@zhin.js/agent 1.1.13 → 1.1.14
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 +40 -20
- package/lib/ai-event-bus.d.ts +1 -1
- package/lib/ai-hook-handlers.d.ts +1 -1
- package/lib/assistant/config.d.ts +3 -17
- package/lib/assistant/config.d.ts.map +1 -1
- package/lib/assistant/config.js +1 -8
- package/lib/assistant/config.js.map +1 -1
- package/lib/assistant/index.d.ts +6 -9
- package/lib/assistant/index.d.ts.map +1 -1
- package/lib/assistant/index.js +4 -6
- package/lib/assistant/index.js.map +1 -1
- package/lib/assistant/job-engine.d.ts +0 -4
- package/lib/assistant/job-engine.d.ts.map +1 -1
- package/lib/assistant/job-engine.js +0 -2
- package/lib/assistant/job-engine.js.map +1 -1
- package/lib/assistant/job-store.d.ts +1 -8
- package/lib/assistant/job-store.d.ts.map +1 -1
- package/lib/assistant/job-store.js +3 -9
- package/lib/assistant/job-store.js.map +1 -1
- package/lib/assistant/job-worker.d.ts +2 -3
- package/lib/assistant/job-worker.d.ts.map +1 -1
- package/lib/assistant/job-worker.js +15 -25
- package/lib/assistant/job-worker.js.map +1 -1
- package/lib/assistant/runtime-contract.d.ts +22 -0
- package/lib/assistant/runtime-contract.d.ts.map +1 -0
- package/lib/assistant/runtime-contract.js +2 -0
- package/lib/assistant/runtime-contract.js.map +1 -0
- package/lib/assistant/types.d.ts +0 -10
- package/lib/assistant/types.d.ts.map +1 -1
- package/lib/assistant/types.js +0 -4
- package/lib/assistant/types.js.map +1 -1
- package/lib/authoring/bridge.d.ts +1 -1
- package/lib/authoring/index.d.ts +0 -4
- package/lib/authoring/index.d.ts.map +1 -1
- package/lib/authoring/index.js +0 -2
- package/lib/authoring/index.js.map +1 -1
- package/lib/authoring/types.d.ts +3 -39
- package/lib/authoring/types.d.ts.map +1 -1
- package/lib/authoring/types.js.map +1 -1
- package/lib/builtin/bash-tool.d.ts.map +1 -1
- package/lib/builtin/bash-tool.js +15 -2
- package/lib/builtin/bash-tool.js.map +1 -1
- package/lib/builtin/five-agent/index.d.ts +0 -1
- package/lib/builtin/five-agent/index.d.ts.map +1 -1
- package/lib/builtin/five-agent/index.js +0 -1
- package/lib/builtin/five-agent/index.js.map +1 -1
- package/lib/builtin/five-agent/role-capability-policy.d.ts +1 -1
- package/lib/builtin/five-agent/role-capability-policy.d.ts.map +1 -1
- package/lib/builtin/five-agent/role-capability-policy.js +1 -1
- package/lib/builtin/five-agent/role-capability-policy.js.map +1 -1
- package/lib/builtin/spawn-task-tool.d.ts +1 -1
- package/lib/builtin/spawn-task-tool.d.ts.map +1 -1
- package/lib/builtin/spawn-task-tool.js +4 -100
- package/lib/builtin/spawn-task-tool.js.map +1 -1
- package/lib/builtin-tools.d.ts +0 -2
- package/lib/builtin-tools.d.ts.map +1 -1
- package/lib/builtin-tools.js +0 -6
- package/lib/builtin-tools.js.map +1 -1
- package/lib/common-adapter-tools.d.ts +1 -1
- package/lib/config/agent-interfaces.d.ts +2 -1
- package/lib/config/agent-interfaces.d.ts.map +1 -1
- package/lib/config/index.d.ts +3 -3
- package/lib/config/index.d.ts.map +1 -1
- package/lib/config/index.js +2 -2
- package/lib/config/index.js.map +1 -1
- package/lib/config/keyword-triggers.d.ts +0 -1
- package/lib/config/keyword-triggers.d.ts.map +1 -1
- package/lib/config/keyword-triggers.js +0 -1
- package/lib/config/keyword-triggers.js.map +1 -1
- package/lib/config/normalize-ai-config.d.ts.map +1 -1
- package/lib/config/normalize-ai-config.js +9 -0
- package/lib/config/normalize-ai-config.js.map +1 -1
- package/lib/config/validate-ai-config.d.ts +1 -0
- package/lib/config/validate-ai-config.d.ts.map +1 -1
- package/lib/config/validate-ai-config.js +179 -0
- package/lib/config/validate-ai-config.js.map +1 -1
- package/lib/config/zhin-agent-config.d.ts +0 -3
- package/lib/config/zhin-agent-config.d.ts.map +1 -1
- package/lib/config/zhin-agent-constants.d.ts +0 -3
- package/lib/config/zhin-agent-constants.d.ts.map +1 -1
- package/lib/config/zhin-agent-constants.js +0 -14
- package/lib/config/zhin-agent-constants.js.map +1 -1
- package/lib/config/zhin-agent-defaults.d.ts.map +1 -1
- package/lib/config/zhin-agent-defaults.js +0 -3
- package/lib/config/zhin-agent-defaults.js.map +1 -1
- package/lib/config/zhin-agent-dependencies.d.ts +4 -5
- package/lib/config/zhin-agent-dependencies.d.ts.map +1 -1
- package/lib/context/context-system.d.ts +2 -1
- package/lib/context/context-system.d.ts.map +1 -1
- package/lib/context/context-system.js +1 -0
- package/lib/context/context-system.js.map +1 -1
- package/lib/context/context-tail-limit.d.ts +2 -2
- package/lib/context/context-tail-limit.d.ts.map +1 -1
- package/lib/context/context-tail-limit.js +2 -3
- package/lib/context/context-tail-limit.js.map +1 -1
- package/lib/context/im-turn-context-adapter.d.ts +1 -2
- package/lib/context/im-turn-context-adapter.d.ts.map +1 -1
- package/lib/context/im-turn-context-adapter.js +1 -5
- package/lib/context/im-turn-context-adapter.js.map +1 -1
- package/lib/context/turn-envelope.d.ts +1 -1
- package/lib/context/turn-envelope.d.ts.map +1 -1
- package/lib/context/turn-envelope.js +4 -0
- package/lib/context/turn-envelope.js.map +1 -1
- package/lib/context/turn-user-message.d.ts +1 -1
- package/lib/context/turn-user-message.d.ts.map +1 -1
- package/lib/context/turn-user-message.js +3 -3
- 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 +36 -12
- package/lib/core/agent-core-run.js.map +1 -1
- package/lib/core/agent-loop-standalone.d.ts +1 -1
- package/lib/core/agent-loop-standalone.js +13 -6
- package/lib/core/agent-loop-standalone.js.map +1 -1
- package/lib/core/tool-execution-authority.d.ts +2 -2
- package/lib/core/tool-execution-authority.d.ts.map +1 -1
- package/lib/data-governance/data-governance.d.ts +198 -0
- package/lib/data-governance/data-governance.d.ts.map +1 -0
- package/lib/data-governance/data-governance.js +660 -0
- package/lib/data-governance/data-governance.js.map +1 -0
- package/lib/data-governance/database-payload-lifecycle-repository.d.ts +68 -0
- package/lib/data-governance/database-payload-lifecycle-repository.d.ts.map +1 -0
- package/lib/data-governance/database-payload-lifecycle-repository.js +226 -0
- package/lib/data-governance/database-payload-lifecycle-repository.js.map +1 -0
- package/lib/data-governance/disclosure-manifest.d.ts +110 -0
- package/lib/data-governance/disclosure-manifest.d.ts.map +1 -0
- package/lib/data-governance/disclosure-manifest.js +264 -0
- package/lib/data-governance/disclosure-manifest.js.map +1 -0
- package/lib/data-governance/encrypted-database-payload-vault.d.ts +107 -0
- package/lib/data-governance/encrypted-database-payload-vault.d.ts.map +1 -0
- package/lib/data-governance/encrypted-database-payload-vault.js +236 -0
- package/lib/data-governance/encrypted-database-payload-vault.js.map +1 -0
- package/lib/data-governance/encrypted-file-payload-vault.d.ts +117 -0
- package/lib/data-governance/encrypted-file-payload-vault.d.ts.map +1 -0
- package/lib/data-governance/encrypted-file-payload-vault.js +507 -0
- package/lib/data-governance/encrypted-file-payload-vault.js.map +1 -0
- package/lib/data-governance/file-payload-lifecycle-repository.d.ts +19 -0
- package/lib/data-governance/file-payload-lifecycle-repository.d.ts.map +1 -0
- package/lib/data-governance/file-payload-lifecycle-repository.js +194 -0
- package/lib/data-governance/file-payload-lifecycle-repository.js.map +1 -0
- package/lib/data-governance/governance-authority-repository.d.ts +148 -0
- package/lib/data-governance/governance-authority-repository.d.ts.map +1 -0
- package/lib/data-governance/governance-authority-repository.js +439 -0
- package/lib/data-governance/governance-authority-repository.js.map +1 -0
- package/lib/data-governance/governed-payload-write-saga.d.ts +126 -0
- package/lib/data-governance/governed-payload-write-saga.d.ts.map +1 -0
- package/lib/data-governance/governed-payload-write-saga.js +471 -0
- package/lib/data-governance/governed-payload-write-saga.js.map +1 -0
- package/lib/data-governance/payload-hold-overdue-projection.d.ts +57 -0
- package/lib/data-governance/payload-hold-overdue-projection.d.ts.map +1 -0
- package/lib/data-governance/payload-hold-overdue-projection.js +80 -0
- package/lib/data-governance/payload-hold-overdue-projection.js.map +1 -0
- package/lib/data-governance/payload-lifecycle.d.ts +359 -0
- package/lib/data-governance/payload-lifecycle.d.ts.map +1 -0
- package/lib/data-governance/payload-lifecycle.js +930 -0
- package/lib/data-governance/payload-lifecycle.js.map +1 -0
- package/lib/data-governance/payload-vault-storage-handoff.d.ts +255 -0
- package/lib/data-governance/payload-vault-storage-handoff.d.ts.map +1 -0
- package/lib/data-governance/payload-vault-storage-handoff.js +471 -0
- package/lib/data-governance/payload-vault-storage-handoff.js.map +1 -0
- package/lib/defaults/hooks.d.ts +2 -2
- package/lib/defaults/hooks.d.ts.map +1 -1
- package/lib/defaults/hooks.js +2 -2
- package/lib/defaults/hooks.js.map +1 -1
- package/lib/defaults/subagents.d.ts +2 -2
- package/lib/defaults/subagents.d.ts.map +1 -1
- package/lib/defaults/subagents.js +2 -2
- package/lib/defaults/subagents.js.map +1 -1
- package/lib/defaults/tools.d.ts +1 -2
- package/lib/defaults/tools.js +2 -2
- package/lib/defaults/tools.js.map +1 -1
- package/lib/discovery/agent-surface-info.d.ts +0 -2
- package/lib/discovery/agent-surface-info.d.ts.map +1 -1
- package/lib/discovery/agent-surface-info.js +0 -5
- package/lib/discovery/agent-surface-info.js.map +1 -1
- package/lib/discovery/agent-surface.d.ts.map +1 -1
- package/lib/discovery/agent-surface.js +0 -39
- package/lib/discovery/agent-surface.js.map +1 -1
- package/lib/event/agent-stream-hooks.d.ts +1 -1
- package/lib/event/hook-stream-sink.d.ts +1 -1
- package/lib/event/publish-agent-stream.d.ts +3 -3
- package/lib/event/publish-agent-stream.d.ts.map +1 -1
- package/lib/event/publish-agent-stream.js +1 -1
- package/lib/event/publish-agent-stream.js.map +1 -1
- package/lib/event/session-events.d.ts +1 -1
- package/lib/event/turn-event.d.ts +22 -2
- package/lib/event/turn-event.d.ts.map +1 -1
- package/lib/event/turn-event.js.map +1 -1
- package/lib/event/turn-to-agent-stream.js +6 -0
- package/lib/event/turn-to-agent-stream.js.map +1 -1
- package/lib/features/agent-feature.d.ts +1 -1
- package/lib/features/mcp-feature.d.ts +1 -1
- package/lib/index.d.ts +99 -33
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +94 -21
- package/lib/index.js.map +1 -1
- package/lib/ingress/capability-ingress.d.ts +5 -5
- package/lib/ingress/capability-ingress.d.ts.map +1 -1
- package/lib/ingress/capability-ingress.js +26 -26
- package/lib/ingress/capability-ingress.js.map +1 -1
- package/lib/init/activate-ai-database-storage.d.ts +5 -3
- package/lib/init/activate-ai-database-storage.d.ts.map +1 -1
- package/lib/init/activate-ai-database-storage.js +23 -32
- package/lib/init/activate-ai-database-storage.js.map +1 -1
- package/lib/init/configure-zhin-agent.d.ts +1 -1
- package/lib/init/configure-zhin-agent.d.ts.map +1 -1
- package/lib/init/configure-zhin-agent.js +3 -5
- package/lib/init/configure-zhin-agent.js.map +1 -1
- package/lib/init/define-ai-database-models.d.ts.map +1 -1
- package/lib/init/define-ai-database-models.js +21 -5
- package/lib/init/define-ai-database-models.js.map +1 -1
- package/lib/init/dispose-zhin-agent.d.ts +1 -3
- package/lib/init/dispose-zhin-agent.d.ts.map +1 -1
- package/lib/init/dispose-zhin-agent.js +0 -2
- package/lib/init/dispose-zhin-agent.js.map +1 -1
- package/lib/init/introspection-collectors.d.ts +1 -1
- package/lib/init/introspection-collectors.d.ts.map +1 -1
- package/lib/init/introspection-collectors.js +13 -14
- package/lib/init/introspection-collectors.js.map +1 -1
- package/lib/internal/agent-host.d.ts +5 -8
- package/lib/internal/agent-host.d.ts.map +1 -1
- package/lib/internal/host-types.d.ts +4 -0
- package/lib/internal/host-types.d.ts.map +1 -1
- package/lib/journal/persistent-turn-journal.d.ts +5 -1
- package/lib/journal/persistent-turn-journal.d.ts.map +1 -1
- package/lib/journal/persistent-turn-journal.js +11 -1
- package/lib/journal/persistent-turn-journal.js.map +1 -1
- package/lib/mcp-client/bridge.d.ts +1 -1
- package/lib/mcp-client/connection.d.ts +1 -1
- package/lib/mcp-client/index.d.ts +1 -1
- package/lib/media/media-normalize.d.ts +9 -5
- package/lib/media/media-normalize.d.ts.map +1 -1
- package/lib/media/media-normalize.js +125 -69
- package/lib/media/media-normalize.js.map +1 -1
- package/lib/media/media-publisher.d.ts.map +1 -1
- package/lib/media/media-publisher.js +48 -3
- package/lib/media/media-publisher.js.map +1 -1
- package/lib/media/vision-capability.js +1 -1
- package/lib/media/vision-capability.js.map +1 -1
- package/lib/memory/index.d.ts +1 -1
- package/lib/memory/index.d.ts.map +1 -1
- package/lib/plugin-ai-hook-bus.d.ts +1 -1
- package/lib/plugin-runtime/agent-host-port.d.ts +66 -4
- 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 +3 -0
- package/lib/plugin-runtime/agent-runtime.d.ts.map +1 -1
- package/lib/plugin-runtime/agent-runtime.js +73 -3
- package/lib/plugin-runtime/agent-runtime.js.map +1 -1
- package/lib/plugin-runtime/agent-trace-runtime.d.ts +37 -0
- package/lib/plugin-runtime/agent-trace-runtime.d.ts.map +1 -0
- package/lib/plugin-runtime/agent-trace-runtime.js +150 -0
- package/lib/plugin-runtime/agent-trace-runtime.js.map +1 -0
- package/lib/plugin-runtime/capability-tools.js +2 -2
- package/lib/plugin-runtime/capability-tools.js.map +1 -1
- package/lib/plugin-runtime/database-overlay-pack-promotion-repository.d.ts +70 -0
- package/lib/plugin-runtime/database-overlay-pack-promotion-repository.d.ts.map +1 -0
- package/lib/plugin-runtime/database-overlay-pack-promotion-repository.js +203 -0
- package/lib/plugin-runtime/database-overlay-pack-promotion-repository.js.map +1 -0
- package/lib/plugin-runtime/deferred-capability-plan.d.ts +26 -0
- package/lib/plugin-runtime/deferred-capability-plan.d.ts.map +1 -1
- package/lib/plugin-runtime/deferred-capability-plan.js +98 -4
- package/lib/plugin-runtime/deferred-capability-plan.js.map +1 -1
- package/lib/plugin-runtime/full-agent-turn-engine.js +48 -5
- package/lib/plugin-runtime/full-agent-turn-engine.js.map +1 -1
- package/lib/plugin-runtime/host-mcp-projection.d.ts +1 -1
- package/lib/plugin-runtime/index.d.ts +66 -0
- package/lib/plugin-runtime/index.d.ts.map +1 -1
- package/lib/plugin-runtime/index.js +65 -0
- package/lib/plugin-runtime/index.js.map +1 -1
- 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-semantic-memory-tools.d.ts +17 -0
- package/lib/plugin-runtime/native-semantic-memory-tools.d.ts.map +1 -0
- package/lib/plugin-runtime/native-semantic-memory-tools.js +169 -0
- package/lib/plugin-runtime/native-semantic-memory-tools.js.map +1 -0
- package/lib/plugin-runtime/turn-intent-resolver.d.ts +20 -0
- package/lib/plugin-runtime/turn-intent-resolver.d.ts.map +1 -0
- package/lib/plugin-runtime/turn-intent-resolver.js +8 -0
- package/lib/plugin-runtime/turn-intent-resolver.js.map +1 -0
- package/lib/plugin-runtime/workroom-acceptance-authority.d.ts +5 -0
- package/lib/plugin-runtime/workroom-acceptance-authority.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-acceptance-authority.js +14 -0
- package/lib/plugin-runtime/workroom-acceptance-authority.js.map +1 -0
- package/lib/plugin-runtime/workroom-acceptance-fact-providers.d.ts +233 -0
- package/lib/plugin-runtime/workroom-acceptance-fact-providers.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-acceptance-fact-providers.js +517 -0
- package/lib/plugin-runtime/workroom-acceptance-fact-providers.js.map +1 -0
- package/lib/plugin-runtime/workroom-acceptance-internal-providers.d.ts +139 -0
- package/lib/plugin-runtime/workroom-acceptance-internal-providers.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-acceptance-internal-providers.js +430 -0
- package/lib/plugin-runtime/workroom-acceptance-internal-providers.js.map +1 -0
- package/lib/plugin-runtime/workroom-acceptance-policy.d.ts +4 -0
- package/lib/plugin-runtime/workroom-acceptance-policy.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-acceptance-policy.js +20 -0
- package/lib/plugin-runtime/workroom-acceptance-policy.js.map +1 -0
- package/lib/plugin-runtime/workroom-acceptance-production-composition.d.ts +175 -0
- package/lib/plugin-runtime/workroom-acceptance-production-composition.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-acceptance-production-composition.js +793 -0
- package/lib/plugin-runtime/workroom-acceptance-production-composition.js.map +1 -0
- package/lib/plugin-runtime/workroom-acceptance-provider-composition.d.ts +186 -0
- package/lib/plugin-runtime/workroom-acceptance-provider-composition.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-acceptance-provider-composition.js +553 -0
- package/lib/plugin-runtime/workroom-acceptance-provider-composition.js.map +1 -0
- package/lib/plugin-runtime/workroom-accepted-source-runtime.d.ts +75 -0
- package/lib/plugin-runtime/workroom-accepted-source-runtime.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-accepted-source-runtime.js +267 -0
- package/lib/plugin-runtime/workroom-accepted-source-runtime.js.map +1 -0
- package/lib/plugin-runtime/workroom-assignment-authority-grant-runtime.d.ts +42 -0
- package/lib/plugin-runtime/workroom-assignment-authority-grant-runtime.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-assignment-authority-grant-runtime.js +90 -0
- package/lib/plugin-runtime/workroom-assignment-authority-grant-runtime.js.map +1 -0
- package/lib/plugin-runtime/workroom-assignment-authority-provider.d.ts +159 -0
- package/lib/plugin-runtime/workroom-assignment-authority-provider.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-assignment-authority-provider.js +595 -0
- package/lib/plugin-runtime/workroom-assignment-authority-provider.js.map +1 -0
- package/lib/plugin-runtime/workroom-assignment-knowledge-composition.d.ts +58 -0
- package/lib/plugin-runtime/workroom-assignment-knowledge-composition.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-assignment-knowledge-composition.js +218 -0
- package/lib/plugin-runtime/workroom-assignment-knowledge-composition.js.map +1 -0
- package/lib/plugin-runtime/workroom-data-governance-authority-writer.d.ts +47 -0
- package/lib/plugin-runtime/workroom-data-governance-authority-writer.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-data-governance-authority-writer.js +115 -0
- package/lib/plugin-runtime/workroom-data-governance-authority-writer.js.map +1 -0
- package/lib/plugin-runtime/workroom-data-governance-composition.d.ts +28 -0
- package/lib/plugin-runtime/workroom-data-governance-composition.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-data-governance-composition.js +41 -0
- package/lib/plugin-runtime/workroom-data-governance-composition.js.map +1 -0
- package/lib/plugin-runtime/workroom-data-governance-root-provider.d.ts +51 -0
- package/lib/plugin-runtime/workroom-data-governance-root-provider.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-data-governance-root-provider.js +66 -0
- package/lib/plugin-runtime/workroom-data-governance-root-provider.js.map +1 -0
- package/lib/plugin-runtime/workroom-data-governance-runtime.d.ts +134 -0
- package/lib/plugin-runtime/workroom-data-governance-runtime.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-data-governance-runtime.js +1253 -0
- package/lib/plugin-runtime/workroom-data-governance-runtime.js.map +1 -0
- package/lib/plugin-runtime/workroom-data-governance-storage.d.ts +66 -0
- package/lib/plugin-runtime/workroom-data-governance-storage.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-data-governance-storage.js +160 -0
- package/lib/plugin-runtime/workroom-data-governance-storage.js.map +1 -0
- package/lib/plugin-runtime/workroom-data-lifecycle-composition.d.ts +37 -0
- package/lib/plugin-runtime/workroom-data-lifecycle-composition.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-data-lifecycle-composition.js +131 -0
- package/lib/plugin-runtime/workroom-data-lifecycle-composition.js.map +1 -0
- package/lib/plugin-runtime/workroom-data-lifecycle-console.d.ts +238 -0
- package/lib/plugin-runtime/workroom-data-lifecycle-console.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-data-lifecycle-console.js +495 -0
- package/lib/plugin-runtime/workroom-data-lifecycle-console.js.map +1 -0
- package/lib/plugin-runtime/workroom-data-lifecycle-human-ingress.d.ts +15 -0
- package/lib/plugin-runtime/workroom-data-lifecycle-human-ingress.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-data-lifecycle-human-ingress.js +119 -0
- package/lib/plugin-runtime/workroom-data-lifecycle-human-ingress.js.map +1 -0
- package/lib/plugin-runtime/workroom-dynamic-planning-provider.d.ts +142 -0
- package/lib/plugin-runtime/workroom-dynamic-planning-provider.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-dynamic-planning-provider.js +301 -0
- package/lib/plugin-runtime/workroom-dynamic-planning-provider.js.map +1 -0
- package/lib/plugin-runtime/workroom-dynamic-planning.d.ts +4 -0
- package/lib/plugin-runtime/workroom-dynamic-planning.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-dynamic-planning.js +13 -0
- package/lib/plugin-runtime/workroom-dynamic-planning.js.map +1 -0
- package/lib/plugin-runtime/workroom-effect-composition.d.ts +37 -0
- package/lib/plugin-runtime/workroom-effect-composition.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-effect-composition.js +69 -0
- package/lib/plugin-runtime/workroom-effect-composition.js.map +1 -0
- package/lib/plugin-runtime/workroom-effect-production.d.ts +133 -0
- package/lib/plugin-runtime/workroom-effect-production.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-effect-production.js +272 -0
- package/lib/plugin-runtime/workroom-effect-production.js.map +1 -0
- package/lib/plugin-runtime/workroom-effect-runtime.d.ts +72 -0
- package/lib/plugin-runtime/workroom-effect-runtime.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-effect-runtime.js +179 -0
- package/lib/plugin-runtime/workroom-effect-runtime.js.map +1 -0
- package/lib/plugin-runtime/workroom-governed-dispatch-composition.d.ts +27 -0
- package/lib/plugin-runtime/workroom-governed-dispatch-composition.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-governed-dispatch-composition.js +40 -0
- package/lib/plugin-runtime/workroom-governed-dispatch-composition.js.map +1 -0
- package/lib/plugin-runtime/workroom-governed-dispatch-reasons.d.ts +10 -0
- package/lib/plugin-runtime/workroom-governed-dispatch-reasons.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-governed-dispatch-reasons.js +20 -0
- package/lib/plugin-runtime/workroom-governed-dispatch-reasons.js.map +1 -0
- package/lib/plugin-runtime/workroom-journal-payload-composition.d.ts +16 -0
- package/lib/plugin-runtime/workroom-journal-payload-composition.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-journal-payload-composition.js +69 -0
- package/lib/plugin-runtime/workroom-journal-payload-composition.js.map +1 -0
- package/lib/plugin-runtime/workroom-local-agent-core-adapter.d.ts +17 -0
- package/lib/plugin-runtime/workroom-local-agent-core-adapter.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-local-agent-core-adapter.js +101 -0
- package/lib/plugin-runtime/workroom-local-agent-core-adapter.js.map +1 -0
- package/lib/plugin-runtime/workroom-local-agent-loop.d.ts +90 -0
- package/lib/plugin-runtime/workroom-local-agent-loop.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-local-agent-loop.js +303 -0
- package/lib/plugin-runtime/workroom-local-agent-loop.js.map +1 -0
- package/lib/plugin-runtime/workroom-local-assignment-authority.d.ts +5 -0
- package/lib/plugin-runtime/workroom-local-assignment-authority.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-local-assignment-authority.js +16 -0
- package/lib/plugin-runtime/workroom-local-assignment-authority.js.map +1 -0
- package/lib/plugin-runtime/workroom-local-assignment-runtime.d.ts +33 -0
- package/lib/plugin-runtime/workroom-local-assignment-runtime.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-local-assignment-runtime.js +189 -0
- package/lib/plugin-runtime/workroom-local-assignment-runtime.js.map +1 -0
- package/lib/plugin-runtime/workroom-local-assignment-supply.d.ts +39 -0
- package/lib/plugin-runtime/workroom-local-assignment-supply.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-local-assignment-supply.js +107 -0
- package/lib/plugin-runtime/workroom-local-assignment-supply.js.map +1 -0
- package/lib/plugin-runtime/workroom-overlay-pack-promotion.d.ts +145 -0
- package/lib/plugin-runtime/workroom-overlay-pack-promotion.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-overlay-pack-promotion.js +516 -0
- package/lib/plugin-runtime/workroom-overlay-pack-promotion.js.map +1 -0
- package/lib/plugin-runtime/workroom-payload-processor-recall.d.ts +91 -0
- package/lib/plugin-runtime/workroom-payload-processor-recall.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-payload-processor-recall.js +189 -0
- package/lib/plugin-runtime/workroom-payload-processor-recall.js.map +1 -0
- package/lib/plugin-runtime/workroom-plan-gate-authority.d.ts +7 -0
- package/lib/plugin-runtime/workroom-plan-gate-authority.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-plan-gate-authority.js +40 -0
- package/lib/plugin-runtime/workroom-plan-gate-authority.js.map +1 -0
- package/lib/plugin-runtime/workroom-portfolio-capacity.d.ts +132 -0
- package/lib/plugin-runtime/workroom-portfolio-capacity.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-portfolio-capacity.js +189 -0
- package/lib/plugin-runtime/workroom-portfolio-capacity.js.map +1 -0
- package/lib/plugin-runtime/workroom-portfolio-checkpoint-ack.d.ts +38 -0
- package/lib/plugin-runtime/workroom-portfolio-checkpoint-ack.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-portfolio-checkpoint-ack.js +103 -0
- package/lib/plugin-runtime/workroom-portfolio-checkpoint-ack.js.map +1 -0
- package/lib/plugin-runtime/workroom-portfolio-control-composition.d.ts +30 -0
- package/lib/plugin-runtime/workroom-portfolio-control-composition.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-portfolio-control-composition.js +102 -0
- package/lib/plugin-runtime/workroom-portfolio-control-composition.js.map +1 -0
- package/lib/plugin-runtime/workroom-portfolio-control-runtime.d.ts +41 -0
- package/lib/plugin-runtime/workroom-portfolio-control-runtime.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-portfolio-control-runtime.js +208 -0
- package/lib/plugin-runtime/workroom-portfolio-control-runtime.js.map +1 -0
- package/lib/plugin-runtime/workroom-portfolio-grant-assignment.d.ts +141 -0
- package/lib/plugin-runtime/workroom-portfolio-grant-assignment.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-portfolio-grant-assignment.js +331 -0
- package/lib/plugin-runtime/workroom-portfolio-grant-assignment.js.map +1 -0
- package/lib/plugin-runtime/workroom-portfolio-kernel-authority.d.ts +23 -0
- package/lib/plugin-runtime/workroom-portfolio-kernel-authority.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-portfolio-kernel-authority.js +82 -0
- package/lib/plugin-runtime/workroom-portfolio-kernel-authority.js.map +1 -0
- package/lib/plugin-runtime/workroom-portfolio-sponsor.d.ts +96 -0
- package/lib/plugin-runtime/workroom-portfolio-sponsor.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-portfolio-sponsor.js +313 -0
- package/lib/plugin-runtime/workroom-portfolio-sponsor.js.map +1 -0
- package/lib/plugin-runtime/workroom-preemption-runtime.d.ts +57 -0
- package/lib/plugin-runtime/workroom-preemption-runtime.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-preemption-runtime.js +163 -0
- package/lib/plugin-runtime/workroom-preemption-runtime.js.map +1 -0
- package/lib/plugin-runtime/workroom-priority-authority.d.ts +11 -0
- package/lib/plugin-runtime/workroom-priority-authority.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-priority-authority.js +72 -0
- package/lib/plugin-runtime/workroom-priority-authority.js.map +1 -0
- package/lib/plugin-runtime/workroom-profile-authority-composition.d.ts +61 -0
- package/lib/plugin-runtime/workroom-profile-authority-composition.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-profile-authority-composition.js +231 -0
- package/lib/plugin-runtime/workroom-profile-authority-composition.js.map +1 -0
- package/lib/plugin-runtime/workroom-profile-authority-runtime.d.ts +228 -0
- package/lib/plugin-runtime/workroom-profile-authority-runtime.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-profile-authority-runtime.js +1132 -0
- package/lib/plugin-runtime/workroom-profile-authority-runtime.js.map +1 -0
- package/lib/plugin-runtime/workroom-projection-outbound.d.ts +10 -0
- package/lib/plugin-runtime/workroom-projection-outbound.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-projection-outbound.js +35 -0
- package/lib/plugin-runtime/workroom-projection-outbound.js.map +1 -0
- package/lib/plugin-runtime/workroom-projection-runtime.d.ts +87 -0
- package/lib/plugin-runtime/workroom-projection-runtime.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-projection-runtime.js +421 -0
- package/lib/plugin-runtime/workroom-projection-runtime.js.map +1 -0
- package/lib/plugin-runtime/workroom-remote-assignment-authority.d.ts +9 -0
- package/lib/plugin-runtime/workroom-remote-assignment-authority.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-remote-assignment-authority.js +20 -0
- package/lib/plugin-runtime/workroom-remote-assignment-authority.js.map +1 -0
- package/lib/plugin-runtime/workroom-remote-callback-runtime.d.ts +38 -0
- package/lib/plugin-runtime/workroom-remote-callback-runtime.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-remote-callback-runtime.js +80 -0
- package/lib/plugin-runtime/workroom-remote-callback-runtime.js.map +1 -0
- package/lib/plugin-runtime/workroom-remote-executor.d.ts +20 -0
- package/lib/plugin-runtime/workroom-remote-executor.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-remote-executor.js +42 -0
- package/lib/plugin-runtime/workroom-remote-executor.js.map +1 -0
- package/lib/plugin-runtime/workroom-reviewer-authority-runtime.d.ts +72 -0
- package/lib/plugin-runtime/workroom-reviewer-authority-runtime.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-reviewer-authority-runtime.js +142 -0
- package/lib/plugin-runtime/workroom-reviewer-authority-runtime.js.map +1 -0
- package/lib/plugin-runtime/workroom-risk-acceptance-runtime.d.ts +112 -0
- package/lib/plugin-runtime/workroom-risk-acceptance-runtime.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-risk-acceptance-runtime.js +376 -0
- package/lib/plugin-runtime/workroom-risk-acceptance-runtime.js.map +1 -0
- package/lib/plugin-runtime/workroom-run-profile-pin-authority.d.ts +42 -0
- package/lib/plugin-runtime/workroom-run-profile-pin-authority.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-run-profile-pin-authority.js +125 -0
- package/lib/plugin-runtime/workroom-run-profile-pin-authority.js.map +1 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-composition.d.ts +25 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-composition.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-composition.js +79 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-composition.js.map +1 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-contract.d.ts +16 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-contract.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-contract.js +49 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-contract.js.map +1 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-request-authority.d.ts +63 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-request-authority.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-request-authority.js +233 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-request-authority.js.map +1 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-supply.d.ts +37 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-supply.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-supply.js +122 -0
- package/lib/plugin-runtime/workroom-scheduler-portfolio-supply.js.map +1 -0
- package/lib/plugin-runtime/workroom-scheduler-route-registry.d.ts +27 -0
- package/lib/plugin-runtime/workroom-scheduler-route-registry.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-scheduler-route-registry.js +136 -0
- package/lib/plugin-runtime/workroom-scheduler-route-registry.js.map +1 -0
- package/lib/plugin-runtime/workroom-scheduler-runtime.d.ts +84 -0
- package/lib/plugin-runtime/workroom-scheduler-runtime.d.ts.map +1 -0
- package/lib/plugin-runtime/workroom-scheduler-runtime.js +231 -0
- package/lib/plugin-runtime/workroom-scheduler-runtime.js.map +1 -0
- package/lib/portfolio/capacity-control-outbox.d.ts +174 -0
- package/lib/portfolio/capacity-control-outbox.d.ts.map +1 -0
- package/lib/portfolio/capacity-control-outbox.js +338 -0
- package/lib/portfolio/capacity-control-outbox.js.map +1 -0
- package/lib/portfolio/database-capacity-control-outbox.d.ts +62 -0
- package/lib/portfolio/database-capacity-control-outbox.d.ts.map +1 -0
- package/lib/portfolio/database-capacity-control-outbox.js +166 -0
- package/lib/portfolio/database-capacity-control-outbox.js.map +1 -0
- package/lib/portfolio/file-capacity-control-outbox.d.ts +10 -0
- package/lib/portfolio/file-capacity-control-outbox.d.ts.map +1 -0
- package/lib/portfolio/file-capacity-control-outbox.js +113 -0
- package/lib/portfolio/file-capacity-control-outbox.js.map +1 -0
- package/lib/portfolio/file-portfolio-journal.d.ts +11 -0
- package/lib/portfolio/file-portfolio-journal.d.ts.map +1 -0
- package/lib/portfolio/file-portfolio-journal.js +196 -0
- package/lib/portfolio/file-portfolio-journal.js.map +1 -0
- package/lib/portfolio/portfolio-admission.d.ts +95 -0
- package/lib/portfolio/portfolio-admission.d.ts.map +1 -0
- package/lib/portfolio/portfolio-admission.js +1080 -0
- package/lib/portfolio/portfolio-admission.js.map +1 -0
- package/lib/portfolio/portfolio-journal.d.ts +359 -0
- package/lib/portfolio/portfolio-journal.d.ts.map +1 -0
- package/lib/portfolio/portfolio-journal.js +844 -0
- package/lib/portfolio/portfolio-journal.js.map +1 -0
- package/lib/portfolio/resource-bundle.d.ts +136 -0
- package/lib/portfolio/resource-bundle.d.ts.map +1 -0
- package/lib/portfolio/resource-bundle.js +387 -0
- package/lib/portfolio/resource-bundle.js.map +1 -0
- package/lib/portfolio/sponsor-projection.d.ts +78 -0
- package/lib/portfolio/sponsor-projection.d.ts.map +1 -0
- package/lib/portfolio/sponsor-projection.js +135 -0
- package/lib/portfolio/sponsor-projection.js.map +1 -0
- package/lib/prompt/assembly.d.ts.map +1 -1
- package/lib/prompt/assembly.js +1 -3
- package/lib/prompt/assembly.js.map +1 -1
- package/lib/prompt/prompt-builder.d.ts +1 -1
- package/lib/prompt/prompt-builder.d.ts.map +1 -1
- package/lib/prompt/system-prompt.d.ts +1 -1
- package/lib/prompt/system-prompt.js +2 -2
- package/lib/prompt/system-prompt.js.map +1 -1
- package/lib/reserved-tools.d.ts.map +1 -1
- package/lib/reserved-tools.js +0 -1
- package/lib/reserved-tools.js.map +1 -1
- package/lib/{orchestrator → resource-hub}/hook-registry.d.ts.map +1 -1
- package/lib/{orchestrator → resource-hub}/hook-registry.js.map +1 -1
- package/lib/{orchestrator → resource-hub}/index.d.ts +4 -11
- package/lib/{orchestrator → resource-hub}/index.d.ts.map +1 -1
- package/lib/{orchestrator → resource-hub}/index.js +4 -8
- package/lib/{orchestrator → resource-hub}/index.js.map +1 -1
- package/lib/{orchestrator → resource-hub}/mcp-lifecycle.d.ts.map +1 -1
- package/lib/{orchestrator → resource-hub}/mcp-lifecycle.js.map +1 -1
- package/lib/{orchestrator → resource-hub}/mcp-registry.d.ts.map +1 -1
- package/lib/{orchestrator → resource-hub}/mcp-registry.js.map +1 -1
- package/lib/{orchestrator → resource-hub}/resolve-subagent-tools.d.ts +3 -3
- package/lib/resource-hub/resolve-subagent-tools.d.ts.map +1 -0
- package/lib/{orchestrator → resource-hub}/resolve-subagent-tools.js +18 -13
- package/lib/resource-hub/resolve-subagent-tools.js.map +1 -0
- package/lib/{orchestrator → resource-hub}/resource-registry.d.ts.map +1 -1
- package/lib/{orchestrator → resource-hub}/resource-registry.js.map +1 -1
- package/lib/{orchestrator → resource-hub}/role-configs.d.ts.map +1 -1
- package/lib/{orchestrator → resource-hub}/role-configs.js +0 -2
- package/lib/{orchestrator → resource-hub}/role-configs.js.map +1 -1
- package/lib/{orchestrator → resource-hub}/skill-registry.d.ts.map +1 -1
- package/lib/{orchestrator → resource-hub}/skill-registry.js.map +1 -1
- package/lib/{orchestrator → resource-hub}/subagent-registry.d.ts.map +1 -1
- package/lib/{orchestrator → resource-hub}/subagent-registry.js.map +1 -1
- package/lib/{orchestrator → resource-hub}/tool-registry.d.ts.map +1 -1
- package/lib/{orchestrator → resource-hub}/tool-registry.js.map +1 -1
- package/lib/{orchestrator → resource-hub}/tool-selection.d.ts.map +1 -1
- package/lib/{orchestrator → resource-hub}/tool-selection.js.map +1 -1
- package/lib/{orchestrator → resource-hub}/types.d.ts +1 -1
- package/lib/{orchestrator → resource-hub}/types.d.ts.map +1 -1
- package/lib/{orchestrator → resource-hub}/types.js.map +1 -1
- package/lib/routing/workroom-bot-identity.d.ts +22 -0
- package/lib/routing/workroom-bot-identity.d.ts.map +1 -0
- package/lib/routing/workroom-bot-identity.js +46 -0
- package/lib/routing/workroom-bot-identity.js.map +1 -0
- package/lib/schedule-domain/budget-guard.d.ts +1 -1
- package/lib/schedule-domain/budget-guard.d.ts.map +1 -1
- package/lib/schedule-domain/budget-guard.js +9 -1
- package/lib/schedule-domain/budget-guard.js.map +1 -1
- package/lib/schedule-domain/execution-domain.d.ts +1 -0
- package/lib/schedule-domain/execution-domain.d.ts.map +1 -1
- package/lib/schedule-domain/execution-domain.js +3 -1
- package/lib/schedule-domain/execution-domain.js.map +1 -1
- package/lib/schedule-domain/schedule-execution-queue.d.ts +24 -0
- package/lib/schedule-domain/schedule-execution-queue.d.ts.map +1 -0
- package/lib/schedule-domain/schedule-execution-queue.js +123 -0
- package/lib/schedule-domain/schedule-execution-queue.js.map +1 -0
- package/lib/seam/seam-integration.d.ts +1 -1
- package/lib/seam/seam-integration.js +1 -1
- package/lib/seam/skill-service.d.ts +1 -1
- package/lib/security/exec-policy.d.ts +11 -1
- package/lib/security/exec-policy.d.ts.map +1 -1
- package/lib/security/exec-policy.js +16 -4
- package/lib/security/exec-policy.js.map +1 -1
- package/lib/security/policy-facade.d.ts.map +1 -1
- package/lib/security/policy-facade.js +60 -5
- package/lib/security/policy-facade.js.map +1 -1
- package/lib/security/sandbox-docker.js +1 -1
- package/lib/security/sandbox-docker.js.map +1 -1
- package/lib/security/sandbox.d.ts +2 -0
- package/lib/security/sandbox.d.ts.map +1 -1
- package/lib/security/sandbox.js +16 -4
- package/lib/security/sandbox.js.map +1 -1
- package/lib/security/turn-file-authority.d.ts +1 -1
- package/lib/security/turn-file-authority.d.ts.map +1 -1
- package/lib/security/turn-file-authority.js +10 -3
- package/lib/security/turn-file-authority.js.map +1 -1
- package/lib/security/turn-sandbox-authority.d.ts +13 -0
- package/lib/security/turn-sandbox-authority.d.ts.map +1 -0
- package/lib/security/turn-sandbox-authority.js +42 -0
- package/lib/security/turn-sandbox-authority.js.map +1 -0
- package/lib/service.d.ts +2 -0
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +2 -1
- package/lib/service.js.map +1 -1
- package/lib/session/approval-port.d.ts +2 -0
- package/lib/session/approval-port.d.ts.map +1 -1
- package/lib/session/approval-port.js.map +1 -1
- package/lib/session/index.d.ts +2 -6
- package/lib/session/index.d.ts.map +1 -1
- package/lib/session/index.js +2 -4
- package/lib/session/index.js.map +1 -1
- package/lib/session/session-io.d.ts +2 -6
- package/lib/session/session-io.d.ts.map +1 -1
- package/lib/session/session-io.js +4 -20
- package/lib/session/session-io.js.map +1 -1
- package/lib/session/session-system.d.ts +0 -2
- package/lib/session/session-system.d.ts.map +1 -1
- package/lib/session/session-system.js +2 -13
- package/lib/session/session-system.js.map +1 -1
- package/lib/session/turn-ingress-session.d.ts +1 -5
- package/lib/session/turn-ingress-session.d.ts.map +1 -1
- package/lib/session/turn-ingress-session.js +27 -29
- package/lib/session/turn-ingress-session.js.map +1 -1
- package/lib/session-tree-runtime.d.ts +15 -0
- package/lib/session-tree-runtime.d.ts.map +1 -0
- package/lib/{session-tree-runtime-registry.js → session-tree-runtime.js} +5 -15
- package/lib/session-tree-runtime.js.map +1 -0
- package/lib/skill/index.d.ts +2 -2
- package/lib/skill/index.d.ts.map +1 -1
- package/lib/skill/index.js +1 -1
- package/lib/skill/skill-registry-as-service.d.ts +1 -1
- package/lib/skill/skill-system.d.ts +4 -4
- package/lib/skill/skill-system.d.ts.map +1 -1
- package/lib/skill/skill-system.js +2 -2
- package/lib/skill/skill-system.js.map +1 -1
- package/lib/subagent/subagent-runtime.d.ts +2 -7
- package/lib/subagent/subagent-runtime.d.ts.map +1 -1
- package/lib/subagent/subagent-runtime.js +4 -43
- package/lib/subagent/subagent-runtime.js.map +1 -1
- package/lib/subagent/subagent-system-init.d.ts.map +1 -1
- package/lib/subagent/subagent-system-init.js +0 -2
- package/lib/subagent/subagent-system-init.js.map +1 -1
- package/lib/subagent-ai-events.d.ts +1 -1
- package/lib/subagent-ai-events.js +1 -1
- package/lib/subagent-preset.d.ts +1 -1
- package/lib/subagent-preset.d.ts.map +1 -1
- package/lib/subagent-prompt.d.ts +0 -2
- package/lib/subagent-prompt.d.ts.map +1 -1
- package/lib/subagent-prompt.js +3 -3
- package/lib/subagent-prompt.js.map +1 -1
- package/lib/task-executor.d.ts +1 -0
- package/lib/task-executor.d.ts.map +1 -1
- package/lib/task-executor.js +4 -1
- package/lib/task-executor.js.map +1 -1
- package/lib/tool/classic-tool-execution-authority.js +2 -2
- package/lib/tool/classic-tool-execution-authority.js.map +1 -1
- package/lib/tool/context-tools.d.ts +1 -4
- package/lib/tool/context-tools.d.ts.map +1 -1
- package/lib/tool/context-tools.js +0 -50
- package/lib/tool/context-tools.js.map +1 -1
- package/lib/tool/contracts.d.ts +1 -1
- package/lib/tool/conversation-reference-tool.d.ts +5 -0
- package/lib/tool/conversation-reference-tool.d.ts.map +1 -0
- package/lib/tool/conversation-reference-tool.js +40 -0
- package/lib/tool/conversation-reference-tool.js.map +1 -0
- package/lib/tool/index.d.ts +1 -0
- package/lib/tool/index.d.ts.map +1 -1
- package/lib/tool/index.js +1 -0
- 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 +7 -22
- package/lib/tool/prepare-turn-tools.js.map +1 -1
- package/lib/tool/runtime.d.ts +3 -4
- package/lib/tool/runtime.d.ts.map +1 -1
- package/lib/tool/runtime.js +0 -1
- package/lib/tool/runtime.js.map +1 -1
- package/lib/tool/sources.d.ts +3 -4
- package/lib/tool/sources.d.ts.map +1 -1
- package/lib/tool/sources.js +2 -6
- package/lib/tool/sources.js.map +1 -1
- package/lib/tool/tool-approval-once-store.d.ts +1 -1
- package/lib/tool/tool-approval-once-store.js +1 -1
- package/lib/tool/tool-system.d.ts.map +1 -1
- package/lib/tool/tool-system.js.map +1 -1
- package/lib/tool/turn-tool-runtime.d.ts +2 -1
- package/lib/tool/turn-tool-runtime.d.ts.map +1 -1
- package/lib/tool/turn-tool-runtime.js +76 -21
- package/lib/tool/turn-tool-runtime.js.map +1 -1
- package/lib/tool-bridge.d.ts +2 -2
- package/lib/tool-bridge.js +1 -1
- package/lib/tool-catalog/deferred-turn-controller.d.ts +1 -1
- package/lib/tool-catalog/tool-catalog.d.ts +1 -1
- package/lib/turn/auto-continue.d.ts +1 -1
- package/lib/turn/deferred-delivery.d.ts +1 -1
- package/lib/turn/inbound-media.d.ts +12 -8
- package/lib/turn/inbound-media.d.ts.map +1 -1
- package/lib/turn/inbound-media.js +61 -42
- package/lib/turn/inbound-media.js.map +1 -1
- package/lib/turn/inbound-queue-config.d.ts +1 -1
- package/lib/turn/inbound-queue-runtime.d.ts +1 -1
- package/lib/turn/inbound-turn-queue.d.ts +1 -1
- package/lib/turn/index.d.ts +1 -1
- package/lib/turn/index.d.ts.map +1 -1
- package/lib/turn/index.js.map +1 -1
- package/lib/turn/persist-deferred-context.d.ts +1 -1
- package/lib/turn/persist-subagent-context.d.ts +1 -1
- package/lib/turn/process-stream.d.ts +1 -1
- package/lib/turn/prompt-api.d.ts +1 -1
- package/lib/turn/prompt-controller.d.ts +6 -0
- package/lib/turn/prompt-controller.d.ts.map +1 -1
- package/lib/turn/prompt-controller.js +58 -5
- package/lib/turn/prompt-controller.js.map +1 -1
- package/lib/turn/turn-ingress.d.ts +55 -5
- package/lib/turn/turn-ingress.d.ts.map +1 -1
- package/lib/turn/turn-ingress.js +18 -0
- package/lib/turn/turn-ingress.js.map +1 -1
- package/lib/turn/turn-pipeline.d.ts.map +1 -1
- package/lib/turn/turn-pipeline.js +5 -4
- package/lib/turn/turn-pipeline.js.map +1 -1
- package/lib/utils/keyed-mutex.d.ts +1 -1
- package/lib/utils/keyed-mutex.d.ts.map +1 -1
- package/lib/utils/keyed-mutex.js +32 -5
- package/lib/utils/keyed-mutex.js.map +1 -1
- package/lib/workroom/acceptance-control.d.ts +76 -0
- package/lib/workroom/acceptance-control.d.ts.map +1 -0
- package/lib/workroom/acceptance-control.js +335 -0
- package/lib/workroom/acceptance-control.js.map +1 -0
- package/lib/workroom/acceptance-policy.d.ts +152 -0
- package/lib/workroom/acceptance-policy.d.ts.map +1 -0
- package/lib/workroom/acceptance-policy.js +610 -0
- package/lib/workroom/acceptance-policy.js.map +1 -0
- package/lib/workroom/accepted-source-memory-application.d.ts +113 -0
- package/lib/workroom/accepted-source-memory-application.d.ts.map +1 -0
- package/lib/workroom/accepted-source-memory-application.js +327 -0
- package/lib/workroom/accepted-source-memory-application.js.map +1 -0
- package/lib/workroom/accepted-source-projector.d.ts +89 -0
- package/lib/workroom/accepted-source-projector.d.ts.map +1 -0
- package/lib/workroom/accepted-source-projector.js +281 -0
- package/lib/workroom/accepted-source-projector.js.map +1 -0
- package/lib/workroom/assignment-authority-grant-application.d.ts +125 -0
- package/lib/workroom/assignment-authority-grant-application.d.ts.map +1 -0
- package/lib/workroom/assignment-authority-grant-application.js +317 -0
- package/lib/workroom/assignment-authority-grant-application.js.map +1 -0
- package/lib/workroom/assignment-authority-grant-repository.d.ts +151 -0
- package/lib/workroom/assignment-authority-grant-repository.d.ts.map +1 -0
- package/lib/workroom/assignment-authority-grant-repository.js +387 -0
- package/lib/workroom/assignment-authority-grant-repository.js.map +1 -0
- package/lib/workroom/assignment-executor.d.ts +110 -0
- package/lib/workroom/assignment-executor.d.ts.map +1 -0
- package/lib/workroom/assignment-executor.js +371 -0
- package/lib/workroom/assignment-executor.js.map +1 -0
- package/lib/workroom/assignment-observation-ingress.d.ts +21 -0
- package/lib/workroom/assignment-observation-ingress.d.ts.map +1 -0
- package/lib/workroom/assignment-observation-ingress.js +24 -0
- package/lib/workroom/assignment-observation-ingress.js.map +1 -0
- package/lib/workroom/canonical-value.d.ts +7 -0
- package/lib/workroom/canonical-value.d.ts.map +1 -0
- package/lib/workroom/canonical-value.js +32 -0
- package/lib/workroom/canonical-value.js.map +1 -0
- package/lib/workroom/catalog-definition.d.ts +49 -0
- package/lib/workroom/catalog-definition.d.ts.map +1 -0
- package/lib/workroom/catalog-definition.js +2 -0
- package/lib/workroom/catalog-definition.js.map +1 -0
- package/lib/workroom/catalog.d.ts +80 -0
- package/lib/workroom/catalog.d.ts.map +1 -0
- package/lib/workroom/catalog.js +372 -0
- package/lib/workroom/catalog.js.map +1 -0
- package/lib/workroom/database-project-knowledge-journal.d.ts +62 -0
- package/lib/workroom/database-project-knowledge-journal.d.ts.map +1 -0
- package/lib/workroom/database-project-knowledge-journal.js +161 -0
- package/lib/workroom/database-project-knowledge-journal.js.map +1 -0
- package/lib/workroom/durable-file-store.d.ts +52 -0
- package/lib/workroom/durable-file-store.d.ts.map +1 -0
- package/lib/workroom/durable-file-store.js +117 -0
- package/lib/workroom/durable-file-store.js.map +1 -0
- package/lib/workroom/dynamic-workflow-planner.d.ts +86 -0
- package/lib/workroom/dynamic-workflow-planner.d.ts.map +1 -0
- package/lib/workroom/dynamic-workflow-planner.js +260 -0
- package/lib/workroom/dynamic-workflow-planner.js.map +1 -0
- package/lib/workroom/effect-blocker-repository.d.ts +35 -0
- package/lib/workroom/effect-blocker-repository.d.ts.map +1 -0
- package/lib/workroom/effect-blocker-repository.js +174 -0
- package/lib/workroom/effect-blocker-repository.js.map +1 -0
- package/lib/workroom/effect-ledger.d.ts +191 -0
- package/lib/workroom/effect-ledger.d.ts.map +1 -0
- package/lib/workroom/effect-ledger.js +443 -0
- package/lib/workroom/effect-ledger.js.map +1 -0
- package/lib/workroom/file-accepted-source-memory-repository.d.ts +15 -0
- package/lib/workroom/file-accepted-source-memory-repository.d.ts.map +1 -0
- package/lib/workroom/file-accepted-source-memory-repository.js +133 -0
- package/lib/workroom/file-accepted-source-memory-repository.js.map +1 -0
- package/lib/workroom/file-effect-ledger.d.ts +10 -0
- package/lib/workroom/file-effect-ledger.d.ts.map +1 -0
- package/lib/workroom/file-effect-ledger.js +118 -0
- package/lib/workroom/file-effect-ledger.js.map +1 -0
- package/lib/workroom/file-human-ingress-application.d.ts +10 -0
- package/lib/workroom/file-human-ingress-application.d.ts.map +1 -0
- package/lib/workroom/file-human-ingress-application.js +177 -0
- package/lib/workroom/file-human-ingress-application.js.map +1 -0
- package/lib/workroom/file-human-ingress.d.ts +24 -0
- package/lib/workroom/file-human-ingress.d.ts.map +1 -0
- package/lib/workroom/file-human-ingress.js +234 -0
- package/lib/workroom/file-human-ingress.js.map +1 -0
- package/lib/workroom/file-interaction-space-binding-repository.d.ts +24 -0
- package/lib/workroom/file-interaction-space-binding-repository.d.ts.map +1 -0
- package/lib/workroom/file-interaction-space-binding-repository.js +293 -0
- package/lib/workroom/file-interaction-space-binding-repository.js.map +1 -0
- package/lib/workroom/file-profile-journal.d.ts +32 -0
- package/lib/workroom/file-profile-journal.d.ts.map +1 -0
- package/lib/workroom/file-profile-journal.js +308 -0
- package/lib/workroom/file-profile-journal.js.map +1 -0
- package/lib/workroom/git-workspace-gateway.d.ts +149 -0
- package/lib/workroom/git-workspace-gateway.d.ts.map +1 -0
- package/lib/workroom/git-workspace-gateway.js +248 -0
- package/lib/workroom/git-workspace-gateway.js.map +1 -0
- package/lib/workroom/human-ingress-application.d.ts +126 -0
- package/lib/workroom/human-ingress-application.d.ts.map +1 -0
- package/lib/workroom/human-ingress-application.js +414 -0
- package/lib/workroom/human-ingress-application.js.map +1 -0
- package/lib/workroom/human-ingress-orchestrator.d.ts +99 -0
- package/lib/workroom/human-ingress-orchestrator.d.ts.map +1 -0
- package/lib/workroom/human-ingress-orchestrator.js +234 -0
- package/lib/workroom/human-ingress-orchestrator.js.map +1 -0
- package/lib/workroom/human-ingress-source-reader.d.ts +29 -0
- package/lib/workroom/human-ingress-source-reader.d.ts.map +1 -0
- package/lib/workroom/human-ingress-source-reader.js +119 -0
- package/lib/workroom/human-ingress-source-reader.js.map +1 -0
- package/lib/workroom/human-ingress.d.ts +182 -0
- package/lib/workroom/human-ingress.d.ts.map +1 -0
- package/lib/workroom/human-ingress.js +526 -0
- package/lib/workroom/human-ingress.js.map +1 -0
- package/lib/workroom/interaction-space-binding-service.d.ts +57 -0
- package/lib/workroom/interaction-space-binding-service.d.ts.map +1 -0
- package/lib/workroom/interaction-space-binding-service.js +197 -0
- package/lib/workroom/interaction-space-binding-service.js.map +1 -0
- package/lib/workroom/interaction-space-router.d.ts +75 -0
- package/lib/workroom/interaction-space-router.d.ts.map +1 -0
- package/lib/workroom/interaction-space-router.js +243 -0
- package/lib/workroom/interaction-space-router.js.map +1 -0
- package/lib/workroom/journal-model.d.ts +40 -0
- package/lib/workroom/journal-model.d.ts.map +1 -0
- package/lib/workroom/journal-model.js +12 -0
- package/lib/workroom/journal-model.js.map +1 -0
- package/lib/workroom/journal.d.ts +214 -0
- package/lib/workroom/journal.d.ts.map +1 -0
- package/lib/workroom/journal.js +1935 -0
- package/lib/workroom/journal.js.map +1 -0
- package/lib/workroom/kernel-contracts.d.ts +167 -0
- package/lib/workroom/kernel-contracts.d.ts.map +1 -0
- package/lib/workroom/kernel-contracts.js +2 -0
- package/lib/workroom/kernel-contracts.js.map +1 -0
- package/lib/workroom/kernel-state.d.ts +5 -0
- package/lib/workroom/kernel-state.d.ts.map +1 -0
- package/lib/workroom/kernel-state.js +819 -0
- package/lib/workroom/kernel-state.js.map +1 -0
- package/lib/workroom/legacy-embedded-payload-migration.d.ts +89 -0
- package/lib/workroom/legacy-embedded-payload-migration.d.ts.map +1 -0
- package/lib/workroom/legacy-embedded-payload-migration.js +312 -0
- package/lib/workroom/legacy-embedded-payload-migration.js.map +1 -0
- package/lib/workroom/legacy-run-offline-migration.d.ts +84 -0
- package/lib/workroom/legacy-run-offline-migration.d.ts.map +1 -0
- package/lib/workroom/legacy-run-offline-migration.js +470 -0
- package/lib/workroom/legacy-run-offline-migration.js.map +1 -0
- package/lib/workroom/local-assignment-executor.d.ts +59 -0
- package/lib/workroom/local-assignment-executor.d.ts.map +1 -0
- package/lib/workroom/local-assignment-executor.js +197 -0
- package/lib/workroom/local-assignment-executor.js.map +1 -0
- package/lib/workroom/local-assignment-issuance.d.ts +68 -0
- package/lib/workroom/local-assignment-issuance.d.ts.map +1 -0
- package/lib/workroom/local-assignment-issuance.js +128 -0
- package/lib/workroom/local-assignment-issuance.js.map +1 -0
- package/lib/workroom/plan-approval-control.d.ts +52 -0
- package/lib/workroom/plan-approval-control.d.ts.map +1 -0
- package/lib/workroom/plan-approval-control.js +9 -0
- package/lib/workroom/plan-approval-control.js.map +1 -0
- package/lib/workroom/plan-revision.d.ts +44 -0
- package/lib/workroom/plan-revision.d.ts.map +1 -0
- package/lib/workroom/plan-revision.js +133 -0
- package/lib/workroom/plan-revision.js.map +1 -0
- package/lib/workroom/profile-compiler.d.ts +130 -0
- package/lib/workroom/profile-compiler.d.ts.map +1 -0
- package/lib/workroom/profile-compiler.js +357 -0
- package/lib/workroom/profile-compiler.js.map +1 -0
- package/lib/workroom/profile-registry.d.ts +191 -0
- package/lib/workroom/profile-registry.d.ts.map +1 -0
- package/lib/workroom/profile-registry.js +698 -0
- package/lib/workroom/profile-registry.js.map +1 -0
- package/lib/workroom/project-knowledge-registry.d.ts +136 -0
- package/lib/workroom/project-knowledge-registry.d.ts.map +1 -0
- package/lib/workroom/project-knowledge-registry.js +429 -0
- package/lib/workroom/project-knowledge-registry.js.map +1 -0
- package/lib/workroom/projection-outbox.d.ts +254 -0
- package/lib/workroom/projection-outbox.d.ts.map +1 -0
- package/lib/workroom/projection-outbox.js +1312 -0
- package/lib/workroom/projection-outbox.js.map +1 -0
- package/lib/workroom/remote-assignment-dispatch-command.d.ts +31 -0
- package/lib/workroom/remote-assignment-dispatch-command.d.ts.map +1 -0
- package/lib/workroom/remote-assignment-dispatch-command.js +56 -0
- package/lib/workroom/remote-assignment-dispatch-command.js.map +1 -0
- package/lib/workroom/remote-assignment-issuance.d.ts +88 -0
- package/lib/workroom/remote-assignment-issuance.d.ts.map +1 -0
- package/lib/workroom/remote-assignment-issuance.js +201 -0
- package/lib/workroom/remote-assignment-issuance.js.map +1 -0
- package/lib/workroom/remote-callback-application.d.ts +115 -0
- package/lib/workroom/remote-callback-application.d.ts.map +1 -0
- package/lib/workroom/remote-callback-application.js +570 -0
- package/lib/workroom/remote-callback-application.js.map +1 -0
- package/lib/workroom/remote-callback-gateway.d.ts +60 -0
- package/lib/workroom/remote-callback-gateway.d.ts.map +1 -0
- package/lib/workroom/remote-callback-gateway.js +173 -0
- package/lib/workroom/remote-callback-gateway.js.map +1 -0
- package/lib/workroom/remote-callback-inbox.d.ts +278 -0
- package/lib/workroom/remote-callback-inbox.d.ts.map +1 -0
- package/lib/workroom/remote-callback-inbox.js +1088 -0
- package/lib/workroom/remote-callback-inbox.js.map +1 -0
- package/lib/workroom/remote-callback-reconciliation-worker.d.ts +60 -0
- package/lib/workroom/remote-callback-reconciliation-worker.d.ts.map +1 -0
- package/lib/workroom/remote-callback-reconciliation-worker.js +197 -0
- package/lib/workroom/remote-callback-reconciliation-worker.js.map +1 -0
- package/lib/workroom/remote-dispatch-admission.d.ts +45 -0
- package/lib/workroom/remote-dispatch-admission.d.ts.map +1 -0
- package/lib/workroom/remote-dispatch-admission.js +187 -0
- package/lib/workroom/remote-dispatch-admission.js.map +1 -0
- package/lib/workroom/remote-dispatch-outbox.d.ts +203 -0
- package/lib/workroom/remote-dispatch-outbox.d.ts.map +1 -0
- package/lib/workroom/remote-dispatch-outbox.js +765 -0
- package/lib/workroom/remote-dispatch-outbox.js.map +1 -0
- package/lib/workroom/remote-dispatch-scheduler.d.ts +36 -0
- package/lib/workroom/remote-dispatch-scheduler.d.ts.map +1 -0
- package/lib/workroom/remote-dispatch-scheduler.js +133 -0
- package/lib/workroom/remote-dispatch-scheduler.js.map +1 -0
- package/lib/workroom/remote-dispatch-worker.d.ts +22 -0
- package/lib/workroom/remote-dispatch-worker.d.ts.map +1 -0
- package/lib/workroom/remote-dispatch-worker.js +124 -0
- package/lib/workroom/remote-dispatch-worker.js.map +1 -0
- package/lib/workroom/remote-dispatch.d.ts +79 -0
- package/lib/workroom/remote-dispatch.d.ts.map +1 -0
- package/lib/workroom/remote-dispatch.js +220 -0
- package/lib/workroom/remote-dispatch.js.map +1 -0
- package/lib/workroom/role-capability-snapshot.d.ts +88 -0
- package/lib/workroom/role-capability-snapshot.d.ts.map +1 -0
- package/lib/workroom/role-capability-snapshot.js +456 -0
- package/lib/workroom/role-capability-snapshot.js.map +1 -0
- package/lib/workroom/runtime.d.ts +109 -0
- package/lib/workroom/runtime.d.ts.map +1 -0
- package/lib/workroom/runtime.js +450 -0
- package/lib/workroom/runtime.js.map +1 -0
- package/lib/workroom/scheduler-priority-control.d.ts +35 -0
- package/lib/workroom/scheduler-priority-control.d.ts.map +1 -0
- package/lib/workroom/scheduler-priority-control.js +9 -0
- package/lib/workroom/scheduler-priority-control.js.map +1 -0
- package/lib/workroom/workflow-plan-builder.d.ts +88 -0
- package/lib/workroom/workflow-plan-builder.d.ts.map +1 -0
- package/lib/workroom/workflow-plan-builder.js +232 -0
- package/lib/workroom/workflow-plan-builder.js.map +1 -0
- package/lib/workroom/workroom-assignment-knowledge-context.d.ts +102 -0
- package/lib/workroom/workroom-assignment-knowledge-context.d.ts.map +1 -0
- package/lib/workroom/workroom-assignment-knowledge-context.js +127 -0
- package/lib/workroom/workroom-assignment-knowledge-context.js.map +1 -0
- package/lib/workroom/workroom-kernel.d.ts +141 -0
- package/lib/workroom/workroom-kernel.d.ts.map +1 -0
- package/lib/workroom/workroom-kernel.js +1325 -0
- package/lib/workroom/workroom-kernel.js.map +1 -0
- package/lib/workroom/workroom-preemption.d.ts +65 -0
- package/lib/workroom/workroom-preemption.d.ts.map +1 -0
- package/lib/workroom/workroom-preemption.js +213 -0
- package/lib/workroom/workroom-preemption.js.map +1 -0
- package/lib/workroom/workroom-scheduler-application.d.ts +43 -0
- package/lib/workroom/workroom-scheduler-application.d.ts.map +1 -0
- package/lib/workroom/workroom-scheduler-application.js +71 -0
- package/lib/workroom/workroom-scheduler-application.js.map +1 -0
- package/lib/workroom/workroom-scheduler.d.ts +135 -0
- package/lib/workroom/workroom-scheduler.d.ts.map +1 -0
- package/lib/workroom/workroom-scheduler.js +649 -0
- package/lib/workroom/workroom-scheduler.js.map +1 -0
- package/lib/workroom/workroom-task-report-store.d.ts +131 -0
- package/lib/workroom/workroom-task-report-store.d.ts.map +1 -0
- package/lib/workroom/workroom-task-report-store.js +528 -0
- package/lib/workroom/workroom-task-report-store.js.map +1 -0
- package/lib/zhin-agent/index.d.ts +7 -22
- package/lib/zhin-agent/index.d.ts.map +1 -1
- package/lib/zhin-agent/index.js +5 -33
- package/lib/zhin-agent/index.js.map +1 -1
- package/lib/zhin-agent/runtime-modules.d.ts +3 -3
- package/lib/zhin-agent/runtime-modules.d.ts.map +1 -1
- package/lib/zhin-agent/runtime-modules.js +3 -3
- package/lib/zhin-agent/runtime-modules.js.map +1 -1
- package/package.json +10 -16
- package/lib/a2a/delegation-message.d.ts +0 -14
- package/lib/a2a/delegation-message.d.ts.map +0 -1
- package/lib/a2a/delegation-message.js +0 -53
- package/lib/a2a/delegation-message.js.map +0 -1
- package/lib/a2a/task-state.d.ts +0 -9
- package/lib/a2a/task-state.d.ts.map +0 -1
- package/lib/a2a/task-state.js +0 -53
- package/lib/a2a/task-state.js.map +0 -1
- package/lib/assistant/runtime-registry.d.ts +0 -23
- package/lib/assistant/runtime-registry.d.ts.map +0 -1
- package/lib/assistant/runtime-registry.js +0 -27
- package/lib/assistant/runtime-registry.js.map +0 -1
- package/lib/authoring/define-dynamic.d.ts +0 -4
- package/lib/authoring/define-dynamic.d.ts.map +0 -1
- package/lib/authoring/define-dynamic.js +0 -8
- package/lib/authoring/define-dynamic.js.map +0 -1
- package/lib/authoring/define-state.d.ts +0 -4
- package/lib/authoring/define-state.d.ts.map +0 -1
- package/lib/authoring/define-state.js +0 -8
- package/lib/authoring/define-state.js.map +0 -1
- package/lib/builtin/five-agent/strategy.d.ts +0 -4
- package/lib/builtin/five-agent/strategy.d.ts.map +0 -1
- package/lib/builtin/five-agent/strategy.js +0 -42
- package/lib/builtin/five-agent/strategy.js.map +0 -1
- package/lib/builtin/memory-search-tool.d.ts +0 -2
- package/lib/builtin/memory-search-tool.d.ts.map +0 -1
- package/lib/builtin/memory-search-tool.js +0 -58
- package/lib/builtin/memory-search-tool.js.map +0 -1
- package/lib/builtin/memory-upsert-tool.d.ts +0 -2
- package/lib/builtin/memory-upsert-tool.d.ts.map +0 -1
- package/lib/builtin/memory-upsert-tool.js +0 -72
- package/lib/builtin/memory-upsert-tool.js.map +0 -1
- package/lib/builtin/orchestration-tools.d.ts +0 -7
- package/lib/builtin/orchestration-tools.d.ts.map +0 -1
- package/lib/builtin/orchestration-tools.js +0 -259
- package/lib/builtin/orchestration-tools.js.map +0 -1
- package/lib/connection/authorization-flow.d.ts +0 -26
- package/lib/connection/authorization-flow.d.ts.map +0 -1
- package/lib/connection/authorization-flow.js +0 -76
- package/lib/connection/authorization-flow.js.map +0 -1
- package/lib/connection/index.d.ts +0 -3
- package/lib/connection/index.d.ts.map +0 -1
- package/lib/connection/index.js +0 -2
- package/lib/connection/index.js.map +0 -1
- package/lib/dynamic/dynamic-registry.d.ts +0 -34
- package/lib/dynamic/dynamic-registry.d.ts.map +0 -1
- package/lib/dynamic/dynamic-registry.js +0 -52
- package/lib/dynamic/dynamic-registry.js.map +0 -1
- package/lib/init/bootstrap-gate.d.ts +0 -6
- package/lib/init/bootstrap-gate.d.ts.map +0 -1
- package/lib/init/bootstrap-gate.js +0 -28
- package/lib/init/bootstrap-gate.js.map +0 -1
- package/lib/memory-entry-registry.d.ts +0 -13
- package/lib/memory-entry-registry.d.ts.map +0 -1
- package/lib/memory-entry-registry.js +0 -24
- package/lib/memory-entry-registry.js.map +0 -1
- package/lib/orchestration-memory-hook.d.ts +0 -3
- package/lib/orchestration-memory-hook.d.ts.map +0 -1
- package/lib/orchestration-memory-hook.js +0 -22
- package/lib/orchestration-memory-hook.js.map +0 -1
- package/lib/orchestration-runtime-registry.d.ts +0 -16
- package/lib/orchestration-runtime-registry.d.ts.map +0 -1
- package/lib/orchestration-runtime-registry.js +0 -20
- package/lib/orchestration-runtime-registry.js.map +0 -1
- package/lib/orchestrator/agent-dispatcher.d.ts +0 -171
- package/lib/orchestrator/agent-dispatcher.d.ts.map +0 -1
- package/lib/orchestrator/agent-dispatcher.js +0 -415
- package/lib/orchestrator/agent-dispatcher.js.map +0 -1
- package/lib/orchestrator/bootstrap-executors.d.ts +0 -7
- package/lib/orchestrator/bootstrap-executors.d.ts.map +0 -1
- package/lib/orchestrator/bootstrap-executors.js +0 -73
- package/lib/orchestrator/bootstrap-executors.js.map +0 -1
- package/lib/orchestrator/orchestration-mappers.d.ts +0 -9
- package/lib/orchestrator/orchestration-mappers.d.ts.map +0 -1
- package/lib/orchestrator/orchestration-mappers.js +0 -117
- package/lib/orchestrator/orchestration-mappers.js.map +0 -1
- package/lib/orchestrator/orchestration-repository.d.ts +0 -91
- package/lib/orchestrator/orchestration-repository.d.ts.map +0 -1
- package/lib/orchestrator/orchestration-repository.js +0 -389
- package/lib/orchestrator/orchestration-repository.js.map +0 -1
- package/lib/orchestrator/orchestration-service.d.ts +0 -133
- package/lib/orchestrator/orchestration-service.d.ts.map +0 -1
- package/lib/orchestrator/orchestration-service.js +0 -582
- package/lib/orchestrator/orchestration-service.js.map +0 -1
- package/lib/orchestrator/orchestration-source.d.ts +0 -5
- package/lib/orchestrator/orchestration-source.d.ts.map +0 -1
- package/lib/orchestrator/orchestration-source.js +0 -22
- package/lib/orchestrator/orchestration-source.js.map +0 -1
- package/lib/orchestrator/orchestration-types.d.ts +0 -88
- package/lib/orchestrator/orchestration-types.d.ts.map +0 -1
- package/lib/orchestrator/orchestration-types.js +0 -2
- package/lib/orchestrator/orchestration-types.js.map +0 -1
- package/lib/orchestrator/remote-agent-registry.d.ts +0 -37
- package/lib/orchestrator/remote-agent-registry.d.ts.map +0 -1
- package/lib/orchestrator/remote-agent-registry.js +0 -178
- package/lib/orchestrator/remote-agent-registry.js.map +0 -1
- package/lib/orchestrator/remote-task-executor.d.ts +0 -10
- package/lib/orchestrator/remote-task-executor.d.ts.map +0 -1
- package/lib/orchestrator/remote-task-executor.js +0 -231
- package/lib/orchestrator/remote-task-executor.js.map +0 -1
- package/lib/orchestrator/remote-task-poller.d.ts +0 -18
- package/lib/orchestrator/remote-task-poller.d.ts.map +0 -1
- package/lib/orchestrator/remote-task-poller.js +0 -84
- package/lib/orchestrator/remote-task-poller.js.map +0 -1
- package/lib/orchestrator/resolve-subagent-tools.d.ts.map +0 -1
- package/lib/orchestrator/resolve-subagent-tools.js.map +0 -1
- package/lib/orchestrator/task-queue.d.ts +0 -167
- package/lib/orchestrator/task-queue.d.ts.map +0 -1
- package/lib/orchestrator/task-queue.js +0 -416
- package/lib/orchestrator/task-queue.js.map +0 -1
- package/lib/session/passive-group-buffer.d.ts +0 -15
- package/lib/session/passive-group-buffer.d.ts.map +0 -1
- package/lib/session/passive-group-buffer.js +0 -50
- package/lib/session/passive-group-buffer.js.map +0 -1
- package/lib/session/passive-group-session.d.ts +0 -10
- package/lib/session/passive-group-session.d.ts.map +0 -1
- package/lib/session/passive-group-session.js +0 -32
- package/lib/session/passive-group-session.js.map +0 -1
- package/lib/session-tree-runtime-registry.d.ts +0 -22
- package/lib/session-tree-runtime-registry.d.ts.map +0 -1
- package/lib/session-tree-runtime-registry.js.map +0 -1
- package/lib/state/agent-state-store.d.ts +0 -18
- package/lib/state/agent-state-store.d.ts.map +0 -1
- package/lib/state/agent-state-store.js +0 -50
- package/lib/state/agent-state-store.js.map +0 -1
- /package/lib/{orchestrator → resource-hub}/hook-registry.d.ts +0 -0
- /package/lib/{orchestrator → resource-hub}/hook-registry.js +0 -0
- /package/lib/{orchestrator → resource-hub}/mcp-lifecycle.d.ts +0 -0
- /package/lib/{orchestrator → resource-hub}/mcp-lifecycle.js +0 -0
- /package/lib/{orchestrator → resource-hub}/mcp-registry.d.ts +0 -0
- /package/lib/{orchestrator → resource-hub}/mcp-registry.js +0 -0
- /package/lib/{orchestrator → resource-hub}/resource-registry.d.ts +0 -0
- /package/lib/{orchestrator → resource-hub}/resource-registry.js +0 -0
- /package/lib/{orchestrator → resource-hub}/role-configs.d.ts +0 -0
- /package/lib/{orchestrator → resource-hub}/skill-registry.d.ts +0 -0
- /package/lib/{orchestrator → resource-hub}/skill-registry.js +0 -0
- /package/lib/{orchestrator → resource-hub}/subagent-registry.d.ts +0 -0
- /package/lib/{orchestrator → resource-hub}/subagent-registry.js +0 -0
- /package/lib/{orchestrator → resource-hub}/tool-registry.d.ts +0 -0
- /package/lib/{orchestrator → resource-hub}/tool-registry.js +0 -0
- /package/lib/{orchestrator → resource-hub}/tool-selection.d.ts +0 -0
- /package/lib/{orchestrator → resource-hub}/tool-selection.js +0 -0
- /package/lib/{orchestrator → resource-hub}/types.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-interaction-space-binding-repository.d.ts","sourceRoot":"","sources":["../../src/workroom/file-interaction-space-binding-repository.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,uBAAuB,EACvB,iCAAiC,EAClC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,iCAAiC,GAAG,iBAAiB,CAAC;AAElE,0DAA0D;AAC1D,MAAM,WAAW,iCAAkC,SAAQ,iBAAiB;IAC1E,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;IAClD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3D;AAsBD;;;;;;GAMG;AACH,qBAAa,qCACb,YAAW,iCAAiC;;IAIxC,QAAQ,CAAC,SAAS,EAAE,MAAM;IAC1B,QAAQ,CAAC,UAAU,EAAE,iCAAiC;gBAD7C,SAAS,EAAE,MAAM,EACjB,UAAU,GAAE,iCAAkD;IAKnE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,uBAAuB,EAAE,CAAC;IAO1E,MAAM,CACV,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,EACxB,MAAM,EAAE,SAAS,uBAAuB,EAAE,GACzC,OAAO,CAAC,SAAS,uBAAuB,EAAE,CAAC;CAmF/C"}
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { readFile as nodeReadFile, readdir as nodeReaddir, } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { canonicalWorkroomJson, deepFreezeWorkroomValue as deepFreeze, digestCanonicalWorkroomValue, } from './canonical-value.js';
|
|
5
|
+
import { DurableFileStore, nodeDurableFileSystem, } from './durable-file-store.js';
|
|
6
|
+
const nodeFileSystem = Object.freeze({
|
|
7
|
+
...nodeDurableFileSystem,
|
|
8
|
+
readdir: async (path) => await nodeReaddir(path),
|
|
9
|
+
readFile: async (path, encoding) => await nodeReadFile(path, encoding),
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Crash-durable Interaction Space binding history.
|
|
13
|
+
*
|
|
14
|
+
* The leaf directory is created non-recursively, so its parent must already be
|
|
15
|
+
* durable. Immutable segments are published through a hard-link pathname whose
|
|
16
|
+
* conversation-key hash and first binding revision form the cross-process CAS.
|
|
17
|
+
*/
|
|
18
|
+
export class FileInteractionSpaceBindingRepository {
|
|
19
|
+
directory;
|
|
20
|
+
fileSystem;
|
|
21
|
+
#durable;
|
|
22
|
+
constructor(directory, fileSystem = nodeFileSystem) {
|
|
23
|
+
this.directory = directory;
|
|
24
|
+
this.fileSystem = fileSystem;
|
|
25
|
+
this.#durable = new DurableFileStore(directory, fileSystem);
|
|
26
|
+
}
|
|
27
|
+
async read(conversationKey) {
|
|
28
|
+
const key = identifier(conversationKey, 'conversationKey');
|
|
29
|
+
const bindings = await this.#readBindings(key);
|
|
30
|
+
if (bindings.length > 0)
|
|
31
|
+
await this.#durable.syncLeaf();
|
|
32
|
+
return bindings;
|
|
33
|
+
}
|
|
34
|
+
async append(conversationKey, expectedRevision, values) {
|
|
35
|
+
const key = identifier(conversationKey, 'conversationKey');
|
|
36
|
+
revision(expectedRevision, 'expectedRevision', true);
|
|
37
|
+
const bindings = snapshotBindings(values, key);
|
|
38
|
+
if (bindings.length === 0) {
|
|
39
|
+
throw new Error('Interaction Space binding append requires facts');
|
|
40
|
+
}
|
|
41
|
+
const current = await this.#readBindings(key);
|
|
42
|
+
const replay = exactReplay(current, expectedRevision, bindings);
|
|
43
|
+
if (replay) {
|
|
44
|
+
if (current.length > 0)
|
|
45
|
+
await this.#durable.syncLeaf();
|
|
46
|
+
return replay;
|
|
47
|
+
}
|
|
48
|
+
if (current.length !== expectedRevision) {
|
|
49
|
+
throw revisionConflict(key, expectedRevision, current.length);
|
|
50
|
+
}
|
|
51
|
+
validateHistory(key, Object.freeze([...current, ...bindings]));
|
|
52
|
+
const firstBindingRevision = bindings[0].bindingRevision;
|
|
53
|
+
const payload = deepFreeze({
|
|
54
|
+
version: 1,
|
|
55
|
+
conversationKey: key,
|
|
56
|
+
expectedRevision,
|
|
57
|
+
firstBindingRevision,
|
|
58
|
+
lastBindingRevision: bindings.at(-1).bindingRevision,
|
|
59
|
+
bindings,
|
|
60
|
+
});
|
|
61
|
+
const segment = deepFreeze({
|
|
62
|
+
...payload,
|
|
63
|
+
payloadDigest: digestCanonicalWorkroomValue(payload),
|
|
64
|
+
});
|
|
65
|
+
await this.#durable.ensureDurableLeaf('Interaction Space binding repository');
|
|
66
|
+
const path = this.#segmentPath(key, firstBindingRevision);
|
|
67
|
+
const published = await this.#durable.publishCreateOnly({
|
|
68
|
+
target: path,
|
|
69
|
+
content: JSON.stringify(segment),
|
|
70
|
+
createdValue: bindings,
|
|
71
|
+
onConflict: async () => {
|
|
72
|
+
const winner = await this.#readBindings(key);
|
|
73
|
+
const exact = exactReplay(winner, expectedRevision, bindings);
|
|
74
|
+
if (exact)
|
|
75
|
+
return exact;
|
|
76
|
+
throw revisionConflict(key, expectedRevision, winner.length);
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
return published.value;
|
|
80
|
+
}
|
|
81
|
+
async #readBindings(conversationKey) {
|
|
82
|
+
let names;
|
|
83
|
+
try {
|
|
84
|
+
names = await this.fileSystem.readdir(this.directory);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
if (isMissingFile(error))
|
|
88
|
+
return Object.freeze([]);
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
const segmentNames = names.filter(name => name.endsWith('.json')).sort();
|
|
92
|
+
const segments = await Promise.all(segmentNames.map(async (name) => parseSegment(await this.fileSystem.readFile(join(this.directory, name), 'utf8'), name)));
|
|
93
|
+
const selected = segments
|
|
94
|
+
.filter(segment => segment.conversationKey === conversationKey)
|
|
95
|
+
.sort((left, right) => left.firstBindingRevision - right.firstBindingRevision);
|
|
96
|
+
const bindings = [];
|
|
97
|
+
let expectedRevision = 0;
|
|
98
|
+
for (const segment of selected) {
|
|
99
|
+
if (segment.expectedRevision !== expectedRevision
|
|
100
|
+
|| segment.firstBindingRevision !== expectedRevision + 1) {
|
|
101
|
+
throw new Error('Interaction Space binding segment revision gap');
|
|
102
|
+
}
|
|
103
|
+
bindings.push(...segment.bindings);
|
|
104
|
+
expectedRevision = segment.lastBindingRevision;
|
|
105
|
+
}
|
|
106
|
+
const frozen = deepFreeze(bindings);
|
|
107
|
+
validateHistory(conversationKey, frozen);
|
|
108
|
+
return frozen;
|
|
109
|
+
}
|
|
110
|
+
#segmentPath(conversationKey, firstRevision) {
|
|
111
|
+
return join(this.directory, segmentName(conversationKey, firstRevision));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function snapshotBindings(values, conversationKey) {
|
|
115
|
+
if (!Array.isArray(values))
|
|
116
|
+
throw new Error('Invalid Interaction Space binding facts');
|
|
117
|
+
return deepFreeze(values.map(value => {
|
|
118
|
+
const encoded = JSON.stringify(value);
|
|
119
|
+
if (typeof encoded !== 'string')
|
|
120
|
+
throw new Error('Invalid Interaction Space binding fact');
|
|
121
|
+
return parseBinding(JSON.parse(encoded), conversationKey);
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
function exactReplay(current, expectedRevision, bindings) {
|
|
125
|
+
if (expectedRevision + bindings.length > current.length)
|
|
126
|
+
return undefined;
|
|
127
|
+
const persisted = current.slice(expectedRevision, expectedRevision + bindings.length);
|
|
128
|
+
if (canonicalWorkroomJson(persisted) === canonicalWorkroomJson(bindings)) {
|
|
129
|
+
return deepFreeze(persisted);
|
|
130
|
+
}
|
|
131
|
+
if (persisted.length > 0) {
|
|
132
|
+
throw new Error(`Interaction Space binding replay payload drift at revision ${expectedRevision}`);
|
|
133
|
+
}
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
function parseSegment(value, name) {
|
|
137
|
+
const match = /^([a-f0-9]{64})\.(\d{16})\.json$/u.exec(name);
|
|
138
|
+
if (!match)
|
|
139
|
+
throw new Error('Invalid Interaction Space binding segment name');
|
|
140
|
+
let parsed;
|
|
141
|
+
try {
|
|
142
|
+
parsed = JSON.parse(value);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
throw new Error('Invalid Interaction Space binding segment JSON', { cause: error });
|
|
146
|
+
}
|
|
147
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
148
|
+
throw new Error('Invalid Interaction Space binding segment');
|
|
149
|
+
}
|
|
150
|
+
assertExactKeys(parsed, [
|
|
151
|
+
'version', 'conversationKey', 'expectedRevision', 'firstBindingRevision',
|
|
152
|
+
'lastBindingRevision', 'bindings', 'payloadDigest',
|
|
153
|
+
], 'segment');
|
|
154
|
+
const segment = parsed;
|
|
155
|
+
if (segment.version !== 1
|
|
156
|
+
|| typeof segment.conversationKey !== 'string'
|
|
157
|
+
|| !Number.isSafeInteger(segment.expectedRevision)
|
|
158
|
+
|| !Number.isSafeInteger(segment.firstBindingRevision)
|
|
159
|
+
|| !Number.isSafeInteger(segment.lastBindingRevision)
|
|
160
|
+
|| !Array.isArray(segment.bindings)
|
|
161
|
+
|| typeof segment.payloadDigest !== 'string') {
|
|
162
|
+
throw new Error('Invalid Interaction Space binding segment');
|
|
163
|
+
}
|
|
164
|
+
const conversationKey = identifier(segment.conversationKey, 'conversationKey');
|
|
165
|
+
const expectedRevision = revision(segment.expectedRevision, 'expectedRevision', true);
|
|
166
|
+
const firstBindingRevision = revision(segment.firstBindingRevision, 'firstBindingRevision');
|
|
167
|
+
const lastBindingRevision = revision(segment.lastBindingRevision, 'lastBindingRevision');
|
|
168
|
+
if (match[1] !== conversationKeyHash(conversationKey)
|
|
169
|
+
|| Number(match[2]) !== firstBindingRevision) {
|
|
170
|
+
throw new Error('Interaction Space binding segment name binding mismatch');
|
|
171
|
+
}
|
|
172
|
+
const bindings = deepFreeze(segment.bindings.map(binding => parseBinding(binding, conversationKey)));
|
|
173
|
+
if (bindings.length === 0
|
|
174
|
+
|| firstBindingRevision !== expectedRevision + 1
|
|
175
|
+
|| bindings[0].bindingRevision !== firstBindingRevision
|
|
176
|
+
|| bindings.at(-1).bindingRevision !== lastBindingRevision) {
|
|
177
|
+
throw new Error('Invalid Interaction Space binding segment position');
|
|
178
|
+
}
|
|
179
|
+
for (let index = 0; index < bindings.length; index += 1) {
|
|
180
|
+
if (bindings[index].bindingRevision !== firstBindingRevision + index) {
|
|
181
|
+
throw new Error('Invalid Interaction Space binding position');
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const payload = deepFreeze({
|
|
185
|
+
version: 1,
|
|
186
|
+
conversationKey,
|
|
187
|
+
expectedRevision,
|
|
188
|
+
firstBindingRevision,
|
|
189
|
+
lastBindingRevision,
|
|
190
|
+
bindings,
|
|
191
|
+
});
|
|
192
|
+
if (segment.payloadDigest !== digestCanonicalWorkroomValue(payload)) {
|
|
193
|
+
throw new Error('Interaction Space binding segment payload digest mismatch');
|
|
194
|
+
}
|
|
195
|
+
validateHistory(conversationKey, bindings, firstBindingRevision - 1);
|
|
196
|
+
return deepFreeze({ ...payload, payloadDigest: segment.payloadDigest });
|
|
197
|
+
}
|
|
198
|
+
function parseBinding(value, conversationKey) {
|
|
199
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
200
|
+
throw new Error('Invalid Interaction Space binding');
|
|
201
|
+
}
|
|
202
|
+
assertExactKeys(value, [
|
|
203
|
+
'version', 'conversationKey', 'bindingRevision', 'effectiveAfterConversationSequence',
|
|
204
|
+
'space', 'projectId', 'sourceRef', 'sourceDigest', 'digest',
|
|
205
|
+
], 'binding');
|
|
206
|
+
const binding = value;
|
|
207
|
+
if (binding.version !== 1 || binding.conversationKey !== conversationKey) {
|
|
208
|
+
throw new Error('Interaction Space binding conversation mismatch');
|
|
209
|
+
}
|
|
210
|
+
const bindingRevision = revision(binding.bindingRevision, 'bindingRevision');
|
|
211
|
+
const effectiveAfterConversationSequence = revision(binding.effectiveAfterConversationSequence, 'effectiveAfterConversationSequence', true);
|
|
212
|
+
if (binding.space !== 'chat' && binding.space !== 'workroom' && binding.space !== 'sponsor_room') {
|
|
213
|
+
throw new Error('Invalid Interaction Space binding space');
|
|
214
|
+
}
|
|
215
|
+
const projectId = binding.projectId === undefined
|
|
216
|
+
? undefined
|
|
217
|
+
: identifier(binding.projectId, 'projectId');
|
|
218
|
+
if (binding.space === 'chat' && projectId !== undefined) {
|
|
219
|
+
throw new Error('Interaction Space chat binding cannot carry projectId');
|
|
220
|
+
}
|
|
221
|
+
if (binding.space !== 'chat' && projectId === undefined) {
|
|
222
|
+
throw new Error(`Interaction Space ${binding.space} binding requires projectId`);
|
|
223
|
+
}
|
|
224
|
+
const sourceRef = identifier(binding.sourceRef, 'sourceRef');
|
|
225
|
+
const sourceDigest = sha256(binding.sourceDigest, 'sourceDigest');
|
|
226
|
+
const projection = deepFreeze({
|
|
227
|
+
version: 1,
|
|
228
|
+
conversationKey,
|
|
229
|
+
bindingRevision,
|
|
230
|
+
effectiveAfterConversationSequence,
|
|
231
|
+
space: binding.space,
|
|
232
|
+
...(projectId === undefined ? {} : { projectId }),
|
|
233
|
+
sourceRef,
|
|
234
|
+
sourceDigest,
|
|
235
|
+
});
|
|
236
|
+
if (binding.digest !== digestCanonicalWorkroomValue(projection)) {
|
|
237
|
+
throw new Error('Interaction Space binding digest mismatch');
|
|
238
|
+
}
|
|
239
|
+
return deepFreeze({ ...projection, digest: binding.digest });
|
|
240
|
+
}
|
|
241
|
+
function validateHistory(conversationKey, bindings, revisionOffset = 0) {
|
|
242
|
+
let previous;
|
|
243
|
+
bindings.forEach((value, index) => {
|
|
244
|
+
const binding = parseBinding(value, conversationKey);
|
|
245
|
+
if (binding.bindingRevision !== revisionOffset + index + 1) {
|
|
246
|
+
throw new Error('Interaction Space binding revisions must be contiguous');
|
|
247
|
+
}
|
|
248
|
+
if (previous
|
|
249
|
+
&& binding.effectiveAfterConversationSequence
|
|
250
|
+
< previous.effectiveAfterConversationSequence) {
|
|
251
|
+
throw new Error('Interaction Space binding anchor must not move backwards');
|
|
252
|
+
}
|
|
253
|
+
previous = binding;
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function segmentName(conversationKey, firstRevision) {
|
|
257
|
+
return `${conversationKeyHash(conversationKey)}.${String(firstRevision).padStart(16, '0')}.json`;
|
|
258
|
+
}
|
|
259
|
+
function conversationKeyHash(conversationKey) {
|
|
260
|
+
return createHash('sha256').update(conversationKey).digest('hex');
|
|
261
|
+
}
|
|
262
|
+
function identifier(value, field) {
|
|
263
|
+
if (typeof value !== 'string' || !value.trim() || value !== value.trim()) {
|
|
264
|
+
throw new Error(`Invalid Interaction Space binding ${field}`);
|
|
265
|
+
}
|
|
266
|
+
return value;
|
|
267
|
+
}
|
|
268
|
+
function revision(value, field, allowZero = false) {
|
|
269
|
+
if (!Number.isSafeInteger(value) || value < (allowZero ? 0 : 1)) {
|
|
270
|
+
throw new Error(`Invalid Interaction Space binding ${field}`);
|
|
271
|
+
}
|
|
272
|
+
return value;
|
|
273
|
+
}
|
|
274
|
+
function sha256(value, field) {
|
|
275
|
+
if (typeof value !== 'string' || !/^sha256:[a-f0-9]{64}$/u.test(value)) {
|
|
276
|
+
throw new Error(`Invalid Interaction Space binding ${field}`);
|
|
277
|
+
}
|
|
278
|
+
return value;
|
|
279
|
+
}
|
|
280
|
+
function assertExactKeys(value, allowed, label) {
|
|
281
|
+
const allow = new Set(allowed);
|
|
282
|
+
const unexpected = Object.keys(value).find(key => !allow.has(key));
|
|
283
|
+
if (unexpected)
|
|
284
|
+
throw new Error(`Invalid Interaction Space binding ${label} field: ${unexpected}`);
|
|
285
|
+
}
|
|
286
|
+
function revisionConflict(conversationKey, expected, actual) {
|
|
287
|
+
return new Error(`Interaction Space binding ${conversationKey} revision conflict: expected ${expected}, actual ${actual}`);
|
|
288
|
+
}
|
|
289
|
+
function isMissingFile(error) {
|
|
290
|
+
return Boolean(error && typeof error === 'object' && 'code' in error
|
|
291
|
+
&& error.code === 'ENOENT');
|
|
292
|
+
}
|
|
293
|
+
//# sourceMappingURL=file-interaction-space-binding-repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-interaction-space-binding-repository.js","sourceRoot":"","sources":["../../src/workroom/file-interaction-space-binding-repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,OAAO,IAAI,WAAW,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,qBAAqB,EACrB,uBAAuB,IAAI,UAAU,EACrC,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GAGtB,MAAM,yBAAyB,CAAC;AAUjC,MAAM,cAAc,GAAsC,MAAM,CAAC,MAAM,CAAC;IACtE,GAAG,qBAAqB;IACxB,OAAO,EAAE,KAAK,EAAE,IAAY,EAA8B,EAAE,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC;IACpF,QAAQ,EAAE,KAAK,EAAE,IAAY,EAAE,QAAgB,EAAmB,EAAE,CAClE,MAAM,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC;CACrC,CAAC,CAAC;AAeH;;;;;;GAMG;AACH,MAAM,OAAO,qCAAqC;IAKrC;IACA;IAJF,QAAQ,CAAmB;IAEpC,YACW,SAAiB,EACjB,aAAgD,cAAc;QAD9D,cAAS,GAAT,SAAS,CAAQ;QACjB,eAAU,GAAV,UAAU,CAAoD;QAEvE,IAAI,CAAC,QAAQ,GAAG,IAAI,gBAAgB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,eAAuB;QAChC,MAAM,GAAG,GAAG,UAAU,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,CAA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CACzG,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK;WAC9D,KAA4B,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ProjectProfileEvent, type ProjectProfileEventDraft, type ProjectProfileJournal } from './profile-registry.js';
|
|
2
|
+
export interface ProjectProfileJournalFileHandle {
|
|
3
|
+
writeFile(value: string, encoding: 'utf8'): Promise<void>;
|
|
4
|
+
sync(): Promise<void>;
|
|
5
|
+
close(): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
/** Injectable only at the durable filesystem boundary. */
|
|
8
|
+
export interface ProjectProfileJournalFileSystem {
|
|
9
|
+
mkdir(path: string): Promise<void>;
|
|
10
|
+
readdir(path: string): Promise<readonly string[]>;
|
|
11
|
+
readFile(path: string, encoding: 'utf8'): Promise<string>;
|
|
12
|
+
open(path: string, flags: 'wx' | 'r'): Promise<ProjectProfileJournalFileHandle>;
|
|
13
|
+
link(existingPath: string, newPath: string): Promise<void>;
|
|
14
|
+
unlink(path: string): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Crash-durable Project Profile Registry Journal.
|
|
18
|
+
*
|
|
19
|
+
* The configured leaf is created non-recursively. Its parent must already be
|
|
20
|
+
* durable; the adapter fsyncs that parent before publishing the first segment.
|
|
21
|
+
* Every append is an immutable segment, and a hard link to the first-sequence
|
|
22
|
+
* pathname is the cross-process expected-revision CAS.
|
|
23
|
+
*/
|
|
24
|
+
export declare class FileProjectProfileJournal implements ProjectProfileJournal {
|
|
25
|
+
#private;
|
|
26
|
+
readonly directory: string;
|
|
27
|
+
readonly fileSystem: ProjectProfileJournalFileSystem;
|
|
28
|
+
constructor(directory: string, fileSystem?: ProjectProfileJournalFileSystem);
|
|
29
|
+
read(projectId: string): Promise<readonly ProjectProfileEvent[]>;
|
|
30
|
+
append(projectId: string, expectedRevision: number, drafts: readonly ProjectProfileEventDraft[]): Promise<readonly ProjectProfileEvent[]>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=file-profile-journal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-profile-journal.d.ts","sourceRoot":"","sources":["../../src/workroom/file-profile-journal.ts"],"names":[],"mappings":"AAeA,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC3B,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,+BAA+B;IAC9C,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,0DAA0D;AAC1D,MAAM,WAAW,+BAA+B;IAC9C,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;IAClD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1D,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,GAAG,GAAG,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;IAChF,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AA+BD;;;;;;;GAOG;AACH,qBAAa,yBAA0B,YAAW,qBAAqB;;IAEnE,QAAQ,CAAC,SAAS,EAAE,MAAM;IAC1B,QAAQ,CAAC,UAAU,EAAE,+BAA+B;gBAD3C,SAAS,EAAE,MAAM,EACjB,UAAU,GAAE,+BAAgD;IAGjE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,mBAAmB,EAAE,CAAC;IAQhE,MAAM,CACV,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,MAAM,EACxB,MAAM,EAAE,SAAS,wBAAwB,EAAE,GAC1C,OAAO,CAAC,SAAS,mBAAmB,EAAE,CAAC;CAyJ3C"}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import { link as nodeLink, mkdir as nodeMkdir, open as nodeOpen, readFile as nodeReadFile, readdir as nodeReaddir, unlink as nodeUnlink, } from 'node:fs/promises';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { canonicalWorkroomJson, deepFreezeWorkroomValue as deepFreeze, digestCanonicalWorkroomValue, } from './canonical-value.js';
|
|
5
|
+
import { ProfileRegistrySequenceConflictError, replayProjectProfileJournal, } from './profile-registry.js';
|
|
6
|
+
const nodeFileSystem = Object.freeze({
|
|
7
|
+
mkdir: async (path) => {
|
|
8
|
+
await nodeMkdir(path);
|
|
9
|
+
},
|
|
10
|
+
readdir: async (path) => await nodeReaddir(path),
|
|
11
|
+
readFile: async (path, encoding) => await nodeReadFile(path, encoding),
|
|
12
|
+
open: async (path, flags) => await nodeOpen(path, flags),
|
|
13
|
+
link: async (existingPath, newPath) => await nodeLink(existingPath, newPath),
|
|
14
|
+
unlink: async (path) => await nodeUnlink(path),
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Crash-durable Project Profile Registry Journal.
|
|
18
|
+
*
|
|
19
|
+
* The configured leaf is created non-recursively. Its parent must already be
|
|
20
|
+
* durable; the adapter fsyncs that parent before publishing the first segment.
|
|
21
|
+
* Every append is an immutable segment, and a hard link to the first-sequence
|
|
22
|
+
* pathname is the cross-process expected-revision CAS.
|
|
23
|
+
*/
|
|
24
|
+
export class FileProjectProfileJournal {
|
|
25
|
+
directory;
|
|
26
|
+
fileSystem;
|
|
27
|
+
constructor(directory, fileSystem = nodeFileSystem) {
|
|
28
|
+
this.directory = directory;
|
|
29
|
+
this.fileSystem = fileSystem;
|
|
30
|
+
}
|
|
31
|
+
async read(projectId) {
|
|
32
|
+
const events = await this.#readEvents(identifier(projectId, 'projectId'));
|
|
33
|
+
// A previous writer may have linked the segment and then observed a failed
|
|
34
|
+
// directory fsync. Re-sync before a retry is allowed to confirm that fact.
|
|
35
|
+
if (events.length > 0)
|
|
36
|
+
await this.#syncDirectoryPath(this.directory);
|
|
37
|
+
return events;
|
|
38
|
+
}
|
|
39
|
+
async append(projectId, expectedRevision, drafts) {
|
|
40
|
+
const id = identifier(projectId, 'projectId');
|
|
41
|
+
expectedRegistryRevision(expectedRevision);
|
|
42
|
+
const snapshottedDrafts = snapshotDrafts(drafts);
|
|
43
|
+
const current = await this.#readEvents(id);
|
|
44
|
+
const replayed = exactReplay(current, expectedRevision, snapshottedDrafts);
|
|
45
|
+
if (replayed) {
|
|
46
|
+
if (current.length > 0)
|
|
47
|
+
await this.#syncDirectoryPath(this.directory);
|
|
48
|
+
return replayed;
|
|
49
|
+
}
|
|
50
|
+
const actualRevision = current.at(-1)?.sequence ?? -1;
|
|
51
|
+
if (actualRevision !== expectedRevision) {
|
|
52
|
+
throw new ProfileRegistrySequenceConflictError(id, expectedRevision, actualRevision);
|
|
53
|
+
}
|
|
54
|
+
if (snapshottedDrafts.length === 0)
|
|
55
|
+
return Object.freeze([]);
|
|
56
|
+
const events = deepFreeze(snapshottedDrafts.map((draft, index) => ({
|
|
57
|
+
...draft,
|
|
58
|
+
version: 1,
|
|
59
|
+
projectId: id,
|
|
60
|
+
sequence: expectedRevision + index + 1,
|
|
61
|
+
})));
|
|
62
|
+
replayProjectProfileJournal(id, Object.freeze([...current, ...events]));
|
|
63
|
+
const payload = deepFreeze({
|
|
64
|
+
version: 1,
|
|
65
|
+
projectId: id,
|
|
66
|
+
expectedRegistryRevision: expectedRevision,
|
|
67
|
+
firstSequence: events[0].sequence,
|
|
68
|
+
lastSequence: events.at(-1).sequence,
|
|
69
|
+
events,
|
|
70
|
+
});
|
|
71
|
+
const segment = deepFreeze({
|
|
72
|
+
...payload,
|
|
73
|
+
payloadDigest: digestCanonicalWorkroomValue(payload),
|
|
74
|
+
});
|
|
75
|
+
await this.#ensureDurableLeaf();
|
|
76
|
+
const path = this.#segmentPath(id, segment.firstSequence);
|
|
77
|
+
const temporaryPath = path + '.' + randomUUID() + '.tmp';
|
|
78
|
+
let temporaryExists = false;
|
|
79
|
+
try {
|
|
80
|
+
const handle = await this.fileSystem.open(temporaryPath, 'wx');
|
|
81
|
+
temporaryExists = true;
|
|
82
|
+
try {
|
|
83
|
+
await handle.writeFile(JSON.stringify(segment), 'utf8');
|
|
84
|
+
await handle.sync();
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
await handle.close();
|
|
88
|
+
}
|
|
89
|
+
await this.fileSystem.link(temporaryPath, path);
|
|
90
|
+
await this.fileSystem.unlink(temporaryPath);
|
|
91
|
+
temporaryExists = false;
|
|
92
|
+
await this.#syncDirectoryPath(this.directory);
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
if (temporaryExists) {
|
|
96
|
+
await this.#removeTemporary(temporaryPath);
|
|
97
|
+
temporaryExists = false;
|
|
98
|
+
}
|
|
99
|
+
if (isAlreadyExists(error)) {
|
|
100
|
+
const winner = await this.#readEvents(id);
|
|
101
|
+
const exact = exactReplay(winner, expectedRevision, snapshottedDrafts);
|
|
102
|
+
await this.#syncDirectoryPath(this.directory);
|
|
103
|
+
if (exact)
|
|
104
|
+
return exact;
|
|
105
|
+
throw new ProfileRegistrySequenceConflictError(id, expectedRevision, winner.at(-1)?.sequence ?? -1);
|
|
106
|
+
}
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
if (temporaryExists)
|
|
111
|
+
await this.#removeTemporary(temporaryPath);
|
|
112
|
+
}
|
|
113
|
+
return events;
|
|
114
|
+
}
|
|
115
|
+
async #readEvents(projectId) {
|
|
116
|
+
const prefix = projectFilePrefix(projectId);
|
|
117
|
+
let names;
|
|
118
|
+
try {
|
|
119
|
+
names = await this.fileSystem.readdir(this.directory);
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
if (isMissingFile(error))
|
|
123
|
+
return Object.freeze([]);
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
const segmentNames = names
|
|
127
|
+
.filter(name => name.startsWith(prefix) && name.endsWith('.json'))
|
|
128
|
+
.sort();
|
|
129
|
+
for (const name of segmentNames) {
|
|
130
|
+
if (!segmentNamePattern(prefix).test(name)) {
|
|
131
|
+
throw new Error('Invalid Project Profile Journal segment name');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const segments = await Promise.all(segmentNames.map(async (name) => parseSegment(await this.fileSystem.readFile(join(this.directory, name), 'utf8'), projectId, Number(name.slice(prefix.length, prefix.length + 16)))));
|
|
135
|
+
const events = [];
|
|
136
|
+
let expectedFirstSequence = 0;
|
|
137
|
+
for (const segment of segments) {
|
|
138
|
+
if (segment.firstSequence !== expectedFirstSequence
|
|
139
|
+
|| segment.expectedRegistryRevision !== expectedFirstSequence - 1) {
|
|
140
|
+
throw new Error('Project Profile Journal segment sequence gap');
|
|
141
|
+
}
|
|
142
|
+
events.push(...segment.events);
|
|
143
|
+
expectedFirstSequence = segment.lastSequence + 1;
|
|
144
|
+
}
|
|
145
|
+
const frozen = deepFreeze(events);
|
|
146
|
+
replayProjectProfileJournal(projectId, frozen);
|
|
147
|
+
return frozen;
|
|
148
|
+
}
|
|
149
|
+
#segmentPath(projectId, firstSequence) {
|
|
150
|
+
return join(this.directory, projectFilePrefix(projectId) + String(firstSequence).padStart(16, '0') + '.json');
|
|
151
|
+
}
|
|
152
|
+
async #ensureDurableLeaf() {
|
|
153
|
+
try {
|
|
154
|
+
await this.fileSystem.mkdir(this.directory);
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
if (!isAlreadyExists(error)) {
|
|
158
|
+
if (isMissingFile(error)) {
|
|
159
|
+
throw new Error('Project Profile Journal requires a pre-existing durable parent directory: '
|
|
160
|
+
+ dirname(this.directory), { cause: error });
|
|
161
|
+
}
|
|
162
|
+
throw error;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
await this.#syncDirectoryPath(dirname(this.directory));
|
|
166
|
+
}
|
|
167
|
+
async #syncDirectoryPath(path) {
|
|
168
|
+
const handle = await this.fileSystem.open(path, 'r');
|
|
169
|
+
try {
|
|
170
|
+
await handle.sync();
|
|
171
|
+
}
|
|
172
|
+
finally {
|
|
173
|
+
await handle.close();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
async #removeTemporary(path) {
|
|
177
|
+
await this.fileSystem.unlink(path).catch(error => {
|
|
178
|
+
if (!isMissingFile(error))
|
|
179
|
+
throw error;
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function snapshotDrafts(drafts) {
|
|
184
|
+
if (!Array.isArray(drafts))
|
|
185
|
+
throw new Error('Invalid Project Profile Journal event drafts');
|
|
186
|
+
return deepFreeze(drafts.map(draft => {
|
|
187
|
+
const encoded = JSON.stringify(draft);
|
|
188
|
+
if (typeof encoded !== 'string')
|
|
189
|
+
throw new Error('Invalid Project Profile Journal event draft');
|
|
190
|
+
return JSON.parse(encoded);
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
193
|
+
function exactReplay(current, expectedRevision, drafts) {
|
|
194
|
+
if (drafts.length === 0)
|
|
195
|
+
return current.at(-1)?.sequence === expectedRevision
|
|
196
|
+
? Object.freeze([])
|
|
197
|
+
: undefined;
|
|
198
|
+
const firstSequence = expectedRevision + 1;
|
|
199
|
+
if (firstSequence < 0 || firstSequence + drafts.length > current.length)
|
|
200
|
+
return undefined;
|
|
201
|
+
const persisted = current.slice(firstSequence, firstSequence + drafts.length);
|
|
202
|
+
const persistedDrafts = persisted.map(({ version: _version, projectId: _projectId, sequence: _sequence, ...draft }) => draft);
|
|
203
|
+
if (canonicalWorkroomJson(persistedDrafts) === canonicalWorkroomJson(drafts)) {
|
|
204
|
+
return deepFreeze(persisted);
|
|
205
|
+
}
|
|
206
|
+
if (persisted.length > 0) {
|
|
207
|
+
throw new Error('Project Profile Journal replay payload drift at registry revision '
|
|
208
|
+
+ expectedRevision);
|
|
209
|
+
}
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
212
|
+
function parseSegment(value, projectId, fileFirstSequence) {
|
|
213
|
+
let parsed;
|
|
214
|
+
try {
|
|
215
|
+
parsed = JSON.parse(value);
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
throw new Error('Invalid Project Profile Journal segment JSON', { cause: error });
|
|
219
|
+
}
|
|
220
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
221
|
+
throw new Error('Invalid Project Profile Journal segment');
|
|
222
|
+
}
|
|
223
|
+
const segment = parsed;
|
|
224
|
+
if (segment.version !== 1
|
|
225
|
+
|| segment.projectId !== projectId
|
|
226
|
+
|| !Number.isSafeInteger(segment.expectedRegistryRevision)
|
|
227
|
+
|| !Number.isSafeInteger(segment.firstSequence)
|
|
228
|
+
|| !Number.isSafeInteger(segment.lastSequence)
|
|
229
|
+
|| !Array.isArray(segment.events)
|
|
230
|
+
|| typeof segment.payloadDigest !== 'string') {
|
|
231
|
+
throw new Error('Invalid Project Profile Journal segment');
|
|
232
|
+
}
|
|
233
|
+
const segmentExpectedRevision = segment.expectedRegistryRevision;
|
|
234
|
+
const segmentFirstSequence = segment.firstSequence;
|
|
235
|
+
const segmentLastSequence = segment.lastSequence;
|
|
236
|
+
const events = segment.events.map(parseEvent);
|
|
237
|
+
if (segmentFirstSequence !== fileFirstSequence) {
|
|
238
|
+
throw new Error('Project Profile Journal segment name position mismatch');
|
|
239
|
+
}
|
|
240
|
+
if (events.length === 0
|
|
241
|
+
|| events[0].sequence !== segmentFirstSequence
|
|
242
|
+
|| events.at(-1).sequence !== segmentLastSequence
|
|
243
|
+
|| segmentFirstSequence !== segmentExpectedRevision + 1) {
|
|
244
|
+
throw new Error('Invalid Project Profile Journal segment position');
|
|
245
|
+
}
|
|
246
|
+
for (let index = 0; index < events.length; index += 1) {
|
|
247
|
+
const event = events[index];
|
|
248
|
+
if (event.projectId !== projectId || event.sequence !== segmentFirstSequence + index) {
|
|
249
|
+
throw new Error('Invalid Project Profile Journal event position');
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
const payload = deepFreeze({
|
|
253
|
+
version: 1,
|
|
254
|
+
projectId,
|
|
255
|
+
expectedRegistryRevision: segmentExpectedRevision,
|
|
256
|
+
firstSequence: segmentFirstSequence,
|
|
257
|
+
lastSequence: segmentLastSequence,
|
|
258
|
+
events,
|
|
259
|
+
});
|
|
260
|
+
if (segment.payloadDigest !== digestCanonicalWorkroomValue(payload)) {
|
|
261
|
+
throw new Error('Project Profile Journal segment payload digest mismatch');
|
|
262
|
+
}
|
|
263
|
+
return deepFreeze({ ...payload, payloadDigest: segment.payloadDigest });
|
|
264
|
+
}
|
|
265
|
+
function parseEvent(value) {
|
|
266
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
267
|
+
throw new Error('Invalid Project Profile Journal event');
|
|
268
|
+
}
|
|
269
|
+
const event = value;
|
|
270
|
+
if (event.version !== 1
|
|
271
|
+
|| typeof event.projectId !== 'string'
|
|
272
|
+
|| !Number.isSafeInteger(event.sequence)
|
|
273
|
+
|| !['profile.revision_registered', 'profile.revision_activated', 'run.profile_pinned']
|
|
274
|
+
.includes(event.type ?? '')
|
|
275
|
+
|| !event.payload
|
|
276
|
+
|| typeof event.payload !== 'object'
|
|
277
|
+
|| Array.isArray(event.payload)) {
|
|
278
|
+
throw new Error('Invalid Project Profile Journal event');
|
|
279
|
+
}
|
|
280
|
+
return deepFreeze(event);
|
|
281
|
+
}
|
|
282
|
+
function identifier(value, name) {
|
|
283
|
+
if (typeof value !== 'string' || !value.trim() || value !== value.trim()) {
|
|
284
|
+
throw new Error('Invalid Project Profile Journal ' + name);
|
|
285
|
+
}
|
|
286
|
+
return value;
|
|
287
|
+
}
|
|
288
|
+
function expectedRegistryRevision(value) {
|
|
289
|
+
if (!Number.isSafeInteger(value) || value < -1) {
|
|
290
|
+
throw new Error('Invalid Project Profile Journal expected registry revision');
|
|
291
|
+
}
|
|
292
|
+
return value;
|
|
293
|
+
}
|
|
294
|
+
function projectFilePrefix(projectId) {
|
|
295
|
+
return createHash('sha256').update(projectId).digest('hex') + '.';
|
|
296
|
+
}
|
|
297
|
+
function segmentNamePattern(prefix) {
|
|
298
|
+
return new RegExp('^' + prefix.replace('.', '\\.') + '\\d{16}\\.json$', 'u');
|
|
299
|
+
}
|
|
300
|
+
function isAlreadyExists(error) {
|
|
301
|
+
return Boolean(error && typeof error === 'object' && 'code' in error
|
|
302
|
+
&& error.code === 'EEXIST');
|
|
303
|
+
}
|
|
304
|
+
function isMissingFile(error) {
|
|
305
|
+
return Boolean(error && typeof error === 'object' && 'code' in error
|
|
306
|
+
&& error.code === 'ENOENT');
|
|
307
|
+
}
|
|
308
|
+
//# sourceMappingURL=file-profile-journal.js.map
|