Skip to content

Commit cb897f3

Browse files
Copilothotlong
andcommitted
Add Zod schemas for new contract data structures
Created comprehensive Zod schemas for all data structures in the new contracts added by PR #422: - plugin-validator.zod.ts: ValidationResult, PluginMetadata - startup-orchestrator.zod.ts: StartupOptions, HealthStatus, PluginStartupResult - plugin-lifecycle-events.zod.ts: Event payload schemas and types - service-registry.zod.ts: ServiceMetadata, registry configuration All schemas include: - Full JSDoc documentation with examples - Comprehensive tests (53 test cases, all passing) - Runtime validation support - JSON Schema generation capability - Default values where appropriate - Proper TypeScript type inference Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 175c5bc commit cb897f3

38 files changed

Lines changed: 2679 additions & 0 deletions

content/docs/references/system/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ This section contains all protocol schemas for the system layer of ObjectStack.
2929
<Card href="./object-storage" title="Object Storage" description="Source: packages/spec/src/system/object-storage.zod.ts" />
3030
<Card href="./plugin" title="Plugin" description="Source: packages/spec/src/system/plugin.zod.ts" />
3131
<Card href="./plugin-capability" title="Plugin Capability" description="Source: packages/spec/src/system/plugin-capability.zod.ts" />
32+
<Card href="./plugin-lifecycle-events" title="Plugin Lifecycle Events" description="Source: packages/spec/src/system/plugin-lifecycle-events.zod.ts" />
33+
<Card href="./plugin-validator" title="Plugin Validator" description="Source: packages/spec/src/system/plugin-validator.zod.ts" />
3234
<Card href="./search-engine" title="Search Engine" description="Source: packages/spec/src/system/search-engine.zod.ts" />
35+
<Card href="./service-registry" title="Service Registry" description="Source: packages/spec/src/system/service-registry.zod.ts" />
36+
<Card href="./startup-orchestrator" title="Startup Orchestrator" description="Source: packages/spec/src/system/startup-orchestrator.zod.ts" />
3337
<Card href="./tracing" title="Tracing" description="Source: packages/spec/src/system/tracing.zod.ts" />
3438
<Card href="./translation" title="Translation" description="Source: packages/spec/src/system/translation.zod.ts" />
3539
</Cards>

