Add distributed state, WASM runtime, registry federation, and AIOps protocols#504
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…code features Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
07de602
into
copilot/improve-microkernel-plugins
There was a problem hiding this comment.
Pull request overview
Extends the spec protocols for enterprise plugin deployments by adding distributed state persistence options, configurable sandbox runtime engines (including WASM), registry federation primitives, and expanded AI protocols for low-code generation and runtime AIOps.
Changes:
- Added distributed-state configuration to advanced plugin lifecycle hot reload settings.
- Added sandbox runtime engine configuration (v8-isolate/wasm/container/process) to advanced plugin security.
- Added registry federation schemas plus new/extended AI schemas for low-code output and runtime AIOps.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/spec/src/system/plugin-lifecycle-advanced.zod.ts | Adds distributed state schema and wires it into hot reload config. |
| packages/spec/src/system/plugin-lifecycle-advanced.test.ts | Adds test coverage for distributed state strategy/config parsing. |
| packages/spec/src/system/plugin-security-advanced.zod.ts | Adds runtime engine configuration to sandbox settings. |
| packages/spec/src/system/plugin-security-advanced.test.ts | Adds test coverage for runtime config + sandbox integration. |
| packages/spec/src/hub/marketplace-enhanced.zod.ts | Adds registry federation schemas (upstreams, sync policy, storage, mirrors). |
| packages/spec/src/hub/marketplace-enhanced.test.ts | Adds test coverage for registry federation schema parsing. |
| packages/spec/src/ai/plugin-development.zod.ts | Extends code generation to support output formats (source-code / low-code-schema / dsl). |
| packages/spec/src/ai/plugin-development.test.ts | Adds test coverage for new outputFormat and low-code schema outputs. |
| packages/spec/src/ai/runtime-ops.zod.ts | Introduces AIOps runtime protocols: anomaly detection, self-healing, scaling, RCA, optimization, agent config. |
| packages/spec/src/ai/runtime-ops.test.ts | Adds test coverage for new AIOps schemas. |
| packages/spec/src/ai/index.ts | Exports the new runtime-ops protocol module. |
| packages/spec/json-schema/system/RuntimeConfig.json | Adds JSON-schema stub entry for RuntimeConfig. |
| packages/spec/json-schema/system/DistributedStateConfig.json | Adds JSON-schema stub entry for DistributedStateConfig. |
| packages/spec/json-schema/hub/RegistryUpstream.json | Adds JSON-schema stub entry for RegistryUpstream. |
| packages/spec/json-schema/hub/RegistrySyncPolicy.json | Adds JSON-schema stub entry for RegistrySyncPolicy. |
| packages/spec/json-schema/hub/RegistryConfig.json | Adds JSON-schema stub entry for RegistryConfig. |
| packages/spec/json-schema/ai/AnomalyDetectionConfig.json | Adds JSON-schema stub entry for AnomalyDetectionConfig. |
| packages/spec/json-schema/ai/SelfHealingAction.json | Adds JSON-schema stub entry for SelfHealingAction. |
| packages/spec/json-schema/ai/SelfHealingConfig.json | Adds JSON-schema stub entry for SelfHealingConfig. |
| packages/spec/json-schema/ai/AutoScalingPolicy.json | Adds JSON-schema stub entry for AutoScalingPolicy. |
| packages/spec/json-schema/ai/RootCauseAnalysisRequest.json | Adds JSON-schema stub entry for RootCauseAnalysisRequest. |
| packages/spec/json-schema/ai/RootCauseAnalysisResult.json | Adds JSON-schema stub entry for RootCauseAnalysisResult. |
| packages/spec/json-schema/ai/PerformanceOptimization.json | Adds JSON-schema stub entry for PerformanceOptimization. |
| packages/spec/json-schema/ai/AIOpsAgentConfig.json | Adds JSON-schema stub entry for AIOpsAgentConfig. |
| content/docs/references/ai/meta.json | Adds runtime-ops to the AI reference navigation metadata. |
| content/docs/references/ai/index.mdx | Adds a docs card linking to the runtime-ops reference page. |
| */ | ||
| engineConfig: z.object({ | ||
| /** | ||
| * WASM-specific settings (when engine is "wasm") | ||
| */ | ||
| wasm: z.object({ | ||
| /** | ||
| * Maximum memory pages (64KB per page) | ||
| */ | ||
| maxMemoryPages: z.number().int().min(1).max(65536).optional() | ||
| .describe('Maximum WASM memory pages (64KB each)'), | ||
|
|
||
| /** | ||
| * Instruction execution limit | ||
| */ | ||
| instructionLimit: z.number().int().min(1).optional() | ||
| .describe('Maximum instructions before timeout'), | ||
|
|
||
| /** | ||
| * Enable SIMD instructions | ||
| */ | ||
| enableSimd: z.boolean().default(false) | ||
| .describe('Enable WebAssembly SIMD support'), | ||
|
|
||
| /** | ||
| * Enable threads | ||
| */ | ||
| enableThreads: z.boolean().default(false) | ||
| .describe('Enable WebAssembly threads'), | ||
|
|
||
| /** | ||
| * Enable bulk memory operations | ||
| */ | ||
| enableBulkMemory: z.boolean().default(true) | ||
| .describe('Enable bulk memory operations'), | ||
| }).optional(), | ||
|
|
||
| /** | ||
| * Container-specific settings (when engine is "container") | ||
| */ | ||
| container: z.object({ | ||
| /** | ||
| * Container image | ||
| */ | ||
| image: z.string().optional() | ||
| .describe('Container image to use'), | ||
|
|
||
| /** | ||
| * Container runtime | ||
| */ | ||
| runtime: z.enum(['docker', 'podman', 'containerd']).default('docker'), | ||
|
|
||
| /** | ||
| * Resource limits | ||
| */ | ||
| resources: z.object({ | ||
| cpuLimit: z.string().optional().describe('CPU limit (e.g., "0.5", "2")'), | ||
| memoryLimit: z.string().optional().describe('Memory limit (e.g., "512m", "1g")'), | ||
| }).optional(), | ||
|
|
||
| /** | ||
| * Network mode | ||
| */ | ||
| networkMode: z.enum(['none', 'bridge', 'host']).default('bridge'), | ||
| }).optional(), | ||
|
|
||
| /** | ||
| * V8 Isolate-specific settings (when engine is "v8-isolate") | ||
| */ | ||
| v8Isolate: z.object({ | ||
| /** | ||
| * Heap size limit in MB | ||
| */ | ||
| heapSizeMb: z.number().int().min(1).optional(), | ||
|
|
||
| /** | ||
| * Enable snapshot | ||
| */ | ||
| enableSnapshot: z.boolean().default(true), | ||
| }).optional(), | ||
| }).optional(), |
There was a problem hiding this comment.
RuntimeConfigSchema doesn’t currently constrain engineConfig based on the selected engine (and engineConfig can be omitted entirely). Consider using a discriminated union on engine (or a refine) so only the matching engine’s config is allowed/required, preventing conflicting configs like providing both wasm and container settings.
| */ | |
| engineConfig: z.object({ | |
| /** | |
| * WASM-specific settings (when engine is "wasm") | |
| */ | |
| wasm: z.object({ | |
| /** | |
| * Maximum memory pages (64KB per page) | |
| */ | |
| maxMemoryPages: z.number().int().min(1).max(65536).optional() | |
| .describe('Maximum WASM memory pages (64KB each)'), | |
| /** | |
| * Instruction execution limit | |
| */ | |
| instructionLimit: z.number().int().min(1).optional() | |
| .describe('Maximum instructions before timeout'), | |
| /** | |
| * Enable SIMD instructions | |
| */ | |
| enableSimd: z.boolean().default(false) | |
| .describe('Enable WebAssembly SIMD support'), | |
| /** | |
| * Enable threads | |
| */ | |
| enableThreads: z.boolean().default(false) | |
| .describe('Enable WebAssembly threads'), | |
| /** | |
| * Enable bulk memory operations | |
| */ | |
| enableBulkMemory: z.boolean().default(true) | |
| .describe('Enable bulk memory operations'), | |
| }).optional(), | |
| /** | |
| * Container-specific settings (when engine is "container") | |
| */ | |
| container: z.object({ | |
| /** | |
| * Container image | |
| */ | |
| image: z.string().optional() | |
| .describe('Container image to use'), | |
| /** | |
| * Container runtime | |
| */ | |
| runtime: z.enum(['docker', 'podman', 'containerd']).default('docker'), | |
| /** | |
| * Resource limits | |
| */ | |
| resources: z.object({ | |
| cpuLimit: z.string().optional().describe('CPU limit (e.g., "0.5", "2")'), | |
| memoryLimit: z.string().optional().describe('Memory limit (e.g., "512m", "1g")'), | |
| }).optional(), | |
| /** | |
| * Network mode | |
| */ | |
| networkMode: z.enum(['none', 'bridge', 'host']).default('bridge'), | |
| }).optional(), | |
| /** | |
| * V8 Isolate-specific settings (when engine is "v8-isolate") | |
| */ | |
| v8Isolate: z.object({ | |
| /** | |
| * Heap size limit in MB | |
| */ | |
| heapSizeMb: z.number().int().min(1).optional(), | |
| /** | |
| * Enable snapshot | |
| */ | |
| enableSnapshot: z.boolean().default(true), | |
| }).optional(), | |
| }).optional(), | |
| * | |
| * Only one engine-specific configuration block is allowed at a time to | |
| * prevent conflicting settings (e.g., both WASM and container configs). | |
| */ | |
| engineConfig: z.union([ | |
| /** | |
| * WASM-specific settings (when engine is "wasm") | |
| */ | |
| z.object({ | |
| wasm: z.object({ | |
| /** | |
| * Maximum memory pages (64KB per page) | |
| */ | |
| maxMemoryPages: z.number().int().min(1).max(65536).optional() | |
| .describe('Maximum WASM memory pages (64KB each)'), | |
| /** | |
| * Instruction execution limit | |
| */ | |
| instructionLimit: z.number().int().min(1).optional() | |
| .describe('Maximum instructions before timeout'), | |
| /** | |
| * Enable SIMD instructions | |
| */ | |
| enableSimd: z.boolean().default(false) | |
| .describe('Enable WebAssembly SIMD support'), | |
| /** | |
| * Enable threads | |
| */ | |
| enableThreads: z.boolean().default(false) | |
| .describe('Enable WebAssembly threads'), | |
| /** | |
| * Enable bulk memory operations | |
| */ | |
| enableBulkMemory: z.boolean().default(true) | |
| .describe('Enable bulk memory operations'), | |
| }).optional(), | |
| }), | |
| /** | |
| * Container-specific settings (when engine is "container") | |
| */ | |
| z.object({ | |
| container: z.object({ | |
| /** | |
| * Container image | |
| */ | |
| image: z.string().optional() | |
| .describe('Container image to use'), | |
| /** | |
| * Container runtime | |
| */ | |
| runtime: z.enum(['docker', 'podman', 'containerd']).default('docker'), | |
| /** | |
| * Resource limits | |
| */ | |
| resources: z.object({ | |
| cpuLimit: z.string().optional().describe('CPU limit (e.g., "0.5", "2")'), | |
| memoryLimit: z.string().optional().describe('Memory limit (e.g., "512m", "1g")'), | |
| }).optional(), | |
| /** | |
| * Network mode | |
| */ | |
| networkMode: z.enum(['none', 'bridge', 'host']).default('bridge'), | |
| }).optional(), | |
| }), | |
| /** | |
| * V8 Isolate-specific settings (when engine is "v8-isolate") | |
| */ | |
| z.object({ | |
| v8Isolate: z.object({ | |
| /** | |
| * Heap size limit in MB | |
| */ | |
| heapSizeMb: z.number().int().min(1).optional(), | |
| /** | |
| * Enable snapshot | |
| */ | |
| enableSnapshot: z.boolean().default(true), | |
| }).optional(), | |
| }), | |
| ]).optional(), |
| /** | ||
| * Sync interval in seconds (for auto sync) | ||
| */ | ||
| syncInterval: z.number().int().min(60).optional() | ||
| .describe('Auto-sync interval in seconds'), |
There was a problem hiding this comment.
syncInterval is described as "for auto sync" but is optional and not validated against syncPolicy. Add a refinement so syncInterval is required when syncPolicy === "auto" (and ideally rejected for manual/proxy to prevent misleading configs).
| username: z.string().optional(), | ||
| password: z.string().optional(), | ||
| token: z.string().optional(), | ||
| apiKey: z.string().optional(), |
There was a problem hiding this comment.
auth validation is too permissive: configs like { type: "bearer" } or { type: "basic", username: "u" } currently pass. Add cross-field validation to require username+password for basic, token for bearer, apiKey for api-key, etc.
| apiKey: z.string().optional(), | |
| apiKey: z.string().optional(), | |
| }).superRefine((value, ctx) => { | |
| switch (value.type) { | |
| case 'basic': { | |
| if (!value.username) { | |
| ctx.addIssue({ | |
| code: z.ZodIssueCode.custom, | |
| path: ['username'], | |
| message: 'username is required when auth type is "basic"', | |
| }); | |
| } | |
| if (!value.password) { | |
| ctx.addIssue({ | |
| code: z.ZodIssueCode.custom, | |
| path: ['password'], | |
| message: 'password is required when auth type is "basic"', | |
| }); | |
| } | |
| break; | |
| } | |
| case 'bearer': { | |
| if (!value.token) { | |
| ctx.addIssue({ | |
| code: z.ZodIssueCode.custom, | |
| path: ['token'], | |
| message: 'token is required when auth type is "bearer"', | |
| }); | |
| } | |
| break; | |
| } | |
| case 'api-key': { | |
| if (!value.apiKey) { | |
| ctx.addIssue({ | |
| code: z.ZodIssueCode.custom, | |
| path: ['apiKey'], | |
| message: 'apiKey is required when auth type is "api-key"', | |
| }); | |
| } | |
| break; | |
| } | |
| case 'oauth2': { | |
| if (!value.token) { | |
| ctx.addIssue({ | |
| code: z.ZodIssueCode.custom, | |
| path: ['token'], | |
| message: 'token is required when auth type is "oauth2"', | |
| }); | |
| } | |
| break; | |
| } | |
| case 'none': | |
| default: | |
| break; | |
| } |
| trigger: z.object({ | ||
| /** | ||
| * Health status that triggers this action | ||
| */ | ||
| healthStatus: z.array(PluginHealthStatusSchema).optional(), |
There was a problem hiding this comment.
SelfHealingActionSchema.trigger can be an empty object, which makes the action impossible to trigger (and likely indicates a misconfiguration). Add a refinement to require at least one of healthStatus, anomalyTypes, errorPatterns, or customCondition to be present/non-empty.
| minInstances: z.number().int().min(1).default(1), | ||
|
|
||
| /** | ||
| * Maximum instances | ||
| */ |
There was a problem hiding this comment.
bounds allows minInstances and maxInstances independently, so minInstances > maxInstances currently passes validation. Add a cross-field check (refine/superRefine) to enforce minInstances <= maxInstances.
| outputFormat: z.enum([ | ||
| 'source-code', // Generate TypeScript/JavaScript source code | ||
| 'low-code-schema', // Generate ObjectStack JSON/YAML schema definitions | ||
| 'dsl', // Generate domain-specific language definitions | ||
| ]).default('source-code') |
There was a problem hiding this comment.
outputFormat is added, but related fields (e.g., language, style, schemaOptions) aren’t constrained by it, so requests can contain incompatible combinations. Consider switching to a z.discriminatedUnion('outputFormat', ...) (or add refinements) to only allow/require fields relevant to each output format.
| /** | ||
| * Distributed state configuration (required when stateStrategy is "distributed") | ||
| */ | ||
| distributedConfig: DistributedStateConfigSchema.optional() | ||
| .describe('Configuration for distributed state management'), |
There was a problem hiding this comment.
distributedConfig is documented as required when stateStrategy is "distributed", but the schema currently allows { stateStrategy: "distributed" } without distributedConfig. Add a .refine/.superRefine to enforce distributedConfig when stateStrategy === "distributed" (and optionally disallow it for other strategies to avoid ambiguous configs).
| /** | ||
| * Custom metric query (when metric is "custom") | ||
| */ | ||
| customMetric: z.string().optional(), | ||
|
|
There was a problem hiding this comment.
customMetric is described as required when metric is "custom", but it’s optional with no validation. Add a refinement so customMetric is required when metric === "custom" (and optionally rejected for non-custom metrics).
| outputFormat: z.enum(['source-code', 'low-code-schema', 'dsl']), | ||
|
|
||
| /** | ||
| * Language used | ||
| * Main plugin code (for source-code format) | ||
| */ |
There was a problem hiding this comment.
GeneratedCodeSchema now includes outputFormat, but code/language are optional regardless of the selected format, allowing incomplete outputs that omit expected fields. Consider modeling this as a discriminated union (or refine) so outputFormat: "source-code" requires code and language, and other formats require their corresponding payload.
| /** | ||
| * Low-code schema definitions (for low-code-schema format) | ||
| */ | ||
| schemas: z.array(z.object({ | ||
| type: z.enum(['object', 'view', 'dashboard', 'app', 'workflow', 'api', 'page']), |
There was a problem hiding this comment.
For outputFormat: "low-code-schema", schemas is optional, so a response can claim low-code output without any schema artifacts. If files isn’t intended to be the sole carrier, add validation to require a non-empty schemas array when outputFormat === "low-code-schema" (or clarify/enforce the intended source of truth).
Extends plugin system with cloud-native primitives for enterprise deployments: distributed state persistence, WebAssembly sandboxing, private registry federation, and AI-driven operations.
Distributed State Management
Added
distributedstate strategy toHotReloadConfigSchemawith Redis/Etcd support:Enables plugin state persistence across Kubernetes pods.
WASM Sandbox Runtime
Added
RuntimeConfigSchematoSandboxConfigwith four isolation engines:Registry Federation
Added
RegistryConfigSchemafor hybrid public/private marketplaces:Supports npm-style scopes, upstream sync (auto/manual/proxy), and HA mirrors.
AI Low-Code Generation
Extended
CodeGenerationRequestSchemawithoutputFormatenum:source-code: Traditional TypeScript/JavaScriptlow-code-schema: ObjectStack JSON/YAML schemasdsl: Domain-specific languageAI generates platform-native metadata instead of raw code.
Runtime AIOps
New file
ai/runtime-ops.zod.tswith autonomous operations protocols:Files Changed
system/plugin-lifecycle-advanced.zod.ts- Distributed statesystem/plugin-security-advanced.zod.ts- WASM runtimehub/marketplace-enhanced.zod.ts- Registry federationai/plugin-development.zod.ts- Low-code generationai/runtime-ops.zod.ts- AIOps (new)All schemas include comprehensive tests (78 new cases, 3232 total passing).
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.