@zhin.js/agent 1.1.22 → 1.1.26
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/README.md +54 -25
- package/lib/activity-feedback/adapter-integration.d.ts +1 -1
- package/lib/activity-feedback/adapter-integration.d.ts.map +1 -1
- package/lib/activity-feedback/index.d.ts +0 -1
- package/lib/activity-feedback/index.d.ts.map +1 -1
- package/lib/activity-feedback/index.js +0 -1
- package/lib/activity-feedback/index.js.map +1 -1
- package/lib/activity-feedback/subagent-prefix.d.ts +1 -1
- package/lib/activity-feedback/subagent-prefix.js +1 -1
- package/lib/ai-event-bus.d.ts +6 -10
- package/lib/ai-event-bus.d.ts.map +1 -1
- package/lib/ai-event-bus.js +0 -13
- package/lib/ai-event-bus.js.map +1 -1
- package/lib/ai-event-contract.d.ts +43 -0
- package/lib/ai-event-contract.d.ts.map +1 -0
- package/lib/ai-event-contract.js +2 -0
- package/lib/ai-event-contract.js.map +1 -0
- package/lib/ai-event-subscriber.d.ts +3 -5
- package/lib/ai-event-subscriber.d.ts.map +1 -1
- package/lib/ai-event-subscriber.js +0 -19
- package/lib/ai-event-subscriber.js.map +1 -1
- package/lib/ai-hook-runtime-bus.d.ts +3 -4
- package/lib/ai-hook-runtime-bus.d.ts.map +1 -1
- package/lib/ai-hook-runtime-bus.js +2 -3
- package/lib/ai-hook-runtime-bus.js.map +1 -1
- package/lib/assistant/deliver-schedule-to-adapter.d.ts +2 -4
- package/lib/assistant/deliver-schedule-to-adapter.d.ts.map +1 -1
- package/lib/assistant/deliver-schedule-to-adapter.js +1 -8
- package/lib/assistant/deliver-schedule-to-adapter.js.map +1 -1
- package/lib/assistant/domains/ha-home-backend.d.ts.map +1 -1
- package/lib/assistant/domains/ha-home-backend.js +1 -2
- package/lib/assistant/domains/ha-home-backend.js.map +1 -1
- package/lib/assistant/domains/ha-ws-transport.d.ts.map +1 -1
- package/lib/assistant/domains/ha-ws-transport.js +1 -2
- package/lib/assistant/domains/ha-ws-transport.js.map +1 -1
- package/lib/assistant/domains/home-state-watch.d.ts.map +1 -1
- package/lib/assistant/domains/home-state-watch.js +1 -2
- package/lib/assistant/domains/home-state-watch.js.map +1 -1
- package/lib/assistant/event-ingress.d.ts.map +1 -1
- package/lib/assistant/event-ingress.js +1 -2
- package/lib/assistant/event-ingress.js.map +1 -1
- package/lib/assistant/home-policy.d.ts +1 -1
- package/lib/assistant/home-policy.d.ts.map +1 -1
- package/lib/assistant/home-tools.d.ts.map +1 -1
- package/lib/assistant/home-tools.js.map +1 -1
- package/lib/assistant/index.d.ts +2 -2
- package/lib/assistant/index.d.ts.map +1 -1
- package/lib/assistant/index.js +2 -2
- package/lib/assistant/index.js.map +1 -1
- package/lib/assistant/job-engine.d.ts +3 -2
- package/lib/assistant/job-engine.d.ts.map +1 -1
- package/lib/assistant/job-engine.js +6 -4
- package/lib/assistant/job-engine.js.map +1 -1
- package/lib/assistant/job-scheduler.d.ts +2 -2
- package/lib/assistant/job-scheduler.d.ts.map +1 -1
- package/lib/assistant/job-scheduler.js +2 -11
- package/lib/assistant/job-scheduler.js.map +1 -1
- package/lib/assistant/job-worker.js +1 -1
- package/lib/assistant/job-worker.js.map +1 -1
- package/lib/assistant/notification-router.d.ts.map +1 -1
- package/lib/assistant/notification-router.js +2 -2
- package/lib/assistant/notification-router.js.map +1 -1
- package/lib/assistant/profile-loader.d.ts +0 -4
- package/lib/assistant/profile-loader.d.ts.map +1 -1
- package/lib/assistant/profile-loader.js +0 -4
- package/lib/assistant/profile-loader.js.map +1 -1
- package/lib/assistant/schedule-skills.d.ts.map +1 -1
- package/lib/assistant/schedule-skills.js +5 -7
- package/lib/assistant/schedule-skills.js.map +1 -1
- package/lib/authoring/bridge.d.ts +2 -16
- package/lib/authoring/bridge.d.ts.map +1 -1
- package/lib/authoring/bridge.js +1 -74
- package/lib/authoring/bridge.js.map +1 -1
- package/lib/authoring/disable-tool.d.ts +2 -2
- package/lib/authoring/disable-tool.d.ts.map +1 -1
- package/lib/authoring/disable-tool.js +2 -2
- package/lib/authoring/disable-tool.js.map +1 -1
- package/lib/authoring/index.d.ts +1 -11
- package/lib/authoring/index.d.ts.map +1 -1
- package/lib/authoring/index.js +1 -6
- package/lib/authoring/index.js.map +1 -1
- package/lib/authoring/types.d.ts +3 -116
- package/lib/authoring/types.d.ts.map +1 -1
- package/lib/authoring/types.js.map +1 -1
- package/lib/bootstrap.d.ts +3 -8
- package/lib/bootstrap.d.ts.map +1 -1
- package/lib/bootstrap.js +9 -29
- package/lib/bootstrap.js.map +1 -1
- package/lib/builtins/builtin-tool-service.d.ts +2 -1
- package/lib/builtins/builtin-tool-service.d.ts.map +1 -1
- package/lib/builtins/builtin-tool-service.js +16 -5
- package/lib/builtins/builtin-tool-service.js.map +1 -1
- package/lib/config/fix-ai-config.d.ts.map +1 -1
- package/lib/config/fix-ai-config.js +0 -57
- package/lib/config/fix-ai-config.js.map +1 -1
- package/lib/config/index.d.ts +2 -1
- package/lib/config/index.d.ts.map +1 -1
- package/lib/config/index.js +2 -1
- package/lib/config/index.js.map +1 -1
- package/lib/config/provider-instance.d.ts +3 -3
- package/lib/config/provider-instance.d.ts.map +1 -1
- package/lib/config/provider-instance.js.map +1 -1
- package/lib/config/resolve-five-agent-binding.d.ts +1 -1
- package/lib/config/resolve-five-agent-binding.d.ts.map +1 -1
- package/lib/config/validate-ai-config.d.ts +0 -1
- package/lib/config/validate-ai-config.d.ts.map +1 -1
- package/lib/config/validate-ai-config.js +0 -229
- package/lib/config/validate-ai-config.js.map +1 -1
- package/lib/config/zhin-agent-config.d.ts +1 -1
- package/lib/config/zhin-agent-config.d.ts.map +1 -1
- package/lib/config/zhin-agent-defaults.js +4 -4
- package/lib/config/zhin-agent-dependencies.d.ts +5 -5
- package/lib/config/zhin-agent-dependencies.d.ts.map +1 -1
- package/lib/context/agents-instruction.d.ts +0 -1
- package/lib/context/agents-instruction.d.ts.map +1 -1
- package/lib/context/agents-instruction.js +1 -14
- package/lib/context/agents-instruction.js.map +1 -1
- package/lib/context/context-system.d.ts.map +1 -1
- package/lib/context/context-system.js +2 -2
- package/lib/context/context-system.js.map +1 -1
- package/lib/context/index.d.ts +1 -1
- package/lib/context/index.d.ts.map +1 -1
- package/lib/context/index.js +1 -1
- package/lib/context/index.js.map +1 -1
- package/lib/context/turn-user-message.d.ts.map +1 -1
- package/lib/context/turn-user-message.js +1 -2
- package/lib/context/turn-user-message.js.map +1 -1
- package/lib/core/agent-core-run.d.ts.map +1 -1
- package/lib/core/agent-core-run.js +17 -16
- package/lib/core/agent-core-run.js.map +1 -1
- package/lib/core/agent-loop-standalone.d.ts +2 -1
- package/lib/core/agent-loop-standalone.d.ts.map +1 -1
- package/lib/core/agent-loop-standalone.js +19 -18
- package/lib/core/agent-loop-standalone.js.map +1 -1
- package/lib/core/tool-calls-user-format.d.ts.map +1 -1
- package/lib/core/tool-calls-user-format.js +2 -76
- package/lib/core/tool-calls-user-format.js.map +1 -1
- package/lib/create-agent-session.d.ts +1 -1
- package/lib/create-agent-session.d.ts.map +1 -1
- package/lib/create-agent-session.js +2 -2
- package/lib/create-agent-session.js.map +1 -1
- package/lib/data-governance/disclosure-authority.d.ts +38 -0
- package/lib/data-governance/disclosure-authority.d.ts.map +1 -0
- package/lib/data-governance/disclosure-authority.js +2 -0
- package/lib/data-governance/disclosure-authority.js.map +1 -0
- package/lib/data-governance/governance-authority-repository.d.ts +3 -0
- package/lib/data-governance/governance-authority-repository.d.ts.map +1 -1
- package/lib/data-governance/governance-authority-repository.js +10 -1
- package/lib/data-governance/governance-authority-repository.js.map +1 -1
- package/lib/deferred-worker-runner.d.ts +2 -1
- package/lib/deferred-worker-runner.d.ts.map +1 -1
- package/lib/deferred-worker-runner.js +6 -4
- package/lib/deferred-worker-runner.js.map +1 -1
- package/lib/discovery/agent-surface-info.d.ts +5 -9
- package/lib/discovery/agent-surface-info.d.ts.map +1 -1
- package/lib/discovery/agent-surface-info.js +81 -45
- package/lib/discovery/agent-surface-info.js.map +1 -1
- package/lib/discovery/agent-surface.d.ts +2 -22
- package/lib/discovery/agent-surface.d.ts.map +1 -1
- package/lib/discovery/agent-surface.js +72 -287
- package/lib/discovery/agent-surface.js.map +1 -1
- package/lib/discovery/agents.d.ts +10 -12
- package/lib/discovery/agents.d.ts.map +1 -1
- package/lib/discovery/agents.js +91 -90
- package/lib/discovery/agents.js.map +1 -1
- package/lib/discovery/utils.d.ts +2 -15
- package/lib/discovery/utils.d.ts.map +1 -1
- package/lib/discovery/utils.js +2 -76
- package/lib/discovery/utils.js.map +1 -1
- package/lib/event/agent-stream-hooks.d.ts +0 -2
- package/lib/event/agent-stream-hooks.d.ts.map +1 -1
- package/lib/event/agent-stream-hooks.js +0 -8
- package/lib/event/agent-stream-hooks.js.map +1 -1
- package/lib/event/ai-event-bus.d.ts +13 -0
- package/lib/event/ai-event-bus.d.ts.map +1 -0
- package/lib/event/ai-event-bus.js +45 -0
- package/lib/event/ai-event-bus.js.map +1 -0
- package/lib/event/event-emitter.d.ts +8 -14
- package/lib/event/event-emitter.d.ts.map +1 -1
- package/lib/event/event-emitter.js +7 -37
- package/lib/event/event-emitter.js.map +1 -1
- package/lib/index.d.ts +42 -74
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +29 -58
- package/lib/index.js.map +1 -1
- package/lib/init/activate-ai-database-storage.d.ts +1 -1
- package/lib/init/activate-ai-database-storage.d.ts.map +1 -1
- package/lib/init/activate-ai-database-storage.js +28 -32
- package/lib/init/activate-ai-database-storage.js.map +1 -1
- package/lib/init/compose-zhin-agent-runtime.d.ts +2 -0
- package/lib/init/compose-zhin-agent-runtime.d.ts.map +1 -1
- package/lib/init/compose-zhin-agent-runtime.js +1 -0
- package/lib/init/compose-zhin-agent-runtime.js.map +1 -1
- package/lib/init/configure-zhin-agent.d.ts +3 -4
- package/lib/init/configure-zhin-agent.d.ts.map +1 -1
- package/lib/init/configure-zhin-agent.js +9 -7
- package/lib/init/configure-zhin-agent.js.map +1 -1
- package/lib/init/define-ai-database-models.js +1 -1
- package/lib/init/dispose-zhin-agent.d.ts +1 -1
- package/lib/init/dispose-zhin-agent.d.ts.map +1 -1
- package/lib/init/dispose-zhin-agent.js +0 -1
- package/lib/init/dispose-zhin-agent.js.map +1 -1
- package/lib/init/runtime-management-commands.d.ts +1 -2
- package/lib/init/runtime-management-commands.d.ts.map +1 -1
- package/lib/init/runtime-management-commands.js.map +1 -1
- package/lib/internal/agent-host.d.ts +10 -5
- package/lib/internal/agent-host.d.ts.map +1 -1
- package/lib/internal/host-types.d.ts +5 -7
- package/lib/internal/host-types.d.ts.map +1 -1
- package/lib/mcp-client/bridge.d.ts +1 -2
- package/lib/mcp-client/bridge.d.ts.map +1 -1
- package/lib/mcp-client/bridge.js +1 -2
- package/lib/mcp-client/bridge.js.map +1 -1
- package/lib/media/media-publisher.d.ts +1 -1
- package/lib/media/media-publisher.d.ts.map +1 -1
- package/lib/media/media-router.d.ts +4 -7
- package/lib/media/media-router.d.ts.map +1 -1
- package/lib/media/media-router.js +10 -26
- package/lib/media/media-router.js.map +1 -1
- package/lib/media/media-types.d.ts +4 -0
- package/lib/media/media-types.d.ts.map +1 -1
- package/lib/media/media-types.js.map +1 -1
- package/lib/media/resolve-config.d.ts +0 -1
- package/lib/media/resolve-config.d.ts.map +1 -1
- package/lib/media/resolve-config.js +0 -3
- package/lib/media/resolve-config.js.map +1 -1
- package/lib/media/subagent-inbound.d.ts +3 -2
- package/lib/media/subagent-inbound.d.ts.map +1 -1
- package/lib/media/subagent-inbound.js +5 -8
- package/lib/media/subagent-inbound.js.map +1 -1
- package/lib/memory/ai-compaction-strategy.d.ts +3 -2
- package/lib/memory/ai-compaction-strategy.d.ts.map +1 -1
- package/lib/memory/ai-compaction-strategy.js +4 -1
- package/lib/memory/ai-compaction-strategy.js.map +1 -1
- package/lib/memory/compaction-runtime.d.ts +23 -14
- package/lib/memory/compaction-runtime.d.ts.map +1 -1
- package/lib/memory/compaction-runtime.js +92 -76
- package/lib/memory/compaction-runtime.js.map +1 -1
- package/lib/memory/context-repository-store.js +1 -1
- package/lib/memory/context-repository-store.js.map +1 -1
- package/lib/memory/index.d.ts +2 -2
- package/lib/memory/index.d.ts.map +1 -1
- package/lib/memory/index.js +1 -1
- package/lib/memory/index.js.map +1 -1
- package/lib/memory/memory-system.d.ts.map +1 -1
- package/lib/memory/memory-system.js +5 -6
- package/lib/memory/memory-system.js.map +1 -1
- package/lib/memory-layers.d.ts +2 -6
- package/lib/memory-layers.d.ts.map +1 -1
- package/lib/memory-layers.js +23 -75
- package/lib/memory-layers.js.map +1 -1
- package/lib/orchestration/five-agent/index.d.ts.map +1 -0
- package/lib/orchestration/five-agent/index.js.map +1 -0
- package/lib/orchestration/five-agent/prompts.d.ts.map +1 -0
- package/lib/orchestration/five-agent/prompts.js.map +1 -0
- package/lib/orchestration/five-agent/role-capability-policy.d.ts.map +1 -0
- package/lib/orchestration/five-agent/role-capability-policy.js.map +1 -0
- package/lib/orchestration/five-agent/roles.d.ts.map +1 -0
- package/lib/orchestration/five-agent/roles.js.map +1 -0
- package/lib/plugin-ai-hook-bus.d.ts +3 -7
- package/lib/plugin-ai-hook-bus.d.ts.map +1 -1
- package/lib/plugin-ai-hook-bus.js +1 -7
- package/lib/plugin-ai-hook-bus.js.map +1 -1
- package/lib/plugin-runtime/agent-event-bus.d.ts +4 -0
- package/lib/plugin-runtime/agent-event-bus.d.ts.map +1 -0
- package/lib/plugin-runtime/agent-event-bus.js +4 -0
- package/lib/plugin-runtime/agent-event-bus.js.map +1 -0
- package/lib/plugin-runtime/agent-host-port.d.ts +0 -6
- package/lib/plugin-runtime/agent-host-port.d.ts.map +1 -1
- package/lib/plugin-runtime/agent-host-port.js.map +1 -1
- package/lib/plugin-runtime/agent-runtime.d.ts +1 -1
- package/lib/plugin-runtime/agent-runtime.d.ts.map +1 -1
- package/lib/plugin-runtime/agent-runtime.js +9 -4
- package/lib/plugin-runtime/agent-runtime.js.map +1 -1
- package/lib/plugin-runtime/capability-ingress.d.ts +1 -1
- package/lib/plugin-runtime/capability-ingress.d.ts.map +1 -1
- package/lib/plugin-runtime/capability-ingress.js +118 -12
- package/lib/plugin-runtime/capability-ingress.js.map +1 -1
- package/lib/plugin-runtime/capability-tools.d.ts.map +1 -1
- package/lib/plugin-runtime/capability-tools.js +5 -3
- package/lib/plugin-runtime/capability-tools.js.map +1 -1
- package/lib/plugin-runtime/deferred-capability-plan.d.ts.map +1 -1
- package/lib/plugin-runtime/deferred-capability-plan.js +50 -21
- package/lib/plugin-runtime/deferred-capability-plan.js.map +1 -1
- package/lib/plugin-runtime/file-edit-quote-utils.d.ts.map +1 -0
- package/lib/plugin-runtime/file-edit-quote-utils.js.map +1 -0
- package/lib/plugin-runtime/full-agent-turn-engine.d.ts.map +1 -1
- package/lib/plugin-runtime/full-agent-turn-engine.js +10 -10
- package/lib/plugin-runtime/full-agent-turn-engine.js.map +1 -1
- package/lib/plugin-runtime/github-actions-delivery-provider.d.ts +44 -0
- package/lib/plugin-runtime/github-actions-delivery-provider.d.ts.map +1 -0
- package/lib/plugin-runtime/github-actions-delivery-provider.js +246 -0
- package/lib/plugin-runtime/github-actions-delivery-provider.js.map +1 -0
- package/lib/plugin-runtime/github-exact-merge-gateway.d.ts +62 -0
- package/lib/plugin-runtime/github-exact-merge-gateway.d.ts.map +1 -0
- package/lib/plugin-runtime/github-exact-merge-gateway.js +79 -0
- package/lib/plugin-runtime/github-exact-merge-gateway.js.map +1 -0
- package/lib/plugin-runtime/github-workroom-capability.d.ts +15 -0
- package/lib/plugin-runtime/github-workroom-capability.d.ts.map +1 -0
- package/lib/plugin-runtime/github-workroom-capability.js +79 -0
- package/lib/plugin-runtime/github-workroom-capability.js.map +1 -0
- package/lib/plugin-runtime/host-tool-projection.d.ts +1 -1
- package/lib/plugin-runtime/host-tool-projection.d.ts.map +1 -1
- package/lib/plugin-runtime/host-tool-projection.js +5 -3
- package/lib/plugin-runtime/host-tool-projection.js.map +1 -1
- package/lib/plugin-runtime/index.d.ts +29 -1
- package/lib/plugin-runtime/index.d.ts.map +1 -1
- package/lib/plugin-runtime/index.js +26 -1
- package/lib/plugin-runtime/index.js.map +1 -1
- package/lib/plugin-runtime/native-bash-tool.d.ts +35 -0
- package/lib/plugin-runtime/native-bash-tool.d.ts.map +1 -0
- package/lib/plugin-runtime/native-bash-tool.js +110 -0
- package/lib/plugin-runtime/native-bash-tool.js.map +1 -0
- package/lib/plugin-runtime/native-file-tools.d.ts.map +1 -1
- package/lib/plugin-runtime/native-file-tools.js +10 -9
- package/lib/plugin-runtime/native-file-tools.js.map +1 -1
- package/lib/plugin-runtime/native-image-tool.d.ts +12 -0
- package/lib/plugin-runtime/native-image-tool.d.ts.map +1 -0
- package/lib/plugin-runtime/native-image-tool.js +73 -0
- package/lib/plugin-runtime/native-image-tool.js.map +1 -0
- package/lib/plugin-runtime/native-interaction-tools.js +1 -1
- package/lib/plugin-runtime/native-interaction-tools.js.map +1 -1
- package/lib/plugin-runtime/native-knowledge-tool.d.ts +34 -0
- package/lib/plugin-runtime/native-knowledge-tool.d.ts.map +1 -0
- package/lib/plugin-runtime/native-knowledge-tool.js +170 -0
- package/lib/plugin-runtime/native-knowledge-tool.js.map +1 -0
- package/lib/plugin-runtime/native-semantic-memory-tools.js +2 -2
- package/lib/plugin-runtime/native-semantic-memory-tools.js.map +1 -1
- package/lib/plugin-runtime/native-todo-tools.js +2 -2
- package/lib/plugin-runtime/native-todo-tools.js.map +1 -1
- package/lib/plugin-runtime/native-tool-suite.d.ts +15 -0
- package/lib/plugin-runtime/native-tool-suite.d.ts.map +1 -0
- package/lib/plugin-runtime/native-tool-suite.js +18 -0
- package/lib/plugin-runtime/native-tool-suite.js.map +1 -0
- package/lib/plugin-runtime/native-web-tools.d.ts.map +1 -1
- package/lib/plugin-runtime/native-web-tools.js +6 -19
- package/lib/plugin-runtime/native-web-tools.js.map +1 -1
- package/lib/plugin-runtime/schedule-capability-plan.js +6 -1
- package/lib/plugin-runtime/schedule-capability-plan.js.map +1 -1
- package/lib/plugin-runtime/self-delivery-project-composition.d.ts +25 -0
- package/lib/plugin-runtime/self-delivery-project-composition.d.ts.map +1 -0
- package/lib/plugin-runtime/self-delivery-project-composition.js +85 -0
- package/lib/plugin-runtime/self-delivery-project-composition.js.map +1 -0
- package/lib/plugin-runtime/self-delivery-project.d.ts +65 -0
- package/lib/plugin-runtime/self-delivery-project.d.ts.map +1 -0
- package/lib/plugin-runtime/self-delivery-project.js +140 -0
- package/lib/plugin-runtime/self-delivery-project.js.map +1 -0
- package/lib/plugin-runtime/workroom-acceptance-internal-providers.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-acceptance-internal-providers.js +7 -2
- package/lib/plugin-runtime/workroom-acceptance-internal-providers.js.map +1 -1
- package/lib/plugin-runtime/workroom-acceptance-production-composition.d.ts +2 -0
- package/lib/plugin-runtime/workroom-acceptance-production-composition.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-acceptance-production-composition.js +1 -0
- package/lib/plugin-runtime/workroom-acceptance-production-composition.js.map +1 -1
- package/lib/plugin-runtime/workroom-acceptance-provider-composition.d.ts +3 -0
- package/lib/plugin-runtime/workroom-acceptance-provider-composition.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-acceptance-provider-composition.js +43 -6
- package/lib/plugin-runtime/workroom-acceptance-provider-composition.js.map +1 -1
- package/lib/plugin-runtime/workroom-accepted-source-runtime.d.ts +1 -1
- package/lib/plugin-runtime/workroom-accepted-source-runtime.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-assignment-authority-provider.d.ts +3 -77
- package/lib/plugin-runtime/workroom-assignment-authority-provider.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-assignment-authority-provider.js +12 -112
- package/lib/plugin-runtime/workroom-assignment-authority-provider.js.map +1 -1
- package/lib/plugin-runtime/workroom-assignment-knowledge-composition.d.ts +1 -1
- package/lib/plugin-runtime/workroom-assignment-knowledge-composition.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-data-governance-authority-writer.d.ts +2 -0
- package/lib/plugin-runtime/workroom-data-governance-authority-writer.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-data-governance-authority-writer.js +24 -0
- package/lib/plugin-runtime/workroom-data-governance-authority-writer.js.map +1 -1
- package/lib/plugin-runtime/workroom-data-governance-bootstrap.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-data-governance-bootstrap.js +19 -0
- package/lib/plugin-runtime/workroom-data-governance-bootstrap.js.map +1 -1
- package/lib/plugin-runtime/workroom-data-governance-runtime.d.ts +4 -38
- package/lib/plugin-runtime/workroom-data-governance-runtime.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-data-governance-runtime.js +145 -42
- package/lib/plugin-runtime/workroom-data-governance-runtime.js.map +1 -1
- package/lib/plugin-runtime/workroom-data-governance-storage.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-data-governance-storage.js +1 -2
- package/lib/plugin-runtime/workroom-data-governance-storage.js.map +1 -1
- package/lib/plugin-runtime/workroom-delivery-gateway.d.ts +96 -0
- package/lib/plugin-runtime/workroom-delivery-gateway.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-delivery-gateway.js +129 -0
- package/lib/plugin-runtime/workroom-delivery-gateway.js.map +1 -0
- package/lib/plugin-runtime/workroom-dynamic-planning-provider.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-dynamic-planning-provider.js +2 -1
- package/lib/plugin-runtime/workroom-dynamic-planning-provider.js.map +1 -1
- package/lib/plugin-runtime/workroom-effect-composition.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-effect-composition.js +12 -1
- package/lib/plugin-runtime/workroom-effect-composition.js.map +1 -1
- package/lib/plugin-runtime/workroom-effect-production.d.ts +5 -0
- package/lib/plugin-runtime/workroom-effect-production.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-effect-production.js +22 -3
- package/lib/plugin-runtime/workroom-effect-production.js.map +1 -1
- package/lib/plugin-runtime/workroom-effect-runtime.d.ts +1 -17
- package/lib/plugin-runtime/workroom-effect-runtime.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-effect-runtime.js +77 -17
- package/lib/plugin-runtime/workroom-effect-runtime.js.map +1 -1
- package/lib/plugin-runtime/workroom-governed-dispatch-composition.d.ts +8 -3
- package/lib/plugin-runtime/workroom-governed-dispatch-composition.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-governed-dispatch-composition.js +21 -18
- package/lib/plugin-runtime/workroom-governed-dispatch-composition.js.map +1 -1
- package/lib/plugin-runtime/workroom-journal-payload-composition.d.ts +1 -1
- package/lib/plugin-runtime/workroom-journal-payload-composition.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-journal-payload-composition.js +1 -1
- package/lib/plugin-runtime/workroom-journal-payload-composition.js.map +1 -1
- package/lib/plugin-runtime/workroom-local-agent-core-adapter.js +3 -3
- package/lib/plugin-runtime/workroom-local-agent-core-adapter.js.map +1 -1
- package/lib/plugin-runtime/workroom-local-agent-loop.d.ts +2 -1
- package/lib/plugin-runtime/workroom-local-agent-loop.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-local-agent-loop.js +11 -1
- package/lib/plugin-runtime/workroom-local-agent-loop.js.map +1 -1
- package/lib/{workroom/local-assignment-executor.d.ts → plugin-runtime/workroom-local-assignment-executor.d.ts} +4 -4
- package/lib/plugin-runtime/workroom-local-assignment-executor.d.ts.map +1 -0
- package/lib/{workroom/local-assignment-executor.js → plugin-runtime/workroom-local-assignment-executor.js} +3 -3
- package/lib/plugin-runtime/workroom-local-assignment-executor.js.map +1 -0
- package/lib/plugin-runtime/workroom-local-assignment-runtime.d.ts +1 -0
- package/lib/plugin-runtime/workroom-local-assignment-runtime.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-local-assignment-runtime.js +72 -26
- package/lib/plugin-runtime/workroom-local-assignment-runtime.js.map +1 -1
- package/lib/plugin-runtime/workroom-portfolio-checkpoint-ack.d.ts +1 -1
- package/lib/plugin-runtime/workroom-portfolio-checkpoint-ack.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-portfolio-control-composition.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-portfolio-control-composition.js +1 -0
- package/lib/plugin-runtime/workroom-portfolio-control-composition.js.map +1 -1
- package/lib/plugin-runtime/workroom-portfolio-control-runtime.d.ts +1 -0
- package/lib/plugin-runtime/workroom-portfolio-control-runtime.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-portfolio-control-runtime.js +1 -0
- package/lib/plugin-runtime/workroom-portfolio-control-runtime.js.map +1 -1
- package/lib/plugin-runtime/workroom-portfolio-grant-assignment.d.ts +1 -1
- package/lib/plugin-runtime/workroom-portfolio-grant-assignment.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-portfolio-grant-assignment.js +6 -3
- package/lib/plugin-runtime/workroom-portfolio-grant-assignment.js.map +1 -1
- package/lib/plugin-runtime/workroom-portfolio-kernel-authority.d.ts +1 -1
- package/lib/plugin-runtime/workroom-portfolio-kernel-authority.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-portfolio-kernel-authority.js +11 -5
- package/lib/plugin-runtime/workroom-portfolio-kernel-authority.js.map +1 -1
- package/lib/plugin-runtime/workroom-preemption-runtime.d.ts +1 -1
- package/lib/plugin-runtime/workroom-preemption-runtime.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-priority-authority.d.ts +11 -3
- package/lib/plugin-runtime/workroom-priority-authority.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-priority-authority.js +51 -47
- package/lib/plugin-runtime/workroom-priority-authority.js.map +1 -1
- package/lib/plugin-runtime/workroom-profile-authority-composition.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-profile-authority-composition.js +2 -1
- package/lib/plugin-runtime/workroom-profile-authority-composition.js.map +1 -1
- package/lib/plugin-runtime/workroom-profile-authority-runtime.d.ts +1 -0
- package/lib/plugin-runtime/workroom-profile-authority-runtime.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-profile-authority-runtime.js +1 -0
- package/lib/plugin-runtime/workroom-profile-authority-runtime.js.map +1 -1
- package/lib/plugin-runtime/workroom-projection-outbound.d.ts +1 -1
- package/lib/plugin-runtime/workroom-projection-outbound.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-projection-runtime.d.ts +6 -4
- package/lib/plugin-runtime/workroom-projection-runtime.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-projection-runtime.js +11 -1
- package/lib/plugin-runtime/workroom-projection-runtime.js.map +1 -1
- package/lib/plugin-runtime/workroom-remote-callback-runtime.d.ts +2 -2
- package/lib/plugin-runtime/workroom-remote-callback-runtime.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-remote-executor.d.ts +1 -12
- package/lib/plugin-runtime/workroom-remote-executor.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-remote-executor.js +1 -20
- package/lib/plugin-runtime/workroom-remote-executor.js.map +1 -1
- package/lib/plugin-runtime/workroom-run-profile-pin-authority.d.ts +1 -1
- package/lib/plugin-runtime/workroom-run-profile-pin-authority.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-scheduler-portfolio-composition.d.ts +8 -1
- package/lib/plugin-runtime/workroom-scheduler-portfolio-composition.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-scheduler-portfolio-composition.js +4 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-composition.js.map +1 -1
- package/lib/plugin-runtime/workroom-scheduler-portfolio-request-authority.d.ts +4 -1
- package/lib/plugin-runtime/workroom-scheduler-portfolio-request-authority.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-scheduler-portfolio-request-authority.js +23 -6
- package/lib/plugin-runtime/workroom-scheduler-portfolio-request-authority.js.map +1 -1
- package/lib/plugin-runtime/workroom-scheduler-portfolio-supply.d.ts +5 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-supply.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-scheduler-portfolio-supply.js +20 -1
- package/lib/plugin-runtime/workroom-scheduler-portfolio-supply.js.map +1 -1
- package/lib/plugin-runtime/workroom-scheduler-runtime.d.ts +1 -1
- package/lib/plugin-runtime/workroom-scheduler-runtime.d.ts.map +1 -1
- package/lib/plugin-runtime/workroom-scheduler-runtime.js +6 -1
- package/lib/plugin-runtime/workroom-scheduler-runtime.js.map +1 -1
- package/lib/prompt/assembly.d.ts.map +1 -1
- package/lib/prompt/assembly.js +1 -2
- package/lib/prompt/assembly.js.map +1 -1
- package/lib/prompt/git-context.d.ts +0 -2
- package/lib/prompt/git-context.d.ts.map +1 -1
- package/lib/prompt/git-context.js +1 -12
- package/lib/prompt/git-context.js.map +1 -1
- package/lib/prompt/index.d.ts +1 -1
- package/lib/prompt/index.d.ts.map +1 -1
- package/lib/prompt/index.js +1 -1
- package/lib/prompt/index.js.map +1 -1
- package/lib/prompt/prompt-assembly-registry.d.ts +1 -1
- package/lib/prompt/prompt-assembly-registry.d.ts.map +1 -1
- package/lib/prompt/prompt-assembly-registry.js.map +1 -1
- package/lib/prompt/system-prompt.d.ts +1 -1
- package/lib/prompt/system-prompt.d.ts.map +1 -1
- package/lib/prompt/system-prompt.js +1 -2
- package/lib/prompt/system-prompt.js.map +1 -1
- package/lib/prompt/templates.d.ts +2 -5
- package/lib/prompt/templates.d.ts.map +1 -1
- package/lib/prompt/templates.js +2 -16
- package/lib/prompt/templates.js.map +1 -1
- package/lib/prompt/workspace-prompt.d.ts +0 -1
- package/lib/prompt/workspace-prompt.d.ts.map +1 -1
- package/lib/prompt/workspace-prompt.js +1 -14
- package/lib/prompt/workspace-prompt.js.map +1 -1
- package/lib/reserved-tools.d.ts.map +1 -1
- package/lib/reserved-tools.js +0 -3
- package/lib/reserved-tools.js.map +1 -1
- package/lib/resource-hub/hook-registry.d.ts +1 -1
- package/lib/resource-hub/hook-registry.d.ts.map +1 -1
- package/lib/resource-hub/hook-registry.js +3 -15
- package/lib/resource-hub/hook-registry.js.map +1 -1
- package/lib/resource-hub/index.d.ts +4 -16
- package/lib/resource-hub/index.d.ts.map +1 -1
- package/lib/resource-hub/index.js +3 -20
- package/lib/resource-hub/index.js.map +1 -1
- package/lib/resource-hub/mcp-registry.js +1 -1
- package/lib/resource-hub/mcp-registry.js.map +1 -1
- package/lib/resource-hub/public-api.d.ts +0 -1
- package/lib/resource-hub/public-api.d.ts.map +1 -1
- package/lib/resource-hub/resolve-subagent-tools.d.ts.map +1 -1
- package/lib/resource-hub/resolve-subagent-tools.js +6 -4
- package/lib/resource-hub/resolve-subagent-tools.js.map +1 -1
- package/lib/resource-hub/role-configs.js +4 -4
- package/lib/resource-hub/role-configs.js.map +1 -1
- package/lib/resource-hub/skill-registry.d.ts +1 -1
- package/lib/resource-hub/skill-registry.js +1 -1
- package/lib/resource-hub/subagent-registry.d.ts +0 -2
- package/lib/resource-hub/subagent-registry.d.ts.map +1 -1
- package/lib/resource-hub/subagent-registry.js +0 -2
- package/lib/resource-hub/subagent-registry.js.map +1 -1
- package/lib/resource-hub/tool-selection.d.ts +4 -30
- package/lib/resource-hub/tool-selection.d.ts.map +1 -1
- package/lib/resource-hub/tool-selection.js +4 -289
- package/lib/resource-hub/tool-selection.js.map +1 -1
- package/lib/resource-hub/types.d.ts +6 -1
- package/lib/resource-hub/types.d.ts.map +1 -1
- package/lib/routing/route-matcher.d.ts +1 -1
- package/lib/routing/route-matcher.js +1 -1
- package/lib/schedule-manager.d.ts.map +1 -1
- package/lib/schedule-manager.js.map +1 -1
- package/lib/seam/index.d.ts +4 -3
- package/lib/seam/index.d.ts.map +1 -1
- package/lib/seam/index.js +1 -1
- package/lib/seam/index.js.map +1 -1
- package/lib/seam/seam-integration.d.ts +26 -37
- package/lib/seam/seam-integration.d.ts.map +1 -1
- package/lib/seam/seam-integration.js +82 -52
- package/lib/seam/seam-integration.js.map +1 -1
- package/lib/seam/seam-provider.d.ts +2 -1
- package/lib/seam/seam-provider.d.ts.map +1 -1
- package/lib/seam/seam-provider.js +25 -11
- package/lib/seam/seam-provider.js.map +1 -1
- package/lib/seam/skill-service.d.ts +0 -21
- package/lib/seam/skill-service.d.ts.map +1 -1
- package/lib/seam/tokens.d.ts +3 -2
- package/lib/seam/tokens.d.ts.map +1 -1
- package/lib/seam/tokens.js +3 -1
- package/lib/seam/tokens.js.map +1 -1
- package/lib/seam/tool-service.d.ts +12 -6
- package/lib/seam/tool-service.d.ts.map +1 -1
- package/lib/security/anomaly-detection.d.ts +2 -7
- package/lib/security/anomaly-detection.d.ts.map +1 -1
- package/lib/security/anomaly-detection.js +2 -20
- package/lib/security/anomaly-detection.js.map +1 -1
- package/lib/security/audit-logger.d.ts +0 -13
- package/lib/security/audit-logger.d.ts.map +1 -1
- package/lib/security/audit-logger.js +0 -30
- package/lib/security/audit-logger.js.map +1 -1
- package/lib/security/comm-message-context.d.ts +4 -0
- package/lib/security/comm-message-context.d.ts.map +1 -1
- package/lib/security/comm-message-context.js +9 -1
- package/lib/security/comm-message-context.js.map +1 -1
- package/lib/security/dangerous-tool-policy.d.ts +3 -3
- package/lib/security/dangerous-tool-policy.d.ts.map +1 -1
- package/lib/security/dangerous-tool-policy.js +8 -28
- package/lib/security/dangerous-tool-policy.js.map +1 -1
- package/lib/security/exec-policy.d.ts +4 -4
- package/lib/security/exec-policy.d.ts.map +1 -1
- package/lib/security/exec-policy.js +21 -62
- package/lib/security/exec-policy.js.map +1 -1
- package/lib/security/file-policy.d.ts.map +1 -1
- package/lib/security/file-policy.js +9 -57
- package/lib/security/file-policy.js.map +1 -1
- package/lib/security/file-role-policy.d.ts +1 -5
- package/lib/security/file-role-policy.d.ts.map +1 -1
- package/lib/security/file-role-policy.js +1 -25
- package/lib/security/file-role-policy.js.map +1 -1
- package/lib/security/index.d.ts +1 -1
- package/lib/security/index.d.ts.map +1 -1
- package/lib/security/index.js +1 -1
- package/lib/security/index.js.map +1 -1
- package/lib/security/owner-approval-contracts.d.ts +6 -0
- package/lib/security/owner-approval-contracts.d.ts.map +1 -0
- package/lib/security/owner-approval-contracts.js +2 -0
- package/lib/security/owner-approval-contracts.js.map +1 -0
- package/lib/security/owner-approval-runtime.d.ts +39 -0
- package/lib/security/owner-approval-runtime.d.ts.map +1 -0
- package/lib/security/owner-approval-runtime.js +159 -0
- package/lib/security/owner-approval-runtime.js.map +1 -0
- package/lib/security/owner-approval-store.d.ts +34 -0
- package/lib/security/owner-approval-store.d.ts.map +1 -0
- package/lib/security/owner-approval-store.js +154 -0
- package/lib/security/owner-approval-store.js.map +1 -0
- package/lib/security/policy-facade.d.ts +8 -15
- package/lib/security/policy-facade.d.ts.map +1 -1
- package/lib/security/policy-facade.js +33 -38
- package/lib/security/policy-facade.js.map +1 -1
- package/lib/security/sandbox.d.ts +0 -13
- package/lib/security/sandbox.d.ts.map +1 -1
- package/lib/security/sandbox.js +0 -21
- package/lib/security/sandbox.js.map +1 -1
- package/lib/security/turn-file-authority.d.ts.map +1 -1
- package/lib/security/turn-file-authority.js +0 -1
- package/lib/security/turn-file-authority.js.map +1 -1
- package/lib/service.d.ts +15 -19
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +42 -39
- package/lib/service.js.map +1 -1
- package/lib/session/approval-port.d.ts +16 -0
- package/lib/session/approval-port.d.ts.map +1 -1
- package/lib/session/approval-port.js.map +1 -1
- package/lib/session/approval-review-agent.d.ts +29 -0
- package/lib/session/approval-review-agent.d.ts.map +1 -0
- package/lib/session/approval-review-agent.js +183 -0
- package/lib/session/approval-review-agent.js.map +1 -0
- package/lib/session/branch-summarization-runtime.d.ts.map +1 -1
- package/lib/session/branch-summarization-runtime.js +3 -2
- package/lib/session/branch-summarization-runtime.js.map +1 -1
- package/lib/session/index.d.ts +2 -2
- package/lib/session/index.d.ts.map +1 -1
- package/lib/session/index.js +2 -2
- package/lib/session/index.js.map +1 -1
- package/lib/session/session-io.d.ts +7 -14
- package/lib/session/session-io.d.ts.map +1 -1
- package/lib/session/session-io.js +14 -47
- package/lib/session/session-io.js.map +1 -1
- package/lib/session/turn-ingress-session.d.ts +2 -5
- package/lib/session/turn-ingress-session.d.ts.map +1 -1
- package/lib/session/turn-ingress-session.js +8 -51
- package/lib/session/turn-ingress-session.js.map +1 -1
- package/lib/skill/skill-instruction-reader-factory.d.ts +5 -0
- package/lib/skill/skill-instruction-reader-factory.d.ts.map +1 -0
- package/lib/skill/skill-instruction-reader-factory.js +13 -0
- package/lib/skill/skill-instruction-reader-factory.js.map +1 -0
- package/lib/skill/skill-instruction-reader.d.ts +22 -0
- package/lib/skill/skill-instruction-reader.d.ts.map +1 -0
- package/lib/skill/skill-instruction-reader.js +44 -0
- package/lib/skill/skill-instruction-reader.js.map +1 -0
- package/lib/skill/skill-instructions.d.ts +5 -0
- package/lib/skill/skill-instructions.d.ts.map +1 -0
- package/lib/skill/skill-instructions.js +78 -0
- package/lib/skill/skill-instructions.js.map +1 -0
- package/lib/skill/skill-registry-as-service.d.ts +5 -5
- package/lib/skill/skill-registry-as-service.d.ts.map +1 -1
- package/lib/skill/skill-registry-as-service.js +21 -16
- package/lib/skill/skill-registry-as-service.js.map +1 -1
- package/lib/skill/skill-system.js +3 -3
- package/lib/skill/skill-system.js.map +1 -1
- package/lib/{builtin → spawn}/spawn-task-tool.d.ts +5 -6
- package/lib/spawn/spawn-task-tool.d.ts.map +1 -0
- package/lib/{builtin → spawn}/spawn-task-tool.js +17 -15
- package/lib/spawn/spawn-task-tool.js.map +1 -0
- package/lib/stability/memory-pressure.d.ts +5 -4
- package/lib/stability/memory-pressure.d.ts.map +1 -1
- package/lib/stability/memory-pressure.js +14 -23
- package/lib/stability/memory-pressure.js.map +1 -1
- package/lib/standalone/standalone-tool-catalog.d.ts +13 -0
- package/lib/standalone/standalone-tool-catalog.d.ts.map +1 -0
- package/lib/standalone/standalone-tool-catalog.js +46 -0
- package/lib/standalone/standalone-tool-catalog.js.map +1 -0
- package/lib/subagent/subagent-runtime.d.ts +7 -5
- package/lib/subagent/subagent-runtime.d.ts.map +1 -1
- package/lib/subagent/subagent-runtime.js +13 -16
- package/lib/subagent/subagent-runtime.js.map +1 -1
- package/lib/subagent/subagent-system-init.d.ts +2 -1
- package/lib/subagent/subagent-system-init.d.ts.map +1 -1
- package/lib/subagent/subagent-system-init.js +1 -0
- package/lib/subagent/subagent-system-init.js.map +1 -1
- package/lib/subagent-ai-events.d.ts +3 -2
- package/lib/subagent-ai-events.d.ts.map +1 -1
- package/lib/subagent-ai-events.js.map +1 -1
- package/lib/subagent-parent-context.js +1 -1
- package/lib/subagent-parent-context.js.map +1 -1
- package/lib/subagent-prompt.d.ts +1 -1
- package/lib/subagent-prompt.js +2 -5
- package/lib/subagent-prompt.js.map +1 -1
- package/lib/task-executor.d.ts +2 -14
- package/lib/task-executor.d.ts.map +1 -1
- package/lib/task-executor.js +2 -11
- package/lib/task-executor.js.map +1 -1
- package/lib/tool/builtin-policy-extractors.d.ts +2 -1
- package/lib/tool/builtin-policy-extractors.d.ts.map +1 -1
- package/lib/tool/builtin-policy-extractors.js +18 -15
- package/lib/tool/builtin-policy-extractors.js.map +1 -1
- package/lib/tool/context-tools.js +1 -1
- package/lib/tool/context-tools.js.map +1 -1
- package/lib/tool/conversation-reference-tool.d.ts.map +1 -1
- package/lib/tool/conversation-reference-tool.js +1 -1
- package/lib/tool/conversation-reference-tool.js.map +1 -1
- package/lib/tool/deferred-resolution.js +2 -2
- package/lib/tool/deferred-resolution.js.map +1 -1
- package/lib/tool/executable-tool-registry.d.ts +11 -0
- package/lib/tool/executable-tool-registry.d.ts.map +1 -0
- package/lib/tool/executable-tool-registry.js +25 -0
- package/lib/tool/executable-tool-registry.js.map +1 -0
- package/lib/tool/index.d.ts +1 -1
- package/lib/tool/index.d.ts.map +1 -1
- package/lib/tool/index.js +1 -1
- package/lib/tool/index.js.map +1 -1
- package/lib/tool/prepare-turn-tools.d.ts.map +1 -1
- package/lib/tool/prepare-turn-tools.js +1 -2
- package/lib/tool/prepare-turn-tools.js.map +1 -1
- package/lib/tool/sources.d.ts.map +1 -1
- package/lib/tool/sources.js +5 -4
- package/lib/tool/sources.js.map +1 -1
- package/lib/tool/tool-approval-gate.d.ts +1 -2
- package/lib/tool/tool-approval-gate.d.ts.map +1 -1
- package/lib/tool/tool-approval-gate.js +24 -0
- package/lib/tool/tool-approval-gate.js.map +1 -1
- package/lib/tool/tool-execution-authority.d.ts +26 -0
- package/lib/tool/tool-execution-authority.d.ts.map +1 -0
- package/lib/tool/tool-execution-authority.js +84 -0
- package/lib/tool/tool-execution-authority.js.map +1 -0
- package/lib/tool/tool-runtime.d.ts +10 -9
- package/lib/tool/tool-runtime.d.ts.map +1 -1
- package/lib/tool/tool-runtime.js +77 -79
- package/lib/tool/tool-runtime.js.map +1 -1
- package/lib/tool/tool-system.js +1 -1
- package/lib/tool/tool-system.js.map +1 -1
- package/lib/tool/turn-tool-runtime.d.ts +6 -2
- package/lib/tool/turn-tool-runtime.d.ts.map +1 -1
- package/lib/tool/turn-tool-runtime.js +19 -5
- package/lib/tool/turn-tool-runtime.js.map +1 -1
- package/lib/tool-catalog/deferred-turn-controller.d.ts +2 -2
- package/lib/tool-catalog/deferred-turn-controller.d.ts.map +1 -1
- package/lib/tool-catalog/deferred-turn-controller.js +4 -4
- package/lib/tool-catalog/deferred-turn-controller.js.map +1 -1
- package/lib/turn/deferred-auto-continue.js +1 -1
- package/lib/turn/deferred-auto-continue.js.map +1 -1
- package/lib/turn/deferred-delivery.js +1 -1
- package/lib/turn/deferred-delivery.js.map +1 -1
- package/lib/turn/inbound-media.d.ts +8 -1
- package/lib/turn/inbound-media.d.ts.map +1 -1
- package/lib/turn/inbound-media.js +4 -6
- package/lib/turn/inbound-media.js.map +1 -1
- package/lib/turn/index.d.ts +2 -2
- package/lib/turn/index.d.ts.map +1 -1
- package/lib/turn/index.js +2 -2
- package/lib/turn/index.js.map +1 -1
- package/lib/turn/persist-deferred-context.js +1 -1
- package/lib/turn/prompt-api.d.ts +3 -4
- package/lib/turn/prompt-api.d.ts.map +1 -1
- package/lib/turn/prompt-api.js +7 -11
- package/lib/turn/prompt-api.js.map +1 -1
- package/lib/turn/task-continuation.d.ts +0 -5
- package/lib/turn/task-continuation.d.ts.map +1 -1
- package/lib/turn/task-continuation.js +0 -15
- package/lib/turn/task-continuation.js.map +1 -1
- package/lib/turn/turn-ingress.d.ts +1 -1
- package/lib/turn/turn-ingress.d.ts.map +1 -1
- package/lib/turn/turn-metrics.d.ts +0 -4
- package/lib/turn/turn-metrics.d.ts.map +1 -1
- package/lib/turn/turn-metrics.js +0 -8
- package/lib/turn/turn-metrics.js.map +1 -1
- package/lib/turn/turn-pipeline.js +7 -4
- package/lib/turn/turn-pipeline.js.map +1 -1
- package/lib/typing-indicator/adapter-integration.d.ts +1 -4
- package/lib/typing-indicator/adapter-integration.d.ts.map +1 -1
- package/lib/typing-indicator/adapter-integration.js.map +1 -1
- package/lib/typing-indicator/index.d.ts +0 -17
- package/lib/typing-indicator/index.d.ts.map +1 -1
- package/lib/typing-indicator/index.js +0 -31
- package/lib/typing-indicator/index.js.map +1 -1
- package/lib/user-profile.js +1 -1
- package/lib/user-profile.js.map +1 -1
- package/lib/utils/config-env.d.ts +1 -1
- package/lib/utils/config-env.js +1 -1
- package/lib/web/bing-search-html.d.ts.map +1 -0
- package/lib/{builtin → web}/bing-search-html.js +2 -6
- package/lib/web/bing-search-html.js.map +1 -0
- package/lib/web/web-search-locale.d.ts +5 -0
- package/lib/web/web-search-locale.d.ts.map +1 -0
- package/lib/web/web-search-locale.js +13 -0
- package/lib/web/web-search-locale.js.map +1 -0
- package/lib/{builtin → web}/web-tool-utils.d.ts +0 -1
- package/lib/web/web-tool-utils.d.ts.map +1 -0
- package/lib/{builtin → web}/web-tool-utils.js +0 -1
- package/lib/web/web-tool-utils.js.map +1 -0
- package/lib/workroom/acceptance-control.d.ts +2 -1
- package/lib/workroom/acceptance-control.d.ts.map +1 -1
- package/lib/workroom/acceptance-control.js +12 -2
- package/lib/workroom/acceptance-control.js.map +1 -1
- package/lib/workroom/accepted-source-memory-application.d.ts +1 -1
- package/lib/workroom/accepted-source-memory-application.d.ts.map +1 -1
- package/lib/workroom/assignment-authority-grant-application.d.ts +2 -2
- package/lib/workroom/assignment-authority-grant-application.d.ts.map +1 -1
- package/lib/workroom/assignment-authority-grant-application.js +1 -1
- package/lib/workroom/assignment-authority-grant-application.js.map +1 -1
- package/lib/workroom/assignment-authority-grant-repository.d.ts +3 -2
- package/lib/workroom/assignment-authority-grant-repository.d.ts.map +1 -1
- package/lib/workroom/assignment-authority-grant-repository.js +3 -1
- package/lib/workroom/assignment-authority-grant-repository.js.map +1 -1
- package/lib/workroom/assignment-authority.d.ts +75 -0
- package/lib/workroom/assignment-authority.d.ts.map +1 -0
- package/lib/workroom/assignment-authority.js +179 -0
- package/lib/workroom/assignment-authority.js.map +1 -0
- package/lib/workroom/catalog-definition.d.ts +0 -6
- package/lib/workroom/catalog-definition.d.ts.map +1 -1
- package/lib/workroom/catalog.js +1 -1
- package/lib/workroom/catalog.js.map +1 -1
- package/lib/workroom/coding-assignment-executor.d.ts +90 -0
- package/lib/workroom/coding-assignment-executor.d.ts.map +1 -0
- package/lib/workroom/coding-assignment-executor.js +250 -0
- package/lib/workroom/coding-assignment-executor.js.map +1 -0
- package/lib/workroom/coding-git-objects.d.ts +17 -0
- package/lib/workroom/coding-git-objects.d.ts.map +1 -0
- package/lib/workroom/coding-git-objects.js +68 -0
- package/lib/workroom/coding-git-objects.js.map +1 -0
- package/lib/workroom/durable-file-store.d.ts +2 -0
- package/lib/workroom/durable-file-store.d.ts.map +1 -1
- package/lib/workroom/durable-file-store.js +5 -0
- package/lib/workroom/durable-file-store.js.map +1 -1
- package/lib/workroom/effect-blocker-repository.d.ts +17 -1
- package/lib/workroom/effect-blocker-repository.d.ts.map +1 -1
- package/lib/workroom/effect-blocker-repository.js.map +1 -1
- package/lib/workroom/effect-ledger.d.ts +21 -1
- package/lib/workroom/effect-ledger.d.ts.map +1 -1
- package/lib/workroom/effect-ledger.js +44 -3
- package/lib/workroom/effect-ledger.js.map +1 -1
- package/lib/workroom/file-accepted-source-memory-repository.d.ts.map +1 -1
- package/lib/workroom/file-accepted-source-memory-repository.js +6 -3
- package/lib/workroom/file-accepted-source-memory-repository.js.map +1 -1
- package/lib/workroom/file-coding-execution-store.d.ts +25 -0
- package/lib/workroom/file-coding-execution-store.d.ts.map +1 -0
- package/lib/workroom/file-coding-execution-store.js +122 -0
- package/lib/workroom/file-coding-execution-store.js.map +1 -0
- package/lib/workroom/file-effect-ledger.d.ts.map +1 -1
- package/lib/workroom/file-effect-ledger.js +6 -3
- package/lib/workroom/file-effect-ledger.js.map +1 -1
- package/lib/workroom/git-workspace-gateway.d.ts +6 -3
- package/lib/workroom/git-workspace-gateway.d.ts.map +1 -1
- package/lib/workroom/git-workspace-gateway.js +10 -1
- package/lib/workroom/git-workspace-gateway.js.map +1 -1
- package/lib/workroom/github-workspace-transport.d.ts +30 -0
- package/lib/workroom/github-workspace-transport.d.ts.map +1 -0
- package/lib/workroom/github-workspace-transport.js +224 -0
- package/lib/workroom/github-workspace-transport.js.map +1 -0
- package/lib/{plugin-runtime/workroom-governed-dispatch-reasons.d.ts → workroom/governed-dispatch-reasons.d.ts} +2 -2
- package/lib/workroom/governed-dispatch-reasons.d.ts.map +1 -0
- package/lib/{plugin-runtime/workroom-governed-dispatch-reasons.js → workroom/governed-dispatch-reasons.js} +1 -1
- package/lib/workroom/governed-dispatch-reasons.js.map +1 -0
- package/lib/workroom/human-ingress-orchestrator.d.ts.map +1 -1
- package/lib/workroom/human-ingress-orchestrator.js +29 -1
- package/lib/workroom/human-ingress-orchestrator.js.map +1 -1
- package/lib/workroom/human-ingress-source-reader.d.ts +3 -3
- package/lib/workroom/human-ingress-source-reader.d.ts.map +1 -1
- package/lib/workroom/human-ingress-source-reader.js.map +1 -1
- package/lib/workroom/journal/activatable-journal.d.ts +15 -0
- package/lib/workroom/journal/activatable-journal.d.ts.map +1 -0
- package/lib/workroom/journal/activatable-journal.js +39 -0
- package/lib/workroom/journal/activatable-journal.js.map +1 -0
- package/lib/workroom/{journal.d.ts → journal/contracts.d.ts} +19 -95
- package/lib/workroom/journal/contracts.d.ts.map +1 -0
- package/lib/workroom/journal/contracts.js +19 -0
- package/lib/workroom/journal/contracts.js.map +1 -0
- package/lib/workroom/journal/database-journal.d.ts +31 -0
- package/lib/workroom/journal/database-journal.d.ts.map +1 -0
- package/lib/workroom/journal/database-journal.js +118 -0
- package/lib/workroom/journal/database-journal.js.map +1 -0
- package/lib/workroom/journal/event-codec.d.ts +26 -0
- package/lib/workroom/journal/event-codec.d.ts.map +1 -0
- package/lib/workroom/journal/event-codec.js +233 -0
- package/lib/workroom/journal/event-codec.js.map +1 -0
- package/lib/workroom/journal/event-validation.d.ts +10 -0
- package/lib/workroom/journal/event-validation.d.ts.map +1 -0
- package/lib/workroom/journal/event-validation.js +671 -0
- package/lib/workroom/journal/event-validation.js.map +1 -0
- package/lib/workroom/journal/file-journal.d.ts +15 -0
- package/lib/workroom/journal/file-journal.d.ts.map +1 -0
- package/lib/workroom/journal/file-journal.js +272 -0
- package/lib/workroom/journal/file-journal.js.map +1 -0
- package/lib/workroom/journal/index.d.ts +9 -0
- package/lib/workroom/journal/index.d.ts.map +1 -0
- package/lib/workroom/journal/index.js +8 -0
- package/lib/workroom/journal/index.js.map +1 -0
- package/lib/workroom/journal/memory-journal.d.ts +27 -0
- package/lib/workroom/journal/memory-journal.d.ts.map +1 -0
- package/lib/workroom/journal/memory-journal.js +103 -0
- package/lib/workroom/journal/memory-journal.js.map +1 -0
- package/lib/workroom/journal/payload-governance.d.ts +29 -0
- package/lib/workroom/journal/payload-governance.d.ts.map +1 -0
- package/lib/workroom/journal/payload-governance.js +282 -0
- package/lib/workroom/journal/payload-governance.js.map +1 -0
- package/lib/workroom/journal/payload-reference.d.ts +9 -0
- package/lib/workroom/journal/payload-reference.d.ts.map +1 -0
- package/lib/workroom/journal/payload-reference.js +60 -0
- package/lib/workroom/journal/payload-reference.js.map +1 -0
- package/lib/workroom/journal/stored-event-projection.d.ts +6 -0
- package/lib/workroom/journal/stored-event-projection.d.ts.map +1 -0
- package/lib/workroom/journal/stored-event-projection.js +280 -0
- package/lib/workroom/journal/stored-event-projection.js.map +1 -0
- package/lib/workroom/kernel-state.d.ts.map +1 -1
- package/lib/workroom/kernel-state.js +35 -3
- package/lib/workroom/kernel-state.js.map +1 -1
- package/lib/workroom/{projection-outbox.d.ts → projection-outbox/contracts.d.ts} +8 -72
- package/lib/workroom/projection-outbox/contracts.d.ts.map +1 -0
- package/lib/workroom/projection-outbox/contracts.js +11 -0
- package/lib/workroom/projection-outbox/contracts.js.map +1 -0
- package/lib/workroom/projection-outbox/delivery-worker.d.ts +22 -0
- package/lib/workroom/projection-outbox/delivery-worker.d.ts.map +1 -0
- package/lib/workroom/projection-outbox/delivery-worker.js +96 -0
- package/lib/workroom/projection-outbox/delivery-worker.js.map +1 -0
- package/lib/workroom/projection-outbox/file-repository.d.ts +11 -0
- package/lib/workroom/projection-outbox/file-repository.d.ts.map +1 -0
- package/lib/workroom/projection-outbox/file-repository.js +89 -0
- package/lib/workroom/projection-outbox/file-repository.js.map +1 -0
- package/lib/workroom/projection-outbox/index.d.ts +10 -0
- package/lib/workroom/projection-outbox/index.d.ts.map +1 -0
- package/lib/workroom/projection-outbox/index.js +8 -0
- package/lib/workroom/projection-outbox/index.js.map +1 -0
- package/lib/workroom/projection-outbox/memory-repository.d.ts +11 -0
- package/lib/workroom/projection-outbox/memory-repository.d.ts.map +1 -0
- package/lib/workroom/projection-outbox/memory-repository.js +40 -0
- package/lib/workroom/projection-outbox/memory-repository.js.map +1 -0
- package/lib/workroom/projection-outbox/projector.d.ts +36 -0
- package/lib/workroom/projection-outbox/projector.d.ts.map +1 -0
- package/lib/workroom/projection-outbox/projector.js +517 -0
- package/lib/workroom/projection-outbox/projector.js.map +1 -0
- package/lib/workroom/projection-outbox/repository-state.d.ts +17 -0
- package/lib/workroom/projection-outbox/repository-state.d.ts.map +1 -0
- package/lib/workroom/projection-outbox/repository-state.js +343 -0
- package/lib/workroom/projection-outbox/repository-state.js.map +1 -0
- package/lib/workroom/projection-outbox/tracer.d.ts +19 -0
- package/lib/workroom/projection-outbox/tracer.d.ts.map +1 -0
- package/lib/workroom/projection-outbox/tracer.js +201 -0
- package/lib/workroom/projection-outbox/tracer.js.map +1 -0
- package/lib/workroom/remote-dispatch-admission.d.ts +2 -2
- package/lib/workroom/remote-dispatch-admission.d.ts.map +1 -1
- package/lib/workroom/remote-dispatch-admission.js +1 -1
- package/lib/workroom/remote-dispatch-admission.js.map +1 -1
- package/lib/workroom/remote-dispatch-worker.d.ts +1 -1
- package/lib/workroom/remote-dispatch-worker.d.ts.map +1 -1
- package/lib/workroom/remote-dispatch-worker.js +1 -1
- package/lib/workroom/remote-dispatch-worker.js.map +1 -1
- package/lib/workroom/remote-executor.d.ts +15 -0
- package/lib/workroom/remote-executor.d.ts.map +1 -0
- package/lib/workroom/remote-executor.js +21 -0
- package/lib/workroom/remote-executor.js.map +1 -0
- package/lib/workroom/runtime.d.ts +1 -1
- package/lib/workroom/runtime.d.ts.map +1 -1
- package/lib/workroom/software-delivery-plan.d.ts +32 -0
- package/lib/workroom/software-delivery-plan.d.ts.map +1 -0
- package/lib/workroom/software-delivery-plan.js +60 -0
- package/lib/workroom/software-delivery-plan.js.map +1 -0
- package/lib/workroom/validate-catalog.d.ts +2 -0
- package/lib/workroom/validate-catalog.d.ts.map +1 -0
- package/lib/workroom/validate-catalog.js +230 -0
- package/lib/workroom/validate-catalog.js.map +1 -0
- package/lib/workroom/workroom-kernel.d.ts +11 -1
- package/lib/workroom/workroom-kernel.d.ts.map +1 -1
- package/lib/workroom/workroom-kernel.js +102 -30
- package/lib/workroom/workroom-kernel.js.map +1 -1
- package/lib/workroom/workroom-preemption.d.ts +1 -1
- package/lib/workroom/workroom-preemption.d.ts.map +1 -1
- package/lib/workroom/workroom-scheduler-application.d.ts +1 -1
- package/lib/workroom/workroom-scheduler-application.d.ts.map +1 -1
- package/lib/workroom/workroom-scheduler-application.js +1 -1
- package/lib/workroom/workroom-scheduler-application.js.map +1 -1
- package/lib/workroom/workroom-scheduler.js +3 -0
- package/lib/workroom/workroom-scheduler.js.map +1 -1
- package/lib/zhin-agent/index.d.ts +12 -6
- package/lib/zhin-agent/index.d.ts.map +1 -1
- package/lib/zhin-agent/index.js +18 -12
- package/lib/zhin-agent/index.js.map +1 -1
- package/package.json +14 -29
- package/lib/activity-feedback/ai-bus.d.ts +0 -21
- package/lib/activity-feedback/ai-bus.d.ts.map +0 -1
- package/lib/activity-feedback/ai-bus.js +0 -59
- package/lib/activity-feedback/ai-bus.js.map +0 -1
- package/lib/ai-hook-handlers.d.ts +0 -8
- package/lib/ai-hook-handlers.d.ts.map +0 -1
- package/lib/ai-hook-handlers.js +0 -46
- package/lib/ai-hook-handlers.js.map +0 -1
- package/lib/authoring/define-agent.d.ts +0 -4
- package/lib/authoring/define-agent.d.ts.map +0 -1
- package/lib/authoring/define-agent.js +0 -8
- package/lib/authoring/define-agent.js.map +0 -1
- package/lib/authoring/define-connection.d.ts +0 -5
- package/lib/authoring/define-connection.d.ts.map +0 -1
- package/lib/authoring/define-connection.js +0 -8
- package/lib/authoring/define-connection.js.map +0 -1
- package/lib/authoring/define-schedule.d.ts +0 -4
- package/lib/authoring/define-schedule.d.ts.map +0 -1
- package/lib/authoring/define-schedule.js +0 -8
- package/lib/authoring/define-schedule.js.map +0 -1
- package/lib/authoring/define-tool.d.ts +0 -20
- package/lib/authoring/define-tool.d.ts.map +0 -1
- package/lib/authoring/define-tool.js +0 -28
- package/lib/authoring/define-tool.js.map +0 -1
- package/lib/authoring/entries/connections.d.ts +0 -3
- package/lib/authoring/entries/connections.d.ts.map +0 -1
- package/lib/authoring/entries/connections.js +0 -2
- package/lib/authoring/entries/connections.js.map +0 -1
- package/lib/authoring/entries/schedules.d.ts +0 -3
- package/lib/authoring/entries/schedules.d.ts.map +0 -1
- package/lib/authoring/entries/schedules.js +0 -2
- package/lib/authoring/entries/schedules.js.map +0 -1
- package/lib/authoring/entries/tools.d.ts +0 -5
- package/lib/authoring/entries/tools.d.ts.map +0 -1
- package/lib/authoring/entries/tools.js +0 -3
- package/lib/authoring/entries/tools.js.map +0 -1
- package/lib/authoring/tool-policy.d.ts +0 -3
- package/lib/authoring/tool-policy.d.ts.map +0 -1
- package/lib/authoring/tool-policy.js +0 -2
- package/lib/authoring/tool-policy.js.map +0 -1
- package/lib/authoring/zod-schema.d.ts +0 -10
- package/lib/authoring/zod-schema.d.ts.map +0 -1
- package/lib/authoring/zod-schema.js +0 -7
- package/lib/authoring/zod-schema.js.map +0 -1
- package/lib/builtin/analyze-media-tool.d.ts +0 -13
- package/lib/builtin/analyze-media-tool.d.ts.map +0 -1
- package/lib/builtin/analyze-media-tool.js +0 -94
- package/lib/builtin/analyze-media-tool.js.map +0 -1
- package/lib/builtin/bash-tool.d.ts +0 -29
- package/lib/builtin/bash-tool.d.ts.map +0 -1
- package/lib/builtin/bash-tool.js +0 -107
- package/lib/builtin/bash-tool.js.map +0 -1
- package/lib/builtin/bing-search-html.d.ts.map +0 -1
- package/lib/builtin/bing-search-html.js.map +0 -1
- package/lib/builtin/builtin-base-tool.d.ts +0 -27
- package/lib/builtin/builtin-base-tool.d.ts.map +0 -1
- package/lib/builtin/builtin-base-tool.js +0 -35
- package/lib/builtin/builtin-base-tool.js.map +0 -1
- package/lib/builtin/edit-file-tool.d.ts +0 -13
- package/lib/builtin/edit-file-tool.d.ts.map +0 -1
- package/lib/builtin/edit-file-tool.js +0 -86
- package/lib/builtin/edit-file-tool.js.map +0 -1
- package/lib/builtin/file-edit-quote-utils.d.ts.map +0 -1
- package/lib/builtin/file-edit-quote-utils.js.map +0 -1
- package/lib/builtin/five-agent/index.d.ts.map +0 -1
- package/lib/builtin/five-agent/index.js.map +0 -1
- package/lib/builtin/five-agent/prompts.d.ts.map +0 -1
- package/lib/builtin/five-agent/prompts.js.map +0 -1
- package/lib/builtin/five-agent/role-capability-policy.d.ts.map +0 -1
- package/lib/builtin/five-agent/role-capability-policy.js.map +0 -1
- package/lib/builtin/five-agent/roles.d.ts.map +0 -1
- package/lib/builtin/five-agent/roles.js.map +0 -1
- package/lib/builtin/generate-image-tool.d.ts +0 -21
- package/lib/builtin/generate-image-tool.d.ts.map +0 -1
- package/lib/builtin/generate-image-tool.js +0 -138
- package/lib/builtin/generate-image-tool.js.map +0 -1
- package/lib/builtin/glob-tool.d.ts +0 -23
- package/lib/builtin/glob-tool.d.ts.map +0 -1
- package/lib/builtin/glob-tool.js +0 -53
- package/lib/builtin/glob-tool.js.map +0 -1
- package/lib/builtin/grep-tool.d.ts +0 -23
- package/lib/builtin/grep-tool.d.ts.map +0 -1
- package/lib/builtin/grep-tool.js +0 -121
- package/lib/builtin/grep-tool.js.map +0 -1
- package/lib/builtin/install-skill-tool.d.ts +0 -24
- package/lib/builtin/install-skill-tool.d.ts.map +0 -1
- package/lib/builtin/install-skill-tool.js +0 -76
- package/lib/builtin/install-skill-tool.js.map +0 -1
- package/lib/builtin/knowledge-search-tool.d.ts +0 -6
- package/lib/builtin/knowledge-search-tool.d.ts.map +0 -1
- package/lib/builtin/knowledge-search-tool.js +0 -184
- package/lib/builtin/knowledge-search-tool.js.map +0 -1
- package/lib/builtin/list-dir-tool.d.ts +0 -13
- package/lib/builtin/list-dir-tool.d.ts.map +0 -1
- package/lib/builtin/list-dir-tool.js +0 -57
- package/lib/builtin/list-dir-tool.js.map +0 -1
- package/lib/builtin/load-skill-tool.d.ts +0 -20
- package/lib/builtin/load-skill-tool.d.ts.map +0 -1
- package/lib/builtin/load-skill-tool.js +0 -60
- package/lib/builtin/load-skill-tool.js.map +0 -1
- package/lib/builtin/read-file-tool.d.ts +0 -14
- package/lib/builtin/read-file-tool.d.ts.map +0 -1
- package/lib/builtin/read-file-tool.js +0 -74
- package/lib/builtin/read-file-tool.js.map +0 -1
- package/lib/builtin/run-deferred-task-tool.d.ts +0 -23
- package/lib/builtin/run-deferred-task-tool.d.ts.map +0 -1
- package/lib/builtin/run-deferred-task-tool.js +0 -41
- package/lib/builtin/run-deferred-task-tool.js.map +0 -1
- package/lib/builtin/spawn-task-tool.d.ts.map +0 -1
- package/lib/builtin/spawn-task-tool.js.map +0 -1
- package/lib/builtin/todo-read-tool.d.ts +0 -14
- package/lib/builtin/todo-read-tool.d.ts.map +0 -1
- package/lib/builtin/todo-read-tool.js +0 -56
- package/lib/builtin/todo-read-tool.js.map +0 -1
- package/lib/builtin/todo-write-tool.d.ts +0 -14
- package/lib/builtin/todo-write-tool.d.ts.map +0 -1
- package/lib/builtin/todo-write-tool.js +0 -54
- package/lib/builtin/todo-write-tool.js.map +0 -1
- package/lib/builtin/web-fetch-tool.d.ts +0 -21
- package/lib/builtin/web-fetch-tool.d.ts.map +0 -1
- package/lib/builtin/web-fetch-tool.js +0 -86
- package/lib/builtin/web-fetch-tool.js.map +0 -1
- package/lib/builtin/web-search-locale.d.ts +0 -16
- package/lib/builtin/web-search-locale.d.ts.map +0 -1
- package/lib/builtin/web-search-locale.js +0 -74
- package/lib/builtin/web-search-locale.js.map +0 -1
- package/lib/builtin/web-search-tool.d.ts +0 -20
- package/lib/builtin/web-search-tool.d.ts.map +0 -1
- package/lib/builtin/web-search-tool.js +0 -115
- package/lib/builtin/web-search-tool.js.map +0 -1
- package/lib/builtin/web-tool-utils.d.ts.map +0 -1
- package/lib/builtin/web-tool-utils.js.map +0 -1
- package/lib/builtin/write-file-tool.d.ts +0 -13
- package/lib/builtin/write-file-tool.d.ts.map +0 -1
- package/lib/builtin/write-file-tool.js +0 -55
- package/lib/builtin/write-file-tool.js.map +0 -1
- package/lib/builtin-tools.d.ts +0 -25
- package/lib/builtin-tools.d.ts.map +0 -1
- package/lib/builtin-tools.js +0 -54
- package/lib/builtin-tools.js.map +0 -1
- package/lib/defaults/hooks.d.ts +0 -6
- package/lib/defaults/hooks.d.ts.map +0 -1
- package/lib/defaults/hooks.js +0 -9
- package/lib/defaults/hooks.js.map +0 -1
- package/lib/defaults/subagents.d.ts +0 -6
- package/lib/defaults/subagents.d.ts.map +0 -1
- package/lib/defaults/subagents.js +0 -23
- package/lib/defaults/subagents.js.map +0 -1
- package/lib/defaults/tools.d.ts +0 -5
- package/lib/defaults/tools.d.ts.map +0 -1
- package/lib/defaults/tools.js +0 -6
- package/lib/defaults/tools.js.map +0 -1
- package/lib/discovery/index.d.ts +0 -5
- package/lib/discovery/index.d.ts.map +0 -1
- package/lib/discovery/index.js +0 -5
- package/lib/discovery/index.js.map +0 -1
- package/lib/discovery/skills.d.ts +0 -53
- package/lib/discovery/skills.d.ts.map +0 -1
- package/lib/discovery/skills.js +0 -306
- package/lib/discovery/skills.js.map +0 -1
- package/lib/discovery/tools.d.ts +0 -53
- package/lib/discovery/tools.d.ts.map +0 -1
- package/lib/discovery/tools.js +0 -305
- package/lib/discovery/tools.js.map +0 -1
- package/lib/features/agent-feature.d.ts +0 -23
- package/lib/features/agent-feature.d.ts.map +0 -1
- package/lib/features/agent-feature.js +0 -51
- package/lib/features/agent-feature.js.map +0 -1
- package/lib/features/index.d.ts +0 -3
- package/lib/features/index.d.ts.map +0 -1
- package/lib/features/index.js +0 -3
- package/lib/features/index.js.map +0 -1
- package/lib/features/mcp-feature.d.ts +0 -25
- package/lib/features/mcp-feature.d.ts.map +0 -1
- package/lib/features/mcp-feature.js +0 -52
- package/lib/features/mcp-feature.js.map +0 -1
- package/lib/hooks.d.ts +0 -144
- package/lib/hooks.d.ts.map +0 -1
- package/lib/hooks.js +0 -82
- package/lib/hooks.js.map +0 -1
- package/lib/ingress/capability-ingress.d.ts +0 -76
- package/lib/ingress/capability-ingress.d.ts.map +0 -1
- package/lib/ingress/capability-ingress.js +0 -274
- package/lib/ingress/capability-ingress.js.map +0 -1
- package/lib/ingress/index.d.ts +0 -2
- package/lib/ingress/index.d.ts.map +0 -1
- package/lib/ingress/index.js +0 -2
- package/lib/ingress/index.js.map +0 -1
- package/lib/init/introspection-args.d.ts +0 -37
- package/lib/init/introspection-args.d.ts.map +0 -1
- package/lib/init/introspection-args.js +0 -71
- package/lib/init/introspection-args.js.map +0 -1
- package/lib/init/introspection-collectors.d.ts +0 -26
- package/lib/init/introspection-collectors.d.ts.map +0 -1
- package/lib/init/introspection-collectors.js +0 -108
- package/lib/init/introspection-collectors.js.map +0 -1
- package/lib/init/introspection-commands-format.d.ts +0 -40
- package/lib/init/introspection-commands-format.d.ts.map +0 -1
- package/lib/init/introspection-commands-format.js +0 -93
- package/lib/init/introspection-commands-format.js.map +0 -1
- package/lib/init/introspection-pagination.d.ts +0 -14
- package/lib/init/introspection-pagination.d.ts.map +0 -1
- package/lib/init/introspection-pagination.js +0 -33
- package/lib/init/introspection-pagination.js.map +0 -1
- package/lib/init/introspection-rest.d.ts +0 -24
- package/lib/init/introspection-rest.d.ts.map +0 -1
- package/lib/init/introspection-rest.js +0 -65
- package/lib/init/introspection-rest.js.map +0 -1
- package/lib/init/upgrade-agent-db-schema.d.ts +0 -49
- package/lib/init/upgrade-agent-db-schema.d.ts.map +0 -1
- package/lib/init/upgrade-agent-db-schema.js +0 -210
- package/lib/init/upgrade-agent-db-schema.js.map +0 -1
- package/lib/init/upgrade-endpoint-id-schema.d.ts +0 -12
- package/lib/init/upgrade-endpoint-id-schema.d.ts.map +0 -1
- package/lib/init/upgrade-endpoint-id-schema.js +0 -58
- package/lib/init/upgrade-endpoint-id-schema.js.map +0 -1
- package/lib/plugin-runtime/workroom-governed-dispatch-reasons.d.ts.map +0 -1
- package/lib/plugin-runtime/workroom-governed-dispatch-reasons.js.map +0 -1
- package/lib/resource-hub/tool-registry.d.ts +0 -60
- package/lib/resource-hub/tool-registry.d.ts.map +0 -1
- package/lib/resource-hub/tool-registry.js +0 -228
- package/lib/resource-hub/tool-registry.js.map +0 -1
- package/lib/security/owner-approve-always-store.d.ts +0 -67
- package/lib/security/owner-approve-always-store.d.ts.map +0 -1
- package/lib/security/owner-approve-always-store.js +0 -510
- package/lib/security/owner-approve-always-store.js.map +0 -1
- package/lib/security/turn-sandbox-authority.d.ts +0 -13
- package/lib/security/turn-sandbox-authority.d.ts.map +0 -1
- package/lib/security/turn-sandbox-authority.js +0 -42
- package/lib/security/turn-sandbox-authority.js.map +0 -1
- package/lib/skill/skill-load-opts.d.ts +0 -5
- package/lib/skill/skill-load-opts.d.ts.map +0 -1
- package/lib/skill/skill-load-opts.js +0 -14
- package/lib/skill/skill-load-opts.js.map +0 -1
- package/lib/stability/registry-cleanup.d.ts +0 -5
- package/lib/stability/registry-cleanup.d.ts.map +0 -1
- package/lib/stability/registry-cleanup.js +0 -20
- package/lib/stability/registry-cleanup.js.map +0 -1
- package/lib/tool/classic-tool-execution-authority.d.ts +0 -22
- package/lib/tool/classic-tool-execution-authority.d.ts.map +0 -1
- package/lib/tool/classic-tool-execution-authority.js +0 -80
- package/lib/tool/classic-tool-execution-authority.js.map +0 -1
- package/lib/tool/web-search-locale-attach.d.ts +0 -4
- package/lib/tool/web-search-locale-attach.d.ts.map +0 -1
- package/lib/tool/web-search-locale-attach.js +0 -20
- package/lib/tool/web-search-locale-attach.js.map +0 -1
- package/lib/typing-indicator/integration.d.ts +0 -89
- package/lib/typing-indicator/integration.d.ts.map +0 -1
- package/lib/typing-indicator/integration.js +0 -261
- package/lib/typing-indicator/integration.js.map +0 -1
- package/lib/workroom/journal.d.ts.map +0 -1
- package/lib/workroom/journal.js +0 -2022
- package/lib/workroom/journal.js.map +0 -1
- package/lib/workroom/local-assignment-executor.d.ts.map +0 -1
- package/lib/workroom/local-assignment-executor.js.map +0 -1
- package/lib/workroom/projection-outbox.d.ts.map +0 -1
- package/lib/workroom/projection-outbox.js +0 -1324
- package/lib/workroom/projection-outbox.js.map +0 -1
- /package/lib/{builtin → orchestration}/five-agent/index.d.ts +0 -0
- /package/lib/{builtin → orchestration}/five-agent/index.js +0 -0
- /package/lib/{builtin → orchestration}/five-agent/prompts.d.ts +0 -0
- /package/lib/{builtin → orchestration}/five-agent/prompts.js +0 -0
- /package/lib/{builtin → orchestration}/five-agent/role-capability-policy.d.ts +0 -0
- /package/lib/{builtin → orchestration}/five-agent/role-capability-policy.js +0 -0
- /package/lib/{builtin → orchestration}/five-agent/roles.d.ts +0 -0
- /package/lib/{builtin → orchestration}/five-agent/roles.js +0 -0
- /package/lib/{builtin → plugin-runtime}/file-edit-quote-utils.d.ts +0 -0
- /package/lib/{builtin → plugin-runtime}/file-edit-quote-utils.js +0 -0
- /package/lib/{builtin → web}/bing-search-html.d.ts +0 -0
|
@@ -1,1324 +0,0 @@
|
|
|
1
|
-
import { readFile, readdir } from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { DurableFileStore } from './durable-file-store.js';
|
|
4
|
-
import { compareCanonicalWorkroomText, deepFreezeWorkroomValue as deepFreeze, digestCanonicalWorkroomValue as digest, } from './canonical-value.js';
|
|
5
|
-
import { createWorkroomGovernedDispatchReason } from '../plugin-runtime/workroom-governed-dispatch-reasons.js';
|
|
6
|
-
export class WorkroomProjectionRevisionConflictError extends Error {
|
|
7
|
-
expectedRevision;
|
|
8
|
-
actualRevision;
|
|
9
|
-
constructor(expectedRevision, actualRevision) {
|
|
10
|
-
super(`Workroom Projection revision conflict: expected ${expectedRevision}, actual ${actualRevision}`);
|
|
11
|
-
this.expectedRevision = expectedRevision;
|
|
12
|
-
this.actualRevision = actualRevision;
|
|
13
|
-
this.name = 'WorkroomProjectionRevisionConflictError';
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export class MemoryWorkroomProjectionRepository {
|
|
17
|
-
#state = emptyProjectionState();
|
|
18
|
-
async read() {
|
|
19
|
-
return this.#state;
|
|
20
|
-
}
|
|
21
|
-
async bind(expectedRevision, binding) {
|
|
22
|
-
this.#assertRevision(expectedRevision);
|
|
23
|
-
this.#state = applyBinding(this.#state, binding);
|
|
24
|
-
return this.#state;
|
|
25
|
-
}
|
|
26
|
-
async capture(expectedRevision, input) {
|
|
27
|
-
if (this.#state.revision !== expectedRevision) {
|
|
28
|
-
throw new WorkroomProjectionRevisionConflictError(expectedRevision, this.#state.revision);
|
|
29
|
-
}
|
|
30
|
-
this.#state = applyCapture(this.#state, input);
|
|
31
|
-
return this.#state;
|
|
32
|
-
}
|
|
33
|
-
async claimNext(expectedRevision, workerId, now, leaseMs) {
|
|
34
|
-
this.#assertRevision(expectedRevision);
|
|
35
|
-
const claimed = applyClaim(this.#state, workerId, now, leaseMs);
|
|
36
|
-
if (!claimed)
|
|
37
|
-
return undefined;
|
|
38
|
-
this.#state = claimed.state;
|
|
39
|
-
return claimed.item;
|
|
40
|
-
}
|
|
41
|
-
async settle(expectedRevision, itemId, workerId, fence, result, settledAt) {
|
|
42
|
-
this.#assertRevision(expectedRevision);
|
|
43
|
-
this.#state = applySettlement(this.#state, itemId, workerId, fence, result, settledAt);
|
|
44
|
-
return this.#state;
|
|
45
|
-
}
|
|
46
|
-
#assertRevision(expectedRevision) {
|
|
47
|
-
if (this.#state.revision !== expectedRevision) {
|
|
48
|
-
throw new WorkroomProjectionRevisionConflictError(expectedRevision, this.#state.revision);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/** Crash-durable, cross-process CAS snapshots for one Projection binding. */
|
|
53
|
-
export class FileWorkroomProjectionRepository {
|
|
54
|
-
#store;
|
|
55
|
-
constructor(directory) {
|
|
56
|
-
this.#store = new DurableFileStore(directory);
|
|
57
|
-
}
|
|
58
|
-
async read() {
|
|
59
|
-
let names;
|
|
60
|
-
try {
|
|
61
|
-
names = (await readdir(this.#store.directory))
|
|
62
|
-
.filter(name => /^projection\.[0-9]{16}\.json$/u.test(name))
|
|
63
|
-
.sort();
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
if (hasCode(error, 'ENOENT'))
|
|
67
|
-
return emptyProjectionState();
|
|
68
|
-
throw error;
|
|
69
|
-
}
|
|
70
|
-
if (names.length === 0)
|
|
71
|
-
return emptyProjectionState();
|
|
72
|
-
for (let index = 0; index < names.length; index += 1) {
|
|
73
|
-
const expected = projectionSnapshotName(index + 1);
|
|
74
|
-
if (names[index] !== expected) {
|
|
75
|
-
throw new Error(`Workroom Projection snapshot gap before revision ${index + 1}`);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const parsed = JSON.parse(await readFile(join(this.#store.directory, names.at(-1)), 'utf8'));
|
|
79
|
-
return parseProjectionState(parsed, names.length);
|
|
80
|
-
}
|
|
81
|
-
async capture(expectedRevision, input) {
|
|
82
|
-
const current = await this.read();
|
|
83
|
-
if (current.revision !== expectedRevision) {
|
|
84
|
-
throw new WorkroomProjectionRevisionConflictError(expectedRevision, current.revision);
|
|
85
|
-
}
|
|
86
|
-
const next = applyCapture(current, input);
|
|
87
|
-
return await this.#publish(expectedRevision, next);
|
|
88
|
-
}
|
|
89
|
-
async bind(expectedRevision, binding) {
|
|
90
|
-
const current = await this.read();
|
|
91
|
-
if (current.revision !== expectedRevision) {
|
|
92
|
-
throw new WorkroomProjectionRevisionConflictError(expectedRevision, current.revision);
|
|
93
|
-
}
|
|
94
|
-
const next = applyBinding(current, binding);
|
|
95
|
-
if (next === current)
|
|
96
|
-
return current;
|
|
97
|
-
return await this.#publish(expectedRevision, next);
|
|
98
|
-
}
|
|
99
|
-
async claimNext(expectedRevision, workerId, now, leaseMs) {
|
|
100
|
-
const current = await this.read();
|
|
101
|
-
if (current.revision !== expectedRevision) {
|
|
102
|
-
throw new WorkroomProjectionRevisionConflictError(expectedRevision, current.revision);
|
|
103
|
-
}
|
|
104
|
-
const claimed = applyClaim(current, workerId, now, leaseMs);
|
|
105
|
-
if (!claimed)
|
|
106
|
-
return undefined;
|
|
107
|
-
const persisted = await this.#publish(expectedRevision, claimed.state);
|
|
108
|
-
return persisted.items[claimed.item.id];
|
|
109
|
-
}
|
|
110
|
-
async settle(expectedRevision, itemId, workerId, fence, result, settledAt) {
|
|
111
|
-
const current = await this.read();
|
|
112
|
-
if (current.revision !== expectedRevision) {
|
|
113
|
-
throw new WorkroomProjectionRevisionConflictError(expectedRevision, current.revision);
|
|
114
|
-
}
|
|
115
|
-
return await this.#publish(expectedRevision, applySettlement(current, itemId, workerId, fence, result, settledAt));
|
|
116
|
-
}
|
|
117
|
-
async #publish(expectedRevision, next) {
|
|
118
|
-
await this.#store.ensureDurableLeaf('Workroom Projection repository');
|
|
119
|
-
const target = join(this.#store.directory, projectionSnapshotName(next.revision));
|
|
120
|
-
const published = await this.#store.publishCreateOnly({
|
|
121
|
-
target,
|
|
122
|
-
content: JSON.stringify({ state: next, digest: digest(next) }),
|
|
123
|
-
createdValue: next,
|
|
124
|
-
onConflict: async () => {
|
|
125
|
-
const winner = parseProjectionState(JSON.parse(await readFile(target, 'utf8')), next.revision);
|
|
126
|
-
if (digest(winner) === digest(next))
|
|
127
|
-
return await this.read();
|
|
128
|
-
const latest = await this.read();
|
|
129
|
-
throw new WorkroomProjectionRevisionConflictError(expectedRevision, latest.revision);
|
|
130
|
-
},
|
|
131
|
-
});
|
|
132
|
-
return published.value;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
/** At-least-once delivery worker; Projection receipts never mutate Kernel facts. */
|
|
136
|
-
export class WorkroomProjectionDeliveryWorker {
|
|
137
|
-
#repository;
|
|
138
|
-
#outbound;
|
|
139
|
-
#workerId;
|
|
140
|
-
#leaseMs;
|
|
141
|
-
#governance;
|
|
142
|
-
#authority;
|
|
143
|
-
#now;
|
|
144
|
-
constructor(options) {
|
|
145
|
-
requireText(options.workerId, 'workerId');
|
|
146
|
-
requirePositiveInteger(options.leaseMs, 'leaseMs');
|
|
147
|
-
this.#repository = options.repository;
|
|
148
|
-
this.#outbound = options.outbound;
|
|
149
|
-
this.#workerId = options.workerId;
|
|
150
|
-
this.#leaseMs = options.leaseMs;
|
|
151
|
-
this.#governance = options.governance;
|
|
152
|
-
this.#authority = options.authority;
|
|
153
|
-
this.#now = options.now ?? Date.now;
|
|
154
|
-
}
|
|
155
|
-
async runOnce(now, signal) {
|
|
156
|
-
requireFiniteNumber(now, 'delivery now');
|
|
157
|
-
signal.throwIfAborted();
|
|
158
|
-
const claimed = await this.#claim(now);
|
|
159
|
-
if (!claimed)
|
|
160
|
-
return Object.freeze({ status: 'idle' });
|
|
161
|
-
let result;
|
|
162
|
-
try {
|
|
163
|
-
const authorized = this.#authority ? await this.#authority.authorize(claimed) : true;
|
|
164
|
-
if (!authorized) {
|
|
165
|
-
result = Object.freeze({
|
|
166
|
-
status: 'failed', code: 'catalog_binding_stale', retryable: false,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
else if (!this.#governance) {
|
|
170
|
-
result = Object.freeze({
|
|
171
|
-
status: 'failed', code: 'project_authority_unavailable', retryable: false,
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
const governed = await this.#governance.revalidate(claimed.disclosure, signal);
|
|
176
|
-
result = governed.status === 'blocked'
|
|
177
|
-
? (() => {
|
|
178
|
-
const reason = createWorkroomGovernedDispatchReason(governed.reason);
|
|
179
|
-
return Object.freeze({
|
|
180
|
-
status: 'failed', code: reason.code, retryable: reason.retryable,
|
|
181
|
-
});
|
|
182
|
-
})()
|
|
183
|
-
: normalizeDeliveryResult(await this.#outbound.send(claimed, governed.body, signal));
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
catch (error) {
|
|
187
|
-
if (signal.aborted)
|
|
188
|
-
throw signal.reason ?? error;
|
|
189
|
-
result = Object.freeze({ status: 'failed', code: 'transport_error', retryable: true });
|
|
190
|
-
}
|
|
191
|
-
// Once send returned a receipt the external effect already happened;
|
|
192
|
-
// cancellation must not discard it and cause a blind duplicate retry.
|
|
193
|
-
const settledAt = this.#now();
|
|
194
|
-
requireFiniteNumber(settledAt, 'delivery completion time');
|
|
195
|
-
await this.#settle(claimed, result, settledAt);
|
|
196
|
-
return result;
|
|
197
|
-
}
|
|
198
|
-
async #claim(now) {
|
|
199
|
-
for (let conflict = 0; conflict < 8; conflict += 1) {
|
|
200
|
-
const state = await this.#repository.read();
|
|
201
|
-
try {
|
|
202
|
-
return await this.#repository.claimNext(state.revision, this.#workerId, now, this.#leaseMs);
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
if (!(error instanceof WorkroomProjectionRevisionConflictError))
|
|
206
|
-
throw error;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
throw new Error('Workroom Projection delivery claim CAS retries exhausted');
|
|
210
|
-
}
|
|
211
|
-
async #settle(item, result, settledAt) {
|
|
212
|
-
for (let conflict = 0; conflict < 8; conflict += 1) {
|
|
213
|
-
const state = await this.#repository.read();
|
|
214
|
-
try {
|
|
215
|
-
await this.#repository.settle(state.revision, item.id, this.#workerId, item.delivery.fence, result, settledAt);
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
catch (error) {
|
|
219
|
-
if (!(error instanceof WorkroomProjectionRevisionConflictError))
|
|
220
|
-
throw error;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
throw new Error('Workroom Projection delivery settlement CAS retries exhausted');
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
/** Durable cursor tracer from authoritative Kernel events to an IM outbox. */
|
|
227
|
-
export class WorkroomProjectionTracer {
|
|
228
|
-
#journal;
|
|
229
|
-
#repository;
|
|
230
|
-
#governance;
|
|
231
|
-
constructor(options) {
|
|
232
|
-
this.#journal = options.journal;
|
|
233
|
-
this.#repository = options.repository;
|
|
234
|
-
this.#governance = options.governance;
|
|
235
|
-
}
|
|
236
|
-
async capture(bindingValue, runId, signal = new AbortController().signal) {
|
|
237
|
-
const binding = freezeAndValidateBinding(bindingValue);
|
|
238
|
-
const events = await this.#journal.read(runId);
|
|
239
|
-
if (events.length === 0)
|
|
240
|
-
throw new Error(`Workroom Projection Run ${runId} not found`);
|
|
241
|
-
if (events[0]?.payload.projectId !== binding.projectId) {
|
|
242
|
-
throw new Error('Workroom Projection binding targets another Project');
|
|
243
|
-
}
|
|
244
|
-
for (let conflict = 0; conflict < 8; conflict += 1) {
|
|
245
|
-
const current = await this.#repository.read();
|
|
246
|
-
const cursorId = projectionBindingCursorKey(runId, binding);
|
|
247
|
-
const storedCursor = current.cursors[cursorId];
|
|
248
|
-
const legacyCursor = storedCursor === undefined
|
|
249
|
-
? exactLegacyBindingCursor(current, runId, binding)
|
|
250
|
-
: undefined;
|
|
251
|
-
const cursor = storedCursor ?? legacyCursor ?? -1;
|
|
252
|
-
const expectedCursor = storedCursor ?? -1;
|
|
253
|
-
const sourceSequence = events.at(-1)?.sequence ?? -1;
|
|
254
|
-
if (cursor > sourceSequence) {
|
|
255
|
-
throw new Error('Workroom Projection legacy cursor exceeds the authoritative Journal');
|
|
256
|
-
}
|
|
257
|
-
if (cursor >= sourceSequence) {
|
|
258
|
-
return legacyCursor === undefined
|
|
259
|
-
? current
|
|
260
|
-
: await this.#repository.capture(current.revision, {
|
|
261
|
-
runId: cursorId,
|
|
262
|
-
expectedCursor,
|
|
263
|
-
cursor,
|
|
264
|
-
items: [],
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
const rawProjection = projectEvents(events, cursor, binding);
|
|
268
|
-
const projected = deepFreeze({
|
|
269
|
-
cursor: rawProjection.cursor,
|
|
270
|
-
items: rawProjection.items.map(item => deepFreeze({ ...item, cursorId })),
|
|
271
|
-
});
|
|
272
|
-
if (projected.cursor <= cursor)
|
|
273
|
-
return current;
|
|
274
|
-
if (!this.#governance && projected.items.length > 0) {
|
|
275
|
-
throw new Error('Workroom Projection governance authority is unavailable');
|
|
276
|
-
}
|
|
277
|
-
const governedItems = await Promise.all(projected.items.map(async (draft) => {
|
|
278
|
-
const governed = await this.#governance.prepareProjection({
|
|
279
|
-
operationId: `projection:${binding.projectId}:${runId}:${draft.sourceSequence}`,
|
|
280
|
-
projectId: binding.projectId,
|
|
281
|
-
sinkRuleId: 'projection:workroom',
|
|
282
|
-
body: draft.content,
|
|
283
|
-
sourceEventIds: draft.sourceEventIds,
|
|
284
|
-
}, signal);
|
|
285
|
-
if (governed.status === 'blocked') {
|
|
286
|
-
throw new Error(`Workroom Projection disclosure blocked: ${governed.reason}`);
|
|
287
|
-
}
|
|
288
|
-
return materializeProjectionItem(draft, governed);
|
|
289
|
-
}));
|
|
290
|
-
try {
|
|
291
|
-
return await this.#repository.capture(current.revision, {
|
|
292
|
-
runId: cursorId,
|
|
293
|
-
expectedCursor,
|
|
294
|
-
cursor: projected.cursor,
|
|
295
|
-
items: governedItems,
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
catch (error) {
|
|
299
|
-
if (!(error instanceof WorkroomProjectionRevisionConflictError))
|
|
300
|
-
throw error;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
throw new Error('Workroom Projection capture CAS retries exhausted');
|
|
304
|
-
}
|
|
305
|
-
/** Capture content-free P12 Hold review facts into the same governed IM outbox. */
|
|
306
|
-
async captureLifecycleOverdue(bindingValue, snapshotValue, signal = new AbortController().signal) {
|
|
307
|
-
const binding = freezeAndValidateBinding(bindingValue);
|
|
308
|
-
const snapshot = validateLifecycleOverdueSnapshot(snapshotValue);
|
|
309
|
-
if (snapshot.projectId !== binding.projectId) {
|
|
310
|
-
throw new Error('Workroom Lifecycle Projection binding targets another Project');
|
|
311
|
-
}
|
|
312
|
-
const byObject = new Map();
|
|
313
|
-
for (const item of snapshot.overdue) {
|
|
314
|
-
byObject.set(item.objectId, [...(byObject.get(item.objectId) ?? []), item]);
|
|
315
|
-
}
|
|
316
|
-
let state = await this.#repository.read();
|
|
317
|
-
for (const objectId of [...byObject.keys()].sort(compareCanonicalWorkroomText)) {
|
|
318
|
-
signal.throwIfAborted();
|
|
319
|
-
state = await this.#captureLifecycleObject(binding, objectId, byObject.get(objectId), signal);
|
|
320
|
-
}
|
|
321
|
-
return state;
|
|
322
|
-
}
|
|
323
|
-
/** Publishes one Project-scoped card from a content-free Portfolio projection. */
|
|
324
|
-
async capturePortfolioSponsor(bindingValue, projectionValue, signal = new AbortController().signal) {
|
|
325
|
-
signal.throwIfAborted();
|
|
326
|
-
const binding = freezeAndValidateBinding(bindingValue);
|
|
327
|
-
if (projectionAudience(binding) !== 'sponsor_room') {
|
|
328
|
-
throw new Error('Portfolio Sponsor projection requires a Sponsor Room binding');
|
|
329
|
-
}
|
|
330
|
-
const { digest: suppliedDigest, ...projectionBody } = projectionValue;
|
|
331
|
-
if (suppliedDigest !== digest(projectionBody)) {
|
|
332
|
-
throw new Error('Portfolio Sponsor projection digest mismatch');
|
|
333
|
-
}
|
|
334
|
-
const project = projectionValue.projects[binding.projectId];
|
|
335
|
-
if (!project || project.projectId !== binding.projectId) {
|
|
336
|
-
throw new Error('Portfolio Sponsor projection does not contain the binding Project');
|
|
337
|
-
}
|
|
338
|
-
const runId = workroomPortfolioProjectionCursorKey(projectionValue.portfolioId, binding.projectId);
|
|
339
|
-
const cursorId = projectionBindingCursorKey(runId, binding);
|
|
340
|
-
for (let conflict = 0; conflict < 8; conflict += 1) {
|
|
341
|
-
const current = await this.#repository.read();
|
|
342
|
-
const storedCursor = current.cursors[cursorId];
|
|
343
|
-
const legacyCursor = storedCursor === undefined
|
|
344
|
-
? exactLegacyBindingCursor(current, runId, binding)
|
|
345
|
-
: undefined;
|
|
346
|
-
const cursor = storedCursor ?? legacyCursor ?? -1;
|
|
347
|
-
const expectedCursor = storedCursor ?? -1;
|
|
348
|
-
if (cursor > projectionValue.sourceSequence) {
|
|
349
|
-
throw new Error('Portfolio Sponsor legacy cursor exceeds the authoritative projection');
|
|
350
|
-
}
|
|
351
|
-
if (cursor >= projectionValue.sourceSequence) {
|
|
352
|
-
return legacyCursor === undefined
|
|
353
|
-
? current
|
|
354
|
-
: await this.#repository.capture(current.revision, {
|
|
355
|
-
runId: cursorId,
|
|
356
|
-
expectedCursor,
|
|
357
|
-
cursor,
|
|
358
|
-
items: [],
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
const draft = deepFreeze({
|
|
362
|
-
...portfolioSponsorDraft(binding, projectionValue, runId),
|
|
363
|
-
cursorId,
|
|
364
|
-
});
|
|
365
|
-
if (!this.#governance) {
|
|
366
|
-
throw new Error('Workroom Projection governance authority is unavailable');
|
|
367
|
-
}
|
|
368
|
-
const governed = await this.#governance.prepareProjection({
|
|
369
|
-
operationId: `projection:${draft.sourceEventIds[0]}`,
|
|
370
|
-
projectId: binding.projectId,
|
|
371
|
-
sinkRuleId: 'projection:sponsor-room',
|
|
372
|
-
body: draft.content,
|
|
373
|
-
sourceEventIds: draft.sourceEventIds,
|
|
374
|
-
}, signal);
|
|
375
|
-
if (governed.status === 'blocked') {
|
|
376
|
-
throw new Error(`Workroom Projection disclosure blocked: ${governed.reason}`);
|
|
377
|
-
}
|
|
378
|
-
try {
|
|
379
|
-
return await this.#repository.capture(current.revision, {
|
|
380
|
-
runId: cursorId,
|
|
381
|
-
expectedCursor,
|
|
382
|
-
cursor: projectionValue.sourceSequence,
|
|
383
|
-
items: [materializeProjectionItem(draft, governed)],
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
catch (error) {
|
|
387
|
-
if (!(error instanceof WorkroomProjectionRevisionConflictError) || conflict === 7)
|
|
388
|
-
throw error;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
throw new Error('Portfolio Sponsor projection capture retries exhausted');
|
|
392
|
-
}
|
|
393
|
-
async #captureLifecycleObject(binding, objectId, values, signal) {
|
|
394
|
-
const stateSequences = new Set(values.map(value => value.stateSequence));
|
|
395
|
-
const stateDigests = new Set(values.map(value => value.stateDigest));
|
|
396
|
-
if (stateSequences.size !== 1 || stateDigests.size !== 1) {
|
|
397
|
-
throw new Error('Workroom Lifecycle Projection object state binding is inconsistent');
|
|
398
|
-
}
|
|
399
|
-
const runId = workroomLifecycleProjectionCursorKey(binding.projectId, objectId);
|
|
400
|
-
const cursorId = projectionBindingCursorKey(runId, binding);
|
|
401
|
-
for (let conflict = 0; conflict < 8; conflict += 1) {
|
|
402
|
-
const current = await this.#repository.read();
|
|
403
|
-
const cursor = current.cursors[cursorId] ?? -1;
|
|
404
|
-
const existingSources = new Set(Object.values(current.items)
|
|
405
|
-
.filter(item => item.projectId === binding.projectId
|
|
406
|
-
&& item.bindingRevision === binding.bindingRevision)
|
|
407
|
-
.flatMap(item => item.sourceEventIds));
|
|
408
|
-
const pending = values
|
|
409
|
-
.filter(value => !existingSources.has(lifecycleOverdueSourceEventId(binding.projectId, value)))
|
|
410
|
-
.sort((left, right) => compareCanonicalWorkroomText(lifecycleOverdueSourceEventId(binding.projectId, left), lifecycleOverdueSourceEventId(binding.projectId, right)));
|
|
411
|
-
if (pending.length === 0)
|
|
412
|
-
return current;
|
|
413
|
-
const drafts = pending.map((value, index) => deepFreeze({
|
|
414
|
-
...lifecycleOverdueDraft(binding, runId, value, cursor + index + 1),
|
|
415
|
-
cursorId,
|
|
416
|
-
}));
|
|
417
|
-
if (!this.#governance && drafts.length > 0) {
|
|
418
|
-
throw new Error('Workroom Projection governance authority is unavailable');
|
|
419
|
-
}
|
|
420
|
-
const governedItems = await Promise.all(drafts.map(async (draft) => {
|
|
421
|
-
const governed = await this.#governance.prepareProjection({
|
|
422
|
-
operationId: `projection:${draft.sourceEventIds[0]}`,
|
|
423
|
-
projectId: binding.projectId,
|
|
424
|
-
sinkRuleId: 'projection:sponsor-room',
|
|
425
|
-
body: draft.content,
|
|
426
|
-
sourceEventIds: draft.sourceEventIds,
|
|
427
|
-
}, signal);
|
|
428
|
-
if (governed.status === 'blocked') {
|
|
429
|
-
throw new Error(`Workroom Projection disclosure blocked: ${governed.reason}`);
|
|
430
|
-
}
|
|
431
|
-
return materializeProjectionItem(draft, governed);
|
|
432
|
-
}));
|
|
433
|
-
try {
|
|
434
|
-
return await this.#repository.capture(current.revision, {
|
|
435
|
-
runId: cursorId,
|
|
436
|
-
expectedCursor: cursor,
|
|
437
|
-
cursor: cursor + drafts.length,
|
|
438
|
-
items: governedItems,
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
catch (error) {
|
|
442
|
-
if (!(error instanceof WorkroomProjectionRevisionConflictError))
|
|
443
|
-
throw error;
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
throw new Error('Workroom Lifecycle Projection capture CAS retries exhausted');
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
function emptyProjectionState() {
|
|
450
|
-
return deepFreeze({ revision: 0, bindings: {}, cursors: {}, items: {}, messageIndex: {} });
|
|
451
|
-
}
|
|
452
|
-
function projectionSnapshotName(revision) {
|
|
453
|
-
return `projection.${String(revision).padStart(16, '0')}.json`;
|
|
454
|
-
}
|
|
455
|
-
function parseProjectionState(value, expectedRevision) {
|
|
456
|
-
const snapshot = requireRecord(value, 'snapshot');
|
|
457
|
-
assertExactRecordKeys(snapshot, ['state', 'digest'], 'snapshot');
|
|
458
|
-
const state = requireRecord(snapshot.state, 'snapshot.state');
|
|
459
|
-
if (typeof snapshot.digest !== 'string' || digest(state) !== snapshot.digest) {
|
|
460
|
-
throw new Error('Workroom Projection snapshot digest mismatch');
|
|
461
|
-
}
|
|
462
|
-
assertExactRecordKeys(state, ['revision', 'bindings', 'cursors', 'items', 'messageIndex'], 'snapshot.state');
|
|
463
|
-
if (state.revision !== expectedRevision) {
|
|
464
|
-
throw new Error('Workroom Projection snapshot revision mismatch');
|
|
465
|
-
}
|
|
466
|
-
const bindings = requireRecord(state.bindings, 'snapshot.bindings');
|
|
467
|
-
const cursors = requireRecord(state.cursors, 'snapshot.cursors');
|
|
468
|
-
const items = requireRecord(state.items, 'snapshot.items');
|
|
469
|
-
const messageIndex = requireRecord(state.messageIndex, 'snapshot.messageIndex');
|
|
470
|
-
for (const [bindingKey, bindingValue] of Object.entries(bindings)) {
|
|
471
|
-
const binding = freezeAndValidateBinding(bindingValue);
|
|
472
|
-
if (workroomProjectionBindingKey(binding.projectId, projectionAudience(binding)) !== bindingKey) {
|
|
473
|
-
throw new Error('Workroom Projection binding key mismatch');
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
for (const [runId, cursor] of Object.entries(cursors)) {
|
|
477
|
-
requireText(runId, 'snapshot cursor runId');
|
|
478
|
-
requireSequence(cursor, 'snapshot cursor', 0);
|
|
479
|
-
}
|
|
480
|
-
for (const [itemId, itemValue] of Object.entries(items)) {
|
|
481
|
-
const item = itemValue;
|
|
482
|
-
if (item?.id !== itemId)
|
|
483
|
-
throw new Error('Workroom Projection snapshot item key mismatch');
|
|
484
|
-
const cursorId = item.cursorId ?? item.runId;
|
|
485
|
-
assertProjectionItem(item, cursorId, -1, Number.MAX_SAFE_INTEGER);
|
|
486
|
-
assertDeliveryState(item.delivery, item.conversation);
|
|
487
|
-
const cursor = cursors[cursorId];
|
|
488
|
-
if (typeof cursor !== 'number' || cursor < item.sourceSequence) {
|
|
489
|
-
throw new Error('Workroom Projection snapshot item exceeds durable cursor');
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
for (const [key, entryValue] of Object.entries(messageIndex)) {
|
|
493
|
-
const entry = entryValue;
|
|
494
|
-
const item = items[entry?.projectionId];
|
|
495
|
-
if (!item
|
|
496
|
-
|| workroomProjectionMessageKey(entry.message) !== key
|
|
497
|
-
|| item.delivery.status !== 'sent'
|
|
498
|
-
|| !item.delivery.message
|
|
499
|
-
|| workroomProjectionMessageKey(item.delivery.message) !== key
|
|
500
|
-
|| entry.bindingRevision !== item.bindingRevision
|
|
501
|
-
|| digest(entry.sourceEventIds) !== digest(item.sourceEventIds)
|
|
502
|
-
|| digest(entry.target) !== digest(item.target)
|
|
503
|
-
|| digest(entry.speaker) !== digest(item.speaker)) {
|
|
504
|
-
throw new Error('Workroom Projection Message Index entry is invalid');
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
return deepFreeze({
|
|
508
|
-
revision: expectedRevision,
|
|
509
|
-
bindings: { ...bindings },
|
|
510
|
-
cursors: { ...cursors },
|
|
511
|
-
items: { ...items },
|
|
512
|
-
messageIndex: { ...messageIndex },
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
function applyBinding(state, value) {
|
|
516
|
-
const binding = freezeAndValidateBinding(value);
|
|
517
|
-
const key = workroomProjectionBindingKey(binding.projectId, projectionAudience(binding));
|
|
518
|
-
const current = state.bindings[key];
|
|
519
|
-
if (current && digest(normalizeLegacyBindingAudience(current))
|
|
520
|
-
=== digest(normalizeLegacyBindingAudience(binding)))
|
|
521
|
-
return state;
|
|
522
|
-
if (current && binding.bindingRevision <= current.bindingRevision) {
|
|
523
|
-
throw new Error('Workroom Projection binding revision must advance');
|
|
524
|
-
}
|
|
525
|
-
return deepFreeze({
|
|
526
|
-
...state,
|
|
527
|
-
revision: state.revision + 1,
|
|
528
|
-
bindings: { ...state.bindings, [key]: binding },
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
function normalizeLegacyBindingAudience(binding) {
|
|
532
|
-
return binding.audience === undefined
|
|
533
|
-
? deepFreeze({ ...binding, audience: 'workroom' })
|
|
534
|
-
: binding;
|
|
535
|
-
}
|
|
536
|
-
function applyClaim(state, workerId, now, leaseMs) {
|
|
537
|
-
requireText(workerId, 'claim.workerId');
|
|
538
|
-
requireFiniteNumber(now, 'claim.now');
|
|
539
|
-
requirePositiveInteger(leaseMs, 'claim.leaseMs');
|
|
540
|
-
const current = Object.values(state.items)
|
|
541
|
-
.filter(item => item.delivery.status === 'pending'
|
|
542
|
-
|| (item.delivery.status === 'failed' && item.delivery.retryable === true
|
|
543
|
-
&& (item.delivery.nextAttemptAt === undefined || item.delivery.nextAttemptAt <= now))
|
|
544
|
-
|| (item.delivery.status === 'leased'
|
|
545
|
-
&& Number(item.delivery.leaseExpiresAt) <= now))
|
|
546
|
-
.sort((left, right) => left.sourceSequence - right.sourceSequence || compareCanonicalWorkroomText(left.id, right.id))[0];
|
|
547
|
-
if (!current)
|
|
548
|
-
return undefined;
|
|
549
|
-
const item = deepFreeze({
|
|
550
|
-
...current,
|
|
551
|
-
delivery: {
|
|
552
|
-
status: 'leased',
|
|
553
|
-
attempts: current.delivery.attempts + 1,
|
|
554
|
-
fence: current.delivery.fence + 1,
|
|
555
|
-
leaseOwner: workerId,
|
|
556
|
-
leaseExpiresAt: now + leaseMs,
|
|
557
|
-
},
|
|
558
|
-
});
|
|
559
|
-
return deepFreeze({
|
|
560
|
-
item,
|
|
561
|
-
state: {
|
|
562
|
-
...state,
|
|
563
|
-
revision: state.revision + 1,
|
|
564
|
-
items: { ...state.items, [item.id]: item },
|
|
565
|
-
},
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
function applySettlement(state, itemId, workerId, fence, resultValue, settledAt) {
|
|
569
|
-
requireFiniteNumber(settledAt, 'delivery settledAt');
|
|
570
|
-
const current = state.items[itemId];
|
|
571
|
-
if (!current
|
|
572
|
-
|| current.delivery.status !== 'leased'
|
|
573
|
-
|| current.delivery.leaseOwner !== workerId
|
|
574
|
-
|| current.delivery.fence !== fence) {
|
|
575
|
-
throw new Error('Workroom Projection delivery settlement is stale or not owned');
|
|
576
|
-
}
|
|
577
|
-
const result = normalizeDeliveryResult(resultValue);
|
|
578
|
-
const delivery = result.status === 'sent'
|
|
579
|
-
? {
|
|
580
|
-
status: 'sent',
|
|
581
|
-
attempts: current.delivery.attempts,
|
|
582
|
-
fence: current.delivery.fence,
|
|
583
|
-
...(result.message ? { message: result.message } : {}),
|
|
584
|
-
}
|
|
585
|
-
: {
|
|
586
|
-
status: 'failed',
|
|
587
|
-
attempts: current.delivery.attempts,
|
|
588
|
-
fence: current.delivery.fence,
|
|
589
|
-
failureCode: result.code,
|
|
590
|
-
retryable: result.retryable,
|
|
591
|
-
...(result.retryable ? { nextAttemptAt: settledAt + retryDelay(current.delivery.attempts) } : {}),
|
|
592
|
-
};
|
|
593
|
-
const item = deepFreeze({ ...current, delivery });
|
|
594
|
-
let messageIndex = state.messageIndex;
|
|
595
|
-
if (result.status === 'sent' && result.message) {
|
|
596
|
-
if (digest(result.message.conversation) !== digest(current.conversation)) {
|
|
597
|
-
throw new Error('Workroom Projection receipt targets another conversation');
|
|
598
|
-
}
|
|
599
|
-
const key = workroomProjectionMessageKey(result.message);
|
|
600
|
-
const entry = deepFreeze({
|
|
601
|
-
projectionId: current.id,
|
|
602
|
-
bindingRevision: current.bindingRevision,
|
|
603
|
-
sourceEventIds: current.sourceEventIds,
|
|
604
|
-
target: current.target,
|
|
605
|
-
speaker: current.speaker,
|
|
606
|
-
message: result.message,
|
|
607
|
-
});
|
|
608
|
-
const existing = messageIndex[key];
|
|
609
|
-
if (existing && digest(existing) !== digest(entry)) {
|
|
610
|
-
throw new Error('Workroom Projection Message Index conflict');
|
|
611
|
-
}
|
|
612
|
-
messageIndex = { ...messageIndex, [key]: entry };
|
|
613
|
-
}
|
|
614
|
-
return deepFreeze({
|
|
615
|
-
...state,
|
|
616
|
-
revision: state.revision + 1,
|
|
617
|
-
items: { ...state.items, [itemId]: item },
|
|
618
|
-
messageIndex,
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
function normalizeDeliveryResult(value) {
|
|
622
|
-
if (value?.status === 'failed') {
|
|
623
|
-
requireText(value.code, 'delivery failure code');
|
|
624
|
-
if (typeof value.retryable !== 'boolean') {
|
|
625
|
-
throw new Error('Workroom Projection delivery retryable must be boolean');
|
|
626
|
-
}
|
|
627
|
-
return deepFreeze({ status: 'failed', code: value.code, retryable: value.retryable });
|
|
628
|
-
}
|
|
629
|
-
if (value?.status !== 'sent')
|
|
630
|
-
throw new Error('Workroom Projection delivery result is invalid');
|
|
631
|
-
if (!value.message)
|
|
632
|
-
return Object.freeze({ status: 'sent' });
|
|
633
|
-
requireConversation(value.message.conversation);
|
|
634
|
-
requireText(value.message.id, 'delivery message.id');
|
|
635
|
-
return deepFreeze({ status: 'sent', message: value.message });
|
|
636
|
-
}
|
|
637
|
-
function assertDeliveryState(value, conversation) {
|
|
638
|
-
const delivery = requireRecord(value, 'delivery state');
|
|
639
|
-
if (!Number.isSafeInteger(delivery.attempts) || Number(delivery.attempts) < 0
|
|
640
|
-
|| !Number.isSafeInteger(delivery.fence) || Number(delivery.fence) < 0
|
|
641
|
-
|| delivery.attempts !== delivery.fence) {
|
|
642
|
-
throw new Error('Workroom Projection delivery attempt/fence is invalid');
|
|
643
|
-
}
|
|
644
|
-
if (delivery.status === 'pending') {
|
|
645
|
-
assertExactRecordKeys(delivery, ['status', 'attempts', 'fence'], 'pending delivery');
|
|
646
|
-
if (delivery.attempts !== 0)
|
|
647
|
-
throw new Error('Workroom Projection pending delivery was attempted');
|
|
648
|
-
return;
|
|
649
|
-
}
|
|
650
|
-
if (delivery.status === 'leased') {
|
|
651
|
-
assertExactRecordKeys(delivery, ['status', 'attempts', 'fence', 'leaseOwner', 'leaseExpiresAt'], 'leased delivery');
|
|
652
|
-
requireText(delivery.leaseOwner, 'delivery.leaseOwner');
|
|
653
|
-
requireFiniteNumber(delivery.leaseExpiresAt, 'delivery.leaseExpiresAt');
|
|
654
|
-
return;
|
|
655
|
-
}
|
|
656
|
-
if (delivery.status === 'failed') {
|
|
657
|
-
assertExactRecordKeys(delivery, ['status', 'attempts', 'fence', 'failureCode', 'retryable',
|
|
658
|
-
...(delivery.nextAttemptAt !== undefined ? ['nextAttemptAt'] : [])], 'failed delivery');
|
|
659
|
-
requireText(delivery.failureCode, 'delivery.failureCode');
|
|
660
|
-
if (typeof delivery.retryable !== 'boolean') {
|
|
661
|
-
throw new Error('Workroom Projection failed delivery retryable is invalid');
|
|
662
|
-
}
|
|
663
|
-
if (delivery.nextAttemptAt !== undefined) {
|
|
664
|
-
if (delivery.retryable !== true) {
|
|
665
|
-
throw new Error('Workroom Projection non-retryable delivery cannot have nextAttemptAt');
|
|
666
|
-
}
|
|
667
|
-
requireFiniteNumber(delivery.nextAttemptAt, 'delivery.nextAttemptAt');
|
|
668
|
-
}
|
|
669
|
-
return;
|
|
670
|
-
}
|
|
671
|
-
if (delivery.status !== 'sent') {
|
|
672
|
-
throw new Error('Workroom Projection delivery status is invalid');
|
|
673
|
-
}
|
|
674
|
-
assertExactRecordKeys(delivery, ['status', 'attempts', 'fence', ...(delivery.message ? ['message'] : [])], 'sent delivery');
|
|
675
|
-
if (delivery.message) {
|
|
676
|
-
const message = delivery.message;
|
|
677
|
-
workroomProjectionMessageKey(message);
|
|
678
|
-
if (digest(message.conversation) !== digest(conversation)) {
|
|
679
|
-
throw new Error('Workroom Projection persisted receipt targets another conversation');
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
function retryDelay(attempts) {
|
|
684
|
-
return Math.min(60_000, 1_000 * 2 ** Math.min(6, Math.max(0, attempts - 1)));
|
|
685
|
-
}
|
|
686
|
-
export function workroomProjectionMessageKey(value) {
|
|
687
|
-
if (!value)
|
|
688
|
-
throw new Error('Workroom Projection MessageRef is required');
|
|
689
|
-
requireConversation(value.conversation);
|
|
690
|
-
requireText(value.id, 'message.id');
|
|
691
|
-
return [
|
|
692
|
-
value.conversation.endpoint.adapter,
|
|
693
|
-
value.conversation.endpoint.id,
|
|
694
|
-
value.conversation.kind,
|
|
695
|
-
value.conversation.id,
|
|
696
|
-
value.conversation.parent?.kind ?? '',
|
|
697
|
-
value.conversation.parent?.id ?? '',
|
|
698
|
-
value.conversation.threadId ?? '',
|
|
699
|
-
value.id,
|
|
700
|
-
].join('\0');
|
|
701
|
-
}
|
|
702
|
-
/** Pure Message Index lookup; it proposes context and owns no Kernel command port. */
|
|
703
|
-
export function resolveProjectionReplyTarget(state, input) {
|
|
704
|
-
requireText(input.projectId, 'reply projectId');
|
|
705
|
-
requirePositiveInteger(input.bindingRevision, 'reply bindingRevision');
|
|
706
|
-
const entry = state.messageIndex[workroomProjectionMessageKey(input.replyTo)];
|
|
707
|
-
if (!entry) {
|
|
708
|
-
return deepFreeze({
|
|
709
|
-
status: 'clarification_required',
|
|
710
|
-
reason: 'target_not_found',
|
|
711
|
-
candidateRefs: [],
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
if (entry.target.projectId !== input.projectId) {
|
|
715
|
-
return deepFreeze({
|
|
716
|
-
status: 'clarification_required',
|
|
717
|
-
reason: 'cross_project_target',
|
|
718
|
-
candidateRefs: [entry.target.projectId],
|
|
719
|
-
});
|
|
720
|
-
}
|
|
721
|
-
if (input.bindingRevision !== entry.bindingRevision) {
|
|
722
|
-
return deepFreeze({
|
|
723
|
-
status: 'clarification_required',
|
|
724
|
-
reason: 'stale_binding',
|
|
725
|
-
candidateRefs: [entry.projectionId],
|
|
726
|
-
});
|
|
727
|
-
}
|
|
728
|
-
const target = entry.target;
|
|
729
|
-
if (!target.taskKey || !target.taskRevision
|
|
730
|
-
|| !target.assignmentId || !target.assignmentRevision) {
|
|
731
|
-
return deepFreeze({
|
|
732
|
-
status: 'clarification_required',
|
|
733
|
-
reason: 'non_task_projection',
|
|
734
|
-
candidateRefs: [entry.projectionId],
|
|
735
|
-
});
|
|
736
|
-
}
|
|
737
|
-
const active = input.activeAssignments.some(candidate => candidate.projectId === target.projectId
|
|
738
|
-
&& candidate.runId === target.runId
|
|
739
|
-
&& candidate.taskKey === target.taskKey
|
|
740
|
-
&& candidate.taskRevision === target.taskRevision
|
|
741
|
-
&& candidate.assignmentId === target.assignmentId
|
|
742
|
-
&& candidate.assignmentRevision === target.assignmentRevision);
|
|
743
|
-
return deepFreeze({
|
|
744
|
-
status: 'task_target',
|
|
745
|
-
via: 'reply',
|
|
746
|
-
disposition: input.intent === 'task_input' && active
|
|
747
|
-
? 'context_proposal'
|
|
748
|
-
: 'discussion_only',
|
|
749
|
-
sourceProjectionId: entry.projectionId,
|
|
750
|
-
sourceEventIds: entry.sourceEventIds,
|
|
751
|
-
target: {
|
|
752
|
-
projectId: target.projectId,
|
|
753
|
-
runId: target.runId,
|
|
754
|
-
taskKey: target.taskKey,
|
|
755
|
-
taskRevision: target.taskRevision,
|
|
756
|
-
assignmentId: target.assignmentId,
|
|
757
|
-
assignmentRevision: target.assignmentRevision,
|
|
758
|
-
agentDefinitionId: target.agentDefinitionId,
|
|
759
|
-
status: active ? 'active' : 'historical',
|
|
760
|
-
},
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
function applyCapture(state, input) {
|
|
764
|
-
requireText(input.runId, 'capture.runId');
|
|
765
|
-
requireSequence(input.expectedCursor, 'capture.expectedCursor', -1);
|
|
766
|
-
requireSequence(input.cursor, 'capture.cursor', 0);
|
|
767
|
-
const currentCursor = state.cursors[input.runId] ?? -1;
|
|
768
|
-
if (currentCursor !== input.expectedCursor) {
|
|
769
|
-
throw new Error(`Workroom Projection cursor conflict for ${input.runId}`);
|
|
770
|
-
}
|
|
771
|
-
if (input.cursor <= input.expectedCursor) {
|
|
772
|
-
throw new Error('Workroom Projection capture cursor must advance');
|
|
773
|
-
}
|
|
774
|
-
const items = { ...state.items };
|
|
775
|
-
for (const item of input.items) {
|
|
776
|
-
assertProjectionItem(item, input.runId, input.expectedCursor, input.cursor);
|
|
777
|
-
const existing = items[item.id];
|
|
778
|
-
if (existing && existing.digest !== item.digest) {
|
|
779
|
-
throw new Error(`Workroom Projection item conflict: ${item.id}`);
|
|
780
|
-
}
|
|
781
|
-
items[item.id] = item;
|
|
782
|
-
}
|
|
783
|
-
return deepFreeze({
|
|
784
|
-
revision: state.revision + 1,
|
|
785
|
-
bindings: state.bindings,
|
|
786
|
-
cursors: { ...state.cursors, [input.runId]: input.cursor },
|
|
787
|
-
items,
|
|
788
|
-
messageIndex: state.messageIndex,
|
|
789
|
-
});
|
|
790
|
-
}
|
|
791
|
-
function projectEvents(events, cursor, binding) {
|
|
792
|
-
const assignments = new Map();
|
|
793
|
-
const taskRevisions = new Map();
|
|
794
|
-
const taskAssignments = new Map();
|
|
795
|
-
const items = [];
|
|
796
|
-
let capturedThrough = cursor;
|
|
797
|
-
let pendingProgress = [];
|
|
798
|
-
const flushProgress = () => {
|
|
799
|
-
if (pendingProgress.length === 0)
|
|
800
|
-
return;
|
|
801
|
-
const byAssignment = new Map();
|
|
802
|
-
for (const progressEvent of pendingProgress) {
|
|
803
|
-
const assignmentId = String(progressEvent.payload.assignmentId);
|
|
804
|
-
byAssignment.set(assignmentId, [...(byAssignment.get(assignmentId) ?? []), progressEvent]);
|
|
805
|
-
}
|
|
806
|
-
for (const progressEvents of byAssignment.values()) {
|
|
807
|
-
const latest = progressEvents.at(-1);
|
|
808
|
-
const item = projectEvent(latest, binding, assignments, taskRevisions, taskAssignments, progressProjectionDefinition(latest, assignments, taskAssignments, progressEvents.length), progressEvents);
|
|
809
|
-
if (item)
|
|
810
|
-
items.push(item);
|
|
811
|
-
}
|
|
812
|
-
capturedThrough = pendingProgress.at(-1).sequence;
|
|
813
|
-
pendingProgress = [];
|
|
814
|
-
};
|
|
815
|
-
for (const event of events) {
|
|
816
|
-
if (event.type === 'task.planned')
|
|
817
|
-
taskRevisions.set(String(event.payload.taskKey), 1);
|
|
818
|
-
if (event.type === 'task.revised') {
|
|
819
|
-
const taskKey = String(event.payload.taskKey);
|
|
820
|
-
taskRevisions.set(taskKey, (taskRevisions.get(taskKey) ?? 0) + 1);
|
|
821
|
-
}
|
|
822
|
-
if (event.type === 'assignment.claimed') {
|
|
823
|
-
const scope = {
|
|
824
|
-
assignmentId: String(event.payload.assignmentId),
|
|
825
|
-
taskKey: String(event.payload.taskKey),
|
|
826
|
-
taskRevision: Number(event.payload.taskRevision),
|
|
827
|
-
assignmentRevision: Number(event.payload.assignmentRevision),
|
|
828
|
-
owner: String(event.payload.owner),
|
|
829
|
-
role: event.payload.role,
|
|
830
|
-
};
|
|
831
|
-
assignments.set(scope.assignmentId, scope);
|
|
832
|
-
taskAssignments.set(scope.taskKey, scope.assignmentId);
|
|
833
|
-
}
|
|
834
|
-
if (event.sequence <= cursor)
|
|
835
|
-
continue;
|
|
836
|
-
if (event.type === 'assignment.progress') {
|
|
837
|
-
pendingProgress.push(event);
|
|
838
|
-
if (pendingProgress.length >= progressWindowSizeForPolicy(binding.projectionPolicyRevision)) {
|
|
839
|
-
flushProgress();
|
|
840
|
-
}
|
|
841
|
-
continue;
|
|
842
|
-
}
|
|
843
|
-
const item = projectEvent(event, binding, assignments, taskRevisions, taskAssignments);
|
|
844
|
-
if (item) {
|
|
845
|
-
// Observable boundaries are immediate. Any partial progress window is
|
|
846
|
-
// deterministically closed before the boundary rather than timer-flushed.
|
|
847
|
-
flushProgress();
|
|
848
|
-
items.push(item);
|
|
849
|
-
capturedThrough = event.sequence;
|
|
850
|
-
}
|
|
851
|
-
else if (pendingProgress.length === 0) {
|
|
852
|
-
capturedThrough = event.sequence;
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
return deepFreeze({ items, cursor: capturedThrough });
|
|
856
|
-
}
|
|
857
|
-
function projectEvent(event, binding, assignments, taskRevisions, taskAssignments, definitionOverride, sourceEvents = [event]) {
|
|
858
|
-
const assignmentId = assignmentIdForEvent(event, taskAssignments);
|
|
859
|
-
const assignment = assignmentId ? assignments.get(assignmentId) : undefined;
|
|
860
|
-
const definition = definitionOverride ?? projectionDefinition(event, assignment);
|
|
861
|
-
if (!definition)
|
|
862
|
-
return undefined;
|
|
863
|
-
const speaker = assignment
|
|
864
|
-
? requireAgentIdentity(binding, assignment)
|
|
865
|
-
: binding.orchestrator;
|
|
866
|
-
const taskKey = assignment?.taskKey ?? taskKeyForEvent(event);
|
|
867
|
-
const taskRevision = assignment?.taskRevision
|
|
868
|
-
?? (taskKey ? taskRevisions.get(taskKey) : undefined);
|
|
869
|
-
const target = deepFreeze({
|
|
870
|
-
projectId: binding.projectId,
|
|
871
|
-
runId: event.runId,
|
|
872
|
-
...(taskKey ? { taskKey } : {}),
|
|
873
|
-
...(taskRevision ? { taskRevision } : {}),
|
|
874
|
-
...(assignment ? { assignmentId: assignment.assignmentId } : {}),
|
|
875
|
-
...(assignment ? { assignmentRevision: assignment.assignmentRevision } : {}),
|
|
876
|
-
agentDefinitionId: speaker.agentDefinitionId,
|
|
877
|
-
});
|
|
878
|
-
const immutableProjection = {
|
|
879
|
-
version: 1,
|
|
880
|
-
audience: 'workroom',
|
|
881
|
-
projectId: binding.projectId,
|
|
882
|
-
runId: event.runId,
|
|
883
|
-
sourceEventIds: sourceEvents.map(sourceEvent => sourceEvent.eventId),
|
|
884
|
-
sourceSequence: event.sequence,
|
|
885
|
-
bindingRevision: binding.bindingRevision,
|
|
886
|
-
projectionPolicyRevision: binding.projectionPolicyRevision,
|
|
887
|
-
conversation: projectionConversationForSpeaker(binding, speaker),
|
|
888
|
-
speaker,
|
|
889
|
-
kind: definition.kind,
|
|
890
|
-
content: `[${speaker.displayName} · ${speaker.role}] ${definition.content}`,
|
|
891
|
-
target,
|
|
892
|
-
};
|
|
893
|
-
const itemDigest = digest(immutableProjection);
|
|
894
|
-
const id = `projection:${itemDigest.slice('sha256:'.length)}`;
|
|
895
|
-
return deepFreeze({
|
|
896
|
-
...immutableProjection,
|
|
897
|
-
id,
|
|
898
|
-
idempotencyKey: id,
|
|
899
|
-
digest: itemDigest,
|
|
900
|
-
delivery: { status: 'pending', attempts: 0, fence: 0 },
|
|
901
|
-
});
|
|
902
|
-
}
|
|
903
|
-
export function workroomLifecycleProjectionCursorKey(projectId, objectId) {
|
|
904
|
-
requireText(projectId, 'Lifecycle Projection projectId');
|
|
905
|
-
requireText(objectId, 'Lifecycle Projection objectId');
|
|
906
|
-
return `payload-lifecycle:${digest({ version: 1, projectId, objectId }).slice('sha256:'.length)}`;
|
|
907
|
-
}
|
|
908
|
-
function projectionBindingCursorKey(sourceKey, binding) {
|
|
909
|
-
requireText(sourceKey, 'Projection cursor source key');
|
|
910
|
-
return `binding-cursor:${digest({
|
|
911
|
-
version: 1,
|
|
912
|
-
sourceKey,
|
|
913
|
-
projectId: binding.projectId,
|
|
914
|
-
audience: projectionAudience(binding),
|
|
915
|
-
bindingRevision: binding.bindingRevision,
|
|
916
|
-
catalogBindingDigest: binding.catalogBindingDigest,
|
|
917
|
-
conversation: binding.conversation,
|
|
918
|
-
}).slice('sha256:'.length)}`;
|
|
919
|
-
}
|
|
920
|
-
function exactLegacyBindingCursor(state, sourceKey, binding) {
|
|
921
|
-
const cursor = state.cursors[sourceKey];
|
|
922
|
-
if (cursor === undefined)
|
|
923
|
-
return undefined;
|
|
924
|
-
const legacyItems = Object.values(state.items).filter(item => item.cursorId === undefined && item.runId === sourceKey);
|
|
925
|
-
if (legacyItems.length === 0)
|
|
926
|
-
return undefined;
|
|
927
|
-
const audience = projectionAudience(binding);
|
|
928
|
-
return legacyItems.every(item => item.projectId === binding.projectId
|
|
929
|
-
&& (item.audience ?? 'workroom') === audience
|
|
930
|
-
&& item.bindingRevision === binding.bindingRevision
|
|
931
|
-
&& item.projectionPolicyRevision === binding.projectionPolicyRevision
|
|
932
|
-
&& digest(item.conversation) === digest(binding.conversation)) ? cursor : undefined;
|
|
933
|
-
}
|
|
934
|
-
export function workroomPortfolioProjectionCursorKey(portfolioId, projectId) {
|
|
935
|
-
requireText(portfolioId, 'Portfolio Projection portfolioId');
|
|
936
|
-
requireText(projectId, 'Portfolio Projection projectId');
|
|
937
|
-
return `portfolio-sponsor:${digest({ version: 1, portfolioId, projectId }).slice('sha256:'.length)}`;
|
|
938
|
-
}
|
|
939
|
-
function portfolioSponsorDraft(binding, projection, runId) {
|
|
940
|
-
const project = projection.projects[binding.projectId];
|
|
941
|
-
const speaker = binding.orchestrator;
|
|
942
|
-
const sourceEventIds = [`portfolio-sponsor:${digest({
|
|
943
|
-
version: 1,
|
|
944
|
-
portfolioId: projection.portfolioId,
|
|
945
|
-
projectId: binding.projectId,
|
|
946
|
-
sourceSequence: projection.sourceSequence,
|
|
947
|
-
projectionDigest: projection.digest,
|
|
948
|
-
}).slice('sha256:'.length)}`];
|
|
949
|
-
const queue = project.queueHead
|
|
950
|
-
? `queue=${boundedProjectionText(project.queueHead.opaqueHeadId, 'opaque')} `
|
|
951
|
-
+ `starvationAt=${project.queueHead.starvationAt}`
|
|
952
|
-
: 'queue=empty';
|
|
953
|
-
const rate = Object.entries(project.rate)
|
|
954
|
-
.sort(([left], [right]) => compareCanonicalWorkroomText(left, right))
|
|
955
|
-
.map(([poolId, window]) => `${boundedProjectionText(poolId, 'pool')}:`
|
|
956
|
-
+ `${window.usedUnits}/${window.limitUnits}@${window.windowStart}-${window.windowEnd}`)
|
|
957
|
-
.join(',') || 'none';
|
|
958
|
-
const immutableProjection = {
|
|
959
|
-
version: 1,
|
|
960
|
-
audience: 'sponsor_room',
|
|
961
|
-
projectId: binding.projectId,
|
|
962
|
-
runId,
|
|
963
|
-
sourceEventIds,
|
|
964
|
-
sourceSequence: projection.sourceSequence,
|
|
965
|
-
bindingRevision: binding.bindingRevision,
|
|
966
|
-
projectionPolicyRevision: binding.projectionPolicyRevision,
|
|
967
|
-
conversation: binding.conversation,
|
|
968
|
-
speaker,
|
|
969
|
-
kind: (project.blockers.length > 0 ? 'attention' : 'status'),
|
|
970
|
-
content: `[${speaker.displayName} · ${speaker.role}] Portfolio ${boundedProjectionText(projection.portfolioId, 'portfolio')} / Project ${boundedProjectionText(binding.projectId, 'project')}:`
|
|
971
|
-
+ `lane=${project.lane} status=${project.status} ${queue} `
|
|
972
|
-
+ `grants=${project.grants.length} reclaims=${project.reclaims.length} `
|
|
973
|
-
+ `budget=${project.budget.availableMicros}/${project.budget.limitMicros} `
|
|
974
|
-
+ `rate=${rate} fairness=${project.fairness.weightedService} `
|
|
975
|
-
+ `blockers=${project.blockers.join(',') || 'none'}`,
|
|
976
|
-
target: deepFreeze({
|
|
977
|
-
projectId: binding.projectId,
|
|
978
|
-
runId,
|
|
979
|
-
agentDefinitionId: speaker.agentDefinitionId,
|
|
980
|
-
}),
|
|
981
|
-
};
|
|
982
|
-
const itemDigest = digest(immutableProjection);
|
|
983
|
-
const id = `projection:${itemDigest.slice('sha256:'.length)}`;
|
|
984
|
-
return deepFreeze({
|
|
985
|
-
...immutableProjection,
|
|
986
|
-
id,
|
|
987
|
-
idempotencyKey: id,
|
|
988
|
-
digest: itemDigest,
|
|
989
|
-
delivery: { status: 'pending', attempts: 0, fence: 0 },
|
|
990
|
-
});
|
|
991
|
-
}
|
|
992
|
-
function lifecycleOverdueSourceEventId(projectId, value) {
|
|
993
|
-
return `payload-hold-overdue:${digest({
|
|
994
|
-
version: 1,
|
|
995
|
-
projectId,
|
|
996
|
-
objectId: value.objectId,
|
|
997
|
-
holdId: value.holdId,
|
|
998
|
-
reasonCode: value.reasonCode,
|
|
999
|
-
placedAt: value.placedAt,
|
|
1000
|
-
reviewAt: value.reviewAt,
|
|
1001
|
-
}).slice('sha256:'.length)}`;
|
|
1002
|
-
}
|
|
1003
|
-
function lifecycleOverdueDraft(binding, runId, value, sourceSequence) {
|
|
1004
|
-
const speaker = binding.orchestrator;
|
|
1005
|
-
const sourceEventIds = [lifecycleOverdueSourceEventId(binding.projectId, value)];
|
|
1006
|
-
const immutableProjection = {
|
|
1007
|
-
version: 1,
|
|
1008
|
-
audience: 'sponsor_room',
|
|
1009
|
-
projectId: binding.projectId,
|
|
1010
|
-
runId,
|
|
1011
|
-
sourceEventIds,
|
|
1012
|
-
sourceSequence,
|
|
1013
|
-
bindingRevision: binding.bindingRevision,
|
|
1014
|
-
projectionPolicyRevision: binding.projectionPolicyRevision,
|
|
1015
|
-
conversation: binding.conversation,
|
|
1016
|
-
speaker,
|
|
1017
|
-
kind: 'attention',
|
|
1018
|
-
content: `[${speaker.displayName} · ${speaker.role}] Retention Hold review overdue:`
|
|
1019
|
-
+ `object ${boundedProjectionText(value.objectId, 'unknown')};`
|
|
1020
|
-
+ `hold ${boundedProjectionText(value.holdId, 'unknown')};reviewAt ${value.reviewAt}`,
|
|
1021
|
-
target: deepFreeze({
|
|
1022
|
-
projectId: binding.projectId,
|
|
1023
|
-
runId,
|
|
1024
|
-
agentDefinitionId: speaker.agentDefinitionId,
|
|
1025
|
-
}),
|
|
1026
|
-
};
|
|
1027
|
-
const itemDigest = digest(immutableProjection);
|
|
1028
|
-
const id = `projection:${itemDigest.slice('sha256:'.length)}`;
|
|
1029
|
-
return deepFreeze({
|
|
1030
|
-
...immutableProjection,
|
|
1031
|
-
id,
|
|
1032
|
-
idempotencyKey: id,
|
|
1033
|
-
digest: itemDigest,
|
|
1034
|
-
delivery: { status: 'pending', attempts: 0, fence: 0 },
|
|
1035
|
-
});
|
|
1036
|
-
}
|
|
1037
|
-
function validateLifecycleOverdueSnapshot(value) {
|
|
1038
|
-
if (!value || value.version !== 1 || !Array.isArray(value.overdue)
|
|
1039
|
-
|| !Number.isSafeInteger(value.clockRevision) || value.clockRevision < 0
|
|
1040
|
-
|| !Number.isSafeInteger(value.observedAt) || value.observedAt < 0) {
|
|
1041
|
-
throw new Error('Workroom Lifecycle overdue projection is invalid');
|
|
1042
|
-
}
|
|
1043
|
-
requireText(value.projectId, 'Lifecycle overdue Project');
|
|
1044
|
-
const identities = new Set();
|
|
1045
|
-
for (const item of value.overdue) {
|
|
1046
|
-
requireText(item.objectId, 'Lifecycle overdue object');
|
|
1047
|
-
requireText(item.holdId, 'Lifecycle overdue Hold');
|
|
1048
|
-
requireText(item.ownerPrincipalId, 'Lifecycle overdue owner');
|
|
1049
|
-
if (!Number.isSafeInteger(item.stateSequence) || item.stateSequence < 0
|
|
1050
|
-
|| !/^sha256:[a-f0-9]{64}$/u.test(item.stateDigest)
|
|
1051
|
-
|| !['legal_hold', 'investigation', 'regulatory_preservation'].includes(item.reasonCode)
|
|
1052
|
-
|| !Number.isSafeInteger(item.placedAt) || item.placedAt < 0
|
|
1053
|
-
|| !Number.isSafeInteger(item.reviewAt) || item.reviewAt <= item.placedAt
|
|
1054
|
-
|| !Number.isSafeInteger(item.overdueBy) || item.overdueBy < 0) {
|
|
1055
|
-
throw new Error('Workroom Lifecycle overdue Hold is invalid');
|
|
1056
|
-
}
|
|
1057
|
-
const identity = lifecycleOverdueSourceEventId(value.projectId, item);
|
|
1058
|
-
if (identities.has(identity))
|
|
1059
|
-
throw new Error('Workroom Lifecycle overdue projection contains duplicates');
|
|
1060
|
-
identities.add(identity);
|
|
1061
|
-
}
|
|
1062
|
-
const { digest: supplied, ...body } = value;
|
|
1063
|
-
if (supplied !== digest(body))
|
|
1064
|
-
throw new Error('Workroom Lifecycle overdue projection digest mismatch');
|
|
1065
|
-
return deepFreeze(structuredClone(value));
|
|
1066
|
-
}
|
|
1067
|
-
function materializeProjectionItem(draft, governed) {
|
|
1068
|
-
const { content: _body, id: _draftId, idempotencyKey: _draftKey, digest: _draftDigest, delivery, ...header } = draft;
|
|
1069
|
-
const projection = deepFreeze({
|
|
1070
|
-
...header,
|
|
1071
|
-
disclosure: {
|
|
1072
|
-
request: structuredClone(governed.request),
|
|
1073
|
-
manifest: structuredClone(governed.manifest),
|
|
1074
|
-
},
|
|
1075
|
-
});
|
|
1076
|
-
const itemDigest = digest(projection);
|
|
1077
|
-
const id = `projection:${itemDigest.slice('sha256:'.length)}`;
|
|
1078
|
-
return deepFreeze({
|
|
1079
|
-
...projection,
|
|
1080
|
-
id,
|
|
1081
|
-
idempotencyKey: id,
|
|
1082
|
-
digest: itemDigest,
|
|
1083
|
-
delivery: structuredClone(delivery),
|
|
1084
|
-
});
|
|
1085
|
-
}
|
|
1086
|
-
function projectionDefinition(event, assignment) {
|
|
1087
|
-
const taskKey = assignment?.taskKey ?? taskKeyForEvent(event);
|
|
1088
|
-
switch (event.type) {
|
|
1089
|
-
case 'run.created':
|
|
1090
|
-
return { kind: 'status', content: `Run 已启动:${boundedProjectionText(event.payload.title, '未命名 Run')}` };
|
|
1091
|
-
case 'task.planned':
|
|
1092
|
-
return { kind: 'status', content: `${taskKey}:已规划` };
|
|
1093
|
-
case 'assignment.claimed':
|
|
1094
|
-
return { kind: 'status', content: `${taskKey}:已领取当前工作` };
|
|
1095
|
-
case 'assignment.started':
|
|
1096
|
-
return { kind: 'status', content: `${taskKey}:正在执行` };
|
|
1097
|
-
case 'assignment.checkpointed':
|
|
1098
|
-
return { kind: 'milestone', content: `${taskKey}:已形成 checkpoint` };
|
|
1099
|
-
case 'assignment.execution_completed':
|
|
1100
|
-
return { kind: 'conclusion', content: `${taskKey}:已提交执行结论,等待验收` };
|
|
1101
|
-
case 'task.blocked':
|
|
1102
|
-
return { kind: 'attention', content: `${taskKey}:阻塞——${boundedProjectionText(event.payload.reason, '原因未说明')}` };
|
|
1103
|
-
case 'task.accepted':
|
|
1104
|
-
return { kind: 'conclusion', content: `${taskKey}:已验收` };
|
|
1105
|
-
case 'task.failed':
|
|
1106
|
-
return { kind: 'attention', content: `${taskKey}:失败——${boundedProjectionText(event.payload.reason, '原因未说明')}` };
|
|
1107
|
-
case 'reviewer.assigned':
|
|
1108
|
-
return { kind: 'attention', content: `${taskKey}:已进入 Reviewer 验收` };
|
|
1109
|
-
case 'sponsor_gate.opened':
|
|
1110
|
-
return { kind: 'attention', content: `${taskKey}:等待 Sponsor 决策` };
|
|
1111
|
-
case 'sponsor_gate.expired':
|
|
1112
|
-
return { kind: 'attention', content: `${taskKey}:Sponsor 决策已过期` };
|
|
1113
|
-
case 'sponsor_gate.decided':
|
|
1114
|
-
return {
|
|
1115
|
-
kind: 'attention',
|
|
1116
|
-
content: `${taskKey}:Sponsor 已${sponsorDecisionLabel(event.payload.decision)}`,
|
|
1117
|
-
};
|
|
1118
|
-
case 'plan_gate.decided':
|
|
1119
|
-
return {
|
|
1120
|
-
kind: 'attention',
|
|
1121
|
-
content: `${taskKey}:Sponsor 已对执行前 Plan Gate ${sponsorDecisionLabel(event.payload.decision)}`,
|
|
1122
|
-
};
|
|
1123
|
-
case 'task.rework_requested':
|
|
1124
|
-
return {
|
|
1125
|
-
kind: 'attention',
|
|
1126
|
-
content: `${taskKey}:已要求返工——${boundedProjectionText(event.payload.reason, '原因未说明')}`,
|
|
1127
|
-
};
|
|
1128
|
-
case 'assignment.lease_expired':
|
|
1129
|
-
return { kind: 'attention', content: `${taskKey}:执行租约已过期,等待恢复` };
|
|
1130
|
-
case 'assignment.cancel_requested':
|
|
1131
|
-
return { kind: 'attention', content: `${taskKey}:执行已请求取消` };
|
|
1132
|
-
case 'assignment.cancelled':
|
|
1133
|
-
return { kind: 'attention', content: `${taskKey}:执行已取消` };
|
|
1134
|
-
case 'task.cancel_requested':
|
|
1135
|
-
return { kind: 'attention', content: `${taskKey}:已请求取消` };
|
|
1136
|
-
case 'run.cancel_requested':
|
|
1137
|
-
return {
|
|
1138
|
-
kind: 'attention',
|
|
1139
|
-
content: `Run 已请求取消——${boundedProjectionText(event.payload.reason, '原因未说明')}`,
|
|
1140
|
-
};
|
|
1141
|
-
case 'task.cancelled':
|
|
1142
|
-
return { kind: 'attention', content: `${taskKey}:已取消` };
|
|
1143
|
-
case 'run.cancelled':
|
|
1144
|
-
return { kind: 'attention', content: 'Run 已取消' };
|
|
1145
|
-
default:
|
|
1146
|
-
return undefined;
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
function progressProjectionDefinition(event, assignments, taskAssignments, count) {
|
|
1150
|
-
const assignmentId = assignmentIdForEvent(event, taskAssignments);
|
|
1151
|
-
const taskKey = assignmentId ? assignments.get(assignmentId)?.taskKey : undefined;
|
|
1152
|
-
const progress = event.payload.progress;
|
|
1153
|
-
const completedUnits = progress.completedUnits;
|
|
1154
|
-
const totalUnits = progress.totalUnits;
|
|
1155
|
-
const units = typeof completedUnits === 'number' && Number.isFinite(completedUnits)
|
|
1156
|
-
&& typeof totalUnits === 'number' && Number.isFinite(totalUnits)
|
|
1157
|
-
? `(${completedUnits}/${totalUnits})`
|
|
1158
|
-
: '';
|
|
1159
|
-
const window = count > 1 ? `;本窗口 ${count} 次更新` : '';
|
|
1160
|
-
return {
|
|
1161
|
-
kind: 'progress',
|
|
1162
|
-
content: `${taskKey ?? '未知任务'}:${boundedProjectionText(progress.summary, '进度已更新')}${units}${window}`,
|
|
1163
|
-
};
|
|
1164
|
-
}
|
|
1165
|
-
/** Policy revision pins the aggregation contract; source Kernel order closes each fixed window. */
|
|
1166
|
-
function progressWindowSizeForPolicy(projectionPolicyRevision) {
|
|
1167
|
-
requirePositiveInteger(projectionPolicyRevision, 'projectionPolicyRevision');
|
|
1168
|
-
return 3;
|
|
1169
|
-
}
|
|
1170
|
-
function boundedProjectionText(value, fallback) {
|
|
1171
|
-
if (typeof value !== 'string')
|
|
1172
|
-
return fallback;
|
|
1173
|
-
const canonical = value.replace(/[\p{Cc}\p{Cf}\s]+/gu, ' ').trim();
|
|
1174
|
-
return (canonical || fallback).slice(0, 240);
|
|
1175
|
-
}
|
|
1176
|
-
function sponsorDecisionLabel(value) {
|
|
1177
|
-
switch (value) {
|
|
1178
|
-
case 'approve': return '批准';
|
|
1179
|
-
case 'reject': return '拒绝';
|
|
1180
|
-
case 'request_changes': return '要求修改';
|
|
1181
|
-
case 'cancel': return '取消';
|
|
1182
|
-
default: return '作出决策';
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
function assignmentIdForEvent(event, taskAssignments) {
|
|
1186
|
-
if (event.type.startsWith('assignment.'))
|
|
1187
|
-
return String(event.payload.assignmentId ?? '') || undefined;
|
|
1188
|
-
const taskKey = taskKeyForEvent(event);
|
|
1189
|
-
return taskKey ? taskAssignments.get(taskKey) : undefined;
|
|
1190
|
-
}
|
|
1191
|
-
function taskKeyForEvent(event) {
|
|
1192
|
-
const value = event.payload.taskKey;
|
|
1193
|
-
return typeof value === 'string' && value ? value : undefined;
|
|
1194
|
-
}
|
|
1195
|
-
function requireAgentIdentity(binding, assignment) {
|
|
1196
|
-
const matches = binding.agents.filter(identity => identity.principalId === assignment.owner && identity.role === assignment.role);
|
|
1197
|
-
if (matches.length !== 1) {
|
|
1198
|
-
throw new Error(`Workroom Projection requires one named Agent identity for ${assignment.assignmentId}`);
|
|
1199
|
-
}
|
|
1200
|
-
return matches[0];
|
|
1201
|
-
}
|
|
1202
|
-
function projectionConversationForSpeaker(binding, speaker) {
|
|
1203
|
-
if (!speaker.messageEndpoint)
|
|
1204
|
-
return binding.conversation;
|
|
1205
|
-
return deepFreeze({
|
|
1206
|
-
...binding.conversation,
|
|
1207
|
-
endpoint: speaker.messageEndpoint,
|
|
1208
|
-
});
|
|
1209
|
-
}
|
|
1210
|
-
function freezeAndValidateBinding(value) {
|
|
1211
|
-
if (value.version !== 1)
|
|
1212
|
-
throw new Error('Workroom Projection binding version is unsupported');
|
|
1213
|
-
projectionAudience(value);
|
|
1214
|
-
requireText(value.projectId, 'binding.projectId');
|
|
1215
|
-
if (!/^sha256:[a-f0-9]{64}$/u.test(value.catalogBindingDigest)) {
|
|
1216
|
-
throw new Error('Workroom Projection binding.catalogBindingDigest is invalid');
|
|
1217
|
-
}
|
|
1218
|
-
requirePositiveInteger(value.bindingRevision, 'binding.bindingRevision');
|
|
1219
|
-
requirePositiveInteger(value.projectionPolicyRevision, 'binding.projectionPolicyRevision');
|
|
1220
|
-
requireConversation(value.conversation);
|
|
1221
|
-
requireIdentity(value.orchestrator, 'binding.orchestrator');
|
|
1222
|
-
if (value.orchestrator.role !== 'orchestrator' || !Array.isArray(value.agents)) {
|
|
1223
|
-
throw new Error('Workroom Projection binding requires an Orchestrator and Agent directory');
|
|
1224
|
-
}
|
|
1225
|
-
for (const identity of value.agents)
|
|
1226
|
-
requireIdentity(identity, 'binding.agents[]');
|
|
1227
|
-
return deepFreeze(value);
|
|
1228
|
-
}
|
|
1229
|
-
export function workroomProjectionBindingKey(projectId, audience) {
|
|
1230
|
-
requireText(projectId, 'binding key projectId');
|
|
1231
|
-
return audience === 'workroom' ? projectId : `${projectId}:sponsor-room`;
|
|
1232
|
-
}
|
|
1233
|
-
export function projectionAudience(value) {
|
|
1234
|
-
if (value.audience === undefined)
|
|
1235
|
-
return 'workroom';
|
|
1236
|
-
if (value.audience !== 'workroom' && value.audience !== 'sponsor_room') {
|
|
1237
|
-
throw new Error('Workroom Projection audience is invalid');
|
|
1238
|
-
}
|
|
1239
|
-
return value.audience;
|
|
1240
|
-
}
|
|
1241
|
-
function assertProjectionItem(item, runId, after, through) {
|
|
1242
|
-
projectionAudience(item);
|
|
1243
|
-
if ('content' in item) {
|
|
1244
|
-
throw new Error('Legacy plaintext Workroom Projection snapshot is unsupported; use offline export then purge it');
|
|
1245
|
-
}
|
|
1246
|
-
if (item.version !== 1 || (item.cursorId ?? item.runId) !== runId
|
|
1247
|
-
|| item.sourceSequence <= after || item.sourceSequence > through
|
|
1248
|
-
|| item.id !== item.idempotencyKey || !/^projection:[a-f0-9]{64}$/u.test(item.id)
|
|
1249
|
-
|| !/^sha256:[a-f0-9]{64}$/u.test(item.digest)) {
|
|
1250
|
-
throw new Error('Invalid Workroom Projection outbox item');
|
|
1251
|
-
}
|
|
1252
|
-
const expectedChannel = projectionAudience(item) === 'sponsor_room'
|
|
1253
|
-
? 'sponsor_projection'
|
|
1254
|
-
: 'workroom_projection';
|
|
1255
|
-
if (!item.disclosure?.request || !item.disclosure.manifest
|
|
1256
|
-
|| item.disclosure.request.projectId !== item.projectId
|
|
1257
|
-
|| item.disclosure.manifest.source.payloadHash !== item.disclosure.request.sourceDigest
|
|
1258
|
-
|| item.disclosure.manifest.channel !== expectedChannel) {
|
|
1259
|
-
throw new Error('Invalid Workroom Projection Disclosure Manifest');
|
|
1260
|
-
}
|
|
1261
|
-
const { id: _id, idempotencyKey: _key, digest: _digest, delivery: _delivery, ...projection } = item;
|
|
1262
|
-
if (digest(projection) !== item.digest || item.id !== `projection:${item.digest.slice(7)}`) {
|
|
1263
|
-
throw new Error('Workroom Projection outbox item digest mismatch');
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
function requireConversation(value) {
|
|
1267
|
-
requireText(value.endpoint?.id, 'conversation.endpoint.id');
|
|
1268
|
-
requireText(value.endpoint?.adapter, 'conversation.endpoint.adapter');
|
|
1269
|
-
requireText(value.id, 'conversation.id');
|
|
1270
|
-
if (!['private', 'group', 'channel'].includes(value.kind)) {
|
|
1271
|
-
throw new Error('Workroom Projection conversation kind is invalid');
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
function requireIdentity(value, label) {
|
|
1275
|
-
requireText(value.principalId, `${label}.principalId`);
|
|
1276
|
-
requireText(value.agentDefinitionId, `${label}.agentDefinitionId`);
|
|
1277
|
-
requireText(value.displayName, `${label}.displayName`);
|
|
1278
|
-
if (!['orchestrator', 'executor', 'reviewer', 'integration'].includes(value.role)) {
|
|
1279
|
-
throw new Error(`Workroom Projection ${label}.role is invalid`);
|
|
1280
|
-
}
|
|
1281
|
-
if (value.messageEndpoint) {
|
|
1282
|
-
requireText(value.messageEndpoint.id, `${label}.messageEndpoint.id`);
|
|
1283
|
-
requireText(value.messageEndpoint.adapter, `${label}.messageEndpoint.adapter`);
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
function requireText(value, label) {
|
|
1287
|
-
if (typeof value !== 'string' || !value.trim()) {
|
|
1288
|
-
throw new Error(`Workroom Projection ${label} requires non-empty text`);
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
function requirePositiveInteger(value, label) {
|
|
1292
|
-
if (!Number.isSafeInteger(value) || Number(value) < 1) {
|
|
1293
|
-
throw new Error(`Workroom Projection ${label} must be a positive integer`);
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
function requireSequence(value, label, minimum) {
|
|
1297
|
-
if (!Number.isSafeInteger(value) || Number(value) < minimum) {
|
|
1298
|
-
throw new Error(`Workroom Projection ${label} is invalid`);
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
function requireFiniteNumber(value, label) {
|
|
1302
|
-
if (typeof value !== 'number' || !Number.isFinite(value)) {
|
|
1303
|
-
throw new Error(`Workroom Projection ${label} must be finite`);
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
function requireRecord(value, label) {
|
|
1307
|
-
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
1308
|
-
throw new Error(`Workroom Projection ${label} must be an object`);
|
|
1309
|
-
}
|
|
1310
|
-
return value;
|
|
1311
|
-
}
|
|
1312
|
-
function assertExactRecordKeys(value, expected, label) {
|
|
1313
|
-
const actual = Object.keys(value).sort();
|
|
1314
|
-
const canonical = [...expected].sort();
|
|
1315
|
-
if (actual.length !== canonical.length
|
|
1316
|
-
|| actual.some((key, index) => key !== canonical[index])) {
|
|
1317
|
-
throw new Error(`Workroom Projection ${label} fields are invalid`);
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
function hasCode(error, code) {
|
|
1321
|
-
return Boolean(error && typeof error === 'object' && 'code' in error
|
|
1322
|
-
&& error.code === code);
|
|
1323
|
-
}
|
|
1324
|
-
//# sourceMappingURL=projection-outbox.js.map
|