@namzu/sdk 34.2.0 → 35.0.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 +133 -0
- package/README.md +2 -6
- package/dist/agents/PipelineAgent.d.ts.map +1 -1
- package/dist/agents/PipelineAgent.js +118 -100
- package/dist/agents/PipelineAgent.js.map +1 -1
- package/dist/agents/ReactiveAgent.d.ts.map +1 -1
- package/dist/agents/ReactiveAgent.js +2 -0
- package/dist/agents/ReactiveAgent.js.map +1 -1
- package/dist/agents/RouterAgent.d.ts.map +1 -1
- package/dist/agents/RouterAgent.js +105 -61
- package/dist/agents/RouterAgent.js.map +1 -1
- package/dist/agents/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/SupervisorAgent.js +8 -4
- package/dist/agents/SupervisorAgent.js.map +1 -1
- package/dist/agents/budget.d.ts +6 -0
- package/dist/agents/budget.d.ts.map +1 -0
- package/dist/agents/budget.js +33 -0
- package/dist/agents/budget.js.map +1 -0
- package/dist/agents/explore.d.ts +20 -0
- package/dist/agents/explore.d.ts.map +1 -0
- package/dist/agents/explore.js +26 -0
- package/dist/agents/explore.js.map +1 -0
- package/dist/agents/file-definitions.d.ts +80 -0
- package/dist/agents/file-definitions.d.ts.map +1 -0
- package/dist/agents/file-definitions.js +179 -0
- package/dist/agents/file-definitions.js.map +1 -0
- package/dist/agents/index.d.ts +3 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +2 -0
- package/dist/agents/index.js.map +1 -1
- package/dist/bridge/a2a/mapper.d.ts.map +1 -1
- package/dist/bridge/a2a/mapper.js +6 -0
- package/dist/bridge/a2a/mapper.js.map +1 -1
- package/dist/bridge/sse/mapper.d.ts.map +1 -1
- package/dist/bridge/sse/mapper.js +22 -0
- package/dist/bridge/sse/mapper.js.map +1 -1
- package/dist/bus/lock.d.ts.map +1 -1
- package/dist/bus/lock.js +1 -10
- package/dist/bus/lock.js.map +1 -1
- package/dist/compaction/consolidation.d.ts +31 -0
- package/dist/compaction/consolidation.d.ts.map +1 -0
- package/dist/compaction/consolidation.js +63 -0
- package/dist/compaction/consolidation.js.map +1 -0
- package/dist/compaction/factory.d.ts.map +1 -1
- package/dist/compaction/factory.js +3 -0
- package/dist/compaction/factory.js.map +1 -1
- package/dist/compaction/index.d.ts +6 -1
- package/dist/compaction/index.d.ts.map +1 -1
- package/dist/compaction/index.js +6 -0
- package/dist/compaction/index.js.map +1 -1
- package/dist/compaction/manager.d.ts +7 -0
- package/dist/compaction/manager.d.ts.map +1 -1
- package/dist/compaction/manager.js +31 -0
- package/dist/compaction/manager.js.map +1 -1
- package/dist/compaction/plan.d.ts +23 -0
- package/dist/compaction/plan.d.ts.map +1 -1
- package/dist/compaction/plan.js +41 -24
- package/dist/compaction/plan.js.map +1 -1
- package/dist/compaction/salience/bm25.d.ts +26 -0
- package/dist/compaction/salience/bm25.d.ts.map +1 -0
- package/dist/compaction/salience/bm25.js +56 -0
- package/dist/compaction/salience/bm25.js.map +1 -0
- package/dist/compaction/salience/goal.d.ts +21 -0
- package/dist/compaction/salience/goal.d.ts.map +1 -0
- package/dist/compaction/salience/goal.js +32 -0
- package/dist/compaction/salience/goal.js.map +1 -0
- package/dist/compaction/salience/index.d.ts +4 -0
- package/dist/compaction/salience/index.d.ts.map +1 -0
- package/dist/compaction/salience/index.js +4 -0
- package/dist/compaction/salience/index.js.map +1 -0
- package/dist/compaction/salience/minhash.d.ts +17 -0
- package/dist/compaction/salience/minhash.d.ts.map +1 -0
- package/dist/compaction/salience/minhash.js +54 -0
- package/dist/compaction/salience/minhash.js.map +1 -0
- package/dist/compaction/salience/score.d.ts +64 -0
- package/dist/compaction/salience/score.d.ts.map +1 -0
- package/dist/compaction/salience/score.js +256 -0
- package/dist/compaction/salience/score.js.map +1 -0
- package/dist/compaction/salience/tokenize.d.ts +20 -0
- package/dist/compaction/salience/tokenize.d.ts.map +1 -0
- package/dist/compaction/salience/tokenize.js +92 -0
- package/dist/compaction/salience/tokenize.js.map +1 -0
- package/dist/compaction/salience/working-set.d.ts +59 -0
- package/dist/compaction/salience/working-set.d.ts.map +1 -0
- package/dist/compaction/salience/working-set.js +137 -0
- package/dist/compaction/salience/working-set.js.map +1 -0
- package/dist/compaction/serializer.d.ts +2 -0
- package/dist/compaction/serializer.d.ts.map +1 -1
- package/dist/compaction/serializer.js +15 -0
- package/dist/compaction/serializer.js.map +1 -1
- package/dist/compaction/token-estimate.d.ts +13 -0
- package/dist/compaction/token-estimate.d.ts.map +1 -0
- package/dist/compaction/token-estimate.js +58 -0
- package/dist/compaction/token-estimate.js.map +1 -0
- package/dist/compaction/tool-result-editing.d.ts +10 -2
- package/dist/compaction/tool-result-editing.d.ts.map +1 -1
- package/dist/compaction/tool-result-editing.js +22 -24
- package/dist/compaction/tool-result-editing.js.map +1 -1
- package/dist/compaction/types.d.ts +22 -1
- package/dist/compaction/types.d.ts.map +1 -1
- package/dist/compaction/wire.d.ts +3 -1
- package/dist/compaction/wire.d.ts.map +1 -1
- package/dist/compaction/wire.js +2 -0
- package/dist/compaction/wire.js.map +1 -1
- package/dist/config/runtime.d.ts +58 -28
- package/dist/config/runtime.d.ts.map +1 -1
- package/dist/config/runtime.js +13 -1
- package/dist/config/runtime.js.map +1 -1
- package/dist/connector/builtins/http.d.ts.map +1 -1
- package/dist/connector/builtins/http.js +2 -8
- package/dist/connector/builtins/http.js.map +1 -1
- package/dist/connector/builtins/webhook.js +2 -2
- package/dist/connector/builtins/webhook.js.map +1 -1
- package/dist/connector/mcp/adapter.d.ts +2 -0
- package/dist/connector/mcp/adapter.d.ts.map +1 -1
- package/dist/connector/mcp/adapter.js +30 -0
- package/dist/connector/mcp/adapter.js.map +1 -1
- package/dist/connector/tools/adapter.js +2 -2
- package/dist/connector/tools/adapter.js.map +1 -1
- package/dist/connector/tools/definitions.js +2 -2
- package/dist/connector/tools/definitions.js.map +1 -1
- package/dist/constants/compaction/index.d.ts +1 -0
- package/dist/constants/compaction/index.d.ts.map +1 -1
- package/dist/constants/compaction/index.js +1 -0
- package/dist/constants/compaction/index.js.map +1 -1
- package/dist/constants/telemetry/index.d.ts +0 -1
- package/dist/constants/telemetry/index.d.ts.map +1 -1
- package/dist/constants/telemetry/index.js +0 -1
- package/dist/constants/telemetry/index.js.map +1 -1
- package/dist/contracts/a2a.d.ts +5 -5
- package/dist/contracts/api.d.ts +4 -2
- package/dist/contracts/api.d.ts.map +1 -1
- package/dist/contracts/schemas.d.ts +1 -15
- package/dist/contracts/schemas.d.ts.map +1 -1
- package/dist/contracts/schemas.js +5 -20
- package/dist/contracts/schemas.js.map +1 -1
- package/dist/invariants/index.d.ts +1 -1
- package/dist/manager/agent/lifecycle.d.ts +2 -18
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +373 -340
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/run/persistence.d.ts +3 -0
- package/dist/manager/run/persistence.d.ts.map +1 -1
- package/dist/manager/run/persistence.js +35 -5
- package/dist/manager/run/persistence.js.map +1 -1
- package/dist/plugin/index.d.ts +2 -0
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +1 -0
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/shell-hook.d.ts +128 -0
- package/dist/plugin/shell-hook.d.ts.map +1 -0
- package/dist/plugin/shell-hook.js +299 -0
- package/dist/plugin/shell-hook.js.map +1 -0
- package/dist/prompt/coding-agent-doctrine.d.ts +63 -0
- package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -0
- package/dist/prompt/coding-agent-doctrine.js +100 -0
- package/dist/prompt/coding-agent-doctrine.js.map +1 -0
- package/dist/prompt/index.d.ts +2 -0
- package/dist/prompt/index.d.ts.map +1 -1
- package/dist/prompt/index.js +1 -0
- package/dist/prompt/index.js.map +1 -1
- package/dist/provider/errors.d.ts +1 -1
- package/dist/provider/errors.js +1 -1
- package/dist/provider/fallback.d.ts +2 -0
- package/dist/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +3 -1
- package/dist/provider/fallback.js.map +1 -1
- package/dist/provider/retry.d.ts +2 -0
- package/dist/provider/retry.d.ts.map +1 -1
- package/dist/provider/retry.js +3 -1
- package/dist/provider/retry.js.map +1 -1
- package/dist/provider/token-budget.d.ts +13 -0
- package/dist/provider/token-budget.d.ts.map +1 -0
- package/dist/provider/token-budget.js +102 -0
- package/dist/provider/token-budget.js.map +1 -0
- package/dist/public-runtime.d.ts +12 -12
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +14 -9
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +2 -0
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +2 -0
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +12 -2
- package/dist/public-types.d.ts.map +1 -1
- package/dist/registry/command/kernel-commands.d.ts.map +1 -1
- package/dist/registry/command/kernel-commands.js +18 -6
- package/dist/registry/command/kernel-commands.js.map +1 -1
- package/dist/registry/tool/execute.d.ts.map +1 -1
- package/dist/registry/tool/execute.js +4 -1
- package/dist/registry/tool/execute.js.map +1 -1
- package/dist/run/LimitChecker.js +1 -1
- package/dist/run/LimitChecker.js.map +1 -1
- package/dist/run/drain.js +1 -1
- package/dist/run/reporter.d.ts.map +1 -1
- package/dist/run/reporter.js +15 -0
- package/dist/run/reporter.js.map +1 -1
- package/dist/run/token-budget.d.ts +108 -0
- package/dist/run/token-budget.d.ts.map +1 -0
- package/dist/run/token-budget.js +591 -0
- package/dist/run/token-budget.js.map +1 -0
- package/dist/runtime/jobs/registry.d.ts +29 -0
- package/dist/runtime/jobs/registry.d.ts.map +1 -1
- package/dist/runtime/jobs/registry.js +98 -18
- package/dist/runtime/jobs/registry.js.map +1 -1
- package/dist/runtime/query/checkpoint.d.ts.map +1 -1
- package/dist/runtime/query/checkpoint.js +10 -3
- package/dist/runtime/query/checkpoint.js.map +1 -1
- package/dist/runtime/query/context.d.ts +2 -26
- package/dist/runtime/query/context.d.ts.map +1 -1
- package/dist/runtime/query/context.js +1 -29
- package/dist/runtime/query/context.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +12 -9
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +95 -46
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/guard.d.ts.map +1 -1
- package/dist/runtime/query/guard.js +8 -0
- package/dist/runtime/query/guard.js.map +1 -1
- package/dist/runtime/query/index.d.ts +35 -4
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +152 -52
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +16 -5
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +98 -30
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +2 -0
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +29 -7
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/iteration/phases/working-memory.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/working-memory.js +25 -15
- package/dist/runtime/query/iteration/phases/working-memory.js.map +1 -1
- package/dist/runtime/query/plugin-hooks.d.ts +1 -1
- package/dist/runtime/query/plugin-hooks.d.ts.map +1 -1
- package/dist/runtime/query/plugin-hooks.js +20 -1
- package/dist/runtime/query/plugin-hooks.js.map +1 -1
- package/dist/runtime/query/repeat-call.d.ts +20 -2
- package/dist/runtime/query/repeat-call.d.ts.map +1 -1
- package/dist/runtime/query/repeat-call.js +35 -7
- package/dist/runtime/query/repeat-call.js.map +1 -1
- package/dist/runtime/query/result.d.ts.map +1 -1
- package/dist/runtime/query/result.js +9 -0
- package/dist/runtime/query/result.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +142 -0
- package/dist/runtime/query/review-policy.d.ts.map +1 -0
- package/dist/runtime/query/review-policy.js +144 -0
- package/dist/runtime/query/review-policy.js.map +1 -0
- package/dist/runtime/query/run-state.d.ts.map +1 -1
- package/dist/runtime/query/run-state.js +4 -0
- package/dist/runtime/query/run-state.js.map +1 -1
- package/dist/runtime/query/steering.d.ts +4 -0
- package/dist/runtime/query/steering.d.ts.map +1 -1
- package/dist/runtime/query/steering.js +29 -0
- package/dist/runtime/query/steering.js.map +1 -1
- package/dist/runtime/query/token-budget.d.ts +7 -0
- package/dist/runtime/query/token-budget.d.ts.map +1 -0
- package/dist/runtime/query/token-budget.js +101 -0
- package/dist/runtime/query/token-budget.js.map +1 -0
- package/dist/runtime/query/tool-output-budget.d.ts +2 -0
- package/dist/runtime/query/tool-output-budget.d.ts.map +1 -1
- package/dist/runtime/query/tool-output-budget.js +29 -11
- package/dist/runtime/query/tool-output-budget.js.map +1 -1
- package/dist/runtime/query/tool-pause.d.ts.map +1 -1
- package/dist/runtime/query/tool-pause.js +4 -2
- package/dist/runtime/query/tool-pause.js.map +1 -1
- package/dist/runtime/query/tooling.d.ts +4 -0
- package/dist/runtime/query/tooling.d.ts.map +1 -1
- package/dist/runtime/query/tooling.js +4 -0
- package/dist/runtime/query/tooling.js.map +1 -1
- package/dist/sandbox/provider/local.d.ts +3 -1
- package/dist/sandbox/provider/local.d.ts.map +1 -1
- package/dist/sandbox/provider/local.js +112 -12
- package/dist/sandbox/provider/local.js.map +1 -1
- package/dist/scheduler/delegating.d.ts +1 -0
- package/dist/scheduler/delegating.d.ts.map +1 -1
- package/dist/scheduler/delegating.js +29 -12
- package/dist/scheduler/delegating.js.map +1 -1
- package/dist/scheduler/local.d.ts +1 -0
- package/dist/scheduler/local.d.ts.map +1 -1
- package/dist/scheduler/local.js +4 -7
- package/dist/scheduler/local.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 +0 -1
- package/dist/session/index.js.map +1 -1
- package/dist/session/workspace/path-builder.d.ts.map +1 -1
- package/dist/session/workspace/path-builder.js +5 -4
- package/dist/session/workspace/path-builder.js.map +1 -1
- package/dist/store/feedback/disk.d.ts.map +1 -1
- package/dist/store/feedback/disk.js +4 -6
- package/dist/store/feedback/disk.js.map +1 -1
- package/dist/store/index.d.ts +2 -0
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +1 -0
- package/dist/store/index.js.map +1 -1
- package/dist/store/memory/disk.d.ts.map +1 -1
- package/dist/store/memory/disk.js +3 -12
- package/dist/store/memory/disk.js.map +1 -1
- package/dist/store/run/checkpoint-disk.d.ts +3 -3
- package/dist/store/run/checkpoint-disk.d.ts.map +1 -1
- package/dist/store/run/checkpoint-disk.js +14 -26
- package/dist/store/run/checkpoint-disk.js.map +1 -1
- package/dist/store/run/claim-disk.js +1 -1
- package/dist/store/run/conformance.d.ts +1 -1
- package/dist/store/run/conformance.d.ts.map +1 -1
- package/dist/store/run/conformance.js +41 -33
- package/dist/store/run/conformance.js.map +1 -1
- package/dist/store/run/disk.d.ts.map +1 -1
- package/dist/store/run/disk.js +20 -4
- package/dist/store/run/disk.js.map +1 -1
- package/dist/store/run/token-budget-disk.d.ts +37 -0
- package/dist/store/run/token-budget-disk.d.ts.map +1 -0
- package/dist/store/run/token-budget-disk.js +208 -0
- package/dist/store/run/token-budget-disk.js.map +1 -0
- package/dist/store/session/disk.d.ts +4 -13
- package/dist/store/session/disk.d.ts.map +1 -1
- package/dist/store/session/disk.js +34 -31
- package/dist/store/session/disk.js.map +1 -1
- package/dist/store/session/memory.d.ts +2 -0
- package/dist/store/session/memory.d.ts.map +1 -1
- package/dist/store/session/memory.js +41 -2
- package/dist/store/session/memory.js.map +1 -1
- package/dist/store/task/disk.d.ts.map +1 -1
- package/dist/store/task/disk.js +7 -8
- package/dist/store/task/disk.js.map +1 -1
- package/dist/store/topic/memory.d.ts +2 -0
- package/dist/store/topic/memory.d.ts.map +1 -1
- package/dist/store/topic/memory.js +13 -1
- package/dist/store/topic/memory.js.map +1 -1
- package/dist/test-support/ids.d.ts +4 -19
- package/dist/test-support/ids.d.ts.map +1 -1
- package/dist/test-support/ids.js +51 -59
- package/dist/test-support/ids.js.map +1 -1
- package/dist/tools/advisory/index.d.ts.map +1 -1
- package/dist/tools/advisory/index.js +3 -1
- package/dist/tools/advisory/index.js.map +1 -1
- package/dist/tools/builtins/bash.d.ts +2 -0
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +9 -11
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/computer-use.d.ts +2 -2
- package/dist/tools/builtins/computer-use.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js +4 -2
- package/dist/tools/builtins/computer-use.js.map +1 -1
- package/dist/tools/builtins/edit.js +2 -2
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/glob.js +3 -3
- package/dist/tools/builtins/glob.js.map +1 -1
- package/dist/tools/builtins/grep.js +2 -2
- package/dist/tools/builtins/grep.js.map +1 -1
- package/dist/tools/builtins/ls.js +2 -2
- package/dist/tools/builtins/ls.js.map +1 -1
- package/dist/tools/builtins/lsp.js +2 -2
- package/dist/tools/builtins/lsp.js.map +1 -1
- package/dist/tools/builtins/read-file.js +2 -2
- package/dist/tools/builtins/read-file.js.map +1 -1
- package/dist/tools/builtins/write-file.js +2 -2
- package/dist/tools/builtins/write-file.js.map +1 -1
- package/dist/tools/coordinator/ask-user-question.d.ts +33 -0
- package/dist/tools/coordinator/ask-user-question.d.ts.map +1 -0
- package/dist/tools/coordinator/ask-user-question.js +237 -0
- package/dist/tools/coordinator/ask-user-question.js.map +1 -0
- package/dist/tools/coordinator/index.d.ts +1 -2
- package/dist/tools/coordinator/index.d.ts.map +1 -1
- package/dist/tools/coordinator/index.js +4 -220
- package/dist/tools/coordinator/index.js.map +1 -1
- package/dist/tools/memory/read.d.ts.map +1 -1
- package/dist/tools/memory/read.js +2 -4
- package/dist/tools/memory/read.js.map +1 -1
- package/dist/tools/paths.d.ts +13 -0
- package/dist/tools/paths.d.ts.map +1 -1
- package/dist/tools/paths.js +53 -0
- package/dist/tools/paths.js.map +1 -1
- package/dist/tools/roster.d.ts +27 -0
- package/dist/tools/roster.d.ts.map +1 -0
- package/dist/tools/roster.js +42 -0
- package/dist/tools/roster.js.map +1 -0
- package/dist/types/agent/base.d.ts +5 -0
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/agent/pipeline.d.ts +3 -0
- package/dist/types/agent/pipeline.d.ts.map +1 -1
- package/dist/types/agent/router.d.ts +2 -3
- package/dist/types/agent/router.d.ts.map +1 -1
- package/dist/types/agent/scheduler.d.ts +3 -0
- package/dist/types/agent/scheduler.d.ts.map +1 -1
- package/dist/types/agent/task.d.ts +5 -16
- package/dist/types/agent/task.d.ts.map +1 -1
- package/dist/types/agent/task.js.map +1 -1
- package/dist/types/common/index.d.ts.map +1 -1
- package/dist/types/common/index.js +3 -0
- package/dist/types/common/index.js.map +1 -1
- package/dist/types/computer-use/index.d.ts +8 -0
- package/dist/types/computer-use/index.d.ts.map +1 -1
- package/dist/types/computer-use/index.js.map +1 -1
- package/dist/types/hitl/index.d.ts +5 -0
- package/dist/types/hitl/index.d.ts.map +1 -1
- package/dist/types/hitl/index.js.map +1 -1
- package/dist/types/ids/brand.d.ts +5 -47
- package/dist/types/ids/brand.d.ts.map +1 -1
- package/dist/types/ids/brand.js +2 -39
- package/dist/types/ids/brand.js.map +1 -1
- package/dist/types/ids/index.d.ts +59 -69
- package/dist/types/ids/index.d.ts.map +1 -1
- package/dist/types/ids/index.js +12 -10
- package/dist/types/ids/index.js.map +1 -1
- package/dist/types/permission/index.d.ts +9 -0
- package/dist/types/permission/index.d.ts.map +1 -1
- package/dist/types/permission/index.js +9 -1
- package/dist/types/permission/index.js.map +1 -1
- package/dist/types/plugin/index.d.ts +45 -4
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/plugin/index.js +7 -0
- package/dist/types/plugin/index.js.map +1 -1
- package/dist/types/run/config.d.ts +3 -0
- package/dist/types/run/config.d.ts.map +1 -1
- package/dist/types/run/emergency.d.ts +5 -0
- package/dist/types/run/emergency.d.ts.map +1 -1
- package/dist/types/run/emergency.js.map +1 -1
- package/dist/types/run/entity.d.ts +6 -2
- package/dist/types/run/entity.d.ts.map +1 -1
- package/dist/types/run/events.d.ts +35 -0
- package/dist/types/run/events.d.ts.map +1 -1
- package/dist/types/run/events.js.map +1 -1
- package/dist/types/run/index.d.ts +1 -0
- package/dist/types/run/index.d.ts.map +1 -1
- package/dist/types/run/index.js +1 -0
- package/dist/types/run/index.js.map +1 -1
- package/dist/types/run/state.d.ts +16 -15
- package/dist/types/run/state.d.ts.map +1 -1
- package/dist/types/run/state.js +41 -22
- package/dist/types/run/state.js.map +1 -1
- package/dist/types/run/stop-reason.d.ts +3 -14
- package/dist/types/run/stop-reason.d.ts.map +1 -1
- package/dist/types/run/token-budget-store.d.ts +29 -0
- package/dist/types/run/token-budget-store.d.ts.map +1 -0
- package/dist/types/run/token-budget-store.js +25 -0
- package/dist/types/run/token-budget-store.js.map +1 -0
- package/dist/types/sandbox/index.d.ts +27 -2
- package/dist/types/sandbox/index.d.ts.map +1 -1
- package/dist/types/sandbox/index.js.map +1 -1
- package/dist/types/session/store.d.ts +8 -0
- package/dist/types/session/store.d.ts.map +1 -1
- package/dist/types/tool/index.d.ts +15 -0
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/utils/frontmatter.d.ts +1 -1
- package/dist/utils/frontmatter.js +1 -1
- package/dist/utils/id-format.d.ts +3 -0
- package/dist/utils/id-format.d.ts.map +1 -0
- package/dist/utils/id-format.js +9 -0
- package/dist/utils/id-format.js.map +1 -0
- package/dist/utils/id.d.ts +65 -32
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/id.js +168 -148
- package/dist/utils/id.js.map +1 -1
- package/dist/utils/log/exception.js +1 -1
- package/dist/utils/log/exception.js.map +1 -1
- package/dist/utils/log/index.d.ts.map +1 -1
- package/dist/utils/log/index.js +1 -2
- package/dist/utils/log/index.js.map +1 -1
- package/dist/utils/log/templates.d.ts.map +1 -1
- package/dist/utils/log/templates.js +0 -1
- package/dist/utils/log/templates.js.map +1 -1
- package/package.json +1 -1
- package/src/agents/AGENTS.md +1 -1
- package/src/agents/PipelineAgent.ts +129 -109
- package/src/agents/ReactiveAgent.ts +2 -0
- package/src/agents/RouterAgent.ts +120 -73
- package/src/agents/SupervisorAgent.ts +12 -4
- package/src/agents/budget.ts +42 -0
- package/src/agents/explore.ts +29 -0
- package/src/agents/file-definitions.ts +237 -0
- package/src/agents/index.ts +15 -0
- package/src/bridge/a2a/mapper.ts +6 -0
- package/src/bridge/sse/mapper.ts +22 -0
- package/src/bus/lock.ts +1 -10
- package/src/compaction/consolidation.ts +79 -0
- package/src/compaction/factory.ts +3 -0
- package/src/compaction/index.ts +34 -4
- package/src/compaction/manager.ts +39 -1
- package/src/compaction/plan.ts +52 -21
- package/src/compaction/salience/bm25.ts +72 -0
- package/src/compaction/salience/goal.ts +44 -0
- package/src/compaction/salience/index.ts +19 -0
- package/src/compaction/salience/minhash.ts +53 -0
- package/src/compaction/salience/score.ts +305 -0
- package/src/compaction/salience/tokenize.ts +89 -0
- package/src/compaction/salience/working-set.ts +187 -0
- package/src/compaction/serializer.ts +16 -0
- package/src/compaction/token-estimate.ts +57 -0
- package/src/compaction/tool-result-editing.ts +28 -26
- package/src/compaction/types.ts +24 -1
- package/src/compaction/wire.ts +5 -1
- package/src/config/runtime.ts +13 -1
- package/src/connector/builtins/http.ts +2 -8
- package/src/connector/builtins/webhook.ts +2 -2
- package/src/connector/mcp/adapter.ts +32 -0
- package/src/connector/tools/adapter.ts +2 -2
- package/src/connector/tools/definitions.ts +2 -2
- package/src/constants/compaction/index.ts +1 -0
- package/src/constants/telemetry/index.ts +0 -1
- package/src/contracts/api.ts +5 -1
- package/src/contracts/schemas.ts +6 -20
- package/src/invariants/index.ts +1 -1
- package/src/manager/agent/lifecycle.ts +380 -352
- package/src/manager/run/persistence.ts +35 -5
- package/src/plugin/index.ts +19 -0
- package/src/plugin/shell-hook.ts +403 -0
- package/src/prompt/coding-agent-doctrine.ts +118 -0
- package/src/prompt/index.ts +8 -0
- package/src/provider/errors.ts +1 -1
- package/src/provider/fallback.ts +4 -1
- package/src/provider/retry.ts +4 -1
- package/src/provider/token-budget.ts +114 -0
- package/src/public-runtime.ts +54 -27
- package/src/public-tools.ts +5 -0
- package/src/public-types.ts +65 -0
- package/src/registry/command/kernel-commands.ts +16 -6
- package/src/registry/tool/execute.ts +4 -1
- package/src/run/LimitChecker.ts +1 -1
- package/src/run/drain.ts +1 -1
- package/src/run/reporter.ts +15 -0
- package/src/run/token-budget.ts +692 -0
- package/src/runtime/jobs/registry.ts +123 -17
- package/src/runtime/query/checkpoint.ts +10 -3
- package/src/runtime/query/context.ts +3 -57
- package/src/runtime/query/executor.ts +128 -58
- package/src/runtime/query/guard.ts +8 -0
- package/src/runtime/query/index.ts +201 -62
- package/src/runtime/query/iteration/index.ts +24 -6
- package/src/runtime/query/iteration/phases/compaction.ts +130 -31
- package/src/runtime/query/iteration/phases/context.ts +2 -0
- package/src/runtime/query/iteration/phases/tool-review.ts +39 -7
- package/src/runtime/query/iteration/phases/working-memory.ts +23 -14
- package/src/runtime/query/plugin-hooks.ts +24 -2
- package/src/runtime/query/repeat-call.ts +42 -7
- package/src/runtime/query/result.ts +9 -0
- package/src/runtime/query/review-policy.ts +231 -0
- package/src/runtime/query/run-state.ts +4 -0
- package/src/runtime/query/steering.ts +32 -0
- package/src/runtime/query/token-budget.ts +127 -0
- package/src/runtime/query/tool-output-budget.ts +33 -10
- package/src/runtime/query/tool-pause.ts +4 -2
- package/src/runtime/query/tooling.ts +8 -0
- package/src/sandbox/provider/local.ts +123 -13
- package/src/scheduler/delegating.ts +35 -13
- package/src/scheduler/local.ts +5 -7
- package/src/session/index.ts +0 -1
- package/src/session/workspace/path-builder.ts +5 -4
- package/src/store/feedback/disk.ts +4 -6
- package/src/store/index.ts +2 -0
- package/src/store/memory/disk.ts +3 -11
- package/src/store/run/checkpoint-disk.ts +14 -27
- package/src/store/run/claim-disk.ts +1 -1
- package/src/store/run/conformance.ts +55 -39
- package/src/store/run/disk.ts +19 -4
- package/src/store/run/token-budget-disk.ts +247 -0
- package/src/store/session/disk.ts +36 -29
- package/src/store/session/memory.ts +38 -1
- package/src/store/task/disk.ts +7 -8
- package/src/store/topic/memory.ts +13 -1
- package/src/test-support/ids.ts +62 -59
- package/src/tools/advisory/index.ts +3 -1
- package/src/tools/builtins/bash.ts +11 -12
- package/src/tools/builtins/computer-use.ts +6 -2
- package/src/tools/builtins/edit.ts +2 -2
- package/src/tools/builtins/glob.ts +3 -3
- package/src/tools/builtins/grep.ts +2 -2
- package/src/tools/builtins/ls.ts +2 -2
- package/src/tools/builtins/lsp.ts +2 -2
- package/src/tools/builtins/read-file.ts +2 -2
- package/src/tools/builtins/write-file.ts +2 -2
- package/src/tools/coordinator/ask-user-question.ts +284 -0
- package/src/tools/coordinator/index.ts +5 -248
- package/src/tools/memory/read.ts +2 -4
- package/src/tools/paths.ts +64 -0
- package/src/tools/roster.ts +46 -0
- package/src/types/agent/base.ts +6 -0
- package/src/types/agent/pipeline.ts +3 -0
- package/src/types/agent/router.ts +2 -3
- package/src/types/agent/scheduler.ts +4 -0
- package/src/types/agent/task.ts +5 -18
- package/src/types/common/index.ts +3 -0
- package/src/types/computer-use/index.ts +8 -0
- package/src/types/hitl/index.ts +5 -0
- package/src/types/ids/brand.ts +5 -48
- package/src/types/ids/index.ts +66 -75
- package/src/types/permission/index.ts +11 -0
- package/src/types/plugin/index.ts +49 -1
- package/src/types/run/config.ts +3 -0
- package/src/types/run/emergency.ts +5 -0
- package/src/types/run/entity.ts +6 -2
- package/src/types/run/events.ts +37 -0
- package/src/types/run/index.ts +1 -0
- package/src/types/run/state.ts +58 -30
- package/src/types/run/stop-reason.ts +3 -14
- package/src/types/run/token-budget-store.ts +54 -0
- package/src/types/sandbox/index.ts +32 -0
- package/src/types/session/store.ts +8 -0
- package/src/types/tool/index.ts +15 -0
- package/src/utils/frontmatter.ts +1 -1
- package/src/utils/id-format.ts +9 -0
- package/src/utils/id.ts +222 -181
- package/src/utils/log/exception.ts +1 -1
- package/src/utils/log/index.ts +1 -2
- package/src/utils/log/templates.ts +0 -1
- package/dist/session/migration/errors.d.ts +0 -26
- package/dist/session/migration/errors.d.ts.map +0 -1
- package/dist/session/migration/errors.js +0 -22
- package/dist/session/migration/errors.js.map +0 -1
- package/dist/session/migration/filesystem.d.ts +0 -122
- package/dist/session/migration/filesystem.d.ts.map +0 -1
- package/dist/session/migration/filesystem.js +0 -379
- package/dist/session/migration/filesystem.js.map +0 -1
- package/dist/session/migration/id-prefix.d.ts +0 -113
- package/dist/session/migration/id-prefix.d.ts.map +0 -1
- package/dist/session/migration/id-prefix.js +0 -132
- package/dist/session/migration/id-prefix.js.map +0 -1
- package/dist/session/migration/index.d.ts +0 -12
- package/dist/session/migration/index.d.ts.map +0 -1
- package/dist/session/migration/index.js +0 -12
- package/dist/session/migration/index.js.map +0 -1
- package/dist/session/migration/marker.d.ts +0 -57
- package/dist/session/migration/marker.d.ts.map +0 -1
- package/dist/session/migration/marker.js +0 -123
- package/dist/session/migration/marker.js.map +0 -1
- package/src/session/migration/errors.ts +0 -23
- package/src/session/migration/filesystem.ts +0 -468
- package/src/session/migration/id-prefix.ts +0 -166
- package/src/session/migration/index.ts +0 -41
- package/src/session/migration/marker.ts +0 -142
package/src/utils/id.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { randomUUID } from 'node:crypto'
|
|
2
2
|
import { unsafeId } from '../types/ids/brand.js'
|
|
3
3
|
import type {
|
|
4
4
|
ActivityId,
|
|
@@ -43,325 +43,366 @@ import type {
|
|
|
43
43
|
VaultRef,
|
|
44
44
|
WorkspaceId,
|
|
45
45
|
} from '../types/ids/index.js'
|
|
46
|
+
import { entityIdPattern } from './id-format.js'
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Mints an id, with the PREFIX checked against the id's own type.
|
|
53
|
-
*
|
|
54
|
-
* The two type parameters are what keeps that check alive now the ids are
|
|
55
|
-
* nominal (NZ-SURF-11). `T` is inferred from the caller's declared return
|
|
56
|
-
* type, `P` from the literal prefix, and the constraint `T extends
|
|
57
|
-
* `${P}${string}`` is what makes `generateRunId` unable to return
|
|
58
|
-
* `generateId('ses_')`: a branded `RunId` is assignable to `` `run_${string}` ``
|
|
59
|
-
* but not to `` `ses_${string}` ``, so the wrong prefix fails to compile.
|
|
60
|
-
*
|
|
61
|
-
* Without the constraint the brand would have COST a check — `unsafeId<T>`
|
|
62
|
-
* accepts any string, so `T` alone would let every generator mint any
|
|
63
|
-
* prefix. That is the docker `sandbox_`/`sbx_` defect, one layer up, which
|
|
64
|
-
* is why this is written the awkward way rather than the short way.
|
|
65
|
-
*/
|
|
66
|
-
function generateId<T extends `${P}${string}`, P extends string = string>(
|
|
67
|
-
prefix: P,
|
|
68
|
-
length = 12,
|
|
69
|
-
): T {
|
|
70
|
-
let suffix = ''
|
|
71
|
-
let remaining = length
|
|
72
|
-
while (remaining > 0) {
|
|
73
|
-
const bytes = randomBytes(remaining + 8)
|
|
74
|
-
for (const byte of bytes) {
|
|
75
|
-
if (remaining <= 0) break
|
|
76
|
-
if (byte < MAX_UNIFORM_BYTE) {
|
|
77
|
-
suffix += ALPHABET[byte % ALPHABET_LEN]
|
|
78
|
-
remaining--
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return unsafeId<T>(`${prefix}${suffix}`)
|
|
48
|
+
/** Factories supply the nominal type; the wire identity carries no kind. */
|
|
49
|
+
function generateId<T extends string>(): T {
|
|
50
|
+
return unsafeId<T>(randomUUID())
|
|
83
51
|
}
|
|
84
52
|
|
|
85
53
|
export function generateProjectId(): ProjectId {
|
|
86
|
-
return generateId(
|
|
54
|
+
return generateId()
|
|
87
55
|
}
|
|
88
56
|
|
|
89
57
|
export function generateTopicId(): TopicId {
|
|
90
|
-
return generateId(
|
|
58
|
+
return generateId()
|
|
91
59
|
}
|
|
92
60
|
|
|
93
61
|
export function generateRunId(): RunId {
|
|
94
|
-
return generateId(
|
|
62
|
+
return generateId()
|
|
95
63
|
}
|
|
96
64
|
|
|
97
65
|
export function generateMessageId(): MessageId {
|
|
98
|
-
return generateId(
|
|
66
|
+
return generateId()
|
|
99
67
|
}
|
|
100
68
|
|
|
101
69
|
export function generateSessionId(): SessionId {
|
|
102
|
-
return generateId(
|
|
70
|
+
return generateId()
|
|
103
71
|
}
|
|
104
72
|
|
|
105
73
|
export function generateGoalId(): GoalId {
|
|
106
|
-
return generateId(
|
|
74
|
+
return generateId()
|
|
107
75
|
}
|
|
108
76
|
|
|
109
77
|
export function generateToolCallId(): ToolCallId {
|
|
110
|
-
return generateId(
|
|
78
|
+
return generateId()
|
|
111
79
|
}
|
|
112
80
|
|
|
113
81
|
export function generateActivityId(): ActivityId {
|
|
114
|
-
return generateId(
|
|
82
|
+
return generateId()
|
|
115
83
|
}
|
|
116
84
|
|
|
117
85
|
export function generateTaskId(): TaskId {
|
|
118
|
-
return generateId(
|
|
86
|
+
return generateId()
|
|
119
87
|
}
|
|
120
88
|
|
|
121
89
|
export function generatePlanId(): PlanId {
|
|
122
|
-
return generateId(
|
|
90
|
+
return generateId()
|
|
123
91
|
}
|
|
124
92
|
|
|
125
93
|
export function generateKnowledgeBaseId(): KnowledgeBaseId {
|
|
126
|
-
return generateId(
|
|
94
|
+
return generateId()
|
|
127
95
|
}
|
|
128
96
|
|
|
129
97
|
export function generateDocumentId(): DocumentId {
|
|
130
|
-
return generateId(
|
|
98
|
+
return generateId()
|
|
131
99
|
}
|
|
132
100
|
|
|
133
101
|
export function generateChunkId(): ChunkId {
|
|
134
|
-
return generateId(
|
|
102
|
+
return generateId()
|
|
135
103
|
}
|
|
136
104
|
|
|
137
105
|
export function generateConnectorId(): ConnectorId {
|
|
138
|
-
return generateId(
|
|
106
|
+
return generateId()
|
|
139
107
|
}
|
|
140
108
|
|
|
141
109
|
export function generateConnectorInstanceId(): ConnectorInstanceId {
|
|
142
|
-
return generateId(
|
|
110
|
+
return generateId()
|
|
143
111
|
}
|
|
144
112
|
|
|
145
113
|
export function generateTenantId(): TenantId {
|
|
146
|
-
return generateId(
|
|
114
|
+
return generateId()
|
|
147
115
|
}
|
|
148
116
|
|
|
149
117
|
export function generateCredentialId(): CredentialId {
|
|
150
|
-
return generateId(
|
|
118
|
+
return generateId()
|
|
151
119
|
}
|
|
152
120
|
|
|
153
121
|
export function generateExecutionContextId(): ExecutionContextId {
|
|
154
|
-
return generateId(
|
|
122
|
+
return generateId()
|
|
155
123
|
}
|
|
156
124
|
|
|
157
125
|
export function generateMCPServerId(): MCPServerId {
|
|
158
|
-
return generateId(
|
|
126
|
+
return generateId()
|
|
159
127
|
}
|
|
160
128
|
|
|
161
129
|
export function generateMCPClientId(): MCPClientId {
|
|
162
|
-
return generateId(
|
|
130
|
+
return generateId()
|
|
163
131
|
}
|
|
164
132
|
|
|
165
133
|
export function generateMCPSessionId(): MCPSessionId {
|
|
166
|
-
return generateId(
|
|
134
|
+
return generateId()
|
|
167
135
|
}
|
|
168
136
|
|
|
169
137
|
export function generateEnvironmentId(): EnvironmentId {
|
|
170
|
-
return generateId(
|
|
138
|
+
return generateId()
|
|
171
139
|
}
|
|
172
140
|
|
|
173
141
|
export function generateCheckpointId(): CheckpointId {
|
|
174
|
-
return generateId(
|
|
142
|
+
return generateId()
|
|
175
143
|
}
|
|
176
144
|
|
|
177
145
|
export function generateAdvisoryId(): AdvisoryId {
|
|
178
|
-
return generateId(
|
|
146
|
+
return generateId()
|
|
179
147
|
}
|
|
180
148
|
|
|
181
149
|
export function generateAdvisoryCallId(): AdvisoryCallId {
|
|
182
|
-
return generateId(
|
|
150
|
+
return generateId()
|
|
183
151
|
}
|
|
184
152
|
|
|
185
153
|
export function generateAuditEventId(): AuditEventId {
|
|
186
|
-
return generateId(
|
|
154
|
+
return generateId()
|
|
187
155
|
}
|
|
188
156
|
|
|
189
157
|
export function generateEmergencySaveId(): EmergencySaveId {
|
|
190
|
-
return generateId(
|
|
158
|
+
return generateId()
|
|
191
159
|
}
|
|
192
160
|
|
|
193
161
|
export function generateMemoryId(): MemoryId {
|
|
194
|
-
return generateId(
|
|
162
|
+
return generateId()
|
|
195
163
|
}
|
|
196
164
|
|
|
197
165
|
export function generatePluginId(): PluginId {
|
|
198
|
-
return generateId(
|
|
166
|
+
return generateId()
|
|
199
167
|
}
|
|
200
168
|
|
|
201
169
|
export function generateSandboxId(): SandboxId {
|
|
202
|
-
return generateId(
|
|
170
|
+
return generateId()
|
|
203
171
|
}
|
|
204
172
|
|
|
205
173
|
export function generateWorkspaceId(): WorkspaceId {
|
|
206
|
-
return generateId(
|
|
174
|
+
return generateId()
|
|
207
175
|
}
|
|
208
176
|
|
|
209
177
|
export function generateSubSessionId(): SubSessionId {
|
|
210
|
-
return generateId(
|
|
178
|
+
return generateId()
|
|
211
179
|
}
|
|
212
180
|
|
|
213
181
|
export function generateSummaryId(): SummaryId {
|
|
214
|
-
return generateId(
|
|
182
|
+
return generateId()
|
|
215
183
|
}
|
|
216
184
|
|
|
217
185
|
export function generateHandoffId(): HandoffId {
|
|
218
|
-
return generateId(
|
|
186
|
+
return generateId()
|
|
219
187
|
}
|
|
220
188
|
|
|
221
189
|
export function generateDeliverableId(): DeliverableId {
|
|
222
|
-
return generateId(
|
|
190
|
+
return generateId()
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Entity kinds are supplied by a typed field or storage collection. */
|
|
194
|
+
export interface EntityIdByKind {
|
|
195
|
+
run: RunId
|
|
196
|
+
message: MessageId
|
|
197
|
+
session: SessionId
|
|
198
|
+
goal: GoalId
|
|
199
|
+
toolCall: ToolCallId
|
|
200
|
+
activity: ActivityId
|
|
201
|
+
task: TaskId
|
|
202
|
+
plan: PlanId
|
|
203
|
+
knowledgeBase: KnowledgeBaseId
|
|
204
|
+
document: DocumentId
|
|
205
|
+
chunk: ChunkId
|
|
206
|
+
connector: ConnectorId
|
|
207
|
+
connectorInstance: ConnectorInstanceId
|
|
208
|
+
tenant: TenantId
|
|
209
|
+
credential: CredentialId
|
|
210
|
+
executionContext: ExecutionContextId
|
|
211
|
+
mcpServer: MCPServerId
|
|
212
|
+
mcpClient: MCPClientId
|
|
213
|
+
mcpSession: MCPSessionId
|
|
214
|
+
environment: EnvironmentId
|
|
215
|
+
checkpoint: CheckpointId
|
|
216
|
+
lock: LockId
|
|
217
|
+
advisory: AdvisoryId
|
|
218
|
+
advisoryCall: AdvisoryCallId
|
|
219
|
+
emergencySave: EmergencySaveId
|
|
220
|
+
memory: MemoryId
|
|
221
|
+
plugin: PluginId
|
|
222
|
+
sandbox: SandboxId
|
|
223
|
+
auditEvent: AuditEventId
|
|
224
|
+
user: UserId
|
|
225
|
+
agent: AgentId
|
|
226
|
+
memoryStoreRef: MemoryStoreRef
|
|
227
|
+
vaultRef: VaultRef
|
|
228
|
+
knowledgeBaseRef: KnowledgeBaseRef
|
|
229
|
+
project: ProjectId
|
|
230
|
+
topic: TopicId
|
|
231
|
+
subSession: SubSessionId
|
|
232
|
+
handoff: HandoffId
|
|
233
|
+
workspace: WorkspaceId
|
|
234
|
+
summary: SummaryId
|
|
235
|
+
deliverable: DeliverableId
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export type EntityIdKind = keyof EntityIdByKind
|
|
239
|
+
|
|
240
|
+
const ENTITY_KINDS = new Set<EntityIdKind>([
|
|
241
|
+
'run',
|
|
242
|
+
'message',
|
|
243
|
+
'session',
|
|
244
|
+
'goal',
|
|
245
|
+
'toolCall',
|
|
246
|
+
'activity',
|
|
247
|
+
'task',
|
|
248
|
+
'plan',
|
|
249
|
+
'knowledgeBase',
|
|
250
|
+
'document',
|
|
251
|
+
'chunk',
|
|
252
|
+
'connector',
|
|
253
|
+
'connectorInstance',
|
|
254
|
+
'tenant',
|
|
255
|
+
'credential',
|
|
256
|
+
'executionContext',
|
|
257
|
+
'mcpServer',
|
|
258
|
+
'mcpClient',
|
|
259
|
+
'mcpSession',
|
|
260
|
+
'environment',
|
|
261
|
+
'checkpoint',
|
|
262
|
+
'lock',
|
|
263
|
+
'advisory',
|
|
264
|
+
'advisoryCall',
|
|
265
|
+
'emergencySave',
|
|
266
|
+
'memory',
|
|
267
|
+
'plugin',
|
|
268
|
+
'sandbox',
|
|
269
|
+
'auditEvent',
|
|
270
|
+
'user',
|
|
271
|
+
'agent',
|
|
272
|
+
'memoryStoreRef',
|
|
273
|
+
'vaultRef',
|
|
274
|
+
'knowledgeBaseRef',
|
|
275
|
+
'project',
|
|
276
|
+
'topic',
|
|
277
|
+
'subSession',
|
|
278
|
+
'handoff',
|
|
279
|
+
'workspace',
|
|
280
|
+
'summary',
|
|
281
|
+
'deliverable',
|
|
282
|
+
])
|
|
283
|
+
|
|
284
|
+
const ID_PATTERN = entityIdPattern()
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Checks an id without throwing or rewriting it. UUIDs identify opaque
|
|
288
|
+
* entities; the kind comes from the caller's field or collection.
|
|
289
|
+
* This validates spelling, not existence, ownership, or access permission.
|
|
290
|
+
*/
|
|
291
|
+
export function isEntityId<K extends EntityIdKind>(
|
|
292
|
+
value: unknown,
|
|
293
|
+
kind: K,
|
|
294
|
+
): value is EntityIdByKind[K] {
|
|
295
|
+
if (typeof value !== 'string') return false
|
|
296
|
+
return ENTITY_KINDS.has(kind) && ID_PATTERN.test(value)
|
|
223
297
|
}
|
|
224
298
|
|
|
225
|
-
function parseId<
|
|
299
|
+
function parseId<K extends EntityIdKind>(
|
|
226
300
|
raw: string,
|
|
227
|
-
|
|
301
|
+
kind: K,
|
|
228
302
|
typeName: string,
|
|
229
|
-
):
|
|
230
|
-
if (!raw
|
|
231
|
-
throw new Error(`Invalid ${typeName}: expected
|
|
303
|
+
): EntityIdByKind[K] {
|
|
304
|
+
if (!isEntityId(raw, kind)) {
|
|
305
|
+
throw new Error(`Invalid ${typeName}: expected a UUID, got ${JSON.stringify(raw)}`)
|
|
232
306
|
}
|
|
233
|
-
return
|
|
307
|
+
return raw
|
|
234
308
|
}
|
|
235
309
|
|
|
310
|
+
/** @deprecated Use the `as*Id` constructor of the same type; this family throws a plain Error and is removed in the next major. */
|
|
236
311
|
export function parseProjectId(raw: string): ProjectId {
|
|
237
|
-
return parseId(raw, '
|
|
312
|
+
return parseId(raw, 'project', 'ProjectId')
|
|
238
313
|
}
|
|
314
|
+
/** @deprecated Use the `as*Id` constructor of the same type; this family throws a plain Error and is removed in the next major. */
|
|
239
315
|
export function parseRunId(raw: string): RunId {
|
|
240
|
-
return parseId(raw, '
|
|
316
|
+
return parseId(raw, 'run', 'RunId')
|
|
241
317
|
}
|
|
318
|
+
/** @deprecated Use the `as*Id` constructor of the same type; this family throws a plain Error and is removed in the next major. */
|
|
242
319
|
export function parseConnectorInstanceId(raw: string): ConnectorInstanceId {
|
|
243
|
-
return parseId(raw, '
|
|
320
|
+
return parseId(raw, 'connectorInstance', 'ConnectorInstanceId')
|
|
244
321
|
}
|
|
322
|
+
/** @deprecated Use the `as*Id` constructor of the same type; this family throws a plain Error and is removed in the next major. */
|
|
245
323
|
export function parsePluginId(raw: string): PluginId {
|
|
246
|
-
return parseId(raw, '
|
|
324
|
+
return parseId(raw, 'plugin', 'PluginId')
|
|
247
325
|
}
|
|
326
|
+
/** @deprecated Use the `as*Id` constructor of the same type; this family throws a plain Error and is removed in the next major. */
|
|
248
327
|
export function parseSandboxId(raw: string): SandboxId {
|
|
249
|
-
return parseId(raw, '
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
//
|
|
253
|
-
//
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
// `RunId` reaches a store key unremarked and the first sign of it is a
|
|
257
|
-
// lookup that finds nothing.
|
|
258
|
-
//
|
|
259
|
-
// These are the check. One per id type rather than a single generic
|
|
260
|
-
// `asId(prefix, value)`, and the repetition is the point: a generic loses
|
|
261
|
-
// the return type, so the call site stops type-checking and the whole
|
|
262
|
-
// exercise buys nothing. The implementations are one function.
|
|
263
|
-
|
|
264
|
-
/** A string that does not carry the prefix the id type requires. */
|
|
328
|
+
return parseId(raw, 'sandbox', 'SandboxId')
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Brands do not validate JSON, JavaScript callers, or type assertions.
|
|
332
|
+
// Storage boundaries must check again before using an id as a path segment.
|
|
333
|
+
|
|
334
|
+
/** A value that cannot represent an entity id because it is not a UUID. */
|
|
265
335
|
export class InvalidIdError extends Error {
|
|
266
336
|
constructor(
|
|
267
337
|
readonly value: string,
|
|
268
|
-
|
|
338
|
+
/** The typed field or collection that required an identity. */
|
|
339
|
+
readonly expectedKind: EntityIdKind,
|
|
269
340
|
) {
|
|
270
341
|
super(
|
|
271
|
-
`
|
|
342
|
+
`Invalid ${expectedKind} id: ${JSON.stringify(value)} must be a UUID. Prefixed IDs are not supported. Use the matching generate*Id() factory to mint an id.`,
|
|
272
343
|
)
|
|
273
344
|
this.name = 'InvalidIdError'
|
|
274
345
|
}
|
|
275
346
|
}
|
|
276
347
|
|
|
277
|
-
/**
|
|
278
|
-
* Builds one prefix check.
|
|
279
|
-
*
|
|
280
|
-
* Throws rather than returning `undefined`, per `refuse-do-not-degrade`: a
|
|
281
|
-
* caller holding a malformed id has no correct fallback available, and the
|
|
282
|
-
* value is on its way to becoming a store key. Returning the input
|
|
283
|
-
* unchanged on the happy path is also load-bearing — a constructor that
|
|
284
|
-
* allocated a copy would silently break `===` on ids used as map keys.
|
|
285
|
-
*
|
|
286
|
-
* The trailing underscore in every prefix is what makes them unambiguous:
|
|
287
|
-
* `mcpc_x` does not start with `mcp_`, and `advc_x` does not start with
|
|
288
|
-
* `adv_`, so no id type can swallow another's values.
|
|
289
|
-
*/
|
|
290
|
-
/**
|
|
291
|
-
* What a checked constructor is, named so the id type can be supplied by
|
|
292
|
-
* ANNOTATION rather than as a type argument.
|
|
293
|
-
*
|
|
294
|
-
* That distinction is load-bearing and was got wrong once. `makeIdParser<
|
|
295
|
-
* RunId>('ses_')` compiles: supplying one of two type parameters explicitly
|
|
296
|
-
* makes the other fall back to its DEFAULT rather than be inferred, so `P`
|
|
297
|
-
* became `string`, the constraint read `RunId extends string`, and the
|
|
298
|
-
* prefix check evaporated. Caught by mutating `asRunId`'s prefix and finding
|
|
299
|
-
* the build still green — a check that cannot fail. With the type on the
|
|
300
|
-
* const instead, `T` comes from the contextual type and `P` is inferred from
|
|
301
|
-
* the argument, so the same mutation is a compile error.
|
|
302
|
-
*/
|
|
303
348
|
type IdParser<T extends string> = (value: string) => T
|
|
304
349
|
|
|
305
|
-
function makeIdParser<
|
|
306
|
-
|
|
307
|
-
)
|
|
308
|
-
|
|
309
|
-
if (!value.startsWith(prefix)) throw new InvalidIdError(value, prefix)
|
|
310
|
-
return unsafeId<T>(value)
|
|
350
|
+
function makeIdParser<K extends EntityIdKind>(kind: K): IdParser<EntityIdByKind[K]> {
|
|
351
|
+
return (value) => {
|
|
352
|
+
if (!isEntityId(value, kind)) throw new InvalidIdError(value, kind)
|
|
353
|
+
return value
|
|
311
354
|
}
|
|
312
355
|
}
|
|
313
356
|
|
|
314
|
-
export const asRunId: IdParser<RunId> = makeIdParser('
|
|
315
|
-
export const asMessageId: IdParser<MessageId> = makeIdParser('
|
|
316
|
-
export const asSessionId: IdParser<SessionId> = makeIdParser('
|
|
317
|
-
export const asGoalId: IdParser<GoalId> = makeIdParser('
|
|
318
|
-
export const asToolCallId: IdParser<ToolCallId> = makeIdParser('
|
|
319
|
-
export const asActivityId: IdParser<ActivityId> = makeIdParser('
|
|
320
|
-
export const asTaskId: IdParser<TaskId> = makeIdParser('
|
|
321
|
-
export const asPlanId: IdParser<PlanId> = makeIdParser('
|
|
322
|
-
export const asKnowledgeBaseId: IdParser<KnowledgeBaseId> = makeIdParser('
|
|
323
|
-
export const asDocumentId: IdParser<DocumentId> = makeIdParser('
|
|
324
|
-
export const asChunkId: IdParser<ChunkId> = makeIdParser('
|
|
325
|
-
export const asConnectorId: IdParser<ConnectorId> = makeIdParser('
|
|
326
|
-
export const asConnectorInstanceId: IdParser<ConnectorInstanceId> =
|
|
327
|
-
|
|
328
|
-
export const
|
|
329
|
-
export const
|
|
330
|
-
export const
|
|
331
|
-
export const
|
|
332
|
-
export const
|
|
333
|
-
export const
|
|
334
|
-
export const
|
|
335
|
-
export const
|
|
336
|
-
export const
|
|
337
|
-
export const
|
|
338
|
-
export const
|
|
339
|
-
export const
|
|
340
|
-
export const
|
|
341
|
-
export const
|
|
342
|
-
export const
|
|
343
|
-
export const
|
|
357
|
+
export const asRunId: IdParser<RunId> = makeIdParser('run')
|
|
358
|
+
export const asMessageId: IdParser<MessageId> = makeIdParser('message')
|
|
359
|
+
export const asSessionId: IdParser<SessionId> = makeIdParser('session')
|
|
360
|
+
export const asGoalId: IdParser<GoalId> = makeIdParser('goal')
|
|
361
|
+
export const asToolCallId: IdParser<ToolCallId> = makeIdParser('toolCall')
|
|
362
|
+
export const asActivityId: IdParser<ActivityId> = makeIdParser('activity')
|
|
363
|
+
export const asTaskId: IdParser<TaskId> = makeIdParser('task')
|
|
364
|
+
export const asPlanId: IdParser<PlanId> = makeIdParser('plan')
|
|
365
|
+
export const asKnowledgeBaseId: IdParser<KnowledgeBaseId> = makeIdParser('knowledgeBase')
|
|
366
|
+
export const asDocumentId: IdParser<DocumentId> = makeIdParser('document')
|
|
367
|
+
export const asChunkId: IdParser<ChunkId> = makeIdParser('chunk')
|
|
368
|
+
export const asConnectorId: IdParser<ConnectorId> = makeIdParser('connector')
|
|
369
|
+
export const asConnectorInstanceId: IdParser<ConnectorInstanceId> =
|
|
370
|
+
makeIdParser('connectorInstance')
|
|
371
|
+
export const asTenantId: IdParser<TenantId> = makeIdParser('tenant')
|
|
372
|
+
export const asCredentialId: IdParser<CredentialId> = makeIdParser('credential')
|
|
373
|
+
export const asExecutionContextId: IdParser<ExecutionContextId> = makeIdParser('executionContext')
|
|
374
|
+
export const asMCPServerId: IdParser<MCPServerId> = makeIdParser('mcpServer')
|
|
375
|
+
export const asMCPClientId: IdParser<MCPClientId> = makeIdParser('mcpClient')
|
|
376
|
+
export const asMCPSessionId: IdParser<MCPSessionId> = makeIdParser('mcpSession')
|
|
377
|
+
export const asEnvironmentId: IdParser<EnvironmentId> = makeIdParser('environment')
|
|
378
|
+
export const asCheckpointId: IdParser<CheckpointId> = makeIdParser('checkpoint')
|
|
379
|
+
export const asLockId: IdParser<LockId> = makeIdParser('lock')
|
|
380
|
+
export const asAdvisoryId: IdParser<AdvisoryId> = makeIdParser('advisory')
|
|
381
|
+
export const asAdvisoryCallId: IdParser<AdvisoryCallId> = makeIdParser('advisoryCall')
|
|
382
|
+
export const asEmergencySaveId: IdParser<EmergencySaveId> = makeIdParser('emergencySave')
|
|
383
|
+
export const asMemoryId: IdParser<MemoryId> = makeIdParser('memory')
|
|
384
|
+
export const asPluginId: IdParser<PluginId> = makeIdParser('plugin')
|
|
385
|
+
export const asSandboxId: IdParser<SandboxId> = makeIdParser('sandbox')
|
|
386
|
+
export const asAuditEventId: IdParser<AuditEventId> = makeIdParser('auditEvent')
|
|
387
|
+
export const asUserId: IdParser<UserId> = makeIdParser('user')
|
|
344
388
|
/**
|
|
345
|
-
* @deprecated
|
|
346
|
-
*
|
|
347
|
-
*
|
|
389
|
+
* @deprecated Agents are named by their registry keys, which have no entity-id
|
|
390
|
+
* spelling contract. Use the registry key as a string. See {@link AgentId}.
|
|
391
|
+
* Removal is a later major.
|
|
348
392
|
*/
|
|
349
|
-
export const asAgentId: IdParser<AgentId> = makeIdParser('
|
|
350
|
-
export const asMemoryStoreRef: IdParser<MemoryStoreRef> = makeIdParser('
|
|
351
|
-
export const asVaultRef: IdParser<VaultRef> = makeIdParser('
|
|
352
|
-
export const asKnowledgeBaseRef: IdParser<KnowledgeBaseRef> = makeIdParser('
|
|
353
|
-
export const asProjectId: IdParser<ProjectId> = makeIdParser('
|
|
354
|
-
export const asTopicId: IdParser<TopicId> = makeIdParser('
|
|
355
|
-
export const asSubSessionId: IdParser<SubSessionId> = makeIdParser('
|
|
356
|
-
export const asHandoffId: IdParser<HandoffId> = makeIdParser('
|
|
357
|
-
export const asWorkspaceId: IdParser<WorkspaceId> = makeIdParser('
|
|
358
|
-
export const asSummaryId: IdParser<SummaryId> = makeIdParser('
|
|
359
|
-
export const asDeliverableId: IdParser<DeliverableId> = makeIdParser('
|
|
360
|
-
|
|
361
|
-
// No
|
|
362
|
-
// the Topic rename, so `asTopicId` already accepts every value one can hold
|
|
363
|
-
// — and a parser shipped `@deprecated` on the day it is written is a name
|
|
364
|
-
// that exists only to be removed. `declared-but-undriven`.
|
|
393
|
+
export const asAgentId: IdParser<AgentId> = makeIdParser('agent')
|
|
394
|
+
export const asMemoryStoreRef: IdParser<MemoryStoreRef> = makeIdParser('memoryStoreRef')
|
|
395
|
+
export const asVaultRef: IdParser<VaultRef> = makeIdParser('vaultRef')
|
|
396
|
+
export const asKnowledgeBaseRef: IdParser<KnowledgeBaseRef> = makeIdParser('knowledgeBaseRef')
|
|
397
|
+
export const asProjectId: IdParser<ProjectId> = makeIdParser('project')
|
|
398
|
+
export const asTopicId: IdParser<TopicId> = makeIdParser('topic')
|
|
399
|
+
export const asSubSessionId: IdParser<SubSessionId> = makeIdParser('subSession')
|
|
400
|
+
export const asHandoffId: IdParser<HandoffId> = makeIdParser('handoff')
|
|
401
|
+
export const asWorkspaceId: IdParser<WorkspaceId> = makeIdParser('workspace')
|
|
402
|
+
export const asSummaryId: IdParser<SummaryId> = makeIdParser('summary')
|
|
403
|
+
export const asDeliverableId: IdParser<DeliverableId> = makeIdParser('deliverable')
|
|
404
|
+
|
|
405
|
+
// No asThreadId: the ambiguous thd_ container prefix remains retired.
|
|
365
406
|
|
|
366
407
|
// `ToolUseId` is a bare `string` — it comes from a provider, which chooses
|
|
367
408
|
// its own shape, so there is no prefix to check and a constructor here would
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// logger that serializes an error chain" is exactly the property this
|
|
20
20
|
// file exists to provide. Being able to walk a `cause` safely is not the
|
|
21
21
|
// same claim as every `cause` being safe to attach in the first place;
|
|
22
|
-
// see that file's own doc comment and
|
|
22
|
+
// see that file's own doc comment and "index".
|
|
23
23
|
|
|
24
24
|
import type { LogAttributes } from './attributes.js'
|
|
25
25
|
|
package/src/utils/log/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// The LogSink seam. `../logger.ts` keeps `Logger`, `LogContext`,
|
|
2
2
|
// `getRootLogger` and `configureLogger` completely unchanged (now
|
|
3
|
-
// `@deprecated`) — this directory is the additive replacement
|
|
4
|
-
// docs/conventions and the observability docs page once those land.
|
|
3
|
+
// `@deprecated`) — this directory is the additive replacement.
|
|
5
4
|
|
|
6
5
|
export type {
|
|
7
6
|
LevelFilter,
|
|
@@ -86,7 +86,6 @@ export const BOOT_TEMPLATES: Record<BootEventName, BootTemplate> = {
|
|
|
86
86
|
// nothing-to-do branch in `runtime/query/index.ts` — so the operator's
|
|
87
87
|
// migration line rendered the body and appended an empty string. `kind`
|
|
88
88
|
// is the fact worth seeing: migrated, already_migrated, or noop_no_legacy.
|
|
89
|
-
[BOOT_EVENT_NAMES.MIGRATION_COMPLETED]: (r) => bodyWith(r, ['namzu.migration.kind']),
|
|
90
89
|
[BOOT_EVENT_NAMES.DISCOVERY_COMPLETED]: (r) =>
|
|
91
90
|
joined([
|
|
92
91
|
r.body,
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed errors for the migration module.
|
|
3
|
-
*
|
|
4
|
-
* See session-hierarchy.md §13.4.1. Structured `details` payload lets
|
|
5
|
-
* consumers route failures without string parsing (Convention #5: fail
|
|
6
|
-
* fast, surface cause, no silent swallowing).
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Raised when any filesystem step during the boot-time v0.2.0 re-layout
|
|
10
|
-
* fails (enumerate, rename, synthesize project.json, write marker).
|
|
11
|
-
* `op` is a short stable tag so consumers can dashboard on failure mode;
|
|
12
|
-
* `cause` carries the underlying `Error` for stack preservation.
|
|
13
|
-
*/
|
|
14
|
-
export declare class FilesystemMigrationError extends Error {
|
|
15
|
-
readonly details: {
|
|
16
|
-
op: string;
|
|
17
|
-
path: string;
|
|
18
|
-
cause?: unknown;
|
|
19
|
-
};
|
|
20
|
-
constructor(details: {
|
|
21
|
-
op: string;
|
|
22
|
-
path: string;
|
|
23
|
-
cause?: unknown;
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/session/migration/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IAClD,QAAQ,CAAC,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;gBAEnD,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAKlE"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed errors for the migration module.
|
|
3
|
-
*
|
|
4
|
-
* See session-hierarchy.md §13.4.1. Structured `details` payload lets
|
|
5
|
-
* consumers route failures without string parsing (Convention #5: fail
|
|
6
|
-
* fast, surface cause, no silent swallowing).
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Raised when any filesystem step during the boot-time v0.2.0 re-layout
|
|
10
|
-
* fails (enumerate, rename, synthesize project.json, write marker).
|
|
11
|
-
* `op` is a short stable tag so consumers can dashboard on failure mode;
|
|
12
|
-
* `cause` carries the underlying `Error` for stack preservation.
|
|
13
|
-
*/
|
|
14
|
-
export class FilesystemMigrationError extends Error {
|
|
15
|
-
details;
|
|
16
|
-
constructor(details) {
|
|
17
|
-
super(`Filesystem migration failed at ${details.op} on ${details.path}`);
|
|
18
|
-
this.name = 'FilesystemMigrationError';
|
|
19
|
-
this.details = details;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/session/migration/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AACH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACzC,OAAO,CAA+C;IAE/D,YAAY,OAAsD;QACjE,KAAK,CAAC,kCAAkC,OAAO,CAAC,EAAE,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;QACxE,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAA;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACvB,CAAC;CACD"}
|