content/docs/references/system/meta.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
"object-storage",
2323
"plugin",
2424
"plugin-capability",
25+
"plugin-lifecycle-events",
26+
"plugin-validator",
2527
"search-engine",
28+
"service-registry",
29+
"startup-orchestrator",
2630
"tracing",
2731
"translation"
2832
]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$ref": "#/definitions/EventPhase",
3+
"definitions": {
4+
"EventPhase": {
5+
"type": "string",
6+
"enum": [
7+
"init",
8+
"start",
9+
"destroy"
10+
],
11+
"description": "Plugin lifecycle phase"
12+
}
13+
},
14+
"$schema": "http://json-schema.org/draft-07/schema#"
15+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"$ref": "#/definitions/HealthStatus",
3+
"definitions": {
4+
"HealthStatus": {
5+
"type": "object",
6+
"properties": {
7+
"healthy": {
8+
"type": "boolean",
9+
"description": "Whether the plugin is healthy"
10+
},
11+
"timestamp": {
12+
"type": "integer",
13+
"description": "Unix timestamp in milliseconds when health check was performed"
14+
},
15+
"details": {
16+
"type": "object",
17+
"additionalProperties": {},
18+
"description": "Optional plugin-specific health details"
19+
},
20+
"message": {
21+
"type": "string",
22+
"description": "Error message if plugin is unhealthy"
23+
}
24+
},
25+
"required": [
26+
"healthy",
27+
"timestamp"
28+
],
29+
"additionalProperties": false
30+
}
31+
},
32+
"$schema": "http://json-schema.org/draft-07/schema#"
33+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"$ref": "#/definitions/HookRegisteredEvent",
3+
"definitions": {
4+
"HookRegisteredEvent": {
5+
"type": "object",
6+
"properties": {
7+
"hookName": {
8+
"type": "string",
9+
"description": "Name of the hook"
10+
},
11+
"timestamp": {
12+
"type": "integer",
13+
"description": "Unix timestamp in milliseconds"
14+
},
15+
"handlerCount": {
16+
"type": "integer",
17+
"minimum": 0,
18+
"description": "Number of handlers registered for this hook"
19+
}
20+
},
21+
"required": [
22+
"hookName",
23+
"timestamp",
24+
"handlerCount"
25+
],
26+
"additionalProperties": false
27+
}
28+
},
29+
"$schema": "http://json-schema.org/draft-07/schema#"
30+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"$ref": "#/definitions/HookTriggeredEvent",
3+
"definitions": {
4+
"HookTriggeredEvent": {
5+
"type": "object",
6+
"properties": {
7+
"hookName": {
8+
"type": "string",
9+
"description": "Name of the hook"
10+
},
11+
"timestamp": {
12+
"type": "integer",
13+
"description": "Unix timestamp in milliseconds"
14+
},
15+
"args": {
16+
"type": "array",
17+
"description": "Arguments passed to the hook handlers"
18+
},
19+
"handlerCount": {
20+
"type": "integer",
21+
"minimum": 0,
22+
"description": "Number of handlers that will handle this event"
23+
}
24+
},
25+
"required": [
26+
"hookName",
27+
"timestamp",
28+
"args"
29+
],
30+
"additionalProperties": false
31+
}
32+
},
33+
"$schema": "http://json-schema.org/draft-07/schema#"
34+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$ref": "#/definitions/KernelEventBase",
3+
"definitions": {
4+
"KernelEventBase": {
5+
"type": "object",
6+
"properties": {
7+
"timestamp": {
8+
"type": "integer",
9+
"description": "Unix timestamp in milliseconds"
10+
}
11+
},
12+
"required": [
13+
"timestamp"
14+
],
15+
"additionalProperties": false
16+
}
17+
},
18+
"$schema": "http://json-schema.org/draft-07/schema#"
19+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"$ref": "#/definitions/KernelReadyEvent",
3+
"definitions": {
4+
"KernelReadyEvent": {
5+
"type": "object",
6+
"properties": {
7+
"timestamp": {
8+
"type": "integer",
9+
"description": "Unix timestamp in milliseconds"
10+
},
11+
"duration": {
12+
"type": "number",
13+
"minimum": 0,
14+
"description": "Total initialization duration in milliseconds"
15+
},
16+
"pluginCount": {
17+
"type": "integer",
18+
"minimum": 0,
19+
"description": "Number of plugins initialized"
20+
}
21+
},
22+
"required": [
23+
"timestamp"
24+
],
25+
"additionalProperties": false
26+
}
27+
},
28+
"$schema": "http://json-schema.org/draft-07/schema#"
29+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$ref": "#/definitions/KernelShutdownEvent",
3+
"definitions": {
4+
"KernelShutdownEvent": {
5+
"type": "object",
6+
"properties": {
7+
"timestamp": {
8+
"type": "integer",
9+
"description": "Unix timestamp in milliseconds"
10+
},
11+
"reason": {
12+
"type": "string",
13+
"description": "Reason for kernel shutdown"
14+
}
15+
},
16+
"required": [
17+
"timestamp"
18+
],
19+
"additionalProperties": false
20+
}
21+
},
22+
"$schema": "http://json-schema.org/draft-07/schema#"
23+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"$ref": "#/definitions/PluginErrorEvent",
3+
"definitions": {
4+
"PluginErrorEvent": {
5+
"type": "object",
6+
"properties": {
7+
"pluginName": {
8+
"type": "string",
9+
"description": "Name of the plugin"
10+
},
11+
"timestamp": {
12+
"type": "integer",
13+
"description": "Unix timestamp in milliseconds when event occurred"
14+
},
15+
"error": {
16+
"description": "Error object"
17+
},
18+
"phase": {
19+
"type": "string",
20+
"enum": [
21+
"init",
22+
"start",
23+
"destroy"
24+
],
25+
"description": "Lifecycle phase where error occurred"
26+
},
27+
"errorMessage": {
28+
"type": "string",
29+
"description": "Error message"
30+
},
31+
"errorStack": {
32+
"type": "string",
33+
"description": "Error stack trace"
34+
}
35+
},
36+
"required": [
37+
"pluginName",
38+
"timestamp",
39+
"error",
40+
"phase"
41+
],
42+
"additionalProperties": false
43+
}
44+
},
45+
"$schema": "http://json-schema.org/draft-07/schema#"
46+
}

0 commit comments

Comments
 (0)