@xrkseek/harness-cli 0.0.5 → 0.0.7
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/README.md +3 -1
- package/dist/commands/plugin.d.ts +3 -0
- package/dist/commands/plugin.d.ts.map +1 -0
- package/dist/commands/plugin.js +100 -0
- package/dist/commands/plugin.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/parse-args.d.ts +3 -1
- package/dist/parse-args.d.ts.map +1 -1
- package/dist/parse-args.js +11 -0
- package/dist/parse-args.js.map +1 -1
- package/dist/plugin/classify.d.ts +18 -0
- package/dist/plugin/classify.d.ts.map +1 -0
- package/dist/plugin/classify.js +109 -0
- package/dist/plugin/classify.js.map +1 -0
- package/dist/plugin/fetch-pack.d.ts +16 -0
- package/dist/plugin/fetch-pack.d.ts.map +1 -0
- package/dist/plugin/fetch-pack.js +104 -0
- package/dist/plugin/fetch-pack.js.map +1 -0
- package/dist/plugin/index.d.ts +27 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +109 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/install-client.d.ts +4 -0
- package/dist/plugin/install-client.d.ts.map +1 -0
- package/dist/plugin/install-client.js +34 -0
- package/dist/plugin/install-client.js.map +1 -0
- package/dist/plugin/install-process.d.ts +4 -0
- package/dist/plugin/install-process.d.ts.map +1 -0
- package/dist/plugin/install-process.js +46 -0
- package/dist/plugin/install-process.js.map +1 -0
- package/dist/plugin/inventory.d.ts +42 -0
- package/dist/plugin/inventory.d.ts.map +1 -0
- package/dist/plugin/inventory.js +105 -0
- package/dist/plugin/inventory.js.map +1 -0
- package/dist/plugin/remap-inject.d.ts +16 -0
- package/dist/plugin/remap-inject.d.ts.map +1 -0
- package/dist/plugin/remap-inject.js +52 -0
- package/dist/plugin/remap-inject.js.map +1 -0
- package/node_modules/@xrkseek/core-agent/dist/index.d.ts +9 -2
- package/node_modules/@xrkseek/core-agent/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-agent/dist/index.js +5 -2
- package/node_modules/@xrkseek/core-agent/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/core-agent-loop/dist/cancel-finalize.d.ts +6 -3
- package/node_modules/@xrkseek/core-agent-loop/dist/cancel-finalize.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-agent-loop/dist/cancel-finalize.js +50 -4
- package/node_modules/@xrkseek/core-agent-loop/dist/cancel-finalize.js.map +1 -1
- package/node_modules/@xrkseek/core-agent-loop/dist/index.d.ts +12 -1
- package/node_modules/@xrkseek/core-agent-loop/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-agent-loop/dist/index.js +215 -43
- package/node_modules/@xrkseek/core-agent-loop/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/core-agent-loop/dist/llm-retry.d.ts +32 -0
- package/node_modules/@xrkseek/core-agent-loop/dist/llm-retry.d.ts.map +1 -0
- package/node_modules/@xrkseek/core-agent-loop/dist/llm-retry.js +92 -0
- package/node_modules/@xrkseek/core-agent-loop/dist/llm-retry.js.map +1 -0
- package/node_modules/@xrkseek/core-agent-loop/dist/settle-batch.d.ts +18 -8
- package/node_modules/@xrkseek/core-agent-loop/dist/settle-batch.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-agent-loop/dist/settle-batch.js +187 -29
- package/node_modules/@xrkseek/core-agent-loop/dist/settle-batch.js.map +1 -1
- package/node_modules/@xrkseek/core-session/README.md +1 -1
- package/node_modules/@xrkseek/core-session/dist/chunk-pack.d.ts +18 -4
- package/node_modules/@xrkseek/core-session/dist/chunk-pack.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/chunk-pack.js +114 -34
- package/node_modules/@xrkseek/core-session/dist/chunk-pack.js.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/compaction.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/compaction.js +24 -4
- package/node_modules/@xrkseek/core-session/dist/compaction.js.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/dangling.d.ts +28 -1
- package/node_modules/@xrkseek/core-session/dist/dangling.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/dangling.js +35 -5
- package/node_modules/@xrkseek/core-session/dist/dangling.js.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/index.d.ts +3 -2
- package/node_modules/@xrkseek/core-session/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/index.js +3 -2
- package/node_modules/@xrkseek/core-session/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/latch.d.ts +1 -1
- package/node_modules/@xrkseek/core-session/dist/latch.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/latch.js +2 -2
- package/node_modules/@xrkseek/core-session/dist/latch.js.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/repair-open-turn.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/repair-open-turn.js +44 -4
- package/node_modules/@xrkseek/core-session/dist/repair-open-turn.js.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/sqlite-store.d.ts +1 -0
- package/node_modules/@xrkseek/core-session/dist/sqlite-store.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/sqlite-store.js +10 -5
- package/node_modules/@xrkseek/core-session/dist/sqlite-store.js.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/surface-fold.d.ts +5 -0
- package/node_modules/@xrkseek/core-session/dist/surface-fold.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/surface-fold.js +29 -3
- package/node_modules/@xrkseek/core-session/dist/surface-fold.js.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/tool-result-prune.d.ts +35 -0
- package/node_modules/@xrkseek/core-session/dist/tool-result-prune.d.ts.map +1 -0
- package/node_modules/@xrkseek/core-session/dist/tool-result-prune.js +99 -0
- package/node_modules/@xrkseek/core-session/dist/tool-result-prune.js.map +1 -0
- package/node_modules/@xrkseek/core-system-prompt/dist/index.d.ts +1 -1
- package/node_modules/@xrkseek/core-system-prompt/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-system-prompt/dist/index.js +1 -1
- package/node_modules/@xrkseek/core-system-prompt/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/core-system-prompt/dist/three-layer.d.ts +15 -2
- package/node_modules/@xrkseek/core-system-prompt/dist/three-layer.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-system-prompt/dist/three-layer.js +38 -4
- package/node_modules/@xrkseek/core-system-prompt/dist/three-layer.js.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/abort.d.ts +5 -0
- package/node_modules/@xrkseek/core-tools/dist/abort.d.ts.map +1 -0
- package/node_modules/@xrkseek/core-tools/dist/abort.js +14 -0
- package/node_modules/@xrkseek/core-tools/dist/abort.js.map +1 -0
- package/node_modules/@xrkseek/core-tools/dist/definition.d.ts +32 -1
- package/node_modules/@xrkseek/core-tools/dist/definition.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/definition.js +1 -0
- package/node_modules/@xrkseek/core-tools/dist/definition.js.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/execution-mode.d.ts +15 -0
- package/node_modules/@xrkseek/core-tools/dist/execution-mode.d.ts.map +1 -0
- package/node_modules/@xrkseek/core-tools/dist/execution-mode.js +17 -0
- package/node_modules/@xrkseek/core-tools/dist/execution-mode.js.map +1 -0
- package/node_modules/@xrkseek/core-tools/dist/index.d.ts +2 -0
- package/node_modules/@xrkseek/core-tools/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/index.js +2 -0
- package/node_modules/@xrkseek/core-tools/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/pipeline.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/pipeline.js +36 -10
- package/node_modules/@xrkseek/core-tools/dist/pipeline.js.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/types.d.ts +7 -0
- package/node_modules/@xrkseek/core-tools/dist/types.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/types.js.map +1 -1
- package/node_modules/@xrkseek/exec-fs/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-fs/dist/index.js +3 -0
- package/node_modules/@xrkseek/exec-fs/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/exec-lsp/dist/tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-lsp/dist/tools.js +1 -0
- package/node_modules/@xrkseek/exec-lsp/dist/tools.js.map +1 -1
- package/node_modules/@xrkseek/exec-pty/dist/tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-pty/dist/tools.js +2 -0
- package/node_modules/@xrkseek/exec-pty/dist/tools.js.map +1 -1
- package/node_modules/@xrkseek/exec-shell/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-shell/dist/index.js +4 -0
- package/node_modules/@xrkseek/exec-shell/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/exec-web/dist/search-providers.js.map +1 -1
- package/node_modules/@xrkseek/exec-web/dist/tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-web/dist/tools.js +2 -0
- package/node_modules/@xrkseek/exec-web/dist/tools.js.map +1 -1
- package/node_modules/@xrkseek/llm/dist/failure.d.ts +45 -0
- package/node_modules/@xrkseek/llm/dist/failure.d.ts.map +1 -0
- package/node_modules/@xrkseek/llm/dist/failure.js +115 -0
- package/node_modules/@xrkseek/llm/dist/failure.js.map +1 -0
- package/node_modules/@xrkseek/llm/dist/index.d.ts +80 -1
- package/node_modules/@xrkseek/llm/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/llm/dist/index.js +167 -2
- package/node_modules/@xrkseek/llm/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/llm/dist/retry-policy.d.ts +23 -0
- package/node_modules/@xrkseek/llm/dist/retry-policy.d.ts.map +1 -0
- package/node_modules/@xrkseek/llm/dist/retry-policy.js +74 -0
- package/node_modules/@xrkseek/llm/dist/retry-policy.js.map +1 -0
- package/node_modules/@xrkseek/llm-anthropic/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/llm-anthropic/dist/index.js +152 -22
- package/node_modules/@xrkseek/llm-anthropic/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/llm-deepseek/README.md +3 -3
- package/node_modules/@xrkseek/llm-deepseek/dist/index.d.ts +32 -2
- package/node_modules/@xrkseek/llm-deepseek/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/llm-deepseek/dist/index.js +59 -5
- package/node_modules/@xrkseek/llm-deepseek/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/llm-gemini/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/llm-gemini/dist/index.js +18 -8
- package/node_modules/@xrkseek/llm-gemini/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/llm-openai-compatible/dist/deepseek-thinking.d.ts +16 -0
- package/node_modules/@xrkseek/llm-openai-compatible/dist/deepseek-thinking.d.ts.map +1 -0
- package/node_modules/@xrkseek/llm-openai-compatible/dist/deepseek-thinking.js +40 -0
- package/node_modules/@xrkseek/llm-openai-compatible/dist/deepseek-thinking.js.map +1 -0
- package/node_modules/@xrkseek/llm-openai-compatible/dist/index.d.ts +9 -1
- package/node_modules/@xrkseek/llm-openai-compatible/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/llm-openai-compatible/dist/index.js +78 -21
- package/node_modules/@xrkseek/llm-openai-compatible/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/llm-openai-responses/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/llm-openai-responses/dist/index.js +18 -8
- package/node_modules/@xrkseek/llm-openai-responses/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/llm-registry/dist/registry.d.ts.map +1 -1
- package/node_modules/@xrkseek/llm-registry/dist/registry.js +6 -4
- package/node_modules/@xrkseek/llm-registry/dist/registry.js.map +1 -1
- package/node_modules/@xrkseek/llm-registry/dist/routing-adapter.d.ts.map +1 -1
- package/node_modules/@xrkseek/llm-registry/dist/routing-adapter.js +15 -3
- package/node_modules/@xrkseek/llm-registry/dist/routing-adapter.js.map +1 -1
- package/node_modules/@xrkseek/llm-replay/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/llm-replay/dist/index.js +4 -1
- package/node_modules/@xrkseek/llm-replay/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/mcp/dist/client.d.ts +3 -1
- package/node_modules/@xrkseek/mcp/dist/client.d.ts.map +1 -1
- package/node_modules/@xrkseek/mcp/dist/client.js +31 -7
- package/node_modules/@xrkseek/mcp/dist/client.js.map +1 -1
- package/node_modules/@xrkseek/mcp/dist/index.d.ts +2 -2
- package/node_modules/@xrkseek/mcp/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/mcp/dist/index.js +1 -1
- package/node_modules/@xrkseek/mcp/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/mcp/dist/register.d.ts.map +1 -1
- package/node_modules/@xrkseek/mcp/dist/register.js +3 -0
- package/node_modules/@xrkseek/mcp/dist/register.js.map +1 -1
- package/node_modules/@xrkseek/mcp/dist/types.d.ts +10 -0
- package/node_modules/@xrkseek/mcp/dist/types.d.ts.map +1 -1
- package/node_modules/@xrkseek/preset-harness/dist/preset.d.ts +18 -1
- package/node_modules/@xrkseek/preset-harness/dist/preset.d.ts.map +1 -1
- package/node_modules/@xrkseek/preset-harness/dist/preset.js +19 -1
- package/node_modules/@xrkseek/preset-harness/dist/preset.js.map +1 -1
- package/node_modules/@xrkseek/preset-harness/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/preset-minimal/dist/preset.d.ts.map +1 -1
- package/node_modules/@xrkseek/preset-minimal/dist/preset.js +1 -0
- package/node_modules/@xrkseek/preset-minimal/dist/preset.js.map +1 -1
- package/node_modules/@xrkseek/preset-minimal/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/preset-server/dist/preset.d.ts.map +1 -1
- package/node_modules/@xrkseek/preset-server/dist/preset.js +5 -1
- package/node_modules/@xrkseek/preset-server/dist/preset.js.map +1 -1
- package/node_modules/@xrkseek/preset-server/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/protocol/dist/index.d.ts +3 -1
- package/node_modules/@xrkseek/protocol/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/protocol/dist/index.js +2 -0
- package/node_modules/@xrkseek/protocol/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/protocol/dist/json-schema.d.ts +72 -0
- package/node_modules/@xrkseek/protocol/dist/json-schema.d.ts.map +1 -1
- package/node_modules/@xrkseek/protocol/dist/json-schema.js +50 -0
- package/node_modules/@xrkseek/protocol/dist/json-schema.js.map +1 -1
- package/node_modules/@xrkseek/protocol/dist/messages.d.ts +7 -0
- package/node_modules/@xrkseek/protocol/dist/messages.d.ts.map +1 -1
- package/node_modules/@xrkseek/protocol/dist/session-events.d.ts +62 -6
- package/node_modules/@xrkseek/protocol/dist/session-events.d.ts.map +1 -1
- package/node_modules/@xrkseek/protocol/dist/session-events.js +19 -0
- package/node_modules/@xrkseek/protocol/dist/session-events.js.map +1 -1
- package/node_modules/@xrkseek/protocol/dist/tools.d.ts +15 -0
- package/node_modules/@xrkseek/protocol/dist/tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/protocol/dist/tools.js +6 -1
- package/node_modules/@xrkseek/protocol/dist/tools.js.map +1 -1
- package/node_modules/@xrkseek/protocol/dist/validate.d.ts.map +1 -1
- package/node_modules/@xrkseek/protocol/dist/validate.js +107 -1
- package/node_modules/@xrkseek/protocol/dist/validate.js.map +1 -1
- package/node_modules/@xrkseek/server-config/dist/home.d.ts +5 -0
- package/node_modules/@xrkseek/server-config/dist/home.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-config/dist/home.js +7 -0
- package/node_modules/@xrkseek/server-config/dist/home.js.map +1 -1
- package/node_modules/@xrkseek/server-config/dist/index.d.ts +4 -2
- package/node_modules/@xrkseek/server-config/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-config/dist/index.js +10 -1
- package/node_modules/@xrkseek/server-config/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/adapt/wire-event.d.ts +2 -0
- package/node_modules/@xrkseek/server-face/dist/adapt/wire-event.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/adapt/wire-event.js +25 -7
- package/node_modules/@xrkseek/server-face/dist/adapt/wire-event.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/goal-store.d.ts +1 -1
- package/node_modules/@xrkseek/server-face/dist/goal-store.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/goal-store.js +1 -1
- package/node_modules/@xrkseek/server-face/dist/goal-store.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/handlers/session.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/handlers/session.js +2 -2
- package/node_modules/@xrkseek/server-face/dist/handlers/session.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/index.d.ts +1 -1
- package/node_modules/@xrkseek/server-face/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/llm-resolve.js +1 -1
- package/node_modules/@xrkseek/server-face/dist/llm-resolve.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/index.d.ts +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/index.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/registry.d.ts +12 -50
- package/node_modules/@xrkseek/server-face/dist/projections/registry.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/registry.js +4 -146
- package/node_modules/@xrkseek/server-face/dist/projections/registry.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/context-breakdown.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/context-breakdown.js +13 -11
- package/node_modules/@xrkseek/server-face/dist/projections/units/context-breakdown.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/context-pressure.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/context-pressure.js +27 -25
- package/node_modules/@xrkseek/server-face/dist/projections/units/context-pressure.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/image-limits.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/image-limits.js +31 -29
- package/node_modules/@xrkseek/server-face/dist/projections/units/image-limits.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/permissions.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/permissions.js +27 -25
- package/node_modules/@xrkseek/server-face/dist/projections/units/permissions.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/plan.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/plan.js +12 -10
- package/node_modules/@xrkseek/server-face/dist/projections/units/plan.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/session-list-metadata.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/session-list-metadata.js +15 -13
- package/node_modules/@xrkseek/server-face/dist/projections/units/session-list-metadata.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/session-stats.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/session-stats.js +27 -25
- package/node_modules/@xrkseek/server-face/dist/projections/units/session-stats.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/title.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/title.js +9 -7
- package/node_modules/@xrkseek/server-face/dist/projections/units/title.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/todos.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/todos.js +25 -23
- package/node_modules/@xrkseek/server-face/dist/projections/units/todos.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/token-usage.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/token-usage.js +14 -12
- package/node_modules/@xrkseek/server-face/dist/projections/units/token-usage.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.d.ts +8 -13
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.js +29 -1
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.js.map +1 -1
- package/node_modules/@xrkseek/server-face/package.json +1 -0
- package/node_modules/@xrkseek/server-host/dist/agent-cache.js +1 -1
- package/node_modules/@xrkseek/server-host/dist/agent-cache.js.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/index.d.ts +8 -0
- package/node_modules/@xrkseek/server-host/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/index.js +39 -1
- package/node_modules/@xrkseek/server-host/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/session-projection/README.md +22 -0
- package/node_modules/@xrkseek/session-projection/dist/index.d.ts +100 -0
- package/node_modules/@xrkseek/session-projection/dist/index.d.ts.map +1 -0
- package/node_modules/@xrkseek/session-projection/dist/index.js +241 -0
- package/node_modules/@xrkseek/session-projection/dist/index.js.map +1 -0
- package/node_modules/@xrkseek/session-projection/dist/types.d.ts +20 -0
- package/node_modules/@xrkseek/session-projection/dist/types.d.ts.map +1 -0
- package/node_modules/@xrkseek/session-projection/dist/types.js +9 -0
- package/node_modules/@xrkseek/session-projection/dist/types.js.map +1 -0
- package/node_modules/@xrkseek/session-projection/package.json +31 -0
- package/node_modules/@xrkseek/workspace/dist/skill-tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/workspace/dist/skill-tools.js +1 -0
- package/node_modules/@xrkseek/workspace/dist/skill-tools.js.map +1 -1
- package/package.json +4 -2
- package/product-web/boot.json +1 -1
- package/product-web/plugins/@xrkseek/client-locale/client.js +3 -3
- package/product-web/plugins/@xrkseek/client-ui-agent-preset/client.js +36 -36
- package/product-web/plugins/@xrkseek/client-ui-commands/client.js +7 -7
- package/product-web/plugins/@xrkseek/client-ui-conversation/client.js +160 -174
- package/product-web/plugins/@xrkseek/client-ui-deliverables/client.js +4 -4
- package/product-web/plugins/@xrkseek/client-ui-directory-picker-browse/client.js +29 -29
- package/product-web/plugins/@xrkseek/client-ui-goal/client.js +8 -8
- package/product-web/plugins/@xrkseek/client-ui-input-trigger/client.js +5 -5
- package/product-web/plugins/@xrkseek/client-ui-jobs/client.js +8 -8
- package/product-web/plugins/@xrkseek/client-ui-layout/client.js +2 -2
- package/product-web/plugins/@xrkseek/client-ui-message-feedback/client.js +3 -3
- package/product-web/plugins/@xrkseek/client-ui-model-selection/client.js +17 -17
- package/product-web/plugins/@xrkseek/client-ui-permission-presets/client.js +4 -4
- package/product-web/plugins/@xrkseek/client-ui-settings-general/client.js +12 -12
- package/product-web/plugins/@xrkseek/client-ui-settings-models/client.js +54 -54
- package/product-web/plugins/@xrkseek/client-ui-settings-plugin-inventory/client.js +9 -9
- package/product-web/plugins/@xrkseek/client-ui-settings-plugins/client.js +133 -62
- package/product-web/plugins/@xrkseek/client-ui-sidebar/client.js +16 -16
- package/product-web/plugins/@xrkseek/client-ui-skill/client.js +12 -12
- package/product-web/plugins/@xrkseek/client-ui-subagent/client.js +17 -17
- package/product-web/plugins/@xrkseek/client-ui-theme/client.js +2 -2
- package/product-web/plugins/@xrkseek/client-ui-tool/client.js +38 -38
- package/product-web/plugins/@xrkseek/client-ui-trajectory/client.js +140 -140
- package/product-web/plugins/@xrkseek/client-ui-user-questions/client.js +27 -27
- package/product-web/plugins/@xrkseek/client-ui-workflow-run/client.js +16 -16
- package/product-web/plugins/@xrkseek/client-ui-workspace/client.js +52 -52
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latch.js","sourceRoot":"","sources":["../src/latch.ts"],"names":[],"mappings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uDAAuD;YACzD,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repair-open-turn.d.ts","sourceRoot":"","sources":["../src/repair-open-turn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"repair-open-turn.d.ts","sourceRoot":"","sources":["../src/repair-open-turn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAuGtD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,GAAG,GAAE,MAAM,MAAiB,GAC3B,YAAY,EAAE,CAiEhB"}
|
|
@@ -1,18 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { danglingSettlement, listDanglingToolCalls, } from "./dangling.js";
|
|
2
2
|
function foldStepStreamChunks(events, turnId, stepId) {
|
|
3
3
|
let content = "";
|
|
4
4
|
let reasoning = "";
|
|
5
|
+
const byIndex = new Map();
|
|
5
6
|
for (const ev of events) {
|
|
6
7
|
if (ev.type !== "assistant/chunk")
|
|
7
8
|
continue;
|
|
8
9
|
if (ev.turnId !== turnId || ev.stepId !== stepId)
|
|
9
10
|
continue;
|
|
11
|
+
if (ev.kind === "usage")
|
|
12
|
+
continue;
|
|
13
|
+
if (ev.kind === "tool-call") {
|
|
14
|
+
const idx = ev.index ?? 0;
|
|
15
|
+
const cur = byIndex.get(idx) ?? {
|
|
16
|
+
id: ev.toolCallId ?? `call_${idx}`,
|
|
17
|
+
arguments: "",
|
|
18
|
+
};
|
|
19
|
+
if (ev.toolCallId)
|
|
20
|
+
cur.id = ev.toolCallId;
|
|
21
|
+
if (ev.toolName)
|
|
22
|
+
cur.name = ev.toolName;
|
|
23
|
+
cur.arguments += ev.argumentsDelta ?? ev.text;
|
|
24
|
+
byIndex.set(idx, cur);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
10
27
|
if (ev.kind === "reasoning")
|
|
11
28
|
reasoning += ev.text;
|
|
12
29
|
else
|
|
13
30
|
content += ev.text;
|
|
14
31
|
}
|
|
15
|
-
|
|
32
|
+
const toolCalls = [...byIndex.entries()]
|
|
33
|
+
.sort((a, b) => a[0] - b[0])
|
|
34
|
+
.map(([, acc]) => {
|
|
35
|
+
let argumentsValue;
|
|
36
|
+
try {
|
|
37
|
+
argumentsValue = acc.arguments ? JSON.parse(acc.arguments) : {};
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
argumentsValue = acc.arguments;
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
id: acc.id,
|
|
44
|
+
name: acc.name ?? "unknown",
|
|
45
|
+
arguments: argumentsValue,
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
return { content, reasoning, toolCalls };
|
|
16
49
|
}
|
|
17
50
|
function findOpenTurnId(events) {
|
|
18
51
|
const ended = new Set();
|
|
@@ -65,6 +98,7 @@ export function repairOpenTurnEvents(events, now = Date.now) {
|
|
|
65
98
|
const out = [];
|
|
66
99
|
const ts = () => now();
|
|
67
100
|
for (const d of listDanglingToolCalls(events)) {
|
|
101
|
+
const settled = danglingSettlement(d);
|
|
68
102
|
out.push({
|
|
69
103
|
type: "tool/result",
|
|
70
104
|
ts: ts(),
|
|
@@ -73,8 +107,9 @@ export function repairOpenTurnEvents(events, now = Date.now) {
|
|
|
73
107
|
result: {
|
|
74
108
|
toolCallId: d.call.id,
|
|
75
109
|
name: d.call.name,
|
|
76
|
-
content:
|
|
110
|
+
content: settled.content,
|
|
77
111
|
isError: true,
|
|
112
|
+
error: settled.error,
|
|
78
113
|
},
|
|
79
114
|
});
|
|
80
115
|
}
|
|
@@ -82,7 +117,9 @@ export function repairOpenTurnEvents(events, now = Date.now) {
|
|
|
82
117
|
if (stepId !== undefined) {
|
|
83
118
|
if (!stepHasAssistantMessage(events, turnId, stepId)) {
|
|
84
119
|
const folded = foldStepStreamChunks(events, turnId, stepId);
|
|
85
|
-
if (folded.content.trim() ||
|
|
120
|
+
if (folded.content.trim() ||
|
|
121
|
+
folded.reasoning.trim() ||
|
|
122
|
+
folded.toolCalls.length > 0) {
|
|
86
123
|
out.push({
|
|
87
124
|
type: "assistant/message",
|
|
88
125
|
ts: ts(),
|
|
@@ -92,6 +129,9 @@ export function repairOpenTurnEvents(events, now = Date.now) {
|
|
|
92
129
|
...(folded.reasoning.trim()
|
|
93
130
|
? { reasoning: folded.reasoning }
|
|
94
131
|
: {}),
|
|
132
|
+
...(folded.toolCalls.length
|
|
133
|
+
? { toolCalls: folded.toolCalls }
|
|
134
|
+
: {}),
|
|
95
135
|
interrupted: true,
|
|
96
136
|
});
|
|
97
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repair-open-turn.js","sourceRoot":"","sources":["../src/repair-open-turn.ts"],"names":[],"mappings":"AACA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"repair-open-turn.js","sourceRoot":"","sources":["../src/repair-open-turn.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,SAAS,oBAAoB,CAC3B,MAA+B,EAC/B,MAAc,EACd,MAAc;IAMd,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,MAAM,OAAO,GAAG,IAAI,GAAG,EAGpB,CAAC;IACJ,KAAK,MAAM,EAAE,IAAI,MAAM,EAAE,CAAC;QACxB,IAAI,EAAE,CAAC,IAAI,KAAK,iBAAiB;YAAE,SAAS;QAC5C,IAAI,EAAE,CAAC,MAAM,KAAK,MAAM,IAAI,EAAE,CAAC,MAAM,KAAK,MAAM;YAAE,SAAS;QAC3D,IAAI,EAAE,CAAC,IAAI,KAAK,OAAO;YAAE,SAAS;QAClC,IAAI,EAAE,CAAC,IAAI,KAAK,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,EAAE,EAAE,EAAE,EAAE;QACR,MAAM;QACN,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;KAChC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -15,6 +15,7 @@ export declare function ftsMatchQuery(query: string): string;
|
|
|
15
15
|
/**
|
|
16
16
|
* Durable SessionStore: one workspace SQLite file (`sessions.db`) with WAL.
|
|
17
17
|
* Lazy session load; batched chunk writes packed as `text-chunks` (≥3);
|
|
18
|
+
* tool-call argument deltas pack as `tool-call-chunks` (≥3);
|
|
18
19
|
* FTS5 trigram search. In-memory API stays flat SessionEvent[].
|
|
19
20
|
*/
|
|
20
21
|
export declare function createPersistentSessionStore(dir: string): PersistentSessionStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-store.d.ts","sourceRoot":"","sources":["../src/sqlite-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sqlite-store.d.ts","sourceRoot":"","sources":["../src/sqlite-store.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,YAAY,CAAC;AAS9D,MAAM,WAAW,sBAAuB,SAAQ,YAAY;IAC1D,mEAAmE;IACnE,KAAK,IAAI,IAAI,CAAC;IACd,kFAAkF;IAClF,KAAK,IAAI,IAAI,CAAC;IACd;;;OAGG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;CACpD;AAmBD,8DAA8D;AAC9D,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAInD;AA2ID;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,GAAG,sBAAsB,CAmKhF;AAED,2DAA2D;AAC3D,eAAO,MAAM,mBAAmB,gBAAU,CAAC;AAE3C,qEAAqE;AACrE,eAAO,MAAM,sBAAsB,IAAiB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdirSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { assertSessionEvent } from "@xrkseek/protocol";
|
|
4
|
-
import { expandPackedStorageRecords, isTextChunkRow, packChunkRunsForExport, } from "./chunk-pack.js";
|
|
4
|
+
import { expandPackedStorageRecords, isPackedChunkRow, isTextChunkRow, isToolCallChunkRow, packChunkRunsForExport, } from "./chunk-pack.js";
|
|
5
5
|
import { deepFreeze, newSessionId } from "./freeze.js";
|
|
6
6
|
import { repairOpenTurnEvents } from "./repair-open-turn.js";
|
|
7
7
|
import { extractEventSearchText } from "./search-text.js";
|
|
@@ -10,7 +10,7 @@ function openDatabase(dbPath) {
|
|
|
10
10
|
return new Db(dbPath);
|
|
11
11
|
}
|
|
12
12
|
const ID_RE = /^[A-Za-z0-9._-]+$/;
|
|
13
|
-
/** v3: durable rows may be `text-chunks`
|
|
13
|
+
/** v3: durable rows may be packed `text-chunks` / `tool-call-chunks` (expanded on load). */
|
|
14
14
|
const SCHEMA_VERSION = 3;
|
|
15
15
|
const DB_NAME = "sessions.db";
|
|
16
16
|
function assertSafeId(id) {
|
|
@@ -31,10 +31,14 @@ function extractStorageSearchText(record) {
|
|
|
31
31
|
const text = record.texts.join("");
|
|
32
32
|
return text || null;
|
|
33
33
|
}
|
|
34
|
+
if (isToolCallChunkRow(record)) {
|
|
35
|
+
// Argument fragments are not model-visible search text.
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
34
38
|
return extractEventSearchText(record) || null;
|
|
35
39
|
}
|
|
36
40
|
function storageTs(record) {
|
|
37
|
-
return
|
|
41
|
+
return isPackedChunkRow(record) ? record.ts0 : record.ts;
|
|
38
42
|
}
|
|
39
43
|
function ensureFts(db) {
|
|
40
44
|
db.exec(`
|
|
@@ -64,7 +68,7 @@ function rebuildFts(db) {
|
|
|
64
68
|
for (const row of rows) {
|
|
65
69
|
try {
|
|
66
70
|
const raw = JSON.parse(row.payload);
|
|
67
|
-
if (
|
|
71
|
+
if (isPackedChunkRow(raw)) {
|
|
68
72
|
const text = extractStorageSearchText(raw);
|
|
69
73
|
if (text)
|
|
70
74
|
insert.run(row.session_id, row.seq, text);
|
|
@@ -114,7 +118,7 @@ function initSchema(db) {
|
|
|
114
118
|
}
|
|
115
119
|
function parseStoragePayload(payload) {
|
|
116
120
|
const raw = JSON.parse(payload);
|
|
117
|
-
if (
|
|
121
|
+
if (isPackedChunkRow(raw)) {
|
|
118
122
|
return expandPackedStorageRecords([raw]);
|
|
119
123
|
}
|
|
120
124
|
return [assertSessionEvent(raw)];
|
|
@@ -150,6 +154,7 @@ function loadSessionIds(db) {
|
|
|
150
154
|
/**
|
|
151
155
|
* Durable SessionStore: one workspace SQLite file (`sessions.db`) with WAL.
|
|
152
156
|
* Lazy session load; batched chunk writes packed as `text-chunks` (≥3);
|
|
157
|
+
* tool-call argument deltas pack as `tool-call-chunks` (≥3);
|
|
153
158
|
* FTS5 trigram search. In-memory API stays flat SessionEvent[].
|
|
154
159
|
*/
|
|
155
160
|
export function createPersistentSessionStore(dir) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-store.js","sourceRoot":"","sources":["../src/sqlite-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,sBAAsB,GAEvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,SAAS,YAAY,CAAC,MAAc;IAClC,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,GAAG,OAAO,CA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,CAAC;AACJ,CAAC;AAED,2DAA2D;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAE3C,qEAAqE;AACrE,MAAM,CAAC,MAAM,sBAAsB,GAAG,cAAc,CAAC"}
|
|
@@ -5,12 +5,17 @@
|
|
|
5
5
|
* `shadowedTokenCount` applies signed delta:
|
|
6
6
|
* estimate(formatCompactionForModel) − shadowedTokenCount
|
|
7
7
|
* Legacy compaction without the field folds at 0 (DSH replace-without-claim).
|
|
8
|
+
*
|
|
9
|
+
* Pruned `tool/result` replacements carry
|
|
10
|
+
* `meta.xrkPrunePreviousSurfaceTokens` so the fold can apply a net delta
|
|
11
|
+
* without re-scanning the log.
|
|
8
12
|
*/
|
|
9
13
|
import type { SessionEvent } from "@xrkseek/protocol";
|
|
10
14
|
export declare function foldSurfaceTokens(surfaceTokens: number, event: SessionEvent): number;
|
|
11
15
|
/**
|
|
12
16
|
* Heuristic price of the current model window's append surface
|
|
13
17
|
* (events after the latest compaction, or from 0).
|
|
18
|
+
* Uses the latest `tool/result` per callId (prune replacements).
|
|
14
19
|
* Used by compaction producers as `shadowedTokenCount`.
|
|
15
20
|
*/
|
|
16
21
|
export declare function priceCurrentSurfaceWindow(events: readonly SessionEvent[]): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface-fold.d.ts","sourceRoot":"","sources":["../src/surface-fold.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"surface-fold.d.ts","sourceRoot":"","sources":["../src/surface-fold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAA0B,YAAY,EAAmB,MAAM,mBAAmB,CAAC;AAuD/F,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,YAAY,GAClB,MAAM,CAIR;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,SAAS,YAAY,EAAE,GAC9B,MAAM,CAkBR"}
|
|
@@ -5,9 +5,14 @@
|
|
|
5
5
|
* `shadowedTokenCount` applies signed delta:
|
|
6
6
|
* estimate(formatCompactionForModel) − shadowedTokenCount
|
|
7
7
|
* Legacy compaction without the field folds at 0 (DSH replace-without-claim).
|
|
8
|
+
*
|
|
9
|
+
* Pruned `tool/result` replacements carry
|
|
10
|
+
* `meta.xrkPrunePreviousSurfaceTokens` so the fold can apply a net delta
|
|
11
|
+
* without re-scanning the log.
|
|
8
12
|
*/
|
|
9
13
|
import { formatCompactionForModel, findLatestCompaction } from "./compaction.js";
|
|
10
14
|
import { estimateAssistantSurface, estimateMessageContent, } from "./surface-estimate.js";
|
|
15
|
+
import { TOOL_RESULT_PRUNE_META_PREV_TOKENS } from "./tool-result-prune.js";
|
|
11
16
|
/** Append-only surface price (excludes compaction). */
|
|
12
17
|
function appendSurfaceDelta(event) {
|
|
13
18
|
switch (event.type) {
|
|
@@ -17,11 +22,19 @@ function appendSurfaceDelta(event) {
|
|
|
17
22
|
case "assistant/message":
|
|
18
23
|
return estimateAssistantSurface(event.content, event.toolCalls);
|
|
19
24
|
case "tool/result":
|
|
20
|
-
return
|
|
25
|
+
return toolResultSurfaceDelta(event);
|
|
21
26
|
default:
|
|
22
27
|
return 0;
|
|
23
28
|
}
|
|
24
29
|
}
|
|
30
|
+
function toolResultSurfaceDelta(event) {
|
|
31
|
+
const next = estimateMessageContent(event.result.content);
|
|
32
|
+
const prevRaw = event.result.meta?.[TOOL_RESULT_PRUNE_META_PREV_TOKENS];
|
|
33
|
+
if (typeof prevRaw === "number" && Number.isFinite(prevRaw)) {
|
|
34
|
+
return next - prevRaw;
|
|
35
|
+
}
|
|
36
|
+
return next;
|
|
37
|
+
}
|
|
25
38
|
/** Checkpoint price after a compaction window swap (one synthetic user message). */
|
|
26
39
|
function estimateCompactionCheckpoint(event) {
|
|
27
40
|
return estimateMessageContent(formatCompactionForModel(event));
|
|
@@ -50,14 +63,27 @@ export function foldSurfaceTokens(surfaceTokens, event) {
|
|
|
50
63
|
/**
|
|
51
64
|
* Heuristic price of the current model window's append surface
|
|
52
65
|
* (events after the latest compaction, or from 0).
|
|
66
|
+
* Uses the latest `tool/result` per callId (prune replacements).
|
|
53
67
|
* Used by compaction producers as `shadowedTokenCount`.
|
|
54
68
|
*/
|
|
55
69
|
export function priceCurrentSurfaceWindow(events) {
|
|
56
70
|
const latest = findLatestCompaction(events);
|
|
57
71
|
const start = latest ? latest.index + 1 : 0;
|
|
58
72
|
let tokens = 0;
|
|
59
|
-
|
|
60
|
-
|
|
73
|
+
const seenToolResults = new Set();
|
|
74
|
+
// Walk newest-first so the first tool/result per callId is the surface.
|
|
75
|
+
for (let i = events.length - 1; i >= start; i--) {
|
|
76
|
+
const ev = events[i];
|
|
77
|
+
if (ev.type === "tool/result") {
|
|
78
|
+
if (seenToolResults.has(ev.result.toolCallId))
|
|
79
|
+
continue;
|
|
80
|
+
seenToolResults.add(ev.result.toolCallId);
|
|
81
|
+
tokens += estimateMessageContent(ev.result.content);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (ev.type === "context/compaction")
|
|
85
|
+
continue;
|
|
86
|
+
tokens += appendSurfaceDelta(ev);
|
|
61
87
|
}
|
|
62
88
|
return tokens;
|
|
63
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface-fold.js","sourceRoot":"","sources":["../src/surface-fold.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"surface-fold.js","sourceRoot":"","sources":["../src/surface-fold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EACL,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kCAAkC,EAAE,MAAM,wBAAwB,CAAC;AAE5E,uDAAuD;AACvD,SAAS,kBAAkB,CAAC,KAAm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CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Truncate oversized model-visible `tool/result` surfaces (DSH-aligned).
|
|
3
|
+
* Appends a replacement `tool/result` for the same callId; log keeps the
|
|
4
|
+
* original. `deriveMessages` / surface pricing fold to the latest per callId.
|
|
5
|
+
*/
|
|
6
|
+
import type { SessionStore } from "./store.js";
|
|
7
|
+
/** DSH-aligned: prune when result text exceeds this many characters. */
|
|
8
|
+
export declare const TOOL_RESULT_PRUNE_THRESHOLD_CHARS = 8192;
|
|
9
|
+
export declare const TOOL_RESULT_PRUNE_HEAD_CHARS = 4096;
|
|
10
|
+
export declare const TOOL_RESULT_PRUNE_TAIL_CHARS = 1024;
|
|
11
|
+
/** `tool/result.meta` key: previous surface token price (for O(1) fold delta). */
|
|
12
|
+
export declare const TOOL_RESULT_PRUNE_META_PREV_TOKENS: "xrkPrunePreviousSurfaceTokens";
|
|
13
|
+
export interface ToolResultPruneOptions {
|
|
14
|
+
readonly thresholdChars?: number;
|
|
15
|
+
readonly headChars?: number;
|
|
16
|
+
readonly tailChars?: number;
|
|
17
|
+
readonly now?: () => number;
|
|
18
|
+
readonly turnId?: string;
|
|
19
|
+
readonly stepId?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ToolResultPruneResult {
|
|
22
|
+
readonly pruned: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function pruneToolResultText(text: string, options?: {
|
|
25
|
+
readonly thresholdChars?: number;
|
|
26
|
+
readonly headChars?: number;
|
|
27
|
+
readonly tailChars?: number;
|
|
28
|
+
}): string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Append pruned replacement `tool/result` events for oversized results in the
|
|
31
|
+
* current model window (after latest compaction). Idempotent when the latest
|
|
32
|
+
* surface is already under threshold.
|
|
33
|
+
*/
|
|
34
|
+
export declare function pruneOversizedToolResults(store: SessionStore, sessionId: string, options?: ToolResultPruneOptions): ToolResultPruneResult;
|
|
35
|
+
//# sourceMappingURL=tool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/**
|
|
2
|
+
* Truncate oversized model-visible `tool/result` surfaces (DSH-aligned).
|
|
3
|
+
* Appends a replacement `tool/result` for the same callId; log keeps the
|
|
4
|
+
* original. `deriveMessages` / surface pricing fold to the latest per callId.
|
|
5
|
+
*/
|
|
6
|
+
import { estimateMessageContent } from "./surface-estimate.js";
|
|
7
|
+
import { findLatestCompaction } from "./compaction.js";
|
|
8
|
+
/** DSH-aligned: prune when result text exceeds this many characters. */
|
|
9
|
+
export const TOOL_RESULT_PRUNE_THRESHOLD_CHARS = 8192;
|
|
10
|
+
export const TOOL_RESULT_PRUNE_HEAD_CHARS = 4096;
|
|
11
|
+
export const TOOL_RESULT_PRUNE_TAIL_CHARS = 1024;
|
|
12
|
+
/** `tool/result.meta` key: previous surface token price (for O(1) fold delta). */
|
|
13
|
+
export const TOOL_RESULT_PRUNE_META_PREV_TOKENS = "xrkPrunePreviousSurfaceTokens";
|
|
14
|
+
function contentPlainText(content) {
|
|
15
|
+
if (typeof content === "string")
|
|
16
|
+
return content;
|
|
17
|
+
if (!Array.isArray(content) || content.length === 0)
|
|
18
|
+
return undefined;
|
|
19
|
+
const parts = [];
|
|
20
|
+
for (const block of content) {
|
|
21
|
+
if (block.type !== "text")
|
|
22
|
+
return undefined;
|
|
23
|
+
parts.push(block.text);
|
|
24
|
+
}
|
|
25
|
+
return parts.join("\n");
|
|
26
|
+
}
|
|
27
|
+
export function pruneToolResultText(text, options = {}) {
|
|
28
|
+
const threshold = options.thresholdChars ?? TOOL_RESULT_PRUNE_THRESHOLD_CHARS;
|
|
29
|
+
const headChars = options.headChars ?? TOOL_RESULT_PRUNE_HEAD_CHARS;
|
|
30
|
+
const tailChars = options.tailChars ?? TOOL_RESULT_PRUNE_TAIL_CHARS;
|
|
31
|
+
// DSH budgets are Unicode code points, not UTF-16 code units.
|
|
32
|
+
const units = Array.from(text);
|
|
33
|
+
if (units.length <= threshold)
|
|
34
|
+
return undefined;
|
|
35
|
+
if (headChars + tailChars >= units.length)
|
|
36
|
+
return undefined;
|
|
37
|
+
const omitted = units.length - headChars - tailChars;
|
|
38
|
+
const head = units.slice(0, headChars).join("");
|
|
39
|
+
const tail = units.slice(-tailChars).join("");
|
|
40
|
+
return `${head}\n\n…[${omitted} chars omitted]…\n\n${tail}`;
|
|
41
|
+
}
|
|
42
|
+
function latestToolResultByCallId(events, start) {
|
|
43
|
+
const latest = new Map();
|
|
44
|
+
for (let i = start; i < events.length; i++) {
|
|
45
|
+
const ev = events[i];
|
|
46
|
+
if (ev.type === "tool/result") {
|
|
47
|
+
latest.set(ev.result.toolCallId, ev);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return latest;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Append pruned replacement `tool/result` events for oversized results in the
|
|
54
|
+
* current model window (after latest compaction). Idempotent when the latest
|
|
55
|
+
* surface is already under threshold.
|
|
56
|
+
*/
|
|
57
|
+
export function pruneOversizedToolResults(store, sessionId, options = {}) {
|
|
58
|
+
const threshold = options.thresholdChars ?? TOOL_RESULT_PRUNE_THRESHOLD_CHARS;
|
|
59
|
+
const headChars = options.headChars ?? TOOL_RESULT_PRUNE_HEAD_CHARS;
|
|
60
|
+
const tailChars = options.tailChars ?? TOOL_RESULT_PRUNE_TAIL_CHARS;
|
|
61
|
+
const now = options.now ?? Date.now;
|
|
62
|
+
const events = store.get(sessionId).events;
|
|
63
|
+
const latestCompaction = findLatestCompaction(events);
|
|
64
|
+
const start = latestCompaction ? latestCompaction.index + 1 : 0;
|
|
65
|
+
const latest = latestToolResultByCallId(events, start);
|
|
66
|
+
let pruned = 0;
|
|
67
|
+
for (const ev of latest.values()) {
|
|
68
|
+
const plain = contentPlainText(ev.result.content);
|
|
69
|
+
if (plain === undefined)
|
|
70
|
+
continue;
|
|
71
|
+
const next = pruneToolResultText(plain, {
|
|
72
|
+
thresholdChars: threshold,
|
|
73
|
+
headChars,
|
|
74
|
+
tailChars,
|
|
75
|
+
});
|
|
76
|
+
if (next === undefined)
|
|
77
|
+
continue;
|
|
78
|
+
const previousSurfaceTokens = estimateMessageContent(ev.result.content);
|
|
79
|
+
store.append(sessionId, {
|
|
80
|
+
type: "tool/result",
|
|
81
|
+
ts: now(),
|
|
82
|
+
turnId: options.turnId ?? ev.turnId,
|
|
83
|
+
stepId: options.stepId ?? ev.stepId,
|
|
84
|
+
result: {
|
|
85
|
+
toolCallId: ev.result.toolCallId,
|
|
86
|
+
name: ev.result.name,
|
|
87
|
+
content: next,
|
|
88
|
+
...(ev.result.isError ? { isError: true } : {}),
|
|
89
|
+
meta: {
|
|
90
|
+
...(ev.result.meta ?? {}),
|
|
91
|
+
[TOOL_RESULT_PRUNE_META_PREV_TOKENS]: previousSurfaceTokens,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
pruned += 1;
|
|
96
|
+
}
|
|
97
|
+
return { pruned };
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=tool-result-prune.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-result-prune.js","sourceRoot":"","sources":["../src/tool-result-prune.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAGvD,wEAAwE;AACxE,MAAM,CAAC,MAAM,iCAAiC,GAAG,IAAI,CAAC;AACtD,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC;AACjD,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAEjD,kFAAkF;AAClF,MAAM,CAAC,MAAM,kCAAkC,GAC7C,+BAAwC,CAAC;AAe3C,SAAS,gBAAgB,CAAC,OAAuB;IAC/C,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC;IAChD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OA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,CAAC,CAAC;QAClD,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,MAAM,IAAI,GAAG,mBAAmB,CAAC,KAAK,EAAE;YACtC,cAAc,EAAE,SAAS;YACzB,SAAS;YACT,SAAS;SACV,CAAC,CAAC;QACH,IAAI,IAAI,KAAK,SAAS;YAAE,SAAS;QAEjC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACxE,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE;YACtB,IAAI,EAAE,aAAa;YACnB,EAAE,EAAE,GAAG,EAAE;YACT,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,MAAM;YACnC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,MAAM;YACnC,MAAM,EAAE;gBACN,UAAU,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU;gBAChC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI;gBACpB,OAAO,EAAE,IAAI;gBACb,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC/C,IAAI,EAAE;oBACJ,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;oBACzB,CAAC,kCAAkC,CAAC,EAAE,qBAAqB;iBAC5D;aACF;SACF,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,CAAC;IACd,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SessionEvent } from "@xrkseek/protocol";
|
|
2
2
|
import { type ThreeLayerInput } from "./three-layer.js";
|
|
3
3
|
import { type PipelineStep, type SlashResolveFn } from "./outbound.js";
|
|
4
|
-
export { assembleThreeLayers, buildSkeletonSystem, buildSkeletonUser, buildVolatileUser, mergeHistory, orderToolsForWire, type AssembledRequest, type SkeletonSystemInput, type SkeletonUserInput, type ThreeLayerInput, type VolatileUserInput, } from "./three-layer.js";
|
|
4
|
+
export { assembleThreeLayers, buildSkeletonSystem, buildSkeletonUser, buildVolatileUser, mergeHistory, orderToolsForWire, TOOL_ORDER_REST, type AssembledRequest, type SkeletonSystemInput, type SkeletonUserInput, type ThreeLayerInput, type VolatileUserInput, } from "./three-layer.js";
|
|
5
5
|
export { compactionStep, createAssembleStep, createContextWindowStep, createOutboundPipeline, createSlashRecipeStep, createToolPairStep, slashRecipeStep, type OutboundPipeline, type PipelineStep, type PipelineStepContext, type SlashExpandResult, type SlashResolveFn, } from "./outbound.js";
|
|
6
6
|
export interface PromptSection {
|
|
7
7
|
readonly id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKnE,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,cAAc,EACpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AAEvB,MA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AqB,EACrB,kBAAkB,EAClB,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IACvC,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,wBAAgB,2BAA2B,IAAI,qBAAqB,CAqBnE;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,UAAU,EAAE,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7D,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,cAAc,CAAC;CAC/B,4CA2BA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assertModelVisible, deriveMessages, } from "@xrkseek/core-session";
|
|
2
2
|
import { assembleThreeLayers, } from "./three-layer.js";
|
|
3
3
|
import { compactionStep, createAssembleStep, createContextWindowStep, createOutboundPipeline, createSlashRecipeStep, createToolPairStep, slashRecipeStep, } from "./outbound.js";
|
|
4
|
-
export { assembleThreeLayers, buildSkeletonSystem, buildSkeletonUser, buildVolatileUser, mergeHistory, orderToolsForWire, } from "./three-layer.js";
|
|
4
|
+
export { assembleThreeLayers, buildSkeletonSystem, buildSkeletonUser, buildVolatileUser, mergeHistory, orderToolsForWire, TOOL_ORDER_REST, } from "./three-layer.js";
|
|
5
5
|
export { compactionStep, createAssembleStep, createContextWindowStep, createOutboundPipeline, createSlashRecipeStep, createToolPairStep, slashRecipeStep, } from "./outbound.js";
|
|
6
6
|
export function createSystemPromptAssembler() {
|
|
7
7
|
const sections = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,GAEpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAGhB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,GAEpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAGhB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,eAAe,GAMhB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAMhB,MAAM,eAAe,CAAC;AAavB,MAAM,UAAU,2BAA2B;IACzC,MAAM,Q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C,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAChF,CAAC;IACF,QAAQ,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACnC,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC7B,QAAQ,CAAC,GAAG,CAAC,uBAAuB,CAAC,OAAO,CAAC,WAAW,IAAI,GAAG,CAAC,CAAC,CAAC;IAClE,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,CAAC;QAC5C,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;IACD,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC/B,qEAAqE;QACrE,8EAA8E;QAC9E,2EAA2E;QAC3E,iEAAiE;QACjE,MAAM,OAAO,GAAI,GAAG,CAAC,IAAI,CAAC,mBAAiD;YACzE,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACjC,kBAAkB,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC5C,MAAM,IAAI,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -40,6 +40,13 @@ export interface ThreeLayerInput {
|
|
|
40
40
|
* so the volatile suffix can stay byte-stable across a turn's tool loop.
|
|
41
41
|
*/
|
|
42
42
|
readonly includeVolatileTime?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Optional tool wire order (DSH `toolOrder`). Exactly one `' '` rest marker;
|
|
45
|
+
* named tools before/after the rest appear in that order, remaining tools
|
|
46
|
+
* fill the rest slot in lexicographic order. Omit / empty → pure lex sort.
|
|
47
|
+
* Unknown names, duplicates, or wrong rest count throw.
|
|
48
|
+
*/
|
|
49
|
+
readonly toolOrder?: readonly string[];
|
|
43
50
|
}
|
|
44
51
|
export declare function buildSkeletonSystem(input: SkeletonSystemInput): string;
|
|
45
52
|
export declare function buildSkeletonUser(input: SkeletonUserInput): ChatMessage;
|
|
@@ -51,13 +58,19 @@ export declare function mergeHistory(history: readonly ChatMessage[], options?:
|
|
|
51
58
|
readonly includeCurrentMarker?: boolean;
|
|
52
59
|
}): ChatMessage[];
|
|
53
60
|
/** Lexicographic tool order — registration order must not leak to the wire. */
|
|
54
|
-
export declare
|
|
61
|
+
export declare const TOOL_ORDER_REST: " ";
|
|
62
|
+
/**
|
|
63
|
+
* Order tools for the wire.
|
|
64
|
+
* @param tools - tool definitions for this request
|
|
65
|
+
* @param toolOrder - optional DSH-style order with exactly one `' '` rest
|
|
66
|
+
*/
|
|
67
|
+
export declare function orderToolsForWire(tools: AssembledRequest["tools"], toolOrder?: readonly string[]): AssembledRequest["tools"];
|
|
55
68
|
/**
|
|
56
69
|
* Fixed order:
|
|
57
70
|
* 1. system = skeleton system (+ optional workspace blocks appended)
|
|
58
71
|
* 2. messages = history(+optional marker) + skeleton user + volatile user
|
|
59
72
|
* Volatile content must never appear in `system`.
|
|
60
|
-
* Tools are sorted by name for prompt-cache stability (DSH parity).
|
|
73
|
+
* Tools are sorted by name (or `toolOrder`) for prompt-cache stability (DSH parity).
|
|
61
74
|
*/
|
|
62
75
|
export declare function assembleThreeLayers(input: ThreeLayerInput): AssembledRequest;
|
|
63
76
|
//# sourceMappingURL=three-layer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"three-layer.d.ts","sourceRoot":"","sources":["../src/three-layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,SAAS;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAA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