@xemahq/biome-sdk 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +62 -0
- package/dist/adapter/index.d.ts +7 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter/index.js +23 -0
- package/dist/adapter/index.js.map +1 -0
- package/dist/adapter/lib/action.d.ts +25 -0
- package/dist/adapter/lib/action.d.ts.map +1 -0
- package/dist/adapter/lib/action.js +3 -0
- package/dist/adapter/lib/action.js.map +1 -0
- package/dist/adapter/lib/provider-module.d.ts +41 -0
- package/dist/adapter/lib/provider-module.d.ts.map +1 -0
- package/dist/adapter/lib/provider-module.js +7 -0
- package/dist/adapter/lib/provider-module.js.map +1 -0
- package/dist/adapter/lib/resource.d.ts +25 -0
- package/dist/adapter/lib/resource.d.ts.map +1 -0
- package/dist/adapter/lib/resource.js +3 -0
- package/dist/adapter/lib/resource.js.map +1 -0
- package/dist/adapter/lib/result.d.ts +18 -0
- package/dist/adapter/lib/result.d.ts.map +1 -0
- package/dist/adapter/lib/result.js +12 -0
- package/dist/adapter/lib/result.js.map +1 -0
- package/dist/adapter/lib/sidecar-contract.d.ts +91 -0
- package/dist/adapter/lib/sidecar-contract.d.ts.map +1 -0
- package/dist/adapter/lib/sidecar-contract.js +19 -0
- package/dist/adapter/lib/sidecar-contract.js.map +1 -0
- package/dist/adapter/lib/webhook.d.ts +49 -0
- package/dist/adapter/lib/webhook.d.ts.map +1 -0
- package/dist/adapter/lib/webhook.js +3 -0
- package/dist/adapter/lib/webhook.js.map +1 -0
- package/dist/agent-workspace/index.d.ts +8 -0
- package/dist/agent-workspace/index.d.ts.map +1 -0
- package/dist/agent-workspace/index.js +24 -0
- package/dist/agent-workspace/index.js.map +1 -0
- package/dist/agent-workspace/lib/errors/error-codes.d.ts +16 -0
- package/dist/agent-workspace/lib/errors/error-codes.d.ts.map +1 -0
- package/dist/agent-workspace/lib/errors/error-codes.js +37 -0
- package/dist/agent-workspace/lib/errors/error-codes.js.map +1 -0
- package/dist/agent-workspace/lib/errors/index.d.ts +4 -0
- package/dist/agent-workspace/lib/errors/index.d.ts.map +1 -0
- package/dist/agent-workspace/lib/errors/index.js +20 -0
- package/dist/agent-workspace/lib/errors/index.js.map +1 -0
- package/dist/agent-workspace/lib/errors/mount-plan-error.d.ts +16 -0
- package/dist/agent-workspace/lib/errors/mount-plan-error.d.ts.map +1 -0
- package/dist/agent-workspace/lib/errors/mount-plan-error.js +26 -0
- package/dist/agent-workspace/lib/errors/mount-plan-error.js.map +1 -0
- package/dist/agent-workspace/lib/errors/mount-resolver-error.d.ts +34 -0
- package/dist/agent-workspace/lib/errors/mount-resolver-error.d.ts.map +1 -0
- package/dist/agent-workspace/lib/errors/mount-resolver-error.js +50 -0
- package/dist/agent-workspace/lib/errors/mount-resolver-error.js.map +1 -0
- package/dist/agent-workspace/lib/mount-resolver.d.ts +10 -0
- package/dist/agent-workspace/lib/mount-resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/mount-resolver.js +3 -0
- package/dist/agent-workspace/lib/mount-resolver.js.map +1 -0
- package/dist/agent-workspace/lib/mount-source.d.ts +4 -0
- package/dist/agent-workspace/lib/mount-source.d.ts.map +1 -0
- package/dist/agent-workspace/lib/mount-source.js +3 -0
- package/dist/agent-workspace/lib/mount-source.js.map +1 -0
- package/dist/agent-workspace/lib/refid-resolver.d.ts +23 -0
- package/dist/agent-workspace/lib/refid-resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/refid-resolver.js +103 -0
- package/dist/agent-workspace/lib/refid-resolver.js.map +1 -0
- package/dist/agent-workspace/lib/registries.d.ts +30 -0
- package/dist/agent-workspace/lib/registries.d.ts.map +1 -0
- package/dist/agent-workspace/lib/registries.js +88 -0
- package/dist/agent-workspace/lib/registries.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/agent-definition.resolver.d.ts +13 -0
- package/dist/agent-workspace/lib/resolvers/agent-definition.resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/agent-definition.resolver.js +25 -0
- package/dist/agent-workspace/lib/resolvers/agent-definition.resolver.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/artifact-store-collection.resolver.d.ts +13 -0
- package/dist/agent-workspace/lib/resolvers/artifact-store-collection.resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/artifact-store-collection.resolver.js +28 -0
- package/dist/agent-workspace/lib/resolvers/artifact-store-collection.resolver.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/artifact-version.resolver.d.ts +13 -0
- package/dist/agent-workspace/lib/resolvers/artifact-version.resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/artifact-version.resolver.js +25 -0
- package/dist/agent-workspace/lib/resolvers/artifact-version.resolver.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/clients.d.ts +122 -0
- package/dist/agent-workspace/lib/resolvers/clients.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/clients.js +3 -0
- package/dist/agent-workspace/lib/resolvers/clients.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/deliverable-specs.resolver.d.ts +13 -0
- package/dist/agent-workspace/lib/resolvers/deliverable-specs.resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/deliverable-specs.resolver.js +24 -0
- package/dist/agent-workspace/lib/resolvers/deliverable-specs.resolver.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/deliverables.resolver.d.ts +13 -0
- package/dist/agent-workspace/lib/resolvers/deliverables.resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/deliverables.resolver.js +28 -0
- package/dist/agent-workspace/lib/resolvers/deliverables.resolver.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/index.d.ts +20 -0
- package/dist/agent-workspace/lib/resolvers/index.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/index.js +36 -0
- package/dist/agent-workspace/lib/resolvers/index.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/instruction-section.resolver.d.ts +13 -0
- package/dist/agent-workspace/lib/resolvers/instruction-section.resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/instruction-section.resolver.js +22 -0
- package/dist/agent-workspace/lib/resolvers/instruction-section.resolver.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/kb-pages.resolver.d.ts +13 -0
- package/dist/agent-workspace/lib/resolvers/kb-pages.resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/kb-pages.resolver.js +36 -0
- package/dist/agent-workspace/lib/resolvers/kb-pages.resolver.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/kb-space.resolver.d.ts +13 -0
- package/dist/agent-workspace/lib/resolvers/kb-space.resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/kb-space.resolver.js +26 -0
- package/dist/agent-workspace/lib/resolvers/kb-space.resolver.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/rendered-agents-md.resolver.d.ts +13 -0
- package/dist/agent-workspace/lib/resolvers/rendered-agents-md.resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/rendered-agents-md.resolver.js +23 -0
- package/dist/agent-workspace/lib/resolvers/rendered-agents-md.resolver.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/rendered-context-json.resolver.d.ts +13 -0
- package/dist/agent-workspace/lib/resolvers/rendered-context-json.resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/rendered-context-json.resolver.js +24 -0
- package/dist/agent-workspace/lib/resolvers/rendered-context-json.resolver.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/rendered-system-overlay.resolver.d.ts +13 -0
- package/dist/agent-workspace/lib/resolvers/rendered-system-overlay.resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/rendered-system-overlay.resolver.js +23 -0
- package/dist/agent-workspace/lib/resolvers/rendered-system-overlay.resolver.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/scm-repo.resolver.d.ts +13 -0
- package/dist/agent-workspace/lib/resolvers/scm-repo.resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/scm-repo.resolver.js +28 -0
- package/dist/agent-workspace/lib/resolvers/scm-repo.resolver.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/session-attachment.resolver.d.ts +13 -0
- package/dist/agent-workspace/lib/resolvers/session-attachment.resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/session-attachment.resolver.js +28 -0
- package/dist/agent-workspace/lib/resolvers/session-attachment.resolver.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/skill-bundle.resolver.d.ts +13 -0
- package/dist/agent-workspace/lib/resolvers/skill-bundle.resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/skill-bundle.resolver.js +29 -0
- package/dist/agent-workspace/lib/resolvers/skill-bundle.resolver.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/static-literal.resolver.d.ts +11 -0
- package/dist/agent-workspace/lib/resolvers/static-literal.resolver.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/static-literal.resolver.js +33 -0
- package/dist/agent-workspace/lib/resolvers/static-literal.resolver.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/types.d.ts +35 -0
- package/dist/agent-workspace/lib/resolvers/types.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/types.js +3 -0
- package/dist/agent-workspace/lib/resolvers/types.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/utils/agent-run-context-cache.d.ts +70 -0
- package/dist/agent-workspace/lib/resolvers/utils/agent-run-context-cache.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/utils/agent-run-context-cache.js +90 -0
- package/dist/agent-workspace/lib/resolvers/utils/agent-run-context-cache.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/utils/auth.d.ts +5 -0
- package/dist/agent-workspace/lib/resolvers/utils/auth.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/utils/auth.js +19 -0
- package/dist/agent-workspace/lib/resolvers/utils/auth.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/utils/size-cap.d.ts +3 -0
- package/dist/agent-workspace/lib/resolvers/utils/size-cap.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/utils/size-cap.js +23 -0
- package/dist/agent-workspace/lib/resolvers/utils/size-cap.js.map +1 -0
- package/dist/agent-workspace/lib/resolvers/utils/streaming.d.ts +3 -0
- package/dist/agent-workspace/lib/resolvers/utils/streaming.d.ts.map +1 -0
- package/dist/agent-workspace/lib/resolvers/utils/streaming.js +11 -0
- package/dist/agent-workspace/lib/resolvers/utils/streaming.js.map +1 -0
- package/dist/agent-workspace/lib/workspace-renderer.d.ts +13 -0
- package/dist/agent-workspace/lib/workspace-renderer.d.ts.map +1 -0
- package/dist/agent-workspace/lib/workspace-renderer.js +3 -0
- package/dist/agent-workspace/lib/workspace-renderer.js.map +1 -0
- package/dist/api/index.d.ts +11 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +27 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/lib/api-manifest.d.ts +29 -0
- package/dist/api/lib/api-manifest.d.ts.map +1 -0
- package/dist/api/lib/api-manifest.js +28 -0
- package/dist/api/lib/api-manifest.js.map +1 -0
- package/dist/api/lib/biome-db.d.ts +2 -0
- package/dist/api/lib/biome-db.d.ts.map +1 -0
- package/dist/api/lib/biome-db.js +13 -0
- package/dist/api/lib/biome-db.js.map +1 -0
- package/dist/api/lib/code-tool-context.d.ts +16 -0
- package/dist/api/lib/code-tool-context.d.ts.map +1 -0
- package/dist/api/lib/code-tool-context.js +12 -0
- package/dist/api/lib/code-tool-context.js.map +1 -0
- package/dist/api/lib/code-tool-descriptor.d.ts +49 -0
- package/dist/api/lib/code-tool-descriptor.d.ts.map +1 -0
- package/dist/api/lib/code-tool-descriptor.js +3 -0
- package/dist/api/lib/code-tool-descriptor.js.map +1 -0
- package/dist/api/lib/code-tool.decorator.d.ts +17 -0
- package/dist/api/lib/code-tool.decorator.d.ts.map +1 -0
- package/dist/api/lib/code-tool.decorator.js +38 -0
- package/dist/api/lib/code-tool.decorator.js.map +1 -0
- package/dist/api/lib/mutation-context.d.ts +16 -0
- package/dist/api/lib/mutation-context.d.ts.map +1 -0
- package/dist/api/lib/mutation-context.js +17 -0
- package/dist/api/lib/mutation-context.js.map +1 -0
- package/dist/api/lib/pagination.d.ts +8 -0
- package/dist/api/lib/pagination.d.ts.map +1 -0
- package/dist/api/lib/pagination.js +7 -0
- package/dist/api/lib/pagination.js.map +1 -0
- package/dist/api/lib/provider-kind-mirror.d.ts +7 -0
- package/dist/api/lib/provider-kind-mirror.d.ts.map +1 -0
- package/dist/api/lib/provider-kind-mirror.js +11 -0
- package/dist/api/lib/provider-kind-mirror.js.map +1 -0
- package/dist/api/lib/request-context.d.ts +21 -0
- package/dist/api/lib/request-context.d.ts.map +1 -0
- package/dist/api/lib/request-context.js +51 -0
- package/dist/api/lib/request-context.js.map +1 -0
- package/dist/api/lib/route-registry-entry.d.ts +11 -0
- package/dist/api/lib/route-registry-entry.d.ts.map +1 -0
- package/dist/api/lib/route-registry-entry.js +3 -0
- package/dist/api/lib/route-registry-entry.js.map +1 -0
- package/dist/api/nest/controller-base.d.ts +6 -0
- package/dist/api/nest/controller-base.d.ts.map +1 -0
- package/dist/api/nest/controller-base.js +28 -0
- package/dist/api/nest/controller-base.js.map +1 -0
- package/dist/api/nest/events/events.controller.d.ts +10 -0
- package/dist/api/nest/events/events.controller.d.ts.map +1 -0
- package/dist/api/nest/events/events.controller.js +56 -0
- package/dist/api/nest/events/events.controller.js.map +1 -0
- package/dist/api/nest/health/health.controller.d.ts +19 -0
- package/dist/api/nest/health/health.controller.d.ts.map +1 -0
- package/dist/api/nest/health/health.controller.js +63 -0
- package/dist/api/nest/health/health.controller.js.map +1 -0
- package/dist/api/nest/health/health.module.d.ts +6 -0
- package/dist/api/nest/health/health.module.d.ts.map +1 -0
- package/dist/api/nest/health/health.module.js +29 -0
- package/dist/api/nest/health/health.module.js.map +1 -0
- package/dist/api/nest/index.d.ts +7 -0
- package/dist/api/nest/index.d.ts.map +1 -0
- package/dist/api/nest/index.js +23 -0
- package/dist/api/nest/index.js.map +1 -0
- package/dist/api/nest/module.d.ts +6 -0
- package/dist/api/nest/module.d.ts.map +1 -0
- package/dist/api/nest/module.js +34 -0
- package/dist/api/nest/module.js.map +1 -0
- package/dist/api/nest/request-context.d.ts +17 -0
- package/dist/api/nest/request-context.d.ts.map +1 -0
- package/dist/api/nest/request-context.js +75 -0
- package/dist/api/nest/request-context.js.map +1 -0
- package/dist/builder/index.d.ts +7 -0
- package/dist/builder/index.d.ts.map +1 -0
- package/dist/builder/index.js +23 -0
- package/dist/builder/index.js.map +1 -0
- package/dist/builder/lib/content-walker.d.ts +27 -0
- package/dist/builder/lib/content-walker.d.ts.map +1 -0
- package/dist/builder/lib/content-walker.js +274 -0
- package/dist/builder/lib/content-walker.js.map +1 -0
- package/dist/builder/lib/contribution-schemas.d.ts +348 -0
- package/dist/builder/lib/contribution-schemas.d.ts.map +1 -0
- package/dist/builder/lib/contribution-schemas.js +301 -0
- package/dist/builder/lib/contribution-schemas.js.map +1 -0
- package/dist/builder/lib/define-biome.d.ts +17 -0
- package/dist/builder/lib/define-biome.d.ts.map +1 -0
- package/dist/builder/lib/define-biome.js +11 -0
- package/dist/builder/lib/define-biome.js.map +1 -0
- package/dist/builder/lib/define-helpers.d.ts +6 -0
- package/dist/builder/lib/define-helpers.d.ts.map +1 -0
- package/dist/builder/lib/define-helpers.js +20 -0
- package/dist/builder/lib/define-helpers.js.map +1 -0
- package/dist/builder/lib/extends-precedence.d.ts +14 -0
- package/dist/builder/lib/extends-precedence.d.ts.map +1 -0
- package/dist/builder/lib/extends-precedence.js +113 -0
- package/dist/builder/lib/extends-precedence.js.map +1 -0
- package/dist/builder/lib/workflow-phase-config-loader.d.ts +18 -0
- package/dist/builder/lib/workflow-phase-config-loader.d.ts.map +1 -0
- package/dist/builder/lib/workflow-phase-config-loader.js +78 -0
- package/dist/builder/lib/workflow-phase-config-loader.js.map +1 -0
- package/dist/host/index.d.ts +11 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +38 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/lib/agents-cross-validate.d.ts +7 -0
- package/dist/host/lib/agents-cross-validate.d.ts.map +1 -0
- package/dist/host/lib/agents-cross-validate.js +157 -0
- package/dist/host/lib/agents-cross-validate.js.map +1 -0
- package/dist/host/lib/biome-manifest.d.ts +808 -0
- package/dist/host/lib/biome-manifest.d.ts.map +1 -0
- package/dist/host/lib/biome-manifest.js +490 -0
- package/dist/host/lib/biome-manifest.js.map +1 -0
- package/dist/host/lib/bootstrap-contributions-service.d.ts +35 -0
- package/dist/host/lib/bootstrap-contributions-service.d.ts.map +1 -0
- package/dist/host/lib/bootstrap-contributions-service.js +79 -0
- package/dist/host/lib/bootstrap-contributions-service.js.map +1 -0
- package/dist/host/lib/default-state.d.ts +3 -0
- package/dist/host/lib/default-state.d.ts.map +1 -0
- package/dist/host/lib/default-state.js +20 -0
- package/dist/host/lib/default-state.js.map +1 -0
- package/dist/host/lib/integration-cross-validate.d.ts +12 -0
- package/dist/host/lib/integration-cross-validate.d.ts.map +1 -0
- package/dist/host/lib/integration-cross-validate.js +66 -0
- package/dist/host/lib/integration-cross-validate.js.map +1 -0
- package/dist/host/lib/system-overlay-contribution.d.ts +14 -0
- package/dist/host/lib/system-overlay-contribution.d.ts.map +1 -0
- package/dist/host/lib/system-overlay-contribution.js +3 -0
- package/dist/host/lib/system-overlay-contribution.js.map +1 -0
- package/dist/host/lib/topology.d.ts +7 -0
- package/dist/host/lib/topology.d.ts.map +1 -0
- package/dist/host/lib/topology.js +105 -0
- package/dist/host/lib/topology.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestrator-adapter/index.d.ts +3 -0
- package/dist/orchestrator-adapter/index.d.ts.map +1 -0
- package/dist/orchestrator-adapter/index.js +19 -0
- package/dist/orchestrator-adapter/index.js.map +1 -0
- package/dist/orchestrator-adapter/lib/orchestrator-adapter-registry.d.ts +6 -0
- package/dist/orchestrator-adapter/lib/orchestrator-adapter-registry.d.ts.map +1 -0
- package/dist/orchestrator-adapter/lib/orchestrator-adapter-registry.js +11 -0
- package/dist/orchestrator-adapter/lib/orchestrator-adapter-registry.js.map +1 -0
- package/dist/orchestrator-adapter/lib/orchestrator-adapter.d.ts +11 -0
- package/dist/orchestrator-adapter/lib/orchestrator-adapter.d.ts.map +1 -0
- package/dist/orchestrator-adapter/lib/orchestrator-adapter.js +3 -0
- package/dist/orchestrator-adapter/lib/orchestrator-adapter.js.map +1 -0
- package/package.json +110 -0
- package/src/adapter/index.ts +6 -0
- package/src/adapter/lib/action.ts +60 -0
- package/src/adapter/lib/provider-module.ts +140 -0
- package/src/adapter/lib/resource.ts +52 -0
- package/src/adapter/lib/result.ts +53 -0
- package/src/adapter/lib/sidecar-contract.ts +169 -0
- package/src/adapter/lib/webhook.ts +142 -0
- package/src/agent-workspace/index.ts +7 -0
- package/src/agent-workspace/lib/errors/error-codes.ts +44 -0
- package/src/agent-workspace/lib/errors/index.ts +3 -0
- package/src/agent-workspace/lib/errors/mount-plan-error.ts +29 -0
- package/src/agent-workspace/lib/errors/mount-resolver-error.ts +56 -0
- package/src/agent-workspace/lib/mount-resolver.ts +35 -0
- package/src/agent-workspace/lib/mount-source.ts +11 -0
- package/src/agent-workspace/lib/refid-resolver.ts +135 -0
- package/src/agent-workspace/lib/registries.ts +150 -0
- package/src/agent-workspace/lib/resolvers/agent-definition.resolver.ts +45 -0
- package/src/agent-workspace/lib/resolvers/artifact-store-collection.resolver.ts +43 -0
- package/src/agent-workspace/lib/resolvers/artifact-version.resolver.ts +52 -0
- package/src/agent-workspace/lib/resolvers/clients.ts +297 -0
- package/src/agent-workspace/lib/resolvers/deliverable-specs.resolver.ts +33 -0
- package/src/agent-workspace/lib/resolvers/deliverables.resolver.ts +41 -0
- package/src/agent-workspace/lib/resolvers/index.ts +19 -0
- package/src/agent-workspace/lib/resolvers/instruction-section.resolver.ts +36 -0
- package/src/agent-workspace/lib/resolvers/kb-pages.resolver.ts +62 -0
- package/src/agent-workspace/lib/resolvers/kb-space.resolver.ts +34 -0
- package/src/agent-workspace/lib/resolvers/rendered-agents-md.resolver.ts +40 -0
- package/src/agent-workspace/lib/resolvers/rendered-context-json.resolver.ts +41 -0
- package/src/agent-workspace/lib/resolvers/rendered-system-overlay.resolver.ts +39 -0
- package/src/agent-workspace/lib/resolvers/scm-repo.resolver.ts +43 -0
- package/src/agent-workspace/lib/resolvers/session-attachment.resolver.ts +37 -0
- package/src/agent-workspace/lib/resolvers/skill-bundle.resolver.ts +42 -0
- package/src/agent-workspace/lib/resolvers/static-literal.resolver.ts +69 -0
- package/src/agent-workspace/lib/resolvers/types.ts +94 -0
- package/src/agent-workspace/lib/resolvers/utils/agent-run-context-cache.ts +206 -0
- package/src/agent-workspace/lib/resolvers/utils/auth.ts +39 -0
- package/src/agent-workspace/lib/resolvers/utils/size-cap.ts +38 -0
- package/src/agent-workspace/lib/resolvers/utils/streaming.ts +22 -0
- package/src/agent-workspace/lib/workspace-renderer.ts +25 -0
- package/src/api/index.ts +10 -0
- package/src/api/lib/api-manifest.ts +54 -0
- package/src/api/lib/biome-db.ts +28 -0
- package/src/api/lib/code-tool-context.ts +45 -0
- package/src/api/lib/code-tool-descriptor.ts +102 -0
- package/src/api/lib/code-tool.decorator.ts +111 -0
- package/src/api/lib/mutation-context.ts +49 -0
- package/src/api/lib/pagination.ts +17 -0
- package/src/api/lib/provider-kind-mirror.ts +16 -0
- package/src/api/lib/request-context.ts +90 -0
- package/src/api/lib/route-registry-entry.ts +35 -0
- package/src/api/nest/controller-base.ts +59 -0
- package/src/api/nest/events/events.controller.ts +48 -0
- package/src/api/nest/health/health.controller.ts +36 -0
- package/src/api/nest/health/health.module.ts +29 -0
- package/src/api/nest/index.ts +6 -0
- package/src/api/nest/module.ts +51 -0
- package/src/api/nest/request-context.ts +166 -0
- package/src/builder/index.ts +26 -0
- package/src/builder/lib/content-walker.ts +383 -0
- package/src/builder/lib/contribution-schemas.ts +572 -0
- package/src/builder/lib/define-biome.ts +84 -0
- package/src/builder/lib/define-helpers.ts +42 -0
- package/src/builder/lib/extends-precedence.ts +195 -0
- package/src/builder/lib/workflow-phase-config-loader.ts +163 -0
- package/src/host/index.ts +39 -0
- package/src/host/lib/agents-cross-validate.ts +283 -0
- package/src/host/lib/biome-manifest.ts +1060 -0
- package/src/host/lib/bootstrap-contributions-service.ts +233 -0
- package/src/host/lib/default-state.ts +40 -0
- package/src/host/lib/integration-cross-validate.ts +140 -0
- package/src/host/lib/system-overlay-contribution.ts +53 -0
- package/src/host/lib/topology.ts +174 -0
- package/src/index.ts +58 -0
- package/src/orchestrator-adapter/index.ts +2 -0
- package/src/orchestrator-adapter/lib/orchestrator-adapter-registry.ts +8 -0
- package/src/orchestrator-adapter/lib/orchestrator-adapter.ts +20 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Closed-set scope flag on a biome API endpoint. Mirrors the storage
|
|
5
|
+
* scope concept — every endpoint declares the authorization context
|
|
6
|
+
* its handler needs, so the ingress shim can inject the matching
|
|
7
|
+
* `X-Org-Id` / `X-Project-Id` / `X-Installation-Id` headers from the
|
|
8
|
+
* platform JWT without the biome doing claim parsing.
|
|
9
|
+
*/
|
|
10
|
+
export enum BiomeApiScope {
|
|
11
|
+
Public = 'public',
|
|
12
|
+
Org = 'org',
|
|
13
|
+
Project = 'project',
|
|
14
|
+
Installation = 'installation',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Per-API declaration. Biomes ship one of these per logical API
|
|
19
|
+
* surface under `xema.ships.apis[]`. `name` becomes the subdomain
|
|
20
|
+
* slug — final URL is `<name>.api.<base-domain>` (e.g. `linear.api.xema.dev`).
|
|
21
|
+
* `basePath` is the in-process route prefix (defaults to `/`).
|
|
22
|
+
*
|
|
23
|
+
* Biome-host-api reads these at install time and writes one route-
|
|
24
|
+
* registry entry per API to the Redis store the ingress consults
|
|
25
|
+
* (same primitive the output surface gateway already runs — see
|
|
26
|
+
* `.claude/plans/golden-floating-piglet.md`).
|
|
27
|
+
*/
|
|
28
|
+
export const BiomeApiManifestEntrySchema = z
|
|
29
|
+
.object({
|
|
30
|
+
name: z
|
|
31
|
+
.string()
|
|
32
|
+
.min(1)
|
|
33
|
+
.regex(
|
|
34
|
+
/^[a-z][a-z0-9-]*$/,
|
|
35
|
+
'API name must be lowercase kebab-case; becomes the subdomain slug',
|
|
36
|
+
),
|
|
37
|
+
basePath: z.string().regex(/^\/.*$/).default('/'),
|
|
38
|
+
/** Workspace package the API deployment image is built from. */
|
|
39
|
+
image: z.object({
|
|
40
|
+
package: z.string().min(1),
|
|
41
|
+
port: z.number().int().min(1).max(65_535),
|
|
42
|
+
}),
|
|
43
|
+
/**
|
|
44
|
+
* OpenAPI spec path inside the biome package. Biome-host-api
|
|
45
|
+
* fetches it at install time + warns if the manifest's declared
|
|
46
|
+
* surface (auth scope, scopes used) doesn't match the spec.
|
|
47
|
+
*/
|
|
48
|
+
openapiSpec: z.string().optional(),
|
|
49
|
+
scopes: z.array(z.nativeEnum(BiomeApiScope)).min(1),
|
|
50
|
+
})
|
|
51
|
+
.strict();
|
|
52
|
+
export type BiomeApiManifestEntry = z.infer<typeof BiomeApiManifestEntrySchema>;
|
|
53
|
+
|
|
54
|
+
export const BiomeApiManifestSchema = z.array(BiomeApiManifestEntrySchema);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Set Postgres `search_path` from Prisma's `?schema=` URL parameter.
|
|
3
|
+
*
|
|
4
|
+
* `@prisma/adapter-pg` (Prisma 7's driver-adapter) does NOT honour the
|
|
5
|
+
* `?schema=` URL parameter at runtime — `pg.Pool` ignores it. The
|
|
6
|
+
* parameter is only read by `prisma migrate` to target the right schema.
|
|
7
|
+
* Without explicit `search_path`, runtime queries fall back to
|
|
8
|
+
* Postgres's default (`public`), so biome services that store their
|
|
9
|
+
* tables in a per-biome schema (e.g. `biome_webapp_studio` inside
|
|
10
|
+
* the shared `xema_biomes` database) get
|
|
11
|
+
* `relation "public.<table>" does not exist`.
|
|
12
|
+
*
|
|
13
|
+
* `libpq`'s `options=-c search_path=...` URL param is the canonical
|
|
14
|
+
* fix; `pg` forwards it in the PostgreSQL startup packet so every new
|
|
15
|
+
* connection in the pool has the right `search_path` set.
|
|
16
|
+
*
|
|
17
|
+
* Call this once in `PrismaService`'s constructor before passing the
|
|
18
|
+
* connection string to `PrismaPg`.
|
|
19
|
+
*/
|
|
20
|
+
export function ensureBiomeDbSearchPath(connectionString: string): string {
|
|
21
|
+
const url = new URL(connectionString);
|
|
22
|
+
const schema = url.searchParams.get('schema');
|
|
23
|
+
if (!schema || schema === 'public' || url.searchParams.has('options')) {
|
|
24
|
+
return connectionString;
|
|
25
|
+
}
|
|
26
|
+
url.searchParams.set('options', `-c search_path=${schema},public`);
|
|
27
|
+
return url.toString();
|
|
28
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { BiomeApiRequestContext } from './request-context';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Runtime context handed to a `@BiomeCodeTool` handler. Extends the
|
|
5
|
+
* generic `BiomeApiRequestContext` with the platform-mediated
|
|
6
|
+
* sub-clients biomes use to reach storage, credentials, and
|
|
7
|
+
* outbound integrations — all scope-bound by the platform so biome
|
|
8
|
+
* code cannot cross-tenant leak by construction.
|
|
9
|
+
*
|
|
10
|
+
* Sub-clients are NOT bundled into this SDK — they live in the
|
|
11
|
+
* domain-specific SDKs (`@xemahq/biome-storage-sdk`,
|
|
12
|
+
* `@xemahq/biome-activity-sdk`, ...). The biome's handler factory
|
|
13
|
+
* composes them; this interface is the union of fields the handler
|
|
14
|
+
* is guaranteed to see.
|
|
15
|
+
*/
|
|
16
|
+
export interface CodeToolCtx extends BiomeApiRequestContext {
|
|
17
|
+
/** Mandatory in code-tool context (different from raw biome API). */
|
|
18
|
+
readonly projectId: string;
|
|
19
|
+
/** Mandatory in code-tool context. */
|
|
20
|
+
readonly installationId: string;
|
|
21
|
+
/** Session/allocation the invoking agent runs in (for audit + scope). */
|
|
22
|
+
readonly sessionId: string;
|
|
23
|
+
/** Per-call correlation id surfaced to logs + traces. */
|
|
24
|
+
readonly correlationId: string;
|
|
25
|
+
/**
|
|
26
|
+
* Sub-clients are NOT declared on the kernel interface — biome
|
|
27
|
+
* code receives them via DI in its handler class. The handler
|
|
28
|
+
* implementation decides which sub-clients it depends on.
|
|
29
|
+
*/
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Open-set lookup key for sub-clients. Biomes import these symbols
|
|
34
|
+
* from the relevant SDK; the platform's biome runner wires the
|
|
35
|
+
* matching client at handler resolution time. Closed-set enum kept
|
|
36
|
+
* deliberately small — sub-clients evolve independently.
|
|
37
|
+
*/
|
|
38
|
+
export const CODE_TOOL_CTX_KEYS = {
|
|
39
|
+
orgId: 'orgId',
|
|
40
|
+
projectId: 'projectId',
|
|
41
|
+
installationId: 'installationId',
|
|
42
|
+
sessionId: 'sessionId',
|
|
43
|
+
actorSubject: 'actorSubject',
|
|
44
|
+
correlationId: 'correlationId',
|
|
45
|
+
} as const;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire-format descriptor a biome API exposes via
|
|
3
|
+
* `GET /code-tools-manifest`. The platform's
|
|
4
|
+
* `BiomeCodeToolsProvider` reads this list to project MCP tools for
|
|
5
|
+
* the installation. Pure types — no runtime dependency on NestJS
|
|
6
|
+
* (biome authors free to use any HTTP framework).
|
|
7
|
+
*
|
|
8
|
+
* The biome's API service ships its handlers under
|
|
9
|
+
* `POST /biome-code-tools/:key` (one route per tool). The platform
|
|
10
|
+
* resolver issues the invocation; biome code never sees MCP
|
|
11
|
+
* protocol bytes.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type { ToolProviderKind } from './provider-kind-mirror';
|
|
15
|
+
|
|
16
|
+
/** Output kind hint the platform surfaces to the calling MCP agent. */
|
|
17
|
+
export type BiomeCodeToolOutputKind = 'structured' | 'text' | 'artifact';
|
|
18
|
+
|
|
19
|
+
export interface BiomeCodeToolMountHint {
|
|
20
|
+
readonly slot: 'inputs' | 'references' | 'deliverables';
|
|
21
|
+
readonly as: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface BiomeCodeToolDescriptor {
|
|
25
|
+
readonly key: string;
|
|
26
|
+
readonly displayName: string;
|
|
27
|
+
readonly description: string;
|
|
28
|
+
/**
|
|
29
|
+
* JSON Schema 2020-12 shape the platform exposes to the MCP agent as
|
|
30
|
+
* the tool's `inputSchema`. The biome SDK's decorator emits this
|
|
31
|
+
* automatically from a Zod schema; biomes not using Zod can supply
|
|
32
|
+
* raw JSON Schema directly.
|
|
33
|
+
*/
|
|
34
|
+
readonly inputSchema: Readonly<Record<string, unknown>>;
|
|
35
|
+
/**
|
|
36
|
+
* Hint about the tool's primary output shape. `'structured'` returns
|
|
37
|
+
* a JSON object the agent reads inline; `'text'` returns a plain
|
|
38
|
+
* string; `'artifact'` emits an ArtifactRef the platform fetches +
|
|
39
|
+
* optionally mounts via workspace-proxy (see `mount`).
|
|
40
|
+
*/
|
|
41
|
+
readonly outputKind: BiomeCodeToolOutputKind;
|
|
42
|
+
/**
|
|
43
|
+
* Optional workspace mount target — when present, the platform
|
|
44
|
+
* fetches the returned artifact bytes and applies them to the
|
|
45
|
+
* calling agent's workspace at `/workspace/<slot>/<as>` so the
|
|
46
|
+
* result appears as a regular file.
|
|
47
|
+
*/
|
|
48
|
+
readonly mount?: BiomeCodeToolMountHint;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Body shape of `GET /code-tools-manifest`. */
|
|
52
|
+
export interface BiomeCodeToolsManifestDto {
|
|
53
|
+
readonly tools: readonly BiomeCodeToolDescriptor[];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Body shape of `POST /biome-code-tools/:key`. The platform sends
|
|
58
|
+
* `{args, scope}` and a service token in `Authorization: Bearer`.
|
|
59
|
+
*/
|
|
60
|
+
export interface BiomeCodeToolInvocationDto {
|
|
61
|
+
readonly args: Readonly<Record<string, unknown>>;
|
|
62
|
+
readonly scope: {
|
|
63
|
+
readonly orgId: string;
|
|
64
|
+
readonly projectId: string;
|
|
65
|
+
readonly sessionId: string;
|
|
66
|
+
readonly actorSubject: string | null;
|
|
67
|
+
readonly installationId: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Response shape. Discriminated by `kind`. */
|
|
72
|
+
export type BiomeCodeToolInvocationResult =
|
|
73
|
+
| {
|
|
74
|
+
readonly kind: 'structured';
|
|
75
|
+
readonly value: Readonly<Record<string, unknown>>;
|
|
76
|
+
}
|
|
77
|
+
| {
|
|
78
|
+
readonly kind: 'text';
|
|
79
|
+
readonly value: string;
|
|
80
|
+
}
|
|
81
|
+
| {
|
|
82
|
+
readonly kind: 'artifact';
|
|
83
|
+
readonly artifactRef: {
|
|
84
|
+
readonly artifactId: string;
|
|
85
|
+
readonly versionId: string;
|
|
86
|
+
readonly version: number;
|
|
87
|
+
readonly hash?: string;
|
|
88
|
+
};
|
|
89
|
+
readonly inlineSnippet?: string;
|
|
90
|
+
}
|
|
91
|
+
| {
|
|
92
|
+
readonly kind: 'error';
|
|
93
|
+
readonly message: string;
|
|
94
|
+
readonly retryable?: boolean;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Re-export the mcp-tool-contracts `ToolProviderKind` value used in
|
|
99
|
+
* downstream registries. Kept here for biomes that want to type
|
|
100
|
+
* their tool selection lists without depending on the contracts pkg.
|
|
101
|
+
*/
|
|
102
|
+
export type { ToolProviderKind };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BiomeCodeToolDescriptor,
|
|
3
|
+
BiomeCodeToolMountHint,
|
|
4
|
+
BiomeCodeToolOutputKind,
|
|
5
|
+
} from './code-tool-descriptor';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Metadata key under which `@BiomeCodeTool` decorator data is
|
|
9
|
+
* stored via `reflect-metadata`. The biome's API service scans
|
|
10
|
+
* controllers for this key at boot, builds a manifest, and exposes
|
|
11
|
+
* it through `GET /code-tools-manifest`.
|
|
12
|
+
*
|
|
13
|
+
* Kept as a plain symbol so biome frameworks (NestJS, raw Express,
|
|
14
|
+
* Fastify) can discover decorated methods the same way regardless of
|
|
15
|
+
* which router they use.
|
|
16
|
+
*/
|
|
17
|
+
export const BIOME_CODE_TOOL_METADATA_KEY = Symbol.for(
|
|
18
|
+
'xema.biome.code-tool.descriptor',
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export interface BiomeCodeToolDecoratorOptions {
|
|
22
|
+
readonly key: string;
|
|
23
|
+
readonly displayName: string;
|
|
24
|
+
readonly description: string;
|
|
25
|
+
/**
|
|
26
|
+
* JSON Schema (raw object) describing the input. Biome authors
|
|
27
|
+
* typically generate this from a Zod schema via
|
|
28
|
+
* `zodToJsonSchema(schema)` — kept as plain JSON Schema here so the
|
|
29
|
+
* SDK has no Zod runtime dependency.
|
|
30
|
+
*/
|
|
31
|
+
readonly inputSchema: Readonly<Record<string, unknown>>;
|
|
32
|
+
readonly outputKind: BiomeCodeToolOutputKind;
|
|
33
|
+
readonly mount?: BiomeCodeToolMountHint;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Method decorator that flags a class method as the handler for one
|
|
38
|
+
* MCP code tool. The biome's API service is expected to expose this
|
|
39
|
+
* method at `POST /biome-code-tools/:key`; the discovery scanner
|
|
40
|
+
* builds the route table from these decorators.
|
|
41
|
+
*
|
|
42
|
+
* Usage:
|
|
43
|
+
*
|
|
44
|
+
* ```ts
|
|
45
|
+
* class EmailTools {
|
|
46
|
+
* @BiomeCodeTool({
|
|
47
|
+
* key: 'search-archive',
|
|
48
|
+
* displayName: 'Search Email Archive',
|
|
49
|
+
* description: 'Search archived emails by full-text query.',
|
|
50
|
+
* inputSchema: searchArchiveJsonSchema,
|
|
51
|
+
* outputKind: 'structured',
|
|
52
|
+
* })
|
|
53
|
+
* async searchArchive(args, ctx) { ... }
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* Tenancy: the platform service-token-validates every inbound call
|
|
58
|
+
* and stamps `CodeToolCtx`; handler code receives only scope-bound
|
|
59
|
+
* sub-clients, never raw credentials.
|
|
60
|
+
*/
|
|
61
|
+
export function BiomeCodeTool(
|
|
62
|
+
options: BiomeCodeToolDecoratorOptions,
|
|
63
|
+
): MethodDecorator {
|
|
64
|
+
return ((
|
|
65
|
+
target: object,
|
|
66
|
+
propertyKey: string | symbol,
|
|
67
|
+
descriptor?: PropertyDescriptor,
|
|
68
|
+
): void => {
|
|
69
|
+
void descriptor;
|
|
70
|
+
const desc: BiomeCodeToolDescriptor = {
|
|
71
|
+
key: options.key,
|
|
72
|
+
displayName: options.displayName,
|
|
73
|
+
description: options.description,
|
|
74
|
+
inputSchema: options.inputSchema,
|
|
75
|
+
outputKind: options.outputKind,
|
|
76
|
+
...(options.mount ? { mount: options.mount } : {}),
|
|
77
|
+
};
|
|
78
|
+
const existing = readToolList(target) ?? [];
|
|
79
|
+
existing.push({ methodName: String(propertyKey), descriptor: desc });
|
|
80
|
+
setToolList(target, existing);
|
|
81
|
+
}) as MethodDecorator;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface RegisteredCodeTool {
|
|
85
|
+
readonly methodName: string;
|
|
86
|
+
readonly descriptor: BiomeCodeToolDescriptor;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Read all `@BiomeCodeTool`-decorated methods on a class.
|
|
91
|
+
* Discovery scanners use this to build the biome's tools-manifest.
|
|
92
|
+
*/
|
|
93
|
+
export function getRegisteredCodeTools(
|
|
94
|
+
target: object,
|
|
95
|
+
): readonly RegisteredCodeTool[] {
|
|
96
|
+
return readToolList(target) ?? [];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function readToolList(target: object): RegisteredCodeTool[] | undefined {
|
|
100
|
+
const store = (target as Record<symbol, unknown>)[BIOME_CODE_TOOL_METADATA_KEY];
|
|
101
|
+
return Array.isArray(store) ? (store as RegisteredCodeTool[]) : undefined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function setToolList(target: object, list: RegisteredCodeTool[]): void {
|
|
105
|
+
Object.defineProperty(target, BIOME_CODE_TOOL_METADATA_KEY, {
|
|
106
|
+
value: list,
|
|
107
|
+
enumerable: false,
|
|
108
|
+
writable: true,
|
|
109
|
+
configurable: true,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mutation context threaded through every service mutation — carries
|
|
3
|
+
* the actor identity and correlation ids needed for event publishing
|
|
4
|
+
* and audit trails.
|
|
5
|
+
*
|
|
6
|
+
* Canonical type shared across all biome services. Do NOT redefine
|
|
7
|
+
* per-service.
|
|
8
|
+
*/
|
|
9
|
+
export interface MutationContext {
|
|
10
|
+
actorId: string;
|
|
11
|
+
actorType: 'human' | 'agent' | 'service';
|
|
12
|
+
correlationId: string;
|
|
13
|
+
causationId?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Minimal request-context shape required by biome controller helpers
|
|
18
|
+
* (`requireProjectId`, `mutationContext`). Structurally compatible with
|
|
19
|
+
* `platform-common`'s `RequestContext` — any `RequestContext` instance
|
|
20
|
+
* satisfies this interface without a cast.
|
|
21
|
+
*/
|
|
22
|
+
export interface BiomeMutationRequestContext {
|
|
23
|
+
orgId: string;
|
|
24
|
+
projectId?: string;
|
|
25
|
+
actorId: string;
|
|
26
|
+
/** Any actorType string is accepted; helpers normalise it to the MutationContext closed set. */
|
|
27
|
+
actorType: string;
|
|
28
|
+
correlationId: string;
|
|
29
|
+
causationId?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Build a `MutationContext` from the request context. Normalises the
|
|
34
|
+
* raw `actorType` string to the closed set used by domain services.
|
|
35
|
+
*/
|
|
36
|
+
export function buildMutationContext(ctx: BiomeMutationRequestContext): MutationContext {
|
|
37
|
+
const actorType: MutationContext['actorType'] =
|
|
38
|
+
ctx.actorType === 'agent'
|
|
39
|
+
? 'agent'
|
|
40
|
+
: ctx.actorType === 'service'
|
|
41
|
+
? 'service'
|
|
42
|
+
: 'human';
|
|
43
|
+
return {
|
|
44
|
+
actorId: ctx.actorId,
|
|
45
|
+
actorType,
|
|
46
|
+
correlationId: ctx.correlationId,
|
|
47
|
+
...(ctx.causationId ? { causationId: ctx.causationId } : {}),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Pagination metadata returned by list endpoints. */
|
|
2
|
+
export interface PaginationMeta {
|
|
3
|
+
total: number;
|
|
4
|
+
page: number;
|
|
5
|
+
limit: number;
|
|
6
|
+
totalPages: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Assemble pagination metadata from a Prisma count result and the
|
|
11
|
+
* query parameters. `totalPages` is always at least 1 even on an
|
|
12
|
+
* empty result set so that pagination UI components don't need to
|
|
13
|
+
* guard for zero.
|
|
14
|
+
*/
|
|
15
|
+
export function paginationMeta(total: number, page: number, limit: number): PaginationMeta {
|
|
16
|
+
return { total, page, limit, totalPages: Math.max(1, Math.ceil(total / limit)) };
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mirror of `ToolProviderKind` from `@xemahq/kernel-contracts/mcp-tool` —
|
|
3
|
+
* inlined here so biome-api-sdk stays free of cross-package
|
|
4
|
+
* dependencies on the broader MCP contracts package. The string
|
|
5
|
+
* values MUST stay identical to the kernel enum.
|
|
6
|
+
*
|
|
7
|
+
* Biome authors typically don't need this; it's used internally by
|
|
8
|
+
* the code-tool descriptor types so downstream code that reads a
|
|
9
|
+
* biome's manifest gets a typed kind discriminator.
|
|
10
|
+
*/
|
|
11
|
+
export enum ToolProviderKind {
|
|
12
|
+
McpServer = 'mcp_server',
|
|
13
|
+
Catalog = 'catalog',
|
|
14
|
+
BiomeWorkflowTools = 'biome_workflow_tools',
|
|
15
|
+
BiomeCodeTools = 'biome_code_tools',
|
|
16
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authoritative request context the ingress shim injects on every
|
|
3
|
+
* call to a biome-shipped API. Biomes MUST NOT trust claim parsing
|
|
4
|
+
* inside their own handlers — the shim does the JWT validation, asserts
|
|
5
|
+
* the JWT's `xema_org_id` claim matches the `X-Org-Id` header, and
|
|
6
|
+
* stamps this shape into the request.
|
|
7
|
+
*
|
|
8
|
+
* Identical to `RequestContext` from `@xemahq/platform-common` by
|
|
9
|
+
* intent; redeclared here so the SDK stays free of platform-common
|
|
10
|
+
* imports (Kernel rule).
|
|
11
|
+
*/
|
|
12
|
+
export interface BiomeApiRequestContext {
|
|
13
|
+
readonly orgId: string;
|
|
14
|
+
readonly projectId?: string;
|
|
15
|
+
readonly installationId?: string;
|
|
16
|
+
readonly actorSubject: string;
|
|
17
|
+
readonly actorType: 'user' | 'service';
|
|
18
|
+
/**
|
|
19
|
+
* The biome id this API was deployed under. Surfaced so handlers
|
|
20
|
+
* can self-identify in logs without consulting env vars.
|
|
21
|
+
*/
|
|
22
|
+
readonly biomeId: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Header names the ingress shim sets on every inbound call. Biome
|
|
27
|
+
* authors read them directly (cheap path) or use the SDK's
|
|
28
|
+
* `requireRequestContext(req)` helper.
|
|
29
|
+
*/
|
|
30
|
+
export const BIOME_API_HEADERS = {
|
|
31
|
+
orgId: 'x-org-id',
|
|
32
|
+
projectId: 'x-project-id',
|
|
33
|
+
installationId: 'x-installation-id',
|
|
34
|
+
actorSubject: 'x-actor-subject',
|
|
35
|
+
actorType: 'x-actor-type',
|
|
36
|
+
biomeId: 'x-biome-id',
|
|
37
|
+
} as const;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Pure extractor — runs in any handler shape (NestJS, Express, Fastify,
|
|
41
|
+
* standalone Node). Throws on missing required headers so biome
|
|
42
|
+
* handlers fail fast instead of operating on incomplete context.
|
|
43
|
+
*/
|
|
44
|
+
export function requireRequestContext(
|
|
45
|
+
headers: Readonly<Record<string, string | string[] | undefined>>,
|
|
46
|
+
): BiomeApiRequestContext {
|
|
47
|
+
const orgId = header(headers, BIOME_API_HEADERS.orgId);
|
|
48
|
+
const actorSubject = header(headers, BIOME_API_HEADERS.actorSubject);
|
|
49
|
+
const actorTypeRaw = header(headers, BIOME_API_HEADERS.actorType);
|
|
50
|
+
const biomeId = header(headers, BIOME_API_HEADERS.biomeId);
|
|
51
|
+
if (!orgId || !actorSubject || !actorTypeRaw || !biomeId) {
|
|
52
|
+
throw new BiomeApiContextError(
|
|
53
|
+
'biome API request is missing one or more required headers — ingress shim did not inject context',
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
if (actorTypeRaw !== 'user' && actorTypeRaw !== 'service') {
|
|
57
|
+
throw new BiomeApiContextError(
|
|
58
|
+
`unknown actorType "${actorTypeRaw}" — expected "user" | "service"`,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
const ctx: BiomeApiRequestContext = {
|
|
62
|
+
orgId,
|
|
63
|
+
actorSubject,
|
|
64
|
+
actorType: actorTypeRaw,
|
|
65
|
+
biomeId,
|
|
66
|
+
};
|
|
67
|
+
const projectId = header(headers, BIOME_API_HEADERS.projectId);
|
|
68
|
+
const installationId = header(headers, BIOME_API_HEADERS.installationId);
|
|
69
|
+
return {
|
|
70
|
+
...ctx,
|
|
71
|
+
...(projectId ? { projectId } : {}),
|
|
72
|
+
...(installationId ? { installationId } : {}),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export class BiomeApiContextError extends Error {
|
|
77
|
+
constructor(message: string) {
|
|
78
|
+
super(message);
|
|
79
|
+
this.name = 'BiomeApiContextError';
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function header(
|
|
84
|
+
headers: Readonly<Record<string, string | string[] | undefined>>,
|
|
85
|
+
name: string,
|
|
86
|
+
): string | undefined {
|
|
87
|
+
const value = headers[name] ?? headers[name.toLowerCase()];
|
|
88
|
+
if (Array.isArray(value)) return value[0];
|
|
89
|
+
return value;
|
|
90
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire shape for a single route-registry entry biome-host-api writes
|
|
3
|
+
* to the Redis store the public ingress consults at request time
|
|
4
|
+
* (same primitive as the output surface gateway — see
|
|
5
|
+
* `.claude/plans/golden-floating-piglet.md` Phase 4).
|
|
6
|
+
*
|
|
7
|
+
* Each entry maps `<biomeName>.api.<base-domain>` to an upstream
|
|
8
|
+
* cluster-internal service. The ingress shim:
|
|
9
|
+
* 1. Looks up the entry by subdomain (Redis `GET`).
|
|
10
|
+
* 2. Validates the platform JWT + asserts `xema_org_id` claim matches
|
|
11
|
+
* the request's tenant routing.
|
|
12
|
+
* 3. Strips the JWT, stamps `BIOME_API_HEADERS` from the request
|
|
13
|
+
* context, proxies to the upstream.
|
|
14
|
+
*
|
|
15
|
+
* Biomes NEVER write to this registry directly — biome-host-api owns
|
|
16
|
+
* the lifecycle, removing the entry on uninstall.
|
|
17
|
+
*/
|
|
18
|
+
export interface BiomeApiRouteRegistryEntry {
|
|
19
|
+
readonly subdomain: string;
|
|
20
|
+
readonly biomeId: string;
|
|
21
|
+
readonly upstreamHost: string;
|
|
22
|
+
readonly upstreamPort: number;
|
|
23
|
+
readonly basePath: string;
|
|
24
|
+
/**
|
|
25
|
+
* Closed-set deployment lifecycle marker. `provisioning` blocks
|
|
26
|
+
* traffic until the underlying Helm release reports healthy;
|
|
27
|
+
* `disabled` returns 503 with a clear "admin disabled" message;
|
|
28
|
+
* `active` is the steady state.
|
|
29
|
+
*/
|
|
30
|
+
readonly status: BiomeApiRouteStatus;
|
|
31
|
+
/** ISO-8601. Operators chart entry churn against this. */
|
|
32
|
+
readonly updatedAt: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type BiomeApiRouteStatus = 'provisioning' | 'active' | 'disabled';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { BadRequestException } from '@nestjs/common';
|
|
2
|
+
|
|
3
|
+
import type { MutationContext, BiomeMutationRequestContext } from '../lib/mutation-context.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Abstract base class for biome API controllers. Provides the two
|
|
7
|
+
* helpers that every biome controller needs:
|
|
8
|
+
*
|
|
9
|
+
* - `requireProjectId(ctx)` — asserts the request carries a project
|
|
10
|
+
* scope and throws `400 Bad Request` if it doesn't.
|
|
11
|
+
* - `mutationContext(ctx)` — builds the `MutationContext` passed to
|
|
12
|
+
* domain-service mutation methods.
|
|
13
|
+
*
|
|
14
|
+
* The `ctx` parameter is typed as `BiomeMutationRequestContext`, which
|
|
15
|
+
* is structurally compatible with `platform-common`'s `RequestContext`
|
|
16
|
+
* so no cast is needed at call sites.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* @Controller('things')
|
|
20
|
+
* export class ThingsController extends BiomeApiControllerBase {
|
|
21
|
+
* constructor(private readonly service: ThingsService) {
|
|
22
|
+
* super();
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* @Post()
|
|
26
|
+
* create(@Body() dto: CreateDto, @Ctx() ctx: RequestContext) {
|
|
27
|
+
* return this.service.create(
|
|
28
|
+
* ctx.orgId,
|
|
29
|
+
* this.requireProjectId(ctx),
|
|
30
|
+
* dto,
|
|
31
|
+
* this.mutationContext(ctx),
|
|
32
|
+
* );
|
|
33
|
+
* }
|
|
34
|
+
* }
|
|
35
|
+
*/
|
|
36
|
+
export abstract class BiomeApiControllerBase {
|
|
37
|
+
protected requireProjectId(ctx: BiomeMutationRequestContext): string {
|
|
38
|
+
const projectId = ctx.projectId;
|
|
39
|
+
if (!projectId) {
|
|
40
|
+
throw new BadRequestException('X-Project-Id header is required for this endpoint');
|
|
41
|
+
}
|
|
42
|
+
return projectId;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
protected mutationContext(ctx: BiomeMutationRequestContext): MutationContext {
|
|
46
|
+
const actorType: MutationContext['actorType'] =
|
|
47
|
+
ctx.actorType === 'agent'
|
|
48
|
+
? 'agent'
|
|
49
|
+
: ctx.actorType === 'service'
|
|
50
|
+
? 'service'
|
|
51
|
+
: 'human';
|
|
52
|
+
return {
|
|
53
|
+
actorId: ctx.actorId,
|
|
54
|
+
actorType,
|
|
55
|
+
correlationId: ctx.correlationId,
|
|
56
|
+
...(ctx.causationId ? { causationId: ctx.causationId } : {}),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BadRequestException,
|
|
3
|
+
Body,
|
|
4
|
+
Controller,
|
|
5
|
+
Headers,
|
|
6
|
+
HttpCode,
|
|
7
|
+
HttpStatus,
|
|
8
|
+
Logger,
|
|
9
|
+
Post,
|
|
10
|
+
UseGuards,
|
|
11
|
+
} from '@nestjs/common';
|
|
12
|
+
import { ApiExcludeController, ApiTags } from '@nestjs/swagger';
|
|
13
|
+
import { EventHubWebhookGuard } from '@xemahq/event-hub-client';
|
|
14
|
+
import { EventDispatcherService, handleCloudEventWebhook } from '@xemahq/events/nest';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Shared CloudEvent webhook ingress for biome services. Accepts
|
|
18
|
+
* events pushed by event-hub-api and dispatches them to whichever
|
|
19
|
+
* `@OnCloudEvent`-decorated handler methods are registered.
|
|
20
|
+
*
|
|
21
|
+
* Add this controller to the biome's `EventsModule` and register
|
|
22
|
+
* domain-specific event handlers as providers in that module.
|
|
23
|
+
*/
|
|
24
|
+
@ApiTags('Webhooks')
|
|
25
|
+
@ApiExcludeController()
|
|
26
|
+
@Controller('webhooks')
|
|
27
|
+
export class PluginEventsController {
|
|
28
|
+
private readonly logger = new Logger(PluginEventsController.name);
|
|
29
|
+
|
|
30
|
+
constructor(private readonly dispatcher: EventDispatcherService) {}
|
|
31
|
+
|
|
32
|
+
@Post('events')
|
|
33
|
+
@HttpCode(HttpStatus.OK)
|
|
34
|
+
@UseGuards(EventHubWebhookGuard)
|
|
35
|
+
async handleWebhook(
|
|
36
|
+
@Body() body: unknown,
|
|
37
|
+
@Headers() headers: Record<string, string>,
|
|
38
|
+
): Promise<{ received: boolean }> {
|
|
39
|
+
try {
|
|
40
|
+
await handleCloudEventWebhook(body, headers, this.dispatcher);
|
|
41
|
+
} catch (err) {
|
|
42
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
43
|
+
this.logger.warn(`Rejecting malformed CloudEvent webhook: ${message}`);
|
|
44
|
+
throw new BadRequestException(message);
|
|
45
|
+
}
|
|
46
|
+
return { received: true };
|
|
47
|
+
}
|
|
48
|
+
}
|