@namzu/sdk 0.1.8 → 0.2.0
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 +16 -0
- package/dist/agents/ReactiveAgent.d.ts.map +1 -1
- package/dist/agents/ReactiveAgent.js +5 -3
- package/dist/agents/ReactiveAgent.js.map +1 -1
- package/dist/agents/RouterAgent.d.ts.map +1 -1
- package/dist/agents/RouterAgent.js +3 -0
- package/dist/agents/RouterAgent.js.map +1 -1
- package/dist/agents/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/SupervisorAgent.js +18 -5
- package/dist/agents/SupervisorAgent.js.map +1 -1
- package/dist/bridge/a2a/mapper.d.ts.map +1 -1
- package/dist/bridge/a2a/mapper.js +6 -0
- package/dist/bridge/a2a/mapper.js.map +1 -1
- 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/sse/mapper.d.ts.map +1 -1
- package/dist/bridge/sse/mapper.js +6 -0
- package/dist/bridge/sse/mapper.js.map +1 -1
- package/dist/constants/a2a/index.d.ts +2 -2
- package/dist/constants/a2a/index.d.ts.map +1 -1
- package/dist/constants/a2a/index.js.map +1 -1
- package/dist/contracts/api.d.ts +22 -3
- package/dist/contracts/api.d.ts.map +1 -1
- package/dist/contracts/index.d.ts +3 -1
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/gateway/local.d.ts.map +1 -1
- package/dist/gateway/local.js +6 -0
- package/dist/gateway/local.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/manager/agent/__tests__/lifecycle.test.d.ts +2 -0
- package/dist/manager/agent/__tests__/lifecycle.test.d.ts.map +1 -0
- package/dist/manager/agent/__tests__/lifecycle.test.js +302 -0
- package/dist/manager/agent/__tests__/lifecycle.test.js.map +1 -0
- package/dist/manager/agent/lifecycle.d.ts +58 -3
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +311 -12
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/run/persistence.d.ts +8 -1
- package/dist/manager/run/persistence.d.ts.map +1 -1
- package/dist/manager/run/persistence.js +15 -0
- package/dist/manager/run/persistence.js.map +1 -1
- package/dist/run/reporter.d.ts.map +1 -1
- package/dist/run/reporter.js +25 -0
- package/dist/run/reporter.js.map +1 -1
- package/dist/runtime/query/__tests__/context.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/context.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/context.test.js +84 -0
- package/dist/runtime/query/__tests__/context.test.js.map +1 -0
- package/dist/runtime/query/context.d.ts +55 -2
- package/dist/runtime/query/context.d.ts.map +1 -1
- package/dist/runtime/query/context.js +48 -8
- package/dist/runtime/query/context.js.map +1 -1
- package/dist/runtime/query/events.d.ts.map +1 -1
- package/dist/runtime/query/events.js +8 -0
- package/dist/runtime/query/events.js.map +1 -1
- package/dist/runtime/query/index.d.ts +25 -2
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +11 -1
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/session/__tests__/integration/_fixtures.d.ts +115 -0
- package/dist/session/__tests__/integration/_fixtures.d.ts.map +1 -0
- package/dist/session/__tests__/integration/_fixtures.js +198 -0
- package/dist/session/__tests__/integration/_fixtures.js.map +1 -0
- package/dist/session/__tests__/integration/capacity-caps.test.d.ts +13 -0
- package/dist/session/__tests__/integration/capacity-caps.test.d.ts.map +1 -0
- package/dist/session/__tests__/integration/capacity-caps.test.js +116 -0
- package/dist/session/__tests__/integration/capacity-caps.test.js.map +1 -0
- package/dist/session/__tests__/integration/e2e-spawn.test.d.ts +18 -0
- package/dist/session/__tests__/integration/e2e-spawn.test.d.ts.map +1 -0
- package/dist/session/__tests__/integration/e2e-spawn.test.js +226 -0
- package/dist/session/__tests__/integration/e2e-spawn.test.js.map +1 -0
- package/dist/session/__tests__/integration/event-stream-ordering.test.d.ts +15 -0
- package/dist/session/__tests__/integration/event-stream-ordering.test.d.ts.map +1 -0
- package/dist/session/__tests__/integration/event-stream-ordering.test.js +323 -0
- package/dist/session/__tests__/integration/event-stream-ordering.test.js.map +1 -0
- package/dist/session/__tests__/integration/handoff-broadcast-e2e.test.d.ts +12 -0
- package/dist/session/__tests__/integration/handoff-broadcast-e2e.test.d.ts.map +1 -0
- package/dist/session/__tests__/integration/handoff-broadcast-e2e.test.js +170 -0
- package/dist/session/__tests__/integration/handoff-broadcast-e2e.test.js.map +1 -0
- package/dist/session/__tests__/integration/handoff-illegal-transition.test.d.ts +18 -0
- package/dist/session/__tests__/integration/handoff-illegal-transition.test.d.ts.map +1 -0
- package/dist/session/__tests__/integration/handoff-illegal-transition.test.js +146 -0
- package/dist/session/__tests__/integration/handoff-illegal-transition.test.js.map +1 -0
- package/dist/session/__tests__/integration/handoff-single-e2e.test.d.ts +15 -0
- package/dist/session/__tests__/integration/handoff-single-e2e.test.d.ts.map +1 -0
- package/dist/session/__tests__/integration/handoff-single-e2e.test.js +163 -0
- package/dist/session/__tests__/integration/handoff-single-e2e.test.js.map +1 -0
- package/dist/session/__tests__/integration/hierarchy-lifecycle.test.d.ts +12 -0
- package/dist/session/__tests__/integration/hierarchy-lifecycle.test.d.ts.map +1 -0
- package/dist/session/__tests__/integration/hierarchy-lifecycle.test.js +157 -0
- package/dist/session/__tests__/integration/hierarchy-lifecycle.test.js.map +1 -0
- package/dist/session/__tests__/integration/migration-filesystem.test.d.ts +11 -0
- package/dist/session/__tests__/integration/migration-filesystem.test.d.ts.map +1 -0
- package/dist/session/__tests__/integration/migration-filesystem.test.js +140 -0
- package/dist/session/__tests__/integration/migration-filesystem.test.js.map +1 -0
- package/dist/session/__tests__/integration/migration-id-prefix.test.d.ts +13 -0
- package/dist/session/__tests__/integration/migration-id-prefix.test.d.ts.map +1 -0
- package/dist/session/__tests__/integration/migration-id-prefix.test.js +84 -0
- package/dist/session/__tests__/integration/migration-id-prefix.test.js.map +1 -0
- package/dist/session/__tests__/integration/prev-artifact-dag.test.d.ts +14 -0
- package/dist/session/__tests__/integration/prev-artifact-dag.test.d.ts.map +1 -0
- package/dist/session/__tests__/integration/prev-artifact-dag.test.js +241 -0
- package/dist/session/__tests__/integration/prev-artifact-dag.test.js.map +1 -0
- package/dist/session/__tests__/integration/retention-archive.test.d.ts +12 -0
- package/dist/session/__tests__/integration/retention-archive.test.d.ts.map +1 -0
- package/dist/session/__tests__/integration/retention-archive.test.js +186 -0
- package/dist/session/__tests__/integration/retention-archive.test.js.map +1 -0
- package/dist/session/__tests__/integration/summary-materialization-e2e.test.d.ts +18 -0
- package/dist/session/__tests__/integration/summary-materialization-e2e.test.d.ts.map +1 -0
- package/dist/session/__tests__/integration/summary-materialization-e2e.test.js +200 -0
- package/dist/session/__tests__/integration/summary-materialization-e2e.test.js.map +1 -0
- package/dist/session/__tests__/integration/tenant-isolation.test.d.ts +14 -0
- package/dist/session/__tests__/integration/tenant-isolation.test.d.ts.map +1 -0
- package/dist/session/__tests__/integration/tenant-isolation.test.js +180 -0
- package/dist/session/__tests__/integration/tenant-isolation.test.js.map +1 -0
- package/dist/session/errors.d.ts +60 -0
- package/dist/session/errors.d.ts.map +1 -0
- package/dist/session/errors.js +50 -0
- package/dist/session/errors.js.map +1 -0
- package/dist/session/events/index.d.ts +4 -0
- package/dist/session/events/index.d.ts.map +1 -0
- package/dist/session/events/index.js +8 -0
- package/dist/session/events/index.js.map +1 -0
- package/dist/session/events/schema-version.d.ts +13 -0
- package/dist/session/events/schema-version.d.ts.map +1 -0
- package/dist/session/events/schema-version.js +12 -0
- package/dist/session/events/schema-version.js.map +1 -0
- package/dist/session/events/types.d.ts +64 -0
- package/dist/session/events/types.d.ts.map +1 -0
- package/dist/session/events/types.js +2 -0
- package/dist/session/events/types.js.map +1 -0
- package/dist/session/handoff/__tests__/broadcast.test.d.ts +2 -0
- package/dist/session/handoff/__tests__/broadcast.test.d.ts.map +1 -0
- package/dist/session/handoff/__tests__/broadcast.test.js +243 -0
- package/dist/session/handoff/__tests__/broadcast.test.js.map +1 -0
- package/dist/session/handoff/__tests__/capacity.test.d.ts +2 -0
- package/dist/session/handoff/__tests__/capacity.test.d.ts.map +1 -0
- package/dist/session/handoff/__tests__/capacity.test.js +100 -0
- package/dist/session/handoff/__tests__/capacity.test.js.map +1 -0
- package/dist/session/handoff/__tests__/single.test.d.ts +2 -0
- package/dist/session/handoff/__tests__/single.test.d.ts.map +1 -0
- package/dist/session/handoff/__tests__/single.test.js +230 -0
- package/dist/session/handoff/__tests__/single.test.js.map +1 -0
- package/dist/session/handoff/assignment.d.ts +59 -0
- package/dist/session/handoff/assignment.d.ts.map +1 -0
- package/dist/session/handoff/assignment.js +11 -0
- package/dist/session/handoff/assignment.js.map +1 -0
- package/dist/session/handoff/broadcast.d.ts +47 -0
- package/dist/session/handoff/broadcast.d.ts.map +1 -0
- package/dist/session/handoff/broadcast.js +296 -0
- package/dist/session/handoff/broadcast.js.map +1 -0
- package/dist/session/handoff/capacity.d.ts +66 -0
- package/dist/session/handoff/capacity.d.ts.map +1 -0
- package/dist/session/handoff/capacity.js +60 -0
- package/dist/session/handoff/capacity.js.map +1 -0
- package/dist/session/handoff/events.d.ts +66 -0
- package/dist/session/handoff/events.d.ts.map +1 -0
- package/dist/session/handoff/events.js +13 -0
- package/dist/session/handoff/events.js.map +1 -0
- package/dist/session/handoff/index.d.ts +12 -0
- package/dist/session/handoff/index.d.ts.map +1 -0
- package/dist/session/handoff/index.js +9 -0
- package/dist/session/handoff/index.js.map +1 -0
- package/dist/session/handoff/single.d.ts +62 -0
- package/dist/session/handoff/single.d.ts.map +1 -0
- package/dist/session/handoff/single.js +217 -0
- package/dist/session/handoff/single.js.map +1 -0
- package/dist/session/handoff/version.d.ts +52 -0
- package/dist/session/handoff/version.d.ts.map +1 -0
- package/dist/session/handoff/version.js +36 -0
- package/dist/session/handoff/version.js.map +1 -0
- package/dist/session/hierarchy/__tests__/session.test.d.ts +2 -0
- package/dist/session/hierarchy/__tests__/session.test.d.ts.map +1 -0
- package/dist/session/hierarchy/__tests__/session.test.js +67 -0
- package/dist/session/hierarchy/__tests__/session.test.js.map +1 -0
- package/dist/session/hierarchy/actor.d.ts +26 -0
- package/dist/session/hierarchy/actor.d.ts.map +1 -0
- package/dist/session/hierarchy/actor.js +2 -0
- package/dist/session/hierarchy/actor.js.map +1 -0
- package/dist/session/hierarchy/index.d.ts +8 -0
- package/dist/session/hierarchy/index.d.ts.map +1 -0
- package/dist/session/hierarchy/index.js +4 -0
- package/dist/session/hierarchy/index.js.map +1 -0
- package/dist/session/hierarchy/lineage.d.ts +15 -0
- package/dist/session/hierarchy/lineage.d.ts.map +1 -0
- package/dist/session/hierarchy/lineage.js +2 -0
- package/dist/session/hierarchy/lineage.js.map +1 -0
- package/dist/session/hierarchy/project.d.ts +40 -0
- package/dist/session/hierarchy/project.d.ts.map +1 -0
- package/dist/session/hierarchy/project.js +2 -0
- package/dist/session/hierarchy/project.js.map +1 -0
- package/dist/session/hierarchy/session.d.ts +59 -0
- package/dist/session/hierarchy/session.d.ts.map +1 -0
- package/dist/session/hierarchy/session.js +51 -0
- package/dist/session/hierarchy/session.js.map +1 -0
- package/dist/session/hierarchy/sub-session.d.ts +76 -0
- package/dist/session/hierarchy/sub-session.d.ts.map +1 -0
- package/dist/session/hierarchy/sub-session.js +2 -0
- package/dist/session/hierarchy/sub-session.js.map +1 -0
- package/dist/session/hierarchy/tenant.d.ts +13 -0
- package/dist/session/hierarchy/tenant.d.ts.map +1 -0
- package/dist/session/hierarchy/tenant.js +2 -0
- package/dist/session/hierarchy/tenant.js.map +1 -0
- package/dist/session/index.d.ts +10 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +15 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/intervention/__tests__/prev-artifact.test.d.ts +2 -0
- package/dist/session/intervention/__tests__/prev-artifact.test.d.ts.map +1 -0
- package/dist/session/intervention/__tests__/prev-artifact.test.js +179 -0
- package/dist/session/intervention/__tests__/prev-artifact.test.js.map +1 -0
- package/dist/session/intervention/index.d.ts +3 -0
- package/dist/session/intervention/index.d.ts.map +1 -0
- package/dist/session/intervention/index.js +8 -0
- package/dist/session/intervention/index.js.map +1 -0
- package/dist/session/intervention/prev-artifact.d.ts +103 -0
- package/dist/session/intervention/prev-artifact.d.ts.map +1 -0
- package/dist/session/intervention/prev-artifact.js +112 -0
- package/dist/session/intervention/prev-artifact.js.map +1 -0
- package/dist/session/migration/__tests__/filesystem.test.d.ts +2 -0
- package/dist/session/migration/__tests__/filesystem.test.d.ts.map +1 -0
- package/dist/session/migration/__tests__/filesystem.test.js +188 -0
- package/dist/session/migration/__tests__/filesystem.test.js.map +1 -0
- package/dist/session/migration/__tests__/id-prefix.test.d.ts +2 -0
- package/dist/session/migration/__tests__/id-prefix.test.d.ts.map +1 -0
- package/dist/session/migration/__tests__/id-prefix.test.js +83 -0
- package/dist/session/migration/__tests__/id-prefix.test.js.map +1 -0
- package/dist/session/migration/__tests__/marker.test.d.ts +2 -0
- package/dist/session/migration/__tests__/marker.test.d.ts.map +1 -0
- package/dist/session/migration/__tests__/marker.test.js +75 -0
- package/dist/session/migration/__tests__/marker.test.js.map +1 -0
- package/dist/session/migration/errors.d.ts +26 -0
- package/dist/session/migration/errors.d.ts.map +1 -0
- package/dist/session/migration/errors.js +22 -0
- package/dist/session/migration/errors.js.map +1 -0
- package/dist/session/migration/filesystem.d.ts +94 -0
- package/dist/session/migration/filesystem.d.ts.map +1 -0
- package/dist/session/migration/filesystem.js +319 -0
- package/dist/session/migration/filesystem.js.map +1 -0
- package/dist/session/migration/id-prefix.d.ts +98 -0
- package/dist/session/migration/id-prefix.d.ts.map +1 -0
- package/dist/session/migration/id-prefix.js +116 -0
- package/dist/session/migration/id-prefix.js.map +1 -0
- package/dist/session/migration/index.d.ts +8 -0
- package/dist/session/migration/index.d.ts.map +1 -0
- package/dist/session/migration/index.js +8 -0
- package/dist/session/migration/index.js.map +1 -0
- package/dist/session/migration/marker.d.ts +57 -0
- package/dist/session/migration/marker.d.ts.map +1 -0
- package/dist/session/migration/marker.js +111 -0
- package/dist/session/migration/marker.js.map +1 -0
- package/dist/session/retention/__tests__/archive.test.d.ts +2 -0
- package/dist/session/retention/__tests__/archive.test.d.ts.map +1 -0
- package/dist/session/retention/__tests__/archive.test.js +252 -0
- package/dist/session/retention/__tests__/archive.test.js.map +1 -0
- package/dist/session/retention/__tests__/disk-backend.test.d.ts +2 -0
- package/dist/session/retention/__tests__/disk-backend.test.d.ts.map +1 -0
- package/dist/session/retention/__tests__/disk-backend.test.js +154 -0
- package/dist/session/retention/__tests__/disk-backend.test.js.map +1 -0
- package/dist/session/retention/archive-backend-ref.d.ts +18 -0
- package/dist/session/retention/archive-backend-ref.d.ts.map +1 -0
- package/dist/session/retention/archive-backend-ref.js +2 -0
- package/dist/session/retention/archive-backend-ref.js.map +1 -0
- package/dist/session/retention/archive.d.ts +130 -0
- package/dist/session/retention/archive.d.ts.map +1 -0
- package/dist/session/retention/archive.js +203 -0
- package/dist/session/retention/archive.js.map +1 -0
- package/dist/session/retention/backend.d.ts +101 -0
- package/dist/session/retention/backend.d.ts.map +1 -0
- package/dist/session/retention/backend.js +15 -0
- package/dist/session/retention/backend.js.map +1 -0
- package/dist/session/retention/disk-backend.d.ts +59 -0
- package/dist/session/retention/disk-backend.d.ts.map +1 -0
- package/dist/session/retention/disk-backend.js +236 -0
- package/dist/session/retention/disk-backend.js.map +1 -0
- package/dist/session/retention/index.d.ts +9 -0
- package/dist/session/retention/index.d.ts.map +1 -0
- package/dist/session/retention/index.js +6 -0
- package/dist/session/retention/index.js.map +1 -0
- package/dist/session/retention/policy.d.ts +49 -0
- package/dist/session/retention/policy.d.ts.map +1 -0
- package/dist/session/retention/policy.js +21 -0
- package/dist/session/retention/policy.js.map +1 -0
- package/dist/session/summary/__tests__/materialize.test.d.ts +2 -0
- package/dist/session/summary/__tests__/materialize.test.d.ts.map +1 -0
- package/dist/session/summary/__tests__/materialize.test.js +269 -0
- package/dist/session/summary/__tests__/materialize.test.js.map +1 -0
- package/dist/session/summary/deliverable.d.ts +74 -0
- package/dist/session/summary/deliverable.d.ts.map +1 -0
- package/dist/session/summary/deliverable.js +20 -0
- package/dist/session/summary/deliverable.js.map +1 -0
- package/dist/session/summary/index.d.ts +6 -0
- package/dist/session/summary/index.d.ts.map +1 -0
- package/dist/session/summary/index.js +9 -0
- package/dist/session/summary/index.js.map +1 -0
- package/dist/session/summary/materialize.d.ts +82 -0
- package/dist/session/summary/materialize.d.ts.map +1 -0
- package/dist/session/summary/materialize.js +117 -0
- package/dist/session/summary/materialize.js.map +1 -0
- package/dist/session/summary/ref.d.ts +91 -0
- package/dist/session/summary/ref.d.ts.map +1 -0
- package/dist/session/summary/ref.js +51 -0
- package/dist/session/summary/ref.js.map +1 -0
- package/dist/session/workspace/__tests__/git-worktree.test.d.ts +2 -0
- package/dist/session/workspace/__tests__/git-worktree.test.d.ts.map +1 -0
- package/dist/session/workspace/__tests__/git-worktree.test.js +244 -0
- package/dist/session/workspace/__tests__/git-worktree.test.js.map +1 -0
- package/dist/session/workspace/__tests__/path-builder.test.d.ts +2 -0
- package/dist/session/workspace/__tests__/path-builder.test.d.ts.map +1 -0
- package/dist/session/workspace/__tests__/path-builder.test.js +37 -0
- package/dist/session/workspace/__tests__/path-builder.test.js.map +1 -0
- package/dist/session/workspace/driver.d.ts +55 -0
- package/dist/session/workspace/driver.d.ts.map +1 -0
- package/dist/session/workspace/driver.js +12 -0
- package/dist/session/workspace/driver.js.map +1 -0
- package/dist/session/workspace/git-worktree.d.ts +65 -0
- package/dist/session/workspace/git-worktree.d.ts.map +1 -0
- package/dist/session/workspace/git-worktree.js +156 -0
- package/dist/session/workspace/git-worktree.js.map +1 -0
- package/dist/session/workspace/index.d.ts +8 -0
- package/dist/session/workspace/index.d.ts.map +1 -0
- package/dist/session/workspace/index.js +7 -0
- package/dist/session/workspace/index.js.map +1 -0
- package/dist/session/workspace/path-builder.d.ts +50 -0
- package/dist/session/workspace/path-builder.d.ts.map +1 -0
- package/dist/session/workspace/path-builder.js +50 -0
- package/dist/session/workspace/path-builder.js.map +1 -0
- package/dist/session/workspace/ref.d.ts +46 -0
- package/dist/session/workspace/ref.d.ts.map +1 -0
- package/dist/session/workspace/ref.js +11 -0
- package/dist/session/workspace/ref.js.map +1 -0
- package/dist/session/workspace/registry.d.ts +26 -0
- package/dist/session/workspace/registry.d.ts.map +1 -0
- package/dist/session/workspace/registry.js +35 -0
- package/dist/session/workspace/registry.js.map +1 -0
- package/dist/store/conversation/memory.d.ts +22 -0
- package/dist/store/conversation/memory.d.ts.map +1 -1
- package/dist/store/conversation/memory.js +22 -0
- package/dist/store/conversation/memory.js.map +1 -1
- package/dist/store/session/__tests__/disk.test.d.ts +2 -0
- package/dist/store/session/__tests__/disk.test.d.ts.map +1 -0
- package/dist/store/session/__tests__/disk.test.js +240 -0
- package/dist/store/session/__tests__/disk.test.js.map +1 -0
- package/dist/store/session/__tests__/memory.test.d.ts +2 -0
- package/dist/store/session/__tests__/memory.test.d.ts.map +1 -0
- package/dist/store/session/__tests__/memory.test.js +217 -0
- package/dist/store/session/__tests__/memory.test.js.map +1 -0
- package/dist/store/session/disk.d.ts +85 -0
- package/dist/store/session/disk.d.ts.map +1 -0
- package/dist/store/session/disk.js +757 -0
- package/dist/store/session/disk.js.map +1 -0
- package/dist/store/session/index.d.ts +7 -0
- package/dist/store/session/index.d.ts.map +1 -0
- package/dist/store/session/index.js +11 -0
- package/dist/store/session/index.js.map +1 -0
- package/dist/store/session/linkage.d.ts +38 -0
- package/dist/store/session/linkage.d.ts.map +1 -0
- package/dist/store/session/linkage.js +64 -0
- package/dist/store/session/linkage.js.map +1 -0
- package/dist/store/session/memory.d.ts +48 -0
- package/dist/store/session/memory.d.ts.map +1 -0
- package/dist/store/session/memory.js +322 -0
- package/dist/store/session/memory.js.map +1 -0
- package/dist/store/session/messages.d.ts +20 -0
- package/dist/store/session/messages.d.ts.map +1 -0
- package/dist/store/session/messages.js +12 -0
- package/dist/store/session/messages.js.map +1 -0
- package/dist/tools/builtins/__tests__/structuredOutput.example.d.ts +1 -1
- package/dist/types/agent/base.d.ts +28 -1
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/agent/task.d.ts +50 -2
- package/dist/types/agent/task.d.ts.map +1 -1
- package/dist/types/agent/task.js.map +1 -1
- package/dist/types/conversation/index.d.ts +7 -0
- package/dist/types/conversation/index.d.ts.map +1 -1
- package/dist/types/ids/index.d.ts +26 -3
- package/dist/types/ids/index.d.ts.map +1 -1
- package/dist/types/ids/index.js +8 -1
- package/dist/types/ids/index.js.map +1 -1
- package/dist/types/invocation/__tests__/state.test.js +36 -29
- package/dist/types/invocation/__tests__/state.test.js.map +1 -1
- package/dist/types/invocation/index.d.ts +20 -4
- package/dist/types/invocation/index.d.ts.map +1 -1
- package/dist/types/invocation/index.js +10 -7
- package/dist/types/invocation/index.js.map +1 -1
- package/dist/types/run/config.d.ts +11 -1
- package/dist/types/run/config.d.ts.map +1 -1
- package/dist/types/run/events.d.ts +26 -1
- package/dist/types/run/events.d.ts.map +1 -1
- package/dist/types/run/index.d.ts.map +1 -1
- package/dist/types/run/index.js +8 -0
- package/dist/types/run/index.js.map +1 -1
- package/dist/types/run/metadata.d.ts +24 -1
- package/dist/types/run/metadata.d.ts.map +1 -1
- package/dist/types/run/status.d.ts +26 -0
- package/dist/types/run/status.d.ts.map +1 -0
- package/dist/types/run/status.js +2 -0
- package/dist/types/run/status.js.map +1 -0
- package/dist/types/session/ids.d.ts +18 -0
- package/dist/types/session/ids.d.ts.map +1 -0
- package/dist/types/session/ids.js +12 -0
- package/dist/types/session/ids.js.map +1 -0
- package/dist/types/session/index.d.ts +3 -0
- package/dist/types/session/index.d.ts.map +1 -0
- package/dist/types/session/index.js +5 -0
- package/dist/types/session/index.js.map +1 -0
- package/dist/types/session/store.d.ts +188 -0
- package/dist/types/session/store.d.ts.map +1 -0
- package/dist/types/session/store.js +14 -0
- package/dist/types/session/store.js.map +1 -0
- package/dist/utils/id.d.ts +18 -1
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/id.js +42 -4
- package/dist/utils/id.js.map +1 -1
- package/package.json +1 -1
- package/src/agents/ReactiveAgent.ts +7 -3
- package/src/agents/RouterAgent.ts +5 -0
- package/src/agents/SupervisorAgent.ts +26 -6
- package/src/bridge/a2a/mapper.ts +7 -0
- package/src/bridge/a2a/task.ts +2 -2
- package/src/bridge/sse/mapper.ts +8 -1
- package/src/constants/a2a/index.ts +2 -2
- package/src/contracts/api.ts +23 -3
- package/src/contracts/index.ts +2 -0
- package/src/gateway/local.ts +6 -0
- package/src/index.ts +14 -0
- package/src/manager/agent/__tests__/lifecycle.test.ts +452 -0
- package/src/manager/agent/lifecycle.ts +434 -19
- package/src/manager/run/persistence.ts +20 -1
- package/src/run/reporter.ts +28 -0
- package/src/runtime/query/__tests__/context.test.ts +101 -0
- package/src/runtime/query/context.ts +106 -10
- package/src/runtime/query/events.ts +8 -0
- package/src/runtime/query/index.ts +41 -3
- package/src/session/__tests__/integration/_fixtures.ts +282 -0
- package/src/session/__tests__/integration/capacity-caps.test.ts +164 -0
- package/src/session/__tests__/integration/e2e-spawn.test.ts +278 -0
- package/src/session/__tests__/integration/event-stream-ordering.test.ts +403 -0
- package/src/session/__tests__/integration/handoff-broadcast-e2e.test.ts +245 -0
- package/src/session/__tests__/integration/handoff-illegal-transition.test.ts +179 -0
- package/src/session/__tests__/integration/handoff-single-e2e.test.ts +220 -0
- package/src/session/__tests__/integration/hierarchy-lifecycle.test.ts +237 -0
- package/src/session/__tests__/integration/migration-filesystem.test.ts +209 -0
- package/src/session/__tests__/integration/migration-id-prefix.test.ts +101 -0
- package/src/session/__tests__/integration/prev-artifact-dag.test.ts +318 -0
- package/src/session/__tests__/integration/retention-archive.test.ts +231 -0
- package/src/session/__tests__/integration/summary-materialization-e2e.test.ts +237 -0
- package/src/session/__tests__/integration/tenant-isolation.test.ts +282 -0
- package/src/session/errors.ts +70 -0
- package/src/session/events/index.ts +16 -0
- package/src/session/events/schema-version.ts +13 -0
- package/src/session/events/types.ts +71 -0
- package/src/session/handoff/__tests__/broadcast.test.ts +350 -0
- package/src/session/handoff/__tests__/capacity.test.ts +123 -0
- package/src/session/handoff/__tests__/single.test.ts +316 -0
- package/src/session/handoff/assignment.ts +62 -0
- package/src/session/handoff/broadcast.ts +381 -0
- package/src/session/handoff/capacity.ts +121 -0
- package/src/session/handoff/events.ts +72 -0
- package/src/session/handoff/index.ts +29 -0
- package/src/session/handoff/single.ts +288 -0
- package/src/session/handoff/version.ts +59 -0
- package/src/session/hierarchy/__tests__/session.test.ts +92 -0
- package/src/session/hierarchy/actor.ts +17 -0
- package/src/session/hierarchy/index.ts +17 -0
- package/src/session/hierarchy/lineage.ts +15 -0
- package/src/session/hierarchy/project.ts +41 -0
- package/src/session/hierarchy/session.ts +97 -0
- package/src/session/hierarchy/sub-session.ts +92 -0
- package/src/session/hierarchy/tenant.ts +13 -0
- package/src/session/index.ts +15 -0
- package/src/session/intervention/__tests__/prev-artifact.test.ts +234 -0
- package/src/session/intervention/index.ts +16 -0
- package/src/session/intervention/prev-artifact.ts +180 -0
- package/src/session/migration/__tests__/filesystem.test.ts +263 -0
- package/src/session/migration/__tests__/id-prefix.test.ts +101 -0
- package/src/session/migration/__tests__/marker.test.ts +84 -0
- package/src/session/migration/errors.ts +23 -0
- package/src/session/migration/filesystem.ts +401 -0
- package/src/session/migration/id-prefix.ts +146 -0
- package/src/session/migration/index.ts +38 -0
- package/src/session/migration/marker.ts +131 -0
- package/src/session/retention/__tests__/archive.test.ts +316 -0
- package/src/session/retention/__tests__/disk-backend.test.ts +180 -0
- package/src/session/retention/archive-backend-ref.ts +17 -0
- package/src/session/retention/archive.ts +281 -0
- package/src/session/retention/backend.ts +107 -0
- package/src/session/retention/disk-backend.ts +304 -0
- package/src/session/retention/index.ts +16 -0
- package/src/session/retention/policy.ts +53 -0
- package/src/session/summary/__tests__/materialize.test.ts +341 -0
- package/src/session/summary/deliverable.ts +84 -0
- package/src/session/summary/index.ts +31 -0
- package/src/session/summary/materialize.ts +169 -0
- package/src/session/summary/ref.ts +104 -0
- package/src/session/workspace/__tests__/git-worktree.test.ts +258 -0
- package/src/session/workspace/__tests__/path-builder.test.ts +51 -0
- package/src/session/workspace/driver.ts +60 -0
- package/src/session/workspace/git-worktree.ts +209 -0
- package/src/session/workspace/index.ts +25 -0
- package/src/session/workspace/path-builder.ts +71 -0
- package/src/session/workspace/ref.ts +50 -0
- package/src/session/workspace/registry.ts +42 -0
- package/src/store/conversation/memory.ts +23 -0
- package/src/store/session/__tests__/disk.test.ts +346 -0
- package/src/store/session/__tests__/memory.test.ts +327 -0
- package/src/store/session/disk.ts +920 -0
- package/src/store/session/index.ts +14 -0
- package/src/store/session/linkage.ts +80 -0
- package/src/store/session/memory.ts +400 -0
- package/src/store/session/messages.ts +21 -0
- package/src/types/agent/base.ts +31 -1
- package/src/types/agent/task.ts +58 -2
- package/src/types/conversation/index.ts +7 -0
- package/src/types/ids/index.ts +41 -3
- package/src/types/invocation/__tests__/state.test.ts +37 -29
- package/src/types/invocation/index.ts +26 -10
- package/src/types/run/config.ts +12 -1
- package/src/types/run/events.ts +36 -1
- package/src/types/run/index.ts +8 -0
- package/src/types/run/metadata.ts +24 -1
- package/src/types/run/status.ts +33 -0
- package/src/types/session/ids.ts +34 -0
- package/src/types/session/index.ts +28 -0
- package/src/types/session/store.ts +229 -0
- package/src/utils/id.ts +55 -4
package/src/types/ids/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export type ThreadId = `thd_${string}`
|
|
2
1
|
export type RunId = `run_${string}`
|
|
3
2
|
export type MessageId = `msg_${string}`
|
|
4
|
-
export type SessionId = `
|
|
3
|
+
export type SessionId = `ses_${string}`
|
|
5
4
|
export type ToolCallId = `call_${string}`
|
|
6
5
|
export type ActivityId = `act_${string}`
|
|
7
6
|
export type TaskId = `task_${string}`
|
|
@@ -11,7 +10,7 @@ export type DocumentId = `doc_${string}`
|
|
|
11
10
|
export type ChunkId = `chk_${string}`
|
|
12
11
|
export type ConnectorId = `conn_${string}`
|
|
13
12
|
export type ConnectorInstanceId = `ci_${string}`
|
|
14
|
-
export type TenantId = `
|
|
13
|
+
export type TenantId = `tnt_${string}`
|
|
15
14
|
export type CredentialId = `cred_${string}`
|
|
16
15
|
export type ExecutionContextId = `ectx_${string}`
|
|
17
16
|
export type MCPServerId = `mcp_${string}`
|
|
@@ -26,3 +25,42 @@ export type EmergencySaveId = `esave_${string}`
|
|
|
26
25
|
export type MemoryId = `mem_${string}`
|
|
27
26
|
export type PluginId = `plg_${string}`
|
|
28
27
|
export type SandboxId = `sbx_${string}`
|
|
28
|
+
|
|
29
|
+
// Actor identifiers (Session Hierarchy §4.3). Branded so actor refs cannot be
|
|
30
|
+
// constructed from bare strings.
|
|
31
|
+
export type UserId = `usr_${string}`
|
|
32
|
+
export type AgentId = `agt_${string}`
|
|
33
|
+
|
|
34
|
+
// Shared-store placeholder refs (Session Hierarchy §4.2 / §3.2). Full shapes
|
|
35
|
+
// land in later phases; kept here as opaque branded IDs so ProjectConfig can
|
|
36
|
+
// reference them today.
|
|
37
|
+
export type MemoryStoreRef = `mms_${string}`
|
|
38
|
+
export type VaultRef = `vlt_${string}`
|
|
39
|
+
export type KnowledgeBaseRef = `kbs_${string}`
|
|
40
|
+
|
|
41
|
+
// Session hierarchy IDs — live canonically here (Phase 9 Known Delta #4
|
|
42
|
+
// collapse: previously split across `types/ids/` and `types/session/ids.ts`
|
|
43
|
+
// with a circular re-export). Convention #2 branded IDs; prefixes mandated
|
|
44
|
+
// by session-hierarchy.md §4. The `types/session/ids.ts` barrel re-exports
|
|
45
|
+
// these for co-location ergonomics.
|
|
46
|
+
export type ProjectId = `prj_${string}`
|
|
47
|
+
export type SubSessionId = `sub_${string}`
|
|
48
|
+
export type HandoffId = `hof_${string}`
|
|
49
|
+
export type WorkspaceId = `wsp_${string}`
|
|
50
|
+
export type SummaryId = `sum_${string}`
|
|
51
|
+
export type DeliverableId = `del_${string}`
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated Use {@link ProjectId}. Alias retained for the 0.2.x migration
|
|
55
|
+
* window; will be removed in 0.3.0. See session-hierarchy.md §13.3.1.
|
|
56
|
+
*/
|
|
57
|
+
export type ThreadId = ProjectId
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Sentinel {@link TenantId} for legacy pre-0.2.0 runs rehomed by the
|
|
61
|
+
* boot-time filesystem migration (session-hierarchy.md §13.4.1). Consumers
|
|
62
|
+
* with strict tenant enforcement should either tag these records on first
|
|
63
|
+
* access or reject them until a real tenant is assigned — the kernel
|
|
64
|
+
* surfaces the sentinel but does not prescribe policy (Convention #17).
|
|
65
|
+
*/
|
|
66
|
+
export const UNKNOWN_TENANT_ID = 'tnt_unknown_legacy' as TenantId
|
|
@@ -3,20 +3,22 @@ import type { TenantId } from '../../ids/index.js'
|
|
|
3
3
|
import { deriveChildState } from '../index.js'
|
|
4
4
|
import type { InvocationState } from '../index.js'
|
|
5
5
|
|
|
6
|
+
const ROOT_TENANT = 'tnt_root' as TenantId
|
|
7
|
+
|
|
6
8
|
describe('InvocationState', () => {
|
|
7
9
|
describe('deriveChildState', () => {
|
|
8
|
-
it('
|
|
9
|
-
const childState = deriveChildState(
|
|
10
|
+
it('seeds parentChain from a root seed when no parent state exists', () => {
|
|
11
|
+
const childState = deriveChildState({ tenantId: ROOT_TENANT }, 'agent-123')
|
|
10
12
|
|
|
11
13
|
expect(childState.parentChain).toEqual(['agent-123'])
|
|
12
|
-
expect(childState.tenantId).
|
|
14
|
+
expect(childState.tenantId).toBe(ROOT_TENANT)
|
|
13
15
|
expect(childState.metadata).toBeUndefined()
|
|
14
16
|
expect(childState.services).toBeUndefined()
|
|
15
17
|
})
|
|
16
18
|
|
|
17
|
-
it('
|
|
19
|
+
it('seeds parentChain when parent has no parentChain', () => {
|
|
18
20
|
const parent: InvocationState = {
|
|
19
|
-
tenantId: '
|
|
21
|
+
tenantId: 'tnt_abc' as TenantId,
|
|
20
22
|
metadata: { userId: 'user-123' },
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -27,10 +29,10 @@ describe('InvocationState', () => {
|
|
|
27
29
|
expect(childState.metadata).toBe(parent.metadata)
|
|
28
30
|
})
|
|
29
31
|
|
|
30
|
-
it('
|
|
32
|
+
it('extends parentChain with current agent', () => {
|
|
31
33
|
const parent: InvocationState = {
|
|
32
34
|
parentChain: ['supervisor', 'router'],
|
|
33
|
-
tenantId: '
|
|
35
|
+
tenantId: 'tnt_xyz' as TenantId,
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
const childState = deriveChildState(parent, 'worker-agent')
|
|
@@ -38,8 +40,8 @@ describe('InvocationState', () => {
|
|
|
38
40
|
expect(childState.parentChain).toEqual(['supervisor', 'router', 'worker-agent'])
|
|
39
41
|
})
|
|
40
42
|
|
|
41
|
-
it('
|
|
42
|
-
const tenantId = '
|
|
43
|
+
it('preserves tenantId through derivation', () => {
|
|
44
|
+
const tenantId = 'tnt_tenant123' as TenantId
|
|
43
45
|
const parent: InvocationState = {
|
|
44
46
|
tenantId,
|
|
45
47
|
parentChain: ['agent-1'],
|
|
@@ -50,13 +52,14 @@ describe('InvocationState', () => {
|
|
|
50
52
|
expect(childState.tenantId).toBe(tenantId)
|
|
51
53
|
})
|
|
52
54
|
|
|
53
|
-
it('
|
|
55
|
+
it('preserves metadata through derivation', () => {
|
|
54
56
|
const metadata = {
|
|
55
57
|
userId: 'user-456',
|
|
56
|
-
sessionId: '
|
|
58
|
+
sessionId: 'ses_789',
|
|
57
59
|
correlationId: 'corr_abc',
|
|
58
60
|
}
|
|
59
61
|
const parent: InvocationState = {
|
|
62
|
+
tenantId: ROOT_TENANT,
|
|
60
63
|
metadata,
|
|
61
64
|
parentChain: ['agent-1'],
|
|
62
65
|
}
|
|
@@ -67,12 +70,13 @@ describe('InvocationState', () => {
|
|
|
67
70
|
expect(childState.metadata?.userId).toBe('user-456')
|
|
68
71
|
})
|
|
69
72
|
|
|
70
|
-
it('
|
|
73
|
+
it('preserves services through derivation', () => {
|
|
71
74
|
const services = {
|
|
72
75
|
db: { pool: 'mock-pool' },
|
|
73
76
|
cache: { client: 'mock-redis' },
|
|
74
77
|
}
|
|
75
78
|
const parent: InvocationState = {
|
|
79
|
+
tenantId: ROOT_TENANT,
|
|
76
80
|
services,
|
|
77
81
|
parentChain: ['agent-1'],
|
|
78
82
|
}
|
|
@@ -82,12 +86,12 @@ describe('InvocationState', () => {
|
|
|
82
86
|
expect(childState.services).toBe(services)
|
|
83
87
|
})
|
|
84
88
|
|
|
85
|
-
it('
|
|
86
|
-
const tenantId = '
|
|
89
|
+
it('preserves all fields through multi-level derivation', () => {
|
|
90
|
+
const tenantId = 'tnt_multi' as TenantId
|
|
87
91
|
const metadata = { userId: 'user-multi' }
|
|
88
92
|
const services = { db: 'postgres' }
|
|
89
93
|
|
|
90
|
-
const level1 = deriveChildState(
|
|
94
|
+
const level1 = deriveChildState({ tenantId }, 'supervisor')
|
|
91
95
|
expect(level1.parentChain).toEqual(['supervisor'])
|
|
92
96
|
|
|
93
97
|
const parent: InvocationState = {
|
|
@@ -110,8 +114,9 @@ describe('InvocationState', () => {
|
|
|
110
114
|
expect(level3.services).toBe(services)
|
|
111
115
|
})
|
|
112
116
|
|
|
113
|
-
it('
|
|
117
|
+
it('creates immutable parentChain', () => {
|
|
114
118
|
const parent: InvocationState = {
|
|
119
|
+
tenantId: ROOT_TENANT,
|
|
115
120
|
parentChain: ['agent-1'],
|
|
116
121
|
}
|
|
117
122
|
|
|
@@ -122,8 +127,9 @@ describe('InvocationState', () => {
|
|
|
122
127
|
expect(childState.parentChain).toEqual(['agent-1', 'agent-2'])
|
|
123
128
|
})
|
|
124
129
|
|
|
125
|
-
it('
|
|
130
|
+
it('handles empty parentChain in parent', () => {
|
|
126
131
|
const parent: InvocationState = {
|
|
132
|
+
tenantId: ROOT_TENANT,
|
|
127
133
|
parentChain: [],
|
|
128
134
|
}
|
|
129
135
|
|
|
@@ -132,25 +138,25 @@ describe('InvocationState', () => {
|
|
|
132
138
|
expect(childState.parentChain).toEqual(['agent-first'])
|
|
133
139
|
})
|
|
134
140
|
|
|
135
|
-
it('
|
|
141
|
+
it('allows complex agent IDs in parentChain', () => {
|
|
136
142
|
const agentIds = ['supervisor-agent-123', 'router-multi-path', 'worker-task-handler']
|
|
137
143
|
|
|
138
|
-
let state: InvocationState
|
|
144
|
+
let state: InvocationState = { tenantId: ROOT_TENANT }
|
|
139
145
|
for (const agentId of agentIds) {
|
|
140
146
|
state = deriveChildState(state, agentId)
|
|
141
147
|
}
|
|
142
148
|
|
|
143
|
-
expect(state
|
|
149
|
+
expect(state.parentChain).toEqual(agentIds)
|
|
144
150
|
})
|
|
145
151
|
|
|
146
|
-
it('
|
|
152
|
+
it('does not mutate parent state', () => {
|
|
147
153
|
const parent: InvocationState = {
|
|
148
154
|
parentChain: ['original'],
|
|
149
|
-
tenantId: '
|
|
155
|
+
tenantId: 'tnt_orig' as TenantId,
|
|
150
156
|
metadata: { key: 'value' },
|
|
151
157
|
}
|
|
152
158
|
|
|
153
|
-
const originalParentChain = [...parent.parentChain
|
|
159
|
+
const originalParentChain = [...(parent.parentChain ?? [])]
|
|
154
160
|
|
|
155
161
|
deriveChildState(parent, 'child')
|
|
156
162
|
|
|
@@ -161,33 +167,34 @@ describe('InvocationState', () => {
|
|
|
161
167
|
})
|
|
162
168
|
|
|
163
169
|
describe('InvocationState immutability', () => {
|
|
164
|
-
it('
|
|
170
|
+
it('has readonly fields', () => {
|
|
165
171
|
const state: InvocationState = {
|
|
166
|
-
tenantId: '
|
|
172
|
+
tenantId: 'tnt_test' as TenantId,
|
|
167
173
|
metadata: { key: 'value' },
|
|
168
174
|
services: { db: 'postgres' },
|
|
169
175
|
parentChain: ['agent-1'],
|
|
170
176
|
}
|
|
171
177
|
|
|
172
178
|
// Type system enforces immutability, so these assertions verify the type definitions
|
|
173
|
-
expect(state.tenantId).toBe('
|
|
179
|
+
expect(state.tenantId).toBe('tnt_test')
|
|
174
180
|
expect(state.metadata).toBeDefined()
|
|
175
181
|
expect(state.services).toBeDefined()
|
|
176
182
|
expect(state.parentChain).toBeDefined()
|
|
177
183
|
})
|
|
178
184
|
|
|
179
|
-
it('
|
|
185
|
+
it('supports undefined optional fields (tenantId still required)', () => {
|
|
180
186
|
const minimalState: InvocationState = {
|
|
187
|
+
tenantId: ROOT_TENANT,
|
|
181
188
|
parentChain: ['agent-1'],
|
|
182
189
|
}
|
|
183
190
|
|
|
184
|
-
expect(minimalState.tenantId).
|
|
191
|
+
expect(minimalState.tenantId).toBe(ROOT_TENANT)
|
|
185
192
|
expect(minimalState.metadata).toBeUndefined()
|
|
186
193
|
expect(minimalState.services).toBeUndefined()
|
|
187
194
|
expect(minimalState.parentChain).toEqual(['agent-1'])
|
|
188
195
|
})
|
|
189
196
|
|
|
190
|
-
it('
|
|
197
|
+
it('handles metadata with various types', () => {
|
|
191
198
|
const metadata = {
|
|
192
199
|
userId: 'user-123',
|
|
193
200
|
count: 42,
|
|
@@ -197,6 +204,7 @@ describe('InvocationState', () => {
|
|
|
197
204
|
}
|
|
198
205
|
|
|
199
206
|
const state: InvocationState = {
|
|
207
|
+
tenantId: ROOT_TENANT,
|
|
200
208
|
metadata,
|
|
201
209
|
}
|
|
202
210
|
|
|
@@ -14,8 +14,12 @@ import type { TenantId } from '../ids/index.js'
|
|
|
14
14
|
* - Tools can access state via ToolContext.invocationState
|
|
15
15
|
*/
|
|
16
16
|
export interface InvocationState {
|
|
17
|
-
/**
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Isolation boundary — required in 0.2.0 per session-hierarchy.md §12.1.
|
|
19
|
+
* Every store accessor downstream branches on this id; omission is a
|
|
20
|
+
* compile-time error.
|
|
21
|
+
*/
|
|
22
|
+
readonly tenantId: TenantId
|
|
19
23
|
|
|
20
24
|
/** Request-scoped metadata (user info, session, correlation IDs, etc.) */
|
|
21
25
|
readonly metadata?: Readonly<Record<string, unknown>>
|
|
@@ -27,6 +31,15 @@ export interface InvocationState {
|
|
|
27
31
|
readonly parentChain?: readonly string[]
|
|
28
32
|
}
|
|
29
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Params for {@link deriveChildState} when the parent is absent. `tenantId`
|
|
36
|
+
* is required even at the top level — the kernel refuses to guess tenant
|
|
37
|
+
* identity (session-hierarchy.md §12.1).
|
|
38
|
+
*/
|
|
39
|
+
export interface DeriveChildStateRoot {
|
|
40
|
+
readonly tenantId: TenantId
|
|
41
|
+
}
|
|
42
|
+
|
|
30
43
|
/**
|
|
31
44
|
* Create a child invocation state with the current agent appended to parentChain.
|
|
32
45
|
*
|
|
@@ -34,22 +47,25 @@ export interface InvocationState {
|
|
|
34
47
|
* to sub-agents. It ensures the full agent hierarchy is tracked for debugging,
|
|
35
48
|
* logging, and tenant isolation validation.
|
|
36
49
|
*
|
|
37
|
-
*
|
|
50
|
+
* When `parent` is undefined (top-level agent), a minimal root context is
|
|
51
|
+
* required so `tenantId` can be seeded — see {@link DeriveChildStateRoot}.
|
|
52
|
+
* `InvocationState.tenantId` is required in 0.2.0 (§12.1).
|
|
53
|
+
*
|
|
54
|
+
* @param parent The parent invocation state, or a root seed carrying `tenantId`.
|
|
38
55
|
* @param currentAgentId The ID of the agent making the delegation
|
|
39
56
|
* @returns A new InvocationState with currentAgentId appended to parentChain
|
|
40
57
|
*/
|
|
41
58
|
export function deriveChildState(
|
|
42
|
-
parent: InvocationState |
|
|
59
|
+
parent: InvocationState | DeriveChildStateRoot,
|
|
43
60
|
currentAgentId: string,
|
|
44
61
|
): InvocationState {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
: [currentAgentId]
|
|
62
|
+
const existingChain = 'parentChain' in parent ? parent.parentChain : undefined
|
|
63
|
+
const parentChain = existingChain ? [...existingChain, currentAgentId] : [currentAgentId]
|
|
48
64
|
|
|
49
65
|
return {
|
|
50
|
-
tenantId: parent
|
|
51
|
-
metadata: parent
|
|
52
|
-
services: parent
|
|
66
|
+
tenantId: parent.tenantId,
|
|
67
|
+
metadata: 'metadata' in parent ? parent.metadata : undefined,
|
|
68
|
+
services: 'services' in parent ? parent.services : undefined,
|
|
53
69
|
parentChain,
|
|
54
70
|
}
|
|
55
71
|
}
|
package/src/types/run/config.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ModelPricing } from '../../utils/cost.js'
|
|
2
2
|
import type { Logger } from '../../utils/logger.js'
|
|
3
|
-
import type { RunId } from '../ids/index.js'
|
|
3
|
+
import type { RunId, SessionId, TenantId } from '../ids/index.js'
|
|
4
4
|
import type { PermissionMode } from '../permission/index.js'
|
|
5
|
+
import type { ProjectId } from '../session/ids.js'
|
|
5
6
|
|
|
6
7
|
export interface AgentRunConfig {
|
|
7
8
|
model: string
|
|
@@ -20,6 +21,12 @@ export interface AgentRunConfig {
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Config for {@link RunPersistence}. Phase 6 promotes `sessionId`, `tenantId`,
|
|
26
|
+
* and `projectId` to required — every Run must be attributed to a Session
|
|
27
|
+
* under a Project within a Tenant (session-hierarchy.md §12.1). The legacy
|
|
28
|
+
* `threadId`-only shape is gone.
|
|
29
|
+
*/
|
|
23
30
|
export interface RunPersistenceConfig {
|
|
24
31
|
runId: RunId
|
|
25
32
|
agentId: string
|
|
@@ -30,6 +37,10 @@ export interface RunPersistenceConfig {
|
|
|
30
37
|
pricing?: ModelPricing
|
|
31
38
|
log: Logger
|
|
32
39
|
|
|
40
|
+
sessionId: SessionId
|
|
41
|
+
tenantId: TenantId
|
|
42
|
+
projectId: ProjectId
|
|
43
|
+
|
|
33
44
|
parentRunId?: RunId
|
|
34
45
|
|
|
35
46
|
depth?: number
|
package/src/types/run/events.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SubsessionIdledEvent,
|
|
3
|
+
SubsessionMessagedEvent,
|
|
4
|
+
SubsessionSpawnedEvent,
|
|
5
|
+
} from '../../session/events/index.js'
|
|
6
|
+
import type { Lineage } from '../../session/hierarchy/lineage.js'
|
|
1
7
|
import type { ActivityStatus, ActivityType } from '../activity/index.js'
|
|
2
8
|
import type { BaseAgentResult } from '../agent/base.js'
|
|
3
9
|
import type { CostInfo, TokenUsage } from '../common/index.js'
|
|
@@ -9,7 +15,21 @@ import type { TaskStatus } from '../task/index.js'
|
|
|
9
15
|
|
|
10
16
|
export type { StopReason } from './stop-reason.js'
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Additive envelope fields present on every {@link RunEvent} variant.
|
|
20
|
+
*
|
|
21
|
+
* Per session-hierarchy.md §10.1 evolution is additive and consumers filter
|
|
22
|
+
* by the `type` discriminator, never by field shape. 0.2.0+ emitters stamp
|
|
23
|
+
* `schemaVersion: 2`; older untagged events are treated as virtually v1 by
|
|
24
|
+
* readers. `lineage` is populated on sub-session emissions (§10.4) and left
|
|
25
|
+
* absent on root-session events.
|
|
26
|
+
*/
|
|
27
|
+
interface RunEventEnvelope {
|
|
28
|
+
schemaVersion?: 2
|
|
29
|
+
lineage?: Lineage
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type CoreRunEvent =
|
|
13
33
|
| { type: 'run_started'; runId: RunId; systemPrompt?: string }
|
|
14
34
|
| { type: 'iteration_started'; runId: RunId; iteration: number }
|
|
15
35
|
| {
|
|
@@ -174,4 +194,19 @@ export type RunEvent =
|
|
|
174
194
|
}
|
|
175
195
|
| { type: 'sandbox_destroyed'; runId: RunId; sandboxId: SandboxId }
|
|
176
196
|
|
|
197
|
+
/**
|
|
198
|
+
* Discriminated union of all run-scoped events emitted by the kernel.
|
|
199
|
+
*
|
|
200
|
+
* Convention #16: `type` is the sole discriminator for exhaustive switches;
|
|
201
|
+
* envelope fields (`schemaVersion`, `lineage`) are additive and never
|
|
202
|
+
* participate in discrimination. Sub-session lifecycle variants
|
|
203
|
+
* (`subsession_spawned`, `subsession_messaged`, `subsession_idled`) carry a
|
|
204
|
+
* required `lineage` — see session-hierarchy.md §10.4.
|
|
205
|
+
*/
|
|
206
|
+
export type RunEvent =
|
|
207
|
+
| (CoreRunEvent & RunEventEnvelope)
|
|
208
|
+
| SubsessionSpawnedEvent
|
|
209
|
+
| SubsessionMessagedEvent
|
|
210
|
+
| SubsessionIdledEvent
|
|
211
|
+
|
|
177
212
|
export type RunEventListener = (event: RunEvent) => void | Promise<void>
|
package/src/types/run/index.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
export * from './stop-reason.js'
|
|
2
2
|
export * from './config.js'
|
|
3
3
|
export * from './state.js'
|
|
4
|
+
// Note: `./status.js` is intentionally NOT re-exported via `export *` from
|
|
5
|
+
// this barrel — the domain `RunStatus` type (session-hierarchy.md §4.6)
|
|
6
|
+
// shares its name with the deprecated wire alias `RunStatus` in
|
|
7
|
+
// `contracts/api.ts` (the canonical wire name is now `WireRunStatus`, see
|
|
8
|
+
// Task 10 Phase 9). The root barrel re-exports the domain `RunStatus`
|
|
9
|
+
// explicitly via `export type { RunStatus } from './types/run/status.js'`
|
|
10
|
+
// so external consumers of `@namzu/sdk` land on the domain enum while
|
|
11
|
+
// `@namzu/contracts` continues to own the wire shape.
|
|
4
12
|
export * from './events.js'
|
|
5
13
|
export * from './metadata.js'
|
|
6
14
|
export * from './emergency.js'
|
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
import type { AgentStatus, CostInfo, TokenUsage } from '../common/index.js'
|
|
2
|
-
import type { RunId, TaskId, ThreadId } from '../ids/index.js'
|
|
2
|
+
import type { RunId, TaskId, TenantId, ThreadId } from '../ids/index.js'
|
|
3
|
+
import type { ProjectId } from '../session/ids.js'
|
|
3
4
|
import type { StopReason } from './stop-reason.js'
|
|
4
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Denormalized metadata for a run.
|
|
8
|
+
*
|
|
9
|
+
* See session-hierarchy.md §4.6, §10.1, and §12.1.
|
|
10
|
+
*
|
|
11
|
+
* 0.2.0 promotes `projectId` and `tenantId` to required fields. `threadId`
|
|
12
|
+
* remains as a deprecated mirror of `projectId` for the 0.2.x migration
|
|
13
|
+
* window — consumers should prefer `projectId` and fall back to `threadId`
|
|
14
|
+
* only for legacy records. 0.3.x removes `threadId` entirely (§13.1).
|
|
15
|
+
*/
|
|
5
16
|
export interface RunMetadata {
|
|
6
17
|
id: RunId
|
|
18
|
+
/**
|
|
19
|
+
* Long-lived goal scope. Required in 0.2.0. Replaces the root-scope role
|
|
20
|
+
* `threadId` played in 0.1.x.
|
|
21
|
+
*/
|
|
22
|
+
projectId: ProjectId
|
|
23
|
+
/** Isolation boundary (Convention #17). Required in 0.2.0. */
|
|
24
|
+
tenantId: TenantId
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Use {@link RunMetadata.projectId}. Mirror retained for the
|
|
27
|
+
* 0.2.x migration window; scheduled for removal in 0.3.0 per
|
|
28
|
+
* session-hierarchy.md §13.1.
|
|
29
|
+
*/
|
|
7
30
|
threadId: ThreadId
|
|
8
31
|
agentId: string
|
|
9
32
|
agentName: string
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain Run status enum. See session-hierarchy.md §4.6 + §5.2 state machine.
|
|
3
|
+
*
|
|
4
|
+
* Distinct from the wire-side {@link WireRunStatus} in `contracts/api.ts`,
|
|
5
|
+
* which maps these states onto HTTP payload shapes (`completed` /
|
|
6
|
+
* `cancelling` / `expired`). Keep this enum purely the domain surface; any
|
|
7
|
+
* consumer that needs the HTTP representation should translate at the bridge
|
|
8
|
+
* boundary.
|
|
9
|
+
*
|
|
10
|
+
* Variants:
|
|
11
|
+
* - `queued` — run created, not yet started.
|
|
12
|
+
* - `running` — iteration loop in flight.
|
|
13
|
+
* - `awaiting_hitl` — synchronous-wait on a HITL gate (user present).
|
|
14
|
+
* - `awaiting_hitl_resolution` — persisted-wait after a HITL timeout under
|
|
15
|
+
* `HITLConfig.onTimeout = 'pause_run_until_resolved'`. User absent; Run
|
|
16
|
+
* persists until resolved or cancelled (permission-policies.md §13.3).
|
|
17
|
+
* - `awaiting_subsession` — parent Run has delegated to a child SubSession
|
|
18
|
+
* and is suspended until the Materializer seals the child's summary.
|
|
19
|
+
* Session-level fan-in treats this as `active` (delegation in flight
|
|
20
|
+
* means the parent IS active). See session-hierarchy.md §5.1.
|
|
21
|
+
* - `succeeded` — terminal, run completed without error.
|
|
22
|
+
* - `failed` — terminal, run errored out.
|
|
23
|
+
* - `cancelled` — terminal, explicitly cancelled.
|
|
24
|
+
*/
|
|
25
|
+
export type RunStatus =
|
|
26
|
+
| 'queued'
|
|
27
|
+
| 'running'
|
|
28
|
+
| 'awaiting_hitl'
|
|
29
|
+
| 'awaiting_hitl_resolution'
|
|
30
|
+
| 'awaiting_subsession'
|
|
31
|
+
| 'succeeded'
|
|
32
|
+
| 'failed'
|
|
33
|
+
| 'cancelled'
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session hierarchy branded ID re-export barrel.
|
|
3
|
+
*
|
|
4
|
+
* Canonical definitions live in `../ids/index.ts` (Phase 9 Known Delta #4
|
|
5
|
+
* collapse: previously this file declared ProjectId/SubSessionId/etc. and
|
|
6
|
+
* `types/ids/` re-exported them — a circular re-export that TypeScript
|
|
7
|
+
* resolved cleanly but smelled). All session IDs now live in one place;
|
|
8
|
+
* this barrel exists solely for ergonomic co-location with session-scoped
|
|
9
|
+
* callers (they already import from `types/session/`).
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export type {
|
|
13
|
+
ProjectId,
|
|
14
|
+
SubSessionId,
|
|
15
|
+
HandoffId,
|
|
16
|
+
WorkspaceId,
|
|
17
|
+
SummaryId,
|
|
18
|
+
DeliverableId,
|
|
19
|
+
SessionId,
|
|
20
|
+
TenantId,
|
|
21
|
+
RunId,
|
|
22
|
+
AgentId,
|
|
23
|
+
UserId,
|
|
24
|
+
TaskId,
|
|
25
|
+
ThreadId,
|
|
26
|
+
} from '../ids/index.js'
|
|
27
|
+
|
|
28
|
+
import type { ProjectId } from '../ids/index.js'
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Use {@link ProjectId}. Alias kept for one version migration
|
|
32
|
+
* window; scheduled for removal in 0.3.0 per session-hierarchy.md §13.3.1.
|
|
33
|
+
*/
|
|
34
|
+
export type ThreadIdDeprecated = ProjectId
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Sub-barrel for session-hierarchy type surface.
|
|
2
|
+
// Concrete definitions live in sibling files; re-export them here so other
|
|
3
|
+
// modules import via `../types/session/index.js`.
|
|
4
|
+
|
|
5
|
+
export type {
|
|
6
|
+
ProjectId,
|
|
7
|
+
SubSessionId,
|
|
8
|
+
HandoffId,
|
|
9
|
+
WorkspaceId,
|
|
10
|
+
SummaryId,
|
|
11
|
+
DeliverableId,
|
|
12
|
+
SessionId,
|
|
13
|
+
TenantId,
|
|
14
|
+
RunId,
|
|
15
|
+
AgentId,
|
|
16
|
+
UserId,
|
|
17
|
+
TaskId,
|
|
18
|
+
ThreadId,
|
|
19
|
+
ThreadIdDeprecated,
|
|
20
|
+
} from './ids.js'
|
|
21
|
+
|
|
22
|
+
export type {
|
|
23
|
+
SessionStore,
|
|
24
|
+
SessionView,
|
|
25
|
+
CreateProjectParams,
|
|
26
|
+
CreateSessionParams,
|
|
27
|
+
CreateSubSessionParams,
|
|
28
|
+
} from './store.js'
|