@namzu/sdk 0.4.1 → 0.4.3
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/CHANGELOG.md +83 -0
- package/dist/__tests__/replay-public-surface.test.d.ts +2 -0
- package/dist/__tests__/replay-public-surface.test.d.ts.map +1 -0
- package/dist/__tests__/replay-public-surface.test.js +45 -0
- package/dist/__tests__/replay-public-surface.test.js.map +1 -0
- package/dist/advisory/context.test.d.ts +16 -0
- package/dist/advisory/context.test.d.ts.map +1 -0
- package/dist/advisory/context.test.js +92 -0
- package/dist/advisory/context.test.js.map +1 -0
- package/dist/advisory/evaluator.test.d.ts +34 -0
- package/dist/advisory/evaluator.test.d.ts.map +1 -0
- package/dist/advisory/evaluator.test.js +172 -0
- package/dist/advisory/evaluator.test.js.map +1 -0
- package/dist/advisory/executor.test.d.ts +35 -0
- package/dist/advisory/executor.test.d.ts.map +1 -0
- package/dist/advisory/executor.test.js +233 -0
- package/dist/advisory/executor.test.js.map +1 -0
- package/dist/advisory/registry.test.d.ts +16 -0
- package/dist/advisory/registry.test.d.ts.map +1 -0
- package/dist/advisory/registry.test.js +62 -0
- package/dist/advisory/registry.test.js.map +1 -0
- package/dist/agents/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/SupervisorAgent.js.map +1 -1
- package/dist/bridge/a2a/agent-card.test.d.ts +24 -0
- package/dist/bridge/a2a/agent-card.test.d.ts.map +1 -0
- package/dist/bridge/a2a/agent-card.test.js +118 -0
- package/dist/bridge/a2a/agent-card.test.js.map +1 -0
- package/dist/bridge/a2a/mapper.test.d.ts +29 -0
- package/dist/bridge/a2a/mapper.test.d.ts.map +1 -0
- package/dist/bridge/a2a/mapper.test.js +265 -0
- package/dist/bridge/a2a/mapper.test.js.map +1 -0
- package/dist/bridge/a2a/message.test.d.ts +20 -0
- package/dist/bridge/a2a/message.test.d.ts.map +1 -0
- package/dist/bridge/a2a/message.test.js +116 -0
- package/dist/bridge/a2a/message.test.js.map +1 -0
- package/dist/bridge/a2a/task.d.ts +2 -2
- package/dist/bridge/a2a/task.d.ts.map +1 -1
- package/dist/bridge/a2a/task.js.map +1 -1
- package/dist/bridge/a2a/task.test.d.ts +29 -0
- package/dist/bridge/a2a/task.test.d.ts.map +1 -0
- package/dist/bridge/a2a/task.test.js +198 -0
- package/dist/bridge/a2a/task.test.js.map +1 -0
- package/dist/bridge/mcp/connector/adapter.test.d.ts +27 -0
- package/dist/bridge/mcp/connector/adapter.test.d.ts.map +1 -0
- package/dist/bridge/mcp/connector/adapter.test.js +203 -0
- package/dist/bridge/mcp/connector/adapter.test.js.map +1 -0
- package/dist/bridge/sse/mapper.test.d.ts +27 -0
- package/dist/bridge/sse/mapper.test.d.ts.map +1 -0
- package/dist/bridge/sse/mapper.test.js +271 -0
- package/dist/bridge/sse/mapper.test.js.map +1 -0
- package/dist/bridge/tools/connector/adapter.test.d.ts +28 -0
- package/dist/bridge/tools/connector/adapter.test.d.ts.map +1 -0
- package/dist/bridge/tools/connector/adapter.test.js +182 -0
- package/dist/bridge/tools/connector/adapter.test.js.map +1 -0
- package/dist/bridge/tools/connector/definitions.test.d.ts +23 -0
- package/dist/bridge/tools/connector/definitions.test.d.ts.map +1 -0
- package/dist/bridge/tools/connector/definitions.test.js +158 -0
- package/dist/bridge/tools/connector/definitions.test.js.map +1 -0
- package/dist/bridge/tools/connector/router.test.d.ts +21 -0
- package/dist/bridge/tools/connector/router.test.d.ts.map +1 -0
- package/dist/bridge/tools/connector/router.test.js +139 -0
- package/dist/bridge/tools/connector/router.test.js.map +1 -0
- package/dist/bus/breaker.test.d.ts +41 -0
- package/dist/bus/breaker.test.d.ts.map +1 -0
- package/dist/bus/breaker.test.js +242 -0
- package/dist/bus/breaker.test.js.map +1 -0
- package/dist/bus/index.test.d.ts +25 -0
- package/dist/bus/index.test.d.ts.map +1 -0
- package/dist/bus/index.test.js +151 -0
- package/dist/bus/index.test.js.map +1 -0
- package/dist/bus/lock.test.d.ts +44 -0
- package/dist/bus/lock.test.d.ts.map +1 -0
- package/dist/bus/lock.test.js +226 -0
- package/dist/bus/lock.test.js.map +1 -0
- package/dist/bus/ownership.test.d.ts +26 -0
- package/dist/bus/ownership.test.d.ts.map +1 -0
- package/dist/bus/ownership.test.js +205 -0
- package/dist/bus/ownership.test.js.map +1 -0
- package/dist/config/runtime.d.ts +24 -25
- package/dist/config/runtime.d.ts.map +1 -1
- package/dist/config/runtime.js.map +1 -1
- package/dist/connector/BaseConnector.test.d.ts +21 -0
- package/dist/connector/BaseConnector.test.d.ts.map +1 -0
- package/dist/connector/BaseConnector.test.js +108 -0
- package/dist/connector/BaseConnector.test.js.map +1 -0
- package/dist/connector/builtins/http.test.d.ts +30 -0
- package/dist/connector/builtins/http.test.d.ts.map +1 -0
- package/dist/connector/builtins/http.test.js +232 -0
- package/dist/connector/builtins/http.test.js.map +1 -0
- package/dist/connector/builtins/webhook.test.d.ts +20 -0
- package/dist/connector/builtins/webhook.test.d.ts.map +1 -0
- package/dist/connector/builtins/webhook.test.js +113 -0
- package/dist/connector/builtins/webhook.test.js.map +1 -0
- package/dist/connector/execution/factory.test.d.ts +16 -0
- package/dist/connector/execution/factory.test.d.ts.map +1 -0
- package/dist/connector/execution/factory.test.js +64 -0
- package/dist/connector/execution/factory.test.js.map +1 -0
- package/dist/connector/execution/remote.test.d.ts +16 -0
- package/dist/connector/execution/remote.test.d.ts.map +1 -0
- package/dist/connector/execution/remote.test.js +53 -0
- package/dist/connector/execution/remote.test.js.map +1 -0
- package/dist/connector/mcp/adapter.test.d.ts +34 -0
- package/dist/connector/mcp/adapter.test.d.ts.map +1 -0
- package/dist/connector/mcp/adapter.test.js +199 -0
- package/dist/connector/mcp/adapter.test.js.map +1 -0
- package/dist/contracts/api.d.ts +2 -2
- package/dist/contracts/api.d.ts.map +1 -1
- package/dist/contracts/index.d.ts +1 -2
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/schemas.d.ts +10 -10
- package/dist/index.d.ts +3 -103
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -89
- package/dist/index.js.map +1 -1
- package/dist/manager/agent/__tests__/lifecycle.test.js.map +1 -1
- package/dist/manager/agent/lifecycle.d.ts +1 -1
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +1 -1
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/run/persistence.d.ts +3 -3
- package/dist/manager/run/persistence.d.ts.map +1 -1
- package/dist/manager/run/persistence.js.map +1 -1
- package/dist/manager/thread/__tests__/lifecycle.test.js.map +1 -1
- package/dist/manager/thread/lifecycle.d.ts +1 -1
- package/dist/manager/thread/lifecycle.d.ts.map +1 -1
- package/dist/plugin/loader.d.ts +0 -5
- package/dist/plugin/loader.d.ts.map +1 -1
- package/dist/plugin/loader.js +1 -13
- package/dist/plugin/loader.js.map +1 -1
- package/dist/public-runtime.d.ts +70 -0
- package/dist/public-runtime.d.ts.map +1 -0
- package/dist/public-runtime.js +108 -0
- package/dist/public-runtime.js.map +1 -0
- package/dist/public-tools.d.ts +19 -0
- package/dist/public-tools.d.ts.map +1 -0
- package/dist/public-tools.js +34 -0
- package/dist/public-tools.js.map +1 -0
- package/dist/public-types.d.ts +55 -0
- package/dist/public-types.d.ts.map +1 -0
- package/dist/public-types.js +14 -0
- package/dist/public-types.js.map +1 -0
- package/dist/rag/chunking.test.d.ts +20 -0
- package/dist/rag/chunking.test.d.ts.map +1 -0
- package/dist/rag/chunking.test.js +92 -0
- package/dist/rag/chunking.test.js.map +1 -0
- package/dist/rag/context-assembler.test.d.ts +19 -0
- package/dist/rag/context-assembler.test.d.ts.map +1 -0
- package/dist/rag/context-assembler.test.js +98 -0
- package/dist/rag/context-assembler.test.js.map +1 -0
- package/dist/rag/embedding.test.d.ts +19 -0
- package/dist/rag/embedding.test.d.ts.map +1 -0
- package/dist/rag/embedding.test.js +115 -0
- package/dist/rag/embedding.test.js.map +1 -0
- package/dist/rag/ingestion.test.d.ts +22 -0
- package/dist/rag/ingestion.test.d.ts.map +1 -0
- package/dist/rag/ingestion.test.js +99 -0
- package/dist/rag/ingestion.test.js.map +1 -0
- package/dist/rag/knowledge-base.test.d.ts +17 -0
- package/dist/rag/knowledge-base.test.d.ts.map +1 -0
- package/dist/rag/knowledge-base.test.js +77 -0
- package/dist/rag/knowledge-base.test.js.map +1 -0
- package/dist/rag/rag-tool.d.ts +1 -1
- package/dist/rag/rag-tool.test.d.ts +21 -0
- package/dist/rag/rag-tool.test.d.ts.map +1 -0
- package/dist/rag/rag-tool.test.js +149 -0
- package/dist/rag/rag-tool.test.js.map +1 -0
- package/dist/rag/retriever.test.d.ts +26 -0
- package/dist/rag/retriever.test.d.ts.map +1 -0
- package/dist/rag/retriever.test.js +180 -0
- package/dist/rag/retriever.test.js.map +1 -0
- package/dist/rag/vector-store.test.d.ts +38 -0
- package/dist/rag/vector-store.test.d.ts.map +1 -0
- package/dist/rag/vector-store.test.js +175 -0
- package/dist/rag/vector-store.test.js.map +1 -0
- package/dist/registry/ManagedRegistry.test.d.ts +21 -0
- package/dist/registry/ManagedRegistry.test.d.ts.map +1 -0
- package/dist/registry/ManagedRegistry.test.js +98 -0
- package/dist/registry/ManagedRegistry.test.js.map +1 -0
- package/dist/registry/Registry.test.d.ts +18 -0
- package/dist/registry/Registry.test.d.ts.map +1 -0
- package/dist/registry/Registry.test.js +79 -0
- package/dist/registry/Registry.test.js.map +1 -0
- package/dist/registry/agent/definitions.test.d.ts +15 -0
- package/dist/registry/agent/definitions.test.d.ts.map +1 -0
- package/dist/registry/agent/definitions.test.js +84 -0
- package/dist/registry/agent/definitions.test.js.map +1 -0
- package/dist/registry/connector/definitions.test.d.ts +13 -0
- package/dist/registry/connector/definitions.test.d.ts.map +1 -0
- package/dist/registry/connector/definitions.test.js +41 -0
- package/dist/registry/connector/definitions.test.js.map +1 -0
- package/dist/registry/connector/scoped.test.d.ts +21 -0
- package/dist/registry/connector/scoped.test.d.ts.map +1 -0
- package/dist/registry/connector/scoped.test.js +115 -0
- package/dist/registry/connector/scoped.test.js.map +1 -0
- package/dist/registry/plugin/index.test.d.ts +12 -0
- package/dist/registry/plugin/index.test.d.ts.map +1 -0
- package/dist/registry/plugin/index.test.js +69 -0
- package/dist/registry/plugin/index.test.js.map +1 -0
- package/dist/registry/tool/execute.test.d.ts +42 -0
- package/dist/registry/tool/execute.test.d.ts.map +1 -0
- package/dist/registry/tool/execute.test.js +281 -0
- package/dist/registry/tool/execute.test.js.map +1 -0
- package/dist/run/LimitChecker.d.ts +0 -1
- package/dist/run/LimitChecker.d.ts.map +1 -1
- package/dist/run/LimitChecker.js +0 -6
- package/dist/run/LimitChecker.js.map +1 -1
- package/dist/run/reporter.d.ts +2 -2
- package/dist/run/reporter.d.ts.map +1 -1
- package/dist/run/reporter.js.map +1 -1
- package/dist/runtime/query/__tests__/checkpoint.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/checkpoint.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/checkpoint.test.js +150 -0
- package/dist/runtime/query/__tests__/checkpoint.test.js.map +1 -0
- package/dist/runtime/query/checkpoint.d.ts +23 -0
- package/dist/runtime/query/checkpoint.d.ts.map +1 -1
- package/dist/runtime/query/checkpoint.js +49 -0
- package/dist/runtime/query/checkpoint.js.map +1 -1
- package/dist/runtime/query/context.d.ts +0 -2
- package/dist/runtime/query/context.d.ts.map +1 -1
- package/dist/runtime/query/context.js +0 -4
- package/dist/runtime/query/context.js.map +1 -1
- package/dist/runtime/query/index.d.ts +3 -3
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/advisory.test.d.ts +42 -0
- package/dist/runtime/query/iteration/phases/advisory.test.d.ts.map +1 -0
- package/dist/runtime/query/iteration/phases/advisory.test.js +334 -0
- package/dist/runtime/query/iteration/phases/advisory.test.js.map +1 -0
- package/dist/runtime/query/replay/__tests__/mutate.test.d.ts +2 -0
- package/dist/runtime/query/replay/__tests__/mutate.test.d.ts.map +1 -0
- package/dist/runtime/query/replay/__tests__/mutate.test.js +123 -0
- package/dist/runtime/query/replay/__tests__/mutate.test.js.map +1 -0
- package/dist/runtime/query/replay/__tests__/prepare.test.d.ts +2 -0
- package/dist/runtime/query/replay/__tests__/prepare.test.d.ts.map +1 -0
- package/dist/runtime/query/replay/__tests__/prepare.test.js +171 -0
- package/dist/runtime/query/replay/__tests__/prepare.test.js.map +1 -0
- package/dist/runtime/query/replay/list.d.ts +24 -0
- package/dist/runtime/query/replay/list.d.ts.map +1 -0
- package/dist/runtime/query/replay/list.js +21 -0
- package/dist/runtime/query/replay/list.js.map +1 -0
- package/dist/runtime/query/replay/mutate.d.ts +17 -0
- package/dist/runtime/query/replay/mutate.d.ts.map +1 -0
- package/dist/runtime/query/replay/mutate.js +62 -0
- package/dist/runtime/query/replay/mutate.js.map +1 -0
- package/dist/runtime/query/replay/prepare.d.ts +56 -0
- package/dist/runtime/query/replay/prepare.d.ts.map +1 -0
- package/dist/runtime/query/replay/prepare.js +65 -0
- package/dist/runtime/query/replay/prepare.js.map +1 -0
- package/dist/runtime/query/result.d.ts +2 -2
- package/dist/runtime/query/result.d.ts.map +1 -1
- package/dist/session/__tests__/integration/_fixtures.d.ts +4 -4
- package/dist/session/__tests__/integration/_fixtures.d.ts.map +1 -1
- package/dist/session/__tests__/integration/_fixtures.js.map +1 -1
- package/dist/session/__tests__/integration/archive-gate.test.js.map +1 -1
- package/dist/session/__tests__/integration/capacity-caps.test.js.map +1 -1
- package/dist/session/__tests__/integration/e2e-spawn.test.js.map +1 -1
- package/dist/session/__tests__/integration/handoff-broadcast-e2e.test.js.map +1 -1
- package/dist/session/__tests__/integration/handoff-single-e2e.test.js.map +1 -1
- package/dist/session/__tests__/integration/prev-artifact-dag.test.js.map +1 -1
- package/dist/session/__tests__/integration/retention-archive.test.js.map +1 -1
- package/dist/session/__tests__/integration/spawn-rollback.test.js.map +1 -1
- package/dist/session/__tests__/integration/summary-materialization-e2e.test.js +1 -1
- package/dist/session/__tests__/integration/summary-materialization-e2e.test.js.map +1 -1
- package/dist/session/errors.d.ts +1 -1
- package/dist/session/errors.d.ts.map +1 -1
- package/dist/session/events/index.d.ts +3 -3
- package/dist/session/events/index.d.ts.map +1 -1
- package/dist/session/events/index.js +3 -2
- package/dist/session/events/index.js.map +1 -1
- package/dist/session/handoff/__tests__/broadcast.test.js.map +1 -1
- package/dist/session/handoff/__tests__/capacity.test.js.map +1 -1
- package/dist/session/handoff/__tests__/single.test.js.map +1 -1
- package/dist/session/handoff/assignment.d.ts +1 -1
- package/dist/session/handoff/assignment.d.ts.map +1 -1
- package/dist/session/handoff/broadcast.d.ts.map +1 -1
- package/dist/session/handoff/broadcast.js.map +1 -1
- package/dist/session/handoff/single.d.ts.map +1 -1
- package/dist/session/handoff/single.js.map +1 -1
- package/dist/session/index.d.ts +0 -1
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +7 -6
- package/dist/session/index.js.map +1 -1
- package/dist/session/intervention/__tests__/prev-artifact.test.js.map +1 -1
- package/dist/session/intervention/prev-artifact.d.ts +1 -1
- package/dist/session/intervention/prev-artifact.d.ts.map +1 -1
- package/dist/session/retention/__tests__/archive.test.js.map +1 -1
- package/dist/session/retention/__tests__/disk-backend.test.js.map +1 -1
- package/dist/session/retention/archive.d.ts +1 -1
- package/dist/session/retention/archive.d.ts.map +1 -1
- package/dist/session/retention/backend.d.ts +4 -4
- package/dist/session/retention/backend.d.ts.map +1 -1
- package/dist/session/retention/disk-backend.d.ts +1 -1
- package/dist/session/retention/disk-backend.d.ts.map +1 -1
- package/dist/session/retention/index.d.ts +3 -3
- package/dist/session/retention/index.d.ts.map +1 -1
- package/dist/session/retention/index.js +4 -2
- package/dist/session/retention/index.js.map +1 -1
- package/dist/session/status/__tests__/derive.test.d.ts +2 -0
- package/dist/session/status/__tests__/derive.test.d.ts.map +1 -0
- package/dist/session/{hierarchy/__tests__/session.test.js → status/__tests__/derive.test.js} +2 -2
- package/dist/session/status/__tests__/derive.test.js.map +1 -0
- package/dist/session/status/derive.d.ts +33 -0
- package/dist/session/status/derive.d.ts.map +1 -0
- package/dist/session/{hierarchy/session.js → status/derive.js} +6 -1
- package/dist/session/status/derive.js.map +1 -0
- package/dist/session/summary/__tests__/materialize.test.js +2 -1
- package/dist/session/summary/__tests__/materialize.test.js.map +1 -1
- package/dist/session/summary/errors.d.ts +43 -0
- package/dist/session/summary/errors.d.ts.map +1 -0
- package/dist/session/summary/errors.js +37 -0
- package/dist/session/summary/errors.js.map +1 -0
- package/dist/session/summary/index.d.ts +4 -3
- package/dist/session/summary/index.d.ts.map +1 -1
- package/dist/session/summary/index.js +5 -4
- package/dist/session/summary/index.js.map +1 -1
- package/dist/session/summary/materialize.d.ts +2 -2
- package/dist/session/summary/materialize.d.ts.map +1 -1
- package/dist/session/summary/materialize.js +2 -1
- package/dist/session/summary/materialize.js.map +1 -1
- package/dist/session/workspace/__tests__/git-worktree.test.js.map +1 -1
- package/dist/session/workspace/driver.d.ts +2 -2
- package/dist/session/workspace/driver.d.ts.map +1 -1
- package/dist/session/workspace/git-worktree.d.ts +1 -1
- package/dist/session/workspace/git-worktree.d.ts.map +1 -1
- package/dist/session/workspace/git-worktree.js.map +1 -1
- package/dist/session/workspace/index.d.ts +1 -1
- package/dist/session/workspace/index.d.ts.map +1 -1
- package/dist/session/workspace/index.js +3 -2
- package/dist/session/workspace/index.js.map +1 -1
- package/dist/store/run/disk.d.ts +4 -4
- package/dist/store/run/disk.d.ts.map +1 -1
- package/dist/store/run/disk.js.map +1 -1
- package/dist/store/session/__tests__/disk.test.js.map +1 -1
- package/dist/store/session/__tests__/memory.test.js.map +1 -1
- package/dist/store/session/disk.d.ts +6 -6
- package/dist/store/session/disk.d.ts.map +1 -1
- package/dist/store/session/disk.js +1 -1
- package/dist/store/session/disk.js.map +1 -1
- package/dist/store/session/index.d.ts +1 -1
- package/dist/store/session/index.d.ts.map +1 -1
- package/dist/store/session/index.js +2 -1
- package/dist/store/session/index.js.map +1 -1
- package/dist/store/session/linkage.d.ts +1 -1
- package/dist/store/session/linkage.d.ts.map +1 -1
- package/dist/store/session/memory.d.ts +5 -5
- package/dist/store/session/memory.d.ts.map +1 -1
- package/dist/store/session/memory.js +1 -1
- package/dist/store/session/memory.js.map +1 -1
- package/dist/store/thread/disk.d.ts +1 -1
- package/dist/store/thread/disk.d.ts.map +1 -1
- package/dist/store/thread/memory.d.ts +1 -1
- package/dist/store/thread/memory.d.ts.map +1 -1
- package/dist/telemetry/attributes.d.ts +0 -1
- package/dist/telemetry/attributes.d.ts.map +1 -1
- package/dist/telemetry/attributes.js +0 -3
- package/dist/telemetry/attributes.js.map +1 -1
- package/dist/telemetry/runtime-accessors.d.ts +1 -2
- package/dist/telemetry/runtime-accessors.d.ts.map +1 -1
- package/dist/telemetry/runtime-accessors.js +1 -4
- package/dist/telemetry/runtime-accessors.js.map +1 -1
- package/dist/test-setup.d.ts +22 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/test-setup.js +23 -0
- package/dist/test-setup.js.map +1 -0
- package/dist/tools/builtins/bash.d.ts +1 -1
- package/dist/tools/builtins/computer-use.d.ts +4 -4
- package/dist/tools/builtins/edit.d.ts +1 -1
- package/dist/tools/builtins/glob.d.ts +1 -1
- package/dist/tools/builtins/grep.d.ts +1 -1
- package/dist/tools/builtins/ls.d.ts +1 -1
- package/dist/tools/builtins/read-file.d.ts +1 -1
- package/dist/tools/builtins/search-tools.d.ts +1 -1
- package/dist/tools/builtins/write-file.d.ts +1 -1
- package/dist/types/agent/task.d.ts +2 -2
- package/dist/types/agent/task.d.ts.map +1 -1
- package/dist/{session/hierarchy/project.d.ts → types/project/entity.d.ts} +4 -4
- package/dist/types/project/entity.d.ts.map +1 -0
- package/dist/types/project/entity.js +2 -0
- package/dist/types/project/entity.js.map +1 -0
- package/dist/types/project/index.d.ts +2 -0
- package/dist/types/project/index.d.ts.map +1 -0
- package/dist/types/project/index.js +4 -0
- package/dist/types/project/index.js.map +1 -0
- package/dist/types/retention/archive-backend-ref.d.ts.map +1 -0
- package/dist/types/retention/archive-backend-ref.js.map +1 -0
- package/dist/types/retention/index.d.ts +4 -0
- package/dist/types/retention/index.d.ts.map +1 -0
- package/dist/types/retention/index.js +4 -0
- package/dist/types/retention/index.js.map +1 -0
- package/dist/types/retention/policy.d.ts.map +1 -0
- package/dist/types/retention/policy.js.map +1 -0
- package/dist/types/run/entity.d.ts +56 -0
- package/dist/types/run/entity.d.ts.map +1 -0
- package/dist/types/run/entity.js +2 -0
- package/dist/types/run/entity.js.map +1 -0
- package/dist/types/run/events.d.ts +2 -2
- package/dist/types/run/events.d.ts.map +1 -1
- package/dist/types/run/index.d.ts +7 -1
- package/dist/types/run/index.d.ts.map +1 -1
- package/dist/types/run/index.js +8 -9
- package/dist/types/run/index.js.map +1 -1
- package/dist/{session/hierarchy → types/run}/lineage.d.ts +1 -1
- package/dist/types/run/lineage.d.ts.map +1 -0
- package/dist/types/run/lineage.js.map +1 -0
- package/dist/types/run/replay.d.ts +53 -0
- package/dist/types/run/replay.d.ts.map +1 -0
- package/dist/types/run/replay.js +15 -0
- package/dist/types/run/replay.js.map +1 -0
- package/dist/types/run/schema-version.d.ts.map +1 -0
- package/dist/types/run/schema-version.js.map +1 -0
- package/dist/{session/events/types.d.ts → types/run/subsession-events.d.ts} +5 -5
- package/dist/types/run/subsession-events.d.ts.map +1 -0
- package/dist/types/run/subsession-events.js +2 -0
- package/dist/types/run/subsession-events.js.map +1 -0
- package/dist/{session/hierarchy → types/session}/actor.d.ts +1 -1
- package/dist/types/session/actor.d.ts.map +1 -0
- package/dist/{session/hierarchy → types/session}/actor.js.map +1 -1
- package/dist/types/session/entity.d.ts +51 -0
- package/dist/types/session/entity.d.ts.map +1 -0
- package/dist/types/session/entity.js +2 -0
- package/dist/types/session/entity.js.map +1 -0
- package/dist/types/session/index.d.ts +4 -0
- package/dist/types/session/index.d.ts.map +1 -1
- package/dist/{store → types}/session/messages.d.ts +2 -2
- package/dist/{store → types}/session/messages.d.ts.map +1 -1
- package/dist/types/session/messages.js.map +1 -0
- package/dist/types/session/store.d.ts +6 -6
- package/dist/types/session/store.d.ts.map +1 -1
- package/dist/{session/hierarchy → types/session}/sub-session.d.ts +9 -9
- package/dist/types/session/sub-session.d.ts.map +1 -0
- package/dist/types/session/sub-session.js.map +1 -0
- package/dist/{session → types}/summary/deliverable.d.ts +2 -2
- package/dist/types/summary/deliverable.d.ts.map +1 -0
- package/dist/types/summary/deliverable.js.map +1 -0
- package/dist/types/summary/index.d.ts +4 -0
- package/dist/types/summary/index.d.ts.map +1 -0
- package/dist/types/summary/index.js +4 -0
- package/dist/types/summary/index.js.map +1 -0
- package/dist/{session → types}/summary/ref.d.ts +9 -36
- package/dist/types/summary/ref.d.ts.map +1 -0
- package/dist/types/summary/ref.js +28 -0
- package/dist/types/summary/ref.js.map +1 -0
- package/dist/{session/hierarchy/tenant.d.ts → types/tenant/entity.d.ts} +2 -2
- package/dist/types/tenant/entity.d.ts.map +1 -0
- package/dist/types/tenant/entity.js +2 -0
- package/dist/types/tenant/entity.js.map +1 -0
- package/dist/types/tenant/index.d.ts +2 -0
- package/dist/types/tenant/index.d.ts.map +1 -0
- package/dist/types/tenant/index.js +4 -0
- package/dist/types/tenant/index.js.map +1 -0
- package/dist/{session/hierarchy/thread.d.ts → types/thread/entity.d.ts} +31 -7
- package/dist/types/thread/entity.d.ts.map +1 -0
- package/dist/types/thread/entity.js +2 -0
- package/dist/types/thread/entity.js.map +1 -0
- package/dist/types/thread/index.d.ts +1 -0
- package/dist/types/thread/index.d.ts.map +1 -1
- package/dist/types/thread/store.d.ts +1 -1
- package/dist/types/thread/store.d.ts.map +1 -1
- package/dist/types/workspace/index.d.ts +2 -0
- package/dist/types/workspace/index.d.ts.map +1 -0
- package/dist/types/workspace/index.js +7 -0
- package/dist/types/workspace/index.js.map +1 -0
- package/dist/{session → types}/workspace/ref.d.ts +1 -1
- package/dist/types/workspace/ref.d.ts.map +1 -0
- package/dist/types/workspace/ref.js.map +1 -0
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +5 -0
- package/dist/utils/logger.js.map +1 -1
- package/package.json +4 -1
- package/src/__tests__/replay-public-surface.test.ts +54 -0
- package/src/advisory/context.test.ts +109 -0
- package/src/advisory/evaluator.test.ts +192 -0
- package/src/advisory/executor.test.ts +272 -0
- package/src/advisory/registry.test.ts +75 -0
- package/src/agents/SupervisorAgent.ts +1 -1
- package/src/bridge/a2a/agent-card.test.ts +140 -0
- package/src/bridge/a2a/mapper.test.ts +293 -0
- package/src/bridge/a2a/message.test.ts +138 -0
- package/src/bridge/a2a/task.test.ts +235 -0
- package/src/bridge/a2a/task.ts +4 -4
- package/src/bridge/mcp/connector/adapter.test.ts +230 -0
- package/src/bridge/sse/mapper.test.ts +422 -0
- package/src/bridge/tools/connector/adapter.test.ts +224 -0
- package/src/bridge/tools/connector/definitions.test.ts +183 -0
- package/src/bridge/tools/connector/router.test.ts +159 -0
- package/src/bus/breaker.test.ts +274 -0
- package/src/bus/index.test.ts +183 -0
- package/src/bus/lock.test.ts +265 -0
- package/src/bus/ownership.test.ts +243 -0
- package/src/config/runtime.ts +0 -2
- package/src/connector/BaseConnector.test.ts +130 -0
- package/src/connector/builtins/http.test.ts +290 -0
- package/src/connector/builtins/webhook.test.ts +138 -0
- package/src/connector/execution/factory.test.ts +75 -0
- package/src/connector/execution/remote.test.ts +63 -0
- package/src/connector/mcp/adapter.test.ts +249 -0
- package/src/contracts/api.ts +2 -2
- package/src/contracts/index.ts +1 -3
- package/src/index.ts +11 -362
- package/src/manager/agent/__tests__/lifecycle.test.ts +2 -2
- package/src/manager/agent/lifecycle.ts +5 -5
- package/src/manager/run/persistence.ts +4 -4
- package/src/manager/thread/__tests__/lifecycle.test.ts +1 -1
- package/src/manager/thread/lifecycle.ts +2 -2
- package/src/plugin/loader.ts +0 -16
- package/src/public-runtime.ts +373 -0
- package/src/public-tools.ts +63 -0
- package/src/public-types.ts +156 -0
- package/src/rag/chunking.test.ts +107 -0
- package/src/rag/context-assembler.test.ts +114 -0
- package/src/rag/embedding.test.ts +130 -0
- package/src/rag/ingestion.test.ts +114 -0
- package/src/rag/knowledge-base.test.ts +106 -0
- package/src/rag/rag-tool.test.ts +167 -0
- package/src/rag/retriever.test.ts +210 -0
- package/src/rag/vector-store.test.ts +196 -0
- package/src/registry/ManagedRegistry.test.ts +118 -0
- package/src/registry/Registry.test.ts +91 -0
- package/src/registry/agent/definitions.test.ts +100 -0
- package/src/registry/connector/definitions.test.ts +51 -0
- package/src/registry/connector/scoped.test.ts +129 -0
- package/src/registry/plugin/index.test.ts +85 -0
- package/src/registry/tool/execute.test.ts +330 -0
- package/src/run/LimitChecker.ts +0 -9
- package/src/run/reporter.ts +3 -3
- package/src/runtime/query/__tests__/checkpoint.test.ts +169 -0
- package/src/runtime/query/checkpoint.ts +54 -0
- package/src/runtime/query/context.ts +0 -5
- package/src/runtime/query/index.ts +4 -4
- package/src/runtime/query/iteration/phases/advisory.test.ts +412 -0
- package/src/runtime/query/replay/__tests__/mutate.test.ts +134 -0
- package/src/runtime/query/replay/__tests__/prepare.test.ts +207 -0
- package/src/runtime/query/replay/list.ts +32 -0
- package/src/runtime/query/replay/mutate.ts +76 -0
- package/src/runtime/query/replay/prepare.ts +114 -0
- package/src/runtime/query/result.ts +2 -2
- package/src/session/__tests__/integration/_fixtures.ts +2 -2
- package/src/session/__tests__/integration/archive-gate.test.ts +1 -1
- package/src/session/__tests__/integration/capacity-caps.test.ts +1 -1
- package/src/session/__tests__/integration/e2e-spawn.test.ts +1 -1
- package/src/session/__tests__/integration/handoff-broadcast-e2e.test.ts +1 -1
- package/src/session/__tests__/integration/handoff-single-e2e.test.ts +1 -1
- package/src/session/__tests__/integration/prev-artifact-dag.test.ts +4 -1
- package/src/session/__tests__/integration/retention-archive.test.ts +1 -1
- package/src/session/__tests__/integration/spawn-rollback.test.ts +2 -2
- package/src/session/__tests__/integration/summary-materialization-e2e.test.ts +1 -1
- package/src/session/errors.ts +1 -1
- package/src/session/events/index.ts +5 -4
- package/src/session/handoff/__tests__/broadcast.test.ts +1 -1
- package/src/session/handoff/__tests__/capacity.test.ts +1 -1
- package/src/session/handoff/__tests__/single.test.ts +1 -1
- package/src/session/handoff/assignment.ts +1 -1
- package/src/session/handoff/broadcast.ts +2 -2
- package/src/session/handoff/single.ts +2 -2
- package/src/session/index.ts +7 -6
- package/src/session/intervention/__tests__/prev-artifact.test.ts +4 -1
- package/src/session/intervention/prev-artifact.ts +1 -1
- package/src/session/retention/__tests__/archive.test.ts +3 -3
- package/src/session/retention/__tests__/disk-backend.test.ts +4 -4
- package/src/session/retention/archive.ts +2 -2
- package/src/session/retention/backend.ts +4 -4
- package/src/session/retention/disk-backend.ts +4 -4
- package/src/session/retention/index.ts +6 -4
- package/src/session/{hierarchy/__tests__/session.test.ts → status/__tests__/derive.test.ts} +3 -2
- package/src/session/{hierarchy/session.ts → status/derive.ts} +9 -55
- package/src/session/summary/__tests__/materialize.test.ts +4 -7
- package/src/session/summary/errors.ts +51 -0
- package/src/session/summary/index.ts +7 -10
- package/src/session/summary/materialize.ts +4 -5
- package/src/session/workspace/__tests__/git-worktree.test.ts +1 -1
- package/src/session/workspace/driver.ts +2 -2
- package/src/session/workspace/git-worktree.ts +1 -1
- package/src/session/workspace/index.ts +7 -6
- package/src/store/run/disk.ts +4 -4
- package/src/store/session/__tests__/disk.test.ts +2 -2
- package/src/store/session/__tests__/memory.test.ts +2 -2
- package/src/store/session/disk.ts +12 -12
- package/src/store/session/index.ts +3 -2
- package/src/store/session/linkage.ts +1 -1
- package/src/store/session/memory.ts +6 -6
- package/src/store/thread/disk.ts +1 -1
- package/src/store/thread/memory.ts +1 -1
- package/src/telemetry/attributes.ts +0 -4
- package/src/telemetry/runtime-accessors.ts +1 -5
- package/src/test-setup.ts +24 -0
- package/src/types/agent/task.ts +2 -2
- package/src/{session/hierarchy/project.ts → types/project/entity.ts} +3 -3
- package/src/types/project/index.ts +4 -0
- package/src/types/retention/index.ts +6 -0
- package/src/types/run/entity.ts +63 -0
- package/src/types/run/events.ts +6 -6
- package/src/types/run/index.ts +16 -9
- package/src/{session/hierarchy → types/run}/lineage.ts +1 -1
- package/src/types/run/replay.ts +61 -0
- package/src/{session/events/types.ts → types/run/subsession-events.ts} +4 -4
- package/src/{session/hierarchy → types/session}/actor.ts +1 -1
- package/src/types/session/entity.ts +59 -0
- package/src/types/session/index.ts +15 -0
- package/src/{store → types}/session/messages.ts +2 -2
- package/src/types/session/store.ts +6 -6
- package/src/{session/hierarchy → types/session}/sub-session.ts +9 -9
- package/src/{session → types}/summary/deliverable.ts +2 -2
- package/src/types/summary/index.ts +18 -0
- package/src/{session → types}/summary/ref.ts +9 -44
- package/src/{session/hierarchy/tenant.ts → types/tenant/entity.ts} +1 -1
- package/src/types/tenant/index.ts +4 -0
- package/src/{session/hierarchy/thread.ts → types/thread/entity.ts} +30 -6
- package/src/types/thread/index.ts +1 -0
- package/src/types/thread/store.ts +1 -1
- package/src/types/workspace/index.ts +12 -0
- package/src/{session → types}/workspace/ref.ts +1 -1
- package/src/utils/logger.ts +6 -1
- package/dist/contracts/ids.d.ts +0 -2
- package/dist/contracts/ids.d.ts.map +0 -1
- package/dist/contracts/ids.js +0 -2
- package/dist/contracts/ids.js.map +0 -1
- package/dist/session/events/schema-version.d.ts.map +0 -1
- package/dist/session/events/schema-version.js.map +0 -1
- package/dist/session/events/types.d.ts.map +0 -1
- package/dist/session/events/types.js +0 -2
- package/dist/session/events/types.js.map +0 -1
- package/dist/session/hierarchy/__tests__/session.test.d.ts +0 -2
- package/dist/session/hierarchy/__tests__/session.test.d.ts.map +0 -1
- package/dist/session/hierarchy/__tests__/session.test.js.map +0 -1
- package/dist/session/hierarchy/actor.d.ts.map +0 -1
- package/dist/session/hierarchy/index.d.ts +0 -9
- package/dist/session/hierarchy/index.d.ts.map +0 -1
- package/dist/session/hierarchy/index.js +0 -4
- package/dist/session/hierarchy/index.js.map +0 -1
- package/dist/session/hierarchy/lineage.d.ts.map +0 -1
- package/dist/session/hierarchy/lineage.js.map +0 -1
- package/dist/session/hierarchy/project.d.ts.map +0 -1
- package/dist/session/hierarchy/project.js +0 -2
- package/dist/session/hierarchy/project.js.map +0 -1
- package/dist/session/hierarchy/session.d.ts +0 -71
- package/dist/session/hierarchy/session.d.ts.map +0 -1
- package/dist/session/hierarchy/session.js.map +0 -1
- package/dist/session/hierarchy/sub-session.d.ts.map +0 -1
- package/dist/session/hierarchy/sub-session.js.map +0 -1
- package/dist/session/hierarchy/tenant.d.ts.map +0 -1
- package/dist/session/hierarchy/tenant.js +0 -2
- package/dist/session/hierarchy/tenant.js.map +0 -1
- package/dist/session/hierarchy/thread.d.ts.map +0 -1
- package/dist/session/hierarchy/thread.js +0 -2
- package/dist/session/hierarchy/thread.js.map +0 -1
- package/dist/session/retention/archive-backend-ref.d.ts.map +0 -1
- package/dist/session/retention/archive-backend-ref.js.map +0 -1
- package/dist/session/retention/policy.d.ts.map +0 -1
- package/dist/session/retention/policy.js.map +0 -1
- package/dist/session/summary/deliverable.d.ts.map +0 -1
- package/dist/session/summary/deliverable.js.map +0 -1
- package/dist/session/summary/ref.d.ts.map +0 -1
- package/dist/session/summary/ref.js +0 -51
- package/dist/session/summary/ref.js.map +0 -1
- package/dist/session/workspace/ref.d.ts.map +0 -1
- package/dist/session/workspace/ref.js.map +0 -1
- package/dist/store/session/messages.js.map +0 -1
- package/dist/tools/builtins/__tests__/structuredOutput.example.d.ts +0 -140
- package/dist/tools/builtins/__tests__/structuredOutput.example.d.ts.map +0 -1
- package/dist/tools/builtins/__tests__/structuredOutput.example.js +0 -183
- package/dist/tools/builtins/__tests__/structuredOutput.example.js.map +0 -1
- package/dist/types/run/state.d.ts +0 -30
- package/dist/types/run/state.d.ts.map +0 -1
- package/dist/types/run/state.js +0 -2
- package/dist/types/run/state.js.map +0 -1
- package/src/contracts/ids.ts +0 -1
- package/src/session/hierarchy/index.ts +0 -18
- package/src/tools/builtins/__tests__/structuredOutput.example.ts +0 -221
- package/src/types/run/state.ts +0 -35
- /package/dist/{session → types}/retention/archive-backend-ref.d.ts +0 -0
- /package/dist/{session → types}/retention/archive-backend-ref.js +0 -0
- /package/dist/{session → types}/retention/policy.d.ts +0 -0
- /package/dist/{session → types}/retention/policy.js +0 -0
- /package/dist/{session/hierarchy → types/run}/lineage.js +0 -0
- /package/dist/{session/events → types/run}/schema-version.d.ts +0 -0
- /package/dist/{session/events → types/run}/schema-version.js +0 -0
- /package/dist/{session/hierarchy → types/session}/actor.js +0 -0
- /package/dist/{store → types}/session/messages.js +0 -0
- /package/dist/{session/hierarchy → types/session}/sub-session.js +0 -0
- /package/dist/{session → types}/summary/deliverable.js +0 -0
- /package/dist/{session → types}/workspace/ref.js +0 -0
- /package/src/{session → types}/retention/archive-backend-ref.ts +0 -0
- /package/src/{session → types}/retention/policy.ts +0 -0
- /package/src/{session/events → types/run}/schema-version.ts +0 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { mkdir, mkdtemp, writeFile } from 'node:fs/promises'
|
|
2
|
+
import { tmpdir } from 'node:os'
|
|
3
|
+
import { join } from 'node:path'
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
5
|
+
import type { CheckpointId, IterationCheckpoint } from '../../../../types/hitl/index.js'
|
|
6
|
+
import type { EmergencySaveId, RunId, ToolCallId } from '../../../../types/ids/index.js'
|
|
7
|
+
import type { AssistantMessage, ToolMessage } from '../../../../types/message/index.js'
|
|
8
|
+
import type { EmergencySaveData } from '../../../../types/run/emergency.js'
|
|
9
|
+
import type { Mutation } from '../../../../types/run/replay.js'
|
|
10
|
+
import { prepareReplayState } from '../prepare.js'
|
|
11
|
+
|
|
12
|
+
const RUN_ID = 'run_source' as RunId
|
|
13
|
+
|
|
14
|
+
function makeCheckpoint(overrides: Partial<IterationCheckpoint>): IterationCheckpoint {
|
|
15
|
+
return {
|
|
16
|
+
id: 'cp_default' as CheckpointId,
|
|
17
|
+
runId: RUN_ID,
|
|
18
|
+
iteration: 1,
|
|
19
|
+
messages: [{ role: 'user', content: 'hi' }],
|
|
20
|
+
tokenUsage: {
|
|
21
|
+
promptTokens: 0,
|
|
22
|
+
completionTokens: 0,
|
|
23
|
+
totalTokens: 0,
|
|
24
|
+
cachedTokens: 0,
|
|
25
|
+
cacheWriteTokens: 0,
|
|
26
|
+
},
|
|
27
|
+
costInfo: { inputCostPer1M: 0, outputCostPer1M: 0, totalCost: 0, cacheDiscount: 0 },
|
|
28
|
+
guardState: { iterationCount: 1, elapsedMs: 0 },
|
|
29
|
+
createdAt: Date.now(),
|
|
30
|
+
...overrides,
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function seedCheckpoint(baseDir: string, cp: IterationCheckpoint): Promise<void> {
|
|
35
|
+
const cpDir = join(baseDir, cp.runId, 'checkpoints')
|
|
36
|
+
await mkdir(cpDir, { recursive: true })
|
|
37
|
+
await writeFile(join(cpDir, `${cp.id}.json`), JSON.stringify(cp), 'utf-8')
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function seedEmergency(emergencyDir: string, dump: EmergencySaveData): Promise<void> {
|
|
41
|
+
await mkdir(emergencyDir, { recursive: true })
|
|
42
|
+
await writeFile(join(emergencyDir, `${dump.runId}.json`), JSON.stringify(dump), 'utf-8')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
describe('prepareReplayState', () => {
|
|
46
|
+
let baseDir: string
|
|
47
|
+
let emergencyDir: string
|
|
48
|
+
|
|
49
|
+
beforeEach(async () => {
|
|
50
|
+
const wrapper = await mkdtemp(join(tmpdir(), 'namzu-prepare-replay-'))
|
|
51
|
+
baseDir = join(wrapper, 'runs')
|
|
52
|
+
emergencyDir = join(wrapper, 'emergency')
|
|
53
|
+
await mkdir(baseDir, { recursive: true })
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
afterEach(async () => {
|
|
57
|
+
// Per-test tmpdir isolation; vitest cleans tmpdir between runs.
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it('resolves a specific CheckpointId and returns the checkpoint messages', async () => {
|
|
61
|
+
const cp = makeCheckpoint({
|
|
62
|
+
id: 'cp_one' as CheckpointId,
|
|
63
|
+
iteration: 3,
|
|
64
|
+
messages: [
|
|
65
|
+
{ role: 'user', content: 'start' },
|
|
66
|
+
{ role: 'assistant', content: 'ok' },
|
|
67
|
+
],
|
|
68
|
+
})
|
|
69
|
+
await seedCheckpoint(baseDir, cp)
|
|
70
|
+
|
|
71
|
+
const prepared = await prepareReplayState({
|
|
72
|
+
baseDir,
|
|
73
|
+
runId: RUN_ID,
|
|
74
|
+
fromCheckpoint: 'cp_one' as CheckpointId,
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
expect(prepared.sourceCheckpoint.id).toBe('cp_one')
|
|
78
|
+
expect(prepared.messages).toEqual(cp.messages)
|
|
79
|
+
expect(prepared.attribution.sourceRunId).toBe(RUN_ID)
|
|
80
|
+
expect(prepared.attribution.fromCheckpointId).toBe('cp_one')
|
|
81
|
+
expect(prepared.attribution.mutations).toEqual([])
|
|
82
|
+
expect(prepared.attribution.replayedAt).toBeGreaterThan(0)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it("resolves 'latest' to the checkpoint with the highest iteration", async () => {
|
|
86
|
+
await seedCheckpoint(baseDir, makeCheckpoint({ id: 'cp_a' as CheckpointId, iteration: 1 }))
|
|
87
|
+
await seedCheckpoint(baseDir, makeCheckpoint({ id: 'cp_b' as CheckpointId, iteration: 5 }))
|
|
88
|
+
await seedCheckpoint(baseDir, makeCheckpoint({ id: 'cp_c' as CheckpointId, iteration: 3 }))
|
|
89
|
+
|
|
90
|
+
const prepared = await prepareReplayState({
|
|
91
|
+
baseDir,
|
|
92
|
+
runId: RUN_ID,
|
|
93
|
+
fromCheckpoint: 'latest',
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
expect(prepared.sourceCheckpoint.id).toBe('cp_b')
|
|
97
|
+
expect(prepared.sourceCheckpoint.iteration).toBe(5)
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it("throws when 'latest' is requested but no checkpoints exist", async () => {
|
|
101
|
+
await expect(
|
|
102
|
+
prepareReplayState({
|
|
103
|
+
baseDir,
|
|
104
|
+
runId: RUN_ID,
|
|
105
|
+
fromCheckpoint: 'latest',
|
|
106
|
+
}),
|
|
107
|
+
).rejects.toThrow(/No checkpoints found/)
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
it('throws when a specific CheckpointId does not resolve', async () => {
|
|
111
|
+
await expect(
|
|
112
|
+
prepareReplayState({
|
|
113
|
+
baseDir,
|
|
114
|
+
runId: RUN_ID,
|
|
115
|
+
fromCheckpoint: 'cp_missing' as CheckpointId,
|
|
116
|
+
}),
|
|
117
|
+
).rejects.toThrow(/not found/)
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
it('applies injectToolResponse mutations at the fork point', async () => {
|
|
121
|
+
const assistantMsg: AssistantMessage = {
|
|
122
|
+
role: 'assistant',
|
|
123
|
+
content: null,
|
|
124
|
+
toolCalls: [{ id: 'call_a', type: 'function', function: { name: 'noop', arguments: '{}' } }],
|
|
125
|
+
}
|
|
126
|
+
const cp = makeCheckpoint({
|
|
127
|
+
id: 'cp_with_tool' as CheckpointId,
|
|
128
|
+
messages: [{ role: 'user', content: 'run tool' }, assistantMsg],
|
|
129
|
+
})
|
|
130
|
+
await seedCheckpoint(baseDir, cp)
|
|
131
|
+
|
|
132
|
+
const mutations: Mutation[] = [
|
|
133
|
+
{
|
|
134
|
+
type: 'injectToolResponse',
|
|
135
|
+
toolCallId: 'call_a' as ToolCallId,
|
|
136
|
+
response: { success: true, output: 'mocked-a' },
|
|
137
|
+
},
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
const prepared = await prepareReplayState({
|
|
141
|
+
baseDir,
|
|
142
|
+
runId: RUN_ID,
|
|
143
|
+
fromCheckpoint: 'cp_with_tool' as CheckpointId,
|
|
144
|
+
mutate: mutations,
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
expect(prepared.messages).toHaveLength(3)
|
|
148
|
+
const appended = prepared.messages[2] as ToolMessage
|
|
149
|
+
expect(appended.role).toBe('tool')
|
|
150
|
+
expect(appended.toolCallId).toBe('call_a')
|
|
151
|
+
expect(appended.content).toBe('mocked-a')
|
|
152
|
+
expect(prepared.attribution.mutations).toEqual(mutations)
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
it("resolves 'emergency' via the emergency dump and projects it to a checkpoint", async () => {
|
|
156
|
+
const dump: EmergencySaveData = {
|
|
157
|
+
id: 'esave_xyz' as EmergencySaveId,
|
|
158
|
+
runId: RUN_ID,
|
|
159
|
+
messages: [{ role: 'user', content: 'before crash' }],
|
|
160
|
+
tokenUsage: {
|
|
161
|
+
promptTokens: 4,
|
|
162
|
+
completionTokens: 2,
|
|
163
|
+
totalTokens: 6,
|
|
164
|
+
cachedTokens: 0,
|
|
165
|
+
cacheWriteTokens: 0,
|
|
166
|
+
},
|
|
167
|
+
currentIteration: 9,
|
|
168
|
+
startedAt: 1_000,
|
|
169
|
+
savedAt: 2_000,
|
|
170
|
+
processSignal: 'SIGTERM',
|
|
171
|
+
}
|
|
172
|
+
await seedEmergency(emergencyDir, dump)
|
|
173
|
+
|
|
174
|
+
const prepared = await prepareReplayState({
|
|
175
|
+
baseDir,
|
|
176
|
+
runId: RUN_ID,
|
|
177
|
+
fromCheckpoint: 'emergency',
|
|
178
|
+
emergencyDir,
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
expect(prepared.sourceCheckpoint.id).toBe('cp_emergency_xyz')
|
|
182
|
+
expect(prepared.sourceCheckpoint.iteration).toBe(9)
|
|
183
|
+
expect(prepared.messages).toEqual(dump.messages)
|
|
184
|
+
expect(prepared.attribution.fromCheckpointId).toBe('cp_emergency_xyz')
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
it("throws when 'emergency' is requested without emergencyDir", async () => {
|
|
188
|
+
await expect(
|
|
189
|
+
prepareReplayState({
|
|
190
|
+
baseDir,
|
|
191
|
+
runId: RUN_ID,
|
|
192
|
+
fromCheckpoint: 'emergency',
|
|
193
|
+
}),
|
|
194
|
+
).rejects.toThrow(/emergencyDir/)
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
it("throws when 'emergency' dump file is missing", async () => {
|
|
198
|
+
await expect(
|
|
199
|
+
prepareReplayState({
|
|
200
|
+
baseDir,
|
|
201
|
+
runId: RUN_ID,
|
|
202
|
+
fromCheckpoint: 'emergency',
|
|
203
|
+
emergencyDir,
|
|
204
|
+
}),
|
|
205
|
+
).rejects.toThrow(/No emergency dump/)
|
|
206
|
+
})
|
|
207
|
+
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { RunDiskStore } from '../../../store/run/disk.js'
|
|
2
|
+
import type { RunId } from '../../../types/ids/index.js'
|
|
3
|
+
import type { CheckpointListEntry } from '../../../types/run/replay.js'
|
|
4
|
+
import type { Logger } from '../../../utils/logger.js'
|
|
5
|
+
import { CheckpointManager } from '../checkpoint.js'
|
|
6
|
+
|
|
7
|
+
export interface ListCheckpointsInput {
|
|
8
|
+
/** Directory that contains `<runId>/` for the target run. */
|
|
9
|
+
baseDir: string
|
|
10
|
+
/** Run whose checkpoints should be listed. */
|
|
11
|
+
runId: RunId
|
|
12
|
+
logger?: Logger
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Read-only listing of a run's checkpoints for use with {@link
|
|
17
|
+
* import('./prepare.js').prepareReplayState}. Returns the public
|
|
18
|
+
* {@link CheckpointListEntry} projection — just enough for a caller to
|
|
19
|
+
* pick a fork point — not the full `IterationCheckpoint` payload.
|
|
20
|
+
*
|
|
21
|
+
* Entries are returned in the order the underlying store returns them
|
|
22
|
+
* (disk store sorts by `createdAt` ascending). Callers that want a
|
|
23
|
+
* specific order should sort client-side.
|
|
24
|
+
*
|
|
25
|
+
* See ses_005-deterministic-replay/design.md §3.1.
|
|
26
|
+
*/
|
|
27
|
+
export async function listCheckpoints(input: ListCheckpointsInput): Promise<CheckpointListEntry[]> {
|
|
28
|
+
const store = new RunDiskStore({ baseDir: input.baseDir, logger: input.logger })
|
|
29
|
+
await store.initRun(input.runId)
|
|
30
|
+
const mgr = new CheckpointManager(store)
|
|
31
|
+
return mgr.listEntries()
|
|
32
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { ToolCallId } from '../../../types/ids/index.js'
|
|
2
|
+
import {
|
|
3
|
+
type AssistantMessage,
|
|
4
|
+
type Message,
|
|
5
|
+
type ToolCall,
|
|
6
|
+
createToolMessage,
|
|
7
|
+
} from '../../../types/message/index.js'
|
|
8
|
+
import { type Mutation, MutationNotApplicableError } from '../../../types/run/replay.js'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns the tool calls on the most recent assistant message that do not
|
|
12
|
+
* yet have a matching {@link import('../../../types/message/index.js').ToolMessage}
|
|
13
|
+
* response further down the message list. These are the fork-point "pending"
|
|
14
|
+
* tool calls that mutations may target.
|
|
15
|
+
*/
|
|
16
|
+
function findPendingToolCalls(messages: readonly Message[]): ToolCall[] {
|
|
17
|
+
let lastAssistantIdx = -1
|
|
18
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
19
|
+
const msg = messages[i]
|
|
20
|
+
if (msg && msg.role === 'assistant' && (msg.toolCalls?.length ?? 0) > 0) {
|
|
21
|
+
lastAssistantIdx = i
|
|
22
|
+
break
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (lastAssistantIdx === -1) return []
|
|
26
|
+
|
|
27
|
+
const assistant = messages[lastAssistantIdx] as AssistantMessage
|
|
28
|
+
const satisfied = new Set<string>()
|
|
29
|
+
for (let i = lastAssistantIdx + 1; i < messages.length; i++) {
|
|
30
|
+
const msg = messages[i]
|
|
31
|
+
if (msg && msg.role === 'tool') {
|
|
32
|
+
satisfied.add(msg.toolCallId)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return (assistant.toolCalls ?? []).filter((tc) => !satisfied.has(tc.id))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Apply an ordered list of {@link Mutation} to a checkpoint's message
|
|
40
|
+
* history at the fork point, producing a new message array that the
|
|
41
|
+
* resumed iteration loop consumes. Pure function; does not touch the run
|
|
42
|
+
* store, does not emit events.
|
|
43
|
+
*
|
|
44
|
+
* Throws {@link MutationNotApplicableError} when an `injectToolResponse`
|
|
45
|
+
* mutation targets a tool call id that is not pending at the fork point —
|
|
46
|
+
* the error payload carries the list of ids that *are* pending so the
|
|
47
|
+
* caller can recover without guessing.
|
|
48
|
+
*
|
|
49
|
+
* See ses_005-deterministic-replay design §3.3.
|
|
50
|
+
*/
|
|
51
|
+
export function applyMutations(
|
|
52
|
+
messages: readonly Message[],
|
|
53
|
+
mutations: readonly Mutation[],
|
|
54
|
+
): Message[] {
|
|
55
|
+
let current: Message[] = [...messages]
|
|
56
|
+
for (const m of mutations) {
|
|
57
|
+
current = applyOne(current, m)
|
|
58
|
+
}
|
|
59
|
+
return current
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function applyOne(messages: Message[], mutation: Mutation): Message[] {
|
|
63
|
+
switch (mutation.type) {
|
|
64
|
+
case 'injectToolResponse': {
|
|
65
|
+
const pending = findPendingToolCalls(messages)
|
|
66
|
+
const match = pending.find((tc) => tc.id === mutation.toolCallId)
|
|
67
|
+
if (!match) {
|
|
68
|
+
throw new MutationNotApplicableError(
|
|
69
|
+
`No pending tool call ${mutation.toolCallId} at fork point`,
|
|
70
|
+
pending.map((tc) => tc.id as ToolCallId),
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
return [...messages, createToolMessage(mutation.response.output, mutation.toolCallId)]
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { join } from 'node:path'
|
|
2
|
+
import { EmergencySaveManager } from '../../../manager/run/emergency.js'
|
|
3
|
+
import { RunDiskStore } from '../../../store/run/disk.js'
|
|
4
|
+
import type { CheckpointId, IterationCheckpoint } from '../../../types/hitl/index.js'
|
|
5
|
+
import type { RunId } from '../../../types/ids/index.js'
|
|
6
|
+
import type { Message } from '../../../types/message/index.js'
|
|
7
|
+
import type { Mutation, ReplayAttribution } from '../../../types/run/replay.js'
|
|
8
|
+
import type { Logger } from '../../../utils/logger.js'
|
|
9
|
+
import { projectEmergencyToCheckpoint } from '../checkpoint.js'
|
|
10
|
+
import { applyMutations } from './mutate.js'
|
|
11
|
+
|
|
12
|
+
export type CheckpointSelector = CheckpointId | 'latest' | 'emergency'
|
|
13
|
+
|
|
14
|
+
export interface PrepareReplayInput {
|
|
15
|
+
/** Directory that contains `<runId>/` for the source run. */
|
|
16
|
+
baseDir: string
|
|
17
|
+
/** Source run to fork from. */
|
|
18
|
+
runId: RunId
|
|
19
|
+
/** Which checkpoint to fork at. */
|
|
20
|
+
fromCheckpoint: CheckpointSelector
|
|
21
|
+
/** Optional mutations applied at the fork point before the caller hands state to `query()`. */
|
|
22
|
+
mutate?: Mutation[]
|
|
23
|
+
/**
|
|
24
|
+
* Directory that holds emergency dumps. Required only when `fromCheckpoint`
|
|
25
|
+
* is `'emergency'`; conventionally sibling of `baseDir` (the `.namzu/emergency`
|
|
26
|
+
* folder), but left explicit so callers with non-default layouts can redirect.
|
|
27
|
+
*/
|
|
28
|
+
emergencyDir?: string
|
|
29
|
+
logger?: Logger
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface PreparedReplayState {
|
|
33
|
+
/**
|
|
34
|
+
* Message history at the fork point, with mutations applied. Seed this
|
|
35
|
+
* as the new run's initial messages and pass `sourceCheckpoint.id` as
|
|
36
|
+
* `resumeFromCheckpoint` when you call `query()`.
|
|
37
|
+
*/
|
|
38
|
+
messages: Message[]
|
|
39
|
+
/** The checkpoint the replay forks from (already projected if emergency). */
|
|
40
|
+
sourceCheckpoint: IterationCheckpoint
|
|
41
|
+
/**
|
|
42
|
+
* Attribution to stamp on the replay run once it is created. The caller
|
|
43
|
+
* sets `Run.replayOf = buildAttribution(prepared, replayedAt)` on the
|
|
44
|
+
* new `RunPersistence` before persisting the first time.
|
|
45
|
+
*/
|
|
46
|
+
attribution: ReplayAttribution
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Produce the state materials needed to execute a replay run — the mutated
|
|
51
|
+
* message history, the resolved source checkpoint, and the replay
|
|
52
|
+
* attribution record. Pure read; does not touch the run store beyond
|
|
53
|
+
* reading the source run's checkpoint files.
|
|
54
|
+
*
|
|
55
|
+
* This is the state-preparation half of the replay primitive. The
|
|
56
|
+
* caller is expected to thread the returned `messages` +
|
|
57
|
+
* `sourceCheckpoint.id` into `query({ resumeFromCheckpoint, messages,
|
|
58
|
+
* ... })` and stamp `Run.replayOf = prepared.attribution` on the resulting
|
|
59
|
+
* run. The end-to-end `replay()` entry that does all of this in one call
|
|
60
|
+
* is a follow-up session (`ReplayEnvironment` shape).
|
|
61
|
+
*
|
|
62
|
+
* See `ses_005-deterministic-replay/design.md` §3.1.
|
|
63
|
+
*/
|
|
64
|
+
export async function prepareReplayState(input: PrepareReplayInput): Promise<PreparedReplayState> {
|
|
65
|
+
const sourceCheckpoint = await resolveCheckpoint(input)
|
|
66
|
+
const mutations = input.mutate ?? []
|
|
67
|
+
const messages = applyMutations(sourceCheckpoint.messages, mutations)
|
|
68
|
+
|
|
69
|
+
const attribution: ReplayAttribution = {
|
|
70
|
+
sourceRunId: input.runId,
|
|
71
|
+
fromCheckpointId: sourceCheckpoint.id,
|
|
72
|
+
mutations,
|
|
73
|
+
replayedAt: Date.now(),
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return { messages, sourceCheckpoint, attribution }
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async function resolveCheckpoint(input: PrepareReplayInput): Promise<IterationCheckpoint> {
|
|
80
|
+
if (input.fromCheckpoint === 'emergency') {
|
|
81
|
+
return resolveEmergency(input)
|
|
82
|
+
}
|
|
83
|
+
const store = new RunDiskStore({ baseDir: input.baseDir, logger: input.logger })
|
|
84
|
+
await store.initRun(input.runId)
|
|
85
|
+
|
|
86
|
+
if (input.fromCheckpoint === 'latest') {
|
|
87
|
+
const all = await store.listCheckpoints()
|
|
88
|
+
if (all.length === 0) {
|
|
89
|
+
throw new Error(`No checkpoints found for run ${input.runId} in ${input.baseDir}`)
|
|
90
|
+
}
|
|
91
|
+
return [...all].sort((a, b) => b.iteration - a.iteration)[0] as IterationCheckpoint
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const checkpoint = await store.readCheckpoint(input.fromCheckpoint)
|
|
95
|
+
if (!checkpoint) {
|
|
96
|
+
throw new Error(`Checkpoint ${input.fromCheckpoint} not found for run ${input.runId}`)
|
|
97
|
+
}
|
|
98
|
+
return checkpoint
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async function resolveEmergency(input: PrepareReplayInput): Promise<IterationCheckpoint> {
|
|
102
|
+
if (!input.emergencyDir) {
|
|
103
|
+
throw new Error(
|
|
104
|
+
"fromCheckpoint: 'emergency' requires an `emergencyDir` — conventionally sibling of baseDir",
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
const path = join(input.emergencyDir, `${input.runId}.json`)
|
|
108
|
+
try {
|
|
109
|
+
const dump = EmergencySaveManager.loadSave(path)
|
|
110
|
+
return projectEmergencyToCheckpoint(dump)
|
|
111
|
+
} catch (err) {
|
|
112
|
+
throw new Error(`No emergency dump found for run ${input.runId} at ${path}`, { cause: err })
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -3,7 +3,7 @@ import type { PlanManager } from '../../manager/plan/lifecycle.js'
|
|
|
3
3
|
import type { RunPersistence } from '../../manager/run/persistence.js'
|
|
4
4
|
import type { ActivityStore } from '../../store/activity/memory.js'
|
|
5
5
|
import { GENAI, NAMZU } from '../../telemetry/attributes.js'
|
|
6
|
-
import type {
|
|
6
|
+
import type { Run, RunEvent } from '../../types/run/index.js'
|
|
7
7
|
import { toErrorMessage } from '../../utils/error.js'
|
|
8
8
|
import type { Logger } from '../../utils/logger.js'
|
|
9
9
|
import type { EmitEvent } from './events.js'
|
|
@@ -87,7 +87,7 @@ export class ResultAssembler {
|
|
|
87
87
|
})
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
async finalize(): Promise<
|
|
90
|
+
async finalize(): Promise<Run> {
|
|
91
91
|
await this.config.runMgr.persist()
|
|
92
92
|
return this.config.runMgr.getRun()
|
|
93
93
|
}
|
|
@@ -30,11 +30,11 @@ import type { AgentDefinition } from '../../../types/agent/factory.js'
|
|
|
30
30
|
import type { AgentTaskContext, SendMessageOptions } from '../../../types/agent/task.js'
|
|
31
31
|
import type { AgentId, RunId, SessionId, TenantId, UserId } from '../../../types/ids/index.js'
|
|
32
32
|
import { createAssistantMessage } from '../../../types/message/index.js'
|
|
33
|
+
import type { ActorRef } from '../../../types/session/actor.js'
|
|
34
|
+
import type { Session } from '../../../types/session/entity.js'
|
|
33
35
|
import type { ProjectId, SummaryId, ThreadId } from '../../../types/session/ids.js'
|
|
34
36
|
import { ZERO_COST } from '../../../utils/cost.js'
|
|
35
37
|
import { DefaultCapacityValidator } from '../../handoff/capacity.js'
|
|
36
|
-
import type { ActorRef } from '../../hierarchy/actor.js'
|
|
37
|
-
import type { Session } from '../../hierarchy/session.js'
|
|
38
38
|
import { SessionSummaryMaterializer } from '../../summary/materialize.js'
|
|
39
39
|
import type { ExecFile, ExecFileResult } from '../../workspace/git-worktree.js'
|
|
40
40
|
import { GitWorktreeDriver } from '../../workspace/git-worktree.js'
|
|
@@ -17,6 +17,7 @@ import { ThreadManager } from '../../../manager/thread/lifecycle.js'
|
|
|
17
17
|
import { InMemorySessionStore } from '../../../store/session/memory.js'
|
|
18
18
|
import { InMemoryThreadStore } from '../../../store/thread/memory.js'
|
|
19
19
|
import type { AgentId, RunId, UserId } from '../../../types/ids/index.js'
|
|
20
|
+
import type { ActorRef } from '../../../types/session/actor.js'
|
|
20
21
|
import { generateHandoffId } from '../../../utils/id.js'
|
|
21
22
|
import { ThreadClosedError } from '../../errors.js'
|
|
22
23
|
import type { HandoffAssignment } from '../../handoff/assignment.js'
|
|
@@ -24,7 +25,6 @@ import { type BroadcastHandoffDeps, executeBroadcastHandoff } from '../../handof
|
|
|
24
25
|
import { DefaultCapacityValidator } from '../../handoff/capacity.js'
|
|
25
26
|
import type { HandoffEventSink } from '../../handoff/events.js'
|
|
26
27
|
import { type SingleHandoffDeps, executeSingleHandoff } from '../../handoff/single.js'
|
|
27
|
-
import type { ActorRef } from '../../hierarchy/actor.js'
|
|
28
28
|
import { GitWorktreeDriver } from '../../workspace/git-worktree.js'
|
|
29
29
|
import { WorkspaceBackendRegistry } from '../../workspace/registry.js'
|
|
30
30
|
import {
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { describe, expect, it } from 'vitest'
|
|
14
|
+
import type { ActorRef } from '../../../types/session/actor.js'
|
|
14
15
|
import { DelegationCapacityExceeded } from '../../handoff/capacity.js'
|
|
15
|
-
import type { ActorRef } from '../../hierarchy/actor.js'
|
|
16
16
|
import {
|
|
17
17
|
DEFAULT_TENANT,
|
|
18
18
|
agentActor,
|
|
@@ -34,10 +34,10 @@ import type { AgentTaskContext, SendMessageOptions } from '../../../types/agent/
|
|
|
34
34
|
import type { RunId, TenantId, UserId } from '../../../types/ids/index.js'
|
|
35
35
|
import { createAssistantMessage } from '../../../types/message/index.js'
|
|
36
36
|
import type { RunEvent } from '../../../types/run/events.js'
|
|
37
|
+
import type { ActorRef } from '../../../types/session/actor.js'
|
|
37
38
|
import type { SummaryId } from '../../../types/session/ids.js'
|
|
38
39
|
import { ZERO_COST } from '../../../utils/cost.js'
|
|
39
40
|
import { DefaultCapacityValidator } from '../../handoff/capacity.js'
|
|
40
|
-
import type { ActorRef } from '../../hierarchy/actor.js'
|
|
41
41
|
import { SessionSummaryMaterializer } from '../../summary/materialize.js'
|
|
42
42
|
import { WorkspaceBackendRegistry } from '../../workspace/registry.js'
|
|
43
43
|
|
|
@@ -14,13 +14,13 @@ import { ThreadManager } from '../../../manager/thread/lifecycle.js'
|
|
|
14
14
|
import { InMemorySessionStore } from '../../../store/session/memory.js'
|
|
15
15
|
import { InMemoryThreadStore } from '../../../store/thread/memory.js'
|
|
16
16
|
import type { SessionId } from '../../../types/ids/index.js'
|
|
17
|
+
import type { ActorRef } from '../../../types/session/actor.js'
|
|
17
18
|
import type { ProjectId, ThreadId } from '../../../types/session/ids.js'
|
|
18
19
|
import { generateHandoffId } from '../../../utils/id.js'
|
|
19
20
|
import type { HandoffAssignment } from '../../handoff/assignment.js'
|
|
20
21
|
import { type BroadcastHandoffDeps, executeBroadcastHandoff } from '../../handoff/broadcast.js'
|
|
21
22
|
import { DefaultCapacityValidator } from '../../handoff/capacity.js'
|
|
22
23
|
import type { HandoffEventSink } from '../../handoff/events.js'
|
|
23
|
-
import type { ActorRef } from '../../hierarchy/actor.js'
|
|
24
24
|
import type { ExecFile } from '../../workspace/git-worktree.js'
|
|
25
25
|
import { GitWorktreeDriver } from '../../workspace/git-worktree.js'
|
|
26
26
|
import { WorkspaceBackendRegistry } from '../../workspace/registry.js'
|
|
@@ -17,13 +17,13 @@ import { ThreadManager } from '../../../manager/thread/lifecycle.js'
|
|
|
17
17
|
import { InMemorySessionStore } from '../../../store/session/memory.js'
|
|
18
18
|
import { InMemoryThreadStore } from '../../../store/thread/memory.js'
|
|
19
19
|
import type { TenantId } from '../../../types/ids/index.js'
|
|
20
|
+
import type { Session } from '../../../types/session/entity.js'
|
|
20
21
|
import { generateHandoffId } from '../../../utils/id.js'
|
|
21
22
|
import { TenantIsolationError } from '../../errors.js'
|
|
22
23
|
import type { HandoffAssignment } from '../../handoff/assignment.js'
|
|
23
24
|
import { DefaultCapacityValidator } from '../../handoff/capacity.js'
|
|
24
25
|
import type { HandoffEventSink } from '../../handoff/events.js'
|
|
25
26
|
import { type SingleHandoffDeps, executeSingleHandoff } from '../../handoff/single.js'
|
|
26
|
-
import type { Session } from '../../hierarchy/session.js'
|
|
27
27
|
import { GitWorktreeDriver } from '../../workspace/git-worktree.js'
|
|
28
28
|
import { WorkspaceBackendRegistry } from '../../workspace/registry.js'
|
|
29
29
|
import { DEFAULT_TENANT, OTHER_TENANT, okExec, stubLogger, userActor } from './_fixtures.js'
|
|
@@ -20,13 +20,16 @@ import type {
|
|
|
20
20
|
SummaryId,
|
|
21
21
|
ThreadId,
|
|
22
22
|
} from '../../../types/session/ids.js'
|
|
23
|
+
import type {
|
|
24
|
+
DeliverableRef,
|
|
25
|
+
SessionSummaryDeliverable,
|
|
26
|
+
} from '../../../types/summary/deliverable.js'
|
|
23
27
|
import {
|
|
24
28
|
ArtifactRefCycleError,
|
|
25
29
|
type InterventionChainLoader,
|
|
26
30
|
InterventionDepthExceeded,
|
|
27
31
|
validatePrevArtifactChain,
|
|
28
32
|
} from '../../intervention/prev-artifact.js'
|
|
29
|
-
import type { DeliverableRef, SessionSummaryDeliverable } from '../../summary/deliverable.js'
|
|
30
33
|
import { DEFAULT_TENANT, agentActor, userActor } from './_fixtures.js'
|
|
31
34
|
|
|
32
35
|
const TEST_THREAD_ID = 'thd_test' as ThreadId
|
|
@@ -16,9 +16,9 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
|
16
16
|
import { InMemorySessionStore } from '../../../store/session/memory.js'
|
|
17
17
|
import { createUserMessage } from '../../../types/message/index.js'
|
|
18
18
|
import type { ThreadId, WorkspaceId } from '../../../types/session/ids.js'
|
|
19
|
+
import type { WorkspaceRef } from '../../../types/workspace/ref.js'
|
|
19
20
|
import { ArchivalManager, ArchiveNotConfiguredError } from '../../retention/archive.js'
|
|
20
21
|
import { DiskArchiveBackend } from '../../retention/disk-backend.js'
|
|
21
|
-
import type { WorkspaceRef } from '../../workspace/ref.js'
|
|
22
22
|
import { WorkspaceBackendRegistry } from '../../workspace/registry.js'
|
|
23
23
|
import { DEFAULT_TENANT, agentActor, userActor } from './_fixtures.js'
|
|
24
24
|
|
|
@@ -41,10 +41,11 @@ import type { AgentDefinition } from '../../../types/agent/factory.js'
|
|
|
41
41
|
import type { AgentTaskContext, SendMessageOptions } from '../../../types/agent/task.js'
|
|
42
42
|
import type { RunId, TenantId, UserId } from '../../../types/ids/index.js'
|
|
43
43
|
import { createAssistantMessage } from '../../../types/message/index.js'
|
|
44
|
+
import type { ActorRef } from '../../../types/session/actor.js'
|
|
44
45
|
import type { SummaryId } from '../../../types/session/ids.js'
|
|
46
|
+
import type { WorkspaceRef } from '../../../types/workspace/ref.js'
|
|
45
47
|
import { ZERO_COST } from '../../../utils/cost.js'
|
|
46
48
|
import { DefaultCapacityValidator } from '../../handoff/capacity.js'
|
|
47
|
-
import type { ActorRef } from '../../hierarchy/actor.js'
|
|
48
49
|
import { SessionSummaryMaterializer } from '../../summary/materialize.js'
|
|
49
50
|
import type {
|
|
50
51
|
BranchWorkspaceParams,
|
|
@@ -52,7 +53,6 @@ import type {
|
|
|
52
53
|
WorkspaceBackendDriver,
|
|
53
54
|
WorkspaceInspection,
|
|
54
55
|
} from '../../workspace/driver.js'
|
|
55
|
-
import type { WorkspaceRef } from '../../workspace/ref.js'
|
|
56
56
|
import { WorkspaceBackendRegistry } from '../../workspace/registry.js'
|
|
57
57
|
|
|
58
58
|
const tenant = 'tnt_alpha' as TenantId
|
|
@@ -19,8 +19,8 @@ import { describe, expect, it } from 'vitest'
|
|
|
19
19
|
import { InMemorySessionStore } from '../../../store/session/memory.js'
|
|
20
20
|
import type { SessionId } from '../../../types/ids/index.js'
|
|
21
21
|
import type { SummaryId, ThreadId } from '../../../types/session/ids.js'
|
|
22
|
+
import { SessionAlreadySummarizedError } from '../../summary/errors.js'
|
|
22
23
|
import { SessionSummaryMaterializer } from '../../summary/materialize.js'
|
|
23
|
-
import { SessionAlreadySummarizedError } from '../../summary/ref.js'
|
|
24
24
|
import { DEFAULT_TENANT, agentActor } from './_fixtures.js'
|
|
25
25
|
|
|
26
26
|
const TEST_THREAD_ID = 'thd_test' as ThreadId
|
package/src/session/errors.ts
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { SessionId, TenantId } from '../types/ids/index.js'
|
|
11
|
+
import type { SessionStatus } from '../types/session/entity.js'
|
|
11
12
|
import type { ThreadId } from '../types/session/ids.js'
|
|
12
|
-
import type { SessionStatus } from './hierarchy/session.js'
|
|
13
13
|
import type { WorkspaceBackendKind } from './workspace/driver.js'
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
// Sub-barrel for session-hierarchy run-event surface.
|
|
2
|
-
//
|
|
2
|
+
// Shape types live under `types/run/` (subsession-events.ts + schema-version.ts);
|
|
3
|
+
// this barrel only re-exports them. No runtime emitter lives here today.
|
|
3
4
|
//
|
|
4
5
|
// Phase 2 scope is limited to the sub-session lifecycle variants that are
|
|
5
6
|
// spliced into `RunEvent`. A dedicated `SessionHierarchyEvent` top-level
|
|
6
7
|
// union lands in a later phase (see session-hierarchy.md §10.2).
|
|
7
8
|
|
|
8
|
-
export { RUN_EVENT_SCHEMA_VERSION } from '
|
|
9
|
-
export type { RunEventSchemaVersion } from '
|
|
9
|
+
export { RUN_EVENT_SCHEMA_VERSION } from '../../types/run/schema-version.js'
|
|
10
|
+
export type { RunEventSchemaVersion } from '../../types/run/schema-version.js'
|
|
10
11
|
|
|
11
12
|
export type {
|
|
12
13
|
SubsessionSpawnedEvent,
|
|
13
14
|
SubsessionMessagedEvent,
|
|
14
15
|
SubsessionIdledEvent,
|
|
15
16
|
SubsessionLifecycleEvent,
|
|
16
|
-
} from '
|
|
17
|
+
} from '../../types/run/subsession-events.js'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
2
|
import { ThreadManager } from '../../../manager/thread/lifecycle.js'
|
|
3
|
-
import type { ActorRef } from '../../../session/hierarchy/actor.js'
|
|
4
3
|
import {
|
|
5
4
|
type ExecFile,
|
|
6
5
|
type ExecFileResult,
|
|
@@ -10,6 +9,7 @@ import { WorkspaceBackendRegistry } from '../../../session/workspace/registry.js
|
|
|
10
9
|
import { InMemorySessionStore } from '../../../store/session/memory.js'
|
|
11
10
|
import { InMemoryThreadStore } from '../../../store/thread/memory.js'
|
|
12
11
|
import type { SessionId, TenantId, UserId } from '../../../types/ids/index.js'
|
|
12
|
+
import type { ActorRef } from '../../../types/session/actor.js'
|
|
13
13
|
import type { ProjectId } from '../../../types/session/ids.js'
|
|
14
14
|
import { generateHandoffId } from '../../../utils/id.js'
|
|
15
15
|
import type { HandoffAssignment } from '../assignment.js'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
|
-
import type { ActorRef } from '../../../session/hierarchy/actor.js'
|
|
3
2
|
import { InMemorySessionStore } from '../../../store/session/memory.js'
|
|
4
3
|
import { InMemoryThreadStore } from '../../../store/thread/memory.js'
|
|
5
4
|
import type { AgentId, SessionId, TenantId, UserId } from '../../../types/ids/index.js'
|
|
5
|
+
import type { ActorRef } from '../../../types/session/actor.js'
|
|
6
6
|
import type { ProjectId, ThreadId } from '../../../types/session/ids.js'
|
|
7
7
|
import { DefaultCapacityValidator, DelegationCapacityExceeded } from '../capacity.js'
|
|
8
8
|
|