@namzu/sdk 0.1.8 → 0.3.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 +69 -2
- package/dist/agents/ReactiveAgent.d.ts.map +1 -1
- package/dist/agents/ReactiveAgent.js +5 -2
- 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 +21 -5
- package/dist/agents/SupervisorAgent.js.map +1 -1
- package/dist/bridge/a2a/index.d.ts +1 -1
- package/dist/bridge/a2a/index.d.ts.map +1 -1
- package/dist/bridge/a2a/index.js +1 -1
- package/dist/bridge/a2a/index.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/message.d.ts +0 -2
- package/dist/bridge/a2a/message.d.ts.map +1 -1
- package/dist/bridge/a2a/message.js +0 -26
- package/dist/bridge/a2a/message.js.map +1 -1
- package/dist/bridge/a2a/task.d.ts +5 -4
- package/dist/bridge/a2a/task.d.ts.map +1 -1
- package/dist/bridge/a2a/task.js +4 -4
- 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 +14 -27
- package/dist/contracts/api.d.ts.map +1 -1
- package/dist/contracts/ids.d.ts +1 -1
- package/dist/contracts/ids.d.ts.map +1 -1
- package/dist/contracts/index.d.ts +3 -3
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +1 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/schemas.d.ts +1 -31
- package/dist/contracts/schemas.d.ts.map +1 -1
- package/dist/contracts/schemas.js +1 -7
- package/dist/contracts/schemas.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 +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- 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 +316 -0
- package/dist/manager/agent/__tests__/lifecycle.test.js.map +1 -0
- package/dist/manager/agent/lifecycle.d.ts +67 -3
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +375 -14
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/index.d.ts +2 -0
- package/dist/manager/index.d.ts.map +1 -1
- package/dist/manager/index.js +1 -0
- package/dist/manager/index.js.map +1 -1
- package/dist/manager/run/persistence.d.ts +10 -1
- package/dist/manager/run/persistence.d.ts.map +1 -1
- package/dist/manager/run/persistence.js +20 -0
- package/dist/manager/run/persistence.js.map +1 -1
- package/dist/manager/thread/__tests__/lifecycle.test.d.ts +2 -0
- package/dist/manager/thread/__tests__/lifecycle.test.d.ts.map +1 -0
- package/dist/manager/thread/__tests__/lifecycle.test.js +216 -0
- package/dist/manager/thread/__tests__/lifecycle.test.js.map +1 -0
- package/dist/manager/thread/lifecycle.d.ts +105 -0
- package/dist/manager/thread/lifecycle.d.ts.map +1 -0
- package/dist/manager/thread/lifecycle.js +186 -0
- package/dist/manager/thread/lifecycle.js.map +1 -0
- package/dist/rag/retriever.js +2 -2
- 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 +85 -0
- package/dist/runtime/query/__tests__/context.test.js.map +1 -0
- package/dist/runtime/query/context-cache.d.ts +3 -3
- package/dist/runtime/query/context-cache.d.ts.map +1 -1
- package/dist/runtime/query/context-cache.js +2 -2
- package/dist/runtime/query/context-cache.js.map +1 -1
- package/dist/runtime/query/context.d.ts +45 -1
- package/dist/runtime/query/context.d.ts.map +1 -1
- package/dist/runtime/query/context.js +50 -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 +22 -1
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +11 -0
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/session/__tests__/integration/_fixtures.d.ts +122 -0
- package/dist/session/__tests__/integration/_fixtures.d.ts.map +1 -0
- package/dist/session/__tests__/integration/_fixtures.js +215 -0
- package/dist/session/__tests__/integration/_fixtures.js.map +1 -0
- package/dist/session/__tests__/integration/archive-gate.test.d.ts +15 -0
- package/dist/session/__tests__/integration/archive-gate.test.d.ts.map +1 -0
- package/dist/session/__tests__/integration/archive-gate.test.js +214 -0
- package/dist/session/__tests__/integration/archive-gate.test.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 +123 -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 +238 -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 +330 -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 +182 -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 +156 -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 +179 -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 +158 -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 +242 -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 +187 -0
- package/dist/session/__tests__/integration/retention-archive.test.js.map +1 -0
- package/dist/session/__tests__/integration/spawn-rollback.test.d.ts +26 -0
- package/dist/session/__tests__/integration/spawn-rollback.test.d.ts.map +1 -0
- package/dist/session/__tests__/integration/spawn-rollback.test.js +236 -0
- package/dist/session/__tests__/integration/spawn-rollback.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 +201 -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 +189 -0
- package/dist/session/__tests__/integration/tenant-isolation.test.js.map +1 -0
- package/dist/session/errors.d.ts +139 -0
- package/dist/session/errors.d.ts.map +1 -0
- package/dist/session/errors.js +107 -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 +261 -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 +103 -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 +239 -0
- package/dist/session/handoff/__tests__/single.test.js.map +1 -0
- package/dist/session/handoff/assignment.d.ts +71 -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 +54 -0
- package/dist/session/handoff/broadcast.d.ts.map +1 -0
- package/dist/session/handoff/broadcast.js +311 -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 +69 -0
- package/dist/session/handoff/single.d.ts.map +1 -0
- package/dist/session/handoff/single.js +229 -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 +69 -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 +9 -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 +71 -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/hierarchy/thread.d.ts +54 -0
- package/dist/session/hierarchy/thread.d.ts.map +1 -0
- package/dist/session/hierarchy/thread.js +2 -0
- package/dist/session/hierarchy/thread.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 +93 -0
- package/dist/session/migration/id-prefix.d.ts.map +1 -0
- package/dist/session/migration/id-prefix.js +111 -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 +253 -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 +270 -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/index.d.ts +0 -2
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +0 -1
- package/dist/store/index.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 +267 -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 +258 -0
- package/dist/store/session/__tests__/memory.test.js.map +1 -0
- package/dist/store/session/disk.d.ts +86 -0
- package/dist/store/session/disk.d.ts.map +1 -0
- package/dist/store/session/disk.js +818 -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 +10 -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 +49 -0
- package/dist/store/session/memory.d.ts.map +1 -0
- package/dist/store/session/memory.js +335 -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/store/thread/disk.d.ts +41 -0
- package/dist/store/thread/disk.d.ts.map +1 -0
- package/dist/store/thread/disk.js +229 -0
- package/dist/store/thread/disk.js.map +1 -0
- package/dist/store/thread/index.d.ts +4 -0
- package/dist/store/thread/index.d.ts.map +1 -0
- package/dist/store/thread/index.js +6 -0
- package/dist/store/thread/index.js.map +1 -0
- package/dist/store/thread/memory.d.ts +23 -0
- package/dist/store/thread/memory.d.ts.map +1 -0
- package/dist/store/thread/memory.js +90 -0
- package/dist/store/thread/memory.js.map +1 -0
- package/dist/tools/builtins/__tests__/structuredOutput.example.d.ts +1 -1
- package/dist/types/agent/base.d.ts +24 -1
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/agent/factory.d.ts +8 -2
- package/dist/types/agent/factory.d.ts.map +1 -1
- package/dist/types/agent/task.d.ts +57 -2
- package/dist/types/agent/task.d.ts.map +1 -1
- package/dist/types/agent/task.js.map +1 -1
- package/dist/types/ids/index.d.ts +22 -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/rag/retrieval.d.ts +4 -3
- package/dist/types/rag/retrieval.d.ts.map +1 -1
- package/dist/types/run/config.d.ts +12 -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 +12 -2
- 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 +9 -0
- package/dist/types/session/ids.d.ts.map +1 -0
- package/dist/types/session/ids.js +9 -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 +210 -0
- package/dist/types/session/store.d.ts.map +1 -0
- package/dist/types/session/store.js +9 -0
- package/dist/types/session/store.js.map +1 -0
- package/dist/types/thread/index.d.ts +2 -0
- package/dist/types/thread/index.d.ts.map +1 -0
- package/dist/types/thread/index.js +5 -0
- package/dist/types/thread/index.js.map +1 -0
- package/dist/types/thread/store.d.ts +86 -0
- package/dist/types/thread/store.d.ts.map +1 -0
- package/dist/types/thread/store.js +22 -0
- package/dist/types/thread/store.js.map +1 -0
- package/dist/utils/id.d.ts +8 -2
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/id.js +22 -4
- package/dist/utils/id.js.map +1 -1
- package/package.json +6 -11
- package/src/agents/ReactiveAgent.ts +7 -2
- package/src/agents/RouterAgent.ts +5 -0
- package/src/agents/SupervisorAgent.ts +29 -6
- package/src/bridge/a2a/index.ts +0 -1
- package/src/bridge/a2a/mapper.ts +7 -0
- package/src/bridge/a2a/message.ts +0 -32
- package/src/bridge/a2a/task.ts +9 -8
- package/src/bridge/sse/mapper.ts +8 -1
- package/src/constants/a2a/index.ts +2 -2
- package/src/contracts/api.ts +14 -30
- package/src/contracts/ids.ts +1 -1
- package/src/contracts/index.ts +3 -7
- package/src/contracts/schemas.ts +1 -8
- package/src/gateway/local.ts +6 -0
- package/src/index.ts +14 -4
- package/src/manager/agent/__tests__/lifecycle.test.ts +473 -0
- package/src/manager/agent/lifecycle.ts +515 -21
- package/src/manager/index.ts +3 -0
- package/src/manager/run/persistence.ts +26 -1
- package/src/manager/thread/__tests__/lifecycle.test.ts +286 -0
- package/src/manager/thread/lifecycle.ts +217 -0
- package/src/rag/retriever.ts +2 -2
- package/src/run/reporter.ts +28 -0
- package/src/runtime/query/__tests__/context.test.ts +102 -0
- package/src/runtime/query/context-cache.ts +4 -4
- package/src/runtime/query/context.ts +98 -9
- package/src/runtime/query/events.ts +8 -0
- package/src/runtime/query/index.ts +38 -1
- package/src/session/__tests__/integration/_fixtures.ts +310 -0
- package/src/session/__tests__/integration/archive-gate.test.ts +288 -0
- package/src/session/__tests__/integration/capacity-caps.test.ts +171 -0
- package/src/session/__tests__/integration/e2e-spawn.test.ts +296 -0
- package/src/session/__tests__/integration/event-stream-ordering.test.ts +410 -0
- package/src/session/__tests__/integration/handoff-broadcast-e2e.test.ts +271 -0
- package/src/session/__tests__/integration/handoff-illegal-transition.test.ts +214 -0
- package/src/session/__tests__/integration/handoff-single-e2e.test.ts +251 -0
- package/src/session/__tests__/integration/hierarchy-lifecycle.test.ts +240 -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 +325 -0
- package/src/session/__tests__/integration/retention-archive.test.ts +233 -0
- package/src/session/__tests__/integration/spawn-rollback.test.ts +313 -0
- package/src/session/__tests__/integration/summary-materialization-e2e.test.ts +239 -0
- package/src/session/__tests__/integration/tenant-isolation.test.ts +292 -0
- package/src/session/errors.ts +159 -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 +378 -0
- package/src/session/handoff/__tests__/capacity.test.ts +129 -0
- package/src/session/handoff/__tests__/single.test.ts +333 -0
- package/src/session/handoff/assignment.ts +74 -0
- package/src/session/handoff/broadcast.ts +406 -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 +310 -0
- package/src/session/handoff/version.ts +59 -0
- package/src/session/hierarchy/__tests__/session.test.ts +100 -0
- package/src/session/hierarchy/actor.ts +17 -0
- package/src/session/hierarchy/index.ts +18 -0
- package/src/session/hierarchy/lineage.ts +15 -0
- package/src/session/hierarchy/project.ts +41 -0
- package/src/session/hierarchy/session.ts +109 -0
- package/src/session/hierarchy/sub-session.ts +92 -0
- package/src/session/hierarchy/tenant.ts +13 -0
- package/src/session/hierarchy/thread.ts +55 -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 +141 -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 +318 -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 +343 -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/index.ts +0 -3
- package/src/store/session/__tests__/disk.test.ts +397 -0
- package/src/store/session/__tests__/memory.test.ts +402 -0
- package/src/store/session/disk.ts +976 -0
- package/src/store/session/index.ts +13 -0
- package/src/store/session/linkage.ts +80 -0
- package/src/store/session/memory.ts +412 -0
- package/src/store/session/messages.ts +21 -0
- package/src/store/thread/disk.ts +261 -0
- package/src/store/thread/index.ts +7 -0
- package/src/store/thread/memory.ts +104 -0
- package/src/types/agent/base.ts +27 -1
- package/src/types/agent/factory.ts +8 -3
- package/src/types/agent/task.ts +66 -2
- package/src/types/ids/index.ts +34 -3
- package/src/types/invocation/__tests__/state.test.ts +37 -29
- package/src/types/invocation/index.ts +26 -10
- package/src/types/rag/retrieval.ts +4 -3
- package/src/types/run/config.ts +13 -1
- package/src/types/run/events.ts +36 -1
- package/src/types/run/index.ts +8 -0
- package/src/types/run/metadata.ts +12 -2
- package/src/types/run/status.ts +33 -0
- package/src/types/session/ids.ts +23 -0
- package/src/types/session/index.ts +27 -0
- package/src/types/session/store.ts +252 -0
- package/src/types/thread/index.ts +5 -0
- package/src/types/thread/store.ts +92 -0
- package/src/utils/id.ts +34 -4
- package/dist/store/conversation/memory.d.ts +0 -21
- package/dist/store/conversation/memory.d.ts.map +0 -1
- package/dist/store/conversation/memory.js +0 -86
- package/dist/store/conversation/memory.js.map +0 -1
- package/dist/types/conversation/index.d.ts +0 -7
- package/dist/types/conversation/index.d.ts.map +0 -1
- package/dist/types/conversation/index.js +0 -2
- package/dist/types/conversation/index.js.map +0 -1
- package/src/store/conversation/memory.ts +0 -121
- package/src/types/conversation/index.ts +0 -8
|
@@ -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
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { KnowledgeBaseId
|
|
1
|
+
import type { KnowledgeBaseId } from '../ids/index.js'
|
|
2
|
+
import type { ProjectId } from '../session/ids.js'
|
|
2
3
|
import type { TenantScope } from './scope.js'
|
|
3
4
|
import type { VectorSearchResult } from './vector.js'
|
|
4
5
|
|
|
@@ -13,8 +14,8 @@ export interface RetrievalConfig {
|
|
|
13
14
|
|
|
14
15
|
export interface RetrievalQuery {
|
|
15
16
|
text: string
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
projectId?: ProjectId
|
|
18
|
+
recentMessages?: string[]
|
|
18
19
|
config?: Partial<RetrievalConfig>
|
|
19
20
|
}
|
|
20
21
|
|
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, ThreadId } 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}. `sessionId`, `threadId`, `tenantId`,
|
|
26
|
+
* and `projectId` are required — every Run is attributed across the full
|
|
27
|
+
* five-layer scope (Tenant → Project → Thread → Session → Run,
|
|
28
|
+
* Convention #17).
|
|
29
|
+
*/
|
|
23
30
|
export interface RunPersistenceConfig {
|
|
24
31
|
runId: RunId
|
|
25
32
|
agentId: string
|
|
@@ -30,6 +37,11 @@ export interface RunPersistenceConfig {
|
|
|
30
37
|
pricing?: ModelPricing
|
|
31
38
|
log: Logger
|
|
32
39
|
|
|
40
|
+
sessionId: SessionId
|
|
41
|
+
threadId: ThreadId
|
|
42
|
+
tenantId: TenantId
|
|
43
|
+
projectId: ProjectId
|
|
44
|
+
|
|
33
45
|
parentRunId?: RunId
|
|
34
46
|
|
|
35
47
|
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,10 +1,20 @@
|
|
|
1
1
|
import type { AgentStatus, CostInfo, TokenUsage } from '../common/index.js'
|
|
2
|
-
import type { RunId, TaskId,
|
|
2
|
+
import type { RunId, TaskId, TenantId } 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
|
+
* `projectId` and `tenantId` are required per Convention #17 — every run is
|
|
10
|
+
* attributed to a Project within a Tenant.
|
|
11
|
+
*/
|
|
5
12
|
export interface RunMetadata {
|
|
6
13
|
id: RunId
|
|
7
|
-
|
|
14
|
+
/** Long-lived goal scope. Required. */
|
|
15
|
+
projectId: ProjectId
|
|
16
|
+
/** Isolation boundary (Convention #17). Required. */
|
|
17
|
+
tenantId: TenantId
|
|
8
18
|
agentId: string
|
|
9
19
|
agentName: string
|
|
10
20
|
status: AgentStatus
|
|
@@ -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,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session hierarchy branded ID re-export barrel.
|
|
3
|
+
*
|
|
4
|
+
* Canonical definitions live in `../ids/index.ts`. This barrel exists solely
|
|
5
|
+
* for ergonomic co-location with session-scoped callers (they already import
|
|
6
|
+
* from `types/session/`).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export type {
|
|
10
|
+
ProjectId,
|
|
11
|
+
ThreadId,
|
|
12
|
+
SubSessionId,
|
|
13
|
+
HandoffId,
|
|
14
|
+
WorkspaceId,
|
|
15
|
+
SummaryId,
|
|
16
|
+
DeliverableId,
|
|
17
|
+
SessionId,
|
|
18
|
+
TenantId,
|
|
19
|
+
RunId,
|
|
20
|
+
AgentId,
|
|
21
|
+
UserId,
|
|
22
|
+
TaskId,
|
|
23
|
+
} from '../ids/index.js'
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
ThreadId,
|
|
8
|
+
SubSessionId,
|
|
9
|
+
HandoffId,
|
|
10
|
+
WorkspaceId,
|
|
11
|
+
SummaryId,
|
|
12
|
+
DeliverableId,
|
|
13
|
+
SessionId,
|
|
14
|
+
TenantId,
|
|
15
|
+
RunId,
|
|
16
|
+
AgentId,
|
|
17
|
+
UserId,
|
|
18
|
+
TaskId,
|
|
19
|
+
} from './ids.js'
|
|
20
|
+
|
|
21
|
+
export type {
|
|
22
|
+
SessionStore,
|
|
23
|
+
SessionView,
|
|
24
|
+
CreateProjectParams,
|
|
25
|
+
CreateSessionParams,
|
|
26
|
+
CreateSubSessionParams,
|
|
27
|
+
} from './store.js'
|