Skip to content

Commit 7608c42

Browse files
committed
feat: Introduce ObjectStackCapabilities schema for dynamic runtime capabilities and API discovery
1 parent caf56e8 commit 7608c42

1 file changed

Lines changed: 53 additions & 2 deletions

File tree

packages/spec/src/stack.zod.ts

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ import { FlowSchema } from './automation/flow.zod';
2525
import { RoleSchema } from './auth/role.zod';
2626
import { PermissionSetSchema } from './permission/permission.zod';
2727

28+
import { ApiEndpointSchema } from './api/endpoint.zod';
29+
import { ApiCapabilitiesSchema } from './api/discovery.zod';
30+
import { FeatureFlagSchema } from './system/feature.zod';
31+
2832
// AI Protocol
2933
import { AgentSchema } from './ai/agent.zod';
3034

@@ -36,8 +40,15 @@ import { AgentSchema } from './ai/agent.zod';
3640
* 1. Project Export/Import (YAML/JSON dumps)
3741
* 2. IDE Validation (IntelliSense)
3842
* 3. Runtime Bootstrapping (In-memory loading)
43+
* 4. Platform Reflection (API & Capabilities Discovery)
44+
*/
45+
/**
46+
* 1. CONFIGURATION PROTOCOL (Static)
47+
* ----------------------------------------------------------------------
48+
* Describes the "Source Code" of an ObjectStack Plugin or Project.
49+
* This is what developers write (or AI generates) in `objectstack.config.ts`.
3950
*/
40-
export const ObjectStackSchema = z.object({
51+
export const ObjectStackConfigSchema = z.object({
4152
/** System Configuration */
4253
manifest: ManifestSchema.describe('Project Package Configuration'),
4354
datasources: z.array(DatasourceSchema).optional().describe('External Data Connections'),
@@ -81,4 +92,44 @@ export const ObjectStackSchema = z.object({
8192
agents: z.array(AgentSchema).optional().describe('AI Agents and Assistants'),
8293
});
8394

84-
export type ObjectStack = z.infer<typeof ObjectStackSchema>;
95+
export type ObjectStackConfig = z.infer<typeof ObjectStackConfigSchema>;
96+
97+
// Alias for backward compatibility
98+
export const ObjectStackSchema = ObjectStackConfigSchema;
99+
export type ObjectStack = ObjectStackConfig;
100+
101+
102+
/**
103+
* 2. RUNTIME CAPABILITIES PROTOCOL (Dynamic)
104+
* ----------------------------------------------------------------------
105+
* Describes what the ObjectOS Platform *is* and *can do*.
106+
* AI Agents read this to understand:
107+
* - What APIs are available?
108+
* - What features are enabled?
109+
* - What limits exist?
110+
*/
111+
export const ObjectStackCapabilitiesSchema = z.object({
112+
/** System Identity */
113+
version: z.string().describe('ObjectOS Kernel Version'),
114+
environment: z.enum(['development', 'test', 'staging', 'production']),
115+
116+
/** Active Features & Flags */
117+
features: z.array(FeatureFlagSchema).optional().describe('Active Feature Flags'),
118+
119+
/** API Surface & Discovery */
120+
apis: z.array(ApiEndpointSchema).optional().describe('Available System & Business APIs'),
121+
network: ApiCapabilitiesSchema.optional().describe('Network Capabilities (GraphQL, WS, etc.)'),
122+
123+
/** Introspection */
124+
system_objects: z.array(z.string()).optional().describe('List of globally available System Objects'),
125+
supported_drivers: z.array(z.string()).optional().describe('Available database drivers'),
126+
127+
/** Constraints (for AI Generation) */
128+
limits: z.object({
129+
maxObjects: z.number().optional(),
130+
maxFieldsPerObject: z.number().optional(),
131+
apiRateLimit: z.number().optional()
132+
}).optional()
133+
});
134+
135+
export type ObjectStackCapabilities = z.infer<typeof ObjectStackCapabilitiesSchema>;

0 commit comments

Comments
 (0)