@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,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DeliverableRef — discriminated union of artifact types a completed
|
|
3
|
+
* sub-session may emit.
|
|
4
|
+
*
|
|
5
|
+
* Consumed by two surfaces:
|
|
6
|
+
* 1. `SessionSummaryRef.deliverables` — authoritative list of artifacts a
|
|
7
|
+
* completed sub-session produced. See session-hierarchy.md §4.7.
|
|
8
|
+
* 2. `SubSession.prevArtifactRef` — intervention chains reference a prior
|
|
9
|
+
* immutable artifact. See session-hierarchy.md §4.5, §8.1.
|
|
10
|
+
*
|
|
11
|
+
* The `session_summary` variant is what intervention sub-sessions use — a
|
|
12
|
+
* follow-up intervention points at the previous completed session's summary,
|
|
13
|
+
* forming a strict acyclic DAG validated by
|
|
14
|
+
* `session/intervention/prev-artifact.ts`.
|
|
15
|
+
*
|
|
16
|
+
* Convention #6: this is a discriminated union on `kind`; any consumer must
|
|
17
|
+
* handle all variants exhaustively.
|
|
18
|
+
*/
|
|
19
|
+
import type { RunId, SessionId } from '../../types/ids/index.js';
|
|
20
|
+
import type { DeliverableId, SummaryId } from '../../types/session/ids.js';
|
|
21
|
+
/** Discriminator for {@link DeliverableRef}. */
|
|
22
|
+
export type DeliverableKind = 'file' | 'session_summary' | 'message' | 'artifact_blob';
|
|
23
|
+
/**
|
|
24
|
+
* A file deliverable — a path relative to the workspace root, plus a content
|
|
25
|
+
* hash pinning the file to its state at materialize time. Subsequent edits to
|
|
26
|
+
* the file on disk do not mutate the deliverable; the ref is a snapshot.
|
|
27
|
+
*/
|
|
28
|
+
export interface FileDeliverable {
|
|
29
|
+
readonly id: DeliverableId;
|
|
30
|
+
readonly kind: 'file';
|
|
31
|
+
/** Path relative to the owning session's workspace root. */
|
|
32
|
+
readonly path: string;
|
|
33
|
+
/** sha256 of the file's content at materialize time. */
|
|
34
|
+
readonly contentHash: string;
|
|
35
|
+
readonly sizeBytes: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A pointer to a previously-materialized {@link SessionSummaryRef}. The
|
|
39
|
+
* intervention DAG uses this variant to reference the immutable output of a
|
|
40
|
+
* prior completed session.
|
|
41
|
+
*/
|
|
42
|
+
export interface SessionSummaryDeliverable {
|
|
43
|
+
readonly id: DeliverableId;
|
|
44
|
+
readonly kind: 'session_summary';
|
|
45
|
+
readonly sessionId: SessionId;
|
|
46
|
+
readonly summaryRef: SummaryId;
|
|
47
|
+
readonly at: Date;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A specific persisted message within a session run — useful for referencing
|
|
51
|
+
* a single LLM turn as an artifact (e.g. a decision record).
|
|
52
|
+
*/
|
|
53
|
+
export interface MessageDeliverable {
|
|
54
|
+
readonly id: DeliverableId;
|
|
55
|
+
readonly kind: 'message';
|
|
56
|
+
readonly sessionId: SessionId;
|
|
57
|
+
readonly runId: RunId;
|
|
58
|
+
/** Opaque identifier bound to the run's persisted message log. */
|
|
59
|
+
readonly messageId: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* An opaque blob deliverable — content lives in an out-of-band storage
|
|
63
|
+
* backend (object store, artifact registry). The SDK does not fetch or
|
|
64
|
+
* validate blob contents; callers resolve via the `storageRef`.
|
|
65
|
+
*/
|
|
66
|
+
export interface ArtifactBlobDeliverable {
|
|
67
|
+
readonly id: DeliverableId;
|
|
68
|
+
readonly kind: 'artifact_blob';
|
|
69
|
+
/** Opaque — bound to a storage backend the consumer owns. */
|
|
70
|
+
readonly storageRef: string;
|
|
71
|
+
readonly mediaType?: string;
|
|
72
|
+
}
|
|
73
|
+
export type DeliverableRef = FileDeliverable | SessionSummaryDeliverable | MessageDeliverable | ArtifactBlobDeliverable;
|
|
74
|
+
//# sourceMappingURL=deliverable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliverable.d.ts","sourceRoot":"","sources":["../../../src/session/summary/deliverable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAE1E,gDAAgD;AAChD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,iBAAiB,GAAG,SAAS,GAAG,eAAe,CAAA;AAEtF;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,EAAE,EAAE,aAAa,CAAA;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,wDAAwD;IACxD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,EAAE,EAAE,aAAa,CAAA;IAC1B,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAA;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAA;IAC9B,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,EAAE,EAAE,aAAa,CAAA;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,kEAAkE;IAClE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,EAAE,EAAE,aAAa,CAAA;IAC1B,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;IAC9B,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,MAAM,cAAc,GACvB,eAAe,GACf,yBAAyB,GACzB,kBAAkB,GAClB,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DeliverableRef — discriminated union of artifact types a completed
|
|
3
|
+
* sub-session may emit.
|
|
4
|
+
*
|
|
5
|
+
* Consumed by two surfaces:
|
|
6
|
+
* 1. `SessionSummaryRef.deliverables` — authoritative list of artifacts a
|
|
7
|
+
* completed sub-session produced. See session-hierarchy.md §4.7.
|
|
8
|
+
* 2. `SubSession.prevArtifactRef` — intervention chains reference a prior
|
|
9
|
+
* immutable artifact. See session-hierarchy.md §4.5, §8.1.
|
|
10
|
+
*
|
|
11
|
+
* The `session_summary` variant is what intervention sub-sessions use — a
|
|
12
|
+
* follow-up intervention points at the previous completed session's summary,
|
|
13
|
+
* forming a strict acyclic DAG validated by
|
|
14
|
+
* `session/intervention/prev-artifact.ts`.
|
|
15
|
+
*
|
|
16
|
+
* Convention #6: this is a discriminated union on `kind`; any consumer must
|
|
17
|
+
* handle all variants exhaustively.
|
|
18
|
+
*/
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=deliverable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliverable.js","sourceRoot":"","sources":["../../../src/session/summary/deliverable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { ArtifactBlobDeliverable, DeliverableKind, DeliverableRef, FileDeliverable, MessageDeliverable, SessionSummaryDeliverable, } from './deliverable.js';
|
|
2
|
+
export { AGENT_SUMMARY_MAX_CHARS, AgentSummaryTooLongError, SessionAlreadySummarizedError, } from './ref.js';
|
|
3
|
+
export type { SessionSummaryKeyDecision, SessionSummaryOutcome, SessionSummaryOutcomeStatus, SessionSummaryRef, } from './ref.js';
|
|
4
|
+
export { SessionSummaryMaterializer } from './materialize.js';
|
|
5
|
+
export type { MaterializeInput, SessionSummaryMaterializerDeps, } from './materialize.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/session/summary/index.ts"],"names":[],"mappings":"AAOA,YAAY,EACX,uBAAuB,EACvB,eAAe,EACf,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,yBAAyB,GACzB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACN,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,GAC7B,MAAM,UAAU,CAAA;AACjB,YAAY,EACX,yBAAyB,EACzB,qBAAqB,EACrB,2BAA2B,EAC3B,iBAAiB,GACjB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAA;AAC7D,YAAY,EACX,gBAAgB,EAChB,8BAA8B,GAC9B,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Sub-barrel for the session summary module (Convention #4).
|
|
2
|
+
//
|
|
3
|
+
// See session-hierarchy.md §4.7 (SessionSummaryRef shape) and §8.1
|
|
4
|
+
// (kernel-only emission invariant). Concrete types and the materializer live
|
|
5
|
+
// in sibling files; re-export them here so consumers import via
|
|
6
|
+
// `../session/summary/index.js`.
|
|
7
|
+
export { AGENT_SUMMARY_MAX_CHARS, AgentSummaryTooLongError, SessionAlreadySummarizedError, } from './ref.js';
|
|
8
|
+
export { SessionSummaryMaterializer } from './materialize.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/session/summary/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,mEAAmE;AACnE,6EAA6E;AAC7E,gEAAgE;AAChE,iCAAiC;AAUjC,OAAO,EACN,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,GAC7B,MAAM,UAAU,CAAA;AAOjB,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SessionSummaryMaterializer — kernel terminalization primitive.
|
|
3
|
+
*
|
|
4
|
+
* The sole producer of {@link SessionSummaryRef}. No agent-callable surface
|
|
5
|
+
* exists to bypass this (Convention #0 load-bearing — see
|
|
6
|
+
* session-hierarchy.md §8.1).
|
|
7
|
+
*
|
|
8
|
+
* Atomicity contract (§8.1): the summary write and the owning session's
|
|
9
|
+
* `non-terminal → idle` status flip commit as one logical unit. In the
|
|
10
|
+
* InMemory store the two happen within the same method call under the store's
|
|
11
|
+
* Map guard; in the Disk store they are two sequential write-tmp-renames
|
|
12
|
+
* (summary.json first, then session.json). A mid-step crash leaves the
|
|
13
|
+
* summary persisted but the session still active — `recover()` replays the
|
|
14
|
+
* session-status flip idempotently on next boot.
|
|
15
|
+
*
|
|
16
|
+
* The class is function-call-style (no internal state beyond deps). Tests
|
|
17
|
+
* inject a fake generator for deterministic IDs; production uses
|
|
18
|
+
* `generateSummaryId` from `utils/id.ts`.
|
|
19
|
+
*/
|
|
20
|
+
import type { SessionId, TenantId } from '../../types/ids/index.js';
|
|
21
|
+
import type { SummaryId } from '../../types/session/ids.js';
|
|
22
|
+
import type { SessionStore } from '../../types/session/store.js';
|
|
23
|
+
import type { DeliverableRef } from './deliverable.js';
|
|
24
|
+
import { type SessionSummaryKeyDecision, type SessionSummaryOutcome, type SessionSummaryRef } from './ref.js';
|
|
25
|
+
/**
|
|
26
|
+
* Dependencies for {@link SessionSummaryMaterializer}. The generator is
|
|
27
|
+
* injected so tests can produce deterministic IDs; production code wires
|
|
28
|
+
* `generateSummaryId` from `utils/id.ts`.
|
|
29
|
+
*/
|
|
30
|
+
export interface SessionSummaryMaterializerDeps {
|
|
31
|
+
readonly store: SessionStore;
|
|
32
|
+
readonly generateSummaryId: () => SummaryId;
|
|
33
|
+
/** Clock hook — defaults to `new Date()` when omitted. */
|
|
34
|
+
readonly now?: () => Date;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Caller-supplied payload for {@link SessionSummaryMaterializer.materialize}.
|
|
38
|
+
* The materializer validates `agentSummary` length, constructs the
|
|
39
|
+
* `SessionSummaryRef`, and delegates the atomic write to the store.
|
|
40
|
+
*/
|
|
41
|
+
export interface MaterializeInput {
|
|
42
|
+
readonly sessionId: SessionId;
|
|
43
|
+
readonly tenantId: TenantId;
|
|
44
|
+
readonly finalOutcome: SessionSummaryOutcome;
|
|
45
|
+
readonly agentSummary: string;
|
|
46
|
+
readonly declaredDeliverables: readonly DeliverableRef[];
|
|
47
|
+
readonly keyDecisions: readonly SessionSummaryKeyDecision[];
|
|
48
|
+
}
|
|
49
|
+
export declare class SessionSummaryMaterializer {
|
|
50
|
+
private readonly deps;
|
|
51
|
+
constructor(deps: SessionSummaryMaterializerDeps);
|
|
52
|
+
/**
|
|
53
|
+
* Kernel emission path. Validates, builds the immutable
|
|
54
|
+
* {@link SessionSummaryRef}, and hands it to the store for atomic write +
|
|
55
|
+
* status-flip. Rejects with:
|
|
56
|
+
*
|
|
57
|
+
* - {@link AgentSummaryTooLongError} — `agentSummary` exceeds the max char
|
|
58
|
+
* cap ({@link AGENT_SUMMARY_MAX_CHARS}).
|
|
59
|
+
* - `TenantIsolationError` — session is owned by a different tenant.
|
|
60
|
+
* - {@link SessionAlreadySummarizedError} — the session already has a
|
|
61
|
+
* persisted summary. Re-materialization would duplicate history; the
|
|
62
|
+
* caller should instead open an intervention sub-session (§4.5).
|
|
63
|
+
*/
|
|
64
|
+
materialize(input: MaterializeInput): Promise<SessionSummaryRef>;
|
|
65
|
+
/**
|
|
66
|
+
* Recovery path. Called at boot (or explicitly by the lifecycle manager)
|
|
67
|
+
* for sessions whose `summary.json` is persisted but whose `session.json`
|
|
68
|
+
* still reports a non-terminal status — the crash window between the two
|
|
69
|
+
* atomic writes on disk.
|
|
70
|
+
*
|
|
71
|
+
* Idempotent: if the session is already `'idle'` (or another terminal
|
|
72
|
+
* state), no write occurs; the existing summary is returned. If no summary
|
|
73
|
+
* is persisted, returns `null` and no side effect occurs. This is the only
|
|
74
|
+
* non-materialize path that may touch the stored summary — it does not
|
|
75
|
+
* mint a new ID, only re-triggers the store's status flip via
|
|
76
|
+
* `recordSummary` when it detects the dangling session.
|
|
77
|
+
*/
|
|
78
|
+
recover(sessionId: SessionId, tenantId: TenantId): Promise<SessionSummaryRef | null>;
|
|
79
|
+
private assertSummaryLength;
|
|
80
|
+
private clock;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=materialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materialize.d.ts","sourceRoot":"","sources":["../../../src/session/summary/materialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAIN,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,MAAM,UAAU,CAAA;AAEjB;;;;GAIG;AACH,MAAM,WAAW,8BAA8B;IAC9C,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAA;IAC5B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,SAAS,CAAA;IAC3C,0DAA0D;IAC1D,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAC3B,QAAQ,CAAC,YAAY,EAAE,qBAAqB,CAAA;IAC5C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,oBAAoB,EAAE,SAAS,cAAc,EAAE,CAAA;IACxD,QAAQ,CAAC,YAAY,EAAE,SAAS,yBAAyB,EAAE,CAAA;CAC3D;AAcD,qBAAa,0BAA0B;IACtC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAgC;gBAEzC,IAAI,EAAE,8BAA8B;IAIhD;;;;;;;;;;;OAWG;IACG,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAgCtE;;;;;;;;;;;;OAYG;IACG,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAoB1F,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,KAAK;CAGb"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SessionSummaryMaterializer — kernel terminalization primitive.
|
|
3
|
+
*
|
|
4
|
+
* The sole producer of {@link SessionSummaryRef}. No agent-callable surface
|
|
5
|
+
* exists to bypass this (Convention #0 load-bearing — see
|
|
6
|
+
* session-hierarchy.md §8.1).
|
|
7
|
+
*
|
|
8
|
+
* Atomicity contract (§8.1): the summary write and the owning session's
|
|
9
|
+
* `non-terminal → idle` status flip commit as one logical unit. In the
|
|
10
|
+
* InMemory store the two happen within the same method call under the store's
|
|
11
|
+
* Map guard; in the Disk store they are two sequential write-tmp-renames
|
|
12
|
+
* (summary.json first, then session.json). A mid-step crash leaves the
|
|
13
|
+
* summary persisted but the session still active — `recover()` replays the
|
|
14
|
+
* session-status flip idempotently on next boot.
|
|
15
|
+
*
|
|
16
|
+
* The class is function-call-style (no internal state beyond deps). Tests
|
|
17
|
+
* inject a fake generator for deterministic IDs; production uses
|
|
18
|
+
* `generateSummaryId` from `utils/id.ts`.
|
|
19
|
+
*/
|
|
20
|
+
import { AGENT_SUMMARY_MAX_CHARS, AgentSummaryTooLongError, SessionAlreadySummarizedError, } from './ref.js';
|
|
21
|
+
/**
|
|
22
|
+
* Session statuses from which a materialize call may legally transition to
|
|
23
|
+
* `'idle'` as part of the terminalization. Other states (already `'idle'`,
|
|
24
|
+
* `'failed'`, `'archived'`, `'awaiting_hitl'`) are left untouched; the
|
|
25
|
+
* materializer never moves a session *out of* `'failed'` or `'archived'`.
|
|
26
|
+
*/
|
|
27
|
+
const TERMINALIZABLE_STATUSES = new Set([
|
|
28
|
+
'active',
|
|
29
|
+
'locked',
|
|
30
|
+
'awaiting_merge',
|
|
31
|
+
]);
|
|
32
|
+
export class SessionSummaryMaterializer {
|
|
33
|
+
deps;
|
|
34
|
+
constructor(deps) {
|
|
35
|
+
this.deps = deps;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Kernel emission path. Validates, builds the immutable
|
|
39
|
+
* {@link SessionSummaryRef}, and hands it to the store for atomic write +
|
|
40
|
+
* status-flip. Rejects with:
|
|
41
|
+
*
|
|
42
|
+
* - {@link AgentSummaryTooLongError} — `agentSummary` exceeds the max char
|
|
43
|
+
* cap ({@link AGENT_SUMMARY_MAX_CHARS}).
|
|
44
|
+
* - `TenantIsolationError` — session is owned by a different tenant.
|
|
45
|
+
* - {@link SessionAlreadySummarizedError} — the session already has a
|
|
46
|
+
* persisted summary. Re-materialization would duplicate history; the
|
|
47
|
+
* caller should instead open an intervention sub-session (§4.5).
|
|
48
|
+
*/
|
|
49
|
+
async materialize(input) {
|
|
50
|
+
this.assertSummaryLength(input.agentSummary);
|
|
51
|
+
const session = await this.deps.store.getSession(input.sessionId, input.tenantId);
|
|
52
|
+
if (!session) {
|
|
53
|
+
throw new Error(`Session ${input.sessionId} not found`);
|
|
54
|
+
}
|
|
55
|
+
const existing = await this.deps.store.getSummary(input.sessionId, input.tenantId);
|
|
56
|
+
if (existing) {
|
|
57
|
+
throw new SessionAlreadySummarizedError({
|
|
58
|
+
sessionId: input.sessionId,
|
|
59
|
+
existingSummaryId: existing.id,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
const summary = {
|
|
63
|
+
id: this.deps.generateSummaryId(),
|
|
64
|
+
sessionRef: input.sessionId,
|
|
65
|
+
tenantId: input.tenantId,
|
|
66
|
+
outcome: input.finalOutcome,
|
|
67
|
+
deliverables: input.declaredDeliverables,
|
|
68
|
+
agentSummary: input.agentSummary,
|
|
69
|
+
keyDecisions: input.keyDecisions,
|
|
70
|
+
at: this.clock(),
|
|
71
|
+
materializedBy: 'kernel',
|
|
72
|
+
};
|
|
73
|
+
await this.deps.store.recordSummary(summary, input.tenantId);
|
|
74
|
+
return summary;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Recovery path. Called at boot (or explicitly by the lifecycle manager)
|
|
78
|
+
* for sessions whose `summary.json` is persisted but whose `session.json`
|
|
79
|
+
* still reports a non-terminal status — the crash window between the two
|
|
80
|
+
* atomic writes on disk.
|
|
81
|
+
*
|
|
82
|
+
* Idempotent: if the session is already `'idle'` (or another terminal
|
|
83
|
+
* state), no write occurs; the existing summary is returned. If no summary
|
|
84
|
+
* is persisted, returns `null` and no side effect occurs. This is the only
|
|
85
|
+
* non-materialize path that may touch the stored summary — it does not
|
|
86
|
+
* mint a new ID, only re-triggers the store's status flip via
|
|
87
|
+
* `recordSummary` when it detects the dangling session.
|
|
88
|
+
*/
|
|
89
|
+
async recover(sessionId, tenantId) {
|
|
90
|
+
const summary = await this.deps.store.getSummary(sessionId, tenantId);
|
|
91
|
+
if (!summary)
|
|
92
|
+
return null;
|
|
93
|
+
const session = await this.deps.store.getSession(sessionId, tenantId);
|
|
94
|
+
if (!session)
|
|
95
|
+
return summary;
|
|
96
|
+
if (TERMINALIZABLE_STATUSES.has(session.status)) {
|
|
97
|
+
// Dangling: summary persisted but session never flipped. Replay the
|
|
98
|
+
// status transition by re-invoking `recordSummary` — store impls
|
|
99
|
+
// treat an existing-summary path as "flip-only, no duplicate write".
|
|
100
|
+
// Cast preserves the kernel brand on the recovered record.
|
|
101
|
+
await this.deps.store.recordSummary(summary, tenantId);
|
|
102
|
+
}
|
|
103
|
+
return summary;
|
|
104
|
+
}
|
|
105
|
+
assertSummaryLength(agentSummary) {
|
|
106
|
+
if (agentSummary.length > AGENT_SUMMARY_MAX_CHARS) {
|
|
107
|
+
throw new AgentSummaryTooLongError({
|
|
108
|
+
actual: agentSummary.length,
|
|
109
|
+
max: AGENT_SUMMARY_MAX_CHARS,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
clock() {
|
|
114
|
+
return this.deps.now ? this.deps.now() : new Date();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=materialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materialize.js","sourceRoot":"","sources":["../../../src/session/summary/materialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH,OAAO,EACN,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,GAI7B,MAAM,UAAU,CAAA;AA4BjB;;;;;GAKG;AACH,MAAM,uBAAuB,GAAmC,IAAI,GAAG,CAAC;IACvE,QAAQ;IACR,QAAQ;IACR,gBAAgB;CAChB,CAAC,CAAA;AAEF,MAAM,OAAO,0BAA0B;IACrB,IAAI,CAAgC;IAErD,YAAY,IAAoC;QAC/C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IACjB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,WAAW,CAAC,KAAuB;QACxC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;QAE5C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;QACjF,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,WAAW,KAAK,CAAC,SAAS,YAAY,CAAC,CAAA;QACxD,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;QAClF,IAAI,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,6BAA6B,CAAC;gBACvC,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,iBAAiB,EAAE,QAAQ,CAAC,EAAE;aAC9B,CAAC,CAAA;QACH,CAAC;QAED,MAAM,OAAO,GAAsB;YAClC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE;YACjC,UAAU,EAAE,KAAK,CAAC,SAAS;YAC3B,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,OAAO,EAAE,KAAK,CAAC,YAAY;YAC3B,YAAY,EAAE,KAAK,CAAC,oBAAoB;YACxC,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE;YAChB,cAAc,EAAE,QAAQ;SACxB,CAAA;QAED,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;QAC5D,OAAO,OAAO,CAAA;IACf,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,OAAO,CAAC,SAAoB,EAAE,QAAkB;QACrD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;QACrE,IAAI,CAAC,OAAO;YAAE,OAAO,IAAI,CAAA;QAEzB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;QACrE,IAAI,CAAC,OAAO;YAAE,OAAO,OAAO,CAAA;QAE5B,IAAI,uBAAuB,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACjD,oEAAoE;YACpE,iEAAiE;YACjE,qEAAqE;YACrE,2DAA2D;YAC3D,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAClC,OAA2D,EAC3D,QAAQ,CACR,CAAA;QACF,CAAC;QACD,OAAO,OAAO,CAAA;IACf,CAAC;IAEO,mBAAmB,CAAC,YAAoB;QAC/C,IAAI,YAAY,CAAC,MAAM,GAAG,uBAAuB,EAAE,CAAC;YACnD,MAAM,IAAI,wBAAwB,CAAC;gBAClC,MAAM,EAAE,YAAY,CAAC,MAAM;gBAC3B,GAAG,EAAE,uBAAuB;aAC5B,CAAC,CAAA;QACH,CAAC;IACF,CAAC;IAEO,KAAK;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAA;IACpD,CAAC;CACD"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SessionSummaryRef — the structured pointer a parent session sees when a
|
|
3
|
+
* sub-session completes. Kernel-owned terminalization primitive: the only
|
|
4
|
+
* producer is {@link SessionSummaryMaterializer.materialize} (see
|
|
5
|
+
* `./materialize.ts`). See session-hierarchy.md §4.7 (shape) and §8.1
|
|
6
|
+
* (emission invariant).
|
|
7
|
+
*
|
|
8
|
+
* The `materializedBy: 'kernel'` literal field is load-bearing — combined
|
|
9
|
+
* with the opaque {@link SummaryId} brand (mintable only by
|
|
10
|
+
* `generateSummaryId`), it enforces at the type level that no agent or tool
|
|
11
|
+
* can construct a valid `SessionSummaryRef`. `SessionStore.recordSummary`
|
|
12
|
+
* only accepts `SessionSummaryRef & { materializedBy: 'kernel' }`, so even a
|
|
13
|
+
* payload shaped correctly would fail the structural check.
|
|
14
|
+
*
|
|
15
|
+
* This is Convention #0 load-bearing: there is no "tool" path to emit a
|
|
16
|
+
* summary; the parent agent sees only what the kernel seals.
|
|
17
|
+
*/
|
|
18
|
+
import type { SessionId, TenantId } from '../../types/ids/index.js';
|
|
19
|
+
import type { SummaryId } from '../../types/session/ids.js';
|
|
20
|
+
import type { DeliverableRef } from './deliverable.js';
|
|
21
|
+
/**
|
|
22
|
+
* Max characters allowed for {@link SessionSummaryRef.agentSummary}. See
|
|
23
|
+
* session-hierarchy.md §4.7 — the agent's narration is bounded to keep
|
|
24
|
+
* parent prompts token-finite regardless of the child's transcript length.
|
|
25
|
+
*/
|
|
26
|
+
export declare const AGENT_SUMMARY_MAX_CHARS = 4000;
|
|
27
|
+
export type SessionSummaryOutcomeStatus = 'succeeded' | 'partial' | 'failed';
|
|
28
|
+
export interface SessionSummaryOutcome {
|
|
29
|
+
readonly status: SessionSummaryOutcomeStatus;
|
|
30
|
+
/** Short human-readable one-liner. Optional per pattern doc §4.7. */
|
|
31
|
+
readonly verdict?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface SessionSummaryKeyDecision {
|
|
34
|
+
readonly at: Date;
|
|
35
|
+
readonly summary: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Structured completion pointer emitted by the kernel when a sub-session
|
|
39
|
+
* terminalizes. See session-hierarchy.md §4.7 and §8.1.
|
|
40
|
+
*
|
|
41
|
+
* Readonly across the board — the record is immutable once sealed.
|
|
42
|
+
*/
|
|
43
|
+
export interface SessionSummaryRef {
|
|
44
|
+
readonly id: SummaryId;
|
|
45
|
+
readonly sessionRef: SessionId;
|
|
46
|
+
readonly tenantId: TenantId;
|
|
47
|
+
readonly outcome: SessionSummaryOutcome;
|
|
48
|
+
readonly deliverables: readonly DeliverableRef[];
|
|
49
|
+
/** Agent's own narration; bounded to {@link AGENT_SUMMARY_MAX_CHARS}. */
|
|
50
|
+
readonly agentSummary: string;
|
|
51
|
+
readonly keyDecisions: readonly SessionSummaryKeyDecision[];
|
|
52
|
+
/** When the summary was materialized. */
|
|
53
|
+
readonly at: Date;
|
|
54
|
+
/**
|
|
55
|
+
* Literal `'kernel'` — enforces kernel-only emission at the type level.
|
|
56
|
+
* See the module header for the invariant rationale.
|
|
57
|
+
*/
|
|
58
|
+
readonly materializedBy: 'kernel';
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Raised by {@link SessionSummaryMaterializer.materialize} when the provided
|
|
62
|
+
* `agentSummary` exceeds {@link AGENT_SUMMARY_MAX_CHARS}. Convention #5
|
|
63
|
+
* deny-by-default — the kernel does not truncate silently.
|
|
64
|
+
*/
|
|
65
|
+
export declare class AgentSummaryTooLongError extends Error {
|
|
66
|
+
readonly details: {
|
|
67
|
+
readonly actual: number;
|
|
68
|
+
readonly max: number;
|
|
69
|
+
};
|
|
70
|
+
constructor(details: {
|
|
71
|
+
actual: number;
|
|
72
|
+
max: number;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Raised when {@link SessionSummaryMaterializer.materialize} is invoked
|
|
77
|
+
* against a session that already has a persisted summary. Re-materialization
|
|
78
|
+
* would duplicate history — callers wanting to append must open a new
|
|
79
|
+
* intervention sub-session (see session-hierarchy.md §4.5).
|
|
80
|
+
*/
|
|
81
|
+
export declare class SessionAlreadySummarizedError extends Error {
|
|
82
|
+
readonly details: {
|
|
83
|
+
readonly sessionId: SessionId;
|
|
84
|
+
readonly existingSummaryId: SummaryId;
|
|
85
|
+
};
|
|
86
|
+
constructor(details: {
|
|
87
|
+
sessionId: SessionId;
|
|
88
|
+
existingSummaryId: SummaryId;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=ref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ref.d.ts","sourceRoot":"","sources":["../../../src/session/summary/ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAA;AAE3C,MAAM,MAAM,2BAA2B,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAA;AAE5E,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAA;IAC5C,qEAAqE;IACrE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;IACjB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAA;IACtB,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAA;IAC9B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAA;IACvC,QAAQ,CAAC,YAAY,EAAE,SAAS,cAAc,EAAE,CAAA;IAChD,yEAAyE;IACzE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,YAAY,EAAE,SAAS,yBAAyB,EAAE,CAAA;IAC3D,yCAAyC;IACzC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;IACjB;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAA;CACjC;AAED;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IAClD,QAAQ,CAAC,OAAO,EAAE;QACjB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;QACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KACpB,CAAA;gBAEW,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;CAKpD;AAED;;;;;GAKG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IACvD,QAAQ,CAAC,OAAO,EAAE;QACjB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;QAC7B,QAAQ,CAAC,iBAAiB,EAAE,SAAS,CAAA;KACrC,CAAA;gBAEW,OAAO,EAAE;QAAE,SAAS,EAAE,SAAS,CAAC;QAAC,iBAAiB,EAAE,SAAS,CAAA;KAAE;CAO3E"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SessionSummaryRef — the structured pointer a parent session sees when a
|
|
3
|
+
* sub-session completes. Kernel-owned terminalization primitive: the only
|
|
4
|
+
* producer is {@link SessionSummaryMaterializer.materialize} (see
|
|
5
|
+
* `./materialize.ts`). See session-hierarchy.md §4.7 (shape) and §8.1
|
|
6
|
+
* (emission invariant).
|
|
7
|
+
*
|
|
8
|
+
* The `materializedBy: 'kernel'` literal field is load-bearing — combined
|
|
9
|
+
* with the opaque {@link SummaryId} brand (mintable only by
|
|
10
|
+
* `generateSummaryId`), it enforces at the type level that no agent or tool
|
|
11
|
+
* can construct a valid `SessionSummaryRef`. `SessionStore.recordSummary`
|
|
12
|
+
* only accepts `SessionSummaryRef & { materializedBy: 'kernel' }`, so even a
|
|
13
|
+
* payload shaped correctly would fail the structural check.
|
|
14
|
+
*
|
|
15
|
+
* This is Convention #0 load-bearing: there is no "tool" path to emit a
|
|
16
|
+
* summary; the parent agent sees only what the kernel seals.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Max characters allowed for {@link SessionSummaryRef.agentSummary}. See
|
|
20
|
+
* session-hierarchy.md §4.7 — the agent's narration is bounded to keep
|
|
21
|
+
* parent prompts token-finite regardless of the child's transcript length.
|
|
22
|
+
*/
|
|
23
|
+
export const AGENT_SUMMARY_MAX_CHARS = 4000;
|
|
24
|
+
/**
|
|
25
|
+
* Raised by {@link SessionSummaryMaterializer.materialize} when the provided
|
|
26
|
+
* `agentSummary` exceeds {@link AGENT_SUMMARY_MAX_CHARS}. Convention #5
|
|
27
|
+
* deny-by-default — the kernel does not truncate silently.
|
|
28
|
+
*/
|
|
29
|
+
export class AgentSummaryTooLongError extends Error {
|
|
30
|
+
details;
|
|
31
|
+
constructor(details) {
|
|
32
|
+
super(`agentSummary ${details.actual} chars exceeds max ${details.max}`);
|
|
33
|
+
this.name = 'AgentSummaryTooLongError';
|
|
34
|
+
this.details = details;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Raised when {@link SessionSummaryMaterializer.materialize} is invoked
|
|
39
|
+
* against a session that already has a persisted summary. Re-materialization
|
|
40
|
+
* would duplicate history — callers wanting to append must open a new
|
|
41
|
+
* intervention sub-session (see session-hierarchy.md §4.5).
|
|
42
|
+
*/
|
|
43
|
+
export class SessionAlreadySummarizedError extends Error {
|
|
44
|
+
details;
|
|
45
|
+
constructor(details) {
|
|
46
|
+
super(`Session ${details.sessionId} already has summary ${details.existingSummaryId}; re-materialization rejected`);
|
|
47
|
+
this.name = 'SessionAlreadySummarizedError';
|
|
48
|
+
this.details = details;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=ref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../src/session/summary/ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAA;AAuC3C;;;;GAIG;AACH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACzC,OAAO,CAGf;IAED,YAAY,OAAwC;QACnD,KAAK,CAAC,gBAAgB,OAAO,CAAC,MAAM,sBAAsB,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;QACxE,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAA;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACvB,CAAC;CACD;AAED;;;;;GAKG;AACH,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAC9C,OAAO,CAGf;IAED,YAAY,OAA+D;QAC1E,KAAK,CACJ,WAAW,OAAO,CAAC,SAAS,wBAAwB,OAAO,CAAC,iBAAiB,+BAA+B,CAC5G,CAAA;QACD,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAA;QAC3C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACvB,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-worktree.test.d.ts","sourceRoot":"","sources":["../../../../src/session/workspace/__tests__/git-worktree.test.ts"],"names":[],"mappings":""}
|