@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
|
@@ -15,7 +15,18 @@ export interface LlmChatRequest {
|
|
|
15
15
|
readonly mediaType: string;
|
|
16
16
|
readonly data: Uint8Array;
|
|
17
17
|
}>;
|
|
18
|
+
/**
|
|
19
|
+
* DeepSeek-style reasoning effort (`off` | `low` | `high` | `max`).
|
|
20
|
+
* Adapters that understand thinking mode map this to wire fields; others ignore.
|
|
21
|
+
*/
|
|
22
|
+
readonly reasoningEffort?: string;
|
|
18
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Why a successful provider call stopped (DSH `FinishReason` subset).
|
|
26
|
+
* `max-tokens` — output ceiling; tool calls are unsafe (BlockAssembler keep/drop).
|
|
27
|
+
* `error` — unknown wire stop (`content_filter`, …) with {@link LlmChatResponse.finishError}.
|
|
28
|
+
*/
|
|
29
|
+
export type LlmFinishReason = "stop" | "tool-calls" | "max-tokens" | "error";
|
|
19
30
|
export interface LlmChatResponse {
|
|
20
31
|
readonly content: string;
|
|
21
32
|
readonly toolCalls?: readonly ToolCall[];
|
|
@@ -23,8 +34,15 @@ export interface LlmChatResponse {
|
|
|
23
34
|
readonly reasoning?: string;
|
|
24
35
|
/** Optional provider token sample when the vendor reports usage. */
|
|
25
36
|
readonly usage?: TokenUsage;
|
|
37
|
+
/** Present when the vendor reports a terminal stop reason. */
|
|
38
|
+
readonly finishReason?: LlmFinishReason;
|
|
39
|
+
/** Set when {@link finishReason} is `error` (DSH unknown finish_reason). */
|
|
40
|
+
readonly finishError?: {
|
|
41
|
+
readonly code: string;
|
|
42
|
+
readonly message: string;
|
|
43
|
+
};
|
|
26
44
|
}
|
|
27
|
-
/** Streaming events from OpenAI-compatible SSE (text + reasoning). */
|
|
45
|
+
/** Streaming events from OpenAI-compatible SSE (text + reasoning + tool-call). */
|
|
28
46
|
export type LlmStreamEvent = {
|
|
29
47
|
readonly type: "text-delta";
|
|
30
48
|
readonly index: number;
|
|
@@ -33,6 +51,13 @@ export type LlmStreamEvent = {
|
|
|
33
51
|
readonly type: "reasoning-delta";
|
|
34
52
|
readonly index: number;
|
|
35
53
|
readonly text: string;
|
|
54
|
+
} | {
|
|
55
|
+
/** Mid-stream tool-call argument fragment (DSH tool-call-delta). */
|
|
56
|
+
readonly type: "tool-call-delta";
|
|
57
|
+
readonly index: number;
|
|
58
|
+
readonly id: string;
|
|
59
|
+
readonly name?: string;
|
|
60
|
+
readonly argumentsDelta: string;
|
|
36
61
|
} | {
|
|
37
62
|
/** Mid-stream provider usage sample (DSH StreamChunk usage). */
|
|
38
63
|
readonly type: "usage";
|
|
@@ -43,7 +68,35 @@ export type LlmStreamEvent = {
|
|
|
43
68
|
readonly reasoning?: string;
|
|
44
69
|
readonly toolCalls?: readonly ToolCall[];
|
|
45
70
|
readonly usage?: TokenUsage;
|
|
71
|
+
readonly finishReason?: LlmFinishReason;
|
|
72
|
+
readonly finishError?: {
|
|
73
|
+
readonly code: string;
|
|
74
|
+
readonly message: string;
|
|
75
|
+
};
|
|
46
76
|
};
|
|
77
|
+
/**
|
|
78
|
+
* Map OpenAI Chat Completions `finish_reason` onto a response (DSH
|
|
79
|
+
* `llm-deepseek/translate.mapFinishReason`).
|
|
80
|
+
*/
|
|
81
|
+
export declare function withOpenAiFinishReason(response: LlmChatResponse, raw: unknown): LlmChatResponse;
|
|
82
|
+
/** Map Anthropic Messages `stop_reason` onto a response. */
|
|
83
|
+
export declare function withAnthropicStopReason(response: LlmChatResponse, raw: unknown): LlmChatResponse;
|
|
84
|
+
/** @deprecated Prefer {@link withOpenAiFinishReason}. */
|
|
85
|
+
export declare function mapOpenAiFinishReason(raw: unknown): Exclude<LlmFinishReason, "error"> | undefined;
|
|
86
|
+
/** @deprecated Prefer {@link withAnthropicStopReason}. */
|
|
87
|
+
export declare function mapAnthropicStopReason(raw: unknown): Exclude<LlmFinishReason, "error"> | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* DSH BlockAssembler keep/drop: a `max-tokens` finish drops tool calls that
|
|
90
|
+
* may be truncated.
|
|
91
|
+
*/
|
|
92
|
+
export declare function applyMaxTokensKeepDrop(response: LlmChatResponse): LlmChatResponse;
|
|
93
|
+
/** True when parseArguments stored unparseable JSON as `{ _raw }`. */
|
|
94
|
+
export declare function toolCallArgsIncomplete(args: unknown): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Post-provider gate (DSH translate + BlockAssembler): keep/drop, refuse
|
|
97
|
+
* unknown finishes / empty stops / truncated tool JSON outside max-tokens.
|
|
98
|
+
*/
|
|
99
|
+
export declare function finalizeLlmChatResponse(response: LlmChatResponse): LlmChatResponse;
|
|
47
100
|
export interface LlmAdapter {
|
|
48
101
|
readonly id: string;
|
|
49
102
|
/** Declared input modalities; default text-only. */
|
|
@@ -73,6 +126,32 @@ export declare class UnsupportedContentError extends Error {
|
|
|
73
126
|
constructor(message?: string);
|
|
74
127
|
}
|
|
75
128
|
export declare function isUnsupportedContentError(err: unknown): boolean;
|
|
129
|
+
/** DSH EMPTY_RESPONSE: stop with no text, reasoning, or tool calls. */
|
|
130
|
+
export declare class EmptyResponseError extends Error {
|
|
131
|
+
readonly code = "EMPTY_RESPONSE";
|
|
132
|
+
constructor(message?: string);
|
|
133
|
+
}
|
|
134
|
+
export declare function isEmptyResponseError(err: unknown): boolean;
|
|
135
|
+
/** Unknown / filtered finish_reason (DSH finish kind error). */
|
|
136
|
+
export declare class ProviderFinishError extends Error {
|
|
137
|
+
readonly code: string;
|
|
138
|
+
constructor(message: string, code: string);
|
|
139
|
+
}
|
|
140
|
+
export declare function isProviderFinishError(err: unknown): boolean;
|
|
141
|
+
/** Tool-call JSON truncated when finish was not max-tokens. */
|
|
142
|
+
export declare class IncompleteToolCallError extends Error {
|
|
143
|
+
readonly code = "INCOMPLETE_TOOL_CALL";
|
|
144
|
+
constructor(message?: string);
|
|
145
|
+
}
|
|
146
|
+
export declare function isIncompleteToolCallError(err: unknown): boolean;
|
|
147
|
+
/** Unsupported or deployment-locked reasoning effort (DSH UNSUPPORTED_REASONING_EFFORT). */
|
|
148
|
+
export declare class UnsupportedReasoningEffortError extends Error {
|
|
149
|
+
readonly code = "UNSUPPORTED_REASONING_EFFORT";
|
|
150
|
+
constructor(message: string);
|
|
151
|
+
}
|
|
152
|
+
export declare function isUnsupportedReasoningEffortError(err: unknown): boolean;
|
|
153
|
+
export { CONTEXT_WINDOW_EXCEEDED_CODE, EMPTY_RESPONSE_CODE, QUOTA_EXCEEDED_CODE, LlmError, classifyCaughtLlmError, httpErrorCode, isLlmError, isQuotaExceededError, parseRetryAfterMs, requestIdFromHeaders, throwHttpLlmError, type LlmFailure, } from "./failure.js";
|
|
154
|
+
export { DEFAULT_RETRY_POLICY, DEFAULT_RETRYABLE_CODES, cancellableDelay, computeRetryDelayMs, failureFromUnknown, isRetryableFailure, type ResolvedRetryPolicy, type RetryPolicyMode, } from "./retry-policy.js";
|
|
76
155
|
export interface LlmRegistry {
|
|
77
156
|
register(adapter: LlmAdapter): void;
|
|
78
157
|
get(id: string): LlmAdapter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACX,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS;QACxB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACrC,EAAE,CAAC;IACJ,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,CACtB,YAAY,EAAE,MAAM,KACjB,OAAO,CAAC;QAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","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B,KAAK,mBAAmB,EACxB,KAAK,eAAe,GACrB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,CAAC;IAC5B,IAAI,IAAI,SAAS,UAAU,EAAE,CAAC;CAC/B;AAED,wBAAgB,iBAAiB,IAAI,WAAW,CAkB/C;AAED,0EAA0E;AAC1E,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,aAAa,CAAC,cAAc,CAAC,GACpC,OAAO,CAAC,eAAe,CAAC,CA4B1B"}
|
|
@@ -1,3 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map OpenAI Chat Completions `finish_reason` onto a response (DSH
|
|
3
|
+
* `llm-deepseek/translate.mapFinishReason`).
|
|
4
|
+
*/
|
|
5
|
+
export function withOpenAiFinishReason(response, raw) {
|
|
6
|
+
if (raw === "length")
|
|
7
|
+
return { ...response, finishReason: "max-tokens" };
|
|
8
|
+
if (raw === "tool_calls")
|
|
9
|
+
return { ...response, finishReason: "tool-calls" };
|
|
10
|
+
if (raw === "stop")
|
|
11
|
+
return { ...response, finishReason: "stop" };
|
|
12
|
+
if (typeof raw === "string" && raw.trim()) {
|
|
13
|
+
return {
|
|
14
|
+
...response,
|
|
15
|
+
finishReason: "error",
|
|
16
|
+
finishError: {
|
|
17
|
+
code: raw.toUpperCase(),
|
|
18
|
+
message: `model stopped: ${raw}`,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return response;
|
|
23
|
+
}
|
|
24
|
+
/** Map Anthropic Messages `stop_reason` onto a response. */
|
|
25
|
+
export function withAnthropicStopReason(response, raw) {
|
|
26
|
+
if (raw === "max_tokens")
|
|
27
|
+
return { ...response, finishReason: "max-tokens" };
|
|
28
|
+
if (raw === "tool_use")
|
|
29
|
+
return { ...response, finishReason: "tool-calls" };
|
|
30
|
+
if (raw === "end_turn" || raw === "stop_sequence") {
|
|
31
|
+
return { ...response, finishReason: "stop" };
|
|
32
|
+
}
|
|
33
|
+
if (typeof raw === "string" && raw.trim()) {
|
|
34
|
+
return {
|
|
35
|
+
...response,
|
|
36
|
+
finishReason: "error",
|
|
37
|
+
finishError: {
|
|
38
|
+
code: raw.toUpperCase(),
|
|
39
|
+
message: `model stopped: ${raw}`,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return response;
|
|
44
|
+
}
|
|
45
|
+
/** @deprecated Prefer {@link withOpenAiFinishReason}. */
|
|
46
|
+
export function mapOpenAiFinishReason(raw) {
|
|
47
|
+
if (raw === "length")
|
|
48
|
+
return "max-tokens";
|
|
49
|
+
if (raw === "tool_calls")
|
|
50
|
+
return "tool-calls";
|
|
51
|
+
if (raw === "stop")
|
|
52
|
+
return "stop";
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
/** @deprecated Prefer {@link withAnthropicStopReason}. */
|
|
56
|
+
export function mapAnthropicStopReason(raw) {
|
|
57
|
+
if (raw === "max_tokens")
|
|
58
|
+
return "max-tokens";
|
|
59
|
+
if (raw === "tool_use")
|
|
60
|
+
return "tool-calls";
|
|
61
|
+
if (raw === "end_turn" || raw === "stop_sequence")
|
|
62
|
+
return "stop";
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* DSH BlockAssembler keep/drop: a `max-tokens` finish drops tool calls that
|
|
67
|
+
* may be truncated.
|
|
68
|
+
*/
|
|
69
|
+
export function applyMaxTokensKeepDrop(response) {
|
|
70
|
+
if (response.finishReason !== "max-tokens" || !response.toolCalls?.length) {
|
|
71
|
+
return response;
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
content: response.content,
|
|
75
|
+
...(response.reasoning ? { reasoning: response.reasoning } : {}),
|
|
76
|
+
...(response.usage ? { usage: response.usage } : {}),
|
|
77
|
+
finishReason: "max-tokens",
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/** True when parseArguments stored unparseable JSON as `{ _raw }`. */
|
|
81
|
+
export function toolCallArgsIncomplete(args) {
|
|
82
|
+
return (!!args &&
|
|
83
|
+
typeof args === "object" &&
|
|
84
|
+
!Array.isArray(args) &&
|
|
85
|
+
Object.keys(args).length === 1 &&
|
|
86
|
+
typeof args._raw === "string");
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Post-provider gate (DSH translate + BlockAssembler): keep/drop, refuse
|
|
90
|
+
* unknown finishes / empty stops / truncated tool JSON outside max-tokens.
|
|
91
|
+
*/
|
|
92
|
+
export function finalizeLlmChatResponse(response) {
|
|
93
|
+
const dropped = applyMaxTokensKeepDrop(response);
|
|
94
|
+
if (dropped.finishReason === "error") {
|
|
95
|
+
throw new ProviderFinishError(dropped.finishError?.message ?? "model stopped with an error finish", dropped.finishError?.code ?? "FINISH_ERROR");
|
|
96
|
+
}
|
|
97
|
+
if (dropped.toolCalls?.some((c) => toolCallArgsIncomplete(c.arguments)) &&
|
|
98
|
+
dropped.finishReason !== "max-tokens") {
|
|
99
|
+
throw new IncompleteToolCallError("tool call arguments were truncated or invalid JSON");
|
|
100
|
+
}
|
|
101
|
+
const empty = !dropped.content.trim() &&
|
|
102
|
+
!dropped.reasoning?.trim() &&
|
|
103
|
+
!(dropped.toolCalls && dropped.toolCalls.length > 0);
|
|
104
|
+
// max-tokens may leave a usage-only durable row; do not treat as EMPTY_RESPONSE.
|
|
105
|
+
if (empty &&
|
|
106
|
+
(dropped.finishReason === "stop" || dropped.finishReason === undefined)) {
|
|
107
|
+
throw new EmptyResponseError();
|
|
108
|
+
}
|
|
109
|
+
return dropped;
|
|
110
|
+
}
|
|
1
111
|
/** Provider reported context window / token limit exceeded. */
|
|
2
112
|
export class ContextOverflowError extends Error {
|
|
3
113
|
constructor(message = "context overflow") {
|
|
@@ -19,6 +129,53 @@ export class UnsupportedContentError extends Error {
|
|
|
19
129
|
export function isUnsupportedContentError(err) {
|
|
20
130
|
return err instanceof UnsupportedContentError;
|
|
21
131
|
}
|
|
132
|
+
/** DSH EMPTY_RESPONSE: stop with no text, reasoning, or tool calls. */
|
|
133
|
+
export class EmptyResponseError extends Error {
|
|
134
|
+
code = "EMPTY_RESPONSE";
|
|
135
|
+
constructor(message = "empty model response") {
|
|
136
|
+
super(message);
|
|
137
|
+
this.name = "EmptyResponseError";
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
export function isEmptyResponseError(err) {
|
|
141
|
+
return err instanceof EmptyResponseError;
|
|
142
|
+
}
|
|
143
|
+
/** Unknown / filtered finish_reason (DSH finish kind error). */
|
|
144
|
+
export class ProviderFinishError extends Error {
|
|
145
|
+
code;
|
|
146
|
+
constructor(message, code) {
|
|
147
|
+
super(message);
|
|
148
|
+
this.name = "ProviderFinishError";
|
|
149
|
+
this.code = code;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
export function isProviderFinishError(err) {
|
|
153
|
+
return err instanceof ProviderFinishError;
|
|
154
|
+
}
|
|
155
|
+
/** Tool-call JSON truncated when finish was not max-tokens. */
|
|
156
|
+
export class IncompleteToolCallError extends Error {
|
|
157
|
+
code = "INCOMPLETE_TOOL_CALL";
|
|
158
|
+
constructor(message = "incomplete tool call") {
|
|
159
|
+
super(message);
|
|
160
|
+
this.name = "IncompleteToolCallError";
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
export function isIncompleteToolCallError(err) {
|
|
164
|
+
return err instanceof IncompleteToolCallError;
|
|
165
|
+
}
|
|
166
|
+
/** Unsupported or deployment-locked reasoning effort (DSH UNSUPPORTED_REASONING_EFFORT). */
|
|
167
|
+
export class UnsupportedReasoningEffortError extends Error {
|
|
168
|
+
code = "UNSUPPORTED_REASONING_EFFORT";
|
|
169
|
+
constructor(message) {
|
|
170
|
+
super(message);
|
|
171
|
+
this.name = "UnsupportedReasoningEffortError";
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
export function isUnsupportedReasoningEffortError(err) {
|
|
175
|
+
return err instanceof UnsupportedReasoningEffortError;
|
|
176
|
+
}
|
|
177
|
+
export { CONTEXT_WINDOW_EXCEEDED_CODE, EMPTY_RESPONSE_CODE, QUOTA_EXCEEDED_CODE, LlmError, classifyCaughtLlmError, httpErrorCode, isLlmError, isQuotaExceededError, parseRetryAfterMs, requestIdFromHeaders, throwHttpLlmError, } from "./failure.js";
|
|
178
|
+
export { DEFAULT_RETRY_POLICY, DEFAULT_RETRYABLE_CODES, cancellableDelay, computeRetryDelayMs, failureFromUnknown, isRetryableFailure, } from "./retry-policy.js";
|
|
22
179
|
export function createLlmRegistry() {
|
|
23
180
|
const adapters = new Map();
|
|
24
181
|
return {
|
|
@@ -45,6 +202,8 @@ export async function collectLlmStream(stream) {
|
|
|
45
202
|
let reasoning = "";
|
|
46
203
|
let toolCalls;
|
|
47
204
|
let usage;
|
|
205
|
+
let finishReason;
|
|
206
|
+
let finishError;
|
|
48
207
|
for await (const ev of stream) {
|
|
49
208
|
if (ev.type === "text-delta")
|
|
50
209
|
content += ev.text;
|
|
@@ -60,13 +219,19 @@ export async function collectLlmStream(stream) {
|
|
|
60
219
|
toolCalls = ev.toolCalls;
|
|
61
220
|
if (ev.usage)
|
|
62
221
|
usage = ev.usage;
|
|
222
|
+
if (ev.finishReason)
|
|
223
|
+
finishReason = ev.finishReason;
|
|
224
|
+
if (ev.finishError)
|
|
225
|
+
finishError = ev.finishError;
|
|
63
226
|
}
|
|
64
227
|
}
|
|
65
|
-
return {
|
|
228
|
+
return finalizeLlmChatResponse({
|
|
66
229
|
content,
|
|
67
230
|
...(reasoning.trim() ? { reasoning } : {}),
|
|
68
231
|
...(toolCalls ? { toolCalls } : {}),
|
|
69
232
|
...(usage ? { usage } : {}),
|
|
70
|
-
|
|
233
|
+
...(finishReason ? { finishReason } : {}),
|
|
234
|
+
...(finishError ? { finishError } : {}),
|
|
235
|
+
});
|
|
71
236
|
}
|
|
72
237
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoFA;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,QAAyB,EACzB,GAAY;IAEZ,IAAI,GAAG,KAAK,QAAQ;QAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;IACzE,IAAI,GAAG,KAAK,YAAY;QAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7E,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;IACjE,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;QAC1C,OAAO;YACL,GAAG,QAAQ;YACX,YAAY,EAAE,OAAO;YACrB,WAAW,EAAE;gBACX,IAAI,EAAE,GAAG,CAAC,WAAW,EAAE;gBACvB,OAAO,EAAE,kBAAkB,GAAG,EAAE;aACjC;SACF,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,uBAAuB,CACrC,QAAyB,EACzB,GAAY;IAEZ,IAAI,GAAG,KAAK,YAAY;QAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7E,IAAI,GAAG,KAAK,UAAU;QAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;IAC3E,IAAI,GAAG,KAAK,UAAU,IAAI,GAAG,KAAK,eAAe,EAAE,CAAC;QAClD,OAAO,EAAE,GAAG,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;IAC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AAE,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC;YAC3C,IAAI,EAAE,CAAC,SAAS;gBAAE,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC;YAC3C,IAAI,EAAE,CAAC,KAAK;gBAAE,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC;YAC/B,IAAI,EAAE,CAAC,YAAY;gBAAE,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC;YACpD,IAAI,EAAE,CAAC,WAAW;gBAAE,WAAW,GAAG,EAAE,CAAC,WAAW,CAAC;QACnD,CAAC;IACH,CAAC;IACD,OAAO,uBAAuB,CAAC;QAC7B,OAAO;QACP,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1C,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3B,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider request retry policy (DSH llm-retry normal mode subset).
|
|
3
|
+
*/
|
|
4
|
+
import { type LlmFailure } from "./failure.js";
|
|
5
|
+
export type RetryPolicyMode = "normal" | "always";
|
|
6
|
+
export interface ResolvedRetryPolicy {
|
|
7
|
+
readonly mode: RetryPolicyMode;
|
|
8
|
+
/** Cap for `normal` mode (ignored when `always`). Default 5. */
|
|
9
|
+
readonly maxRetries: number;
|
|
10
|
+
readonly retryableCodes: readonly string[];
|
|
11
|
+
readonly initialDelayMs: number;
|
|
12
|
+
readonly maxDelayMs: number;
|
|
13
|
+
/** Jitter ratio in [0, 1]; default 0.25. */
|
|
14
|
+
readonly jitterRatio: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const DEFAULT_RETRYABLE_CODES: readonly ["EMPTY_RESPONSE", "RATE_LIMIT", "SERVER", "TIMEOUT", "TRANSPORT"];
|
|
17
|
+
export declare const DEFAULT_RETRY_POLICY: ResolvedRetryPolicy;
|
|
18
|
+
export declare function failureFromUnknown(err: unknown): LlmFailure;
|
|
19
|
+
export declare function isRetryableFailure(failure: LlmFailure, policy?: ResolvedRetryPolicy): boolean;
|
|
20
|
+
export declare function computeRetryDelayMs(policy: ResolvedRetryPolicy, retry: number, failure?: LlmFailure, random?: () => number): number;
|
|
21
|
+
/** Cancellable delay; resolves false when aborted before the timer fires. */
|
|
22
|
+
export declare function cancellableDelay(delayMs: number, signal?: AbortSignal): Promise<boolean>;
|
|
23
|
+
//# sourceMappingURL=retry-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-policy.d.ts","sourceRoot":"","sources":["../src/retry-policy.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,gEAAgE;IAChE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,4CAA4C;IAC5C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,uBAAuB,6EAM1B,CAAC;AAEX,eAAO,MAAM,oBAAoB,EAAE,mBAOlC,CAAC;AAeF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,CAU3D;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,UAAU,EACnB,MAAM,GAAE,mBAA0C,GACjD,OAAO,CAGT;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,UAAU,EACpB,MAAM,GAAE,MAAM,MAAoB,GACjC,MAAM,CAeR;AAED,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,OAAO,CAAC,CAalB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider request retry policy (DSH llm-retry normal mode subset).
|
|
3
|
+
*/
|
|
4
|
+
import { isLlmError, } from "./failure.js";
|
|
5
|
+
export const DEFAULT_RETRYABLE_CODES = [
|
|
6
|
+
"EMPTY_RESPONSE",
|
|
7
|
+
"RATE_LIMIT",
|
|
8
|
+
"SERVER",
|
|
9
|
+
"TIMEOUT",
|
|
10
|
+
"TRANSPORT",
|
|
11
|
+
];
|
|
12
|
+
export const DEFAULT_RETRY_POLICY = {
|
|
13
|
+
mode: "normal",
|
|
14
|
+
maxRetries: 5,
|
|
15
|
+
retryableCodes: [...DEFAULT_RETRYABLE_CODES],
|
|
16
|
+
initialDelayMs: 1_000,
|
|
17
|
+
maxDelayMs: 60_000,
|
|
18
|
+
jitterRatio: 0.25,
|
|
19
|
+
};
|
|
20
|
+
function errorCode(err) {
|
|
21
|
+
if (isLlmError(err))
|
|
22
|
+
return err.code;
|
|
23
|
+
if (err &&
|
|
24
|
+
typeof err === "object" &&
|
|
25
|
+
"code" in err &&
|
|
26
|
+
typeof (err).code === "string") {
|
|
27
|
+
return err.code;
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
export function failureFromUnknown(err) {
|
|
32
|
+
if (isLlmError(err))
|
|
33
|
+
return err.toFailure();
|
|
34
|
+
const code = errorCode(err);
|
|
35
|
+
if (err instanceof Error) {
|
|
36
|
+
return {
|
|
37
|
+
message: err.message,
|
|
38
|
+
code: code ?? "UNKNOWN",
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return { message: String(err), code: code ?? "UNKNOWN" };
|
|
42
|
+
}
|
|
43
|
+
export function isRetryableFailure(failure, policy = DEFAULT_RETRY_POLICY) {
|
|
44
|
+
if (policy.mode === "always")
|
|
45
|
+
return true;
|
|
46
|
+
return policy.retryableCodes.includes(failure.code);
|
|
47
|
+
}
|
|
48
|
+
export function computeRetryDelayMs(policy, retry, failure, random = Math.random) {
|
|
49
|
+
if (failure?.providerRetryAfterMs !== undefined &&
|
|
50
|
+
failure.providerRetryAfterMs > 0) {
|
|
51
|
+
return Math.min(failure.providerRetryAfterMs, policy.maxDelayMs);
|
|
52
|
+
}
|
|
53
|
+
const exponent = Math.min(Math.max(retry - 1, 0), 1024);
|
|
54
|
+
const exponential = Math.min(policy.initialDelayMs * 2 ** exponent, policy.maxDelayMs);
|
|
55
|
+
const jitter = 1 - policy.jitterRatio + 2 * policy.jitterRatio * random();
|
|
56
|
+
return Math.min(exponential * jitter, policy.maxDelayMs);
|
|
57
|
+
}
|
|
58
|
+
/** Cancellable delay; resolves false when aborted before the timer fires. */
|
|
59
|
+
export function cancellableDelay(delayMs, signal) {
|
|
60
|
+
if (signal?.aborted)
|
|
61
|
+
return Promise.resolve(false);
|
|
62
|
+
return new Promise((resolve) => {
|
|
63
|
+
const timer = setTimeout(() => {
|
|
64
|
+
signal?.removeEventListener("abort", onAbort);
|
|
65
|
+
resolve(true);
|
|
66
|
+
}, delayMs);
|
|
67
|
+
function onAbort() {
|
|
68
|
+
clearTimeout(timer);
|
|
69
|
+
resolve(false);
|
|
70
|
+
}
|
|
71
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=retry-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-policy.js","sourceRoot":"","sources":["../src/retry-policy.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,UAAU,GAGX,MAAM,cAAc,CAAC;AAetB,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,gBAAgB;IAChB,YAAY;IACZ,QAAQ;IACR,SAAS;IACT,WAAW;CACH,CAAC;AAEX,MAAM,CAAC,MAAM,oBAAoB,GAAwB;IACvD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,CAAC;IACb,cAAc,EAAE,CAAC,GAAG,uBAAuB,CAAC;IAC5C,cAAc,EAAE,KAAK;IACrB,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE,IAAI;CAClB,CAAC;AAEF,SAAS,SAAS,CAAC,GAAY;IAC7B,IAAI,UAAU,CAAC,GAAG,CAAC;QAAE,OAAQ,GAAgB,CAAC,IAAI,CAAC;IACnD,IACE,GAAG;QACH,OAAO,GAAG,KAAK,QAAQ;QACvB,MAAM,IAAI,GAAG;QACb,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,QAAQ,EAC9B,CAAC;QACD,OAAQ,GAAwB,CAAC,IAAI,CAAC;IACxC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,GAAY;IAC7C,IAAI,UAAU,CAAC,GAAG,CAAC;QAAE,OAAQ,GAAgB,CAAC,SAAS,EAAE,CAAC;IAC1D,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;QACzB,OAAO;YACL,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,IAAI,EAAE,IAAI,IA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AAO;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9C,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,EAAE,OAAO,CAAC,CAAC;QACZ,SAAS,OAAO;YACd,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;QACD,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EAEhB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EAEhB,MAAM,cAAc,CAAC;AAmBtB,eAAO,MAAM,0BAA0B,8BAA8B,CAAC;AACtE,eAAO,MAAM,uBAAuB,6BAA6B,CAAC;AAClE,eAAO,MAAM,qBAAqB,eAAe,CAAC;AA8DlD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,C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