dal-code 1.0.24 → 1.0.26
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 +42 -0
- package/NOTICE +7 -0
- package/dal-docs/README.md +109 -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 +59 -0
- package/dist/cli/args.js +14 -14
- 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 +50 -0
- package/dist/core/agent-session-services.js +1 -1
- package/dist/core/agent-session.d.ts +422 -0
- package/dist/core/agent-session.js +8 -7
- package/dist/core/auth-storage.d.ts +56 -0
- package/dist/core/background-processes.d.ts +73 -0
- package/dist/core/background-processes.js +7 -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 +1003 -0
- package/dist/core/extensions/wrapper.d.ts +5 -0
- package/dist/core/footer-data-provider.d.ts +46 -0
- package/dist/core/host-capabilities.d.ts +50 -0
- package/dist/core/host-capabilities.js +2 -0
- package/dist/core/keybindings.d.ts +525 -0
- 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/permissions/rules.d.ts +45 -0
- package/dist/core/permissions/rules.js +1 -0
- package/dist/core/permissions/shell-words.js +2 -0
- package/dist/core/permissions/tool-policy.d.ts +46 -0
- package/dist/core/permissions/tool-policy.js +1 -0
- 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/sandbox/availability.d.ts +9 -0
- package/dist/core/sandbox/availability.js +1 -0
- package/dist/core/sandbox/denial.d.ts +25 -0
- package/dist/core/sandbox/denial.js +3 -0
- package/dist/core/sandbox/index.d.ts +5 -0
- package/dist/core/sandbox/index.js +1 -0
- package/dist/core/sandbox/policy.d.ts +66 -0
- package/dist/core/sandbox/policy.js +1 -0
- package/dist/core/sandbox/runtime.d.ts +31 -0
- package/dist/core/sandbox/runtime.js +1 -0
- package/dist/core/sandbox/shell-sandbox.d.ts +119 -0
- package/dist/core/sandbox/shell-sandbox.js +5 -0
- package/dist/core/sdk.d.ts +43 -0
- package/dist/core/sdk.js +1 -1
- package/dist/core/session-manager.d.ts +208 -0
- package/dist/core/settings-manager.d.ts +368 -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 +89 -0
- package/dist/core/tools/bash.js +16 -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/find.js +11 -11
- package/dist/core/tools/grep.d.ts +34 -0
- package/dist/core/tools/grep.js +10 -10
- package/dist/core/tools/index.d.ts +43 -0
- package/dist/core/tools/index.js +1 -1
- package/dist/core/tools/ls.d.ts +33 -0
- package/dist/core/tools/ls.js +6 -6
- package/dist/core/tools/powershell.d.ts +17 -0
- package/dist/core/tools/powershell.js +2 -2
- package/dist/core/tools/process.d.ts +26 -0
- package/dist/core/tools/process.js +22 -0
- package/dist/core/tools/read.d.ts +33 -0
- package/dist/core/tools/read.js +15 -15
- 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/builtins.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/manifest.d.ts +32 -0
- package/dist/dal/manifest.js +1 -0
- package/dist/dal/safety-net.js +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +1 -1
- package/dist/main.d.ts +9 -0
- package/dist/main.js +4 -4
- 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/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/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/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/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/print-mode.js +6 -4
- package/dist/modes/rpc/rpc-client.d.ts +142 -0
- package/dist/modes/rpc/rpc-client.js +4 -1
- package/dist/modes/rpc/rpc-mode.d.ts +3 -0
- package/dist/modes/rpc/rpc-mode.js +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +565 -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-interactive/LICENSE +21 -0
- package/dist/node_modules/@dalcode/dal-interactive/package.json +33 -0
- package/dist/node_modules/@dalcode/dal-interactive/src/handoff.js +28 -0
- package/dist/node_modules/@dalcode/dal-interactive/src/index.js +1 -0
- package/dist/node_modules/@dalcode/dal-interactive/src/interactive-shell.js +1 -0
- package/dist/node_modules/@dalcode/dal-interactive/src/questionnaire.js +3 -0
- 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-review/LICENSE +21 -0
- package/dist/node_modules/@dalcode/dal-review/package.json +34 -0
- package/dist/node_modules/@dalcode/dal-review/src/args.d.ts +13 -0
- package/dist/node_modules/@dalcode/dal-review/src/args.js +1 -0
- package/dist/node_modules/@dalcode/dal-review/src/core.d.ts +6 -0
- package/dist/node_modules/@dalcode/dal-review/src/core.js +1 -0
- package/dist/node_modules/@dalcode/dal-review/src/findings.d.ts +23 -0
- package/dist/node_modules/@dalcode/dal-review/src/findings.js +4 -0
- package/dist/node_modules/@dalcode/dal-review/src/index.js +1 -0
- package/dist/node_modules/@dalcode/dal-review/src/prompt.d.ts +3 -0
- package/dist/node_modules/@dalcode/dal-review/src/prompt.js +29 -0
- package/dist/node_modules/@dalcode/dal-review/src/runner.d.ts +91 -0
- package/dist/node_modules/@dalcode/dal-review/src/runner.js +2 -0
- package/dist/node_modules/@dalcode/dal-review/src/targets.d.ts +33 -0
- package/dist/node_modules/@dalcode/dal-review/src/targets.js +17 -0
- package/dist/node_modules/@dalcode/dal-review/src/types.d.ts +94 -0
- package/dist/node_modules/@dalcode/dal-review/src/types.js +1 -0
- 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/config.d.ts +50 -0
- 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-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/agents.js +2 -2
- package/dist/node_modules/@dalcode/dal-subagent/src/index.js +12 -12
- 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-terminal/LICENSE +21 -0
- package/dist/node_modules/@dalcode/dal-terminal/package.json +33 -0
- package/dist/node_modules/@dalcode/dal-terminal/src/contract.d.ts +60 -0
- package/dist/node_modules/@dalcode/dal-terminal/src/contract.js +7 -0
- package/dist/node_modules/@dalcode/dal-terminal/src/index.js +6 -0
- 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-web/src/config.js +2 -2
- package/dist/node_modules/@dalcode/dal-web/src/index.js +4 -4
- package/dist/node_modules/@dalcode/dal-web/src/search.js +4 -4
- package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/index.js +4 -4
- package/dist/node_modules/@dalcode/dal-workflow/src/plan-mode.js +13 -13
- 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 +11 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +1 -1
- 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 +18 -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/review.d.ts +1 -0
- package/dist/sdk/review.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/sdk/subagents.d.ts +8 -0
- package/dist/sdk/subagents.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/index.ts +6 -0
- 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 +75 -5
- package/package.json +27 -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
|
@@ -1 +1 @@
|
|
|
1
|
-
var P=Object.defineProperty;var i=(l,o)=>P(l,"name",{value:o,configurable:!0});import*as p from"node:crypto";import{resolveExtensionNotify as A}from"../../core/extensions/index.js";import{flushRawStdout as D,takeOverStdout as B,waitForRawStdoutBackpressure as _,writeRawStdout as N}from"../../core/output-guard.js";import{killTrackedDetachedChildren as $}from"../../utils/shell.js";import{theme as J}from"../interactive/theme/theme.js";import{toJsonEvent as W}from"../json-event.js";import{attachJsonlLineReader as G,serializeJsonLine as z}from"./jsonl.js";async function V(l){B();let o=l.session,h,w;const a=i(e=>{N(z(e))},"output"),r=i((e,t,s)=>s===void 0?{id:e,type:"response",command:t,success:!0}:{id:e,type:"response",command:t,success:!0,data:s},"success"),d=i((e,t,s)=>({id:e,type:"response",command:t,success:!1,error:s}),"error"),m=new Map;let b=!1,I=!1;const k=[];function g(e,t,s,n){if(e?.signal?.aborted)return Promise.resolve(t);const c=p.randomUUID();return new Promise((u,L)=>{let x;const v=i(()=>{x&&clearTimeout(x),e?.signal?.removeEventListener("abort",C),m.delete(c)},"cleanup"),C=i(()=>{v(),u(t)},"onAbort");e?.signal?.addEventListener("abort",C,{once:!0}),e?.timeout&&(x=setTimeout(()=>{v(),u(t)},e.timeout)),m.set(c,{resolve:i(F=>{v(),u(n(F))},"resolve"),reject:L}),a({type:"extension_ui_request",id:c,...s})})}i(g,"createDialogPromise");const U=i(()=>({select:i((e,t,s)=>g(s,void 0,{method:"select",title:e,options:t,timeout:s?.timeout},n=>"cancelled"in n&&n.cancelled?void 0:"value"in n?n.value:void 0),"select"),confirm:i((e,t,s)=>g(s,!1,{method:"confirm",title:e,message:t,timeout:s?.timeout},n=>"cancelled"in n&&n.cancelled?!1:"confirmed"in n?n.confirmed:!1),"confirm"),input:i((e,t,s)=>g(s,void 0,{method:"input",title:e,placeholder:t,timeout:s?.timeout},n=>"cancelled"in n&&n.cancelled?void 0:"value"in n?n.value:void 0),"input"),notify(e,t){const s=A(e,t);a({type:"extension_ui_request",id:p.randomUUID(),method:"notify",message:s.message,notifyType:s.type})},setPanel(e,t){a({type:"extension_ui_request",id:p.randomUUID(),method:"setPanel",panelId:e,panel:t})},requestInput:i(e=>g(e,void 0,{method:"requestInput",title:e.title,placeholder:e.placeholder,timeout:e.timeout},t=>"cancelled"in t&&t.cancelled?void 0:"value"in t?t.value:void 0),"requestInput"),requestChoice:i(e=>g(e,void 0,{method:"requestChoice",title:e.title,items:e.items,timeout:e.timeout},t=>"cancelled"in t&&t.cancelled?void 0:"value"in t?t.value:void 0),"requestChoice"),onTerminalInput(){return()=>{}},setStatus(e,t){a({type:"extension_ui_request",id:p.randomUUID(),method:"setStatus",statusKey:e,statusText:t})},setWorkingMessage(e){},setWorkingVisible(e){},setWorkingIndicator(e){},setHiddenThinkingLabel(e){},setWidget(e,t,s){(t===void 0||Array.isArray(t))&&a({type:"extension_ui_request",id:p.randomUUID(),method:"setWidget",widgetKey:e,widgetLines:t,widgetPlacement:s?.placement})},setFooter(e){},setHeader(e){},setTitle(e){a({type:"extension_ui_request",id:p.randomUUID(),method:"setTitle",title:e})},async custom(){},pasteToEditor(e){this.setEditorText(e)},setEditorText(e){a({type:"extension_ui_request",id:p.randomUUID(),method:"set_editor_text",text:e})},getEditorText(){return""},async editor(e,t){const s=p.randomUUID();return new Promise((n,c)=>{m.set(s,{resolve:i(u=>{"cancelled"in u&&u.cancelled?n(void 0):"value"in u?n(u.value):n(void 0)},"resolve"),reject:c}),a({type:"extension_ui_request",id:s,method:"editor",title:e,prefill:t})})},addAutocompleteProvider(){},setEditorComponent(){},getEditorComponent(){},get theme(){return J},getAllThemes(){return[]},getTheme(e){},setTheme(e){return{success:!1,error:"Theme switching not supported in RPC mode"}},getToolsExpanded(){return!1},setToolsExpanded(e){}}),"createExtensionUIContext");l.setRebindSession(async()=>{await f()});const f=i(async()=>{o=l.session,await o.bindExtensions({uiContext:U(),mode:"rpc",commandContextActions:{waitForIdle:i(()=>o.waitForIdle(),"waitForIdle"),newSession:i(async e=>l.newSession(e),"newSession"),fork:i(async(e,t)=>({cancelled:(await l.fork(e,t)).cancelled}),"fork"),navigateTree:i(async(e,t)=>({cancelled:(await o.navigateTree(e,{summarize:t?.summarize,customInstructions:t?.customInstructions,replaceInstructions:t?.replaceInstructions,label:t?.label})).cancelled}),"navigateTree"),switchSession:i(async(e,t)=>l.switchSession(e,t),"switchSession"),reload:i(async()=>{await o.reload()},"reload")},shutdownHandler:i(()=>{b=!0},"shutdownHandler"),onError:i(e=>{a({type:"extension_error",extensionPath:e.extensionPath,event:e.event,error:e.error})},"onError")}),h?.(),w?.(),h=o.subscribe(e=>{a(W(e)),e.type==="agent_settled"&&T()}),w=o.agent.subscribe(async()=>{await _()})},"rebindSession"),M=i(()=>{const e=["SIGTERM"];process.platform!=="win32"&&e.push("SIGHUP");for(const t of e){const s=i(()=>{$(),y(t==="SIGHUP"?129:143,t)},"handler");process.on(t,s),k.push(()=>process.off(t,s))}},"registerSignalHandlers");await f(),M();const R=i(async e=>{const t=e.id;switch(e.type){case"prompt":{let s=!1;o.prompt(e.message,{images:e.images,streamingBehavior:e.streamingBehavior,source:"rpc",preflightResult:i(n=>{n&&(s=!0,a(r(t,"prompt")))},"preflightResult")}).catch(n=>{s||a(d(t,"prompt",n.message))});return}case"steer":return await o.steer(e.message,e.images,{source:"rpc"}),r(t,"steer");case"follow_up":return await o.followUp(e.message,e.images,{source:"rpc"}),r(t,"follow_up");case"abort":return await o.abort(),r(t,"abort");case"clear_queue":return r(t,"clear_queue",o.clearQueue());case"new_session":{const s=e.parentSession?{parentSession:e.parentSession}:void 0,n=await l.newSession(s);return n.cancelled||await f(),r(t,"new_session",n)}case"get_state":{const s={model:o.model,thinkingLevel:o.thinkingLevel,isStreaming:o.isStreaming,isCompacting:o.isCompacting,steeringMode:o.steeringMode,followUpMode:o.followUpMode,sessionFile:o.sessionFile,sessionId:o.sessionId,sessionName:o.sessionName,autoCompactionEnabled:o.autoCompactionEnabled,messageCount:o.messages.length,pendingMessageCount:o.pendingMessageCount};return r(t,"get_state",s)}case"set_model":{const n=o.modelRuntime.getAvailableSnapshot().find(c=>c.provider===e.provider&&c.id===e.modelId);return n?(await o.setModel(n),r(t,"set_model",n)):d(t,"set_model",`Model not found: ${e.provider}/${e.modelId}`)}case"cycle_model":{const s=await o.cycleModel();return s?r(t,"cycle_model",s):r(t,"cycle_model",null)}case"get_available_models":{const s=o.modelRuntime.getAvailableSnapshot();return r(t,"get_available_models",{models:s})}case"set_thinking_level":return o.setThinkingLevel(e.level),r(t,"set_thinking_level");case"cycle_thinking_level":{const s=o.cycleThinkingLevel();return s?r(t,"cycle_thinking_level",{level:s}):r(t,"cycle_thinking_level",null)}case"get_available_thinking_levels":{const s=o.getAvailableThinkingLevels();return r(t,"get_available_thinking_levels",{levels:s})}case"set_steering_mode":return o.setSteeringMode(e.mode),r(t,"set_steering_mode");case"set_follow_up_mode":return o.setFollowUpMode(e.mode),r(t,"set_follow_up_mode");case"compact":{const s=await o.compact(e.customInstructions);return r(t,"compact",s)}case"set_auto_compaction":return o.setAutoCompactionEnabled(e.enabled),r(t,"set_auto_compaction");case"set_auto_retry":return o.setAutoRetryEnabled(e.enabled),r(t,"set_auto_retry");case"abort_retry":return o.abortRetry(),r(t,"abort_retry");case"bash":{const s=await o.extensionRunner.emitUserBash({type:"user_bash",command:e.command,excludeFromContext:e.excludeFromContext??!1,cwd:o.sessionManager.getCwd()});if(s?.result)return o.recordBashResult(e.command,s.result,{excludeFromContext:e.excludeFromContext}),r(t,"bash",s.result);const n=await o.executeBash(e.command,void 0,{excludeFromContext:e.excludeFromContext,id:t,operations:s?.operations});return r(t,"bash",n)}case"abort_bash":return o.abortBash(),r(t,"abort_bash");case"get_session_stats":{const s=o.getSessionStats();return r(t,"get_session_stats",s)}case"export_html":{const s=await o.exportToHtml(e.outputPath);return r(t,"export_html",{path:s})}case"switch_session":{const s=await l.switchSession(e.sessionPath);return s.cancelled||await f(),r(t,"switch_session",s)}case"fork":{const s=await l.fork(e.entryId);return s.cancelled||await f(),r(t,"fork",{text:s.selectedText,cancelled:s.cancelled})}case"clone":{const s=o.sessionManager.getLeafId();if(!s)return d(t,"clone","Cannot clone session: no current entry selected");const n=await l.fork(s,{position:"at"});return n.cancelled||await f(),r(t,"clone",{cancelled:n.cancelled})}case"get_fork_messages":{const s=o.getUserMessagesForForking();return r(t,"get_fork_messages",{messages:s})}case"get_entries":{const s=o.sessionManager;let n=s.getEntries();if(e.since!==void 0){const c=n.findIndex(u=>u.id===e.since);if(c===-1)return d(t,"get_entries",`Entry not found: ${e.since}`);n=n.slice(c+1)}return r(t,"get_entries",{entries:n,leafId:s.getLeafId()})}case"get_tree":{const s=o.sessionManager;return r(t,"get_tree",{tree:s.getTree(),leafId:s.getLeafId()})}case"get_last_assistant_text":{const s=o.getLastAssistantText();return r(t,"get_last_assistant_text",{text:s})}case"set_session_name":{const s=e.name.trim();return s?(o.setSessionName(s),r(t,"set_session_name")):d(t,"set_session_name","Session name cannot be empty")}case"get_messages":return r(t,"get_messages",{messages:o.messages});case"get_commands":{const s=[];for(const n of o.extensionRunner.getRegisteredCommands())s.push({name:n.invocationName,description:n.description,source:"extension",sourceInfo:n.sourceInfo});for(const n of o.promptTemplates)s.push({name:n.name,description:n.description,source:"prompt",sourceInfo:n.sourceInfo});for(const n of o.resourceLoader.getSkills().skills)s.push({name:`skill:${n.name}`,description:n.description,source:"skill",sourceInfo:n.sourceInfo});return r(t,"get_commands",{commands:s})}default:{const s=e;return d(t,s.type,`Unknown command: ${s.type}`)}}},"handleCommand");let S=i(()=>{},"detachInput");async function y(e=0,t){I&&process.exit(e),I=!0;for(const s of k)s();h?.(),w?.(),await l.dispose(),S(),process.stdin.pause(),t!=="SIGTERM"&&await D(),process.exit(e)}i(y,"shutdown");async function T(){b&&await y()}i(T,"checkShutdownRequested");const q=i(async e=>{let t;try{t=JSON.parse(e)}catch(n){a(d(void 0,"parse",`Failed to parse command: ${n instanceof Error?n.message:String(n)}`)),await _();return}if(typeof t=="object"&&t!==null&&"type"in t&&t.type==="extension_ui_response"){const n=t,c=m.get(n.id);c&&(m.delete(n.id),c.resolve(n));return}const s=t;try{const n=await R(s);n&&(a(n),await _()),await T()}catch(n){a(d(s.id,s.type,n instanceof Error?n.message:String(n))),await _()}},"handleInputLine"),E=i(()=>{y()},"onInputEnd");return process.stdin.on("end",E),S=(()=>{const e=G(process.stdin,t=>{q(t)});return()=>{e(),process.stdin.off("end",E)}})(),new Promise(()=>{})}i(V,"runRpcMode");export{V as runRpcMode};
|
|
1
|
+
var N=Object.defineProperty;var i=(u,o)=>N(u,"name",{value:o,configurable:!0});import*as d from"node:crypto";import{resolveExtensionNotify as $}from"../../core/extensions/index.js";import{DEFAULT_HOST_CALL_TIMEOUT_MS as J,getHostCapabilities as P,HostCallError as x,parseHostCapabilities as W}from"../../core/host-capabilities.js";import{flushRawStdout as j,takeOverStdout as G,waitForRawStdoutBackpressure as I,writeRawStdout as H}from"../../core/output-guard.js";import{killTrackedDetachedChildren as O}from"../../utils/shell.js";import{theme as z}from"../interactive/theme/theme.js";import{toJsonEvent as K}from"../json-event.js";import{attachJsonlLineReader as Q,serializeJsonLine as X}from"./jsonl.js";async function re(u){G();let o=u.session,k,S;const c=i(e=>{H(X(e))},"output"),r=i((e,t,s)=>s===void 0?{id:e,type:"response",command:t,success:!0}:{id:e,type:"response",command:t,success:!0,data:s},"success"),p=i((e,t,s)=>({id:e,type:"response",command:t,success:!1,error:s}),"error"),m=new Map,b=new Map,q=i((e,t)=>{const s=d.randomUUID();return new Promise((n,a)=>{const l=i(()=>{clearTimeout(w),t.signal?.removeEventListener("abort",f),b.delete(s)},"cleanup"),y=i(g=>{l(),c({type:"host_request_cancelled",id:s}),a(g)},"giveUp"),f=i(()=>y(new x("aborted","host call aborted")),"onAbort"),w=setTimeout(()=>y(new x("timeout","host did not answer in time")),t.timeoutMs??J);t.signal?.addEventListener("abort",f,{once:!0}),b.set(s,{resolve:i(g=>{l(),n(g)},"resolve"),reject:i(g=>{l(),a(g)},"reject")});const v={type:"host_request",id:s,capability:e.capability,method:e.method,params:e.params};c(v)})},"rpcHostTransport");let C=!1,E=!1;const U=[];function h(e,t,s,n){if(e?.signal?.aborted)return Promise.resolve(t);const a=d.randomUUID();return new Promise((l,y)=>{let f;const w=i(()=>{f&&clearTimeout(f),e?.signal?.removeEventListener("abort",v),m.delete(a)},"cleanup"),v=i(()=>{w(),l(t)},"onAbort");e?.signal?.addEventListener("abort",v,{once:!0}),e?.timeout&&(f=setTimeout(()=>{w(),l(t)},e.timeout)),m.set(a,{resolve:i(g=>{w(),l(n(g))},"resolve"),reject:y}),c({type:"extension_ui_request",id:a,...s})})}i(h,"createDialogPromise");const F=i(()=>({select:i((e,t,s)=>h(s,void 0,{method:"select",title:e,options:t,timeout:s?.timeout},n=>"cancelled"in n&&n.cancelled?void 0:"value"in n?n.value:void 0),"select"),confirm:i((e,t,s)=>h(s,!1,{method:"confirm",title:e,message:t,timeout:s?.timeout},n=>"cancelled"in n&&n.cancelled?!1:"confirmed"in n?n.confirmed:!1),"confirm"),input:i((e,t,s)=>h(s,void 0,{method:"input",title:e,placeholder:t,timeout:s?.timeout},n=>"cancelled"in n&&n.cancelled?void 0:"value"in n?n.value:void 0),"input"),notify(e,t){const s=$(e,t);c({type:"extension_ui_request",id:d.randomUUID(),method:"notify",message:s.message,notifyType:s.type})},setPanel(e,t){c({type:"extension_ui_request",id:d.randomUUID(),method:"setPanel",panelId:e,panel:t})},requestInput:i(e=>h(e,void 0,{method:"requestInput",title:e.title,placeholder:e.placeholder,timeout:e.timeout},t=>"cancelled"in t&&t.cancelled?void 0:"value"in t?t.value:void 0),"requestInput"),requestChoice:i(e=>h(e,void 0,{method:"requestChoice",title:e.title,items:e.items,timeout:e.timeout},t=>"cancelled"in t&&t.cancelled?void 0:"value"in t?t.value:void 0),"requestChoice"),onTerminalInput(){return()=>{}},setStatus(e,t){c({type:"extension_ui_request",id:d.randomUUID(),method:"setStatus",statusKey:e,statusText:t})},setWorkingMessage(e){},setWorkingVisible(e){},setWorkingIndicator(e){},setHiddenThinkingLabel(e){},setWidget(e,t,s){(t===void 0||Array.isArray(t))&&c({type:"extension_ui_request",id:d.randomUUID(),method:"setWidget",widgetKey:e,widgetLines:t,widgetPlacement:s?.placement})},setFooter(e){},setHeader(e){},setTitle(e){c({type:"extension_ui_request",id:d.randomUUID(),method:"setTitle",title:e})},async custom(){},pasteToEditor(e){this.setEditorText(e)},setEditorText(e){c({type:"extension_ui_request",id:d.randomUUID(),method:"set_editor_text",text:e})},getEditorText(){return""},async editor(e,t){const s=d.randomUUID();return new Promise((n,a)=>{m.set(s,{resolve:i(l=>{"cancelled"in l&&l.cancelled?n(void 0):"value"in l?n(l.value):n(void 0)},"resolve"),reject:a}),c({type:"extension_ui_request",id:s,method:"editor",title:e,prefill:t})})},addAutocompleteProvider(){},setEditorComponent(){},getEditorComponent(){},get theme(){return z},getAllThemes(){return[]},getTheme(e){},setTheme(e){return{success:!1,error:"Theme switching not supported in RPC mode"}},getToolsExpanded(){return!1},setToolsExpanded(e){}}),"createExtensionUIContext");u.setRebindSession(async()=>{await _()});const _=i(async()=>{o=u.session,await o.bindExtensions({uiContext:F(),mode:"rpc",commandContextActions:{waitForIdle:i(()=>o.waitForIdle(),"waitForIdle"),newSession:i(async e=>u.newSession(e),"newSession"),fork:i(async(e,t)=>({cancelled:(await u.fork(e,t)).cancelled}),"fork"),navigateTree:i(async(e,t)=>({cancelled:(await o.navigateTree(e,{summarize:t?.summarize,customInstructions:t?.customInstructions,replaceInstructions:t?.replaceInstructions,label:t?.label})).cancelled}),"navigateTree"),switchSession:i(async(e,t)=>u.switchSession(e,t),"switchSession"),reload:i(async()=>{await o.reload()},"reload")},shutdownHandler:i(()=>{C=!0},"shutdownHandler"),onError:i(e=>{c({type:"extension_error",extensionPath:e.extensionPath,event:e.event,error:e.error})},"onError")}),k?.(),S?.(),k=o.subscribe(e=>{c(K(e)),e.type==="agent_settled"&&R()}),S=o.agent.subscribe(async()=>{await I()})},"rebindSession"),A=i(()=>{const e=["SIGTERM"];process.platform!=="win32"&&e.push("SIGHUP");for(const t of e){const s=i(()=>{O(),T(t==="SIGHUP"?129:143,t)},"handler");process.on(t,s),U.push(()=>process.off(t,s))}},"registerSignalHandlers");await _(),A();const D=i(async e=>{const t=e.id;switch(e.type){case"prompt":{let s=!1;o.prompt(e.message,{images:e.images,streamingBehavior:e.streamingBehavior,source:"rpc",preflightResult:i(n=>{n&&(s=!0,c(r(t,"prompt")))},"preflightResult")}).catch(n=>{s||c(p(t,"prompt",n.message))});return}case"steer":return await o.steer(e.message,e.images,{source:"rpc"}),r(t,"steer");case"follow_up":return await o.followUp(e.message,e.images,{source:"rpc"}),r(t,"follow_up");case"abort":return await o.abort(),r(t,"abort");case"clear_queue":return r(t,"clear_queue",o.clearQueue());case"new_session":{const s=e.parentSession?{parentSession:e.parentSession}:void 0,n=await u.newSession(s);return n.cancelled||await _(),r(t,"new_session",n)}case"get_state":{const s={model:o.model,thinkingLevel:o.thinkingLevel,isStreaming:o.isStreaming,isCompacting:o.isCompacting,steeringMode:o.steeringMode,followUpMode:o.followUpMode,sessionFile:o.sessionFile,sessionId:o.sessionId,sessionName:o.sessionName,autoCompactionEnabled:o.autoCompactionEnabled,messageCount:o.messages.length,pendingMessageCount:o.pendingMessageCount};return r(t,"get_state",s)}case"set_model":{const n=o.modelRuntime.getAvailableSnapshot().find(a=>a.provider===e.provider&&a.id===e.modelId);return n?(await o.setModel(n),r(t,"set_model",n)):p(t,"set_model",`Model not found: ${e.provider}/${e.modelId}`)}case"cycle_model":{const s=await o.cycleModel();return s?r(t,"cycle_model",s):r(t,"cycle_model",null)}case"get_available_models":{const s=o.modelRuntime.getAvailableSnapshot();return r(t,"get_available_models",{models:s})}case"set_thinking_level":return o.setThinkingLevel(e.level),r(t,"set_thinking_level");case"cycle_thinking_level":{const s=o.cycleThinkingLevel();return s?r(t,"cycle_thinking_level",{level:s}):r(t,"cycle_thinking_level",null)}case"get_available_thinking_levels":{const s=o.getAvailableThinkingLevels();return r(t,"get_available_thinking_levels",{levels:s})}case"set_steering_mode":return o.setSteeringMode(e.mode),r(t,"set_steering_mode");case"set_follow_up_mode":return o.setFollowUpMode(e.mode),r(t,"set_follow_up_mode");case"compact":{const s=await o.compact(e.customInstructions);return r(t,"compact",s)}case"set_auto_compaction":return o.setAutoCompactionEnabled(e.enabled),r(t,"set_auto_compaction");case"set_auto_retry":return o.setAutoRetryEnabled(e.enabled),r(t,"set_auto_retry");case"abort_retry":return o.abortRetry(),r(t,"abort_retry");case"bash":{const s=await o.extensionRunner.emitUserBash({type:"user_bash",command:e.command,excludeFromContext:e.excludeFromContext??!1,cwd:o.sessionManager.getCwd()});if(s?.result)return o.recordBashResult(e.command,s.result,{excludeFromContext:e.excludeFromContext}),r(t,"bash",s.result);const n=await o.executeBash(e.command,void 0,{excludeFromContext:e.excludeFromContext,id:t,operations:s?.operations});return r(t,"bash",n)}case"abort_bash":return o.abortBash(),r(t,"abort_bash");case"get_sandbox_status":return r(t,"get_sandbox_status",o.getSandboxStatus()??null);case"list_background_processes":return r(t,"list_background_processes",{processes:o.backgroundProcesses.list()});case"read_background_process":{const{text:s,truncated:n,info:a}=o.backgroundProcesses.read(e.processId,e.tail!==void 0?{tail:e.tail}:{tail:200});return r(t,"read_background_process",{text:s,truncated:n,process:a})}case"stop_background_process":{const s=await o.backgroundProcesses.stop(e.processId);return r(t,"stop_background_process",{process:s})}case"get_session_stats":{const s=o.getSessionStats();return r(t,"get_session_stats",s)}case"export_html":{const s=await o.exportToHtml(e.outputPath);return r(t,"export_html",{path:s})}case"switch_session":{const s=await u.switchSession(e.sessionPath);return s.cancelled||await _(),r(t,"switch_session",s)}case"fork":{const s=await u.fork(e.entryId);return s.cancelled||await _(),r(t,"fork",{text:s.selectedText,cancelled:s.cancelled})}case"clone":{const s=o.sessionManager.getLeafId();if(!s)return p(t,"clone","Cannot clone session: no current entry selected");const n=await u.fork(s,{position:"at"});return n.cancelled||await _(),r(t,"clone",{cancelled:n.cancelled})}case"get_fork_messages":{const s=o.getUserMessagesForForking();return r(t,"get_fork_messages",{messages:s})}case"get_entries":{const s=o.sessionManager;let n=s.getEntries();if(e.since!==void 0){const a=n.findIndex(l=>l.id===e.since);if(a===-1)return p(t,"get_entries",`Entry not found: ${e.since}`);n=n.slice(a+1)}return r(t,"get_entries",{entries:n,leafId:s.getLeafId()})}case"get_tree":{const s=o.sessionManager;return r(t,"get_tree",{tree:s.getTree(),leafId:s.getLeafId()})}case"get_last_assistant_text":{const s=o.getLastAssistantText();return r(t,"get_last_assistant_text",{text:s})}case"set_session_name":{const s=e.name.trim();return s?(o.setSessionName(s),r(t,"set_session_name")):p(t,"set_session_name","Session name cannot be empty")}case"get_messages":return r(t,"get_messages",{messages:o.messages});case"get_commands":{const s=[];for(const n of o.extensionRunner.getRegisteredCommands())s.push({name:n.invocationName,description:n.description,source:"extension",sourceInfo:n.sourceInfo});for(const n of o.promptTemplates)s.push({name:n.name,description:n.description,source:"prompt",sourceInfo:n.sourceInfo});for(const n of o.resourceLoader.getSkills().skills)s.push({name:`skill:${n.name}`,description:n.description,source:"skill",sourceInfo:n.sourceInfo});return r(t,"get_commands",{commands:s})}case"set_host_capabilities":{const s=P();return s.set("rpc",W(e.capabilities),q),r(t,"set_host_capabilities",{capabilities:s.list()})}default:{const s=e;return p(t,s.type,`Unknown command: ${s.type}`)}}},"handleCommand");let M=i(()=>{},"detachInput");async function T(e=0,t){E&&process.exit(e),E=!0;for(const s of U)s();k?.(),S?.(),P().clear("rpc");for(const s of b.values())s.reject(new x("unavailable","RPC host disconnected"));await u.dispose(),M(),process.stdin.pause(),t!=="SIGTERM"&&await j(),process.exit(e)}i(T,"shutdown");async function R(){C&&await T()}i(R,"checkShutdownRequested");const B=i(async e=>{let t;try{t=JSON.parse(e)}catch(n){c(p(void 0,"parse",`Failed to parse command: ${n instanceof Error?n.message:String(n)}`)),await I();return}if(typeof t=="object"&&t!==null&&"type"in t&&t.type==="extension_ui_response"){const n=t,a=m.get(n.id);a&&(m.delete(n.id),a.resolve(n));return}if(typeof t=="object"&&t!==null&&"type"in t&&t.type==="host_response"){const n=t,a=b.get(n.id);a&&("error"in n?a.reject(new x("host_error",String(n.error))):a.resolve(n.result));return}const s=t;try{const n=await D(s);n&&(c(n),await I()),await R()}catch(n){c(p(s.id,s.type,n instanceof Error?n.message:String(n))),await I()}},"handleInputLine"),L=i(()=>{T()},"onInputEnd");return process.stdin.on("end",L),M=(()=>{const e=Q(process.stdin,t=>{B(t)});return()=>{e(),process.stdin.off("end",L)}})(),new Promise(()=>{})}i(re,"runRpcMode");export{re as runRpcMode};
|
|
@@ -0,0 +1,565 @@
|
|
|
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 { BackgroundProcessInfo } from "../../core/background-processes.ts";
|
|
5
|
+
import type { BashResult } from "../../core/bash-executor.ts";
|
|
6
|
+
import type { CompactionResult } from "../../core/compaction/index.ts";
|
|
7
|
+
import type { HostCapability } from "../../core/host-capabilities.ts";
|
|
8
|
+
import type { SandboxStatus } from "../../core/sandbox/shell-sandbox.ts";
|
|
9
|
+
import type { SessionEntry, SessionTreeNode } from "../../core/session-manager.ts";
|
|
10
|
+
import type { SourceInfo } from "../../core/source-info.ts";
|
|
11
|
+
export type RpcCommand = {
|
|
12
|
+
id?: string;
|
|
13
|
+
type: "prompt";
|
|
14
|
+
message: string;
|
|
15
|
+
images?: ImageContent[];
|
|
16
|
+
streamingBehavior?: "steer" | "followUp";
|
|
17
|
+
} | {
|
|
18
|
+
id?: string;
|
|
19
|
+
type: "steer";
|
|
20
|
+
message: string;
|
|
21
|
+
images?: ImageContent[];
|
|
22
|
+
} | {
|
|
23
|
+
id?: string;
|
|
24
|
+
type: "follow_up";
|
|
25
|
+
message: string;
|
|
26
|
+
images?: ImageContent[];
|
|
27
|
+
} | {
|
|
28
|
+
id?: string;
|
|
29
|
+
type: "abort";
|
|
30
|
+
} | {
|
|
31
|
+
id?: string;
|
|
32
|
+
type: "clear_queue";
|
|
33
|
+
} | {
|
|
34
|
+
id?: string;
|
|
35
|
+
type: "new_session";
|
|
36
|
+
parentSession?: string;
|
|
37
|
+
} | {
|
|
38
|
+
id?: string;
|
|
39
|
+
type: "get_state";
|
|
40
|
+
} | {
|
|
41
|
+
id?: string;
|
|
42
|
+
type: "set_model";
|
|
43
|
+
provider: string;
|
|
44
|
+
modelId: string;
|
|
45
|
+
} | {
|
|
46
|
+
id?: string;
|
|
47
|
+
type: "cycle_model";
|
|
48
|
+
} | {
|
|
49
|
+
id?: string;
|
|
50
|
+
type: "get_available_models";
|
|
51
|
+
} | {
|
|
52
|
+
id?: string;
|
|
53
|
+
type: "set_thinking_level";
|
|
54
|
+
level: ThinkingLevel;
|
|
55
|
+
} | {
|
|
56
|
+
id?: string;
|
|
57
|
+
type: "cycle_thinking_level";
|
|
58
|
+
} | {
|
|
59
|
+
id?: string;
|
|
60
|
+
type: "get_available_thinking_levels";
|
|
61
|
+
} | {
|
|
62
|
+
id?: string;
|
|
63
|
+
type: "set_steering_mode";
|
|
64
|
+
mode: "all" | "one-at-a-time";
|
|
65
|
+
} | {
|
|
66
|
+
id?: string;
|
|
67
|
+
type: "set_follow_up_mode";
|
|
68
|
+
mode: "all" | "one-at-a-time";
|
|
69
|
+
} | {
|
|
70
|
+
id?: string;
|
|
71
|
+
type: "compact";
|
|
72
|
+
customInstructions?: string;
|
|
73
|
+
} | {
|
|
74
|
+
id?: string;
|
|
75
|
+
type: "set_auto_compaction";
|
|
76
|
+
enabled: boolean;
|
|
77
|
+
} | {
|
|
78
|
+
id?: string;
|
|
79
|
+
type: "set_auto_retry";
|
|
80
|
+
enabled: boolean;
|
|
81
|
+
} | {
|
|
82
|
+
id?: string;
|
|
83
|
+
type: "abort_retry";
|
|
84
|
+
} | {
|
|
85
|
+
id?: string;
|
|
86
|
+
type: "bash";
|
|
87
|
+
command: string;
|
|
88
|
+
excludeFromContext?: boolean;
|
|
89
|
+
} | {
|
|
90
|
+
id?: string;
|
|
91
|
+
type: "abort_bash";
|
|
92
|
+
} | {
|
|
93
|
+
id?: string;
|
|
94
|
+
type: "get_sandbox_status";
|
|
95
|
+
} | {
|
|
96
|
+
id?: string;
|
|
97
|
+
type: "list_background_processes";
|
|
98
|
+
} | {
|
|
99
|
+
id?: string;
|
|
100
|
+
type: "read_background_process";
|
|
101
|
+
processId: string;
|
|
102
|
+
tail?: number;
|
|
103
|
+
} | {
|
|
104
|
+
id?: string;
|
|
105
|
+
type: "stop_background_process";
|
|
106
|
+
processId: string;
|
|
107
|
+
} | {
|
|
108
|
+
id?: string;
|
|
109
|
+
type: "get_session_stats";
|
|
110
|
+
} | {
|
|
111
|
+
id?: string;
|
|
112
|
+
type: "export_html";
|
|
113
|
+
outputPath?: string;
|
|
114
|
+
} | {
|
|
115
|
+
id?: string;
|
|
116
|
+
type: "switch_session";
|
|
117
|
+
sessionPath: string;
|
|
118
|
+
} | {
|
|
119
|
+
id?: string;
|
|
120
|
+
type: "fork";
|
|
121
|
+
entryId: string;
|
|
122
|
+
} | {
|
|
123
|
+
id?: string;
|
|
124
|
+
type: "clone";
|
|
125
|
+
} | {
|
|
126
|
+
id?: string;
|
|
127
|
+
type: "get_fork_messages";
|
|
128
|
+
} | {
|
|
129
|
+
id?: string;
|
|
130
|
+
type: "get_entries";
|
|
131
|
+
since?: string;
|
|
132
|
+
} | {
|
|
133
|
+
id?: string;
|
|
134
|
+
type: "get_tree";
|
|
135
|
+
} | {
|
|
136
|
+
id?: string;
|
|
137
|
+
type: "get_last_assistant_text";
|
|
138
|
+
} | {
|
|
139
|
+
id?: string;
|
|
140
|
+
type: "set_session_name";
|
|
141
|
+
name: string;
|
|
142
|
+
} | {
|
|
143
|
+
id?: string;
|
|
144
|
+
type: "get_messages";
|
|
145
|
+
} | {
|
|
146
|
+
id?: string;
|
|
147
|
+
type: "get_commands";
|
|
148
|
+
} | {
|
|
149
|
+
id?: string;
|
|
150
|
+
type: "set_host_capabilities";
|
|
151
|
+
capabilities: HostCapability[];
|
|
152
|
+
};
|
|
153
|
+
export interface RpcSlashCommand {
|
|
154
|
+
name: string;
|
|
155
|
+
description?: string;
|
|
156
|
+
source: "extension" | "prompt" | "skill";
|
|
157
|
+
sourceInfo: SourceInfo;
|
|
158
|
+
}
|
|
159
|
+
export interface RpcSessionState {
|
|
160
|
+
model?: Model<any>;
|
|
161
|
+
thinkingLevel: ThinkingLevel;
|
|
162
|
+
isStreaming: boolean;
|
|
163
|
+
isCompacting: boolean;
|
|
164
|
+
steeringMode: "all" | "one-at-a-time";
|
|
165
|
+
followUpMode: "all" | "one-at-a-time";
|
|
166
|
+
sessionFile?: string;
|
|
167
|
+
sessionId: string;
|
|
168
|
+
sessionName?: string;
|
|
169
|
+
autoCompactionEnabled: boolean;
|
|
170
|
+
messageCount: number;
|
|
171
|
+
pendingMessageCount: number;
|
|
172
|
+
}
|
|
173
|
+
export type RpcResponse = {
|
|
174
|
+
id?: string;
|
|
175
|
+
type: "response";
|
|
176
|
+
command: "prompt";
|
|
177
|
+
success: true;
|
|
178
|
+
} | {
|
|
179
|
+
id?: string;
|
|
180
|
+
type: "response";
|
|
181
|
+
command: "steer";
|
|
182
|
+
success: true;
|
|
183
|
+
} | {
|
|
184
|
+
id?: string;
|
|
185
|
+
type: "response";
|
|
186
|
+
command: "follow_up";
|
|
187
|
+
success: true;
|
|
188
|
+
} | {
|
|
189
|
+
id?: string;
|
|
190
|
+
type: "response";
|
|
191
|
+
command: "abort";
|
|
192
|
+
success: true;
|
|
193
|
+
} | {
|
|
194
|
+
id?: string;
|
|
195
|
+
type: "response";
|
|
196
|
+
command: "clear_queue";
|
|
197
|
+
success: true;
|
|
198
|
+
data: {
|
|
199
|
+
steering: string[];
|
|
200
|
+
followUp: string[];
|
|
201
|
+
};
|
|
202
|
+
} | {
|
|
203
|
+
id?: string;
|
|
204
|
+
type: "response";
|
|
205
|
+
command: "new_session";
|
|
206
|
+
success: true;
|
|
207
|
+
data: {
|
|
208
|
+
cancelled: boolean;
|
|
209
|
+
};
|
|
210
|
+
} | {
|
|
211
|
+
id?: string;
|
|
212
|
+
type: "response";
|
|
213
|
+
command: "get_state";
|
|
214
|
+
success: true;
|
|
215
|
+
data: RpcSessionState;
|
|
216
|
+
} | {
|
|
217
|
+
id?: string;
|
|
218
|
+
type: "response";
|
|
219
|
+
command: "set_model";
|
|
220
|
+
success: true;
|
|
221
|
+
data: Model<any>;
|
|
222
|
+
} | {
|
|
223
|
+
id?: string;
|
|
224
|
+
type: "response";
|
|
225
|
+
command: "cycle_model";
|
|
226
|
+
success: true;
|
|
227
|
+
data: {
|
|
228
|
+
model: Model<any>;
|
|
229
|
+
thinkingLevel: ThinkingLevel;
|
|
230
|
+
isScoped: boolean;
|
|
231
|
+
} | null;
|
|
232
|
+
} | {
|
|
233
|
+
id?: string;
|
|
234
|
+
type: "response";
|
|
235
|
+
command: "get_available_models";
|
|
236
|
+
success: true;
|
|
237
|
+
data: {
|
|
238
|
+
models: Model<any>[];
|
|
239
|
+
};
|
|
240
|
+
} | {
|
|
241
|
+
id?: string;
|
|
242
|
+
type: "response";
|
|
243
|
+
command: "set_thinking_level";
|
|
244
|
+
success: true;
|
|
245
|
+
} | {
|
|
246
|
+
id?: string;
|
|
247
|
+
type: "response";
|
|
248
|
+
command: "cycle_thinking_level";
|
|
249
|
+
success: true;
|
|
250
|
+
data: {
|
|
251
|
+
level: ThinkingLevel;
|
|
252
|
+
} | null;
|
|
253
|
+
} | {
|
|
254
|
+
id?: string;
|
|
255
|
+
type: "response";
|
|
256
|
+
command: "get_available_thinking_levels";
|
|
257
|
+
success: true;
|
|
258
|
+
data: {
|
|
259
|
+
levels: ThinkingLevel[];
|
|
260
|
+
};
|
|
261
|
+
} | {
|
|
262
|
+
id?: string;
|
|
263
|
+
type: "response";
|
|
264
|
+
command: "set_steering_mode";
|
|
265
|
+
success: true;
|
|
266
|
+
} | {
|
|
267
|
+
id?: string;
|
|
268
|
+
type: "response";
|
|
269
|
+
command: "set_follow_up_mode";
|
|
270
|
+
success: true;
|
|
271
|
+
} | {
|
|
272
|
+
id?: string;
|
|
273
|
+
type: "response";
|
|
274
|
+
command: "compact";
|
|
275
|
+
success: true;
|
|
276
|
+
data: CompactionResult;
|
|
277
|
+
} | {
|
|
278
|
+
id?: string;
|
|
279
|
+
type: "response";
|
|
280
|
+
command: "set_auto_compaction";
|
|
281
|
+
success: true;
|
|
282
|
+
} | {
|
|
283
|
+
id?: string;
|
|
284
|
+
type: "response";
|
|
285
|
+
command: "set_auto_retry";
|
|
286
|
+
success: true;
|
|
287
|
+
} | {
|
|
288
|
+
id?: string;
|
|
289
|
+
type: "response";
|
|
290
|
+
command: "abort_retry";
|
|
291
|
+
success: true;
|
|
292
|
+
} | {
|
|
293
|
+
id?: string;
|
|
294
|
+
type: "response";
|
|
295
|
+
command: "bash";
|
|
296
|
+
success: true;
|
|
297
|
+
data: BashResult;
|
|
298
|
+
} | {
|
|
299
|
+
id?: string;
|
|
300
|
+
type: "response";
|
|
301
|
+
command: "abort_bash";
|
|
302
|
+
success: true;
|
|
303
|
+
} | {
|
|
304
|
+
id?: string;
|
|
305
|
+
type: "response";
|
|
306
|
+
command: "get_sandbox_status";
|
|
307
|
+
success: true;
|
|
308
|
+
data: SandboxStatus | null;
|
|
309
|
+
} | {
|
|
310
|
+
id?: string;
|
|
311
|
+
type: "response";
|
|
312
|
+
command: "list_background_processes";
|
|
313
|
+
success: true;
|
|
314
|
+
data: {
|
|
315
|
+
processes: BackgroundProcessInfo[];
|
|
316
|
+
};
|
|
317
|
+
} | {
|
|
318
|
+
id?: string;
|
|
319
|
+
type: "response";
|
|
320
|
+
command: "read_background_process";
|
|
321
|
+
success: true;
|
|
322
|
+
data: {
|
|
323
|
+
text: string;
|
|
324
|
+
truncated: boolean;
|
|
325
|
+
process: BackgroundProcessInfo;
|
|
326
|
+
};
|
|
327
|
+
} | {
|
|
328
|
+
id?: string;
|
|
329
|
+
type: "response";
|
|
330
|
+
command: "stop_background_process";
|
|
331
|
+
success: true;
|
|
332
|
+
data: {
|
|
333
|
+
process: BackgroundProcessInfo;
|
|
334
|
+
};
|
|
335
|
+
} | {
|
|
336
|
+
id?: string;
|
|
337
|
+
type: "response";
|
|
338
|
+
command: "get_session_stats";
|
|
339
|
+
success: true;
|
|
340
|
+
data: SessionStats;
|
|
341
|
+
} | {
|
|
342
|
+
id?: string;
|
|
343
|
+
type: "response";
|
|
344
|
+
command: "export_html";
|
|
345
|
+
success: true;
|
|
346
|
+
data: {
|
|
347
|
+
path: string;
|
|
348
|
+
};
|
|
349
|
+
} | {
|
|
350
|
+
id?: string;
|
|
351
|
+
type: "response";
|
|
352
|
+
command: "switch_session";
|
|
353
|
+
success: true;
|
|
354
|
+
data: {
|
|
355
|
+
cancelled: boolean;
|
|
356
|
+
};
|
|
357
|
+
} | {
|
|
358
|
+
id?: string;
|
|
359
|
+
type: "response";
|
|
360
|
+
command: "fork";
|
|
361
|
+
success: true;
|
|
362
|
+
data: {
|
|
363
|
+
text: string;
|
|
364
|
+
cancelled: boolean;
|
|
365
|
+
};
|
|
366
|
+
} | {
|
|
367
|
+
id?: string;
|
|
368
|
+
type: "response";
|
|
369
|
+
command: "clone";
|
|
370
|
+
success: true;
|
|
371
|
+
data: {
|
|
372
|
+
cancelled: boolean;
|
|
373
|
+
};
|
|
374
|
+
} | {
|
|
375
|
+
id?: string;
|
|
376
|
+
type: "response";
|
|
377
|
+
command: "get_fork_messages";
|
|
378
|
+
success: true;
|
|
379
|
+
data: {
|
|
380
|
+
messages: Array<{
|
|
381
|
+
entryId: string;
|
|
382
|
+
text: string;
|
|
383
|
+
}>;
|
|
384
|
+
};
|
|
385
|
+
} | {
|
|
386
|
+
id?: string;
|
|
387
|
+
type: "response";
|
|
388
|
+
command: "get_entries";
|
|
389
|
+
success: true;
|
|
390
|
+
data: {
|
|
391
|
+
entries: SessionEntry[];
|
|
392
|
+
leafId: string | null;
|
|
393
|
+
};
|
|
394
|
+
} | {
|
|
395
|
+
id?: string;
|
|
396
|
+
type: "response";
|
|
397
|
+
command: "get_tree";
|
|
398
|
+
success: true;
|
|
399
|
+
data: {
|
|
400
|
+
tree: SessionTreeNode[];
|
|
401
|
+
leafId: string | null;
|
|
402
|
+
};
|
|
403
|
+
} | {
|
|
404
|
+
id?: string;
|
|
405
|
+
type: "response";
|
|
406
|
+
command: "get_last_assistant_text";
|
|
407
|
+
success: true;
|
|
408
|
+
data: {
|
|
409
|
+
text: string | null;
|
|
410
|
+
};
|
|
411
|
+
} | {
|
|
412
|
+
id?: string;
|
|
413
|
+
type: "response";
|
|
414
|
+
command: "set_session_name";
|
|
415
|
+
success: true;
|
|
416
|
+
} | {
|
|
417
|
+
id?: string;
|
|
418
|
+
type: "response";
|
|
419
|
+
command: "get_messages";
|
|
420
|
+
success: true;
|
|
421
|
+
data: {
|
|
422
|
+
messages: AgentMessage[];
|
|
423
|
+
};
|
|
424
|
+
} | {
|
|
425
|
+
id?: string;
|
|
426
|
+
type: "response";
|
|
427
|
+
command: "get_commands";
|
|
428
|
+
success: true;
|
|
429
|
+
data: {
|
|
430
|
+
commands: RpcSlashCommand[];
|
|
431
|
+
};
|
|
432
|
+
} | {
|
|
433
|
+
id?: string;
|
|
434
|
+
type: "response";
|
|
435
|
+
command: "set_host_capabilities";
|
|
436
|
+
success: true;
|
|
437
|
+
data: {
|
|
438
|
+
capabilities: HostCapability[];
|
|
439
|
+
};
|
|
440
|
+
} | {
|
|
441
|
+
id?: string;
|
|
442
|
+
type: "response";
|
|
443
|
+
command: string;
|
|
444
|
+
success: false;
|
|
445
|
+
error: string;
|
|
446
|
+
};
|
|
447
|
+
export type RpcExtensionUIRequest = {
|
|
448
|
+
type: "extension_ui_request";
|
|
449
|
+
id: string;
|
|
450
|
+
method: "select";
|
|
451
|
+
title: string;
|
|
452
|
+
options: string[];
|
|
453
|
+
timeout?: number;
|
|
454
|
+
} | {
|
|
455
|
+
type: "extension_ui_request";
|
|
456
|
+
id: string;
|
|
457
|
+
method: "confirm";
|
|
458
|
+
title: string;
|
|
459
|
+
message: string;
|
|
460
|
+
timeout?: number;
|
|
461
|
+
} | {
|
|
462
|
+
type: "extension_ui_request";
|
|
463
|
+
id: string;
|
|
464
|
+
method: "input";
|
|
465
|
+
title: string;
|
|
466
|
+
placeholder?: string;
|
|
467
|
+
timeout?: number;
|
|
468
|
+
} | {
|
|
469
|
+
type: "extension_ui_request";
|
|
470
|
+
id: string;
|
|
471
|
+
method: "editor";
|
|
472
|
+
title: string;
|
|
473
|
+
prefill?: string;
|
|
474
|
+
} | {
|
|
475
|
+
type: "extension_ui_request";
|
|
476
|
+
id: string;
|
|
477
|
+
method: "notify";
|
|
478
|
+
message: string;
|
|
479
|
+
notifyType?: "info" | "warning" | "error";
|
|
480
|
+
} | {
|
|
481
|
+
type: "extension_ui_request";
|
|
482
|
+
id: string;
|
|
483
|
+
method: "setStatus";
|
|
484
|
+
statusKey: string;
|
|
485
|
+
statusText: string | undefined;
|
|
486
|
+
} | {
|
|
487
|
+
type: "extension_ui_request";
|
|
488
|
+
id: string;
|
|
489
|
+
method: "setWidget";
|
|
490
|
+
widgetKey: string;
|
|
491
|
+
widgetLines: string[] | undefined;
|
|
492
|
+
widgetPlacement?: "aboveEditor" | "belowEditor";
|
|
493
|
+
} | {
|
|
494
|
+
type: "extension_ui_request";
|
|
495
|
+
id: string;
|
|
496
|
+
method: "setPanel";
|
|
497
|
+
panelId: string;
|
|
498
|
+
panel?: {
|
|
499
|
+
title?: string;
|
|
500
|
+
lines?: string[];
|
|
501
|
+
placement?: "aux" | "status";
|
|
502
|
+
};
|
|
503
|
+
} | {
|
|
504
|
+
type: "extension_ui_request";
|
|
505
|
+
id: string;
|
|
506
|
+
method: "requestInput";
|
|
507
|
+
title: string;
|
|
508
|
+
placeholder?: string;
|
|
509
|
+
timeout?: number;
|
|
510
|
+
} | {
|
|
511
|
+
type: "extension_ui_request";
|
|
512
|
+
id: string;
|
|
513
|
+
method: "requestChoice";
|
|
514
|
+
title: string;
|
|
515
|
+
items: Array<{
|
|
516
|
+
id: string;
|
|
517
|
+
label: string;
|
|
518
|
+
description?: string;
|
|
519
|
+
}>;
|
|
520
|
+
timeout?: number;
|
|
521
|
+
} | {
|
|
522
|
+
type: "extension_ui_request";
|
|
523
|
+
id: string;
|
|
524
|
+
method: "setTitle";
|
|
525
|
+
title: string;
|
|
526
|
+
} | {
|
|
527
|
+
type: "extension_ui_request";
|
|
528
|
+
id: string;
|
|
529
|
+
method: "set_editor_text";
|
|
530
|
+
text: string;
|
|
531
|
+
};
|
|
532
|
+
export type RpcExtensionUIResponse = {
|
|
533
|
+
type: "extension_ui_response";
|
|
534
|
+
id: string;
|
|
535
|
+
value: string;
|
|
536
|
+
} | {
|
|
537
|
+
type: "extension_ui_response";
|
|
538
|
+
id: string;
|
|
539
|
+
confirmed: boolean;
|
|
540
|
+
} | {
|
|
541
|
+
type: "extension_ui_response";
|
|
542
|
+
id: string;
|
|
543
|
+
cancelled: true;
|
|
544
|
+
};
|
|
545
|
+
export interface RpcHostRequest {
|
|
546
|
+
type: "host_request";
|
|
547
|
+
id: string;
|
|
548
|
+
capability: string;
|
|
549
|
+
method: string;
|
|
550
|
+
params: Record<string, unknown>;
|
|
551
|
+
}
|
|
552
|
+
export interface RpcHostRequestCancelled {
|
|
553
|
+
type: "host_request_cancelled";
|
|
554
|
+
id: string;
|
|
555
|
+
}
|
|
556
|
+
export type RpcHostResponse = {
|
|
557
|
+
type: "host_response";
|
|
558
|
+
id: string;
|
|
559
|
+
result: unknown;
|
|
560
|
+
} | {
|
|
561
|
+
type: "host_response";
|
|
562
|
+
id: string;
|
|
563
|
+
error: string;
|
|
564
|
+
};
|
|
565
|
+
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.26",
|
|
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.26",
|
|
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};
|