@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,23 +1,56 @@
|
|
|
1
|
+
import { settleDanglingTools, } from "@xrkseek/core-session";
|
|
1
2
|
export function isAbortError(err, signal) {
|
|
2
3
|
return (err instanceof DOMException &&
|
|
3
4
|
err.name === "AbortError" &&
|
|
4
5
|
signal?.aborted === true);
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
+
function parseArgsFragment(raw) {
|
|
8
|
+
try {
|
|
9
|
+
return raw ? JSON.parse(raw) : {};
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return raw;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** Fold logged stream chunks for one step into assistant text / tool surfaces. */
|
|
7
16
|
export function foldStepStreamChunks(events, turnId, stepId) {
|
|
8
17
|
let content = "";
|
|
9
18
|
let reasoning = "";
|
|
19
|
+
const byIndex = new Map();
|
|
10
20
|
for (const ev of events) {
|
|
11
21
|
if (ev.type !== "assistant/chunk")
|
|
12
22
|
continue;
|
|
13
23
|
if (ev.turnId !== turnId || ev.stepId !== stepId)
|
|
14
24
|
continue;
|
|
25
|
+
if (ev.kind === "usage")
|
|
26
|
+
continue;
|
|
27
|
+
if (ev.kind === "tool-call") {
|
|
28
|
+
const idx = ev.index ?? 0;
|
|
29
|
+
const cur = byIndex.get(idx) ?? {
|
|
30
|
+
id: ev.toolCallId ?? `call_${idx}`,
|
|
31
|
+
arguments: "",
|
|
32
|
+
};
|
|
33
|
+
if (ev.toolCallId)
|
|
34
|
+
cur.id = ev.toolCallId;
|
|
35
|
+
if (ev.toolName)
|
|
36
|
+
cur.name = ev.toolName;
|
|
37
|
+
cur.arguments += ev.argumentsDelta ?? ev.text;
|
|
38
|
+
byIndex.set(idx, cur);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
15
41
|
if (ev.kind === "reasoning")
|
|
16
42
|
reasoning += ev.text;
|
|
17
43
|
else
|
|
18
44
|
content += ev.text;
|
|
19
45
|
}
|
|
20
|
-
|
|
46
|
+
const toolCalls = [...byIndex.entries()]
|
|
47
|
+
.sort((a, b) => a[0] - b[0])
|
|
48
|
+
.map(([, acc]) => ({
|
|
49
|
+
id: acc.id,
|
|
50
|
+
name: acc.name ?? "unknown",
|
|
51
|
+
arguments: parseArgsFragment(acc.arguments),
|
|
52
|
+
}));
|
|
53
|
+
return { content, reasoning, toolCalls };
|
|
21
54
|
}
|
|
22
55
|
function stepHasAssistantMessage(events, turnId, stepId) {
|
|
23
56
|
return events.some((e) => e.type === "assistant/message" &&
|
|
@@ -39,7 +72,9 @@ export function finalizeCancelledTurn(input) {
|
|
|
39
72
|
if (input.stepId !== undefined && !stepHasEnd(events(), input.turnId, input.stepId)) {
|
|
40
73
|
if (!stepHasAssistantMessage(events(), input.turnId, input.stepId)) {
|
|
41
74
|
const folded = foldStepStreamChunks(events(), input.turnId, input.stepId);
|
|
42
|
-
if (folded.content.trim() ||
|
|
75
|
+
if (folded.content.trim() ||
|
|
76
|
+
folded.reasoning.trim() ||
|
|
77
|
+
folded.toolCalls.length > 0) {
|
|
43
78
|
input.store.append(input.sessionId, {
|
|
44
79
|
type: "assistant/message",
|
|
45
80
|
ts: input.now(),
|
|
@@ -49,6 +84,9 @@ export function finalizeCancelledTurn(input) {
|
|
|
49
84
|
...(folded.reasoning.trim()
|
|
50
85
|
? { reasoning: folded.reasoning }
|
|
51
86
|
: {}),
|
|
87
|
+
...(folded.toolCalls.length
|
|
88
|
+
? { toolCalls: folded.toolCalls }
|
|
89
|
+
: {}),
|
|
52
90
|
interrupted: true,
|
|
53
91
|
});
|
|
54
92
|
}
|
|
@@ -60,12 +98,20 @@ export function finalizeCancelledTurn(input) {
|
|
|
60
98
|
stepId: input.stepId,
|
|
61
99
|
});
|
|
62
100
|
}
|
|
101
|
+
// Cancel path: settle open tools as ABORTED_BEFORE_DISPATCH (not crash-unknown).
|
|
102
|
+
settleDanglingTools(input.store, input.sessionId, {
|
|
103
|
+
now: input.now,
|
|
104
|
+
kind: "aborted-before-dispatch",
|
|
105
|
+
});
|
|
63
106
|
if (!turnHasEnd(events(), input.turnId)) {
|
|
64
107
|
input.store.append(input.sessionId, {
|
|
65
108
|
type: "turn/end",
|
|
66
109
|
ts: input.now(),
|
|
67
110
|
turnId: input.turnId,
|
|
68
|
-
reason: {
|
|
111
|
+
reason: {
|
|
112
|
+
kind: "aborted",
|
|
113
|
+
reason: input.cancelCause ?? { kind: "legacy" },
|
|
114
|
+
},
|
|
69
115
|
});
|
|
70
116
|
}
|
|
71
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancel-finalize.js","sourceRoot":"","sources":["../src/cancel-finalize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cancel-finalize.js","sourceRoot":"","sources":["../src/cancel-finalize.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,GAEpB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,UAAU,YAAY,CAC1B,GAAY,EACZ,MAAoB;IAEpB,OAAO,CACL,GAAG,YAAY,YAAY;QAC3B,GAAG,CAAC,IAAI,KAAK,YAAY;QACzB,MAAM,EAAE,OAAO,KAAK,IAAI,CACzB,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAW;IACpC,IAAI,CAAC;QACH,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,oBAAoB,CAClC,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,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,CAAC,CAAC;IAEH,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACxC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE;YAClC,IAAI,EAAE,UAAU;YAChB,EAAE,EAAE,KAAK,CAAC,GAAG,EAAE;YACf,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,MAAM,EAAE;gBACN,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,KAAK,CAAC,WAAW,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;aAChD;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CompactionOptions, type SessionStore } from "@xrkseek/core-session";
|
|
2
2
|
import { type ToolPipeline, type ToolRegistry } from "@xrkseek/core-tools";
|
|
3
|
-
import { type LlmAdapter, type LlmChatRequest } from "@xrkseek/llm";
|
|
3
|
+
import { type LlmAdapter, type LlmChatRequest, type ResolvedRetryPolicy } from "@xrkseek/llm";
|
|
4
4
|
import type { MessageContent } from "@xrkseek/protocol";
|
|
5
5
|
import { type ToolSettleMode } from "./settle-batch.js";
|
|
6
6
|
export interface AssembleOptions {
|
|
@@ -8,6 +8,11 @@ export interface AssembleOptions {
|
|
|
8
8
|
readonly mcpProtocol?: string;
|
|
9
9
|
readonly owner?: string;
|
|
10
10
|
readonly workspaceBlocks?: readonly string[];
|
|
11
|
+
/**
|
|
12
|
+
* Optional DSH `toolOrder` (exactly one `' '` rest). Forwarded to
|
|
13
|
+
* `assembleThreeLayers`; omit → lexicographic tool wire order.
|
|
14
|
+
*/
|
|
15
|
+
readonly toolOrder?: readonly string[];
|
|
11
16
|
/** When false, skip three-layer and use legacy system+history. Default true if assemble set. */
|
|
12
17
|
readonly enabled?: boolean;
|
|
13
18
|
/**
|
|
@@ -63,6 +68,12 @@ export interface RunTurnInput {
|
|
|
63
68
|
* Pass `false` or omit to disable. Object enables auto + one overflow retry.
|
|
64
69
|
*/
|
|
65
70
|
readonly compaction?: false | CompactionOptions;
|
|
71
|
+
/**
|
|
72
|
+
* Provider request retries within a step (DSH llm-retry).
|
|
73
|
+
* Default: normal mode, max 5, retryable EMPTY_RESPONSE / RATE_LIMIT /
|
|
74
|
+
* SERVER / TIMEOUT / TRANSPORT. Pass `false` to disable.
|
|
75
|
+
*/
|
|
76
|
+
readonly llmRetry?: false | Partial<ResolvedRetryPolicy>;
|
|
66
77
|
}
|
|
67
78
|
export interface RunTurnResult {
|
|
68
79
|
readonly turnId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EASL,KAAK,UAAU,EACf,KAAK,cAAc,EAEnB,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAEV,cAAc,EAKf,MAAM,mBAAmB,CAAC;AAgB3B,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAUzE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACv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UAAU,CAAC,EAAE,cAAc,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,KAAK,GAAG,iBAAiB,CAAC;IAChD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC1D;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AA6OD;;;GAGG;AACH,wBAAsB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAigBzE;AAED,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { assertModelVisible, assertToolCallsSettled, deriveMessages, estimateMessagesTokens, settleDanglingTools, DEFAULT_COMPACTION_BUFFER_TOKENS, DEFAULT_COMPACTION_KEEP_TOKENS, } from "@xrkseek/core-session";
|
|
1
|
+
import { assertModelVisible, assertToolCallsSettled, deriveMessages, estimateMessagesTokens, pruneOversizedToolResults, settleDanglingTools, DEFAULT_COMPACTION_BUFFER_TOKENS, DEFAULT_COMPACTION_KEEP_TOKENS, } from "@xrkseek/core-session";
|
|
2
2
|
import { assembleThreeLayers, } from "@xrkseek/core-system-prompt";
|
|
3
3
|
import { materializeTools, } from "@xrkseek/core-tools";
|
|
4
|
-
import { isContextOverflowError, UnsupportedContentError, } from "@xrkseek/llm";
|
|
5
|
-
import { contentHasImage, flattenText, parseSessionEvent, DEFAULT_PLAN_POLICY_SECTION, foldPlanMode, pendingPlanTarget, } from "@xrkseek/protocol";
|
|
4
|
+
import { finalizeLlmChatResponse, isContextOverflowError, isEmptyResponseError, isIncompleteToolCallError, isLlmError, isProviderFinishError, isUnsupportedReasoningEffortError, UnsupportedContentError, } from "@xrkseek/llm";
|
|
5
|
+
import { contentHasImage, flattenText, parseSessionEvent, parseTurnEndCancelCause, DEFAULT_PLAN_POLICY_SECTION, foldPlanMode, pendingPlanTarget, } from "@xrkseek/protocol";
|
|
6
6
|
import { resolveCompactionOptions, runCompaction } from "./compaction.js";
|
|
7
7
|
import { maybeAppendRequestHeader } from "./request-header-log.js";
|
|
8
8
|
import { MAX_STEPS_PROMPT, MAX_STEPS_TOOL_DISABLED, } from "./max-steps.js";
|
|
9
9
|
import { settleToolBatch } from "./settle-batch.js";
|
|
10
10
|
import { finalizeCancelledTurn, isAbortError, } from "./cancel-finalize.js";
|
|
11
|
+
import { invokeLlmWithRetry, resolveRetryPolicy, } from "./llm-retry.js";
|
|
11
12
|
function id(prefix) {
|
|
12
13
|
return `${prefix}_${Math.random().toString(36).slice(2, 10)}`;
|
|
13
14
|
}
|
|
@@ -29,22 +30,34 @@ function llmAllowsImage(llm) {
|
|
|
29
30
|
return (llm.inputModalities ?? ["text"]).includes("image");
|
|
30
31
|
}
|
|
31
32
|
function toLlmRequest(input, req) {
|
|
33
|
+
let reasoningEffort;
|
|
34
|
+
try {
|
|
35
|
+
reasoningEffort =
|
|
36
|
+
input.llm.ensureRoute?.()?.reasoningEffort ??
|
|
37
|
+
input.llm.peekRoute?.()?.reasoningEffort;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
reasoningEffort = input.llm.peekRoute?.()?.reasoningEffort;
|
|
41
|
+
}
|
|
32
42
|
return {
|
|
33
43
|
messages: req.messages,
|
|
34
44
|
...(req.tools.length ? { tools: req.tools } : {}),
|
|
35
45
|
...(input.signal ? { signal: input.signal } : {}),
|
|
36
46
|
...(input.resolveImage ? { resolveImage: input.resolveImage } : {}),
|
|
47
|
+
...(reasoningEffort !== undefined ? { reasoningEffort } : {}),
|
|
37
48
|
};
|
|
38
49
|
}
|
|
39
50
|
async function invokeLlm(input, req, onChunk) {
|
|
40
51
|
const request = toLlmRequest(input, req);
|
|
41
52
|
if (!input.llm.stream) {
|
|
42
|
-
return input.llm.chat(request);
|
|
53
|
+
return finalizeLlmChatResponse(await input.llm.chat(request));
|
|
43
54
|
}
|
|
44
55
|
let content = "";
|
|
45
56
|
let reasoning = "";
|
|
46
57
|
let toolCalls;
|
|
47
58
|
let usage;
|
|
59
|
+
let finishReason;
|
|
60
|
+
let finishError;
|
|
48
61
|
for await (const ev of input.llm.stream(request)) {
|
|
49
62
|
if (input.signal?.aborted) {
|
|
50
63
|
throw new DOMException("aborted", "AbortError");
|
|
@@ -61,6 +74,16 @@ async function invokeLlm(input, req, onChunk) {
|
|
|
61
74
|
onChunk({ kind: "text", index: ev.index, text: ev.text });
|
|
62
75
|
}
|
|
63
76
|
}
|
|
77
|
+
else if (ev.type === "tool-call-delta") {
|
|
78
|
+
onChunk({
|
|
79
|
+
kind: "tool-call",
|
|
80
|
+
index: ev.index,
|
|
81
|
+
text: ev.argumentsDelta,
|
|
82
|
+
toolCallId: ev.id,
|
|
83
|
+
...(ev.name ? { toolName: ev.name } : {}),
|
|
84
|
+
argumentsDelta: ev.argumentsDelta,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
64
87
|
else if (ev.type === "usage") {
|
|
65
88
|
usage = ev.usage;
|
|
66
89
|
onChunk({ kind: "usage", index: 0, text: "", usage: ev.usage });
|
|
@@ -73,14 +96,20 @@ async function invokeLlm(input, req, onChunk) {
|
|
|
73
96
|
toolCalls = ev.toolCalls;
|
|
74
97
|
if (ev.usage)
|
|
75
98
|
usage = ev.usage;
|
|
99
|
+
if (ev.finishReason)
|
|
100
|
+
finishReason = ev.finishReason;
|
|
101
|
+
if (ev.finishError)
|
|
102
|
+
finishError = ev.finishError;
|
|
76
103
|
}
|
|
77
104
|
}
|
|
78
|
-
return {
|
|
105
|
+
return finalizeLlmChatResponse({
|
|
79
106
|
content,
|
|
80
107
|
...(reasoning.trim() ? { reasoning } : {}),
|
|
81
108
|
...(toolCalls ? { toolCalls } : {}),
|
|
82
109
|
...(usage ? { usage } : {}),
|
|
83
|
-
|
|
110
|
+
...(finishReason ? { finishReason } : {}),
|
|
111
|
+
...(finishError ? { finishError } : {}),
|
|
112
|
+
});
|
|
84
113
|
}
|
|
85
114
|
function buildModelRequest(input) {
|
|
86
115
|
const derived = deriveMessages(input.events);
|
|
@@ -148,6 +177,7 @@ function buildModelRequest(input) {
|
|
|
148
177
|
includeCurrentMarker: input.firstStep === true,
|
|
149
178
|
includeVolatileTime: input.firstStep === true,
|
|
150
179
|
tools: toolDefs,
|
|
180
|
+
...(input.assemble?.toolOrder ? { toolOrder: input.assemble.toolOrder } : {}),
|
|
151
181
|
...(input.assemble?.workspaceBlocks ||
|
|
152
182
|
input.slashSystemExtra ||
|
|
153
183
|
foldPlanMode(input.events)
|
|
@@ -223,6 +253,8 @@ export async function runTurn(input) {
|
|
|
223
253
|
content: userContent,
|
|
224
254
|
});
|
|
225
255
|
let activeStepId;
|
|
256
|
+
/** Sticky: once any step hits max-tokens, the turn ends that way (DSH). */
|
|
257
|
+
let turnEndReason = { kind: "completed" };
|
|
226
258
|
try {
|
|
227
259
|
while (steps < maxSteps) {
|
|
228
260
|
if (input.signal?.aborted) {
|
|
@@ -262,24 +294,37 @@ export async function runTurn(input) {
|
|
|
262
294
|
: {}),
|
|
263
295
|
});
|
|
264
296
|
let req = buildReq();
|
|
265
|
-
//
|
|
297
|
+
// Soft budget: prune only under pressure (DSH: below-pressure never prune),
|
|
298
|
+
// remeasure, then summarize only if still over.
|
|
266
299
|
if (compaction?.auto !== false &&
|
|
267
300
|
compaction?.maxRequestTokens !== undefined) {
|
|
268
301
|
const buffer = compaction.bufferTokens ?? DEFAULT_COMPACTION_BUFFER_TOKENS;
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
sessionId: input.sessionId,
|
|
274
|
-
llm: input.llm,
|
|
275
|
-
reason: "auto",
|
|
276
|
-
keepTokens: compaction.keepTokens ?? DEFAULT_COMPACTION_KEEP_TOKENS,
|
|
277
|
-
turnId,
|
|
278
|
-
...(input.signal ? { signal: input.signal } : {}),
|
|
302
|
+
const softCeiling = compaction.maxRequestTokens - buffer;
|
|
303
|
+
let used = estimateMessagesTokens(req.messages);
|
|
304
|
+
if (used > softCeiling) {
|
|
305
|
+
const pruned = pruneOversizedToolResults(input.store, input.sessionId, {
|
|
279
306
|
now,
|
|
307
|
+
turnId,
|
|
308
|
+
stepId,
|
|
280
309
|
});
|
|
281
|
-
if (
|
|
310
|
+
if (pruned.pruned > 0) {
|
|
282
311
|
req = buildReq();
|
|
312
|
+
used = estimateMessagesTokens(req.messages);
|
|
313
|
+
}
|
|
314
|
+
if (used > softCeiling) {
|
|
315
|
+
const did = await runCompaction({
|
|
316
|
+
store: input.store,
|
|
317
|
+
sessionId: input.sessionId,
|
|
318
|
+
llm: input.llm,
|
|
319
|
+
reason: "auto",
|
|
320
|
+
keepTokens: compaction.keepTokens ?? DEFAULT_COMPACTION_KEEP_TOKENS,
|
|
321
|
+
turnId,
|
|
322
|
+
...(input.signal ? { signal: input.signal } : {}),
|
|
323
|
+
now,
|
|
324
|
+
});
|
|
325
|
+
if (did.compacted)
|
|
326
|
+
req = buildReq();
|
|
327
|
+
}
|
|
283
328
|
}
|
|
284
329
|
}
|
|
285
330
|
// Legacy invariant: logged history reconstructible (excluding ephemeral volatile).
|
|
@@ -309,6 +354,22 @@ export async function runTurn(input) {
|
|
|
309
354
|
});
|
|
310
355
|
return;
|
|
311
356
|
}
|
|
357
|
+
if (chunk.kind === "tool-call" && chunk.toolCallId) {
|
|
358
|
+
const delta = chunk.argumentsDelta ?? chunk.text;
|
|
359
|
+
append(input.store, input.sessionId, {
|
|
360
|
+
type: "assistant/chunk",
|
|
361
|
+
ts: now(),
|
|
362
|
+
turnId,
|
|
363
|
+
stepId,
|
|
364
|
+
text: delta,
|
|
365
|
+
kind: "tool-call",
|
|
366
|
+
index: chunk.index,
|
|
367
|
+
toolCallId: chunk.toolCallId,
|
|
368
|
+
...(chunk.toolName ? { toolName: chunk.toolName } : {}),
|
|
369
|
+
argumentsDelta: delta,
|
|
370
|
+
});
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
312
373
|
append(input.store, input.sessionId, {
|
|
313
374
|
type: "assistant/chunk",
|
|
314
375
|
ts: now(),
|
|
@@ -320,44 +381,114 @@ export async function runTurn(input) {
|
|
|
320
381
|
});
|
|
321
382
|
};
|
|
322
383
|
try {
|
|
323
|
-
response = await
|
|
384
|
+
response = await invokeLlmWithRetry({
|
|
385
|
+
invoke: (onBuffered) => invokeLlm(input, req, onBuffered),
|
|
386
|
+
flushChunk: onChunk,
|
|
387
|
+
store: input.store,
|
|
388
|
+
sessionId: input.sessionId,
|
|
389
|
+
turnId,
|
|
390
|
+
stepId,
|
|
391
|
+
now,
|
|
392
|
+
...(input.signal ? { signal: input.signal } : {}),
|
|
393
|
+
policy: resolveRetryPolicy(input.llmRetry),
|
|
394
|
+
provider: input.llm.id,
|
|
395
|
+
});
|
|
324
396
|
}
|
|
325
397
|
catch (err) {
|
|
326
398
|
if (compaction &&
|
|
327
399
|
isContextOverflowError(err) &&
|
|
328
400
|
!overflowRecovered) {
|
|
329
401
|
overflowRecovered = true;
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
llm: input.llm,
|
|
334
|
-
reason: "overflow",
|
|
335
|
-
keepTokens: compaction.keepTokens ?? DEFAULT_COMPACTION_KEEP_TOKENS,
|
|
336
|
-
turnId,
|
|
337
|
-
...(input.signal ? { signal: input.signal } : {}),
|
|
402
|
+
// Overflow: prune first, retry once; only summarize if still overflowing
|
|
403
|
+
// (DSH compaction-basic: model-free prune before head reduction).
|
|
404
|
+
const pruned = pruneOversizedToolResults(input.store, input.sessionId, {
|
|
338
405
|
now,
|
|
339
|
-
});
|
|
340
|
-
if (!did.compacted)
|
|
341
|
-
throw err;
|
|
342
|
-
req = buildReq();
|
|
343
|
-
assertToolCallsSettled(input.store.get(input.sessionId).events);
|
|
344
|
-
maybeAppendRequestHeader({
|
|
345
|
-
store: input.store,
|
|
346
|
-
sessionId: input.sessionId,
|
|
347
406
|
turnId,
|
|
348
|
-
|
|
349
|
-
now,
|
|
350
|
-
reason: "change",
|
|
351
|
-
...(req.system?.trim() ? { system: req.system } : {}),
|
|
352
|
-
...(req.tools.length ? { tools: req.tools } : {}),
|
|
407
|
+
stepId,
|
|
353
408
|
});
|
|
354
|
-
|
|
409
|
+
if (pruned.pruned > 0) {
|
|
410
|
+
req = buildReq();
|
|
411
|
+
assertToolCallsSettled(input.store.get(input.sessionId).events);
|
|
412
|
+
maybeAppendRequestHeader({
|
|
413
|
+
store: input.store,
|
|
414
|
+
sessionId: input.sessionId,
|
|
415
|
+
turnId,
|
|
416
|
+
llm: input.llm,
|
|
417
|
+
now,
|
|
418
|
+
reason: "change",
|
|
419
|
+
...(req.system?.trim() ? { system: req.system } : {}),
|
|
420
|
+
...(req.tools.length ? { tools: req.tools } : {}),
|
|
421
|
+
});
|
|
422
|
+
try {
|
|
423
|
+
response = await invokeLlm(input, req, onChunk);
|
|
424
|
+
}
|
|
425
|
+
catch (retryErr) {
|
|
426
|
+
if (!isContextOverflowError(retryErr))
|
|
427
|
+
throw retryErr;
|
|
428
|
+
const did = await runCompaction({
|
|
429
|
+
store: input.store,
|
|
430
|
+
sessionId: input.sessionId,
|
|
431
|
+
llm: input.llm,
|
|
432
|
+
reason: "overflow",
|
|
433
|
+
keepTokens: compaction.keepTokens ?? DEFAULT_COMPACTION_KEEP_TOKENS,
|
|
434
|
+
turnId,
|
|
435
|
+
...(input.signal ? { signal: input.signal } : {}),
|
|
436
|
+
now,
|
|
437
|
+
});
|
|
438
|
+
if (!did.compacted)
|
|
439
|
+
throw retryErr;
|
|
440
|
+
req = buildReq();
|
|
441
|
+
assertToolCallsSettled(input.store.get(input.sessionId).events);
|
|
442
|
+
maybeAppendRequestHeader({
|
|
443
|
+
store: input.store,
|
|
444
|
+
sessionId: input.sessionId,
|
|
445
|
+
turnId,
|
|
446
|
+
llm: input.llm,
|
|
447
|
+
now,
|
|
448
|
+
reason: "change",
|
|
449
|
+
...(req.system?.trim() ? { system: req.system } : {}),
|
|
450
|
+
...(req.tools.length ? { tools: req.tools } : {}),
|
|
451
|
+
});
|
|
452
|
+
response = await invokeLlm(input, req, onChunk);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
const did = await runCompaction({
|
|
457
|
+
store: input.store,
|
|
458
|
+
sessionId: input.sessionId,
|
|
459
|
+
llm: input.llm,
|
|
460
|
+
reason: "overflow",
|
|
461
|
+
keepTokens: compaction.keepTokens ?? DEFAULT_COMPACTION_KEEP_TOKENS,
|
|
462
|
+
turnId,
|
|
463
|
+
...(input.signal ? { signal: input.signal } : {}),
|
|
464
|
+
now,
|
|
465
|
+
});
|
|
466
|
+
if (!did.compacted)
|
|
467
|
+
throw err;
|
|
468
|
+
req = buildReq();
|
|
469
|
+
assertToolCallsSettled(input.store.get(input.sessionId).events);
|
|
470
|
+
maybeAppendRequestHeader({
|
|
471
|
+
store: input.store,
|
|
472
|
+
sessionId: input.sessionId,
|
|
473
|
+
turnId,
|
|
474
|
+
llm: input.llm,
|
|
475
|
+
now,
|
|
476
|
+
reason: "change",
|
|
477
|
+
...(req.system?.trim() ? { system: req.system } : {}),
|
|
478
|
+
...(req.tools.length ? { tools: req.tools } : {}),
|
|
479
|
+
});
|
|
480
|
+
response = await invokeLlm(input, req, onChunk);
|
|
481
|
+
}
|
|
355
482
|
}
|
|
356
483
|
else {
|
|
357
484
|
throw err;
|
|
358
485
|
}
|
|
359
486
|
}
|
|
360
487
|
assistantText = response.content;
|
|
488
|
+
// DSH: max-tokens is sticky for the turn; keep/drop already stripped tools.
|
|
489
|
+
if (response.finishReason === "max-tokens") {
|
|
490
|
+
turnEndReason = { kind: "max-tokens" };
|
|
491
|
+
}
|
|
361
492
|
append(input.store, input.sessionId, {
|
|
362
493
|
type: "assistant/message",
|
|
363
494
|
ts: now(),
|
|
@@ -424,7 +555,7 @@ export async function runTurn(input) {
|
|
|
424
555
|
call,
|
|
425
556
|
});
|
|
426
557
|
}
|
|
427
|
-
const { outcomes } = await settleToolBatch({
|
|
558
|
+
const { outcomes, aborted: settleAborted } = await settleToolBatch({
|
|
428
559
|
calls,
|
|
429
560
|
registry: input.tools,
|
|
430
561
|
materialization: table,
|
|
@@ -469,6 +600,9 @@ export async function runTurn(input) {
|
|
|
469
600
|
batchContexts.push(...outcome.additionalContexts);
|
|
470
601
|
batchSafety.push(...outcome.safetyNotices);
|
|
471
602
|
}
|
|
603
|
+
if (settleAborted || input.signal?.aborted) {
|
|
604
|
+
throw new DOMException("aborted", "AbortError");
|
|
605
|
+
}
|
|
472
606
|
for (const notice of batchSafety) {
|
|
473
607
|
append(input.store, input.sessionId, {
|
|
474
608
|
type: "safety/notice",
|
|
@@ -495,12 +629,16 @@ export async function runTurn(input) {
|
|
|
495
629
|
stepId,
|
|
496
630
|
});
|
|
497
631
|
activeStepId = undefined;
|
|
632
|
+
// DSH: any successful tool with concludesTurn ends the turn at this step.
|
|
633
|
+
if (outcomes.some((o) => o.concludesTurn === true)) {
|
|
634
|
+
break;
|
|
635
|
+
}
|
|
498
636
|
}
|
|
499
637
|
append(input.store, input.sessionId, {
|
|
500
638
|
type: "turn/end",
|
|
501
639
|
ts: now(),
|
|
502
640
|
turnId,
|
|
503
|
-
reason:
|
|
641
|
+
reason: turnEndReason,
|
|
504
642
|
});
|
|
505
643
|
return { turnId, assistantText, steps, toolOk, toolFailed };
|
|
506
644
|
}
|
|
@@ -512,6 +650,40 @@ export async function runTurn(input) {
|
|
|
512
650
|
turnId,
|
|
513
651
|
...(activeStepId !== undefined ? { stepId: activeStepId } : {}),
|
|
514
652
|
now,
|
|
653
|
+
cancelCause: parseTurnEndCancelCause(input.signal?.reason),
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
else if (isEmptyResponseError(err) ||
|
|
657
|
+
isProviderFinishError(err) ||
|
|
658
|
+
isIncompleteToolCallError(err) ||
|
|
659
|
+
isUnsupportedReasoningEffortError(err) ||
|
|
660
|
+
isLlmError(err)) {
|
|
661
|
+
if (activeStepId !== undefined) {
|
|
662
|
+
append(input.store, input.sessionId, {
|
|
663
|
+
type: "step/end",
|
|
664
|
+
ts: now(),
|
|
665
|
+
turnId,
|
|
666
|
+
stepId: activeStepId,
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
const code = isProviderFinishError(err) ||
|
|
670
|
+
isEmptyResponseError(err) ||
|
|
671
|
+
isIncompleteToolCallError(err) ||
|
|
672
|
+
isUnsupportedReasoningEffortError(err) ||
|
|
673
|
+
isLlmError(err)
|
|
674
|
+
? err.code
|
|
675
|
+
: "ERROR";
|
|
676
|
+
append(input.store, input.sessionId, {
|
|
677
|
+
type: "turn/end",
|
|
678
|
+
ts: now(),
|
|
679
|
+
turnId,
|
|
680
|
+
reason: {
|
|
681
|
+
kind: "error",
|
|
682
|
+
error: {
|
|
683
|
+
message: err instanceof Error ? err.message : String(err),
|
|
684
|
+
code,
|
|
685
|
+
},
|
|
686
|
+
},
|
|
515
687
|
});
|
|
516
688
|
}
|
|
517
689
|
throw err;
|