@namzu/sdk 34.2.0 → 36.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 +171 -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 +150 -0
- package/dist/provider/token-budget.js.map +1 -0
- package/dist/public-runtime.d.ts +14 -14
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +15 -10
- 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 +13 -9
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +144 -55
- 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 +42 -4
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +153 -52
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +3 -3
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +47 -11
- 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 +4 -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/iteration/stream-turn.d.ts.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.js +10 -5
- package/dist/runtime/query/iteration/stream-turn.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/prompt.d.ts.map +1 -1
- package/dist/runtime/query/prompt.js +14 -4
- package/dist/runtime/query/prompt.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/file-walk-program.d.ts +3 -0
- package/dist/sandbox/file-walk-program.d.ts.map +1 -0
- package/dist/sandbox/file-walk-program.js +94 -0
- package/dist/sandbox/file-walk-program.js.map +1 -0
- package/dist/sandbox/file-walk.d.ts +12 -0
- package/dist/sandbox/file-walk.d.ts.map +1 -0
- package/dist/sandbox/file-walk.js +429 -0
- package/dist/sandbox/file-walk.js.map +1 -0
- package/dist/sandbox/index.d.ts +2 -0
- package/dist/sandbox/index.d.ts.map +1 -1
- package/dist/sandbox/index.js +1 -0
- package/dist/sandbox/index.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 +121 -12
- package/dist/sandbox/provider/local.js.map +1 -1
- package/dist/scheduler/completion-inbox.d.ts +3 -2
- package/dist/scheduler/completion-inbox.d.ts.map +1 -1
- package/dist/scheduler/completion-inbox.js +29 -15
- package/dist/scheduler/completion-inbox.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 +224 -70
- 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.d.ts +2 -1
- package/dist/tools/builtins/glob.d.ts.map +1 -1
- package/dist/tools/builtins/glob.js +95 -103
- package/dist/tools/builtins/glob.js.map +1 -1
- package/dist/tools/builtins/grep.d.ts.map +1 -1
- package/dist/tools/builtins/grep.js +155 -111
- package/dist/tools/builtins/grep.js.map +1 -1
- package/dist/tools/builtins/ls.js +4 -4
- 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 +47 -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 +6 -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 +158 -0
- package/src/public-runtime.ts +56 -28
- 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 +181 -71
- package/src/runtime/query/guard.ts +8 -0
- package/src/runtime/query/index.ts +209 -62
- package/src/runtime/query/iteration/index.ts +53 -15
- package/src/runtime/query/iteration/phases/compaction.ts +130 -31
- package/src/runtime/query/iteration/phases/context.ts +4 -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/iteration/stream-turn.ts +9 -5
- package/src/runtime/query/plugin-hooks.ts +24 -2
- package/src/runtime/query/prompt.ts +21 -4
- 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/file-walk-program.ts +93 -0
- package/src/sandbox/file-walk.ts +463 -0
- package/src/sandbox/index.ts +2 -0
- package/src/sandbox/provider/local.ts +136 -13
- package/src/scheduler/completion-inbox.ts +29 -19
- 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 +241 -70
- package/src/tools/builtins/computer-use.ts +6 -2
- package/src/tools/builtins/edit.ts +2 -2
- package/src/tools/builtins/glob.ts +104 -122
- package/src/tools/builtins/grep.ts +166 -132
- package/src/tools/builtins/ls.ts +4 -4
- 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 +53 -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
|
@@ -47,6 +47,18 @@ function renderToolResults(results, evictedCount = 0) {
|
|
|
47
47
|
}
|
|
48
48
|
return lines.join('\n');
|
|
49
49
|
}
|
|
50
|
+
/** The pinned-facts section alone, or null when nothing is pinned. */
|
|
51
|
+
export function renderPins(state) {
|
|
52
|
+
const pins = state.pins ? [...state.pins.values()] : [];
|
|
53
|
+
if (pins.length === 0)
|
|
54
|
+
return null;
|
|
55
|
+
const lines = pins.map((p) => `- **${p.key}**: ${p.text} _(${p.source})_`);
|
|
56
|
+
const dropped = state.evicted.pins ?? 0;
|
|
57
|
+
if (dropped > 0) {
|
|
58
|
+
lines.push(`- _(${dropped} older ${dropped === 1 ? 'pin' : 'pins'} dropped to stay within the pin budget)_`);
|
|
59
|
+
}
|
|
60
|
+
return `${SECTION_HEADERS.pins}\n\n${lines.join('\n')}`;
|
|
61
|
+
}
|
|
50
62
|
export function serializeState(state) {
|
|
51
63
|
const sections = [];
|
|
52
64
|
if (state.task) {
|
|
@@ -58,6 +70,9 @@ export function serializeState(state) {
|
|
|
58
70
|
if (state.plan.length > 0) {
|
|
59
71
|
sections.push(`${SECTION_HEADERS.plan}\n\n${renderPlan(state.plan)}`);
|
|
60
72
|
}
|
|
73
|
+
const pinned = renderPins(state);
|
|
74
|
+
if (pinned)
|
|
75
|
+
sections.push(pinned);
|
|
61
76
|
if (state.environment.length > 0) {
|
|
62
77
|
sections.push(`${SECTION_HEADERS.environment}\n\n${renderList(state.environment, state.evicted.environment)}`);
|
|
63
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/compaction/serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAGlE,MAAM,iBAAiB,GAAuC;IAC7D,OAAO,EAAE,QAAQ;IACjB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,QAAQ;CACjB,CAAA;AAED,SAAS,UAAU,CAAC,IAAgB;IACnC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC1F,CAAC;AAED,SAAS,WAAW,CACnB,KAGC;IAED,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;QAC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,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CACtF,CAAA;IACF,CAAC;IAED,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,QAAQ,CAAC,IAAI,CACZ,GAAG,eAAe,CAAC,WAAW,OAAO,UAAU,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAC/F,CAAA;IACF,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAC7B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Message } from '../types/message/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Provider-neutral prompt estimate shared by triggers, retention and eviction.
|
|
4
|
+
*
|
|
5
|
+
* Text and tool inputs use the existing characters-per-token approximation.
|
|
6
|
+
* Images and documents have an explicit allowance independent of compression
|
|
7
|
+
* and of whether the bytes are inline or stored externally. Without dimensions,
|
|
8
|
+
* page counts and a provider tokenizer their exact cost is unknown. In
|
|
9
|
+
* particular, serialized base64 is never treated as model-visible prose.
|
|
10
|
+
*/
|
|
11
|
+
export declare function estimateMessageTokens(message: Message): number;
|
|
12
|
+
export declare function estimateMessagesTokens(messages: readonly Message[]): number;
|
|
13
|
+
//# sourceMappingURL=token-estimate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-estimate.d.ts","sourceRoot":"","sources":["../../src/compaction/token-estimate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAsC,MAAM,2BAA2B,CAAA;AAe5F;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CA2B9D;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,CAE3E"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { CHARS_PER_TOKEN } from '../constants/limits.js';
|
|
2
|
+
// Heuristic allowances, not provider billing formulas or upper bounds. Encoded
|
|
3
|
+
// byte length depends on compression, not the number of visual tokens. The
|
|
4
|
+
// provider's measured prompt usage replaces these guesses after the next call.
|
|
5
|
+
const IMAGE_TOKENS = 1_024;
|
|
6
|
+
const DOCUMENT_TOKENS = 4_096;
|
|
7
|
+
const OMITTED_IMAGE_TOKENS = 64;
|
|
8
|
+
function richTokens(block) {
|
|
9
|
+
if (block.type === 'stored')
|
|
10
|
+
return block.kind === 'image' ? IMAGE_TOKENS : DOCUMENT_TOKENS;
|
|
11
|
+
if (block.type === 'document')
|
|
12
|
+
return DOCUMENT_TOKENS;
|
|
13
|
+
return block.modelOmission ? OMITTED_IMAGE_TOKENS : IMAGE_TOKENS;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Provider-neutral prompt estimate shared by triggers, retention and eviction.
|
|
17
|
+
*
|
|
18
|
+
* Text and tool inputs use the existing characters-per-token approximation.
|
|
19
|
+
* Images and documents have an explicit allowance independent of compression
|
|
20
|
+
* and of whether the bytes are inline or stored externally. Without dimensions,
|
|
21
|
+
* page counts and a provider tokenizer their exact cost is unknown. In
|
|
22
|
+
* particular, serialized base64 is never treated as model-visible prose.
|
|
23
|
+
*/
|
|
24
|
+
export function estimateMessageTokens(message) {
|
|
25
|
+
let chars = 0;
|
|
26
|
+
let rich = 0;
|
|
27
|
+
if (typeof message.content === 'string')
|
|
28
|
+
chars += message.content.length;
|
|
29
|
+
else if (message.content) {
|
|
30
|
+
for (const block of message.content) {
|
|
31
|
+
if (block.type === 'text')
|
|
32
|
+
chars += block.text.length;
|
|
33
|
+
else {
|
|
34
|
+
rich += richTokens(block);
|
|
35
|
+
if (block.type === 'document')
|
|
36
|
+
chars += block.name?.length ?? 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (message.role === 'assistant') {
|
|
41
|
+
for (const call of message.toolCalls ?? []) {
|
|
42
|
+
chars += call.function.name.length + call.function.arguments.length;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (message.role === 'user') {
|
|
46
|
+
for (const attachment of message.attachments ?? []) {
|
|
47
|
+
rich += richTokens(attachment);
|
|
48
|
+
if (attachment.type === 'document' || attachment.type === 'stored') {
|
|
49
|
+
chars += attachment.name?.length ?? 0;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return Math.ceil(chars / CHARS_PER_TOKEN) + rich;
|
|
54
|
+
}
|
|
55
|
+
export function estimateMessagesTokens(messages) {
|
|
56
|
+
return messages.reduce((total, message) => total + estimateMessageTokens(message), 0);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=token-estimate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-estimate.js","sourceRoot":"","sources":["../../src/compaction/token-estimate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAGxD,+EAA+E;AAC/E,2EAA2E;AAC3E,+EAA+E;AAC/E,MAAM,YAAY,GAAG,KAAK,CAAA;AAC1B,MAAM,eAAe,GAAG,KAAK,CAAA;AAC7B,MAAM,oBAAoB,GAAG,EAAE,CAAA;AAE/B,SAAS,UAAU,CAAC,KAAqE;IACxF,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,eAAe,CAAA;IAC3F,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,eAAe,CAAA;IACrD,OAAO,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,YAAY,CAAA;AACjE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACrD,IAAI,KAAK,GAAG,CAAC,CAAA;IAC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AC,GAAG,IAAI,CAAA;AACjD,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,QAA4B;IAClE,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,KAAK,GAAG,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAA;AACtF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Message } from '../types/message/index.js';
|
|
1
|
+
import type { Message, ToolMessage } from '../types/message/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Clear stale tool OUTPUT in place, without touching the conversation's
|
|
4
4
|
* shape.
|
|
@@ -39,9 +39,17 @@ export declare const DEFAULT_MIN_CHARS_TO_CLEAR = 1000;
|
|
|
39
39
|
export interface ToolResultEditOutcome {
|
|
40
40
|
readonly messages: Message[];
|
|
41
41
|
readonly clearedCount: number;
|
|
42
|
-
/**
|
|
42
|
+
/** Payload characters removed, including encoded data; not a token estimate. */
|
|
43
43
|
readonly charsReclaimed: number;
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* One result cleared on its own, for a caller that chose it by some
|
|
47
|
+
* other rule than staleness. The same placeholder, the same accounting.
|
|
48
|
+
*/
|
|
49
|
+
export declare function clearToolResult(tool: ToolMessage, toolName: string): {
|
|
50
|
+
readonly message: ToolMessage;
|
|
51
|
+
readonly charsReclaimed: number;
|
|
52
|
+
};
|
|
45
53
|
export declare function isClearedToolResult(content: unknown): boolean;
|
|
46
54
|
/**
|
|
47
55
|
* Replace the output of old, large tool results with a short placeholder.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-result-editing.d.ts","sourceRoot":"","sources":["../../src/compaction/tool-result-editing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool-result-editing.d.ts","sourceRoot":"","sources":["../../src/compaction/tool-result-editing.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAmB,MAAM,2BAA2B,CAAA;AAItF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAA;IACvC;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAA;IACjC,oDAAoD;IACpD,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC1C;AAED,eAAO,MAAM,gCAAgC,IAAI,CAAA;AACjD,eAAO,MAAM,0BAA0B,OAAQ,CAAA;AA2E/C,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAA;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,gFAAgF;IAChF,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAC/B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC9B,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,MAAM,GACd;IAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAIpE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAE7D;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACpC,QAAQ,EAAE,SAAS,OAAO,EAAE,EAC5B,MAAM,GAAE,oBAAyB,GAC/B,qBAAqB,CA8DvB"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { CHARS_PER_TOKEN } from '../constants/limits.js';
|
|
1
2
|
import { SPILL_MARKER } from '../runtime/query/tool-output-budget.js';
|
|
2
3
|
import { toolResultToText } from '../types/message/content.js';
|
|
3
4
|
import { findRetainedIndices } from './retention.js';
|
|
5
|
+
import { estimateMessageTokens } from './token-estimate.js';
|
|
4
6
|
export const DEFAULT_KEEP_RECENT_TOOL_RESULTS = 3;
|
|
5
7
|
export const DEFAULT_MIN_CHARS_TO_CLEAR = 1_000;
|
|
6
8
|
/** Marks a cleared result, and is how a second pass recognizes its own work. */
|
|
@@ -43,7 +45,7 @@ function clearedPlaceholder(content, toolName, size) {
|
|
|
43
45
|
parts.push(spillLine, 'Read a window of it with `read` (offset/limit) or search it with `grep`.');
|
|
44
46
|
}
|
|
45
47
|
else {
|
|
46
|
-
parts.push('
|
|
48
|
+
parts.push('Full result unavailable here. Recover from a saved artifact or a read-only observation; do not repeat a state-changing action to recover its output.');
|
|
47
49
|
}
|
|
48
50
|
if (text.length > KEEP_HEAD_CHARS + KEEP_TAIL_CHARS) {
|
|
49
51
|
parts.push('', text.slice(0, KEEP_HEAD_CHARS), `… ${(text.length - KEEP_HEAD_CHARS - KEEP_TAIL_CHARS).toLocaleString('en-US')} characters elided …`, text.slice(-KEEP_TAIL_CHARS));
|
|
@@ -58,6 +60,15 @@ function clearedPlaceholder(content, toolName, size) {
|
|
|
58
60
|
}
|
|
59
61
|
return parts.join('\n');
|
|
60
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* One result cleared on its own, for a caller that chose it by some
|
|
65
|
+
* other rule than staleness. The same placeholder, the same accounting.
|
|
66
|
+
*/
|
|
67
|
+
export function clearToolResult(tool, toolName) {
|
|
68
|
+
const size = measureContent(tool.content);
|
|
69
|
+
const content = clearedPlaceholder(tool.content, toolName, size);
|
|
70
|
+
return { message: { ...tool, content }, charsReclaimed: Math.max(0, size - content.length) };
|
|
71
|
+
}
|
|
61
72
|
export function isClearedToolResult(content) {
|
|
62
73
|
return typeof content === 'string' && content.startsWith(CLEARED_PREFIX);
|
|
63
74
|
}
|
|
@@ -116,36 +127,23 @@ export function clearStaleToolResults(messages, config = {}) {
|
|
|
116
127
|
if (preserve.has(toolName))
|
|
117
128
|
return msg;
|
|
118
129
|
const size = measureContent(tool.content);
|
|
119
|
-
if (
|
|
130
|
+
if (estimateMessageTokens(tool) * CHARS_PER_TOKEN < minChars)
|
|
131
|
+
return msg;
|
|
132
|
+
const content = clearedPlaceholder(tool.content, toolName, size);
|
|
133
|
+
if (estimateMessageTokens({ ...tool, content }) >= estimateMessageTokens(tool))
|
|
120
134
|
return msg;
|
|
121
135
|
clearedCount++;
|
|
122
|
-
charsReclaimed += size -
|
|
136
|
+
charsReclaimed += size - content.length;
|
|
123
137
|
return {
|
|
124
138
|
...tool,
|
|
125
|
-
content
|
|
139
|
+
content,
|
|
126
140
|
};
|
|
127
141
|
});
|
|
128
|
-
|
|
129
|
-
// caller uses to decide "was that enough?" is the real saving and not
|
|
130
|
-
// an overstatement.
|
|
131
|
-
if (clearedCount > 0) {
|
|
132
|
-
let placeholderChars = 0;
|
|
133
|
-
for (const msg of edited) {
|
|
134
|
-
if (msg.role === 'tool' && isClearedToolResult(msg.content)) {
|
|
135
|
-
placeholderChars += measureContent(msg.content);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
charsReclaimed = Math.max(0, charsReclaimed - placeholderChars);
|
|
139
|
-
}
|
|
140
|
-
return { messages: edited, clearedCount, charsReclaimed };
|
|
142
|
+
return { messages: edited, clearedCount, charsReclaimed: Math.max(0, charsReclaimed) };
|
|
141
143
|
}
|
|
142
144
|
/**
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* An image block is measured by its base64 payload, which is the whole
|
|
146
|
-
* point: a screenshot is the single largest thing a tool result can carry,
|
|
147
|
-
* and it is exactly the kind of output an agent reads once and never
|
|
148
|
-
* needs again.
|
|
145
|
+
* Payload character count for storage telemetry. Encoded image length is
|
|
146
|
+
* independent of visual token cost; context decisions use the shared estimate.
|
|
149
147
|
*/
|
|
150
148
|
function measureContent(content) {
|
|
151
149
|
if (typeof content === 'string')
|
|
@@ -156,7 +154,7 @@ function measureContent(content) {
|
|
|
156
154
|
for (const block of content) {
|
|
157
155
|
if (block.type === 'text')
|
|
158
156
|
total += block.text.length;
|
|
159
|
-
else if (block.type === 'image')
|
|
157
|
+
else if (block.type === 'image' || block.type === 'document')
|
|
160
158
|
total += block.data.length;
|
|
161
159
|
}
|
|
162
160
|
return total;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-result-editing.js","sourceRoot":"","sources":["../../src/compaction/tool-result-editing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"tool-result-editing.js","sourceRoot":"","sources":["../../src/compaction/tool-result-editing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAsC3D,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAA;AACjD,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAA;AAE/C,gFAAgF;AAChF,MAAM,cAAc,GAAG,uBAAuB,CAAA;AAE9C;;;;;;;GAOG;AACH,MAAM,eAAe,GAAG,GAAG,CAAA;AAC3B,MAAM,eAAe,GAAG,GAAG,CAAA;AAE3B;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAS,kBAAkB,CAC1B,OAA+B,EAC/B,QAAgB,EAChB,IAAY;IAEZ,MAAM,IAAI,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAC9E,MAAM,KAAK,GAAa;QACvB,GAAG,cAAc,IAAI,QAAQ,aAAa,IAAI,CAAC,cAAc,CA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AG,kBAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;QAChE,IAAI,qBAAqB,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,qBAAqB,CAAC,IAAI,CAAC;YAAE,OAAO,GAAG,CAAA;QAC1F,YAAY,EAAE,CAAA;QACd,cAAc,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAA;QACvC,OAAO;YACN,GAAG,IAAI;YACP,OAAO;SACe,CAAA;IACxB,CAAC,CAAC,CAAA;IAEF,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,cAAc,CAAC,EAAE,CAAA;AACvF,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc,CAAC,OAA+B;IACtD,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC,MAAM,CAAA;IACtD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,CAAC,CAAA;IACrC,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,KAAK,MAAM,KAAK,IAAI,OAAqC,EAAE,CAAC;QAC3D,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;YAAE,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAA;aAChD,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;YAAE,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAA;IACzF,CAAC;IACD,OAAO,KAAK,CAAA;AACb,CAAC"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
export interface WorkingState {
|
|
2
2
|
task: string;
|
|
3
3
|
plan: PlanSlot[];
|
|
4
|
+
/**
|
|
5
|
+
* Facts pinned by tools, by key. A tool that knows something the model
|
|
6
|
+
* must not lose — what its controls do, where the piece is, what has
|
|
7
|
+
* already failed — pins it with a key, and a later pin under the same
|
|
8
|
+
* key replaces it. Pins live in the working-memory slot, so they are in
|
|
9
|
+
* front of the model every iteration and survive compaction; the
|
|
10
|
+
* rule-based extractor below only guesses, a pin is stated.
|
|
11
|
+
*/
|
|
12
|
+
pins: Map<string, PinSlot>;
|
|
4
13
|
files: Map<string, FileSlot>;
|
|
5
14
|
decisions: string[];
|
|
6
15
|
failures: string[];
|
|
@@ -20,6 +29,18 @@ export interface WorkingState {
|
|
|
20
29
|
*/
|
|
21
30
|
evicted: Record<string, number>;
|
|
22
31
|
}
|
|
32
|
+
export interface PinSlot {
|
|
33
|
+
key: string;
|
|
34
|
+
text: string;
|
|
35
|
+
/** The tool that pinned it. */
|
|
36
|
+
source: string;
|
|
37
|
+
updatedAt: number;
|
|
38
|
+
}
|
|
39
|
+
/** What a tool result carries to pin a fact; see `ToolResult.workingState`. */
|
|
40
|
+
export interface WorkingStatePin {
|
|
41
|
+
readonly key: string;
|
|
42
|
+
readonly text: string;
|
|
43
|
+
}
|
|
23
44
|
export interface PlanSlot {
|
|
24
45
|
id: string;
|
|
25
46
|
label: string;
|
|
@@ -46,5 +67,5 @@ export interface ToolResultSlot {
|
|
|
46
67
|
summary: string;
|
|
47
68
|
timestamp: number;
|
|
48
69
|
}
|
|
49
|
-
export type CompactionStrategy = 'structured' | 'sliding-window' | 'disabled';
|
|
70
|
+
export type CompactionStrategy = 'structured' | 'salience' | 'sliding-window' | 'disabled';
|
|
50
71
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/compaction/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,QAAQ,EAAE,CAAA;IAChB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAC5B,SAAS,EAAE,MAA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C;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAA;AAErB,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,GAAG,gBAAgB,GAAG,UAAU,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CompactionConfig } from '../config/runtime.js';
|
|
2
2
|
import { WorkingStateManager } from './manager.js';
|
|
3
|
-
import type { FileSlot, PlanSlot, ToolResultSlot } from './types.js';
|
|
3
|
+
import type { FileSlot, PinSlot, PlanSlot, ToolResultSlot } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* The working state in a form that survives a process boundary.
|
|
6
6
|
*
|
|
@@ -25,6 +25,8 @@ import type { FileSlot, PlanSlot, ToolResultSlot } from './types.js';
|
|
|
25
25
|
export interface WorkingStateSnapshot {
|
|
26
26
|
readonly task: string;
|
|
27
27
|
readonly plan: readonly PlanSlot[];
|
|
28
|
+
/** Absent in snapshots written before pins existed; restored as none. */
|
|
29
|
+
readonly pins?: readonly PinSlot[];
|
|
28
30
|
readonly files: readonly FileSlot[];
|
|
29
31
|
readonly decisions: readonly string[];
|
|
30
32
|
readonly failures: readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../src/compaction/wire.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAgB,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../src/compaction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action/wire.js
CHANGED
|
@@ -4,6 +4,7 @@ export function snapshotWorkingState(manager) {
|
|
|
4
4
|
return {
|
|
5
5
|
task: state.task,
|
|
6
6
|
plan: [...state.plan],
|
|
7
|
+
pins: [...(state.pins?.values() ?? [])],
|
|
7
8
|
files: [...state.files.values()],
|
|
8
9
|
decisions: [...state.decisions],
|
|
9
10
|
failures: [...state.failures],
|
|
@@ -29,6 +30,7 @@ export function restoreWorkingState(snapshot, config) {
|
|
|
29
30
|
const state = {
|
|
30
31
|
task: snapshot.task,
|
|
31
32
|
plan: [...snapshot.plan],
|
|
33
|
+
pins: new Map((snapshot.pins ?? []).map((p) => [p.key, p])),
|
|
32
34
|
files: new Map(snapshot.files.map((f) => [f.path, f])),
|
|
33
35
|
decisions: [...snapshot.decisions],
|
|
34
36
|
failures: [...snapshot.failures],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../../src/compaction/wire.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../../src/compaction/wire.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AA6ClD,MAAM,UAAU,oBAAoB,CAAC,OAA4B;IAChE,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAA;IAChC,OAAO;QACN,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;QACrB,IAAI,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACvC,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAChC,SAAS,EAAE,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;QAC/B,QAAQ,EAA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,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC;QACtC,gBAAgB,EAAE,CAAC,GAAG,QAAQ,CAAC,gBAAgB,CAAC;QAChD,cAAc,EAAE,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC;QAC5C,OAAO,EAAE,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE;KAChC,CAAA;IACD,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;IAC3B,OAAO,OAAO,CAAA;AACf,CAAC"}
|
package/dist/config/runtime.d.ts
CHANGED
|
@@ -27,7 +27,19 @@ export declare const TaskRouterConfigSchema: z.ZodOptional<z.ZodObject<{
|
|
|
27
27
|
planning?: string | null | undefined;
|
|
28
28
|
}>>;
|
|
29
29
|
export declare const CompactionConfigSchema: z.ZodObject<{
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* `salience` is the default: every message scored without a model, the
|
|
32
|
+
* context held from half the window. `structured` is the previous
|
|
33
|
+
* default — positional retention, a pass only at the trigger — and one
|
|
34
|
+
* word away for a host that wants it back.
|
|
35
|
+
*/
|
|
36
|
+
strategy: z.ZodDefault<z.ZodEnum<["structured", "salience", "sliding-window", "disabled"]>>;
|
|
37
|
+
/**
|
|
38
|
+
* `salience` only: the fraction of the window at which the working-set
|
|
39
|
+
* pass starts evicting low-salience messages, well before
|
|
40
|
+
* `triggerThreshold` summarises. The context is held around here.
|
|
41
|
+
*/
|
|
42
|
+
softTarget: z.ZodOptional<z.ZodNumber>;
|
|
31
43
|
/**
|
|
32
44
|
* Optional model context-window size (tokens) the compaction trigger
|
|
33
45
|
* measures the CURRENT window against. NO default: when omitted the
|
|
@@ -130,7 +142,7 @@ export declare const CompactionConfigSchema: z.ZodObject<{
|
|
|
130
142
|
maxCharsPerRequirement: z.ZodDefault<z.ZodNumber>;
|
|
131
143
|
maxCharsPerTask: z.ZodDefault<z.ZodNumber>;
|
|
132
144
|
}, "strip", z.ZodTypeAny, {
|
|
133
|
-
strategy: "structured" | "sliding-window" | "disabled";
|
|
145
|
+
strategy: "structured" | "salience" | "sliding-window" | "disabled";
|
|
134
146
|
triggerThreshold: number;
|
|
135
147
|
resetThreshold: number;
|
|
136
148
|
keepRecentMessages: number;
|
|
@@ -149,11 +161,13 @@ export declare const CompactionConfigSchema: z.ZodObject<{
|
|
|
149
161
|
maxCharsPerNote: number;
|
|
150
162
|
maxCharsPerRequirement: number;
|
|
151
163
|
maxCharsPerTask: number;
|
|
164
|
+
softTarget?: number | undefined;
|
|
152
165
|
contextWindowTokens?: number | undefined;
|
|
153
166
|
keepRecentTokens?: number | undefined;
|
|
154
167
|
preserveToolResultsFrom?: string[] | undefined;
|
|
155
168
|
}, {
|
|
156
|
-
strategy?: "structured" | "sliding-window" | "disabled" | undefined;
|
|
169
|
+
strategy?: "structured" | "salience" | "sliding-window" | "disabled" | undefined;
|
|
170
|
+
softTarget?: number | undefined;
|
|
157
171
|
contextWindowTokens?: number | undefined;
|
|
158
172
|
triggerThreshold?: number | undefined;
|
|
159
173
|
resetThreshold?: number | undefined;
|
|
@@ -260,7 +274,19 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
260
274
|
planning?: string | null | undefined;
|
|
261
275
|
}>>;
|
|
262
276
|
compaction: z.ZodDefault<z.ZodObject<{
|
|
263
|
-
|
|
277
|
+
/**
|
|
278
|
+
* `salience` is the default: every message scored without a model, the
|
|
279
|
+
* context held from half the window. `structured` is the previous
|
|
280
|
+
* default — positional retention, a pass only at the trigger — and one
|
|
281
|
+
* word away for a host that wants it back.
|
|
282
|
+
*/
|
|
283
|
+
strategy: z.ZodDefault<z.ZodEnum<["structured", "salience", "sliding-window", "disabled"]>>;
|
|
284
|
+
/**
|
|
285
|
+
* `salience` only: the fraction of the window at which the working-set
|
|
286
|
+
* pass starts evicting low-salience messages, well before
|
|
287
|
+
* `triggerThreshold` summarises. The context is held around here.
|
|
288
|
+
*/
|
|
289
|
+
softTarget: z.ZodOptional<z.ZodNumber>;
|
|
264
290
|
/**
|
|
265
291
|
* Optional model context-window size (tokens) the compaction trigger
|
|
266
292
|
* measures the CURRENT window against. NO default: when omitted the
|
|
@@ -363,7 +389,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
363
389
|
maxCharsPerRequirement: z.ZodDefault<z.ZodNumber>;
|
|
364
390
|
maxCharsPerTask: z.ZodDefault<z.ZodNumber>;
|
|
365
391
|
}, "strip", z.ZodTypeAny, {
|
|
366
|
-
strategy: "structured" | "sliding-window" | "disabled";
|
|
392
|
+
strategy: "structured" | "salience" | "sliding-window" | "disabled";
|
|
367
393
|
triggerThreshold: number;
|
|
368
394
|
resetThreshold: number;
|
|
369
395
|
keepRecentMessages: number;
|
|
@@ -382,11 +408,13 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
382
408
|
maxCharsPerNote: number;
|
|
383
409
|
maxCharsPerRequirement: number;
|
|
384
410
|
maxCharsPerTask: number;
|
|
411
|
+
softTarget?: number | undefined;
|
|
385
412
|
contextWindowTokens?: number | undefined;
|
|
386
413
|
keepRecentTokens?: number | undefined;
|
|
387
414
|
preserveToolResultsFrom?: string[] | undefined;
|
|
388
415
|
}, {
|
|
389
|
-
strategy?: "structured" | "sliding-window" | "disabled" | undefined;
|
|
416
|
+
strategy?: "structured" | "salience" | "sliding-window" | "disabled" | undefined;
|
|
417
|
+
softTarget?: number | undefined;
|
|
390
418
|
contextWindowTokens?: number | undefined;
|
|
391
419
|
triggerThreshold?: number | undefined;
|
|
392
420
|
resetThreshold?: number | undefined;
|
|
@@ -456,27 +484,27 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
456
484
|
requireIsolation: z.ZodDefault<z.ZodArray<z.ZodEnum<["filesystem", "network", "process"]>, "many">>;
|
|
457
485
|
workspace: z.ZodDefault<z.ZodEnum<["ephemeral", "working-directory"]>>;
|
|
458
486
|
}, "strip", z.ZodTypeAny, {
|
|
487
|
+
workspace: "ephemeral" | "working-directory";
|
|
459
488
|
enabled: boolean;
|
|
460
489
|
provider: "local";
|
|
461
490
|
timeoutMs: number;
|
|
462
491
|
memoryLimitMb: number;
|
|
463
492
|
maxProcesses: number;
|
|
464
493
|
requireIsolation: ("network" | "filesystem" | "process")[];
|
|
465
|
-
workspace: "ephemeral" | "working-directory";
|
|
466
494
|
}, {
|
|
495
|
+
workspace?: "ephemeral" | "working-directory" | undefined;
|
|
467
496
|
enabled?: boolean | undefined;
|
|
468
497
|
provider?: "local" | undefined;
|
|
469
498
|
timeoutMs?: number | undefined;
|
|
470
499
|
memoryLimitMb?: number | undefined;
|
|
471
500
|
maxProcesses?: number | undefined;
|
|
472
501
|
requireIsolation?: ("network" | "filesystem" | "process")[] | undefined;
|
|
473
|
-
workspace?: "ephemeral" | "working-directory" | undefined;
|
|
474
502
|
}>>;
|
|
475
503
|
}, "strip", z.ZodTypeAny, {
|
|
476
504
|
model: string;
|
|
477
505
|
timeoutMs: number;
|
|
478
506
|
compaction: {
|
|
479
|
-
strategy: "structured" | "sliding-window" | "disabled";
|
|
507
|
+
strategy: "structured" | "salience" | "sliding-window" | "disabled";
|
|
480
508
|
triggerThreshold: number;
|
|
481
509
|
resetThreshold: number;
|
|
482
510
|
keepRecentMessages: number;
|
|
@@ -495,6 +523,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
495
523
|
maxCharsPerNote: number;
|
|
496
524
|
maxCharsPerRequirement: number;
|
|
497
525
|
maxCharsPerTask: number;
|
|
526
|
+
softTarget?: number | undefined;
|
|
498
527
|
contextWindowTokens?: number | undefined;
|
|
499
528
|
keepRecentTokens?: number | undefined;
|
|
500
529
|
preserveToolResultsFrom?: string[] | undefined;
|
|
@@ -503,6 +532,15 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
503
532
|
tokenBudget: number;
|
|
504
533
|
maxResponseTokens: number;
|
|
505
534
|
maxIterations: number;
|
|
535
|
+
sandbox?: {
|
|
536
|
+
workspace: "ephemeral" | "working-directory";
|
|
537
|
+
enabled: boolean;
|
|
538
|
+
provider: "local";
|
|
539
|
+
timeoutMs: number;
|
|
540
|
+
memoryLimitMb: number;
|
|
541
|
+
maxProcesses: number;
|
|
542
|
+
requireIsolation: ("network" | "filesystem" | "process")[];
|
|
543
|
+
} | undefined;
|
|
506
544
|
taskRouter?: {
|
|
507
545
|
default?: string | null | undefined;
|
|
508
546
|
compaction?: string | null | undefined;
|
|
@@ -526,20 +564,21 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
526
564
|
allowedScopes: ("user" | "project")[];
|
|
527
565
|
hookTimeoutMs: number;
|
|
528
566
|
} | undefined;
|
|
529
|
-
sandbox?: {
|
|
530
|
-
enabled: boolean;
|
|
531
|
-
provider: "local";
|
|
532
|
-
timeoutMs: number;
|
|
533
|
-
memoryLimitMb: number;
|
|
534
|
-
maxProcesses: number;
|
|
535
|
-
requireIsolation: ("network" | "filesystem" | "process")[];
|
|
536
|
-
workspace: "ephemeral" | "working-directory";
|
|
537
|
-
} | undefined;
|
|
538
567
|
}, {
|
|
539
568
|
model?: string | undefined;
|
|
569
|
+
sandbox?: {
|
|
570
|
+
workspace?: "ephemeral" | "working-directory" | undefined;
|
|
571
|
+
enabled?: boolean | undefined;
|
|
572
|
+
provider?: "local" | undefined;
|
|
573
|
+
timeoutMs?: number | undefined;
|
|
574
|
+
memoryLimitMb?: number | undefined;
|
|
575
|
+
maxProcesses?: number | undefined;
|
|
576
|
+
requireIsolation?: ("network" | "filesystem" | "process")[] | undefined;
|
|
577
|
+
} | undefined;
|
|
540
578
|
timeoutMs?: number | undefined;
|
|
541
579
|
compaction?: {
|
|
542
|
-
strategy?: "structured" | "sliding-window" | "disabled" | undefined;
|
|
580
|
+
strategy?: "structured" | "salience" | "sliding-window" | "disabled" | undefined;
|
|
581
|
+
softTarget?: number | undefined;
|
|
543
582
|
contextWindowTokens?: number | undefined;
|
|
544
583
|
triggerThreshold?: number | undefined;
|
|
545
584
|
resetThreshold?: number | undefined;
|
|
@@ -589,15 +628,6 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
589
628
|
allowedScopes?: ("user" | "project")[] | undefined;
|
|
590
629
|
hookTimeoutMs?: number | undefined;
|
|
591
630
|
} | undefined;
|
|
592
|
-
sandbox?: {
|
|
593
|
-
enabled?: boolean | undefined;
|
|
594
|
-
provider?: "local" | undefined;
|
|
595
|
-
timeoutMs?: number | undefined;
|
|
596
|
-
memoryLimitMb?: number | undefined;
|
|
597
|
-
maxProcesses?: number | undefined;
|
|
598
|
-
requireIsolation?: ("network" | "filesystem" | "process")[] | undefined;
|
|
599
|
-
workspace?: "ephemeral" | "working-directory" | undefined;
|
|
600
|
-
} | undefined;
|
|
601
631
|
}>;
|
|
602
632
|
export type RuntimeConfig = z.infer<typeof RuntimeConfigSchema>;
|
|
603
633
|
export declare const RUNTIME_DEFAULTS: Readonly<RuntimeConfig>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/config/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAE/D,OAAO,EAAE,mBAAmB,EAAE,CAAA;AAE9B,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;GAUvB,CAAA;AAEZ,eAAO,MAAM,sBAAsB;;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/config/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAE/D,OAAO,EAAE,mBAAmB,EAAE,CAAA;AAE9B,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;GAUvB,CAAA;AAEZ,eAAO,MAAM,sBAAsB;IAClC;;;;;OAKG;;IAEH;;;;OAIG;;IAEH;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDF,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,aAAa,CAAiC,CAAA"}
|
package/dist/config/runtime.js
CHANGED
|
@@ -14,7 +14,19 @@ export const TaskRouterConfigSchema = z
|
|
|
14
14
|
})
|
|
15
15
|
.optional();
|
|
16
16
|
export const CompactionConfigSchema = z.object({
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* `salience` is the default: every message scored without a model, the
|
|
19
|
+
* context held from half the window. `structured` is the previous
|
|
20
|
+
* default — positional retention, a pass only at the trigger — and one
|
|
21
|
+
* word away for a host that wants it back.
|
|
22
|
+
*/
|
|
23
|
+
strategy: z.enum(['structured', 'salience', 'sliding-window', 'disabled']).default('salience'),
|
|
24
|
+
/**
|
|
25
|
+
* `salience` only: the fraction of the window at which the working-set
|
|
26
|
+
* pass starts evicting low-salience messages, well before
|
|
27
|
+
* `triggerThreshold` summarises. The context is held around here.
|
|
28
|
+
*/
|
|
29
|
+
softTarget: z.number().min(0).max(1).optional(),
|
|
18
30
|
/**
|
|
19
31
|
* Optional model context-window size (tokens) the compaction trigger
|
|
20
32
|
* measures the CURRENT window against. NO default: when omitted the
|