dal-code 1.0.23 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dal-docs/README.md +96 -0
- package/dal-docs/extensions.md +98 -0
- package/dal-docs/keybindings.md +40 -0
- package/dal-docs/packages.md +62 -0
- package/dal-docs/prompt-templates.md +42 -0
- package/dal-docs/settings.md +86 -0
- package/dal-docs/skills.md +65 -0
- package/dal-docs/themes.md +44 -0
- package/dist/cli/args.d.ts +56 -0
- package/dist/config.d.ts +63 -0
- package/dist/config.js +1 -1
- package/dist/core/agent-session-runtime.d.ts +74 -0
- package/dist/core/agent-session-services.d.ts +48 -0
- package/dist/core/agent-session.d.ts +409 -0
- package/dist/core/agent-session.js +6 -6
- package/dist/core/auth-storage.d.ts +56 -0
- package/dist/core/bash-executor.d.ts +13 -0
- package/dist/core/cache-warmer.d.ts +60 -0
- package/dist/core/compaction/branch-summarization.d.ts +43 -0
- package/dist/core/compaction/compaction.d.ts +62 -0
- package/dist/core/compaction/index.d.ts +3 -0
- package/dist/core/compaction/utils.d.ts +16 -0
- package/dist/core/diagnostics.d.ts +14 -0
- package/dist/core/event-bus.d.ts +8 -0
- package/dist/core/exec.d.ts +12 -0
- package/dist/core/extensions/index.d.ts +8 -0
- package/dist/core/extensions/loader.d.ts +13 -0
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/extensions/permission-surface.js +1 -1
- package/dist/core/extensions/runner.d.ts +165 -0
- package/dist/core/extensions/runner.js +1 -1
- package/dist/core/extensions/types.d.ts +1000 -0
- package/dist/core/extensions/wrapper.d.ts +5 -0
- package/dist/core/footer-data-provider.d.ts +46 -0
- package/dist/core/keybindings.d.ts +525 -0
- package/dist/core/keybindings.js +1 -1
- package/dist/core/messages.d.ts +50 -0
- package/dist/core/model-config.d.ts +1212 -0
- package/dist/core/model-registry.d.ts +41 -0
- package/dist/core/model-resolver.d.ts +67 -0
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-runtime.d.ts +101 -0
- package/dist/core/model-runtime.js +2 -2
- package/dist/core/package-manager.d.ts +213 -0
- package/dist/core/package-manager.js +2 -2
- package/dist/core/project-map.d.ts +18 -0
- package/dist/core/prompt-templates.d.ts +24 -0
- package/dist/core/provider-composer.d.ts +55 -0
- package/dist/core/remote-catalog-provider.js +1 -1
- package/dist/core/resolve-config-value.d.ts +11 -0
- package/dist/core/resource-loader.d.ts +220 -0
- package/dist/core/resource-loader.js +1 -1
- package/dist/core/sdk.d.ts +40 -0
- package/dist/core/session-manager.d.ts +208 -0
- package/dist/core/settings-manager.d.ts +348 -0
- package/dist/core/settings-manager.js +1 -1
- package/dist/core/skills.d.ts +33 -0
- package/dist/core/slash-commands.d.ts +14 -0
- package/dist/core/source-info.d.ts +17 -0
- package/dist/core/system-prompt.d.ts +39 -0
- package/dist/core/system-prompt.js +15 -11
- package/dist/core/tools/bash.d.ts +75 -0
- package/dist/core/tools/bash.js +14 -14
- package/dist/core/tools/edit-diff.d.ts +44 -0
- package/dist/core/tools/edit.d.ts +48 -0
- package/dist/core/tools/file-mutation-queue.d.ts +1 -0
- package/dist/core/tools/find.d.ts +34 -0
- package/dist/core/tools/grep.d.ts +34 -0
- package/dist/core/tools/index.d.ts +42 -0
- package/dist/core/tools/index.js +1 -1
- package/dist/core/tools/ls.d.ts +33 -0
- package/dist/core/tools/powershell.d.ts +17 -0
- package/dist/core/tools/read.d.ts +33 -0
- package/dist/core/tools/read.js +2 -2
- package/dist/core/tools/renderers/bash.d.ts +3 -0
- package/dist/core/tools/renderers/edit.d.ts +15 -0
- package/dist/core/tools/renderers/find.d.ts +2 -0
- package/dist/core/tools/renderers/grep.d.ts +2 -0
- package/dist/core/tools/renderers/index.d.ts +13 -0
- package/dist/core/tools/renderers/ls.d.ts +2 -0
- package/dist/core/tools/renderers/read.d.ts +3 -0
- package/dist/core/tools/renderers/read.js +8 -8
- package/dist/core/tools/renderers/write.d.ts +2 -0
- package/dist/core/tools/truncate.d.ts +27 -0
- package/dist/core/tools/write.d.ts +24 -0
- package/dist/core/trust-manager.d.ts +28 -0
- package/dist/core/trust-manager.js +2 -2
- package/dist/dal/child-env.d.ts +12 -0
- package/dist/dal/child-env.js +1 -0
- package/dist/dal/hooks/activity.d.ts +17 -0
- package/dist/dal/hooks/activity.js +1 -0
- package/dist/dal/hooks/config.d.ts +47 -0
- package/dist/dal/hooks/config.js +1 -0
- package/dist/dal/hooks/events.d.ts +43 -0
- package/dist/dal/hooks/events.js +4 -0
- package/dist/dal/hooks/extension.d.ts +3 -0
- package/dist/dal/hooks/extension.js +4 -0
- package/dist/dal/hooks/index.d.ts +5 -0
- package/dist/dal/hooks/index.js +1 -0
- package/dist/dal/hooks/runner.d.ts +57 -0
- package/dist/dal/hooks/runner.js +1 -0
- package/dist/dal/safety-net.js +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +1 -1
- package/dist/main.d.ts +9 -0
- package/dist/main.js +2 -2
- package/dist/modes/acp/acp-mode.d.ts +2 -0
- package/dist/modes/index.d.ts +7 -0
- package/dist/modes/interactive/components/armin.d.ts +30 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +26 -0
- package/dist/modes/interactive/components/assistant-message.js +2 -2
- package/dist/modes/interactive/components/bash-execution.d.ts +22 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +14 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +11 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +11 -0
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/dist/modes/interactive/components/custom-message.d.ts +17 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +17 -0
- package/dist/modes/interactive/components/diff.d.ts +4 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +12 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +19 -0
- package/dist/modes/interactive/components/extension-input.d.ts +21 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +22 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts +23 -0
- package/dist/modes/interactive/components/footer.d.ts +18 -0
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/index.d.ts +33 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +9 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +27 -0
- package/dist/modes/interactive/components/model-selector.d.ts +81 -0
- package/dist/modes/interactive/components/model-selector.js +2 -2
- package/dist/modes/interactive/components/oauth-selector.d.ts +29 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +39 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +20 -0
- package/dist/modes/interactive/components/session-selector.d.ts +88 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +92 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +6 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +11 -0
- package/dist/modes/interactive/components/status-indicator.d.ts +44 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +7 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +19 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +76 -0
- package/dist/modes/interactive/components/tool-execution.js +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +65 -0
- package/dist/modes/interactive/components/trust-selector.d.ts +22 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +23 -0
- package/dist/modes/interactive/components/user-message.d.ts +14 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +5 -0
- package/dist/modes/interactive/interactive-mode.d.ts +326 -0
- package/dist/modes/interactive/interactive-mode.js +48 -48
- package/dist/modes/interactive/theme/theme-json.d.ts +257 -0
- package/dist/modes/interactive/theme/theme.d.ts +106 -0
- package/dist/modes/interactive/tui-renderer.d.ts +18 -0
- package/dist/modes/json-event.d.ts +26 -0
- package/dist/modes/print-mode.d.ts +9 -0
- package/dist/modes/rpc/rpc-client.d.ts +119 -0
- package/dist/modes/rpc/rpc-client.js +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +3 -0
- package/dist/modes/rpc/rpc-types.d.ts +483 -0
- package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-bridge/src/ask-user.js +12 -0
- package/dist/node_modules/@dalcode/dal-bridge/src/client.js +1 -1
- package/dist/node_modules/@dalcode/dal-bridge/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-gateway/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-guard/package.json +5 -4
- package/dist/node_modules/@dalcode/dal-guard/src/hooks.js +1 -0
- package/dist/node_modules/@dalcode/dal-guard/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-lsp/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-lsp/src/client.js +3 -3
- package/dist/node_modules/@dalcode/dal-mcp/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-mcp/src/command-parser.d.ts +19 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/config-edit.d.ts +19 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/config.d.ts +9 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/http-client.d.ts +16 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.d.ts +22 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.js +2 -2
- package/dist/node_modules/@dalcode/dal-mcp/src/types.d.ts +30 -0
- package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-office/src/extract/csv.d.ts +3 -0
- package/dist/node_modules/@dalcode/dal-office/src/extract/csv.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/extract/ooxml.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/index.d.ts +11 -0
- package/dist/node_modules/@dalcode/dal-office/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/paths.d.ts +3 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/chart.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/render/docx.d.ts +19 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/pptx.d.ts +40 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/pptx.js +2 -2
- package/dist/node_modules/@dalcode/dal-office/src/render/thumbnails.d.ts +19 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/thumbnails.js +1 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.d.ts +14 -0
- package/dist/node_modules/@dalcode/dal-office/src/scratchpad.d.ts +16 -0
- package/dist/node_modules/@dalcode/dal-office/src/themes.d.ts +13 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/docx-edit.js +10 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/edit-shared.js +1 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/pptx-edit.js +9 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/read-file.js +4 -2
- package/dist/node_modules/@dalcode/dal-office/src/tools/xlsx-edit.js +5 -0
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +2 -2
- package/dist/node_modules/@dalcode/dal-plugins/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-rewind/src/core.d.ts +61 -0
- package/dist/node_modules/@dalcode/dal-router/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-router/src/commands.js +6 -6
- package/dist/node_modules/@dalcode/dal-router/src/config.d.ts +50 -0
- package/dist/node_modules/@dalcode/dal-router/src/index.js +4 -4
- package/dist/node_modules/@dalcode/dal-router/src/jev.d.ts +51 -0
- package/dist/node_modules/@dalcode/dal-router/src/pool.d.ts +6 -0
- package/dist/node_modules/@dalcode/dal-router/src/router.d.ts +32 -0
- package/dist/node_modules/@dalcode/dal-router/src/runtime.d.ts +37 -0
- package/dist/node_modules/@dalcode/dal-router/src/runtime.js +1 -1
- package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-skills/src/discover.js +4 -4
- package/dist/node_modules/@dalcode/dal-skills/src/index.js +9 -9
- package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-subagent/src/index.js +14 -8
- package/dist/node_modules/@dalcode/dal-subagent/src/process-runner.js +3 -3
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/src/groups.js +1 -1
- package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/plan-mode.js +1 -1
- package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
- package/dist/node_modules/@dalcode/deepailab/src/index.js +3 -3
- package/dist/node_modules/@dalcode/deepailab/src/model-defaults.js +1 -1
- package/dist/node_modules/@earendil-works/chord/dist/api.d.ts +21 -0
- package/dist/node_modules/@earendil-works/chord/dist/context/index.d.ts +12 -0
- package/dist/node_modules/@earendil-works/chord/dist/delta/index.d.ts +127 -0
- package/dist/node_modules/@earendil-works/chord/dist/index.d.ts +8 -0
- package/dist/node_modules/@earendil-works/chord/dist/json.d.ts +2 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/errors.d.ts +16 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/provider.d.ts +32 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts +12 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/wire.d.ts +59 -0
- package/dist/node_modules/@earendil-works/chord/dist/state/draft.d.ts +13 -0
- package/dist/node_modules/@earendil-works/chord/dist/types.d.ts +188 -0
- package/dist/node_modules/@earendil-works/chord/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +7 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +80 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +711 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts +44 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +80 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts +15 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/context.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/events.d.ts +22 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.d.ts +17 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.d.ts +34 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +50 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts +28 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/result.d.ts +132 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.d.ts +56 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.d.ts +94 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.d.ts +99 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.d.ts +52 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.d.ts +19 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts +13 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.d.ts +33 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.d.ts +37 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.d.ts +36 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.d.ts +46 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +75 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.d.ts +473 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.d.ts +94 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts +26 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.d.ts +1495 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.d.ts +26 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.d.ts +18 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.d.ts +32 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +185 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.d.ts +22 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts +22 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts +28 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +27 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +61 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/index.d.ts +28 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/stream-fn.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +150 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +4 -4
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts +18 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts +13 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts +18 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts +12 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts +24 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts +14 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts +8 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts +15 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts +30 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts +24 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts +85 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/context.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/helpers.d.ts +8 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts +20 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +127 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js +0 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts +34 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/compat.d.ts +47 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts +9 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts +9 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +829 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts +13 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/images-models.d.ts +37 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/images.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/index.d.ts +38 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/legacy-api-aliases.d.ts +25 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/model-catalog.d.ts +16 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models-store.d.ts +21 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.d.ts +97 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +84 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts +18 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/baseten.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts +100 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/meta.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius.d.ts +7 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/together.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/types.d.ts +502 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.d.ts +63 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts +19 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +19 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts +16 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/text.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/transcript.d.ts +29 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/uuid.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-client/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-coding-agent/LICENSE +21 -0
- package/dist/node_modules/@earendil-works/pi-coding-agent/index.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-coding-agent/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +15 -0
- package/dist/node_modules/@earendil-works/pi-protocol/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-server/package.json +5 -5
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.d.ts +200 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.d.ts +20 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/noop.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +55 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +20 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts +9 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +151 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/h-stack.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts +25 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +43 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +28 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +61 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts +61 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +52 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +50 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts +8 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/stack.d.ts +35 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +15 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts +9 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/v-stack.d.ts +7 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts +17 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/index.d.ts +32 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +329 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/keys.d.ts +101 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/latex.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/layout-node.d.ts +41 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/native-platform.d.ts +13 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +30 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-colors.d.ts +9 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +82 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +76 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +138 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.d.ts +32 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +252 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +38 -0
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/dist/package-manager-cli.js +32 -32
- package/dist/sdk/index.d.ts +14 -0
- package/dist/sdk/index.js +1 -0
- package/dist/sdk/mcp.d.ts +8 -0
- package/dist/sdk/mcp.js +1 -0
- package/dist/sdk/office.d.ts +1 -0
- package/dist/sdk/office.js +1 -0
- package/dist/sdk/rewind.d.ts +1 -0
- package/dist/sdk/rewind.js +1 -0
- package/dist/sdk/router.d.ts +6 -0
- package/dist/sdk/router.js +1 -0
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/frontmatter.d.ts +7 -0
- package/dist/utils/image-convert.d.ts +5 -0
- package/dist/utils/image-resize-core.d.ts +16 -0
- package/dist/utils/image-resize.d.ts +4 -0
- package/dist/utils/mime.d.ts +2 -0
- package/dist/utils/shell.d.ts +20 -0
- package/dist/utils/shell.js +3 -3
- package/dist/utils/version-check.d.ts +20 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +22 -1
- package/dist/bun/register-bedrock.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +0 -5
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.js +0 -1
- package/dist/node_modules/@earendil-works/pi-client/dist/session-handle.js +0 -1
- package/dist/node_modules/@earendil-works/pi-client/dist/state.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/cli.js +0 -16
- package/dist/node_modules/@earendil-works/pi-server/dist/config.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/handler.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/client.js +0 -2
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/protocol.js +0 -2
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/server.js +0 -3
- package/dist/node_modules/@earendil-works/pi-server/dist/protocol.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/radius.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/rpc-process.js +0 -4
- package/dist/node_modules/@earendil-works/pi-server/dist/serve.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/sessions.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/snapshots.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/storage.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/supervisor.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/service.js +0 -1
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/branch-cache.js +0 -7
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/search-backend.js +0 -36
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/branch-entries.js +0 -25
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/branch-tips.js +0 -2
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/entries.js +0 -7
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/facts.js +0 -20
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/lanes.js +0 -26
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/records.js +0 -9
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/session-sequences.js +0 -1
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/session-stats.js +0 -10
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/sessions.js +0 -29
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/writer-leases.js +0 -14
- package/dist/server/create-harness.js +0 -1
- package/dist/utils/clipboard-native.js +0 -1
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
import type { AgentMessage, ThinkingLevel } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import type { ImageContent, Model } from "@earendil-works/pi-ai";
|
|
3
|
+
import type { SessionStats } from "../../core/agent-session.ts";
|
|
4
|
+
import type { BashResult } from "../../core/bash-executor.ts";
|
|
5
|
+
import type { CompactionResult } from "../../core/compaction/index.ts";
|
|
6
|
+
import type { SessionEntry, SessionTreeNode } from "../../core/session-manager.ts";
|
|
7
|
+
import type { SourceInfo } from "../../core/source-info.ts";
|
|
8
|
+
export type RpcCommand = {
|
|
9
|
+
id?: string;
|
|
10
|
+
type: "prompt";
|
|
11
|
+
message: string;
|
|
12
|
+
images?: ImageContent[];
|
|
13
|
+
streamingBehavior?: "steer" | "followUp";
|
|
14
|
+
} | {
|
|
15
|
+
id?: string;
|
|
16
|
+
type: "steer";
|
|
17
|
+
message: string;
|
|
18
|
+
images?: ImageContent[];
|
|
19
|
+
} | {
|
|
20
|
+
id?: string;
|
|
21
|
+
type: "follow_up";
|
|
22
|
+
message: string;
|
|
23
|
+
images?: ImageContent[];
|
|
24
|
+
} | {
|
|
25
|
+
id?: string;
|
|
26
|
+
type: "abort";
|
|
27
|
+
} | {
|
|
28
|
+
id?: string;
|
|
29
|
+
type: "clear_queue";
|
|
30
|
+
} | {
|
|
31
|
+
id?: string;
|
|
32
|
+
type: "new_session";
|
|
33
|
+
parentSession?: string;
|
|
34
|
+
} | {
|
|
35
|
+
id?: string;
|
|
36
|
+
type: "get_state";
|
|
37
|
+
} | {
|
|
38
|
+
id?: string;
|
|
39
|
+
type: "set_model";
|
|
40
|
+
provider: string;
|
|
41
|
+
modelId: string;
|
|
42
|
+
} | {
|
|
43
|
+
id?: string;
|
|
44
|
+
type: "cycle_model";
|
|
45
|
+
} | {
|
|
46
|
+
id?: string;
|
|
47
|
+
type: "get_available_models";
|
|
48
|
+
} | {
|
|
49
|
+
id?: string;
|
|
50
|
+
type: "set_thinking_level";
|
|
51
|
+
level: ThinkingLevel;
|
|
52
|
+
} | {
|
|
53
|
+
id?: string;
|
|
54
|
+
type: "cycle_thinking_level";
|
|
55
|
+
} | {
|
|
56
|
+
id?: string;
|
|
57
|
+
type: "get_available_thinking_levels";
|
|
58
|
+
} | {
|
|
59
|
+
id?: string;
|
|
60
|
+
type: "set_steering_mode";
|
|
61
|
+
mode: "all" | "one-at-a-time";
|
|
62
|
+
} | {
|
|
63
|
+
id?: string;
|
|
64
|
+
type: "set_follow_up_mode";
|
|
65
|
+
mode: "all" | "one-at-a-time";
|
|
66
|
+
} | {
|
|
67
|
+
id?: string;
|
|
68
|
+
type: "compact";
|
|
69
|
+
customInstructions?: string;
|
|
70
|
+
} | {
|
|
71
|
+
id?: string;
|
|
72
|
+
type: "set_auto_compaction";
|
|
73
|
+
enabled: boolean;
|
|
74
|
+
} | {
|
|
75
|
+
id?: string;
|
|
76
|
+
type: "set_auto_retry";
|
|
77
|
+
enabled: boolean;
|
|
78
|
+
} | {
|
|
79
|
+
id?: string;
|
|
80
|
+
type: "abort_retry";
|
|
81
|
+
} | {
|
|
82
|
+
id?: string;
|
|
83
|
+
type: "bash";
|
|
84
|
+
command: string;
|
|
85
|
+
excludeFromContext?: boolean;
|
|
86
|
+
} | {
|
|
87
|
+
id?: string;
|
|
88
|
+
type: "abort_bash";
|
|
89
|
+
} | {
|
|
90
|
+
id?: string;
|
|
91
|
+
type: "get_session_stats";
|
|
92
|
+
} | {
|
|
93
|
+
id?: string;
|
|
94
|
+
type: "export_html";
|
|
95
|
+
outputPath?: string;
|
|
96
|
+
} | {
|
|
97
|
+
id?: string;
|
|
98
|
+
type: "switch_session";
|
|
99
|
+
sessionPath: string;
|
|
100
|
+
} | {
|
|
101
|
+
id?: string;
|
|
102
|
+
type: "fork";
|
|
103
|
+
entryId: string;
|
|
104
|
+
} | {
|
|
105
|
+
id?: string;
|
|
106
|
+
type: "clone";
|
|
107
|
+
} | {
|
|
108
|
+
id?: string;
|
|
109
|
+
type: "get_fork_messages";
|
|
110
|
+
} | {
|
|
111
|
+
id?: string;
|
|
112
|
+
type: "get_entries";
|
|
113
|
+
since?: string;
|
|
114
|
+
} | {
|
|
115
|
+
id?: string;
|
|
116
|
+
type: "get_tree";
|
|
117
|
+
} | {
|
|
118
|
+
id?: string;
|
|
119
|
+
type: "get_last_assistant_text";
|
|
120
|
+
} | {
|
|
121
|
+
id?: string;
|
|
122
|
+
type: "set_session_name";
|
|
123
|
+
name: string;
|
|
124
|
+
} | {
|
|
125
|
+
id?: string;
|
|
126
|
+
type: "get_messages";
|
|
127
|
+
} | {
|
|
128
|
+
id?: string;
|
|
129
|
+
type: "get_commands";
|
|
130
|
+
};
|
|
131
|
+
export interface RpcSlashCommand {
|
|
132
|
+
name: string;
|
|
133
|
+
description?: string;
|
|
134
|
+
source: "extension" | "prompt" | "skill";
|
|
135
|
+
sourceInfo: SourceInfo;
|
|
136
|
+
}
|
|
137
|
+
export interface RpcSessionState {
|
|
138
|
+
model?: Model<any>;
|
|
139
|
+
thinkingLevel: ThinkingLevel;
|
|
140
|
+
isStreaming: boolean;
|
|
141
|
+
isCompacting: boolean;
|
|
142
|
+
steeringMode: "all" | "one-at-a-time";
|
|
143
|
+
followUpMode: "all" | "one-at-a-time";
|
|
144
|
+
sessionFile?: string;
|
|
145
|
+
sessionId: string;
|
|
146
|
+
sessionName?: string;
|
|
147
|
+
autoCompactionEnabled: boolean;
|
|
148
|
+
messageCount: number;
|
|
149
|
+
pendingMessageCount: number;
|
|
150
|
+
}
|
|
151
|
+
export type RpcResponse = {
|
|
152
|
+
id?: string;
|
|
153
|
+
type: "response";
|
|
154
|
+
command: "prompt";
|
|
155
|
+
success: true;
|
|
156
|
+
} | {
|
|
157
|
+
id?: string;
|
|
158
|
+
type: "response";
|
|
159
|
+
command: "steer";
|
|
160
|
+
success: true;
|
|
161
|
+
} | {
|
|
162
|
+
id?: string;
|
|
163
|
+
type: "response";
|
|
164
|
+
command: "follow_up";
|
|
165
|
+
success: true;
|
|
166
|
+
} | {
|
|
167
|
+
id?: string;
|
|
168
|
+
type: "response";
|
|
169
|
+
command: "abort";
|
|
170
|
+
success: true;
|
|
171
|
+
} | {
|
|
172
|
+
id?: string;
|
|
173
|
+
type: "response";
|
|
174
|
+
command: "clear_queue";
|
|
175
|
+
success: true;
|
|
176
|
+
data: {
|
|
177
|
+
steering: string[];
|
|
178
|
+
followUp: string[];
|
|
179
|
+
};
|
|
180
|
+
} | {
|
|
181
|
+
id?: string;
|
|
182
|
+
type: "response";
|
|
183
|
+
command: "new_session";
|
|
184
|
+
success: true;
|
|
185
|
+
data: {
|
|
186
|
+
cancelled: boolean;
|
|
187
|
+
};
|
|
188
|
+
} | {
|
|
189
|
+
id?: string;
|
|
190
|
+
type: "response";
|
|
191
|
+
command: "get_state";
|
|
192
|
+
success: true;
|
|
193
|
+
data: RpcSessionState;
|
|
194
|
+
} | {
|
|
195
|
+
id?: string;
|
|
196
|
+
type: "response";
|
|
197
|
+
command: "set_model";
|
|
198
|
+
success: true;
|
|
199
|
+
data: Model<any>;
|
|
200
|
+
} | {
|
|
201
|
+
id?: string;
|
|
202
|
+
type: "response";
|
|
203
|
+
command: "cycle_model";
|
|
204
|
+
success: true;
|
|
205
|
+
data: {
|
|
206
|
+
model: Model<any>;
|
|
207
|
+
thinkingLevel: ThinkingLevel;
|
|
208
|
+
isScoped: boolean;
|
|
209
|
+
} | null;
|
|
210
|
+
} | {
|
|
211
|
+
id?: string;
|
|
212
|
+
type: "response";
|
|
213
|
+
command: "get_available_models";
|
|
214
|
+
success: true;
|
|
215
|
+
data: {
|
|
216
|
+
models: Model<any>[];
|
|
217
|
+
};
|
|
218
|
+
} | {
|
|
219
|
+
id?: string;
|
|
220
|
+
type: "response";
|
|
221
|
+
command: "set_thinking_level";
|
|
222
|
+
success: true;
|
|
223
|
+
} | {
|
|
224
|
+
id?: string;
|
|
225
|
+
type: "response";
|
|
226
|
+
command: "cycle_thinking_level";
|
|
227
|
+
success: true;
|
|
228
|
+
data: {
|
|
229
|
+
level: ThinkingLevel;
|
|
230
|
+
} | null;
|
|
231
|
+
} | {
|
|
232
|
+
id?: string;
|
|
233
|
+
type: "response";
|
|
234
|
+
command: "get_available_thinking_levels";
|
|
235
|
+
success: true;
|
|
236
|
+
data: {
|
|
237
|
+
levels: ThinkingLevel[];
|
|
238
|
+
};
|
|
239
|
+
} | {
|
|
240
|
+
id?: string;
|
|
241
|
+
type: "response";
|
|
242
|
+
command: "set_steering_mode";
|
|
243
|
+
success: true;
|
|
244
|
+
} | {
|
|
245
|
+
id?: string;
|
|
246
|
+
type: "response";
|
|
247
|
+
command: "set_follow_up_mode";
|
|
248
|
+
success: true;
|
|
249
|
+
} | {
|
|
250
|
+
id?: string;
|
|
251
|
+
type: "response";
|
|
252
|
+
command: "compact";
|
|
253
|
+
success: true;
|
|
254
|
+
data: CompactionResult;
|
|
255
|
+
} | {
|
|
256
|
+
id?: string;
|
|
257
|
+
type: "response";
|
|
258
|
+
command: "set_auto_compaction";
|
|
259
|
+
success: true;
|
|
260
|
+
} | {
|
|
261
|
+
id?: string;
|
|
262
|
+
type: "response";
|
|
263
|
+
command: "set_auto_retry";
|
|
264
|
+
success: true;
|
|
265
|
+
} | {
|
|
266
|
+
id?: string;
|
|
267
|
+
type: "response";
|
|
268
|
+
command: "abort_retry";
|
|
269
|
+
success: true;
|
|
270
|
+
} | {
|
|
271
|
+
id?: string;
|
|
272
|
+
type: "response";
|
|
273
|
+
command: "bash";
|
|
274
|
+
success: true;
|
|
275
|
+
data: BashResult;
|
|
276
|
+
} | {
|
|
277
|
+
id?: string;
|
|
278
|
+
type: "response";
|
|
279
|
+
command: "abort_bash";
|
|
280
|
+
success: true;
|
|
281
|
+
} | {
|
|
282
|
+
id?: string;
|
|
283
|
+
type: "response";
|
|
284
|
+
command: "get_session_stats";
|
|
285
|
+
success: true;
|
|
286
|
+
data: SessionStats;
|
|
287
|
+
} | {
|
|
288
|
+
id?: string;
|
|
289
|
+
type: "response";
|
|
290
|
+
command: "export_html";
|
|
291
|
+
success: true;
|
|
292
|
+
data: {
|
|
293
|
+
path: string;
|
|
294
|
+
};
|
|
295
|
+
} | {
|
|
296
|
+
id?: string;
|
|
297
|
+
type: "response";
|
|
298
|
+
command: "switch_session";
|
|
299
|
+
success: true;
|
|
300
|
+
data: {
|
|
301
|
+
cancelled: boolean;
|
|
302
|
+
};
|
|
303
|
+
} | {
|
|
304
|
+
id?: string;
|
|
305
|
+
type: "response";
|
|
306
|
+
command: "fork";
|
|
307
|
+
success: true;
|
|
308
|
+
data: {
|
|
309
|
+
text: string;
|
|
310
|
+
cancelled: boolean;
|
|
311
|
+
};
|
|
312
|
+
} | {
|
|
313
|
+
id?: string;
|
|
314
|
+
type: "response";
|
|
315
|
+
command: "clone";
|
|
316
|
+
success: true;
|
|
317
|
+
data: {
|
|
318
|
+
cancelled: boolean;
|
|
319
|
+
};
|
|
320
|
+
} | {
|
|
321
|
+
id?: string;
|
|
322
|
+
type: "response";
|
|
323
|
+
command: "get_fork_messages";
|
|
324
|
+
success: true;
|
|
325
|
+
data: {
|
|
326
|
+
messages: Array<{
|
|
327
|
+
entryId: string;
|
|
328
|
+
text: string;
|
|
329
|
+
}>;
|
|
330
|
+
};
|
|
331
|
+
} | {
|
|
332
|
+
id?: string;
|
|
333
|
+
type: "response";
|
|
334
|
+
command: "get_entries";
|
|
335
|
+
success: true;
|
|
336
|
+
data: {
|
|
337
|
+
entries: SessionEntry[];
|
|
338
|
+
leafId: string | null;
|
|
339
|
+
};
|
|
340
|
+
} | {
|
|
341
|
+
id?: string;
|
|
342
|
+
type: "response";
|
|
343
|
+
command: "get_tree";
|
|
344
|
+
success: true;
|
|
345
|
+
data: {
|
|
346
|
+
tree: SessionTreeNode[];
|
|
347
|
+
leafId: string | null;
|
|
348
|
+
};
|
|
349
|
+
} | {
|
|
350
|
+
id?: string;
|
|
351
|
+
type: "response";
|
|
352
|
+
command: "get_last_assistant_text";
|
|
353
|
+
success: true;
|
|
354
|
+
data: {
|
|
355
|
+
text: string | null;
|
|
356
|
+
};
|
|
357
|
+
} | {
|
|
358
|
+
id?: string;
|
|
359
|
+
type: "response";
|
|
360
|
+
command: "set_session_name";
|
|
361
|
+
success: true;
|
|
362
|
+
} | {
|
|
363
|
+
id?: string;
|
|
364
|
+
type: "response";
|
|
365
|
+
command: "get_messages";
|
|
366
|
+
success: true;
|
|
367
|
+
data: {
|
|
368
|
+
messages: AgentMessage[];
|
|
369
|
+
};
|
|
370
|
+
} | {
|
|
371
|
+
id?: string;
|
|
372
|
+
type: "response";
|
|
373
|
+
command: "get_commands";
|
|
374
|
+
success: true;
|
|
375
|
+
data: {
|
|
376
|
+
commands: RpcSlashCommand[];
|
|
377
|
+
};
|
|
378
|
+
} | {
|
|
379
|
+
id?: string;
|
|
380
|
+
type: "response";
|
|
381
|
+
command: string;
|
|
382
|
+
success: false;
|
|
383
|
+
error: string;
|
|
384
|
+
};
|
|
385
|
+
export type RpcExtensionUIRequest = {
|
|
386
|
+
type: "extension_ui_request";
|
|
387
|
+
id: string;
|
|
388
|
+
method: "select";
|
|
389
|
+
title: string;
|
|
390
|
+
options: string[];
|
|
391
|
+
timeout?: number;
|
|
392
|
+
} | {
|
|
393
|
+
type: "extension_ui_request";
|
|
394
|
+
id: string;
|
|
395
|
+
method: "confirm";
|
|
396
|
+
title: string;
|
|
397
|
+
message: string;
|
|
398
|
+
timeout?: number;
|
|
399
|
+
} | {
|
|
400
|
+
type: "extension_ui_request";
|
|
401
|
+
id: string;
|
|
402
|
+
method: "input";
|
|
403
|
+
title: string;
|
|
404
|
+
placeholder?: string;
|
|
405
|
+
timeout?: number;
|
|
406
|
+
} | {
|
|
407
|
+
type: "extension_ui_request";
|
|
408
|
+
id: string;
|
|
409
|
+
method: "editor";
|
|
410
|
+
title: string;
|
|
411
|
+
prefill?: string;
|
|
412
|
+
} | {
|
|
413
|
+
type: "extension_ui_request";
|
|
414
|
+
id: string;
|
|
415
|
+
method: "notify";
|
|
416
|
+
message: string;
|
|
417
|
+
notifyType?: "info" | "warning" | "error";
|
|
418
|
+
} | {
|
|
419
|
+
type: "extension_ui_request";
|
|
420
|
+
id: string;
|
|
421
|
+
method: "setStatus";
|
|
422
|
+
statusKey: string;
|
|
423
|
+
statusText: string | undefined;
|
|
424
|
+
} | {
|
|
425
|
+
type: "extension_ui_request";
|
|
426
|
+
id: string;
|
|
427
|
+
method: "setWidget";
|
|
428
|
+
widgetKey: string;
|
|
429
|
+
widgetLines: string[] | undefined;
|
|
430
|
+
widgetPlacement?: "aboveEditor" | "belowEditor";
|
|
431
|
+
} | {
|
|
432
|
+
type: "extension_ui_request";
|
|
433
|
+
id: string;
|
|
434
|
+
method: "setPanel";
|
|
435
|
+
panelId: string;
|
|
436
|
+
panel?: {
|
|
437
|
+
title?: string;
|
|
438
|
+
lines?: string[];
|
|
439
|
+
placement?: "aux" | "status";
|
|
440
|
+
};
|
|
441
|
+
} | {
|
|
442
|
+
type: "extension_ui_request";
|
|
443
|
+
id: string;
|
|
444
|
+
method: "requestInput";
|
|
445
|
+
title: string;
|
|
446
|
+
placeholder?: string;
|
|
447
|
+
timeout?: number;
|
|
448
|
+
} | {
|
|
449
|
+
type: "extension_ui_request";
|
|
450
|
+
id: string;
|
|
451
|
+
method: "requestChoice";
|
|
452
|
+
title: string;
|
|
453
|
+
items: Array<{
|
|
454
|
+
id: string;
|
|
455
|
+
label: string;
|
|
456
|
+
description?: string;
|
|
457
|
+
}>;
|
|
458
|
+
timeout?: number;
|
|
459
|
+
} | {
|
|
460
|
+
type: "extension_ui_request";
|
|
461
|
+
id: string;
|
|
462
|
+
method: "setTitle";
|
|
463
|
+
title: string;
|
|
464
|
+
} | {
|
|
465
|
+
type: "extension_ui_request";
|
|
466
|
+
id: string;
|
|
467
|
+
method: "set_editor_text";
|
|
468
|
+
text: string;
|
|
469
|
+
};
|
|
470
|
+
export type RpcExtensionUIResponse = {
|
|
471
|
+
type: "extension_ui_response";
|
|
472
|
+
id: string;
|
|
473
|
+
value: string;
|
|
474
|
+
} | {
|
|
475
|
+
type: "extension_ui_response";
|
|
476
|
+
id: string;
|
|
477
|
+
confirmed: boolean;
|
|
478
|
+
} | {
|
|
479
|
+
type: "extension_ui_response";
|
|
480
|
+
id: string;
|
|
481
|
+
cancelled: true;
|
|
482
|
+
};
|
|
483
|
+
export type RpcCommandType = RpcCommand["type"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-bridge",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
21
|
+
"@dalcode/dal-pi-kit": "1.0.25",
|
|
22
22
|
"typebox": "1.3.7"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var P=Object.defineProperty;var d=(e,t)=>P(e,"name",{value:t,configurable:!0});var T=Object.defineProperty,F=d((e,t)=>T(e,"name",{value:t,configurable:!0}),"p");import{realpathSync as b,statSync as N}from"node:fs";import{extname as _,isAbsolute as O,relative as G,resolve as D}from"node:path";import{t as s}from"@dalcode/dal-pi-kit";import{Type as u}from"typebox";const z="dal:ask-user-thumbnail",S=20*1024,f=500,M=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg"]),V=u.Object({id:u.Optional(u.String({description:s("\u9009\u9879 id\uFF08\u53EF\u9009\uFF0C\u9ED8\u8BA4 o1\u3001o2\u2026\uFF09")})),label:u.String({description:s("\u9009\u9879\u540D\u79F0")}),description:u.Optional(u.String({description:s("\u9009\u9879\u8BF4\u660E")})),recommended:u.Optional(u.Boolean({description:s("\u63A8\u8350\u9879\uFF1Bchoice / swatch \u6BCF\u9898\u81F3\u5C11\u4E00\u4E2A")})),thumbnail:u.Optional(u.String({description:s("\u7F29\u7565\u56FE\uFF0C\u7531\u7CFB\u7EDF\u6309\u771F\u5B9E\u7248\u5F0F\u7ED8\u5236\uFF1Atheme:default|business|tech|warm|minimal\uFF08PPT \u4E3B\u9898\u5C01\u9762\uFF09\u3001page:hero|split|dashboard\uFF08\u9875\u9762\u5E03\u5C40\uFF09\u3001doc:report|brief|handout\uFF08\u6587\u6863\u7248\u5F0F\uFF09")})),image:u.Optional(u.String({description:s("\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55\u5185\u7684\u56FE\u7247\u8DEF\u5F84\uFF0C\u4F5C\u4E3A\u9009\u9879\u9884\u89C8")})),colors:u.Optional(u.Array(u.String(),{description:s("swatch \u8272\u677F\uFF1A2\u20135 \u4E2A #RRGGBB")})),preview:u.Optional(u.String({description:s("\u9009\u9879\u9884\u89C8")}))}),W=u.Object({id:u.Optional(u.String({description:s("\u95EE\u9898 id\uFF08\u53EF\u9009\uFF0C\u9ED8\u8BA4 q1\u3001q2\u2026\uFF09\uFF1B\u7B54\u6848\u6309\u5B83\u56DE\u4F20")})),question:u.String({description:s("\u8981\u5411\u7528\u6237\u786E\u8BA4\u7684\u95EE\u9898")}),header:u.Optional(u.String({description:s("\u95EE\u9898\u6807\u9898")})),type:u.Optional(u.Union([u.Literal("choice"),u.Literal("swatch"),u.Literal("outline"),u.Literal("slider"),u.Literal("text")],{description:s("\u9898\u578B\uFF1Achoice \u9009\u9879\uFF08\u53EF\u914D\u7F29\u7565\u56FE\uFF09/ swatch \u914D\u8272\u8272\u677F / outline \u53EF\u62D6\u62FD\u6392\u5E8F\u7684\u5927\u7EB2 / slider \u6ED1\u6746\u6570\u503C / text \u81EA\u7531\u6587\u672C\u3002\u4E0D\u586B\u65F6\u6709 options \u4E3A choice")})),required:u.Optional(u.Boolean({description:s("\u662F\u5426\u5FC5\u7B54\uFF0C\u9ED8\u8BA4\u662F")})),options:u.Optional(u.Array(V,{description:s("choice / swatch \u7684\u9009\u9879\uFF0C2\u20136 \u4E2A")})),multiSelect:u.Optional(u.Boolean()),maxSelect:u.Optional(u.Integer({minimum:1,description:s("\u591A\u9009\u65F6\u6700\u591A\u9009\u51E0\u4E2A")})),layout:u.Optional(u.Union([u.Literal("list"),u.Literal("cards")],{description:s("cards \u4E3A\u7F29\u7565\u56FE\u5361\u7247\u7F51\u683C")})),allowOther:u.Optional(u.Boolean({description:s("\u9644\u52A0\u300C\u5176\u4ED6\uFF1A___\u300D\u81EA\u586B\u9879")})),items:u.Optional(u.Array(u.Object({id:u.Optional(u.String()),text:u.String()}),{description:s("outline \u7684\u6761\u76EE\uFF08\u5982 PPT \u6BCF\u9875\u6807\u9898\uFF09\uFF0C\u6700\u591A 15 \u6761\uFF0C\u987A\u5E8F\u5373\u63A8\u8350\u987A\u5E8F")})),allowEdit:u.Optional(u.Boolean()),allowAdd:u.Optional(u.Boolean()),allowRemove:u.Optional(u.Boolean()),min:u.Optional(u.Number()),max:u.Optional(u.Number()),step:u.Optional(u.Number()),value:u.Optional(u.Number({description:s("slider \u7684\u63A8\u8350\u503C")})),unit:u.Optional(u.String()),marks:u.Optional(u.Array(u.Object({value:u.Number(),label:u.String()}))),placeholder:u.Optional(u.String()),multiline:u.Optional(u.Boolean()),maxLength:u.Optional(u.Integer({minimum:1,maximum:f}))}),H=u.Object({title:u.Optional(u.String({description:s("\u5361\u7247\u6807\u9898\uFF0C\u5982\u300C\u5F00\u59CB\u505A PPT \u524D\u786E\u8BA4 3 \u4EF6\u4E8B\u300D")})),intent:u.Optional(u.Union([u.Literal("slides"),u.Literal("document"),u.Literal("sheet"),u.Literal("page"),u.Literal("other")])),subject:u.Optional(u.String({description:s("\u4F5C\u54C1\u6807\u9898\uFF0C\u753B\u5728\u4E3B\u9898\u7F29\u7565\u56FE\u7684\u5C01\u9762\u4E0A")})),questions:u.Array(W,{minItems:1,maxItems:3,description:s("\u4E00\u6B21\u6700\u591A 3 \u4E2A\u95EE\u9898")})});class q extends Error{static{d(this,"B")}static{F(this,"AskUserInputError")}}function A(e,t){let i=s(e);for(const[o,a]of Object.entries(t))i=i.replaceAll(`{${o}}`,String(a));throw new q(i)}d(A,"h"),F(A,"fail");const Y=new Set(["svg","g","rect","circle","ellipse","line","path","polygon","polyline","text","tspan"]),Z=new Set(["xmlns","viewBox","width","height","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","d","points","transform","fill","fill-opacity","stroke","stroke-width","stroke-opacity","opacity","font-size","font-weight","font-family","text-anchor","dx","dy"]);function v(e){if(Buffer.byteLength(e,"utf8")>S||/<!|<\?|&(?!amp;|lt;|gt;|quot;|apos;|#\d+;|#x[0-9a-fA-F]+;)/.test(e))return;const t=/<\/?([A-Za-z][\w:-]*)((?:\s+[\w:-]+\s*=\s*"[^"<]*")*)\s*\/?>/g;let i=0;for(let o=t.exec(e);o!==null;o=t.exec(e)){if(e.slice(i,o.index).includes("<")||(i=o.index+o[0].length,!Y.has(o[1])))return;for(const a of o[2].matchAll(/([\w:-]+)\s*=\s*"([^"]*)"/g))if(!Z.has(a[1])||/url\s*\(|javascript:|expression\s*\(/i.test(a[2]))return}if(!e.slice(i).includes("<"))return/^\s*<svg[\s>]/.test(e)?e:void 0}d(v,"N"),F(v,"sanitizeSvg");function k(e,t){const i=G(e,t);return i===""||!i.startsWith("..")&&!O(i)}d(k,"_"),F(k,"isInside");function $(e,t){const i=O(t)?D(t):D(e,t);let o;try{o=b(i)}catch{A("\u9884\u89C8\u56FE\u7247\u4E0D\u5B58\u5728\uFF1A{path}",{path:t})}return(!k(b(e),o)||!N(o).isFile())&&A("\u9884\u89C8\u56FE\u7247\u5FC5\u987B\u662F\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55\u5185\u7684\u6587\u4EF6\uFF1A{path}",{path:t}),M.has(_(o).toLowerCase())||A("\u9884\u89C8\u56FE\u7247\u683C\u5F0F\u4E0D\u652F\u6301\uFF1A{path}",{path:t}),{kind:"image",path:o}}d($,"Q"),F($,"imagePreview");function w(e,t,i){const o=(e??"").trim().slice(0,64)||t;let a=o;for(let l=2;i.has(a);l++)a=`${o}-${l}`;return i.add(a),a}d(w,"y"),F(w,"uniqueId");function C(e,t,i,o,a,l){const r=e.options??[];(r.length<2||r.length>6)&&A("\u300C{q}\u300D\u9700\u8981 2\u20136 \u4E2A\u9009\u9879",{q:t}),r.some(n=>n.recommended===!0)||A("\u300C{q}\u300D\u6CA1\u6709\u63A8\u8350\u9879\uFF1A\u8BF7\u628A\u4F60\u63A8\u8350\u7684\u9009\u9879\u6807\u4E0A recommended: true",{q:t});const p=new Set;return r.map((n,c)=>{const m={id:w(n.id,`o${c+1}`,p),label:n.label.trim().slice(0,200)||`${c+1}`,...n.description?.trim()?{description:n.description.trim().slice(0,1e3)}:{},...n.recommended===!0?{recommended:!0}:{}};if(l){const E=n.colors??[];(E.length<2||E.length>5||!E.every(g=>/^#[0-9A-Fa-f]{6}$/.test(g)))&&A("\u300C{q}\u300D\u7684\u8272\u677F\u9009\u9879\u300C{o}\u300D\u9700\u8981 2\u20135 \u4E2A #RRGGBB \u989C\u8272",{q:t,o:m.label}),m.colors=E.map(g=>g.toUpperCase())}let h;if(n.thumbnail){const E=a(n.thumbnail.trim(),o),g=E===void 0?void 0:v(E);g!==void 0&&(h={kind:"svg",svg:g})}return!h&&n.image&&(h=$(i,n.image)),!h&&n.preview?.trim()&&(h={kind:"text",text:n.preview.slice(0,4e3)}),h&&(m.preview=h),m})}d(C,"S"),F(C,"buildOptions");function L(e){return e.type?e.type:e.options&&e.options.length>0?e.options.every(t=>(t.colors?.length??0)>0)?"swatch":"choice":e.items&&e.items.length>0?"outline":e.value!==void 0&&e.min!==void 0&&e.max!==void 0?"slider":"text"}d(L,"C"),F(L,"inferType");function j(e,t,i,o,a){switch(L(e)){case"choice":{const l=C(e,t,i,o,a,!1),r=e.multiSelect===!0;e.maxSelect!==void 0&&(!r||e.maxSelect>l.length)&&A("\u300C{q}\u300D\u7684 maxSelect \u53EA\u7528\u4E8E\u591A\u9009\uFF0C\u4E14\u4E0D\u80FD\u8D85\u8FC7\u9009\u9879\u6570",{q:t});const p=l.some(c=>c.preview?.kind==="svg"||c.preview?.kind==="image"),n=e.layout??(p?"cards":void 0);return{type:"choice",...r?{multi:!0}:{},...e.maxSelect!==void 0?{max:e.maxSelect}:{},...n?{layout:n}:{},options:l}}case"swatch":return{type:"swatch",options:C(e,t,i,o,a,!0)};case"outline":{const l=(e.items??[]).filter(p=>p.text.trim()!=="");(l.length<1||l.length>15)&&A("\u300C{q}\u300D\u7684\u5927\u7EB2\u9700\u8981 1\u201315 \u6761",{q:t});const r=new Set;return{type:"outline",items:l.map((p,n)=>({id:w(p.id,`i${n+1}`,r),text:p.text.trim().slice(0,500)})),allowEdit:e.allowEdit??!0,allowAdd:e.allowAdd??!0,allowRemove:e.allowRemove??!0}}case"slider":{const{min:l,max:r,value:p}=e,n=e.step??1;return(l===void 0||r===void 0||p===void 0)&&A("\u300C{q}\u300D\u7684\u6ED1\u6746\u9700\u8981 min\u3001max \u548C\u63A8\u8350\u503C value",{q:t}),(!(l<r)||!(n>0)||p<l||p>r)&&A("\u300C{q}\u300D\u7684\u6ED1\u6746\u53D6\u503C\u4E0D\u5408\u7406\uFF1A\u9700\u8981 min < max\u3001step > 0\u3001min \u2264 value \u2264 max",{q:t}),{type:"slider",min:l,max:r,step:n,value:p,...e.unit?{unit:e.unit.slice(0,16)}:{},...e.marks&&e.marks.length>0?{marks:e.marks.filter(c=>c.value>=l&&c.value<=r).slice(0,11).map(c=>({value:c.value,label:c.label.slice(0,40)}))}:{}}}default:return{type:"text",...e.placeholder?{placeholder:e.placeholder.slice(0,200)}:{},...e.multiline?{multiline:!0}:{},maxLength:Math.min(e.maxLength??f,f)}}}d(j,"G"),F(j,"buildControl");function U(e,t,i){(e.questions.length<1||e.questions.length>3)&&A("\u4E00\u6B21\u53EA\u80FD\u95EE 1\u20133 \u4E2A\u95EE\u9898",{});const o=new Set,a=e.subject?.trim()||void 0,l=e.questions.map((r,p)=>{const n=r.question.trim().slice(0,500);n===""&&A("\u7B2C {n} \u4E2A\u95EE\u9898\u662F\u7A7A\u7684",{n:p+1});const c=r.header?.trim().slice(0,60)||void 0,m=j(r,c??n,t,a,i),h=m.type==="choice"||m.type==="swatch";return{id:w(r.id,`q${p+1}`,o),question:n,...c?{header:c}:{},...r.required===!1?{required:!1}:{},control:m,...h&&r.allowOther?{allowOther:!0}:{},options:h?m.options.map(E=>({label:E.label,description:E.description??E.label,...E.preview?.kind==="text"?{preview:E.preview.text}:{}})):[],multiSelect:m.type==="choice"&&m.multi===!0}});return{version:2,...e.intent?{intent:e.intent}:{},...e.title?.trim()?{title:e.title.trim().slice(0,120)}:{},questions:l}}d(U,"Z"),F(U,"buildAskUserRequest");function x(e,t){const i=e.type==="choice"||e.type==="swatch"?e.options:[];return t.map(o=>i.find(a=>a.id===o)?.label??o).join(", ")}d(x,"k"),F(x,"labelsFor");function y(e){return e.map((t,i)=>`${i+1}. ${t.text}`).join(" ")}d(y,"A"),F(y,"numbered");function B(e){const t=e.control;switch(t.type){case"choice":case"swatch":return x(t,t.options.filter(i=>i.recommended).map(i=>i.id));case"outline":return y(t.items);case"slider":return`${t.value}${t.unit??""}`;default:return}}d(B,"V"),F(B,"recommendedAnswer");function R(e,t){return"choice"in t?x(e.control,t.choice):"other"in t?`${s("\u5176\u4ED6\uFF1A")}${t.other}`:"outline"in t?y(t.outline):"value"in t?`${t.value}${e.control.type==="slider"?e.control.unit??"":""}`:"text"in t?t.text:""}d(R,"M"),F(R,"answerText");function I(e,t){const i=[],o=[],a=[],l=t.structured?.answers;if(l)for(const n of e.questions){const c=n.header??n.question,m=l[n.id];if(!m||"skipped"in m){const h=B(n);o.push(c),a.push(`- ${c}: ${h??"(no recommendation, your call)"}`),i.push(`- ${c}: ${h?`${h} (skipped \u2192 recommended)`:"(skipped \u2192 your call)"}`);continue}i.push(`- ${c}: ${R(n,m)}`)}else for(const[n,c]of Object.entries(t.answers??{}))i.push(`- ${n}: ${c}`);const r=t.summary?.trim();let p=r?`User answers: ${r}${a.length>0?`
|
|
2
|
+
Recommended options for the skipped questions:
|
|
3
|
+
${a.join(`
|
|
4
|
+
`)}`:""}`:`User answers:
|
|
5
|
+
${i.join(`
|
|
6
|
+
`)}`;return o.length>0?p+=o.length===e.questions.length?`
|
|
7
|
+
|
|
8
|
+
The user chose "skip, you decide". Continue with the recommended options and tell the user in one sentence which ones you used. Do not ask again.`:`
|
|
9
|
+
|
|
10
|
+
For the skipped questions, continue with the recommended option and mention it in one sentence in your reply.`:p+=`
|
|
11
|
+
|
|
12
|
+
Proceed with these choices. Do not ask again for this task.`,{text:p,skipped:o}}d(I,"J"),F(I,"describeAnswers");export{q as AskUserInputError,S as SVG_PREVIEW_MAX_BYTES,z as THUMBNAIL_CHANNEL,H as askUserSchema,U as buildAskUserRequest,I as describeAnswers,B as recommendedAnswer,v as sanitizeSvg};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var I=Object.defineProperty;var r=(t,e)=>I(t,"name",{value:e,configurable:!0});var d=Object.defineProperty,i=r((t,e)=>d(t,"name",{value:e,configurable:!0}),"s");const m=15e4,g="DALCODE_BRIDGE_ASK_USER_TIMEOUT_MS",p="DALCODE_BRIDGE_PLAN_TIMEOUT_MS";function E(t,e,n){const s=Number(t[e]);return Number.isFinite(s)&&s>0?s:n}r(E,"a"),i(E,"timeoutFromEnv");function _(t=process.env){return E(t,g,33e4)}r(_,"A"),i(_,"askUserTimeoutMs");function u(t=process.env){return E(t,p,66e4)}r(u,"N"),i(u,"planTimeoutMs");function A(t=process.env){const e=t.DALCODE_BRIDGE_URL,n=t.DALCODE_BRIDGE_TOKEN;if(!(!e||!n))return{baseUrl:e.replace(/\/+$/,""),token:n}}r(A,"I"),i(A,"readBridgeConfig");const D="DALCODE_PARENT_SESSION_ID",T="DALCODE_PARENT_TASK_ID",N="DALCODE_SUBAGENT_ID",S="DALCODE_PARENT_SUBAGENT_ID",l="DALCODE_SUBAGENT_LABEL";function f(t=process.env){const e=t[D],n=t[N];if(!e||!n)return;const s=t[T],o=t[S],a=t[l];return{parentSessionId:e,subagentId:n,...s?{parentTaskId:s}:{},...o?{parentSubagentId:o}:{},...a?{label:a}:{}}}r(f,"b"),i(f,"readSubagentAttribution");class b{static{r(this,"D")}static{i(this,"BridgeClient")}config;fetchImpl;constructor(e,n=(s,o)=>fetch(s,o)){this.config=e,this.fetchImpl=n}async post(e,n,s={}){const o=new AbortController,a=setTimeout(()=>o.abort(),s.timeoutMs??15e4);try{const c=await this.fetchImpl(`${this.config.baseUrl}${e}`,{method:"POST",headers:{"content-type":"application/json","x-dal-bridge-token":this.config.token},body:JSON.stringify(n),signal:o.signal});return c.ok?await c.json():void 0}catch{return}finally{clearTimeout(a)}}}export{b as BridgeClient,D as PARENT_SESSION_ENV,S as PARENT_SUBAGENT_ENV,T as PARENT_TASK_ENV,N as SUBAGENT_ID_ENV,l as SUBAGENT_LABEL_ENV,_ as askUserTimeoutMs,u as planTimeoutMs,A as readBridgeConfig,f as readSubagentAttribution};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var y=Object.defineProperty;var c=(n,p)=>y(n,"name",{value:p,configurable:!0});var S=Object.defineProperty,d=c((n,p)=>S(n,"name",{value:p,configurable:!0}),"l");import{t as e}from"@dalcode/dal-pi-kit";import{Type as i}from"typebox";import{AskUserInputError as _,askUserSchema as x,buildAskUserRequest as I,describeAnswers as T,THUMBNAIL_CHANNEL as P}from"./ask-user.js";import{askUserTimeoutMs as N,BridgeClient as $,planTimeoutMs as M,readBridgeConfig as U,readSubagentAttribution as O}from"./client.js";const q=i.Object({goal:i.String({description:e("\u8FD9\u4E2A\u8BA1\u5212\u8981\u8FBE\u6210\u4EC0\u4E48\uFF0C\u4E00\u53E5\u8BDD\u8BF4\u660E")}),reasoning:i.Optional(i.String({description:e("\u4E3A\u4EC0\u4E48\u9009\u8FD9\u4E2A\u65B9\u6848")})),steps:i.Array(i.Object({title:i.String({description:e("\u8FD9\u4E00\u6B65\u505A\u4EC0\u4E48")}),description:i.Optional(i.String({description:e("\u8FD9\u4E00\u6B65\u7684\u7EC6\u8282")}))}),{description:e("\u6309\u987A\u5E8F\u6392\u5217\u7684\u6267\u884C\u6B65\u9AA4")})}),L=new Set(["read","grep","ripgrep","find","fd","ls","glob","todo_read","todo","lsp"]),j="submit_plan",f="ask_user";function g(n){const p=n.input;for(const D of["command","file_path","path","filePath"]){const F=p[D];if(typeof F=="string"&&F.length>0)return F}}c(g,"q"),d(g,"ruleContentFor");function k(n,p){const D=U();if(!D)return;const F=new $(D,p),a=O();function B(t){const u=t.sessionManager.getSessionId();return a?{sessionId:a.parentSessionId,subagent:{id:a.subagentId,sessionId:u,...a.parentTaskId?{parentTaskId:a.parentTaskId}:{},...a.parentSubagentId?{parentSubagentId:a.parentSubagentId}:{},...a.label?{label:a.label}:{}}}:{sessionId:u}}c(B,"b"),d(B,"caller");let s,m=0;function C(t){const u=t.model;return{provider:u?.provider??"unknown",model:u?.id??u?.name??"unknown"}}c(C,"x"),d(C,"describeModel"),n.on("tool_call",async(t,u)=>{if(L.has(t.toolName)||t.toolName===j||t.toolName===f)return;const o=await F.post("/api/internal/pi-bridge/permission",{...B(u),toolName:t.toolName,toolInput:t.input,ruleContent:g(t)});if(!o)return{block:!0,reason:e("dal-bridge\uFF1A\u65E0\u6CD5\u8054\u7CFB DAL Code \u53D6\u5F97\u6388\u6743\uFF0C\u5DF2\u62D2\u7EDD\u6267\u884C\u3002")};if(o.decision==="deny")return{block:!0,reason:o.message??e("dal-bridge\uFF1A\u7528\u6237\u5DF2\u62D2\u7EDD\u8BE5\u64CD\u4F5C\u3002")}}),n.on("after_provider_response",(t,u)=>{t.status>=400?s={...C(u),reason:`HTTP ${t.status}`}:(s=void 0,m=0)}),n.on("before_provider_request",async(t,u)=>{if(!s)return;const o=C(u);if(o.provider===s.provider&&o.model===s.model)return;m+=1;const l={provider:s.provider,model:s.model},A=s.reason;s=void 0,await F.post("/api/internal/pi-bridge/provider-fallback",{...B(u),from:l,to:o,reason:A,attempt:m,blocked:!0});const r=new Error(e("dal-bridge\uFF1A\u8BF7\u6C42\u5931\u8D25\u540E\u4E0D\u5141\u8BB8\u81EA\u52A8\u6362\u6A21\u578B\u3002")+` ${l.provider}/${l.model} \u2192 ${o.provider}/${o.model} (${A})`);throw r.name="ProviderSwapAborted",r}),n.registerTool({name:"submit_plan",label:e("\u63D0\u4EA4\u8BA1\u5212\u5F85\u5BA1\u6279"),description:e(e("\u5728\u52A8\u624B\u6539\u52A8\u4E4B\u524D\uFF0C\u628A\u8BA1\u5212\u63D0\u4EA4\u7ED9\u7528\u6237\u5BA1\u6279\u3002\u8FD4\u56DE\u662F\u5426\u7EE7\u7EED\u6267\u884C\uFF0C\u4EE5\u53CA\u7528\u6237\u7ED9\u51FA\u7684\u53CD\u9988\u3002")+e("\u5F53\u4EFB\u52A1\u662F\u591A\u6B65\u9AA4\u7684\u3001\u6216\u4F1A\u6539\u52A8\u591A\u4E2A\u6587\u4EF6\u65F6\u4F7F\u7528\u3002")),promptSnippet:e("submit_plan - \u591A\u6B65\u9AA4\u4EFB\u52A1\u52A8\u624B\u524D\u5148\u63D0\u4EA4\u8BA1\u5212\u5F85\u7528\u6237\u5BA1\u6279"),parameters:q,execute:d(async(t,u,o,l,A)=>{const r=await F.post("/api/internal/pi-bridge/plan",{...B(A),goal:u.goal,reasoning:u.reasoning,steps:u.steps},{timeoutMs:M()});return!r||r.decision==="cancel"?{content:[{type:"text",text:r?.feedback?`Plan not approved. User feedback: ${r.feedback}`:"Plan not approved. Stop and wait for further instructions."}],details:{approved:!1,...r?.feedback?{feedback:r.feedback}:{}}}:{content:[{type:"text",text:"Plan approved. Proceed with the steps."}],details:{approved:!0}}},"execute")});const v=d((t,u)=>{let o;return n.events.emit(P,{ref:t,...u!==void 0?{title:u}:{},reply:d(l=>{o=l},"reply")}),o},"resolveThumbnail");n.registerTool({name:f,label:e("\u8BE2\u95EE\u7528\u6237"),description:e("\u52A8\u624B\u505A PPT\u3001\u6587\u6863\u3001\u8868\u683C\u3001\u9875\u9762\u4E4B\u524D\uFF0C\u7528\u4E00\u5F20\u5361\u7247\u5411\u7528\u6237\u786E\u8BA4\u4F1A\u6539\u53D8\u4EA7\u51FA\u7684\u5173\u952E\u51B3\u5B9A\uFF08\u6700\u591A 3 \u9898\uFF09\u3002\u9898\u578B\uFF1Achoice \u9009\u9879\uFF08\u53EF\u5E26\u7F29\u7565\u56FE\uFF09\u3001swatch \u914D\u8272\u3001outline \u53EF\u6392\u5E8F\u5927\u7EB2\u3001slider \u6570\u503C\u3001text \u81EA\u7531\u6587\u672C\u3002\u6BCF\u9898\u90FD\u8981\u6709\u63A8\u8350\u9879\u3002"),promptSnippet:e("ask_user - \u5F00\u5DE5\u524D\u7528\u4E00\u5F20\u5361\u7247\u786E\u8BA4\u5173\u952E\u51B3\u5B9A\uFF08\u6700\u591A 3 \u9898\uFF0C\u6BCF\u9898\u6709\u63A8\u8350\u9879\uFF09"),promptGuidelines:[e("ask_user \u53EA\u5728\u5F00\u5DE5\u524D\u95EE\u4E00\u6B21\uFF0C\u4E00\u8F6E\u6700\u591A 3 \u9898\uFF1B\u540C\u4E00\u4EFB\u52A1\u4E4B\u540E\u4E0D\u518D\u8FFD\u95EE\uFF0C\u9664\u975E\u7528\u6237\u4E3B\u52A8\u8981\u6C42\u3002"),e("\u53EA\u95EE\u4F1A\u6539\u53D8\u4EA7\u51FA\u7684\u51B3\u5B9A\uFF08\u53D7\u4F17/\u7528\u9014\u3001\u98CE\u683C\u6216\u4E3B\u9898\u3001\u7BC7\u5E45\u3001\u5927\u7EB2\u987A\u5E8F\uFF09\uFF1B\u80FD\u4ECE\u7528\u6237\u539F\u8BDD\u3001\u9644\u4EF6\u6216\u9879\u76EE\u6587\u4EF6\u63A8\u65AD\u51FA\u7684\u4E0D\u95EE\u3002"),e("\u7528\u6237\u8BF4\u4E86\u300C\u76F4\u63A5\u505A / \u4F60\u51B3\u5B9A / \u5FEB\u901F\u51FA\u4E00\u7248\u300D\uFF0C\u6216\u662F\u5728\u4FEE\u6539\u5DF2\u6709\u6587\u4EF6\uFF08\u5E26\u5B9A\u4F4D\u3001\u300C\u628A\u7B2C 3 \u9875\u6539\u6210\u2026\u300D\uFF09\u65F6\uFF0C\u4E0D\u8981\u8C03\u7528 ask_user\u3002"),e("\u6BCF\u9898\u90FD\u6807\u51FA\u63A8\u8350\u9879\uFF08recommended\uFF09\uFF1B\u98CE\u683C\u9898\u4F18\u5148\u7528 thumbnail \u7F29\u7565\u56FE\uFF08theme:\u2026 / page:\u2026 / doc:\u2026\uFF09\uFF0C\u914D\u8272\u7528 swatch\u3002"),e("\u7528\u6237\u8DF3\u8FC7\u65F6\u6309\u63A8\u8350\u9879\u7EE7\u7EED\uFF0C\u5E76\u5728\u56DE\u590D\u91CC\u7528\u4E00\u53E5\u8BDD\u8BF4\u660E\u7528\u4E86\u54EA\u4E9B\u63A8\u8350\u9879\u3002")],parameters:x,execute:d(async(t,u,o,l,A)=>{let r;try{r=I(u,A.cwd,v)}catch(b){throw b instanceof _?new Error(`ask_user: ${b.message}`):b}const E=await F.post("/api/internal/pi-bridge/ask-user",{...B(A),...r},{timeoutMs:N()});if(!E||E.cancelled)return{content:[{type:"text",text:"User did not answer. Stop and wait for further instructions."}],details:{answered:!1,request:r}};const{text:w,skipped:h}=T(r,E);return{content:[{type:"text",text:w}],details:{answered:!0,answers:E.answers??{},...E.structured?{structured:E.structured}:{},...E.summary?{summary:E.summary}:{},skipped:h,request:r}}},"execute")})}c(k,"F"),d(k,"default");export{k as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-gateway",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@dalcode/deepailab": "1.0.
|
|
20
|
+
"@dalcode/deepailab": "1.0.25"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var D=Object.defineProperty;var s=(o,t)=>D(o,"name",{value:t,configurable:!0});var E=Object.defineProperty,c=s((o,t)=>E(o,"name",{value:t,configurable:!0}),"s");import{gatewayModelDefaults as _,restoreCatalog as b,toCatalogStoreEntry as v}from"@dalcode/deepailab/model-defaults";const p="dalcode-gateway",T=2e4;function u(){const o=process.env.DALCODE_GATEWAY_URL;return o!==void 0&&o.length>0?o.replace(/\/+$/,""):void 0}s(u,"w"),c(u,"gatewayBaseUrl");function w(o){const t=u();if(t===void 0)return;m(t);let a=[],r=0;o.registerProvider(p,{name:"DAL Code Gateway",baseUrl:t,apiKey:"$DALCODE_GATEWAY_TOKEN",api:"openai-completions",models:[],refreshModels:c(async({credential:e,allowNetwork:n,signal:l,stored:f,publish:A})=>{const g=f?.checkedAt??0;if(g>r){const i=b(f);i.length>0&&(a=i,r=g)}const h=e?.type==="api_key"?e.key:void 0;if(!n||!h)return a;const d=await y(t,h,l);if(d.length>0){const i=v(p,d,t);a=d,r=i.checkedAt??Date.now();try{await A({persist:i})}catch{}}return a},"refreshModels")})}s(w,"b"),c(w,"default");async function y(o,t,a){let r;try{r=await fetch(`${o}/models`,{headers:{Authorization:`Bearer ${t}`,Accept:"application/json"},signal:AbortSignal.any([a,AbortSignal.timeout(T)])})}catch(e){const n=e instanceof Error&&(e.name==="AbortError"||e.name==="TimeoutError");throw new Error(`DAL Code gateway: could not load the model catalog (${n?"timed out":String(e)}).`)}if(!r.ok)throw new Error(`DAL Code gateway: the model catalog request was rejected (HTTP ${r.status}).`);return((await r.json()).data??[]).filter(e=>typeof e.id=="string"&&e.id.length>0).map(e=>_(e.id,e.display_name??e.name,{contextWindow:e.context_window,maxTokens:e.max_output_tokens,capabilities:e.capabilities,reasoningEfforts:e.reasoning_efforts,pricing:e.pricing}))}s(y,"E"),c(y,"fetchCatalog");function m(o){const t=globalThis.fetch.bind(globalThis);globalThis.fetch=(a,r)=>{if(!(typeof a=="string"?a:a instanceof URL?a.href:a.url).startsWith(o))return t(a,r);const e=new Headers(r?.headers),n=process.env.DALCODE_TASK_ID,l=process.env.DALCODE_SESSION_ID;return n&&e.set("x-dal-task-id",n),l&&e.set("x-dal-session-id",l),t(a,{...r,headers:e})}}s(m,"D"),c(m,"installMeteringHeaders");export{w as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-guard",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -13,13 +13,14 @@
|
|
|
13
13
|
],
|
|
14
14
|
"pi": {
|
|
15
15
|
"extensions": [
|
|
16
|
+
"./src/hooks.js",
|
|
16
17
|
"./src/index.js"
|
|
17
18
|
]
|
|
18
19
|
},
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
21
|
-
"@dalcode/dal-bridge": "1.0.
|
|
22
|
-
"@dalcode/dal-halo": "1.0.
|
|
21
|
+
"@dalcode/dal-pi-kit": "1.0.25",
|
|
22
|
+
"@dalcode/dal-bridge": "1.0.25",
|
|
23
|
+
"@dalcode/dal-halo": "1.0.25"
|
|
23
24
|
},
|
|
24
25
|
"peerDependencies": {
|
|
25
26
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{dalHooksExtension as o}from"@earendil-works/pi-coding-agent";export{o as default};
|