@namzu/sdk 0.1.7 → 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 +23 -5
- package/README.md +14 -9
- 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
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SessionStore — canonical persistence contract for the session hierarchy.
|
|
3
|
+
*
|
|
4
|
+
* Replaces `ConversationStore` (deprecated; `types/conversation/index.ts`).
|
|
5
|
+
* Per session-hierarchy.md §4 Entity Model, §10.4 Parent-Child Linkage, §12
|
|
6
|
+
* Multi-Tenant and Security — every accessor takes explicit {@link TenantId}
|
|
7
|
+
* (Convention #17). Cross-tenant access rejects with `TenantIsolationError`.
|
|
8
|
+
*
|
|
9
|
+
* Minimum surface — covers downstream phases 4 (handoff), 5 (summary), and
|
|
10
|
+
* 6 (sub-session spawn) plus the drill primitive (§14.3). Extensions land in
|
|
11
|
+
* paired phases alongside their consumers (Convention #0: no speculative API).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type { ActorRef } from '../../session/hierarchy/actor.js'
|
|
15
|
+
import type { Project } from '../../session/hierarchy/project.js'
|
|
16
|
+
import type { Session } from '../../session/hierarchy/session.js'
|
|
17
|
+
import type {
|
|
18
|
+
CompletionMode,
|
|
19
|
+
FailureMode,
|
|
20
|
+
SubSession,
|
|
21
|
+
SubSessionKind,
|
|
22
|
+
} from '../../session/hierarchy/sub-session.js'
|
|
23
|
+
import type { SessionSummaryRef } from '../../session/summary/ref.js'
|
|
24
|
+
import type { SessionMessage } from '../../store/session/messages.js'
|
|
25
|
+
import type { MessageId, SessionId, TenantId } from '../ids/index.js'
|
|
26
|
+
import type { Message } from '../message/index.js'
|
|
27
|
+
import type { ProjectId, SubSessionId, SummaryId } from '../session/ids.js'
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Params for {@link SessionStore.createSession}. The store owns id generation,
|
|
31
|
+
* `ownerVersion` initialization, and timestamps. See session-hierarchy.md §4.3.
|
|
32
|
+
*/
|
|
33
|
+
export interface CreateSessionParams {
|
|
34
|
+
projectId: ProjectId
|
|
35
|
+
/**
|
|
36
|
+
* Initial owner of the session. May be `null` for bootstrap scenarios where
|
|
37
|
+
* the first Run attaches an actor; the store rejects mutations against
|
|
38
|
+
* actor-less sessions from downstream consumers.
|
|
39
|
+
*/
|
|
40
|
+
currentActor: ActorRef | null
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Params for {@link SessionStore.createSubSession}. `workspaceId` is optional
|
|
45
|
+
* because Phase 3 does not yet wire workspace creation into spawn — Phase 6
|
|
46
|
+
* makes the two atomic. `summaryRef` is populated by the materializer in
|
|
47
|
+
* Phase 5, never by callers of this API.
|
|
48
|
+
*/
|
|
49
|
+
export interface CreateSubSessionParams {
|
|
50
|
+
parentSessionId: SessionId
|
|
51
|
+
childSessionId: SessionId
|
|
52
|
+
kind: SubSessionKind
|
|
53
|
+
spawnedBy: ActorRef
|
|
54
|
+
failureMode?: FailureMode
|
|
55
|
+
completionMode?: CompletionMode
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Minimal Project surface needed by the store in Phase 3. The full Project
|
|
60
|
+
* entity lives in `session/hierarchy/project.ts`; a dedicated `ProjectStore`
|
|
61
|
+
* is out of scope for this phase (session-hierarchy.md §11 defers the project
|
|
62
|
+
* store to a later phase).
|
|
63
|
+
*/
|
|
64
|
+
export interface CreateProjectParams {
|
|
65
|
+
tenantId: TenantId
|
|
66
|
+
name: string
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Return shape for {@link SessionStore.drill}. See session-hierarchy.md §14.3.
|
|
71
|
+
* The fields are final — consumers may rely on exhaustiveness (Convention #6).
|
|
72
|
+
*
|
|
73
|
+
* `ancestry` is root-to-self. `children` lists direct sub-sessions only
|
|
74
|
+
* (recursive drill-down is the consumer's responsibility).
|
|
75
|
+
*/
|
|
76
|
+
export interface SessionView {
|
|
77
|
+
session: Session
|
|
78
|
+
children: readonly SubSession[]
|
|
79
|
+
ancestry: readonly SessionId[]
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Canonical persistence contract. Every accessor takes explicit `tenantId`.
|
|
84
|
+
* Cross-tenant reads/writes must reject with `TenantIsolationError`
|
|
85
|
+
* (see `session/errors.ts`).
|
|
86
|
+
*
|
|
87
|
+
* Read accessors return `null` when the resource does not exist for the
|
|
88
|
+
* supplied tenant — this is the deny-by-default surface (Convention #5):
|
|
89
|
+
* callers never get a fallback and must branch on missing explicitly.
|
|
90
|
+
*/
|
|
91
|
+
export interface SessionStore {
|
|
92
|
+
// Project CRUD ------------------------------------------------------------
|
|
93
|
+
|
|
94
|
+
createProject(params: CreateProjectParams, tenantId: TenantId): Promise<Project>
|
|
95
|
+
|
|
96
|
+
getProject(projectId: ProjectId, tenantId: TenantId): Promise<Project | null>
|
|
97
|
+
|
|
98
|
+
// Session CRUD ------------------------------------------------------------
|
|
99
|
+
|
|
100
|
+
createSession(params: CreateSessionParams, tenantId: TenantId): Promise<Session>
|
|
101
|
+
|
|
102
|
+
getSession(sessionId: SessionId, tenantId: TenantId): Promise<Session | null>
|
|
103
|
+
|
|
104
|
+
updateSession(session: Session, tenantId: TenantId): Promise<void>
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Hard-delete a session. Idempotent — absent sessions succeed as a no-op.
|
|
108
|
+
* Rejects with `TenantIsolationError` on cross-tenant access.
|
|
109
|
+
*
|
|
110
|
+
* Closes the Phase 4 Known Delta (broadcast rollback previously had to
|
|
111
|
+
* flip status to `'archived'` as a stopgap). Used by:
|
|
112
|
+
* - Broadcast rollback (compensating cleanup — pattern doc §6.2)
|
|
113
|
+
* - Archival tombstone consolidation when a caller prefers deletion
|
|
114
|
+
* over the in-slot tombstone (uncommon — default is in-slot).
|
|
115
|
+
*
|
|
116
|
+
* Policy: rejects when the session still has sub-sessions attached —
|
|
117
|
+
* callers must delete children first. This keeps the operation a single,
|
|
118
|
+
* locally-reasoning write rather than an implicit recursive cascade
|
|
119
|
+
* (Convention #5 deny-by-default).
|
|
120
|
+
*/
|
|
121
|
+
deleteSession(sessionId: SessionId, tenantId: TenantId): Promise<void>
|
|
122
|
+
|
|
123
|
+
// SubSession CRUD ---------------------------------------------------------
|
|
124
|
+
|
|
125
|
+
createSubSession(params: CreateSubSessionParams, tenantId: TenantId): Promise<SubSession>
|
|
126
|
+
|
|
127
|
+
getSubSession(subSessionId: SubSessionId, tenantId: TenantId): Promise<SubSession | null>
|
|
128
|
+
|
|
129
|
+
updateSubSession(subSession: SubSession, tenantId: TenantId): Promise<void>
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Hard-delete a sub-session record. Idempotent — absent sub-sessions
|
|
133
|
+
* succeed as a no-op. Rejects with `TenantIsolationError` on cross-tenant
|
|
134
|
+
* access. Does not cascade to the owned child session; the caller owns
|
|
135
|
+
* that (typical broadcast-rollback flow deletes the sub-session first,
|
|
136
|
+
* then the child session).
|
|
137
|
+
*/
|
|
138
|
+
deleteSubSession(subSessionId: SubSessionId, tenantId: TenantId): Promise<void>
|
|
139
|
+
|
|
140
|
+
// Messages (replaces ConversationStore surface) ---------------------------
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Append a single message to the session's message log. Returns the
|
|
144
|
+
* assigned {@link MessageId}. Write is append-only; the store never
|
|
145
|
+
* rewrites or reorders previously persisted messages.
|
|
146
|
+
*/
|
|
147
|
+
appendMessage(sessionId: SessionId, message: Message, tenantId: TenantId): Promise<MessageId>
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Load the full message history for a session in insertion order.
|
|
151
|
+
* Returns an empty array when the session has no messages.
|
|
152
|
+
*
|
|
153
|
+
* Returns payload-only {@link Message} records. Callers that need the
|
|
154
|
+
* full persistence envelope (including {@link MessageId} and timestamp)
|
|
155
|
+
* should use {@link SessionStore.loadSessionMessages} instead.
|
|
156
|
+
*/
|
|
157
|
+
loadMessages(sessionId: SessionId, tenantId: TenantId): Promise<readonly Message[]>
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Load the full {@link SessionMessage} envelope for every persisted
|
|
161
|
+
* message in insertion order (Phase 9 Known Delta #7). Unlike
|
|
162
|
+
* {@link SessionStore.loadMessages} this preserves the original
|
|
163
|
+
* {@link MessageId} and timestamp — required for full-fidelity archival
|
|
164
|
+
* round-trips via {@link ArchivalManager.archive}.
|
|
165
|
+
*
|
|
166
|
+
* Returns an empty array when the session has no messages; cross-tenant
|
|
167
|
+
* reads reject with `TenantIsolationError` (Convention #17).
|
|
168
|
+
*/
|
|
169
|
+
loadSessionMessages(sessionId: SessionId, tenantId: TenantId): Promise<readonly SessionMessage[]>
|
|
170
|
+
|
|
171
|
+
// Linkage (pattern doc §10.4 / §14.3) ------------------------------------
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Direct children of the session (one level). Returns an empty array when
|
|
175
|
+
* the session has no delegations.
|
|
176
|
+
*/
|
|
177
|
+
getChildren(sessionId: SessionId, tenantId: TenantId): Promise<readonly SubSession[]>
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Session id chain from root to self, inclusive. Walks parent sub-session
|
|
181
|
+
* links. Rejects on cycle via `session/errors.ts#AncestryCycleError` —
|
|
182
|
+
* the write path enforces acyclicity, so a cycle here indicates store
|
|
183
|
+
* corruption.
|
|
184
|
+
*/
|
|
185
|
+
getAncestry(sessionId: SessionId, tenantId: TenantId): Promise<readonly SessionId[]>
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Single-round navigation primitive. Returns `null` when the session does
|
|
189
|
+
* not exist for the tenant. See session-hierarchy.md §14.3.
|
|
190
|
+
*/
|
|
191
|
+
drill(sessionId: SessionId, tenantId: TenantId): Promise<SessionView | null>
|
|
192
|
+
|
|
193
|
+
// Summary (pattern doc §4.7 / §8.1) --------------------------------------
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @internal Kernel-internal. Call through
|
|
197
|
+
* `SessionSummaryMaterializer.materialize`, never directly. The
|
|
198
|
+
* `materializedBy: 'kernel'` constraint on the argument type ensures
|
|
199
|
+
* external callers cannot construct a valid input — the only mint site for
|
|
200
|
+
* `SummaryId` is `generateSummaryId` inside the Materializer.
|
|
201
|
+
*
|
|
202
|
+
* Atomic write-then-status-flip (Convention #8): persists the summary and
|
|
203
|
+
* transitions the owning Session's status to `'idle'` if it was in a
|
|
204
|
+
* non-terminal state (`'active' | 'locked' | 'awaiting_merge'`). The two
|
|
205
|
+
* writes commit as one logical unit; mid-crash recovery is replay via
|
|
206
|
+
* `SessionSummaryMaterializer.recover()`.
|
|
207
|
+
*
|
|
208
|
+
* Rejects with {@link SessionAlreadySummarizedError} if a summary already
|
|
209
|
+
* exists for the session (re-materialization forbidden; see
|
|
210
|
+
* session-hierarchy.md §4.7 immutability invariant).
|
|
211
|
+
*/
|
|
212
|
+
recordSummary(
|
|
213
|
+
summary: SessionSummaryRef & { materializedBy: 'kernel' },
|
|
214
|
+
tenantId: TenantId,
|
|
215
|
+
): Promise<void>
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Loads the persisted summary for a session. Returns `null` when none has
|
|
219
|
+
* been materialized. Cross-tenant reads reject with `TenantIsolationError`
|
|
220
|
+
* (Convention #17).
|
|
221
|
+
*/
|
|
222
|
+
getSummary(sessionId: SessionId, tenantId: TenantId): Promise<SessionSummaryRef | null>
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Re-export of {@link SummaryId} so downstream consumers importing from
|
|
227
|
+
* `types/session/store.js` pick up the brand alongside the store contract.
|
|
228
|
+
*/
|
|
229
|
+
export type { SummaryId }
|
package/src/utils/id.ts
CHANGED
|
@@ -8,10 +8,12 @@ import type {
|
|
|
8
8
|
ConnectorId,
|
|
9
9
|
ConnectorInstanceId,
|
|
10
10
|
CredentialId,
|
|
11
|
+
DeliverableId,
|
|
11
12
|
DocumentId,
|
|
12
13
|
EmergencySaveId,
|
|
13
14
|
EnvironmentId,
|
|
14
15
|
ExecutionContextId,
|
|
16
|
+
HandoffId,
|
|
15
17
|
KnowledgeBaseId,
|
|
16
18
|
MCPClientId,
|
|
17
19
|
MCPServerId,
|
|
@@ -20,13 +22,17 @@ import type {
|
|
|
20
22
|
MessageId,
|
|
21
23
|
PlanId,
|
|
22
24
|
PluginId,
|
|
25
|
+
ProjectId,
|
|
23
26
|
RunId,
|
|
24
27
|
SandboxId,
|
|
25
28
|
SessionId,
|
|
29
|
+
SubSessionId,
|
|
30
|
+
SummaryId,
|
|
26
31
|
TaskId,
|
|
27
32
|
TenantId,
|
|
28
33
|
ThreadId,
|
|
29
34
|
ToolCallId,
|
|
35
|
+
WorkspaceId,
|
|
30
36
|
} from '../types/ids/index.js'
|
|
31
37
|
|
|
32
38
|
const ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz'
|
|
@@ -49,8 +55,17 @@ function generateId<T extends string>(prefix: T, length = 12): `${T}${string}` {
|
|
|
49
55
|
return `${prefix}${suffix}` as `${T}${string}`
|
|
50
56
|
}
|
|
51
57
|
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Prefer {@link generateProjectId}. `ThreadId` is an alias of
|
|
60
|
+
* `ProjectId` during the 0.2.x migration window; this helper emits the new
|
|
61
|
+
* `prj_` prefix and will be removed in 0.3.0. See session-hierarchy.md §13.
|
|
62
|
+
*/
|
|
52
63
|
export function generateThreadId(): ThreadId {
|
|
53
|
-
return generateId('
|
|
64
|
+
return generateId('prj_')
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function generateProjectId(): ProjectId {
|
|
68
|
+
return generateId('prj_')
|
|
54
69
|
}
|
|
55
70
|
|
|
56
71
|
export function generateRunId(): RunId {
|
|
@@ -62,7 +77,7 @@ export function generateMessageId(): MessageId {
|
|
|
62
77
|
}
|
|
63
78
|
|
|
64
79
|
export function generateSessionId(): SessionId {
|
|
65
|
-
return generateId('
|
|
80
|
+
return generateId('ses_')
|
|
66
81
|
}
|
|
67
82
|
|
|
68
83
|
export function generateToolCallId(): ToolCallId {
|
|
@@ -102,7 +117,7 @@ export function generateConnectorInstanceId(): ConnectorInstanceId {
|
|
|
102
117
|
}
|
|
103
118
|
|
|
104
119
|
export function generateTenantId(): TenantId {
|
|
105
|
-
return generateId('
|
|
120
|
+
return generateId('tnt_')
|
|
106
121
|
}
|
|
107
122
|
|
|
108
123
|
export function generateCredentialId(): CredentialId {
|
|
@@ -157,6 +172,26 @@ export function generateSandboxId(): SandboxId {
|
|
|
157
172
|
return generateId('sbx_')
|
|
158
173
|
}
|
|
159
174
|
|
|
175
|
+
export function generateWorkspaceId(): WorkspaceId {
|
|
176
|
+
return generateId('wsp_')
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export function generateSubSessionId(): SubSessionId {
|
|
180
|
+
return generateId('sub_')
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export function generateSummaryId(): SummaryId {
|
|
184
|
+
return generateId('sum_')
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export function generateHandoffId(): HandoffId {
|
|
188
|
+
return generateId('hof_')
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export function generateDeliverableId(): DeliverableId {
|
|
192
|
+
return generateId('del_')
|
|
193
|
+
}
|
|
194
|
+
|
|
160
195
|
function parseId<T extends string>(raw: string, prefix: string, typeName: string): T {
|
|
161
196
|
if (!raw.startsWith(prefix)) {
|
|
162
197
|
throw new Error(`Invalid ${typeName}: expected "${prefix}" prefix, got "${raw}"`)
|
|
@@ -164,8 +199,24 @@ function parseId<T extends string>(raw: string, prefix: string, typeName: string
|
|
|
164
199
|
return raw as T
|
|
165
200
|
}
|
|
166
201
|
|
|
202
|
+
/**
|
|
203
|
+
* @deprecated Parses either the legacy `thd_*` prefix or the new `prj_*`
|
|
204
|
+
* prefix during the 0.2.x migration window. 0.3.x will only accept `prj_*`.
|
|
205
|
+
* See session-hierarchy.md §13.3.1.
|
|
206
|
+
*/
|
|
167
207
|
export function parseThreadId(raw: string): ThreadId {
|
|
168
|
-
|
|
208
|
+
if (raw.startsWith('prj_')) {
|
|
209
|
+
return raw as ThreadId
|
|
210
|
+
}
|
|
211
|
+
if (raw.startsWith('thd_')) {
|
|
212
|
+
// Read-accept legacy prefix; a proper coercion pipeline lands in Phase 7.
|
|
213
|
+
return raw as unknown as ThreadId
|
|
214
|
+
}
|
|
215
|
+
throw new Error(`Invalid ThreadId: expected "prj_" or "thd_" prefix, got "${raw}"`)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export function parseProjectId(raw: string): ProjectId {
|
|
219
|
+
return parseId<ProjectId>(raw, 'prj_', 'ProjectId')
|
|
169
220
|
}
|
|
170
221
|
export function parseRunId(raw: string): RunId {
|
|
171
222
|
return parseId<RunId>(raw, 'run_', 'RunId')
|