@namzu/sdk 0.4.1 → 0.4.2
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 +73 -0
- package/dist/__tests__/replay-public-surface.test.d.ts +2 -0
- package/dist/__tests__/replay-public-surface.test.d.ts.map +1 -0
- package/dist/__tests__/replay-public-surface.test.js +45 -0
- package/dist/__tests__/replay-public-surface.test.js.map +1 -0
- package/dist/agents/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/SupervisorAgent.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/config/runtime.d.ts +24 -25
- package/dist/config/runtime.d.ts.map +1 -1
- package/dist/config/runtime.js.map +1 -1
- package/dist/contracts/api.d.ts +2 -2
- package/dist/contracts/api.d.ts.map +1 -1
- package/dist/contracts/index.d.ts +1 -2
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/schemas.d.ts +10 -10
- package/dist/index.d.ts +3 -103
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -89
- package/dist/index.js.map +1 -1
- package/dist/manager/agent/__tests__/lifecycle.test.js.map +1 -1
- package/dist/manager/agent/lifecycle.d.ts +1 -1
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +1 -1
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/run/persistence.d.ts +3 -3
- package/dist/manager/run/persistence.d.ts.map +1 -1
- package/dist/manager/run/persistence.js.map +1 -1
- package/dist/manager/thread/__tests__/lifecycle.test.js.map +1 -1
- package/dist/manager/thread/lifecycle.d.ts +1 -1
- package/dist/manager/thread/lifecycle.d.ts.map +1 -1
- package/dist/plugin/loader.d.ts +0 -5
- package/dist/plugin/loader.d.ts.map +1 -1
- package/dist/plugin/loader.js +1 -13
- package/dist/plugin/loader.js.map +1 -1
- package/dist/public-runtime.d.ts +70 -0
- package/dist/public-runtime.d.ts.map +1 -0
- package/dist/public-runtime.js +108 -0
- package/dist/public-runtime.js.map +1 -0
- package/dist/public-tools.d.ts +19 -0
- package/dist/public-tools.d.ts.map +1 -0
- package/dist/public-tools.js +34 -0
- package/dist/public-tools.js.map +1 -0
- package/dist/public-types.d.ts +55 -0
- package/dist/public-types.d.ts.map +1 -0
- package/dist/public-types.js +14 -0
- package/dist/public-types.js.map +1 -0
- package/dist/rag/rag-tool.d.ts +1 -1
- package/dist/run/LimitChecker.d.ts +0 -1
- package/dist/run/LimitChecker.d.ts.map +1 -1
- package/dist/run/LimitChecker.js +0 -6
- package/dist/run/LimitChecker.js.map +1 -1
- package/dist/run/reporter.d.ts +2 -2
- package/dist/run/reporter.d.ts.map +1 -1
- package/dist/run/reporter.js.map +1 -1
- package/dist/runtime/query/__tests__/checkpoint.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/checkpoint.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/checkpoint.test.js +150 -0
- package/dist/runtime/query/__tests__/checkpoint.test.js.map +1 -0
- package/dist/runtime/query/checkpoint.d.ts +23 -0
- package/dist/runtime/query/checkpoint.d.ts.map +1 -1
- package/dist/runtime/query/checkpoint.js +49 -0
- package/dist/runtime/query/checkpoint.js.map +1 -1
- package/dist/runtime/query/context.d.ts +0 -2
- package/dist/runtime/query/context.d.ts.map +1 -1
- package/dist/runtime/query/context.js +0 -4
- package/dist/runtime/query/context.js.map +1 -1
- package/dist/runtime/query/index.d.ts +3 -3
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/replay/__tests__/mutate.test.d.ts +2 -0
- package/dist/runtime/query/replay/__tests__/mutate.test.d.ts.map +1 -0
- package/dist/runtime/query/replay/__tests__/mutate.test.js +123 -0
- package/dist/runtime/query/replay/__tests__/mutate.test.js.map +1 -0
- package/dist/runtime/query/replay/__tests__/prepare.test.d.ts +2 -0
- package/dist/runtime/query/replay/__tests__/prepare.test.d.ts.map +1 -0
- package/dist/runtime/query/replay/__tests__/prepare.test.js +171 -0
- package/dist/runtime/query/replay/__tests__/prepare.test.js.map +1 -0
- package/dist/runtime/query/replay/list.d.ts +24 -0
- package/dist/runtime/query/replay/list.d.ts.map +1 -0
- package/dist/runtime/query/replay/list.js +21 -0
- package/dist/runtime/query/replay/list.js.map +1 -0
- package/dist/runtime/query/replay/mutate.d.ts +17 -0
- package/dist/runtime/query/replay/mutate.d.ts.map +1 -0
- package/dist/runtime/query/replay/mutate.js +62 -0
- package/dist/runtime/query/replay/mutate.js.map +1 -0
- package/dist/runtime/query/replay/prepare.d.ts +56 -0
- package/dist/runtime/query/replay/prepare.d.ts.map +1 -0
- package/dist/runtime/query/replay/prepare.js +65 -0
- package/dist/runtime/query/replay/prepare.js.map +1 -0
- package/dist/runtime/query/result.d.ts +2 -2
- package/dist/runtime/query/result.d.ts.map +1 -1
- package/dist/session/__tests__/integration/_fixtures.d.ts +4 -4
- package/dist/session/__tests__/integration/_fixtures.d.ts.map +1 -1
- package/dist/session/__tests__/integration/_fixtures.js.map +1 -1
- package/dist/session/__tests__/integration/archive-gate.test.js.map +1 -1
- package/dist/session/__tests__/integration/capacity-caps.test.js.map +1 -1
- package/dist/session/__tests__/integration/e2e-spawn.test.js.map +1 -1
- package/dist/session/__tests__/integration/handoff-broadcast-e2e.test.js.map +1 -1
- package/dist/session/__tests__/integration/handoff-single-e2e.test.js.map +1 -1
- package/dist/session/__tests__/integration/prev-artifact-dag.test.js.map +1 -1
- package/dist/session/__tests__/integration/retention-archive.test.js.map +1 -1
- package/dist/session/__tests__/integration/spawn-rollback.test.js.map +1 -1
- package/dist/session/__tests__/integration/summary-materialization-e2e.test.js +1 -1
- package/dist/session/__tests__/integration/summary-materialization-e2e.test.js.map +1 -1
- package/dist/session/errors.d.ts +1 -1
- package/dist/session/errors.d.ts.map +1 -1
- package/dist/session/events/index.d.ts +3 -3
- package/dist/session/events/index.d.ts.map +1 -1
- package/dist/session/events/index.js +3 -2
- package/dist/session/events/index.js.map +1 -1
- package/dist/session/handoff/__tests__/broadcast.test.js.map +1 -1
- package/dist/session/handoff/__tests__/capacity.test.js.map +1 -1
- package/dist/session/handoff/__tests__/single.test.js.map +1 -1
- package/dist/session/handoff/assignment.d.ts +1 -1
- package/dist/session/handoff/assignment.d.ts.map +1 -1
- package/dist/session/handoff/broadcast.d.ts.map +1 -1
- package/dist/session/handoff/broadcast.js.map +1 -1
- package/dist/session/handoff/single.d.ts.map +1 -1
- package/dist/session/handoff/single.js.map +1 -1
- package/dist/session/index.d.ts +0 -1
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +7 -6
- package/dist/session/index.js.map +1 -1
- package/dist/session/intervention/__tests__/prev-artifact.test.js.map +1 -1
- package/dist/session/intervention/prev-artifact.d.ts +1 -1
- package/dist/session/intervention/prev-artifact.d.ts.map +1 -1
- package/dist/session/retention/__tests__/archive.test.js.map +1 -1
- package/dist/session/retention/__tests__/disk-backend.test.js.map +1 -1
- package/dist/session/retention/archive.d.ts +1 -1
- package/dist/session/retention/archive.d.ts.map +1 -1
- package/dist/session/retention/backend.d.ts +4 -4
- package/dist/session/retention/backend.d.ts.map +1 -1
- package/dist/session/retention/disk-backend.d.ts +1 -1
- package/dist/session/retention/disk-backend.d.ts.map +1 -1
- package/dist/session/retention/index.d.ts +3 -3
- package/dist/session/retention/index.d.ts.map +1 -1
- package/dist/session/retention/index.js +4 -2
- package/dist/session/retention/index.js.map +1 -1
- package/dist/session/status/__tests__/derive.test.d.ts +2 -0
- package/dist/session/status/__tests__/derive.test.d.ts.map +1 -0
- package/dist/session/{hierarchy/__tests__/session.test.js → status/__tests__/derive.test.js} +2 -2
- package/dist/session/status/__tests__/derive.test.js.map +1 -0
- package/dist/session/status/derive.d.ts +33 -0
- package/dist/session/status/derive.d.ts.map +1 -0
- package/dist/session/{hierarchy/session.js → status/derive.js} +6 -1
- package/dist/session/status/derive.js.map +1 -0
- package/dist/session/summary/__tests__/materialize.test.js +2 -1
- package/dist/session/summary/__tests__/materialize.test.js.map +1 -1
- package/dist/session/summary/errors.d.ts +43 -0
- package/dist/session/summary/errors.d.ts.map +1 -0
- package/dist/session/summary/errors.js +37 -0
- package/dist/session/summary/errors.js.map +1 -0
- package/dist/session/summary/index.d.ts +4 -3
- package/dist/session/summary/index.d.ts.map +1 -1
- package/dist/session/summary/index.js +5 -4
- package/dist/session/summary/index.js.map +1 -1
- package/dist/session/summary/materialize.d.ts +2 -2
- package/dist/session/summary/materialize.d.ts.map +1 -1
- package/dist/session/summary/materialize.js +2 -1
- package/dist/session/summary/materialize.js.map +1 -1
- package/dist/session/workspace/__tests__/git-worktree.test.js.map +1 -1
- package/dist/session/workspace/driver.d.ts +2 -2
- package/dist/session/workspace/driver.d.ts.map +1 -1
- package/dist/session/workspace/git-worktree.d.ts +1 -1
- package/dist/session/workspace/git-worktree.d.ts.map +1 -1
- package/dist/session/workspace/git-worktree.js.map +1 -1
- package/dist/session/workspace/index.d.ts +1 -1
- package/dist/session/workspace/index.d.ts.map +1 -1
- package/dist/session/workspace/index.js +3 -2
- package/dist/session/workspace/index.js.map +1 -1
- package/dist/store/run/disk.d.ts +4 -4
- package/dist/store/run/disk.d.ts.map +1 -1
- package/dist/store/run/disk.js.map +1 -1
- package/dist/store/session/__tests__/disk.test.js.map +1 -1
- package/dist/store/session/__tests__/memory.test.js.map +1 -1
- package/dist/store/session/disk.d.ts +6 -6
- package/dist/store/session/disk.d.ts.map +1 -1
- package/dist/store/session/disk.js +1 -1
- package/dist/store/session/disk.js.map +1 -1
- package/dist/store/session/index.d.ts +1 -1
- package/dist/store/session/index.d.ts.map +1 -1
- package/dist/store/session/index.js +2 -1
- package/dist/store/session/index.js.map +1 -1
- package/dist/store/session/linkage.d.ts +1 -1
- package/dist/store/session/linkage.d.ts.map +1 -1
- package/dist/store/session/memory.d.ts +5 -5
- package/dist/store/session/memory.d.ts.map +1 -1
- package/dist/store/session/memory.js +1 -1
- package/dist/store/session/memory.js.map +1 -1
- package/dist/store/thread/disk.d.ts +1 -1
- package/dist/store/thread/disk.d.ts.map +1 -1
- package/dist/store/thread/memory.d.ts +1 -1
- package/dist/store/thread/memory.d.ts.map +1 -1
- package/dist/telemetry/attributes.d.ts +0 -1
- package/dist/telemetry/attributes.d.ts.map +1 -1
- package/dist/telemetry/attributes.js +0 -3
- package/dist/telemetry/attributes.js.map +1 -1
- package/dist/telemetry/runtime-accessors.d.ts +1 -2
- package/dist/telemetry/runtime-accessors.d.ts.map +1 -1
- package/dist/telemetry/runtime-accessors.js +1 -4
- package/dist/telemetry/runtime-accessors.js.map +1 -1
- package/dist/tools/builtins/bash.d.ts +1 -1
- package/dist/tools/builtins/computer-use.d.ts +4 -4
- package/dist/tools/builtins/edit.d.ts +1 -1
- package/dist/tools/builtins/glob.d.ts +1 -1
- package/dist/tools/builtins/grep.d.ts +1 -1
- package/dist/tools/builtins/ls.d.ts +1 -1
- package/dist/tools/builtins/read-file.d.ts +1 -1
- package/dist/tools/builtins/search-tools.d.ts +1 -1
- package/dist/tools/builtins/write-file.d.ts +1 -1
- package/dist/types/agent/task.d.ts +2 -2
- package/dist/types/agent/task.d.ts.map +1 -1
- package/dist/{session/hierarchy/project.d.ts → types/project/entity.d.ts} +4 -4
- package/dist/types/project/entity.d.ts.map +1 -0
- package/dist/types/project/entity.js +2 -0
- package/dist/types/project/entity.js.map +1 -0
- package/dist/types/project/index.d.ts +2 -0
- package/dist/types/project/index.d.ts.map +1 -0
- package/dist/types/project/index.js +4 -0
- package/dist/types/project/index.js.map +1 -0
- package/dist/types/retention/archive-backend-ref.d.ts.map +1 -0
- package/dist/types/retention/archive-backend-ref.js.map +1 -0
- package/dist/types/retention/index.d.ts +4 -0
- package/dist/types/retention/index.d.ts.map +1 -0
- package/dist/types/retention/index.js +4 -0
- package/dist/types/retention/index.js.map +1 -0
- package/dist/types/retention/policy.d.ts.map +1 -0
- package/dist/types/retention/policy.js.map +1 -0
- package/dist/types/run/entity.d.ts +56 -0
- package/dist/types/run/entity.d.ts.map +1 -0
- package/dist/types/run/entity.js +2 -0
- package/dist/types/run/entity.js.map +1 -0
- package/dist/types/run/events.d.ts +2 -2
- package/dist/types/run/events.d.ts.map +1 -1
- package/dist/types/run/index.d.ts +7 -1
- package/dist/types/run/index.d.ts.map +1 -1
- package/dist/types/run/index.js +8 -9
- package/dist/types/run/index.js.map +1 -1
- package/dist/{session/hierarchy → types/run}/lineage.d.ts +1 -1
- package/dist/types/run/lineage.d.ts.map +1 -0
- package/dist/types/run/lineage.js.map +1 -0
- package/dist/types/run/replay.d.ts +53 -0
- package/dist/types/run/replay.d.ts.map +1 -0
- package/dist/types/run/replay.js +15 -0
- package/dist/types/run/replay.js.map +1 -0
- package/dist/types/run/schema-version.d.ts.map +1 -0
- package/dist/types/run/schema-version.js.map +1 -0
- package/dist/{session/events/types.d.ts → types/run/subsession-events.d.ts} +5 -5
- package/dist/types/run/subsession-events.d.ts.map +1 -0
- package/dist/types/run/subsession-events.js +2 -0
- package/dist/types/run/subsession-events.js.map +1 -0
- package/dist/{session/hierarchy → types/session}/actor.d.ts +1 -1
- package/dist/types/session/actor.d.ts.map +1 -0
- package/dist/{session/hierarchy → types/session}/actor.js.map +1 -1
- package/dist/types/session/entity.d.ts +51 -0
- package/dist/types/session/entity.d.ts.map +1 -0
- package/dist/types/session/entity.js +2 -0
- package/dist/types/session/entity.js.map +1 -0
- package/dist/types/session/index.d.ts +4 -0
- package/dist/types/session/index.d.ts.map +1 -1
- package/dist/{store → types}/session/messages.d.ts +2 -2
- package/dist/{store → types}/session/messages.d.ts.map +1 -1
- package/dist/types/session/messages.js.map +1 -0
- package/dist/types/session/store.d.ts +6 -6
- package/dist/types/session/store.d.ts.map +1 -1
- package/dist/{session/hierarchy → types/session}/sub-session.d.ts +9 -9
- package/dist/types/session/sub-session.d.ts.map +1 -0
- package/dist/types/session/sub-session.js.map +1 -0
- package/dist/{session → types}/summary/deliverable.d.ts +2 -2
- package/dist/types/summary/deliverable.d.ts.map +1 -0
- package/dist/types/summary/deliverable.js.map +1 -0
- package/dist/types/summary/index.d.ts +4 -0
- package/dist/types/summary/index.d.ts.map +1 -0
- package/dist/types/summary/index.js +4 -0
- package/dist/types/summary/index.js.map +1 -0
- package/dist/{session → types}/summary/ref.d.ts +9 -36
- package/dist/types/summary/ref.d.ts.map +1 -0
- package/dist/types/summary/ref.js +28 -0
- package/dist/types/summary/ref.js.map +1 -0
- package/dist/{session/hierarchy/tenant.d.ts → types/tenant/entity.d.ts} +2 -2
- package/dist/types/tenant/entity.d.ts.map +1 -0
- package/dist/types/tenant/entity.js +2 -0
- package/dist/types/tenant/entity.js.map +1 -0
- package/dist/types/tenant/index.d.ts +2 -0
- package/dist/types/tenant/index.d.ts.map +1 -0
- package/dist/types/tenant/index.js +4 -0
- package/dist/types/tenant/index.js.map +1 -0
- package/dist/{session/hierarchy/thread.d.ts → types/thread/entity.d.ts} +31 -7
- package/dist/types/thread/entity.d.ts.map +1 -0
- package/dist/types/thread/entity.js +2 -0
- package/dist/types/thread/entity.js.map +1 -0
- package/dist/types/thread/index.d.ts +1 -0
- package/dist/types/thread/index.d.ts.map +1 -1
- package/dist/types/thread/store.d.ts +1 -1
- package/dist/types/thread/store.d.ts.map +1 -1
- package/dist/types/workspace/index.d.ts +2 -0
- package/dist/types/workspace/index.d.ts.map +1 -0
- package/dist/types/workspace/index.js +7 -0
- package/dist/types/workspace/index.js.map +1 -0
- package/dist/{session → types}/workspace/ref.d.ts +1 -1
- package/dist/types/workspace/ref.d.ts.map +1 -0
- package/dist/types/workspace/ref.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/replay-public-surface.test.ts +54 -0
- package/src/agents/SupervisorAgent.ts +1 -1
- package/src/bridge/a2a/task.ts +4 -4
- package/src/config/runtime.ts +0 -2
- package/src/contracts/api.ts +2 -2
- package/src/contracts/index.ts +1 -3
- package/src/index.ts +11 -362
- package/src/manager/agent/__tests__/lifecycle.test.ts +2 -2
- package/src/manager/agent/lifecycle.ts +5 -5
- package/src/manager/run/persistence.ts +4 -4
- package/src/manager/thread/__tests__/lifecycle.test.ts +1 -1
- package/src/manager/thread/lifecycle.ts +2 -2
- package/src/plugin/loader.ts +0 -16
- package/src/public-runtime.ts +373 -0
- package/src/public-tools.ts +63 -0
- package/src/public-types.ts +156 -0
- package/src/run/LimitChecker.ts +0 -9
- package/src/run/reporter.ts +3 -3
- package/src/runtime/query/__tests__/checkpoint.test.ts +169 -0
- package/src/runtime/query/checkpoint.ts +54 -0
- package/src/runtime/query/context.ts +0 -5
- package/src/runtime/query/index.ts +4 -4
- package/src/runtime/query/replay/__tests__/mutate.test.ts +134 -0
- package/src/runtime/query/replay/__tests__/prepare.test.ts +207 -0
- package/src/runtime/query/replay/list.ts +32 -0
- package/src/runtime/query/replay/mutate.ts +76 -0
- package/src/runtime/query/replay/prepare.ts +114 -0
- package/src/runtime/query/result.ts +2 -2
- package/src/session/__tests__/integration/_fixtures.ts +2 -2
- package/src/session/__tests__/integration/archive-gate.test.ts +1 -1
- package/src/session/__tests__/integration/capacity-caps.test.ts +1 -1
- package/src/session/__tests__/integration/e2e-spawn.test.ts +1 -1
- package/src/session/__tests__/integration/handoff-broadcast-e2e.test.ts +1 -1
- package/src/session/__tests__/integration/handoff-single-e2e.test.ts +1 -1
- package/src/session/__tests__/integration/prev-artifact-dag.test.ts +4 -1
- package/src/session/__tests__/integration/retention-archive.test.ts +1 -1
- package/src/session/__tests__/integration/spawn-rollback.test.ts +2 -2
- package/src/session/__tests__/integration/summary-materialization-e2e.test.ts +1 -1
- package/src/session/errors.ts +1 -1
- package/src/session/events/index.ts +5 -4
- package/src/session/handoff/__tests__/broadcast.test.ts +1 -1
- package/src/session/handoff/__tests__/capacity.test.ts +1 -1
- package/src/session/handoff/__tests__/single.test.ts +1 -1
- package/src/session/handoff/assignment.ts +1 -1
- package/src/session/handoff/broadcast.ts +2 -2
- package/src/session/handoff/single.ts +2 -2
- package/src/session/index.ts +7 -6
- package/src/session/intervention/__tests__/prev-artifact.test.ts +4 -1
- package/src/session/intervention/prev-artifact.ts +1 -1
- package/src/session/retention/__tests__/archive.test.ts +3 -3
- package/src/session/retention/__tests__/disk-backend.test.ts +4 -4
- package/src/session/retention/archive.ts +2 -2
- package/src/session/retention/backend.ts +4 -4
- package/src/session/retention/disk-backend.ts +4 -4
- package/src/session/retention/index.ts +6 -4
- package/src/session/{hierarchy/__tests__/session.test.ts → status/__tests__/derive.test.ts} +3 -2
- package/src/session/{hierarchy/session.ts → status/derive.ts} +9 -55
- package/src/session/summary/__tests__/materialize.test.ts +4 -7
- package/src/session/summary/errors.ts +51 -0
- package/src/session/summary/index.ts +7 -10
- package/src/session/summary/materialize.ts +4 -5
- package/src/session/workspace/__tests__/git-worktree.test.ts +1 -1
- package/src/session/workspace/driver.ts +2 -2
- package/src/session/workspace/git-worktree.ts +1 -1
- package/src/session/workspace/index.ts +7 -6
- package/src/store/run/disk.ts +4 -4
- package/src/store/session/__tests__/disk.test.ts +2 -2
- package/src/store/session/__tests__/memory.test.ts +2 -2
- package/src/store/session/disk.ts +12 -12
- package/src/store/session/index.ts +3 -2
- package/src/store/session/linkage.ts +1 -1
- package/src/store/session/memory.ts +6 -6
- package/src/store/thread/disk.ts +1 -1
- package/src/store/thread/memory.ts +1 -1
- package/src/telemetry/attributes.ts +0 -4
- package/src/telemetry/runtime-accessors.ts +1 -5
- package/src/types/agent/task.ts +2 -2
- package/src/{session/hierarchy/project.ts → types/project/entity.ts} +3 -3
- package/src/types/project/index.ts +4 -0
- package/src/types/retention/index.ts +6 -0
- package/src/types/run/entity.ts +63 -0
- package/src/types/run/events.ts +6 -6
- package/src/types/run/index.ts +16 -9
- package/src/{session/hierarchy → types/run}/lineage.ts +1 -1
- package/src/types/run/replay.ts +61 -0
- package/src/{session/events/types.ts → types/run/subsession-events.ts} +4 -4
- package/src/{session/hierarchy → types/session}/actor.ts +1 -1
- package/src/types/session/entity.ts +59 -0
- package/src/types/session/index.ts +15 -0
- package/src/{store → types}/session/messages.ts +2 -2
- package/src/types/session/store.ts +6 -6
- package/src/{session/hierarchy → types/session}/sub-session.ts +9 -9
- package/src/{session → types}/summary/deliverable.ts +2 -2
- package/src/types/summary/index.ts +18 -0
- package/src/{session → types}/summary/ref.ts +9 -44
- package/src/{session/hierarchy/tenant.ts → types/tenant/entity.ts} +1 -1
- package/src/types/tenant/index.ts +4 -0
- package/src/{session/hierarchy/thread.ts → types/thread/entity.ts} +30 -6
- package/src/types/thread/index.ts +1 -0
- package/src/types/thread/store.ts +1 -1
- package/src/types/workspace/index.ts +12 -0
- package/src/{session → types}/workspace/ref.ts +1 -1
- package/dist/contracts/ids.d.ts +0 -2
- package/dist/contracts/ids.d.ts.map +0 -1
- package/dist/contracts/ids.js +0 -2
- package/dist/contracts/ids.js.map +0 -1
- package/dist/session/events/schema-version.d.ts.map +0 -1
- package/dist/session/events/schema-version.js.map +0 -1
- package/dist/session/events/types.d.ts.map +0 -1
- package/dist/session/events/types.js +0 -2
- package/dist/session/events/types.js.map +0 -1
- package/dist/session/hierarchy/__tests__/session.test.d.ts +0 -2
- package/dist/session/hierarchy/__tests__/session.test.d.ts.map +0 -1
- package/dist/session/hierarchy/__tests__/session.test.js.map +0 -1
- package/dist/session/hierarchy/actor.d.ts.map +0 -1
- package/dist/session/hierarchy/index.d.ts +0 -9
- package/dist/session/hierarchy/index.d.ts.map +0 -1
- package/dist/session/hierarchy/index.js +0 -4
- package/dist/session/hierarchy/index.js.map +0 -1
- package/dist/session/hierarchy/lineage.d.ts.map +0 -1
- package/dist/session/hierarchy/lineage.js.map +0 -1
- package/dist/session/hierarchy/project.d.ts.map +0 -1
- package/dist/session/hierarchy/project.js +0 -2
- package/dist/session/hierarchy/project.js.map +0 -1
- package/dist/session/hierarchy/session.d.ts +0 -71
- package/dist/session/hierarchy/session.d.ts.map +0 -1
- package/dist/session/hierarchy/session.js.map +0 -1
- package/dist/session/hierarchy/sub-session.d.ts.map +0 -1
- package/dist/session/hierarchy/sub-session.js.map +0 -1
- package/dist/session/hierarchy/tenant.d.ts.map +0 -1
- package/dist/session/hierarchy/tenant.js +0 -2
- package/dist/session/hierarchy/tenant.js.map +0 -1
- package/dist/session/hierarchy/thread.d.ts.map +0 -1
- package/dist/session/hierarchy/thread.js +0 -2
- package/dist/session/hierarchy/thread.js.map +0 -1
- package/dist/session/retention/archive-backend-ref.d.ts.map +0 -1
- package/dist/session/retention/archive-backend-ref.js.map +0 -1
- package/dist/session/retention/policy.d.ts.map +0 -1
- package/dist/session/retention/policy.js.map +0 -1
- package/dist/session/summary/deliverable.d.ts.map +0 -1
- package/dist/session/summary/deliverable.js.map +0 -1
- package/dist/session/summary/ref.d.ts.map +0 -1
- package/dist/session/summary/ref.js +0 -51
- package/dist/session/summary/ref.js.map +0 -1
- package/dist/session/workspace/ref.d.ts.map +0 -1
- package/dist/session/workspace/ref.js.map +0 -1
- package/dist/store/session/messages.js.map +0 -1
- package/dist/tools/builtins/__tests__/structuredOutput.example.d.ts +0 -140
- package/dist/tools/builtins/__tests__/structuredOutput.example.d.ts.map +0 -1
- package/dist/tools/builtins/__tests__/structuredOutput.example.js +0 -183
- package/dist/tools/builtins/__tests__/structuredOutput.example.js.map +0 -1
- package/dist/types/run/state.d.ts +0 -30
- package/dist/types/run/state.d.ts.map +0 -1
- package/dist/types/run/state.js +0 -2
- package/dist/types/run/state.js.map +0 -1
- package/src/contracts/ids.ts +0 -1
- package/src/session/hierarchy/index.ts +0 -18
- package/src/tools/builtins/__tests__/structuredOutput.example.ts +0 -221
- package/src/types/run/state.ts +0 -35
- /package/dist/{session → types}/retention/archive-backend-ref.d.ts +0 -0
- /package/dist/{session → types}/retention/archive-backend-ref.js +0 -0
- /package/dist/{session → types}/retention/policy.d.ts +0 -0
- /package/dist/{session → types}/retention/policy.js +0 -0
- /package/dist/{session/hierarchy → types/run}/lineage.js +0 -0
- /package/dist/{session/events → types/run}/schema-version.d.ts +0 -0
- /package/dist/{session/events → types/run}/schema-version.js +0 -0
- /package/dist/{session/hierarchy → types/session}/actor.js +0 -0
- /package/dist/{store → types}/session/messages.js +0 -0
- /package/dist/{session/hierarchy → types/session}/sub-session.js +0 -0
- /package/dist/{session → types}/summary/deliverable.js +0 -0
- /package/dist/{session → types}/workspace/ref.js +0 -0
- /package/src/{session → types}/retention/archive-backend-ref.ts +0 -0
- /package/src/{session → types}/retention/policy.ts +0 -0
- /package/src/{session/events → types/run}/schema-version.ts +0 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// Sub-barrel for the retention/archival module (Convention #4).
|
|
2
|
-
// Concrete types
|
|
2
|
+
// Concrete shape types live under `types/retention/`; runtime machinery
|
|
3
|
+
// (backend contract, manager, disk backend) lives in sibling files under
|
|
4
|
+
// `session/retention/`.
|
|
3
5
|
|
|
4
|
-
export type { ArchiveBackendRef } from '
|
|
5
|
-
export type { RetentionPolicy } from '
|
|
6
|
-
export { RETENTION_POLICY_DISABLED } from '
|
|
6
|
+
export type { ArchiveBackendRef } from '../../types/retention/archive-backend-ref.js'
|
|
7
|
+
export type { RetentionPolicy } from '../../types/retention/policy.js'
|
|
8
|
+
export { RETENTION_POLICY_DISABLED } from '../../types/retention/policy.js'
|
|
7
9
|
export type { ArchiveBackend, ArchiveInput, ArchiveOutput, SubSessionTombstone } from './backend.js'
|
|
8
10
|
export {
|
|
9
11
|
ArchivalManager,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
2
|
import type { RunStatus } from '../../../types/run/status.js'
|
|
3
|
+
import type { ActorRef } from '../../../types/session/actor.js'
|
|
4
|
+
import type { Session, SessionStatus } from '../../../types/session/entity.js'
|
|
3
5
|
import type {
|
|
4
6
|
ProjectId,
|
|
5
7
|
SessionId,
|
|
@@ -7,8 +9,7 @@ import type {
|
|
|
7
9
|
ThreadId,
|
|
8
10
|
UserId,
|
|
9
11
|
} from '../../../types/session/ids.js'
|
|
10
|
-
import
|
|
11
|
-
import { type Session, type SessionStatus, deriveStatus } from '../session.js'
|
|
12
|
+
import { deriveStatus } from '../derive.js'
|
|
12
13
|
|
|
13
14
|
const tenant = 'tnt_a' as TenantId
|
|
14
15
|
const project = 'prj_a' as ProjectId
|
|
@@ -1,61 +1,11 @@
|
|
|
1
|
-
import type { SessionId, TenantId } from '../../types/ids/index.js'
|
|
2
|
-
import type { RunStatus } from '../../types/run/status.js'
|
|
3
|
-
import type { ProjectId, ThreadId, WorkspaceId } from '../../types/session/ids.js'
|
|
4
|
-
import type { ActorRef } from './actor.js'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Session lifecycle states. See session-hierarchy.md §4.3 and the state
|
|
8
|
-
* machine in §5.1. `awaiting_merge` is a sub-state of idle used on the
|
|
9
|
-
* broadcast source session (§5.4) between fan-out and all recipients
|
|
10
|
-
* terminalizing.
|
|
11
|
-
*/
|
|
12
|
-
export type SessionStatus =
|
|
13
|
-
| 'active'
|
|
14
|
-
| 'idle'
|
|
15
|
-
| 'locked'
|
|
16
|
-
| 'awaiting_hitl'
|
|
17
|
-
| 'awaiting_merge'
|
|
18
|
-
| 'failed'
|
|
19
|
-
| 'archived'
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Multi-turn work unit owned by exactly one {@link ActorRef} at a time.
|
|
23
|
-
*
|
|
24
|
-
* Scope identifiers:
|
|
25
|
-
* - `threadId` — the topic-level {@link Thread} this Session lives under.
|
|
26
|
-
* Set at creation, immutable; Sessions never move threads.
|
|
27
|
-
* - `projectId` — the {@link Project} the owning Thread belongs to.
|
|
28
|
-
* **Denormalized** from `thread.projectId` at creation time; immutable.
|
|
29
|
-
* Kept on the Session record for ergonomic access (Project-scoped
|
|
30
|
-
* consumers — handoff validators, archival, retention — would otherwise
|
|
31
|
-
* need a second round-trip to ThreadStore on every read). This is NOT
|
|
32
|
-
* a deprecated mirror of a fading field; it is a deliberate
|
|
33
|
-
* denormalization of structurally-immutable derived data.
|
|
34
|
-
*
|
|
35
|
-
* Other invariants (session-hierarchy.md §4.3):
|
|
36
|
-
* - `previousActors` is append-only and publicly read-only; previous
|
|
37
|
-
* owners cannot write to the session again.
|
|
38
|
-
* - `ownerVersion` is the CAS counter for handoff (§6.1 / §6.2 / §6.4).
|
|
39
|
-
* - `workspaceId` is nullable for sessions whose workspace has not yet
|
|
40
|
-
* been provisioned (or has been torn down during archival).
|
|
41
|
-
*/
|
|
42
|
-
export interface Session {
|
|
43
|
-
id: SessionId
|
|
44
|
-
threadId: ThreadId
|
|
45
|
-
projectId: ProjectId
|
|
46
|
-
tenantId: TenantId
|
|
47
|
-
status: SessionStatus
|
|
48
|
-
currentActor: ActorRef | null
|
|
49
|
-
previousActors: readonly ActorRef[]
|
|
50
|
-
workspaceId: WorkspaceId | null
|
|
51
|
-
ownerVersion: number
|
|
52
|
-
createdAt: Date
|
|
53
|
-
updatedAt: Date
|
|
54
|
-
}
|
|
55
|
-
|
|
56
1
|
/**
|
|
57
2
|
* Pure Run→Session fan-in helper per session-hierarchy.md §5.1.
|
|
58
3
|
*
|
|
4
|
+
* Extracted from `session/hierarchy/session.ts` on 2026-04-21 (ses_010 commit
|
|
5
|
+
* 4) so the shape definition can live under `types/session/` while the
|
|
6
|
+
* runtime helper stays in a feature folder — the type-layering rule
|
|
7
|
+
* (`types/` = pure shapes, feature folders = runtime).
|
|
8
|
+
*
|
|
59
9
|
* The precedence (highest first) matches the pattern-doc table:
|
|
60
10
|
* 1. Session-level states that do not fan in from Run status:
|
|
61
11
|
* - `locked` (handoff CAS window) — preserved verbatim
|
|
@@ -75,6 +25,10 @@ export interface Session {
|
|
|
75
25
|
* not a terminal Session state"). Only `failed` runs drive the Session to
|
|
76
26
|
* `failed` when every Run ended that way.
|
|
77
27
|
*/
|
|
28
|
+
|
|
29
|
+
import type { RunStatus } from '../../types/run/status.js'
|
|
30
|
+
import type { Session, SessionStatus } from '../../types/session/entity.js'
|
|
31
|
+
|
|
78
32
|
export function deriveStatus(
|
|
79
33
|
session: Session,
|
|
80
34
|
runs: readonly { status: RunStatus }[],
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
2
|
import { TenantIsolationError } from '../../../session/errors.js'
|
|
3
|
-
import type { ActorRef } from '../../../session/hierarchy/actor.js'
|
|
4
3
|
import { InMemorySessionStore } from '../../../store/session/memory.js'
|
|
5
4
|
import type { AgentId, SessionId, TenantId, UserId } from '../../../types/ids/index.js'
|
|
5
|
+
import type { ActorRef } from '../../../types/session/actor.js'
|
|
6
6
|
import type { SummaryId, ThreadId } from '../../../types/session/ids.js'
|
|
7
|
-
import type { DeliverableRef } from '
|
|
7
|
+
import type { DeliverableRef } from '../../../types/summary/deliverable.js'
|
|
8
|
+
import { AGENT_SUMMARY_MAX_CHARS } from '../../../types/summary/ref.js'
|
|
9
|
+
import { AgentSummaryTooLongError, SessionAlreadySummarizedError } from '../errors.js'
|
|
8
10
|
import { SessionSummaryMaterializer } from '../materialize.js'
|
|
9
|
-
import {
|
|
10
|
-
AGENT_SUMMARY_MAX_CHARS,
|
|
11
|
-
AgentSummaryTooLongError,
|
|
12
|
-
SessionAlreadySummarizedError,
|
|
13
|
-
} from '../ref.js'
|
|
14
11
|
|
|
15
12
|
const TEST_THREAD_ID = 'thd_test' as ThreadId
|
|
16
13
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime errors emitted by the session-summary materialization path.
|
|
3
|
+
*
|
|
4
|
+
* Split from `session/summary/ref.ts` on 2026-04-21 (ses_010 commit 1): the
|
|
5
|
+
* shape types moved to `types/summary/ref.ts`; runtime behaviour (error
|
|
6
|
+
* classes, materializer) remains under `session/summary/`. This keeps the
|
|
7
|
+
* type-layering rule consistent — `types/` holds only pure shapes.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { SessionId } from '../../types/ids/index.js'
|
|
11
|
+
import type { SummaryId } from '../../types/session/ids.js'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Raised by `SessionSummaryMaterializer.materialize` when the provided
|
|
15
|
+
* `agentSummary` exceeds the max-character bound declared at
|
|
16
|
+
* `types/summary/ref.ts#AGENT_SUMMARY_MAX_CHARS`. Convention #5
|
|
17
|
+
* deny-by-default — the kernel does not truncate silently.
|
|
18
|
+
*/
|
|
19
|
+
export class AgentSummaryTooLongError extends Error {
|
|
20
|
+
readonly details: {
|
|
21
|
+
readonly actual: number
|
|
22
|
+
readonly max: number
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
constructor(details: { actual: number; max: number }) {
|
|
26
|
+
super(`agentSummary ${details.actual} chars exceeds max ${details.max}`)
|
|
27
|
+
this.name = 'AgentSummaryTooLongError'
|
|
28
|
+
this.details = details
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Raised when `SessionSummaryMaterializer.materialize` is invoked against a
|
|
34
|
+
* session that already has a persisted summary. Re-materialization would
|
|
35
|
+
* duplicate history — callers wanting to append must open a new intervention
|
|
36
|
+
* sub-session (see session-hierarchy.md §4.5).
|
|
37
|
+
*/
|
|
38
|
+
export class SessionAlreadySummarizedError extends Error {
|
|
39
|
+
readonly details: {
|
|
40
|
+
readonly sessionId: SessionId
|
|
41
|
+
readonly existingSummaryId: SummaryId
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
constructor(details: { sessionId: SessionId; existingSummaryId: SummaryId }) {
|
|
45
|
+
super(
|
|
46
|
+
`Session ${details.sessionId} already has summary ${details.existingSummaryId}; re-materialization rejected`,
|
|
47
|
+
)
|
|
48
|
+
this.name = 'SessionAlreadySummarizedError'
|
|
49
|
+
this.details = details
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Sub-barrel for the session summary module (Convention #4).
|
|
2
2
|
//
|
|
3
3
|
// See session-hierarchy.md §4.7 (SessionSummaryRef shape) and §8.1
|
|
4
|
-
// (kernel-only emission invariant).
|
|
5
|
-
//
|
|
6
|
-
//
|
|
4
|
+
// (kernel-only emission invariant). Shape types live under
|
|
5
|
+
// `types/summary/`; runtime (materializer + error classes) lives in
|
|
6
|
+
// sibling files under `session/summary/`.
|
|
7
7
|
|
|
8
8
|
export type {
|
|
9
9
|
ArtifactBlobDeliverable,
|
|
@@ -12,18 +12,15 @@ export type {
|
|
|
12
12
|
FileDeliverable,
|
|
13
13
|
MessageDeliverable,
|
|
14
14
|
SessionSummaryDeliverable,
|
|
15
|
-
} from '
|
|
16
|
-
export {
|
|
17
|
-
AGENT_SUMMARY_MAX_CHARS,
|
|
18
|
-
AgentSummaryTooLongError,
|
|
19
|
-
SessionAlreadySummarizedError,
|
|
20
|
-
} from './ref.js'
|
|
15
|
+
} from '../../types/summary/deliverable.js'
|
|
16
|
+
export { AGENT_SUMMARY_MAX_CHARS } from '../../types/summary/ref.js'
|
|
21
17
|
export type {
|
|
22
18
|
SessionSummaryKeyDecision,
|
|
23
19
|
SessionSummaryOutcome,
|
|
24
20
|
SessionSummaryOutcomeStatus,
|
|
25
21
|
SessionSummaryRef,
|
|
26
|
-
} from '
|
|
22
|
+
} from '../../types/summary/ref.js'
|
|
23
|
+
export { AgentSummaryTooLongError, SessionAlreadySummarizedError } from './errors.js'
|
|
27
24
|
export { SessionSummaryMaterializer } from './materialize.js'
|
|
28
25
|
export type {
|
|
29
26
|
MaterializeInput,
|
|
@@ -19,18 +19,17 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
import type { SessionId, TenantId } from '../../types/ids/index.js'
|
|
22
|
+
import type { Session } from '../../types/session/entity.js'
|
|
22
23
|
import type { SummaryId } from '../../types/session/ids.js'
|
|
23
24
|
import type { SessionStore } from '../../types/session/store.js'
|
|
24
|
-
import type {
|
|
25
|
-
import type { DeliverableRef } from './deliverable.js'
|
|
25
|
+
import type { DeliverableRef } from '../../types/summary/deliverable.js'
|
|
26
26
|
import {
|
|
27
27
|
AGENT_SUMMARY_MAX_CHARS,
|
|
28
|
-
AgentSummaryTooLongError,
|
|
29
|
-
SessionAlreadySummarizedError,
|
|
30
28
|
type SessionSummaryKeyDecision,
|
|
31
29
|
type SessionSummaryOutcome,
|
|
32
30
|
type SessionSummaryRef,
|
|
33
|
-
} from '
|
|
31
|
+
} from '../../types/summary/ref.js'
|
|
32
|
+
import { AgentSummaryTooLongError, SessionAlreadySummarizedError } from './errors.js'
|
|
34
33
|
|
|
35
34
|
/**
|
|
36
35
|
* Dependencies for {@link SessionSummaryMaterializer}. The generator is
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from 'vitest'
|
|
2
|
+
import type { WorkspaceRef } from '../../../types/workspace/ref.js'
|
|
2
3
|
import { WorkspaceBackendError } from '../../errors.js'
|
|
3
4
|
import {
|
|
4
5
|
type ExecFile,
|
|
@@ -6,7 +7,6 @@ import {
|
|
|
6
7
|
GitWorktreeDriver,
|
|
7
8
|
parseWorktreeList,
|
|
8
9
|
} from '../git-worktree.js'
|
|
9
|
-
import type { WorkspaceRef } from '../ref.js'
|
|
10
10
|
|
|
11
11
|
function stubLogger() {
|
|
12
12
|
return {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* later phase (Convention #10: provider abstraction).
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import type { WorkspaceBackendKind, WorkspaceRef } from '
|
|
12
|
+
import type { WorkspaceBackendKind, WorkspaceRef } from '../../types/workspace/ref.js'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Params for {@link WorkspaceBackendDriver.create}. `baseRef` selects the
|
|
@@ -57,4 +57,4 @@ export interface WorkspaceBackendDriver {
|
|
|
57
57
|
inspect(ref: WorkspaceRef): Promise<WorkspaceInspection>
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
export type { WorkspaceBackendKind } from '
|
|
60
|
+
export type { WorkspaceBackendKind } from '../../types/workspace/ref.js'
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import { execFile } from 'node:child_process'
|
|
14
14
|
import { join } from 'node:path'
|
|
15
15
|
import { promisify } from 'node:util'
|
|
16
|
+
import type { GitWorktreeBackendMeta, WorkspaceRef } from '../../types/workspace/ref.js'
|
|
16
17
|
import { generateWorkspaceId } from '../../utils/id.js'
|
|
17
18
|
import type { Logger } from '../../utils/logger.js'
|
|
18
19
|
import { WorkspaceBackendError } from '../errors.js'
|
|
@@ -22,7 +23,6 @@ import type {
|
|
|
22
23
|
WorkspaceBackendDriver,
|
|
23
24
|
WorkspaceInspection,
|
|
24
25
|
} from './driver.js'
|
|
25
|
-
import type { GitWorktreeBackendMeta, WorkspaceRef } from './ref.js'
|
|
26
26
|
|
|
27
27
|
const execFileAsync = promisify(execFile)
|
|
28
28
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// Sub-barrel for the workspace module (Convention #4).
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// Shape types live under `types/workspace/`; runtime machinery (drivers,
|
|
3
|
+
// registry, path-builder, git-worktree) lives in sibling files under
|
|
4
|
+
// `session/workspace/`.
|
|
4
5
|
|
|
5
6
|
export type {
|
|
6
|
-
WorkspaceRef,
|
|
7
|
-
WorkspaceBackendMeta,
|
|
8
|
-
WorkspaceBackendKind,
|
|
9
7
|
GitWorktreeBackendMeta,
|
|
10
|
-
|
|
8
|
+
WorkspaceBackendKind,
|
|
9
|
+
WorkspaceBackendMeta,
|
|
10
|
+
WorkspaceRef,
|
|
11
|
+
} from '../../types/workspace/ref.js'
|
|
11
12
|
|
|
12
13
|
export type {
|
|
13
14
|
WorkspaceBackendDriver,
|
package/src/store/run/disk.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { appendFile, mkdir, readFile, readdir, rename, unlink, writeFile } from 'node:fs/promises'
|
|
2
2
|
import { join } from 'node:path'
|
|
3
3
|
import type { CheckpointId, IterationCheckpoint } from '../../types/hitl/index.js'
|
|
4
|
-
import type {
|
|
4
|
+
import type { Run, RunEvent, RunStoreConfig } from '../../types/run/index.js'
|
|
5
5
|
import { type Logger, getRootLogger } from '../../utils/logger.js'
|
|
6
6
|
|
|
7
7
|
export class RunDiskStore {
|
|
@@ -44,7 +44,7 @@ export class RunDiskStore {
|
|
|
44
44
|
await appendFile(join(dir, 'transcript.jsonl'), line, 'utf-8')
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
async writeRunMeta(run:
|
|
47
|
+
async writeRunMeta(run: Run): Promise<void> {
|
|
48
48
|
const dir = this.requireInit()
|
|
49
49
|
|
|
50
50
|
const meta: Record<string, unknown> = {
|
|
@@ -65,7 +65,7 @@ export class RunDiskStore {
|
|
|
65
65
|
await atomicWriteJson(join(dir, 'run.json'), meta)
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
async writeMessages(run:
|
|
68
|
+
async writeMessages(run: Run): Promise<void> {
|
|
69
69
|
const dir = this.requireInit()
|
|
70
70
|
await atomicWriteJson(join(dir, 'messages.json'), run.messages)
|
|
71
71
|
}
|
|
@@ -151,7 +151,7 @@ export class RunDiskStore {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
async addToIndex(run:
|
|
154
|
+
async addToIndex(run: Run): Promise<void> {
|
|
155
155
|
if (run.parentRunId) return
|
|
156
156
|
|
|
157
157
|
const prev = this.indexLock
|
|
@@ -4,9 +4,9 @@ import { tmpdir } from 'node:os'
|
|
|
4
4
|
import { join } from 'node:path'
|
|
5
5
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
6
6
|
import { TenantIsolationError } from '../../../session/errors.js'
|
|
7
|
-
import type { ActorRef } from '../../../session/hierarchy/actor.js'
|
|
8
7
|
import type { AgentId, TenantId, UserId } from '../../../types/ids/index.js'
|
|
9
8
|
import { createUserMessage } from '../../../types/message/index.js'
|
|
9
|
+
import type { ActorRef } from '../../../types/session/actor.js'
|
|
10
10
|
import { DiskSessionStore } from '../disk.js'
|
|
11
11
|
|
|
12
12
|
const tenantA = 'tnt_alpha' as TenantId
|
|
@@ -389,9 +389,9 @@ describe('DiskSessionStore', () => {
|
|
|
389
389
|
})
|
|
390
390
|
})
|
|
391
391
|
|
|
392
|
-
import type { SessionSummaryRef } from '../../../session/summary/ref.js'
|
|
393
392
|
// Import after use so tests are self-contained w.r.t. types we already use.
|
|
394
393
|
import type { SessionId } from '../../../types/ids/index.js'
|
|
395
394
|
import type { SummaryId, ThreadId } from '../../../types/session/ids.js'
|
|
395
|
+
import type { SessionSummaryRef } from '../../../types/summary/ref.js'
|
|
396
396
|
|
|
397
397
|
const TEST_THREAD_ID = 'thd_test' as ThreadId
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
2
|
import { TenantIsolationError } from '../../../session/errors.js'
|
|
3
|
-
import type { ActorRef } from '../../../session/hierarchy/actor.js'
|
|
4
|
-
import type { SubSession } from '../../../session/hierarchy/sub-session.js'
|
|
5
3
|
import type { AgentId, SessionId, TenantId, UserId } from '../../../types/ids/index.js'
|
|
6
4
|
import { createUserMessage } from '../../../types/message/index.js'
|
|
5
|
+
import type { ActorRef } from '../../../types/session/actor.js'
|
|
7
6
|
import type { ThreadId } from '../../../types/session/ids.js'
|
|
7
|
+
import type { SubSession } from '../../../types/session/sub-session.js'
|
|
8
8
|
import { InMemorySessionStore } from '../memory.js'
|
|
9
9
|
|
|
10
10
|
const TEST_THREAD_ID = 'thd_test' as ThreadId
|
|
@@ -33,19 +33,13 @@ import {
|
|
|
33
33
|
} from 'node:fs/promises'
|
|
34
34
|
import { join } from 'node:path'
|
|
35
35
|
import { TenantIsolationError } from '../../session/errors.js'
|
|
36
|
-
import
|
|
37
|
-
import type { Session } from '../../session/hierarchy/session.js'
|
|
38
|
-
import type { SubSession } from '../../session/hierarchy/sub-session.js'
|
|
39
|
-
import type { DeliverableRef } from '../../session/summary/deliverable.js'
|
|
40
|
-
import { SessionAlreadySummarizedError } from '../../session/summary/ref.js'
|
|
41
|
-
import type {
|
|
42
|
-
SessionSummaryKeyDecision,
|
|
43
|
-
SessionSummaryOutcome,
|
|
44
|
-
SessionSummaryRef,
|
|
45
|
-
} from '../../session/summary/ref.js'
|
|
36
|
+
import { SessionAlreadySummarizedError } from '../../session/summary/errors.js'
|
|
46
37
|
import type { MessageId, SessionId, TenantId } from '../../types/ids/index.js'
|
|
47
38
|
import type { Message } from '../../types/message/index.js'
|
|
39
|
+
import type { Project } from '../../types/project/entity.js'
|
|
40
|
+
import type { Session } from '../../types/session/entity.js'
|
|
48
41
|
import type { ProjectId, SubSessionId, SummaryId, ThreadId } from '../../types/session/ids.js'
|
|
42
|
+
import type { SessionMessage } from '../../types/session/messages.js'
|
|
49
43
|
import type {
|
|
50
44
|
CreateProjectParams,
|
|
51
45
|
CreateSessionParams,
|
|
@@ -53,6 +47,13 @@ import type {
|
|
|
53
47
|
SessionStore,
|
|
54
48
|
SessionView,
|
|
55
49
|
} from '../../types/session/store.js'
|
|
50
|
+
import type { SubSession } from '../../types/session/sub-session.js'
|
|
51
|
+
import type { DeliverableRef } from '../../types/summary/deliverable.js'
|
|
52
|
+
import type {
|
|
53
|
+
SessionSummaryKeyDecision,
|
|
54
|
+
SessionSummaryOutcome,
|
|
55
|
+
SessionSummaryRef,
|
|
56
|
+
} from '../../types/summary/ref.js'
|
|
56
57
|
import {
|
|
57
58
|
generateMessageId,
|
|
58
59
|
generateProjectId,
|
|
@@ -61,7 +62,6 @@ import {
|
|
|
61
62
|
} from '../../utils/id.js'
|
|
62
63
|
import { getAncestry, getChildren, orderChildren } from './linkage.js'
|
|
63
64
|
import type { LinkageView } from './linkage.js'
|
|
64
|
-
import type { SessionMessage } from './messages.js'
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* Config for {@link DiskSessionStore}. `rootDir` is absolute; all files live
|
|
@@ -973,4 +973,4 @@ async function atomicWriteJson(filePath: string, value: unknown): Promise<void>
|
|
|
973
973
|
// line is a whole record. This matches pattern doc §13.4 persistence
|
|
974
974
|
// (`messages.json[l]` as append-only event log).
|
|
975
975
|
|
|
976
|
-
export type { SessionMessage } from '
|
|
976
|
+
export type { SessionMessage } from '../../types/session/messages.js'
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
// Messages are scoped to a `SessionId` and every accessor carries explicit
|
|
4
4
|
// `TenantId` (Convention #17). Concrete implementations live in sibling
|
|
5
5
|
// files; re-export them here so consumers import via
|
|
6
|
-
// `../store/session/index.js`.
|
|
6
|
+
// `../store/session/index.js`. The `SessionMessage` shape lives under
|
|
7
|
+
// `types/session/messages.ts` — re-exported here for convenience.
|
|
7
8
|
|
|
8
9
|
export { InMemorySessionStore } from './memory.js'
|
|
9
10
|
export { DiskSessionStore } from './disk.js'
|
|
10
11
|
export type { DiskSessionStoreConfig } from './disk.js'
|
|
11
|
-
export type { SessionMessage } from '
|
|
12
|
+
export type { SessionMessage } from '../../types/session/messages.js'
|
|
12
13
|
export { getAncestry, getChildren, orderChildren } from './linkage.js'
|
|
13
14
|
export type { LinkageView } from './linkage.js'
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { AncestryCycleError } from '../../session/errors.js'
|
|
12
|
-
import type { SubSession } from '../../session/hierarchy/sub-session.js'
|
|
13
12
|
import type { SessionId } from '../../types/ids/index.js'
|
|
14
13
|
import type { SubSessionId } from '../../types/session/ids.js'
|
|
14
|
+
import type { SubSession } from '../../types/session/sub-session.js'
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Read shape required by the pure linkage helpers. Both in-memory and disk
|
|
@@ -9,14 +9,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { TenantIsolationError } from '../../session/errors.js'
|
|
12
|
-
import
|
|
13
|
-
import type { Session } from '../../session/hierarchy/session.js'
|
|
14
|
-
import type { SubSession } from '../../session/hierarchy/sub-session.js'
|
|
15
|
-
import { SessionAlreadySummarizedError } from '../../session/summary/ref.js'
|
|
16
|
-
import type { SessionSummaryRef } from '../../session/summary/ref.js'
|
|
12
|
+
import { SessionAlreadySummarizedError } from '../../session/summary/errors.js'
|
|
17
13
|
import type { MessageId, SessionId, TenantId } from '../../types/ids/index.js'
|
|
18
14
|
import type { Message } from '../../types/message/index.js'
|
|
15
|
+
import type { Project } from '../../types/project/entity.js'
|
|
16
|
+
import type { Session } from '../../types/session/entity.js'
|
|
19
17
|
import type { ProjectId, SubSessionId, ThreadId } from '../../types/session/ids.js'
|
|
18
|
+
import type { SessionMessage } from '../../types/session/messages.js'
|
|
20
19
|
import type {
|
|
21
20
|
CreateProjectParams,
|
|
22
21
|
CreateSessionParams,
|
|
@@ -24,6 +23,8 @@ import type {
|
|
|
24
23
|
SessionStore,
|
|
25
24
|
SessionView,
|
|
26
25
|
} from '../../types/session/store.js'
|
|
26
|
+
import type { SubSession } from '../../types/session/sub-session.js'
|
|
27
|
+
import type { SessionSummaryRef } from '../../types/summary/ref.js'
|
|
27
28
|
import {
|
|
28
29
|
generateMessageId,
|
|
29
30
|
generateProjectId,
|
|
@@ -32,7 +33,6 @@ import {
|
|
|
32
33
|
} from '../../utils/id.js'
|
|
33
34
|
import { getAncestry, getChildren, orderChildren } from './linkage.js'
|
|
34
35
|
import type { LinkageView } from './linkage.js'
|
|
35
|
-
import type { SessionMessage } from './messages.js'
|
|
36
36
|
|
|
37
37
|
interface ProjectRecord {
|
|
38
38
|
tenantId: TenantId
|
package/src/store/thread/disk.ts
CHANGED
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
import { mkdir, readFile, readdir, rename, rm, unlink, writeFile } from 'node:fs/promises'
|
|
23
23
|
import { join } from 'node:path'
|
|
24
24
|
import { StaleThreadError, TenantIsolationError } from '../../session/errors.js'
|
|
25
|
-
import type { Thread, ThreadStatus } from '../../session/hierarchy/thread.js'
|
|
26
25
|
import type { TenantId } from '../../types/ids/index.js'
|
|
27
26
|
import type { ProjectId, ThreadId } from '../../types/session/ids.js'
|
|
27
|
+
import type { Thread, ThreadStatus } from '../../types/thread/entity.js'
|
|
28
28
|
import type { CreateThreadParams, ThreadStore } from '../../types/thread/store.js'
|
|
29
29
|
import { generateThreadId } from '../../utils/id.js'
|
|
30
30
|
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { StaleThreadError, TenantIsolationError } from '../../session/errors.js'
|
|
12
|
-
import type { Thread } from '../../session/hierarchy/thread.js'
|
|
13
12
|
import type { TenantId } from '../../types/ids/index.js'
|
|
14
13
|
import type { ProjectId, ThreadId } from '../../types/session/ids.js'
|
|
14
|
+
import type { Thread } from '../../types/thread/entity.js'
|
|
15
15
|
import type { CreateThreadParams, ThreadStore } from '../../types/thread/store.js'
|
|
16
16
|
import { generateThreadId } from '../../utils/id.js'
|
|
17
17
|
|
|
@@ -8,10 +8,6 @@ export function agentIterationSpanName(iteration: number): string {
|
|
|
8
8
|
return `namzu.agent.iteration ${iteration}`
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export function chatSpanName(model: string): string {
|
|
12
|
-
return `chat ${model}`
|
|
13
|
-
}
|
|
14
|
-
|
|
15
11
|
export function toolSpanName(toolName: string): string {
|
|
16
12
|
return `namzu.tool.execute ${toolName}`
|
|
17
13
|
}
|
|
@@ -8,12 +8,8 @@
|
|
|
8
8
|
// return the no-op defaults and every span/meter write is silently
|
|
9
9
|
// discarded — standard OTEL library behavior.
|
|
10
10
|
|
|
11
|
-
import { type
|
|
11
|
+
import { type Tracer, trace } from '@opentelemetry/api'
|
|
12
12
|
|
|
13
13
|
export function getTracer(): Tracer {
|
|
14
14
|
return trace.getTracer('namzu')
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
export function getMeter(): Meter {
|
|
18
|
-
return metrics.getMeter('namzu')
|
|
19
|
-
}
|
package/src/types/agent/task.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ActorRef } from '../../session/
|
|
2
|
-
import type { WorkspaceBackendKind } from '../../
|
|
1
|
+
import type { ActorRef } from '../../types/session/actor.js'
|
|
2
|
+
import type { WorkspaceBackendKind } from '../../types/workspace/ref.js'
|
|
3
3
|
import type { TokenUsage } from '../common/index.js'
|
|
4
4
|
import type { RunId, SessionId, TaskId, TenantId } from '../ids/index.js'
|
|
5
5
|
import type { Message } from '../message/index.js'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { RetentionPolicy } from '../../types/retention/policy.js'
|
|
2
|
+
import type { KnowledgeBaseRef, MemoryStoreRef, TenantId, VaultRef } from '../ids/index.js'
|
|
3
|
+
import type { ProjectId } from '../session/ids.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Per-project configuration. Defaults per session-hierarchy.md §3 / §4.2 /
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Sub-barrel for the retention shape surface (Convention #4).
|
|
2
|
+
// Concrete types live in sibling files; re-export them here.
|
|
3
|
+
|
|
4
|
+
export type { ArchiveBackendRef } from './archive-backend-ref.js'
|
|
5
|
+
export type { RetentionPolicy } from './policy.js'
|
|
6
|
+
export { RETENTION_POLICY_DISABLED } from './policy.js'
|