dal-code 1.0.44 → 1.0.46
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 +103 -0
- package/NOTICE +66 -1
- package/PRIVACY.md +159 -102
- package/dal-docs/README.md +1 -1
- package/dal-docs/keybindings.md +1 -0
- package/dal-docs/settings.md +5 -0
- package/dist/bun/register-bedrock.js +1 -0
- package/dist/cli/args.js +2 -2
- package/dist/cli/auth-check.js +1 -1
- package/dist/cli/auth-command.js +6 -5
- package/dist/cli/credential-print.js +1 -1
- package/dist/cli/experimental/auth.js +1 -0
- package/dist/cli/experimental/cli.js +1 -0
- package/dist/cli/experimental/command-options.js +1 -0
- package/dist/cli/experimental/command.js +1 -0
- package/dist/cli/experimental/commands/client.js +1 -0
- package/dist/cli/experimental/commands/pi.js +1 -0
- package/dist/cli/experimental/commands/server.js +1 -0
- package/dist/cli/experimental/transport-address.js +1 -0
- package/dist/cli/list-models.js +2 -2
- package/dist/cli/piped-stdin.js +2 -0
- package/dist/cli/startup-diagnostics.js +1 -0
- package/dist/client/index.js +1 -0
- package/dist/client/remote-session.js +1 -0
- package/dist/client/transcript.js +1 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +1 -1
- package/dist/core/agent-log.d.ts +6 -0
- package/dist/core/agent-log.js +3 -0
- package/dist/core/agent-session-runtime.js +1 -1
- package/dist/core/agent-session-services.d.ts +0 -1
- package/dist/core/agent-session-services.js +1 -1
- package/dist/core/agent-session.d.ts +20 -3
- package/dist/core/agent-session.js +8 -8
- package/dist/core/auth-storage.js +1 -1
- package/dist/core/background-processes.js +7 -7
- package/dist/core/client-identity.js +1 -0
- package/dist/core/compaction/branch-summarization.js +3 -3
- package/dist/core/compaction/compaction.d.ts +2 -2
- package/dist/core/compaction/compaction.js +11 -9
- package/dist/core/compaction-backoff.js +1 -0
- package/dist/core/dal-session-headers.js +1 -0
- package/dist/core/export-html/index.js +2 -2
- package/dist/core/export-html/template.html +1 -0
- package/dist/core/export-html/template.js +35 -35
- package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
- package/dist/core/export-html/vendor/marked.min.js +30 -29
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/extensions/runner.d.ts +6 -0
- package/dist/core/extensions/runner.js +1 -1
- package/dist/core/extensions/types.d.ts +6 -1
- package/dist/core/extensions/virtual-modules.js +1 -1
- package/dist/core/http-dispatcher.js +1 -1
- package/dist/core/key-id-schema.js +1 -0
- package/dist/core/keybindings-schema.js +1 -0
- package/dist/core/keybindings.d.ts +5 -0
- package/dist/core/keybindings.js +1 -1
- package/dist/core/model-config.d.ts +1805 -102
- package/dist/core/model-config.js +4 -4
- package/dist/core/model-identity.js +2 -0
- package/dist/core/model-resolver.d.ts +30 -10
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-runtime.d.ts +3 -0
- package/dist/core/model-runtime.js +2 -2
- package/dist/core/package-manager.d.ts +7 -0
- package/dist/core/package-manager.js +2 -2
- package/dist/core/permissions/shell-words.d.ts +26 -0
- package/dist/core/project-trust.js +2 -2
- package/dist/core/prompt-templates.js +2 -2
- package/dist/core/provider-attribution.js +1 -1
- package/dist/core/provider-composer.d.ts +2 -1
- package/dist/core/provider-composer.js +1 -1
- package/dist/core/remote-catalog-provider.js +1 -1
- package/dist/core/resource-loader.js +1 -1
- package/dist/core/sandbox/bwrap-placeholders.js +1 -1
- package/dist/core/sandbox/index.d.ts +1 -1
- package/dist/core/sandbox/index.js +1 -1
- package/dist/core/sandbox/libreoffice.js +1 -0
- package/dist/core/sandbox/policy.d.ts +4 -0
- package/dist/core/sandbox/policy.js +1 -1
- package/dist/core/sandbox/runtime.d.ts +3 -0
- package/dist/core/sandbox/runtime.js +1 -1
- package/dist/core/sandbox/shell-sandbox.d.ts +2 -0
- package/dist/core/sandbox/shell-sandbox.js +6 -6
- package/dist/core/sandbox/windows.js +4 -4
- package/dist/core/sdk.js +1 -1
- package/dist/core/session-manager.d.ts +1 -0
- package/dist/core/session-manager.js +12 -12
- package/dist/core/session-stall-monitor.d.ts +41 -0
- package/dist/core/session-stall-monitor.js +2 -0
- package/dist/core/settings-defaults.js +1 -0
- package/dist/core/settings-manager.d.ts +9 -0
- package/dist/core/settings-manager.js +1 -1
- package/dist/core/settings-schema.d.ts +231 -0
- package/dist/core/settings-schema.js +1 -0
- package/dist/core/stall-watchdog.d.ts +55 -0
- package/dist/core/stall-watchdog.js +1 -0
- package/dist/core/system-prompt.js +10 -10
- package/dist/core/tools/bash-read-only.d.ts +1 -0
- package/dist/core/tools/bash.d.ts +1 -0
- package/dist/core/tools/bash.js +14 -14
- package/dist/core/tools/edit.d.ts +1 -1
- package/dist/core/tools/edit.js +3 -3
- package/dist/core/tools/grep.js +1 -1
- package/dist/core/tools/path-utils.d.ts +1 -0
- package/dist/core/tools/path-utils.js +1 -1
- package/dist/core/tools/read.js +12 -12
- package/dist/core/tools/render-utils.d.ts +40 -0
- package/dist/core/tools/render-utils.js +7 -7
- package/dist/core/tools/renderers/read.js +8 -8
- package/dist/core/trust-manager.js +1 -1
- package/dist/core/workspace-lock.d.ts +6 -2
- package/dist/core/workspace-lock.js +3 -3
- package/dist/dal/builtins.js +2 -2
- package/dist/dal/extension-compat.js +4 -4
- package/dist/dal/hooks/config.d.ts +5 -1
- package/dist/dal/hooks/config.js +1 -1
- package/dist/dal/hooks/extension.js +3 -3
- package/dist/dal/hooks/index.d.ts +1 -1
- package/dist/dal/hooks/index.js +1 -1
- package/dist/dal/i18n.js +1 -1
- package/dist/dal/manifest.d.ts +1 -0
- package/dist/dal/manifest.js +1 -1
- package/dist/dal/safety-net.js +3 -1
- package/dist/extensions/codemode/execute.js +22 -15
- package/dist/extensions/codemode/index.js +1 -1
- package/dist/extensions/codemode/renderer.js +6 -6
- package/dist/extensions/codemode/tool.d.ts +2 -3
- package/dist/extensions/codemode/tool.js +9 -12
- package/dist/extensions/mcp/cli.js +4 -4
- package/dist/extensions/mcp/config.js +2 -2
- package/dist/extensions/mcp/index.js +12 -12
- package/dist/extensions/mcp/oauth.js +2 -2
- package/dist/extensions/mcp/resources.d.ts +0 -5
- package/dist/extensions/mcp/resources.js +1 -1
- package/dist/extensions/mcp/runtime.d.ts +1 -4
- package/dist/extensions/mcp/runtime.js +3 -3
- package/dist/extensions/mcp/tools.js +7 -7
- package/dist/extensions/tool-search/tool.js +3 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +1 -1
- package/dist/main.js +4 -4
- package/dist/migrations.js +3 -5
- package/dist/modes/interactive/components/daxnuts.js +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
- package/dist/modes/interactive/components/settings-selector.js +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +1 -1
- package/dist/modes/interactive/components/status-indicator.js +1 -1
- package/dist/modes/interactive/components/tree-selector.js +1 -1
- package/dist/modes/interactive/external-editor.js +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +7 -7
- package/dist/modes/interactive/interactive-mode.js +26 -26
- package/dist/modes/interactive/session-share.js +2 -2
- package/dist/modes/interactive/theme/dark.json +1 -1
- package/dist/modes/interactive/theme/light.json +1 -1
- package/dist/modes/interactive/theme/theme-json.js +4 -4
- package/dist/modes/interactive/theme/theme-schema.d.ts +18 -0
- package/dist/modes/interactive/theme/theme-schema.js +12 -0
- package/dist/modes/interactive/theme/theme-schema.json +2 -7
- package/dist/modes/interactive/theme/theme-tokens.d.ts +255 -0
- package/dist/modes/interactive/theme/theme-tokens.js +1 -0
- package/dist/modes/interactive/theme/theme.d.ts +7 -10
- package/dist/modes/interactive/theme/theme.js +5 -5
- package/dist/modes/print-mode.d.ts +1 -0
- package/dist/modes/print-mode.js +8 -7
- package/dist/modes/rpc/rpc-client.d.ts +5 -1
- package/dist/modes/rpc/rpc-client.js +3 -3
- package/dist/modes/rpc/rpc-mode.js +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +20 -0
- package/dist/node_modules/@dalcode/dal-advisor/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-advisor/src/index.js +8 -8
- package/dist/node_modules/@dalcode/dal-awake/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-capabilities/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-capabilities/src/catalogue.js +1 -1
- package/dist/node_modules/@dalcode/dal-capabilities/src/index.js +9 -9
- package/dist/node_modules/@dalcode/dal-capabilities/src/match.js +1 -1
- package/dist/node_modules/@dalcode/dal-capabilities/src/state.js +3 -3
- package/dist/node_modules/@dalcode/dal-codeindex/package.json +34 -0
- package/dist/node_modules/@dalcode/dal-codeindex/src/extract.js +3 -0
- package/dist/node_modules/@dalcode/dal-codeindex/src/format.js +11 -0
- package/dist/node_modules/@dalcode/dal-codeindex/src/index.js +4 -0
- package/dist/node_modules/@dalcode/dal-codeindex/src/indexer.js +1 -0
- package/dist/node_modules/@dalcode/dal-codeindex/src/languages.js +176 -0
- package/dist/node_modules/@dalcode/dal-codeindex/src/project.js +1 -0
- package/dist/node_modules/@dalcode/dal-codeindex/src/query.js +2 -0
- package/dist/node_modules/@dalcode/dal-codeindex/src/runtime.js +1 -0
- package/dist/node_modules/@dalcode/dal-codeindex/src/scan.js +1 -0
- package/dist/node_modules/@dalcode/dal-codeindex/src/semantic.js +2 -0
- package/dist/node_modules/@dalcode/dal-codeindex/src/sqlite.js +1 -0
- package/dist/node_modules/@dalcode/dal-codeindex/src/store.js +33 -0
- package/dist/node_modules/@dalcode/dal-codeindex/src/worker.js +1 -0
- package/dist/node_modules/@dalcode/dal-compat/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-dap/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-dap/src/install.js +2 -2
- package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-goal/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-guard/package.json +5 -4
- package/dist/node_modules/@dalcode/dal-guard/src/credentials.js +7 -1
- package/dist/node_modules/@dalcode/dal-guard/src/edit-anchor-core.js +25 -23
- package/dist/node_modules/@dalcode/dal-guard/src/edit-anchor.js +4 -4
- package/dist/node_modules/@dalcode/dal-guard/src/index.js +4 -2
- package/dist/node_modules/@dalcode/dal-guard/src/mode.js +2 -2
- package/dist/node_modules/@dalcode/dal-guard/src/policy.js +1 -0
- package/dist/node_modules/@dalcode/dal-guard/src/session-files.js +1 -0
- package/dist/node_modules/@dalcode/dal-guard/src/suspicion.js +1 -0
- package/dist/node_modules/@dalcode/dal-guard/src/workspace.js +2 -2
- package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-learn/package.json +4 -2
- package/dist/node_modules/@dalcode/dal-learn/src/engine.js +4 -4
- package/dist/node_modules/@dalcode/dal-learn/src/index.js +15 -14
- package/dist/node_modules/@dalcode/dal-learn/src/revisions.js +3 -0
- package/dist/node_modules/@dalcode/dal-learn/src/safety.js +1 -1
- package/dist/node_modules/@dalcode/dal-learn/src/skill-evolution.js +14 -14
- package/dist/node_modules/@dalcode/dal-lsp/package.json +5 -3
- package/dist/node_modules/@dalcode/dal-lsp/src/config.js +1 -1
- package/dist/node_modules/@dalcode/dal-lsp/src/index.js +14 -11
- package/dist/node_modules/@dalcode/dal-lsp/src/managed.js +1 -0
- package/dist/node_modules/@dalcode/dal-mcp/package.json +8 -5
- package/dist/node_modules/@dalcode/dal-mcp/src/child-env.js +3 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/http-client.d.ts +9 -27
- package/dist/node_modules/@dalcode/dal-mcp/src/http-client.js +1 -2
- package/dist/node_modules/@dalcode/dal-mcp/src/index.js +17 -17
- package/dist/node_modules/@dalcode/dal-mcp/src/protocol-client.d.ts +38 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/protocol-client.js +1 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/proxy.js +6 -6
- package/dist/node_modules/@dalcode/dal-mcp/src/resources.js +1 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.d.ts +10 -18
- package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.js +4 -5
- package/dist/node_modules/@dalcode/dal-mcp/src/types.d.ts +50 -5
- package/dist/node_modules/@dalcode/dal-mcp/src/types.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/package.json +3 -2
- package/dist/node_modules/@dalcode/dal-office/src/extract/cell.js +1 -0
- package/dist/node_modules/@dalcode/dal-office/src/extract/index.js +2 -2
- package/dist/node_modules/@dalcode/dal-office/src/extract/ooxml.js +4 -4
- package/dist/node_modules/@dalcode/dal-office/src/extract/pdf.js +4 -4
- package/dist/node_modules/@dalcode/dal-office/src/facts.d.ts +15 -0
- package/dist/node_modules/@dalcode/dal-office/src/facts.js +4 -0
- package/dist/node_modules/@dalcode/dal-office/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/lazy.js +1 -0
- package/dist/node_modules/@dalcode/dal-office/src/{index.d.ts → office.d.ts} +4 -5
- package/dist/node_modules/@dalcode/dal-office/src/office.js +1 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/capture.d.ts +21 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/capture.js +13 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/chart.d.ts +15 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/chart.js +3 -3
- package/dist/node_modules/@dalcode/dal-office/src/render/docx.d.ts +4 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/docx.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/render/pptx.d.ts +10 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/pptx.js +4 -3
- package/dist/node_modules/@dalcode/dal-office/src/render/table-layout.js +1 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/xlsx-chart.d.ts +24 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/xlsx-chart.js +1 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.d.ts +9 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/scratchpad.d.ts +2 -0
- package/dist/node_modules/@dalcode/dal-office/src/scratchpad.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/table-stats.js +2 -0
- package/dist/node_modules/@dalcode/dal-office/src/themes.d.ts +2 -0
- package/dist/node_modules/@dalcode/dal-office/src/themes.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/tools/chart-generate.js +4 -3
- package/dist/node_modules/@dalcode/dal-office/src/tools/doc-generate.js +2 -3
- package/dist/node_modules/@dalcode/dal-office/src/tools/docx-edit.js +5 -5
- package/dist/node_modules/@dalcode/dal-office/src/tools/drawio-generate.js +2 -3
- package/dist/node_modules/@dalcode/dal-office/src/tools/md-generate.js +2 -3
- package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-generate.js +5 -2
- package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-plan.js +4 -2
- package/dist/node_modules/@dalcode/dal-office/src/tools/pptx-edit.js +5 -5
- package/dist/node_modules/@dalcode/dal-office/src/tools/read-file.js +4 -3
- package/dist/node_modules/@dalcode/dal-office/src/tools/render-page.js +4 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/sheet-generate.js +3 -3
- package/dist/node_modules/@dalcode/dal-office/src/tools/xlsx-edit.js +3 -3
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +19 -13
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/project-size.js +1 -0
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/session-scope.js +1 -0
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +19 -13
- package/dist/node_modules/@dalcode/dal-pi-kit/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/project-size.js +1 -0
- package/dist/node_modules/@dalcode/dal-pi-kit/src/session-scope.js +1 -0
- package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -5
- package/dist/node_modules/@dalcode/dal-plugins/src/brand.js +1 -1
- package/dist/node_modules/@dalcode/dal-plugins/src/index.js +10 -10
- package/dist/node_modules/@dalcode/dal-plugins/src/manage.js +7 -7
- package/dist/node_modules/@dalcode/dal-recall/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-recall/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-remote/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-rewind/src/commands.js +1 -1
- package/dist/node_modules/@dalcode/dal-rewind/src/core.d.ts +2 -1
- package/dist/node_modules/@dalcode/dal-rewind/src/core.js +8 -8
- package/dist/node_modules/@dalcode/dal-rewind/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-rewind/src/state.js +1 -1
- package/dist/node_modules/@dalcode/dal-router/package.json +13 -10
- package/dist/node_modules/@dalcode/dal-router/src/advisor.js +1 -1
- package/dist/node_modules/@dalcode/dal-router/src/commands.js +8 -8
- package/dist/node_modules/@dalcode/dal-router/src/config.d.ts +12 -34
- package/dist/node_modules/@dalcode/dal-router/src/config.js +2 -2
- package/dist/node_modules/@dalcode/dal-router/src/index.js +2 -4
- package/dist/node_modules/@dalcode/dal-router/src/notice.js +1 -0
- package/dist/node_modules/@dalcode/dal-router/src/roles/changes.js +5 -0
- package/dist/node_modules/@dalcode/dal-router/src/roles/deliverables.js +4 -0
- package/dist/node_modules/@dalcode/dal-router/src/roles/index.js +15 -0
- package/dist/node_modules/@dalcode/dal-router/src/roles/models.d.ts +50 -0
- package/dist/node_modules/@dalcode/dal-router/src/roles/models.js +1 -0
- package/dist/node_modules/@dalcode/dal-router/src/roles/planner.js +4 -0
- package/dist/node_modules/@dalcode/dal-router/src/roles/prompts.js +42 -0
- package/dist/node_modules/@dalcode/dal-router/src/roles/signals.js +2 -0
- package/dist/node_modules/@dalcode/dal-router/src/runtime.d.ts +3 -13
- package/dist/node_modules/@dalcode/dal-router/src/runtime.js +1 -1
- package/dist/node_modules/@dalcode/dal-router/src/subagent.js +1 -1
- package/dist/node_modules/@dalcode/dal-router/src/task-shape.d.ts +8 -0
- package/dist/node_modules/@dalcode/dal-router/src/task-shape.js +1 -0
- package/dist/node_modules/@dalcode/dal-rtk/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-skills/package.json +4 -3
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/chart-design/SKILL.md +35 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/dal-slides/SKILL.md +82 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/diagram-design/SKILL.md +7 -5
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/poster-design/SKILL.md +8 -6
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/print-design/SKILL.md +21 -8
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/diagram.html +1 -1
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/mindmap.html +1 -1
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/event-poster.html +1 -1
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/poster.css +1 -1
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/square-card.html +1 -1
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/wechat-cover.html +1 -1
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/xhs-card.html +1 -1
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/xhs-cover.html +8 -5
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/print/letter.html +1 -1
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/print/report.html +1 -1
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/print/resume.html +7 -3
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/web-design/SKILL.md +4 -4
- package/dist/node_modules/@dalcode/dal-skills/src/bundled.js +1 -1
- package/dist/node_modules/@dalcode/dal-skills/src/catalog.js +3 -2
- package/dist/node_modules/@dalcode/dal-skills/src/client.js +1 -1
- package/dist/node_modules/@dalcode/dal-skills/src/hint.js +1 -0
- package/dist/node_modules/@dalcode/dal-skills/src/index.js +13 -14
- package/dist/node_modules/@dalcode/dal-skills/src/packages.js +3 -3
- package/dist/node_modules/@dalcode/dal-skills/src/search.js +1 -1
- package/dist/node_modules/@dalcode/dal-statusline/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-structured/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-subagent/src/background.js +10 -10
- package/dist/node_modules/@dalcode/dal-subagent/src/index.js +18 -20
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/src/groups.js +1 -1
- package/dist/node_modules/@dalcode/dal-tool-catalog/src/index.js +4 -4
- package/dist/node_modules/@dalcode/dal-usage/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-workflow/LICENSE +27 -0
- package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/announce-check.js +3 -1
- package/dist/node_modules/@dalcode/dal-workflow/src/deliverable-scope.js +1 -0
- 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/dal-workflow/src/test-proof-note.js +3 -0
- package/dist/node_modules/@dalcode/dal-workflow/src/todo-snapshot.js +2 -0
- package/dist/node_modules/@dalcode/dal-workflow/src/todo.js +3 -3
- package/dist/node_modules/@dalcode/dal-workflow/src/truncation-check.js +1 -0
- package/dist/node_modules/@dalcode/dal-workflow/src/working-contract.js +1 -1
- package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
- package/dist/node_modules/@dalcode/deepailab/src/index.js +3 -3
- package/dist/node_modules/@earendil-works/pi-agent-core/README.md +5 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +2 -1
- 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 +3 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent.js +1 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +37 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +104 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js +16 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/config.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/context.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +10 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/events.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +17 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/bash.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/bounded.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/chord.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/context.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/harness.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/hooks.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/jsonl.js +4 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/collapse.js +3 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/entries.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/frames.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/generation.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/job.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/plugin.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/post-tools.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/task-api.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/tool.js +3 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/membrane.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/memory.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/scheduler.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/session.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/system.js +8 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/types.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/view.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +5 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/result.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.js +3 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.js +8 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +5 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +10 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js +2 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.js +12 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit-diff.js +16 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/image.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js +14 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.js +5 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +5 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/node.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js +1 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-ai/README.md +83 -37
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +5 -5
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/classifier-shared.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-workers-ai-system-one.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +2 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts +6 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/llama-cpp-classify.js +5 -5
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +4 -4
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +6 -6
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +5 -5
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +11 -6
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +3 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +4 -4
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/oauth-page.js +74 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js +0 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/images-models.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/index.d.ts +2 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.d.ts +539 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.js +1 -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/amazon-bedrock.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/azure.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cerebras.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/groq.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.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/opencode.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/qwen-token-plan-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.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/data/together.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/typesafe.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-ams.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-sgp.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.d.ts +90 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-api.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/telemetry.d.ts +286 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/telemetry.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/types.d.ts +23 -148
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/identity.d.ts +27 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/identity.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/transcript.d.ts +3 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/transcript.js +2 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-codemode/README.md +195 -11
- package/dist/node_modules/@earendil-works/pi-codemode/dist/cloudflare.js +1 -0
- package/dist/node_modules/@earendil-works/pi-codemode/dist/declarations.d.ts +0 -2
- package/dist/node_modules/@earendil-works/pi-codemode/dist/declarations.js +9 -84
- package/dist/node_modules/@earendil-works/pi-codemode/dist/index.d.ts +5 -2
- package/dist/node_modules/@earendil-works/pi-codemode/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-codemode/dist/portable.js +1 -0
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.d.ts +29 -0
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.js +1 -0
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/host.d.ts +3 -16
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/host.js +1 -1
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.d.ts +13 -0
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.js +1 -0
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.js +14 -6
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.d.ts +72 -0
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.js +1 -1
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.d.ts +32 -0
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.js +1 -0
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/vm.js +3 -0
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/worker.js +1 -3
- package/dist/node_modules/@earendil-works/pi-codemode/dist/source.js +4 -3
- package/dist/node_modules/@earendil-works/pi-codemode/dist/types.d.ts +51 -1
- package/dist/node_modules/@earendil-works/pi-codemode/package.json +14 -2
- package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/CHANGELOG.md +15 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/client.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/index.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.d.ts +2 -2
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/protocol/content.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.d.ts +2 -2
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.js +4 -4
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/transport.d.ts +4 -1
- package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/README.md +167 -21
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.d.ts +77 -2
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.d.ts +35 -2
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.js +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/metrics.d.ts +70 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/metrics.js +1 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/noop.d.ts +5 -2
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/noop.js +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/render.js +2 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/testing/conformance.js +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +6 -1
- package/dist/node_modules/@earendil-works/pi-tui/README.md +5 -3
- package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +2 -2
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.js +6 -6
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.js +2 -2
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +8 -7
- package/dist/node_modules/@earendil-works/pi-tui/dist/index.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/keys.js +5 -5
- package/dist/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +4 -4
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +7 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui.js +2 -2
- package/dist/node_modules/@earendil-works/pi-tui/dist/utils.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/package.json +3 -2
- package/dist/package-manager-cli.js +9 -9
- package/dist/sdk/index.d.ts +3 -3
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/office.d.ts +1 -1
- package/dist/sdk/office.js +1 -1
- package/dist/sdk/rewind.d.ts +1 -1
- package/dist/sdk/rewind.js +1 -1
- package/dist/sdk/router.d.ts +4 -4
- package/dist/sdk/router.js +1 -1
- package/dist/server/create-harness.js +1 -0
- package/dist/utils/clipboard-command.js +1 -1
- package/dist/utils/clipboard-native.js +1 -0
- package/dist/utils/clipboard.js +1 -1
- package/dist/utils/output-files.js +1 -1
- package/dist/utils/pi-user-agent.js +1 -1
- package/dist/utils/shell.js +2 -2
- package/dist/utils/temp-files.js +1 -0
- package/dist/utils/tools-manager.js +1 -1
- package/docs/security.md +24 -7
- package/examples/README.md +0 -3
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/minimal-mode.ts +4 -5
- package/examples/extensions/overlay-test.ts +2 -2
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/subagent/index.ts +4 -6
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +22 -460
- package/package.json +7 -12
- package/dist/modes/interactive/theme/theme-json.d.ts +0 -75
- package/dist/node_modules/@dalcode/dal-guard/src/review.js +0 -3
- package/dist/node_modules/@dalcode/dal-office/src/scenes.js +0 -1
- package/dist/node_modules/@dalcode/dal-plugins/src/rank.js +0 -4
- package/dist/node_modules/@dalcode/dal-router/src/assist.js +0 -4
- package/dist/node_modules/@dalcode/dal-router/src/compact-defer.js +0 -3
- package/dist/node_modules/@dalcode/dal-router/src/jev.d.ts +0 -52
- package/dist/node_modules/@dalcode/dal-router/src/jev.js +0 -5
- package/dist/node_modules/@dalcode/dal-router/src/router.d.ts +0 -32
- package/dist/node_modules/@dalcode/dal-router/src/router.js +0 -1
- package/dist/node_modules/@dalcode/dal-router/src/services.js +0 -1
- package/dist/node_modules/@dalcode/dal-subagent/src/role-pick.js +0 -2
- package/dist/node_modules/@earendil-works/chord/README.md +0 -264
- package/dist/node_modules/@earendil-works/chord/dist/api.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/bundler.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/context/index.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/delta/apply-immutable-trusted.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/delta/diff.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/delta/index.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/delta/revision-validator.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/delta/tracker.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/facets/host.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/facets/loader.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/index.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/json.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/node/bundle-loader.js +0 -2
- package/dist/node_modules/@earendil-works/chord/dist/node/bundle.js +0 -4
- package/dist/node_modules/@earendil-works/chord/dist/node/manifest.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/node/package.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/node.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/services/consumer.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/services/errors.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/services/handle.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/services/instances.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/services/loopback.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/services/provider.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/services/state-codec.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/services/state-internals.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/services/state.js +0 -1
- package/dist/node_modules/@earendil-works/chord/dist/services/wire.js +0 -1
- package/dist/node_modules/@earendil-works/chord/package.json +0 -62
- package/dist/node_modules/@earendil-works/chord/src/delta/README.md +0 -191
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.d.ts +0 -63
- package/dist/node_modules/@earendil-works/pi-client/CHANGELOG.md +0 -45
- package/dist/node_modules/@earendil-works/pi-client/LICENSE +0 -21
- package/dist/node_modules/@earendil-works/pi-client/README.md +0 -72
- package/dist/node_modules/@earendil-works/pi-client/dist/client.js +0 -1
- package/dist/node_modules/@earendil-works/pi-client/dist/connection.js +0 -1
- package/dist/node_modules/@earendil-works/pi-client/dist/errors.js +0 -1
- package/dist/node_modules/@earendil-works/pi-client/dist/index.js +0 -1
- package/dist/node_modules/@earendil-works/pi-client/dist/promise.js +0 -1
- package/dist/node_modules/@earendil-works/pi-client/dist/types.js +0 -0
- package/dist/node_modules/@earendil-works/pi-client/dist/unix.js +0 -1
- package/dist/node_modules/@earendil-works/pi-client/package.json +0 -46
- package/dist/node_modules/@earendil-works/pi-protocol/LICENSE +0 -21
- package/dist/node_modules/@earendil-works/pi-protocol/README.md +0 -41
- package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/decoder.js +0 -1
- package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/encoder.js +0 -1
- package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/index.js +0 -1
- package/dist/node_modules/@earendil-works/pi-protocol/dist/cbor/options.js +0 -1
- package/dist/node_modules/@earendil-works/pi-protocol/dist/codec.js +0 -1
- package/dist/node_modules/@earendil-works/pi-protocol/dist/framing.js +0 -1
- package/dist/node_modules/@earendil-works/pi-protocol/dist/index.js +0 -1
- package/dist/node_modules/@earendil-works/pi-protocol/dist/protocol.js +0 -1
- package/dist/node_modules/@earendil-works/pi-protocol/dist/schemas.js +0 -1
- package/dist/node_modules/@earendil-works/pi-protocol/package.json +0 -39
- package/dist/node_modules/@earendil-works/pi-server/CHANGELOG.md +0 -81
- package/dist/node_modules/@earendil-works/pi-server/LICENSE +0 -21
- package/dist/node_modules/@earendil-works/pi-server/README.md +0 -63
- package/dist/node_modules/@earendil-works/pi-server/dist/connection.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/errors.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/index.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/listener.js +0 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/server.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/session-router.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/client.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/host.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/index.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/server.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/address.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/index.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/listener.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/preset.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/types.js +0 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/types.js +0 -0
- package/dist/node_modules/@earendil-works/pi-server/package.json +0 -45
- package/examples/plugins/pi-example-plugin/README.md +0 -38
- package/examples/plugins/pi-example-plugin/package.json +0 -10
- package/examples/plugins/pi-example-plugin/src/contract.ts +0 -13
- package/examples/plugins/pi-example-plugin/src/session.ts +0 -24
- package/examples/plugins/pi-example-plugin/src/tui.ts +0 -31
- /package/dist/node_modules/{@earendil-works/chord → @dalcode/dal-codeindex}/LICENSE +0 -0
- /package/dist/node_modules/@earendil-works/{chord/dist → pi-agent-core/dist/harness/session/testing}/types.js +0 -0
- /package/dist/node_modules/@earendil-works/{chord/dist/delta/draft.js → pi-agent-core/dist/harness/tools/tool-context.js} +0 -0
- /package/dist/node_modules/@earendil-works/{pi-client/dist/transport.js → pi-agent-core/dist/search/index.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
var N=Object.defineProperty;var a=(r,e)=>N(r,"name",{value:e,configurable:!0});import{DEFAULT_MAX_AGENT_RETRY_DELAY_MS as O}from"@earendil-works/pi-ai";import{randomUUID as A}from"crypto";import{existsSync as P,mkdirSync as D,readFileSync as R}from"fs";import{dirname as W,join as m}from"path";import _ from"proper-lockfile";import{CONFIG_DIR_NAME as E,getAgentDir as $}from"../config.js";import{normalizePath as w,resolvePath as f}from"../utils/paths.js";import{stripBom as k}from"../utils/text.js";import{DEFAULT_HTTP_IDLE_TIMEOUT_MS as U,parseHttpIdleTimeoutMs as B}from"./http-dispatcher.js";import{declaredDataFormat as p,reportNewerDataFormat as H,writeFileAtomicSync as V}from"./shared-data.js";const q=8e4,X={reserveTokens:16384,keepRecentTokens:2e4,maxContextTokens:q},K=32e3,G=5,Q=["off","streaming","idle"];function M(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}a(M,"isMergeableObject");function C(r,e){const t={...r};for(const s of Object.keys(e)){const i=e[s];if(i===void 0)continue;const o=r[s];t[s]=M(o)&&M(i)?C(o,i):i}return t}a(C,"deepMergeObjects");const z=["read","bash","edit","write"];function S(r){return typeof r=="string"&&(r.startsWith("+")||r.startsWith("-"))}a(S,"isToolModifier");function me(r){const e=r.filter(S);if(e.length===0)return;if(e.length<r.length)return"tool names cannot be mixed with +name or -name entries";const t=e.find(s=>s.includes("*"));if(t)return`+name and -name entries take exact tool names, not patterns: ${t}`}a(me,"getToolListError");function J(r,e){const t=[...r];for(const s of e){if(!S(s))continue;const i=s.slice(1),o=t.indexOf(i);s.startsWith("+")&&o===-1&&i?t.push(i):s.startsWith("-")&&o!==-1&&t.splice(o,1)}return t}a(J,"applyToolModifiers");function Y(r,e){return e===void 0?r:!Array.isArray(r)||!Array.isArray(e)||!e.every(S)?e:[...r,...e]}a(Y,"mergeDefaultTools");function Z(r){const e=r.filter(t=>!S(t));return J(e.length>0||r.length===0?e:z,r)}a(Z,"resolveDefaultTools");function h(r,e){const t=C(r,e),s=Y(r.defaultTools,e.defaultTools);return s===void 0?t:{...t,defaultTools:s}}a(h,"deepMergeSettings");function x(r,e){const t=B(r);if(t!==void 0)return t;if(r!==void 0)throw new Error(`Invalid ${e} setting: ${String(r)}`)}a(x,"parseTimeoutSetting");const b=1,T=["enableAnalytics","trackingId"];function ee(r){let e;try{e=JSON.parse(k(r))}catch{return}if(typeof e!="object"||e===null||Array.isArray(e))return;const t=e;if(!(p(t)>b)&&T.some(s=>s in t)){for(const s of T)delete t[s];return JSON.stringify(t,null,2)}}a(ee,"withoutRetiredKeys");function y(r,e,t){return{scope:r,...t?{path:t}:{},error:e instanceof Error?e:new Error(String(e))}}a(y,"toSettingsError");class te{static{a(this,"FileSettingsStorage")}globalSettingsPath;projectSettingsPath;constructor(e,t){const s=f(e),i=f(t);this.globalSettingsPath=m(i,"settings.json"),this.projectSettingsPath=m(s,E,"settings.json")}acquireLockSyncWithRetry(e){let i;for(let o=1;o<=100;o++)try{return _.lockSync(e,{realpath:!1})}catch(n){if((typeof n=="object"&&n!==null&&"code"in n?String(n.code):void 0)!=="ELOCKED"||o===100)throw n;i=n;const g=Date.now();for(;Date.now()-g<20;);}throw i??new Error("Failed to acquire settings lock")}withLock(e,t){const s=e==="global"?this.globalSettingsPath:this.projectSettingsPath,i=W(s);let o;try{const n=P(s);n&&(o=this.acquireLockSyncWithRetry(s));const l=n?R(s,"utf-8"):void 0,g=t(l);g!==void 0&&(P(i)||D(i,{recursive:!0}),o||(o=this.acquireLockSyncWithRetry(s)),V(s,g))}finally{o&&o()}}}class se{static{a(this,"InMemorySettingsStorage")}global;project;withLock(e,t){const s=e==="global"?this.global:this.project,i=t(s);i!==void 0&&(e==="global"?this.global=i:this.project=i)}}class d{static{a(this,"SettingsManager")}storage;globalSettings;projectSettings;settings;projectTrusted;modifiedFields=new Set;modifiedNestedFields=new Map;modifiedProjectFields=new Set;modifiedProjectNestedFields=new Map;globalSettingsLoadError=null;projectSettingsLoadError=null;writeQueue=Promise.resolve();errors;settingsPaths;constructor(e,t,s,i=null,o=null,n=[],l=!0,g={}){this.storage=e,this.globalSettings=t,this.projectSettings=s,this.projectTrusted=l,this.globalSettingsLoadError=i,this.projectSettingsLoadError=o,this.errors=[...n],this.settingsPaths=g,this.settings=h(this.globalSettings,this.projectSettings),this.reportNewerFormatScopes()}static create(e,t=$(),s={}){const i=f(e),o=f(t),n=new te(i,o);return d.fromStorageWithPaths(n,s,{global:m(o,"settings.json"),project:m(i,E,"settings.json")})}static fromStorage(e,t={}){return d.fromStorageWithPaths(e,t)}static fromStorageWithPaths(e,t,s={}){const i=t.projectTrusted??!0,o=d.tryLoadFromStorage(e,"global"),n=d.tryLoadFromStorage(e,"project",i),l=[];return o.error&&l.push(y("global",o.error,s.global)),n.error&&l.push(y("project",n.error,s.project)),new d(e,o.settings,n.settings,o.error,n.error,l,i,s)}static inMemory(e={},t={}){const s=new se,i=d.migrateSettings(structuredClone(e));return s.withLock("global",()=>JSON.stringify(i,null,2)),d.fromStorage(s,t)}static loadFromStorage(e,t,s=!0){if(t==="project"&&!s)return{};let i;if(e.withLock(t,n=>(i=n,t==="global"&&n?ee(n):void 0)),!i)return{};const o=JSON.parse(k(i));return d.migrateSettings(o)}static tryLoadFromStorage(e,t,s=!0){try{return{settings:d.loadFromStorage(e,t,s),error:null}}catch(i){return{settings:{},error:i}}}static migrateSettings(e){for(const t of T)delete e[t];if("queueMode"in e&&!("steeringMode"in e)&&(e.steeringMode=e.queueMode,delete e.queueMode),!("transport"in e)&&typeof e.websockets=="boolean"&&(e.transport=e.websockets?"websocket":"sse",delete e.websockets),"skills"in e&&typeof e.skills=="object"&&e.skills!==null&&!Array.isArray(e.skills)){const t=e.skills;t.enableSkillCommands!==void 0&&e.enableSkillCommands===void 0&&(e.enableSkillCommands=t.enableSkillCommands),Array.isArray(t.customDirectories)&&t.customDirectories.length>0?e.skills=t.customDirectories:delete e.skills}if("retry"in e&&typeof e.retry=="object"&&e.retry!==null&&!Array.isArray(e.retry)){const t=e.retry,s=typeof t.provider=="object"&&t.provider!==null?t.provider:void 0;typeof t.maxDelayMs=="number"&&(s?.maxRetryDelayMs===void 0||s?.maxRetryDelayMs===null)&&(t.provider={...s??{},maxRetryDelayMs:t.maxDelayMs}),delete t.maxDelayMs}return e}getSettings(){return structuredClone(this.settings)}getGlobalSettings(){return structuredClone(this.globalSettings)}getProjectSettings(){return structuredClone(this.projectSettings)}isProjectTrusted(){return this.projectTrusted}setProjectTrusted(e){if(this.projectTrusted===e)return;if(this.projectTrusted=e,this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear(),!e){this.projectSettings={},this.projectSettingsLoadError=null,this.settings=h(this.globalSettings,this.projectSettings);return}const t=d.tryLoadFromStorage(this.storage,"project",e);this.projectSettings=t.settings,this.projectSettingsLoadError=t.error,t.error&&this.recordError("project",t.error),this.settings=h(this.globalSettings,this.projectSettings)}async reload(){await this.writeQueue;const e=d.tryLoadFromStorage(this.storage,"global");e.error?(this.globalSettingsLoadError=e.error,this.recordError("global",e.error)):(this.globalSettings=e.settings,this.globalSettingsLoadError=null),this.modifiedFields.clear(),this.modifiedNestedFields.clear(),this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear();const t=d.tryLoadFromStorage(this.storage,"project",this.projectTrusted);t.error?(this.projectSettingsLoadError=t.error,this.recordError("project",t.error)):(this.projectSettings=t.settings,this.projectSettingsLoadError=null),this.settings=h(this.globalSettings,this.projectSettings),this.reportNewerFormatScopes()}applyOverrides(e){this.settings=h(this.settings,e)}markModified(e,t){this.modifiedFields.add(e),t&&(this.modifiedNestedFields.has(e)||this.modifiedNestedFields.set(e,new Set),this.modifiedNestedFields.get(e).add(t))}markProjectModified(e,t){this.modifiedProjectFields.add(e),t&&(this.modifiedProjectNestedFields.has(e)||this.modifiedProjectNestedFields.set(e,new Set),this.modifiedProjectNestedFields.get(e).add(t))}assertProjectTrustedForWrite(){if(!this.projectTrusted)throw new Error("Project is not trusted; refusing to write project settings")}reportNewerFormat(e){H(this.settingsPaths[e]??`${e} settings.json`)}reportNewerFormatScopes(){p(this.globalSettings)>b&&this.reportNewerFormat("global"),p(this.projectSettings)>b&&this.reportNewerFormat("project")}recordError(e,t){this.errors.push(y(e,t,this.settingsPaths[e]))}clearModifiedScope(e){if(e==="global"){this.modifiedFields.clear(),this.modifiedNestedFields.clear();return}this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear()}enqueueWrite(e,t){this.writeQueue=this.writeQueue.then(()=>{e==="project"&&this.assertProjectTrustedForWrite(),t(),this.clearModifiedScope(e)}).catch(s=>{this.recordError(e,s)})}cloneModifiedNestedFields(e){const t=new Map;for(const[s,i]of e.entries())t.set(s,new Set(i));return t}persistScopedSettings(e,t,s,i){this.storage.withLock(e,o=>{const n=o?JSON.parse(k(o)):{};if(p(n)>b){this.reportNewerFormat(e);return}const l=o?d.migrateSettings(n):{},g={...l};for(const c of s){const u=t[c];if(i.has(c)&&typeof u=="object"&&u!==null){const F=i.get(c),L=l[c]??{},I=u,v={...L};for(const j of F)v[j]=I[j];g[c]=v}else g[c]=u}return JSON.stringify(g,null,2)})}save(){if(this.settings=h(this.globalSettings,this.projectSettings),this.globalSettingsLoadError)return;const e=structuredClone(this.globalSettings),t=new Set(this.modifiedFields),s=this.cloneModifiedNestedFields(this.modifiedNestedFields);this.enqueueWrite("global",()=>{this.persistScopedSettings("global",e,t,s)})}saveProjectSettings(e){if(this.assertProjectTrustedForWrite(),this.projectSettings=structuredClone(e),this.settings=h(this.globalSettings,this.projectSettings),this.projectSettingsLoadError)return;const t=structuredClone(this.projectSettings),s=new Set(this.modifiedProjectFields),i=this.cloneModifiedNestedFields(this.modifiedProjectNestedFields);this.enqueueWrite("project",()=>{this.persistScopedSettings("project",t,s,i)})}updateProjectSettings(e,t){this.assertProjectTrustedForWrite();const s=structuredClone(this.projectSettings);t(s),this.markProjectModified(e),this.saveProjectSettings(s)}async flush(){await this.writeQueue}drainErrors(){const e=[...this.errors];return this.errors=[],e}getLastChangelogVersion(){return this.settings.lastChangelogVersion}setLastChangelogVersion(e){this.globalSettings.lastChangelogVersion=e,this.markModified("lastChangelogVersion"),this.save()}getSessionDir(){const e=this.settings.sessionDir;return e&&w(e)}getDefaultProvider(){return this.settings.defaultProvider}getDefaultModel(){return this.settings.defaultModel}setDefaultProvider(e){this.globalSettings.defaultProvider=e,this.markModified("defaultProvider"),this.save()}setDefaultModel(e){this.globalSettings.defaultModel=e,this.markModified("defaultModel"),this.save()}setDefaultModelAndProvider(e,t){this.globalSettings.defaultProvider=e,this.globalSettings.defaultModel=t,this.markModified("defaultProvider"),this.markModified("defaultModel"),this.save()}getSteeringMode(){return this.settings.steeringMode||"one-at-a-time"}setSteeringMode(e){this.globalSettings.steeringMode=e,this.markModified("steeringMode"),this.save()}getFollowUpMode(){return this.settings.followUpMode||"one-at-a-time"}setFollowUpMode(e){this.globalSettings.followUpMode=e,this.markModified("followUpMode"),this.save()}getThemeSetting(){const e=this.settings.theme;if(typeof e=="string")return e}getTheme(){const e=this.getThemeSetting();return e?.includes("/")?void 0:e}setTheme(e){this.globalSettings.theme=e,this.markModified("theme"),this.save()}getDefaultThinkingLevel(){return this.settings.defaultThinkingLevel}setDefaultThinkingLevel(e){this.globalSettings.defaultThinkingLevel=e,this.markModified("defaultThinkingLevel"),this.save()}getModelThinkingLevel(e,t){return this.settings.modelThinkingLevels?.[`${e}/${t}`]}getAllModelThinkingLevels(){return{...this.settings.modelThinkingLevels??{}}}setModelThinkingLevel(e,t,s){this.globalSettings.modelThinkingLevels||(this.globalSettings.modelThinkingLevels={}),this.globalSettings.modelThinkingLevels[`${e}/${t}`]=s,this.markModified("modelThinkingLevels"),this.save()}removeModelThinkingLevel(e,t){this.globalSettings.modelThinkingLevels&&(delete this.globalSettings.modelThinkingLevels[`${e}/${t}`],Object.keys(this.globalSettings.modelThinkingLevels).length===0&&delete this.globalSettings.modelThinkingLevels,this.markModified("modelThinkingLevels"),this.save())}getTransport(){return this.settings.transport??"auto"}setTransport(e){this.globalSettings.transport=e,this.markModified("transport"),this.save()}getCompactionEnabled(){return this.settings.compaction?.enabled??!0}setCompactionEnabled(e){this.globalSettings.compaction||(this.globalSettings.compaction={}),this.globalSettings.compaction.enabled=e,this.markModified("compaction","enabled"),this.save()}getCompactionTokenSetting(e,t){const s=this.settings.compaction,i=s?.[e];if(i!==void 0&&(typeof i!="number"||!Number.isSafeInteger(i)||i<0))throw new Error(`Invalid compaction.${e} setting: ${String(i)}. Expected a non-negative safe integer.`);const o=t?`${t.provider}/${t.id}`:void 0,n=o!==void 0?s?.modelOverrides?.[o]:void 0;if(n!==void 0&&!M(n))throw new Error(`Invalid compaction.modelOverrides["${o}"] setting: ${String(n)}. Expected an object.`);const l=n?.[e];if(l!==void 0&&(typeof l!="number"||!Number.isSafeInteger(l)||l<0))throw new Error(`Invalid compaction.modelOverrides["${o}"].${e} setting: ${String(l)}. Expected a non-negative safe integer.`);return l??i??X[e]}getCompactionReserveTokens(e){return this.getCompactionTokenSetting("reserveTokens",e)}getCompactionKeepRecentTokens(e){return this.getCompactionTokenSetting("keepRecentTokens",e)}getCompactionSettings(e){return{enabled:this.getCompactionEnabled(),reserveTokens:this.getCompactionReserveTokens(e),keepRecentTokens:this.getCompactionKeepRecentTokens(e),maxContextTokens:this.getCompactionMaxContextTokens(e),pruneToolOutputs:this.getCompactionPruneToolOutputs()}}getCompactionMaxContextTokens(e){return this.getCompactionTokenSetting("maxContextTokens",e)}getCompactionPruneToolOutputs(){const e=this.settings.compaction?.pruneToolOutputs;if(e!==void 0&&typeof e!="boolean")throw new Error(`Invalid compaction.pruneToolOutputs setting: ${String(e)}. Expected a boolean.`);return e??!0}getCompactionSummaryModel(){const e=this.settings.compaction?.summaryModel;if(e===void 0||e==="")return;const t=typeof e=="string"?e.indexOf("/"):-1;if(typeof e!="string"||t<=0||t===e.length-1)throw new Error(`Invalid compaction.summaryModel setting: ${String(e)}. Expected "provider/modelId".`);return{provider:e.slice(0,t),modelId:e.slice(t+1)}}getBranchSummarySettings(){return{reserveTokens:this.settings.branchSummary?.reserveTokens??16384,skipPrompt:this.settings.branchSummary?.skipPrompt??!1}}getBranchSummarySkipPrompt(){return this.settings.branchSummary?.skipPrompt??!1}getRetryEnabled(){return this.settings.retry?.enabled??!0}setRetryEnabled(e){this.globalSettings.retry||(this.globalSettings.retry={}),this.globalSettings.retry.enabled=e,this.markModified("retry","enabled"),this.save()}getRetrySettings(){return{enabled:this.getRetryEnabled(),maxRetries:this.settings.retry?.maxRetries??G,baseDelayMs:this.settings.retry?.baseDelayMs??2e3,maxAgentDelayMs:this.settings.retry?.maxAgentDelayMs??O}}getMaxOutputTokens(){const e=this.settings.maxOutputTokens;if(e===void 0)return K;if(typeof e!="number"||!Number.isSafeInteger(e)||e<0)throw new Error(`Invalid maxOutputTokens setting: ${String(e)}. Expected a non-negative safe integer.`);return e}getOutputTokenLimit(e){const t=this.getMaxOutputTokens();return t>0&&(e<=0||e>t)?t:e}getHttpIdleTimeoutMs(){return x(this.settings.httpIdleTimeoutMs,"httpIdleTimeoutMs")??U}setHttpIdleTimeoutMs(e){if(!Number.isFinite(e)||e<0)throw new Error(`Invalid httpIdleTimeoutMs setting: ${String(e)}`);this.globalSettings.httpIdleTimeoutMs=Math.floor(e),this.markModified("httpIdleTimeoutMs"),this.save()}getCacheWarmingMode(){const e=this.globalSettings.cacheWarming;return e!==void 0&&Q.includes(e)?e:"streaming"}setCacheWarmingMode(e){this.globalSettings.cacheWarming=e,this.markModified("cacheWarming"),this.save()}getProviderRetrySettings(){return{timeoutMs:this.settings.retry?.provider?.timeoutMs,maxRetries:this.settings.retry?.provider?.maxRetries,maxRetryDelayMs:this.settings.retry?.provider?.maxRetryDelayMs??6e4}}getWebSocketConnectTimeoutMs(){return x(this.settings.websocketConnectTimeoutMs,"websocketConnectTimeoutMs")}getHideThinkingBlock(){return this.settings.hideThinkingBlock??!0}getShowCacheMissNotices(){return this.settings.showCacheMissNotices??!1}getExternalEditorCommand(){const e=this.settings.externalEditor;if(typeof e=="string"&&e.trim()!=="")return e;const t=process.env.VISUAL||process.env.EDITOR;return t||(process.platform==="win32"?"notepad":"nano")}setHideThinkingBlock(e){this.globalSettings.hideThinkingBlock=e,this.markModified("hideThinkingBlock"),this.save()}setShowCacheMissNotices(e){this.globalSettings.showCacheMissNotices=e,this.markModified("showCacheMissNotices"),this.save()}getShellPath(){const e=this.settings.shellPath;return e&&w(e)}setShellPath(e){this.globalSettings.shellPath=e,this.markModified("shellPath"),this.save()}getQuietStartup(){const e=this.settings.quietStartup;return e===!1?!1:e==="header"?e:!0}setQuietStartup(e){this.globalSettings.quietStartup=e,this.markModified("quietStartup"),this.save()}getDefaultProjectTrust(){const e=this.globalSettings.defaultProjectTrust;return e==="always"||e==="never"?e:"ask"}setDefaultProjectTrust(e){this.globalSettings.defaultProjectTrust=e,this.markModified("defaultProjectTrust"),this.save()}getShellCommandPrefix(){return this.settings.shellCommandPrefix}getShellEnvironmentPolicy(){const e=this.globalSettings.shellEnvironment??{},t=[...e.exclude??[],...this.projectSettings.shellEnvironment?.exclude??[]];return{...e.inherit!==void 0?{inherit:e.inherit}:{},...t.length>0?{exclude:t}:{},...e.include!==void 0?{include:[...e.include]}:{},...e.set!==void 0?{set:{...e.set}}:{}}}getPermissionRuleSources(){return{...this.globalSettings.permissions?{user:structuredClone(this.globalSettings.permissions)}:{},...this.projectSettings.permissions?{project:structuredClone(this.projectSettings.permissions)}:{}}}getSandboxSettingsSources(){return{...this.globalSettings.sandbox?{global:structuredClone(this.globalSettings.sandbox)}:{},...this.projectSettings.sandbox?{project:structuredClone(this.projectSettings.sandbox)}:{}}}setShellCommandPrefix(e){this.globalSettings.shellCommandPrefix=e,this.markModified("shellCommandPrefix"),this.save()}getNpmCommand(){return this.settings.npmCommand?[...this.settings.npmCommand]:void 0}setNpmCommand(e){this.globalSettings.npmCommand=e?[...e]:void 0,this.markModified("npmCommand"),this.save()}getCollapseChangelog(){return this.settings.collapseChangelog??!0}setCollapseChangelog(e){this.globalSettings.collapseChangelog=e,this.markModified("collapseChangelog"),this.save()}getEnableInstallTelemetry(){return this.settings.enableInstallTelemetry??!0}setEnableInstallTelemetry(e){this.globalSettings.enableInstallTelemetry=e,this.markModified("enableInstallTelemetry"),this.save()}getOrCreateDeviceId(){return this.globalSettings.deviceId||(this.globalSettings.deviceId=A(),this.markModified("deviceId"),this.save()),this.globalSettings.deviceId}getPackages(){return[...this.settings.packages??[]]}setPackages(e){this.globalSettings.packages=e,this.markModified("packages"),this.save()}setProjectPackages(e){this.updateProjectSettings("packages",t=>{t.packages=e})}getExtensionPaths(){return[...this.settings.extensions??[]]}setExtensionPaths(e){this.globalSettings.extensions=e,this.markModified("extensions"),this.save()}setProjectExtensionPaths(e){this.updateProjectSettings("extensions",t=>{t.extensions=e})}getSkillPaths(){return[...this.settings.skills??[]]}setSkillPaths(e){this.globalSettings.skills=e,this.markModified("skills"),this.save()}setProjectSkillPaths(e){this.updateProjectSettings("skills",t=>{t.skills=e})}getPromptTemplatePaths(){return[...this.settings.prompts??[]]}setPromptTemplatePaths(e){this.globalSettings.prompts=e,this.markModified("prompts"),this.save()}setProjectPromptTemplatePaths(e){this.updateProjectSettings("prompts",t=>{t.prompts=e})}getThemePaths(){return[...this.settings.themes??[]]}setThemePaths(e){this.globalSettings.themes=e,this.markModified("themes"),this.save()}setProjectThemePaths(e){this.updateProjectSettings("themes",t=>{t.themes=e})}getEnableSkillCommands(){return this.settings.enableSkillCommands??!0}setEnableSkillCommands(e){this.globalSettings.enableSkillCommands=e,this.markModified("enableSkillCommands"),this.save()}getFactoryEnabled(){return this.settings.factoryEnabled??!0}setFactoryEnabled(e){this.globalSettings.factoryEnabled=e,this.markModified("factoryEnabled"),this.save()}getThinkingBudgets(){return this.settings.thinkingBudgets}getTerminalCapabilityOverrides(){const e=this.settings.terminal,t=e?.images;return{...t==="kitty"||t==="iterm2"?{images:t}:t===!1?{images:null}:{},...typeof e?.trueColor=="boolean"?{trueColor:e.trueColor}:{},...typeof e?.hyperlinks=="boolean"?{hyperlinks:e.hyperlinks}:{}}}getShowImages(){return this.settings.terminal?.showImages??!0}setShowImages(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showImages=e,this.markModified("terminal","showImages"),this.save()}getImageWidthCells(){const e=this.settings.terminal?.imageWidthCells;return typeof e!="number"||!Number.isFinite(e)?60:Math.max(1,Math.floor(e))}setImageWidthCells(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.imageWidthCells=Math.max(1,Math.floor(e)),this.markModified("terminal","imageWidthCells"),this.save()}getClearOnShrink(){return this.settings.terminal?.clearOnShrink!==void 0?this.settings.terminal.clearOnShrink:process.env.PI_CLEAR_ON_SHRINK==="1"}setClearOnShrink(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.clearOnShrink=e,this.markModified("terminal","clearOnShrink"),this.save()}getShowTerminalProgress(){return this.settings.terminal?.showTerminalProgress??!1}setShowTerminalProgress(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showTerminalProgress=e,this.markModified("terminal","showTerminalProgress"),this.save()}getTuiMode(){return this.settings.tuiMode==="fullscreen"?"fullscreen":(this.settings.tuiMode==="regular"||this.settings.tuiMode,"regular")}setTuiMode(e){this.globalSettings.tuiMode=e,this.markModified("tuiMode"),this.save()}getFullscreenExitOutput(){return this.settings.fullscreenExitOutput==="resume-hint"?"resume-hint":"transcript"}setFullscreenExitOutput(e){this.globalSettings.fullscreenExitOutput=e,this.markModified("fullscreenExitOutput"),this.save()}getFullscreenScrollbar(){const e=this.settings.fullscreenScrollbar;return e==="always"||e==="hidden"?e:"auto"}setFullscreenScrollbar(e){this.globalSettings.fullscreenScrollbar=e,this.markModified("fullscreenScrollbar"),this.save()}getFullscreenCopyOnSelect(){return this.settings.fullscreenCopyOnSelect??!0}setFullscreenCopyOnSelect(e){this.globalSettings.fullscreenCopyOnSelect=e,this.markModified("fullscreenCopyOnSelect"),this.save()}getFullscreenWheelScrollLines(){const e=this.settings.fullscreenWheelScrollLines;return typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.min(100,Math.floor(e))):"auto"}setFullscreenWheelScrollLines(e){this.globalSettings.fullscreenWheelScrollLines=e==="auto"?e:Math.max(1,Math.min(100,Math.floor(e))),this.markModified("fullscreenWheelScrollLines"),this.save()}getImageAutoResize(){return this.settings.images?.autoResize??!0}setImageAutoResize(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.autoResize=e,this.markModified("images","autoResize"),this.save()}getBlockImages(){return this.settings.images?.blockImages??!1}setBlockImages(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.blockImages=e,this.markModified("images","blockImages"),this.save()}getEnabledModels(){return this.settings.enabledModels}getDefaultTools(){const e=this.settings.defaultTools;if(e!==void 0)return Z(Array.isArray(e)?e.filter(t=>typeof t=="string"):[])}setEnabledModels(e){this.globalSettings.enabledModels=e,this.markModified("enabledModels"),this.save()}getDoubleEscapeAction(){return this.settings.doubleEscapeAction??"tree"}setDoubleEscapeAction(e){this.globalSettings.doubleEscapeAction=e,this.markModified("doubleEscapeAction"),this.save()}getTreeFilterMode(){const e=this.settings.treeFilterMode;return e&&["default","no-tools","user-only","labeled-only","all"].includes(e)?e:"default"}setTreeFilterMode(e){this.globalSettings.treeFilterMode=e,this.markModified("treeFilterMode"),this.save()}getShowHardwareCursor(){return this.settings.showHardwareCursor??process.env.PI_HARDWARE_CURSOR==="1"}setShowHardwareCursor(e){this.globalSettings.showHardwareCursor=e,this.markModified("showHardwareCursor"),this.save()}getEditorPaddingX(){return this.settings.editorPaddingX??1}setEditorPaddingX(e){this.globalSettings.editorPaddingX=Math.max(0,Math.min(3,Math.floor(e))),this.markModified("editorPaddingX"),this.save()}getOutputPad(){return this.settings.outputPad===1?1:0}setOutputPad(e){this.globalSettings.outputPad=e,this.markModified("outputPad"),this.save()}getAutocompleteMaxVisible(){return this.settings.autocompleteMaxVisible??5}setAutocompleteMaxVisible(e){this.globalSettings.autocompleteMaxVisible=Math.max(3,Math.min(20,Math.floor(e))),this.markModified("autocompleteMaxVisible"),this.save()}getCodeBlockIndent(){return this.settings.markdown?.codeBlockIndent??" "}getMermaidRenderingMode(){const e=this.settings.markdown?.mermaid;return e==="off"||e==="final"?e:"streaming"}setMermaidRenderingMode(e){this.globalSettings.markdown??={},this.globalSettings.markdown.mermaid=e,this.markModified("markdown","mermaid"),this.save()}getWarnings(){return{...this.settings.warnings??{}}}setWarnings(e){this.globalSettings.warnings={...e},this.markModified("warnings"),this.save()}}export{Q as CACHE_WARMING_MODES,q as DEFAULT_COMPACTION_MAX_CONTEXT_TOKENS,K as DEFAULT_MAX_OUTPUT_TOKENS,G as DEFAULT_MAX_RETRIES,z as DEFAULT_TOOL_NAMES,te as FileSettingsStorage,se as InMemorySettingsStorage,b as SETTINGS_FORMAT_VERSION,d as SettingsManager,J as applyToolModifiers,me as getToolListError,S as isToolModifier};
|
|
1
|
+
var D=Object.defineProperty;var d=(r,e)=>D(r,"name",{value:e,configurable:!0});import{DEFAULT_MAX_AGENT_RETRY_DELAY_MS as N}from"@earendil-works/pi-ai";import{randomUUID as R}from"crypto";import{existsSync as w,mkdirSync as W,readFileSync as _}from"fs";import{dirname as U,join as f}from"path";import $ from"proper-lockfile";import{CONFIG_DIR_NAME as C,getAgentDir as H}from"../config.js";import{normalizePath as x,resolvePath as p}from"../utils/paths.js";import{stripBom as T}from"../utils/text.js";import{DEFAULT_FIRST_TOKEN_TIMEOUT_MS as B,DEFAULT_HTTP_IDLE_TIMEOUT_MS as V,parseHttpIdleTimeoutMs as F}from"./http-dispatcher.js";import{SETTINGS_DEFAULTS as l}from"./settings-defaults.js";import{declaredDataFormat as S,reportNewerDataFormat as q,writeFileAtomicSync as G}from"./shared-data.js";import{DEFAULT_STALL_WATCHDOG_MS as K}from"./stall-watchdog.js";const X=8e4,z={reserveTokens:16384,keepRecentTokens:2e4,maxContextTokens:X},Q=32e3,J=5,Y=["off","streaming","idle"];function y(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}d(y,"isMergeableObject");function L(r,e){const t={...r};for(const s of Object.keys(e)){const i=e[s];if(i===void 0)continue;const o=r[s];t[s]=y(o)&&y(i)?L(o,i):i}return t}d(L,"deepMergeObjects");const Z=["read","bash","edit","write"];function b(r){return typeof r=="string"&&(r.startsWith("+")||r.startsWith("-"))}d(b,"isToolModifier");function ke(r){const e=r.filter(b);if(e.length===0)return;if(e.length<r.length)return"tool names cannot be mixed with +name or -name entries";const t=e.find(s=>s.includes("*"));if(t)return`+name and -name entries take exact tool names, not patterns: ${t}`}d(ke,"getToolListError");function ee(r,e){const t=[...r];for(const s of e){if(!b(s))continue;const i=s.slice(1),o=t.indexOf(i);s.startsWith("+")&&o===-1&&i?t.push(i):s.startsWith("-")&&o!==-1&&t.splice(o,1)}return t}d(ee,"applyToolModifiers");function te(r,e){return e===void 0?r:!Array.isArray(r)||!Array.isArray(e)||!e.every(b)?e:[...r,...e]}d(te,"mergeDefaultTools");function se(r){const e=r.filter(t=>!b(t));return ee(e.length>0||r.length===0?e:Z,r)}d(se,"resolveDefaultTools");function c(r,e){const t=L(r,e),s=te(r.defaultTools,e.defaultTools);return s===void 0?t:{...t,defaultTools:s}}d(c,"deepMergeSettings");function k(r,e){const t=F(r);if(t!==void 0)return t;if(r!==void 0)throw new Error(`Invalid ${e} setting: ${String(r)}`)}d(k,"parseTimeoutSetting");const M=1,v=["enableAnalytics","trackingId"];function ie(r){let e;try{e=JSON.parse(T(r))}catch{return}if(typeof e!="object"||e===null||Array.isArray(e))return;const t=e;if(!(S(t)>M)&&v.some(s=>s in t)){for(const s of v)delete t[s];return JSON.stringify(t,null,2)}}d(ie,"withoutRetiredKeys");function P(r,e,t){return{scope:r,...t?{path:t}:{},error:e instanceof Error?e:new Error(String(e))}}d(P,"toSettingsError");class re{static{d(this,"FileSettingsStorage")}globalSettingsPath;projectSettingsPath;constructor(e,t){const s=p(e),i=p(t);this.globalSettingsPath=f(i,"settings.json"),this.projectSettingsPath=f(s,C,"settings.json")}acquireLockSyncWithRetry(e){let i;for(let o=1;o<=100;o++)try{return $.lockSync(e,{realpath:!1})}catch(n){if((typeof n=="object"&&n!==null&&"code"in n?String(n.code):void 0)!=="ELOCKED"||o===100)throw n;i=n;const h=Date.now();for(;Date.now()-h<20;);}throw i??new Error("Failed to acquire settings lock")}withLock(e,t){const s=e==="global"?this.globalSettingsPath:this.projectSettingsPath,i=U(s);let o;try{const n=w(s);n&&(o=this.acquireLockSyncWithRetry(s));const a=n?_(s,"utf-8"):void 0,h=t(a);h!==void 0&&(w(i)||W(i,{recursive:!0}),o||(o=this.acquireLockSyncWithRetry(s)),G(s,h))}finally{o&&o()}}}class oe{static{d(this,"InMemorySettingsStorage")}global;project;withLock(e,t){const s=e==="global"?this.global:this.project,i=t(s);i!==void 0&&(e==="global"?this.global=i:this.project=i)}}class g{static{d(this,"SettingsManager")}storage;globalSettings;projectSettings;settings;projectTrusted;modifiedFields=new Set;modifiedNestedFields=new Map;modifiedProjectFields=new Set;modifiedProjectNestedFields=new Map;globalSettingsLoadError=null;projectSettingsLoadError=null;writeQueue=Promise.resolve();errors;settingsPaths;constructor(e,t,s,i=null,o=null,n=[],a=!0,h={}){this.storage=e,this.globalSettings=t,this.projectSettings=s,this.projectTrusted=a,this.globalSettingsLoadError=i,this.projectSettingsLoadError=o,this.errors=[...n],this.settingsPaths=h,this.settings=c(this.globalSettings,this.projectSettings),this.reportNewerFormatScopes()}static create(e,t=H(),s={}){const i=p(e),o=p(t),n=new re(i,o);return g.fromStorageWithPaths(n,s,{global:f(o,"settings.json"),project:f(i,C,"settings.json")})}static fromStorage(e,t={}){return g.fromStorageWithPaths(e,t)}static fromStorageWithPaths(e,t,s={}){const i=t.projectTrusted??!0,o=g.tryLoadFromStorage(e,"global"),n=g.tryLoadFromStorage(e,"project",i),a=[];return o.error&&a.push(P("global",o.error,s.global)),n.error&&a.push(P("project",n.error,s.project)),new g(e,o.settings,n.settings,o.error,n.error,a,i,s)}static inMemory(e={},t={}){const s=new oe,i=g.migrateSettings(structuredClone(e));return s.withLock("global",()=>JSON.stringify(i,null,2)),g.fromStorage(s,t)}static loadFromStorage(e,t,s=!0){if(t==="project"&&!s)return{};let i;if(e.withLock(t,n=>(i=n,t==="global"&&n?ie(n):void 0)),!i)return{};const o=JSON.parse(T(i));return g.migrateSettings(o)}static tryLoadFromStorage(e,t,s=!0){try{return{settings:g.loadFromStorage(e,t,s),error:null}}catch(i){return{settings:{},error:i}}}static migrateSettings(e){for(const t of v)delete e[t];if("queueMode"in e&&!("steeringMode"in e)&&(e.steeringMode=e.queueMode,delete e.queueMode),!("transport"in e)&&typeof e.websockets=="boolean"&&(e.transport=e.websockets?"websocket":"sse",delete e.websockets),"skills"in e&&typeof e.skills=="object"&&e.skills!==null&&!Array.isArray(e.skills)){const t=e.skills;t.enableSkillCommands!==void 0&&e.enableSkillCommands===void 0&&(e.enableSkillCommands=t.enableSkillCommands),Array.isArray(t.customDirectories)&&t.customDirectories.length>0?e.skills=t.customDirectories:delete e.skills}if("retry"in e&&typeof e.retry=="object"&&e.retry!==null&&!Array.isArray(e.retry)){const t=e.retry,s=typeof t.provider=="object"&&t.provider!==null?t.provider:void 0;typeof t.maxDelayMs=="number"&&(s?.maxRetryDelayMs===void 0||s?.maxRetryDelayMs===null)&&(t.provider={...s??{},maxRetryDelayMs:t.maxDelayMs}),delete t.maxDelayMs}return e}getSettings(){return structuredClone(this.settings)}getGlobalSettings(){return structuredClone(this.globalSettings)}getProjectSettings(){return structuredClone(this.projectSettings)}isProjectTrusted(){return this.projectTrusted}setProjectTrusted(e){if(this.projectTrusted===e)return;if(this.projectTrusted=e,this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear(),!e){this.projectSettings={},this.projectSettingsLoadError=null,this.settings=c(this.globalSettings,this.projectSettings);return}const t=g.tryLoadFromStorage(this.storage,"project",e);this.projectSettings=t.settings,this.projectSettingsLoadError=t.error,t.error&&this.recordError("project",t.error),this.settings=c(this.globalSettings,this.projectSettings)}async reload(){await this.writeQueue;const e=g.tryLoadFromStorage(this.storage,"global");e.error?(this.globalSettingsLoadError=e.error,this.recordError("global",e.error)):(this.globalSettings=e.settings,this.globalSettingsLoadError=null),this.modifiedFields.clear(),this.modifiedNestedFields.clear(),this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear();const t=g.tryLoadFromStorage(this.storage,"project",this.projectTrusted);t.error?(this.projectSettingsLoadError=t.error,this.recordError("project",t.error)):(this.projectSettings=t.settings,this.projectSettingsLoadError=null),this.settings=c(this.globalSettings,this.projectSettings),this.reportNewerFormatScopes()}applyOverrides(e){this.settings=c(this.settings,e)}markModified(e,t){this.modifiedFields.add(e),t&&(this.modifiedNestedFields.has(e)||this.modifiedNestedFields.set(e,new Set),this.modifiedNestedFields.get(e).add(t))}markProjectModified(e,t){this.modifiedProjectFields.add(e),t&&(this.modifiedProjectNestedFields.has(e)||this.modifiedProjectNestedFields.set(e,new Set),this.modifiedProjectNestedFields.get(e).add(t))}assertProjectTrustedForWrite(){if(!this.projectTrusted)throw new Error("Project is not trusted; refusing to write project settings")}reportNewerFormat(e){q(this.settingsPaths[e]??`${e} settings.json`)}reportNewerFormatScopes(){S(this.globalSettings)>M&&this.reportNewerFormat("global"),S(this.projectSettings)>M&&this.reportNewerFormat("project")}recordError(e,t){this.errors.push(P(e,t,this.settingsPaths[e]))}clearModifiedScope(e){if(e==="global"){this.modifiedFields.clear(),this.modifiedNestedFields.clear();return}this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear()}enqueueWrite(e,t){this.writeQueue=this.writeQueue.then(()=>{e==="project"&&this.assertProjectTrustedForWrite(),t(),this.clearModifiedScope(e)}).catch(s=>{this.recordError(e,s)})}cloneModifiedNestedFields(e){const t=new Map;for(const[s,i]of e.entries())t.set(s,new Set(i));return t}persistScopedSettings(e,t,s,i){this.storage.withLock(e,o=>{const n=o?JSON.parse(T(o)):{};if(S(n)>M){this.reportNewerFormat(e);return}const a=o?g.migrateSettings(n):{},h={...a};for(const u of s){const m=t[u];if(i.has(u)&&typeof m=="object"&&m!==null){const I=i.get(u),O=a[u]??{},A=m,j={...O};for(const E of I)j[E]=A[E];h[u]=j}else h[u]=m}return JSON.stringify(h,null,2)})}save(){if(this.settings=c(this.globalSettings,this.projectSettings),this.globalSettingsLoadError)return;const e=structuredClone(this.globalSettings),t=new Set(this.modifiedFields),s=this.cloneModifiedNestedFields(this.modifiedNestedFields);this.enqueueWrite("global",()=>{this.persistScopedSettings("global",e,t,s)})}saveProjectSettings(e){if(this.assertProjectTrustedForWrite(),this.projectSettings=structuredClone(e),this.settings=c(this.globalSettings,this.projectSettings),this.projectSettingsLoadError)return;const t=structuredClone(this.projectSettings),s=new Set(this.modifiedProjectFields),i=this.cloneModifiedNestedFields(this.modifiedProjectNestedFields);this.enqueueWrite("project",()=>{this.persistScopedSettings("project",t,s,i)})}updateProjectSettings(e,t){this.assertProjectTrustedForWrite();const s=structuredClone(this.projectSettings);t(s),this.markProjectModified(e),this.saveProjectSettings(s)}async flush(){await this.writeQueue}drainErrors(){const e=[...this.errors];return this.errors=[],e}getLastChangelogVersion(){return this.settings.lastChangelogVersion}setLastChangelogVersion(e){this.globalSettings.lastChangelogVersion=e,this.markModified("lastChangelogVersion"),this.save()}getSessionDir(){const e=this.settings.sessionDir;return e&&x(e)}getDefaultProvider(){return this.settings.defaultProvider}getDefaultModel(){return this.settings.defaultModel}setDefaultProvider(e){this.globalSettings.defaultProvider=e,this.markModified("defaultProvider"),this.save()}setDefaultModel(e){this.globalSettings.defaultModel=e,this.markModified("defaultModel"),this.save()}setDefaultModelAndProvider(e,t){this.globalSettings.defaultProvider=e,this.globalSettings.defaultModel=t,this.markModified("defaultProvider"),this.markModified("defaultModel"),this.save()}getSteeringMode(){return this.settings.steeringMode||l.steeringMode}setSteeringMode(e){this.globalSettings.steeringMode=e,this.markModified("steeringMode"),this.save()}getFollowUpMode(){return this.settings.followUpMode||l.followUpMode}setFollowUpMode(e){this.globalSettings.followUpMode=e,this.markModified("followUpMode"),this.save()}getThemeSetting(){const e=this.settings.theme;if(typeof e=="string")return e}getTheme(){const e=this.getThemeSetting();return e?.includes("/")?void 0:e}setTheme(e){this.globalSettings.theme=e,this.markModified("theme"),this.save()}getDefaultThinkingLevel(){return this.settings.defaultThinkingLevel}setDefaultThinkingLevel(e){this.globalSettings.defaultThinkingLevel=e,this.markModified("defaultThinkingLevel"),this.save()}getModelThinkingLevel(e,t){return this.settings.modelThinkingLevels?.[`${e}/${t}`]}getAllModelThinkingLevels(){return{...this.settings.modelThinkingLevels??{}}}setModelThinkingLevel(e,t,s){this.globalSettings.modelThinkingLevels||(this.globalSettings.modelThinkingLevels={}),this.globalSettings.modelThinkingLevels[`${e}/${t}`]=s,this.markModified("modelThinkingLevels"),this.save()}removeModelThinkingLevel(e,t){this.globalSettings.modelThinkingLevels&&(delete this.globalSettings.modelThinkingLevels[`${e}/${t}`],Object.keys(this.globalSettings.modelThinkingLevels).length===0&&delete this.globalSettings.modelThinkingLevels,this.markModified("modelThinkingLevels"),this.save())}getTransport(){return this.settings.transport??l.transport}setTransport(e){this.globalSettings.transport=e,this.markModified("transport"),this.save()}getSessionShareDestination(){const e=this.settings.sessionShareDestination;return e==="gist"||e==="radius"?e:l.sessionShareDestination}setSessionShareDestination(e){this.globalSettings.sessionShareDestination=e,this.markModified("sessionShareDestination"),this.save()}getCompactionEnabled(){return this.settings.compaction?.enabled??l.compaction.enabled}setCompactionEnabled(e){this.globalSettings.compaction||(this.globalSettings.compaction={}),this.globalSettings.compaction.enabled=e,this.markModified("compaction","enabled"),this.save()}getCompactionTokenSetting(e,t){const s=this.settings.compaction,i=s?.[e];if(i!==void 0&&(typeof i!="number"||!Number.isSafeInteger(i)||i<0))throw new Error(`Invalid compaction.${e} setting: ${String(i)}. Expected a non-negative safe integer.`);const o=t?`${t.provider}/${t.id}`:void 0,n=o!==void 0?s?.modelOverrides?.[o]:void 0;if(n!==void 0&&!y(n))throw new Error(`Invalid compaction.modelOverrides["${o}"] setting: ${String(n)}. Expected an object.`);const a=n?.[e];if(a!==void 0&&(typeof a!="number"||!Number.isSafeInteger(a)||a<0))throw new Error(`Invalid compaction.modelOverrides["${o}"].${e} setting: ${String(a)}. Expected a non-negative safe integer.`);return a??i??z[e]}getCompactionReserveTokens(e){return this.getCompactionTokenSetting("reserveTokens",e)}getCompactionKeepRecentTokens(e){return this.getCompactionTokenSetting("keepRecentTokens",e)}getCompactionSettings(e){return{enabled:this.getCompactionEnabled(),reserveTokens:this.getCompactionReserveTokens(e),keepRecentTokens:this.getCompactionKeepRecentTokens(e),maxContextTokens:this.getCompactionMaxContextTokens(e),pruneToolOutputs:this.getCompactionPruneToolOutputs()}}getCompactionMaxContextTokens(e){return this.getCompactionTokenSetting("maxContextTokens",e)}getCompactionPruneToolOutputs(){const e=this.settings.compaction?.pruneToolOutputs;if(e!==void 0&&typeof e!="boolean")throw new Error(`Invalid compaction.pruneToolOutputs setting: ${String(e)}. Expected a boolean.`);return e??!0}getCompactionSummaryModel(){const e=this.settings.compaction?.summaryModel;if(e===void 0||e==="")return;const t=typeof e=="string"?e.indexOf("/"):-1;if(typeof e!="string"||t<=0||t===e.length-1)throw new Error(`Invalid compaction.summaryModel setting: ${String(e)}. Expected "provider/modelId".`);return{provider:e.slice(0,t),modelId:e.slice(t+1)}}getBranchSummarySettings(){return{reserveTokens:this.settings.branchSummary?.reserveTokens??l.branchSummary.reserveTokens,skipPrompt:this.settings.branchSummary?.skipPrompt??l.branchSummary.skipPrompt}}getBranchSummarySkipPrompt(){return this.settings.branchSummary?.skipPrompt??l.branchSummary.skipPrompt}getRetryEnabled(){return this.settings.retry?.enabled??l.retry.enabled}setRetryEnabled(e){this.globalSettings.retry||(this.globalSettings.retry={}),this.globalSettings.retry.enabled=e,this.markModified("retry","enabled"),this.save()}getRetrySettings(){return{enabled:this.getRetryEnabled(),maxRetries:this.settings.retry?.maxRetries??J,baseDelayMs:this.settings.retry?.baseDelayMs??2e3,maxAgentDelayMs:this.settings.retry?.maxAgentDelayMs??N}}getMaxOutputTokens(){const e=this.settings.maxOutputTokens;if(e===void 0)return Q;if(typeof e!="number"||!Number.isSafeInteger(e)||e<0)throw new Error(`Invalid maxOutputTokens setting: ${String(e)}. Expected a non-negative safe integer.`);return e}getOutputTokenLimit(e){const t=this.getMaxOutputTokens();return t>0&&(e<=0||e>t)?t:e}getStallWatchdogMs(){const e=F(process.env.DAL_STALL_WATCHDOG_MS);return e!==void 0?e:k(this.settings.stallWatchdogMs,"stallWatchdogMs")??K}getHttpIdleTimeoutMs(){return k(this.settings.httpIdleTimeoutMs,"httpIdleTimeoutMs")??V}getFirstTokenTimeoutMs(){return k(this.settings.firstTokenTimeoutMs,"firstTokenTimeoutMs")??B}setHttpIdleTimeoutMs(e){if(!Number.isFinite(e)||e<0)throw new Error(`Invalid httpIdleTimeoutMs setting: ${String(e)}`);this.globalSettings.httpIdleTimeoutMs=Math.floor(e),this.markModified("httpIdleTimeoutMs"),this.save()}getCacheWarmingMode(){const e=this.globalSettings.cacheWarming;return e!==void 0&&Y.includes(e)?e:l.cacheWarming}setCacheWarmingMode(e){this.globalSettings.cacheWarming=e,this.markModified("cacheWarming"),this.save()}getProviderRetrySettings(){return{timeoutMs:this.settings.retry?.provider?.timeoutMs,maxRetries:this.settings.retry?.provider?.maxRetries,maxRetryDelayMs:this.settings.retry?.provider?.maxRetryDelayMs??l.retry.provider.maxRetryDelayMs}}getWebSocketConnectTimeoutMs(){return k(this.settings.websocketConnectTimeoutMs,"websocketConnectTimeoutMs")}getHideThinkingBlock(){return this.settings.hideThinkingBlock??!0}getShowCacheMissNotices(){return this.settings.showCacheMissNotices??l.showCacheMissNotices}getExternalEditorCommand(){const e=this.settings.externalEditor;if(typeof e=="string"&&e.trim()!=="")return e;const t=process.env.VISUAL||process.env.EDITOR;return t||(process.platform==="win32"?"notepad":"nano")}setHideThinkingBlock(e){this.globalSettings.hideThinkingBlock=e,this.markModified("hideThinkingBlock"),this.save()}setShowCacheMissNotices(e){this.globalSettings.showCacheMissNotices=e,this.markModified("showCacheMissNotices"),this.save()}getShellPath(){const e=this.settings.shellPath;return e&&x(e)}setShellPath(e){this.globalSettings.shellPath=e,this.markModified("shellPath"),this.save()}getQuietStartup(){const e=this.settings.quietStartup;return e===!1?!1:e==="header"?e:!0}setQuietStartup(e){this.globalSettings.quietStartup=e,this.markModified("quietStartup"),this.save()}getDefaultProjectTrust(){const e=this.globalSettings.defaultProjectTrust;return e==="always"||e==="never"?e:l.defaultProjectTrust}setDefaultProjectTrust(e){this.globalSettings.defaultProjectTrust=e,this.markModified("defaultProjectTrust"),this.save()}getShellCommandPrefix(){return this.settings.shellCommandPrefix}getShellEnvironmentPolicy(){const e=this.globalSettings.shellEnvironment??{},t=[...e.exclude??[],...this.projectSettings.shellEnvironment?.exclude??[]];return{...e.inherit!==void 0?{inherit:e.inherit}:{},...t.length>0?{exclude:t}:{},...e.include!==void 0?{include:[...e.include]}:{},...e.set!==void 0?{set:{...e.set}}:{}}}getPermissionRuleSources(){return{...this.globalSettings.permissions?{user:structuredClone(this.globalSettings.permissions)}:{},...this.projectSettings.permissions?{project:structuredClone(this.projectSettings.permissions)}:{}}}getSandboxSettingsSources(){return{...this.globalSettings.sandbox?{global:structuredClone(this.globalSettings.sandbox)}:{},...this.projectSettings.sandbox?{project:structuredClone(this.projectSettings.sandbox)}:{}}}setShellCommandPrefix(e){this.globalSettings.shellCommandPrefix=e,this.markModified("shellCommandPrefix"),this.save()}getNpmCommand(){return this.settings.npmCommand?[...this.settings.npmCommand]:void 0}setNpmCommand(e){this.globalSettings.npmCommand=e?[...e]:void 0,this.markModified("npmCommand"),this.save()}getCollapseChangelog(){return this.settings.collapseChangelog??!0}setCollapseChangelog(e){this.globalSettings.collapseChangelog=e,this.markModified("collapseChangelog"),this.save()}getEnableInstallTelemetry(){return this.settings.enableInstallTelemetry??l.enableInstallTelemetry}setEnableInstallTelemetry(e){this.globalSettings.enableInstallTelemetry=e,this.markModified("enableInstallTelemetry"),this.save()}getOrCreateDeviceId(){return this.globalSettings.deviceId||(this.globalSettings.deviceId=R(),this.markModified("deviceId"),this.save()),this.globalSettings.deviceId}getPackages(){return[...this.settings.packages??[]]}setPackages(e){this.globalSettings.packages=e,this.markModified("packages"),this.save()}setProjectPackages(e){this.updateProjectSettings("packages",t=>{t.packages=e})}getExtensionPaths(){return[...this.settings.extensions??[]]}setExtensionPaths(e){this.globalSettings.extensions=e,this.markModified("extensions"),this.save()}setProjectExtensionPaths(e){this.updateProjectSettings("extensions",t=>{t.extensions=e})}getSkillPaths(){return[...this.settings.skills??[]]}setSkillPaths(e){this.globalSettings.skills=e,this.markModified("skills"),this.save()}setProjectSkillPaths(e){this.updateProjectSettings("skills",t=>{t.skills=e})}getPromptTemplatePaths(){return[...this.settings.prompts??[]]}setPromptTemplatePaths(e){this.globalSettings.prompts=e,this.markModified("prompts"),this.save()}setProjectPromptTemplatePaths(e){this.updateProjectSettings("prompts",t=>{t.prompts=e})}getThemePaths(){return[...this.settings.themes??[]]}setThemePaths(e){this.globalSettings.themes=e,this.markModified("themes"),this.save()}setProjectThemePaths(e){this.updateProjectSettings("themes",t=>{t.themes=e})}getEnableSkillCommands(){return this.settings.enableSkillCommands??l.enableSkillCommands}setEnableSkillCommands(e){this.globalSettings.enableSkillCommands=e,this.markModified("enableSkillCommands"),this.save()}getFactoryEnabled(){return this.settings.factoryEnabled??!0}setFactoryEnabled(e){this.globalSettings.factoryEnabled=e,this.markModified("factoryEnabled"),this.save()}getThinkingBudgets(){return this.settings.thinkingBudgets}getTerminalCapabilityOverrides(){const e=this.settings.terminal,t=e?.images;return{...t==="kitty"||t==="iterm2"?{images:t}:t===!1?{images:null}:{},...typeof e?.trueColor=="boolean"?{trueColor:e.trueColor}:{},...typeof e?.hyperlinks=="boolean"?{hyperlinks:e.hyperlinks}:{}}}getShowImages(){return this.settings.terminal?.showImages??l.terminal.showImages}setShowImages(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showImages=e,this.markModified("terminal","showImages"),this.save()}getImageWidthCells(){const e=this.settings.terminal?.imageWidthCells;return typeof e!="number"||!Number.isFinite(e)?l.terminal.imageWidthCells:Math.max(1,Math.floor(e))}setImageWidthCells(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.imageWidthCells=Math.max(1,Math.floor(e)),this.markModified("terminal","imageWidthCells"),this.save()}getClearOnShrink(){return this.settings.terminal?.clearOnShrink!==void 0?this.settings.terminal.clearOnShrink:process.env.PI_CLEAR_ON_SHRINK==="1"?!0:l.terminal.clearOnShrink}setClearOnShrink(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.clearOnShrink=e,this.markModified("terminal","clearOnShrink"),this.save()}getShowTerminalProgress(){return this.settings.terminal?.showTerminalProgress??l.terminal.showTerminalProgress}setShowTerminalProgress(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showTerminalProgress=e,this.markModified("terminal","showTerminalProgress"),this.save()}getTuiMode(){return this.settings.tuiMode==="fullscreen"?"fullscreen":(this.settings.tuiMode==="regular"||this.settings.tuiMode,"regular")}setTuiMode(e){this.globalSettings.tuiMode=e,this.markModified("tuiMode"),this.save()}getFullscreenExitOutput(){return this.settings.fullscreenExitOutput==="resume-hint"?"resume-hint":l.fullscreenExitOutput}setFullscreenExitOutput(e){this.globalSettings.fullscreenExitOutput=e,this.markModified("fullscreenExitOutput"),this.save()}getFullscreenScrollbar(){const e=this.settings.fullscreenScrollbar;return e==="always"||e==="hidden"?e:l.fullscreenScrollbar}setFullscreenScrollbar(e){this.globalSettings.fullscreenScrollbar=e,this.markModified("fullscreenScrollbar"),this.save()}getFullscreenCopyOnSelect(){return this.settings.fullscreenCopyOnSelect??l.fullscreenCopyOnSelect}setFullscreenCopyOnSelect(e){this.globalSettings.fullscreenCopyOnSelect=e,this.markModified("fullscreenCopyOnSelect"),this.save()}getFullscreenWheelScrollLines(){const e=this.settings.fullscreenWheelScrollLines;return typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.min(100,Math.floor(e))):l.fullscreenWheelScrollLines}setFullscreenWheelScrollLines(e){this.globalSettings.fullscreenWheelScrollLines=e==="auto"?e:Math.max(1,Math.min(100,Math.floor(e))),this.markModified("fullscreenWheelScrollLines"),this.save()}getImageAutoResize(){return this.settings.images?.autoResize??l.images.autoResize}setImageAutoResize(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.autoResize=e,this.markModified("images","autoResize"),this.save()}getBlockImages(){return this.settings.images?.blockImages??l.images.blockImages}setBlockImages(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.blockImages=e,this.markModified("images","blockImages"),this.save()}getEnabledModels(){return this.settings.enabledModels}getDefaultTools(){const e=this.settings.defaultTools;if(e!==void 0)return se(Array.isArray(e)?e.filter(t=>typeof t=="string"):[])}setEnabledModels(e){this.globalSettings.enabledModels=e,this.markModified("enabledModels"),this.save()}getDoubleEscapeAction(){return this.settings.doubleEscapeAction??l.doubleEscapeAction}setDoubleEscapeAction(e){this.globalSettings.doubleEscapeAction=e,this.markModified("doubleEscapeAction"),this.save()}getTreeFilterMode(){const e=this.settings.treeFilterMode;return e&&["default","no-tools","user-only","labeled-only","all"].includes(e)?e:l.treeFilterMode}setTreeFilterMode(e){this.globalSettings.treeFilterMode=e,this.markModified("treeFilterMode"),this.save()}getShowHardwareCursor(){return this.settings.showHardwareCursor??process.env.PI_HARDWARE_CURSOR==="1"}setShowHardwareCursor(e){this.globalSettings.showHardwareCursor=e,this.markModified("showHardwareCursor"),this.save()}getEditorPaddingX(){return this.settings.editorPaddingX??1}setEditorPaddingX(e){this.globalSettings.editorPaddingX=Math.max(0,Math.min(3,Math.floor(e))),this.markModified("editorPaddingX"),this.save()}getOutputPad(){return this.settings.outputPad===1?1:0}setOutputPad(e){this.globalSettings.outputPad=e,this.markModified("outputPad"),this.save()}getAutocompleteMaxVisible(){return this.settings.autocompleteMaxVisible??l.autocompleteMaxVisible}setAutocompleteMaxVisible(e){this.globalSettings.autocompleteMaxVisible=Math.max(3,Math.min(20,Math.floor(e))),this.markModified("autocompleteMaxVisible"),this.save()}getCodeBlockIndent(){return this.settings.markdown?.codeBlockIndent??l.markdown.codeBlockIndent}getMermaidRenderingMode(){const e=this.settings.markdown?.mermaid;return e==="off"||e==="final"?e:l.markdown.mermaid}setMermaidRenderingMode(e){this.globalSettings.markdown??={},this.globalSettings.markdown.mermaid=e,this.markModified("markdown","mermaid"),this.save()}getWarnings(){return{...this.settings.warnings??{}}}setWarnings(e){this.globalSettings.warnings={...e},this.markModified("warnings"),this.save()}}export{Y as CACHE_WARMING_MODES,X as DEFAULT_COMPACTION_MAX_CONTEXT_TOKENS,Q as DEFAULT_MAX_OUTPUT_TOKENS,J as DEFAULT_MAX_RETRIES,Z as DEFAULT_TOOL_NAMES,re as FileSettingsStorage,oe as InMemorySettingsStorage,M as SETTINGS_FORMAT_VERSION,g as SettingsManager,ee as applyToolModifiers,ke as getToolListError,b as isToolModifier};
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { type Static, Type } from "typebox";
|
|
2
|
+
declare const CompactionModelOverrideSchema: Type.TObject<{
|
|
3
|
+
reserveTokens: Type.TOptional<Type.TInteger>;
|
|
4
|
+
keepRecentTokens: Type.TOptional<Type.TInteger>;
|
|
5
|
+
}>;
|
|
6
|
+
declare const CompactionSettingsSchema: Type.TObject<{
|
|
7
|
+
enabled: Type.TOptional<Type.TBoolean>;
|
|
8
|
+
reserveTokens: Type.TOptional<Type.TInteger>;
|
|
9
|
+
keepRecentTokens: Type.TOptional<Type.TInteger>;
|
|
10
|
+
modelOverrides: Type.TOptional<Type.TRecord<"^.*$", Type.TObject<{
|
|
11
|
+
reserveTokens: Type.TOptional<Type.TInteger>;
|
|
12
|
+
keepRecentTokens: Type.TOptional<Type.TInteger>;
|
|
13
|
+
}>>>;
|
|
14
|
+
}>;
|
|
15
|
+
declare const BranchSummarySettingsSchema: Type.TObject<{
|
|
16
|
+
reserveTokens: Type.TOptional<Type.TNumber>;
|
|
17
|
+
skipPrompt: Type.TOptional<Type.TBoolean>;
|
|
18
|
+
}>;
|
|
19
|
+
declare const ProviderRetrySettingsSchema: Type.TObject<{
|
|
20
|
+
timeoutMs: Type.TOptional<Type.TNumber>;
|
|
21
|
+
maxRetries: Type.TOptional<Type.TNumber>;
|
|
22
|
+
maxRetryDelayMs: Type.TOptional<Type.TNumber>;
|
|
23
|
+
}>;
|
|
24
|
+
declare const RetrySettingsSchema: Type.TObject<{
|
|
25
|
+
enabled: Type.TOptional<Type.TBoolean>;
|
|
26
|
+
maxRetries: Type.TOptional<Type.TNumber>;
|
|
27
|
+
baseDelayMs: Type.TOptional<Type.TNumber>;
|
|
28
|
+
maxAgentDelayMs: Type.TOptional<Type.TNumber>;
|
|
29
|
+
provider: Type.TOptional<Type.TObject<{
|
|
30
|
+
timeoutMs: Type.TOptional<Type.TNumber>;
|
|
31
|
+
maxRetries: Type.TOptional<Type.TNumber>;
|
|
32
|
+
maxRetryDelayMs: Type.TOptional<Type.TNumber>;
|
|
33
|
+
}>>;
|
|
34
|
+
maxDelayMs: Type.TOptional<Type.TNumber>;
|
|
35
|
+
}>;
|
|
36
|
+
declare const TerminalSettingsSchema: Type.TObject<{
|
|
37
|
+
showImages: Type.TOptional<Type.TBoolean>;
|
|
38
|
+
imageWidthCells: Type.TOptional<Type.TNumber>;
|
|
39
|
+
clearOnShrink: Type.TOptional<Type.TBoolean>;
|
|
40
|
+
showTerminalProgress: Type.TOptional<Type.TBoolean>;
|
|
41
|
+
hyperlinks: Type.TOptional<Type.TUnion<[Type.TBoolean, Type.TLiteral<"auto">]>>;
|
|
42
|
+
images: Type.TOptional<Type.TUnion<[Type.TLiteral<"kitty">, Type.TLiteral<"iterm2">, Type.TLiteral<"auto">, Type.TLiteral<false>]>>;
|
|
43
|
+
trueColor: Type.TOptional<Type.TUnion<[Type.TBoolean, Type.TLiteral<"auto">]>>;
|
|
44
|
+
}>;
|
|
45
|
+
declare const ImageSettingsSchema: Type.TObject<{
|
|
46
|
+
autoResize: Type.TOptional<Type.TBoolean>;
|
|
47
|
+
blockImages: Type.TOptional<Type.TBoolean>;
|
|
48
|
+
}>;
|
|
49
|
+
declare const ThinkingBudgetsSettingsSchema: Type.TObject<{
|
|
50
|
+
minimal: Type.TOptional<Type.TNumber>;
|
|
51
|
+
low: Type.TOptional<Type.TNumber>;
|
|
52
|
+
medium: Type.TOptional<Type.TNumber>;
|
|
53
|
+
high: Type.TOptional<Type.TNumber>;
|
|
54
|
+
}>;
|
|
55
|
+
declare const MarkdownSettingsSchema: Type.TObject<{
|
|
56
|
+
codeBlockIndent: Type.TOptional<Type.TString>;
|
|
57
|
+
mermaid: Type.TOptional<Type.TUnion<[Type.TLiteral<"off">, Type.TLiteral<"final">, Type.TLiteral<"streaming">]>>;
|
|
58
|
+
}>;
|
|
59
|
+
declare const WarningSettingsSchema: Type.TObject<{
|
|
60
|
+
anthropicExtraUsage: Type.TOptional<Type.TBoolean>;
|
|
61
|
+
}>;
|
|
62
|
+
declare const CodemodeModeSchema: Type.TUnion<[Type.TLiteral<"on">, Type.TLiteral<"only">]>;
|
|
63
|
+
declare const CodemodeSettingsSchema: Type.TObject<{
|
|
64
|
+
mode: Type.TOptional<Type.TUnion<[Type.TLiteral<"on">, Type.TLiteral<"only">]>>;
|
|
65
|
+
inlineBudget: Type.TOptional<Type.TNumber>;
|
|
66
|
+
}>;
|
|
67
|
+
declare const PackageSourceSchema: Type.TUnion<[Type.TString, Type.TObject<{
|
|
68
|
+
source: Type.TString;
|
|
69
|
+
autoload: Type.TOptional<Type.TBoolean>;
|
|
70
|
+
extensions: Type.TOptional<Type.TArray<Type.TString>>;
|
|
71
|
+
skills: Type.TOptional<Type.TArray<Type.TString>>;
|
|
72
|
+
prompts: Type.TOptional<Type.TArray<Type.TString>>;
|
|
73
|
+
themes: Type.TOptional<Type.TArray<Type.TString>>;
|
|
74
|
+
}>]>;
|
|
75
|
+
export declare const SettingsSchema: Type.TObject<{
|
|
76
|
+
$schema: Type.TOptional<Type.TString>;
|
|
77
|
+
lastChangelogVersion: Type.TOptional<Type.TString>;
|
|
78
|
+
defaultProvider: Type.TOptional<Type.TString>;
|
|
79
|
+
defaultModel: Type.TOptional<Type.TString>;
|
|
80
|
+
defaultThinkingLevel: Type.TOptional<Type.TEnum<["off", "minimal", "low", "medium", "high", "xhigh", "max"]>>;
|
|
81
|
+
modelThinkingLevels: Type.TOptional<Type.TRecord<"^.*$", Type.TEnum<["off", "minimal", "low", "medium", "high", "xhigh", "max"]>>>;
|
|
82
|
+
transport: Type.TOptional<Type.TUnion<[Type.TLiteral<"auto">, Type.TLiteral<"sse">, Type.TLiteral<"websocket">, Type.TLiteral<"websocket-cached">]>>;
|
|
83
|
+
sessionShareDestination: Type.TOptional<Type.TUnion<[Type.TLiteral<"auto">, Type.TLiteral<"gist">, Type.TLiteral<"radius">]>>;
|
|
84
|
+
steeringMode: Type.TOptional<Type.TUnion<[Type.TLiteral<"all">, Type.TLiteral<"one-at-a-time">]>>;
|
|
85
|
+
followUpMode: Type.TOptional<Type.TUnion<[Type.TLiteral<"all">, Type.TLiteral<"one-at-a-time">]>>;
|
|
86
|
+
theme: Type.TOptional<Type.TString>;
|
|
87
|
+
compaction: Type.TOptional<Type.TObject<{
|
|
88
|
+
enabled: Type.TOptional<Type.TBoolean>;
|
|
89
|
+
reserveTokens: Type.TOptional<Type.TInteger>;
|
|
90
|
+
keepRecentTokens: Type.TOptional<Type.TInteger>;
|
|
91
|
+
modelOverrides: Type.TOptional<Type.TRecord<"^.*$", Type.TObject<{
|
|
92
|
+
reserveTokens: Type.TOptional<Type.TInteger>;
|
|
93
|
+
keepRecentTokens: Type.TOptional<Type.TInteger>;
|
|
94
|
+
}>>>;
|
|
95
|
+
}>>;
|
|
96
|
+
branchSummary: Type.TOptional<Type.TObject<{
|
|
97
|
+
reserveTokens: Type.TOptional<Type.TNumber>;
|
|
98
|
+
skipPrompt: Type.TOptional<Type.TBoolean>;
|
|
99
|
+
}>>;
|
|
100
|
+
retry: Type.TOptional<Type.TObject<{
|
|
101
|
+
enabled: Type.TOptional<Type.TBoolean>;
|
|
102
|
+
maxRetries: Type.TOptional<Type.TNumber>;
|
|
103
|
+
baseDelayMs: Type.TOptional<Type.TNumber>;
|
|
104
|
+
maxAgentDelayMs: Type.TOptional<Type.TNumber>;
|
|
105
|
+
provider: Type.TOptional<Type.TObject<{
|
|
106
|
+
timeoutMs: Type.TOptional<Type.TNumber>;
|
|
107
|
+
maxRetries: Type.TOptional<Type.TNumber>;
|
|
108
|
+
maxRetryDelayMs: Type.TOptional<Type.TNumber>;
|
|
109
|
+
}>>;
|
|
110
|
+
maxDelayMs: Type.TOptional<Type.TNumber>;
|
|
111
|
+
}>>;
|
|
112
|
+
hideThinkingBlock: Type.TOptional<Type.TBoolean>;
|
|
113
|
+
showCacheMissNotices: Type.TOptional<Type.TBoolean>;
|
|
114
|
+
externalEditor: Type.TOptional<Type.TString>;
|
|
115
|
+
shellPath: Type.TOptional<Type.TString>;
|
|
116
|
+
quietStartup: Type.TOptional<Type.TUnion<[Type.TBoolean, Type.TLiteral<"header">]>>;
|
|
117
|
+
defaultProjectTrust: Type.TOptional<Type.TUnion<[Type.TLiteral<"ask">, Type.TLiteral<"always">, Type.TLiteral<"never">]>>;
|
|
118
|
+
shellCommandPrefix: Type.TOptional<Type.TString>;
|
|
119
|
+
npmCommand: Type.TOptional<Type.TArray<Type.TString>>;
|
|
120
|
+
collapseChangelog: Type.TOptional<Type.TBoolean>;
|
|
121
|
+
enableInstallTelemetry: Type.TOptional<Type.TBoolean>;
|
|
122
|
+
enableAnalytics: Type.TOptional<Type.TBoolean>;
|
|
123
|
+
trackingId: Type.TOptional<Type.TString>;
|
|
124
|
+
packages: Type.TOptional<Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
125
|
+
source: Type.TString;
|
|
126
|
+
autoload: Type.TOptional<Type.TBoolean>;
|
|
127
|
+
extensions: Type.TOptional<Type.TArray<Type.TString>>;
|
|
128
|
+
skills: Type.TOptional<Type.TArray<Type.TString>>;
|
|
129
|
+
prompts: Type.TOptional<Type.TArray<Type.TString>>;
|
|
130
|
+
themes: Type.TOptional<Type.TArray<Type.TString>>;
|
|
131
|
+
}>]>>>;
|
|
132
|
+
extensions: Type.TOptional<Type.TArray<Type.TString>>;
|
|
133
|
+
deviceId: Type.TOptional<Type.TString>;
|
|
134
|
+
skills: Type.TOptional<Type.TUnion<[Type.TArray<Type.TString>, Type.TObject<{
|
|
135
|
+
enableSkillCommands: Type.TOptional<Type.TBoolean>;
|
|
136
|
+
customDirectories: Type.TOptional<Type.TArray<Type.TString>>;
|
|
137
|
+
}>]>>;
|
|
138
|
+
prompts: Type.TOptional<Type.TArray<Type.TString>>;
|
|
139
|
+
themes: Type.TOptional<Type.TArray<Type.TString>>;
|
|
140
|
+
enableSkillCommands: Type.TOptional<Type.TBoolean>;
|
|
141
|
+
terminal: Type.TOptional<Type.TObject<{
|
|
142
|
+
showImages: Type.TOptional<Type.TBoolean>;
|
|
143
|
+
imageWidthCells: Type.TOptional<Type.TNumber>;
|
|
144
|
+
clearOnShrink: Type.TOptional<Type.TBoolean>;
|
|
145
|
+
showTerminalProgress: Type.TOptional<Type.TBoolean>;
|
|
146
|
+
hyperlinks: Type.TOptional<Type.TUnion<[Type.TBoolean, Type.TLiteral<"auto">]>>;
|
|
147
|
+
images: Type.TOptional<Type.TUnion<[Type.TLiteral<"kitty">, Type.TLiteral<"iterm2">, Type.TLiteral<"auto">, Type.TLiteral<false>]>>;
|
|
148
|
+
trueColor: Type.TOptional<Type.TUnion<[Type.TBoolean, Type.TLiteral<"auto">]>>;
|
|
149
|
+
}>>;
|
|
150
|
+
images: Type.TOptional<Type.TObject<{
|
|
151
|
+
autoResize: Type.TOptional<Type.TBoolean>;
|
|
152
|
+
blockImages: Type.TOptional<Type.TBoolean>;
|
|
153
|
+
}>>;
|
|
154
|
+
enabledModels: Type.TOptional<Type.TArray<Type.TString>>;
|
|
155
|
+
defaultTools: Type.TOptional<Type.TArray<Type.TString>>;
|
|
156
|
+
doubleEscapeAction: Type.TOptional<Type.TUnion<[Type.TLiteral<"fork">, Type.TLiteral<"tree">, Type.TLiteral<"none">]>>;
|
|
157
|
+
treeFilterMode: Type.TOptional<Type.TUnion<[Type.TLiteral<"default">, Type.TLiteral<"no-tools">, Type.TLiteral<"user-only">, Type.TLiteral<"labeled-only">, Type.TLiteral<"all">]>>;
|
|
158
|
+
thinkingBudgets: Type.TOptional<Type.TObject<{
|
|
159
|
+
minimal: Type.TOptional<Type.TNumber>;
|
|
160
|
+
low: Type.TOptional<Type.TNumber>;
|
|
161
|
+
medium: Type.TOptional<Type.TNumber>;
|
|
162
|
+
high: Type.TOptional<Type.TNumber>;
|
|
163
|
+
}>>;
|
|
164
|
+
editorPaddingX: Type.TOptional<Type.TNumber>;
|
|
165
|
+
outputPad: Type.TOptional<Type.TUnion<[Type.TLiteral<0>, Type.TLiteral<1>]>>;
|
|
166
|
+
autocompleteMaxVisible: Type.TOptional<Type.TNumber>;
|
|
167
|
+
showHardwareCursor: Type.TOptional<Type.TBoolean>;
|
|
168
|
+
markdown: Type.TOptional<Type.TObject<{
|
|
169
|
+
codeBlockIndent: Type.TOptional<Type.TString>;
|
|
170
|
+
mermaid: Type.TOptional<Type.TUnion<[Type.TLiteral<"off">, Type.TLiteral<"final">, Type.TLiteral<"streaming">]>>;
|
|
171
|
+
}>>;
|
|
172
|
+
warnings: Type.TOptional<Type.TObject<{
|
|
173
|
+
anthropicExtraUsage: Type.TOptional<Type.TBoolean>;
|
|
174
|
+
}>>;
|
|
175
|
+
codemode: Type.TOptional<Type.TObject<{
|
|
176
|
+
mode: Type.TOptional<Type.TUnion<[Type.TLiteral<"on">, Type.TLiteral<"only">]>>;
|
|
177
|
+
inlineBudget: Type.TOptional<Type.TNumber>;
|
|
178
|
+
}>>;
|
|
179
|
+
sessionDir: Type.TOptional<Type.TString>;
|
|
180
|
+
httpProxy: Type.TOptional<Type.TString>;
|
|
181
|
+
httpIdleTimeoutMs: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TLiteral<"disabled">]>>;
|
|
182
|
+
stallWatchdogMs: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TLiteral<"disabled">]>>;
|
|
183
|
+
firstTokenTimeoutMs: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TLiteral<"disabled">]>>;
|
|
184
|
+
cacheWarming: Type.TOptional<Type.TUnion<[Type.TLiteral<"off">, Type.TLiteral<"streaming">, Type.TLiteral<"idle">]>>;
|
|
185
|
+
websocketConnectTimeoutMs: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TLiteral<"disabled">]>>;
|
|
186
|
+
tuiMode: Type.TOptional<Type.TUnion<[Type.TLiteral<"regular">, Type.TLiteral<"fullscreen">]>>;
|
|
187
|
+
fullscreenExitOutput: Type.TOptional<Type.TUnion<[Type.TLiteral<"transcript">, Type.TLiteral<"resume-hint">]>>;
|
|
188
|
+
fullscreenScrollbar: Type.TOptional<Type.TUnion<[Type.TLiteral<"auto">, Type.TLiteral<"always">, Type.TLiteral<"hidden">]>>;
|
|
189
|
+
fullscreenCopyOnSelect: Type.TOptional<Type.TBoolean>;
|
|
190
|
+
fullscreenWheelScrollLines: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TLiteral<"auto">]>>;
|
|
191
|
+
queueMode: Type.TOptional<Type.TUnion<[Type.TLiteral<"all">, Type.TLiteral<"one-at-a-time">]>>;
|
|
192
|
+
websockets: Type.TOptional<Type.TBoolean>;
|
|
193
|
+
}>;
|
|
194
|
+
type SettingsInput = Static<typeof SettingsSchema>;
|
|
195
|
+
export interface CompactionModelOverride extends Static<typeof CompactionModelOverrideSchema> {
|
|
196
|
+
}
|
|
197
|
+
export interface CompactionSettings extends Static<typeof CompactionSettingsSchema> {
|
|
198
|
+
}
|
|
199
|
+
export interface BranchSummarySettings extends Static<typeof BranchSummarySettingsSchema> {
|
|
200
|
+
}
|
|
201
|
+
export interface ProviderRetrySettings extends Static<typeof ProviderRetrySettingsSchema> {
|
|
202
|
+
}
|
|
203
|
+
export interface RetrySettings extends Omit<Static<typeof RetrySettingsSchema>, "maxDelayMs"> {
|
|
204
|
+
}
|
|
205
|
+
export interface TerminalSettings extends Static<typeof TerminalSettingsSchema> {
|
|
206
|
+
}
|
|
207
|
+
export interface ImageSettings extends Static<typeof ImageSettingsSchema> {
|
|
208
|
+
}
|
|
209
|
+
export interface ThinkingBudgetsSettings extends Static<typeof ThinkingBudgetsSettingsSchema> {
|
|
210
|
+
}
|
|
211
|
+
export type MermaidRenderingMode = NonNullable<Static<typeof MarkdownSettingsSchema>["mermaid"]>;
|
|
212
|
+
export interface MarkdownSettings extends Static<typeof MarkdownSettingsSchema> {
|
|
213
|
+
}
|
|
214
|
+
export interface WarningSettings extends Static<typeof WarningSettingsSchema> {
|
|
215
|
+
}
|
|
216
|
+
export type CodemodeMode = Static<typeof CodemodeModeSchema>;
|
|
217
|
+
export interface CodemodeSettings extends Static<typeof CodemodeSettingsSchema> {
|
|
218
|
+
}
|
|
219
|
+
export type DefaultProjectTrust = NonNullable<SettingsInput["defaultProjectTrust"]>;
|
|
220
|
+
export type QuietStartup = NonNullable<SettingsInput["quietStartup"]>;
|
|
221
|
+
export type TransportSetting = NonNullable<SettingsInput["transport"]>;
|
|
222
|
+
export type SessionShareDestination = NonNullable<SettingsInput["sessionShareDestination"]>;
|
|
223
|
+
export type PackageSource = Static<typeof PackageSourceSchema>;
|
|
224
|
+
export type FullscreenExitOutput = NonNullable<SettingsInput["fullscreenExitOutput"]>;
|
|
225
|
+
export type TuiMode = NonNullable<SettingsInput["tuiMode"]>;
|
|
226
|
+
export type CacheWarmingMode = NonNullable<SettingsInput["cacheWarming"]>;
|
|
227
|
+
export interface Settings extends Omit<SettingsInput, "queueMode" | "retry" | "skills" | "websockets"> {
|
|
228
|
+
retry?: RetrySettings;
|
|
229
|
+
skills?: string[];
|
|
230
|
+
}
|
|
231
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p=Object.defineProperty;var o=(i,c)=>p(i,"name",{value:c,configurable:!0});import{ModelThinkingLevelSchema as r}from"@earendil-works/pi-ai/providers/model-schema";import{Type as e}from"typebox";import{SETTINGS_DEFAULTS as t}from"./settings-defaults.js";function n(i={}){return e.Integer({minimum:0,maximum:Number.MAX_SAFE_INTEGER,...i})}o(n,"nonNegativeSafeInteger");function a(i){return e.Union([e.Number({minimum:0}),e.Literal("disabled")],i)}o(a,"timeoutSetting");const m=e.Object({reserveTokens:e.Optional(n()),keepRecentTokens:e.Optional(n())}),u=e.Object({enabled:e.Optional(e.Boolean({default:t.compaction.enabled})),reserveTokens:e.Optional(n({default:t.compaction.reserveTokens})),keepRecentTokens:e.Optional(n({default:t.compaction.keepRecentTokens})),modelOverrides:e.Optional(e.Record(e.String(),m,{description:'Per-model overrides keyed by exact "provider/modelId" strings.'}))}),g=e.Object({reserveTokens:e.Optional(e.Number({description:"Tokens reserved for the prompt and LLM response.",default:t.branchSummary.reserveTokens})),skipPrompt:e.Optional(e.Boolean({description:'When true, skips the "Summarize branch?" prompt and defaults to no summary.',default:t.branchSummary.skipPrompt}))}),h=e.Object({timeoutMs:e.Optional(e.Number({description:"SDK or provider request timeout in milliseconds."})),maxRetries:e.Optional(e.Number({description:"SDK or provider retry attempts."})),maxRetryDelayMs:e.Optional(e.Number({description:"Maximum server-requested delay before failing.",default:t.retry.provider.maxRetryDelayMs}))}),f=e.Object({enabled:e.Optional(e.Boolean({default:t.retry.enabled})),maxRetries:e.Optional(e.Number({default:t.retry.maxRetries})),baseDelayMs:e.Optional(e.Number({description:"Exponential backoff base delay in milliseconds: 2s, 4s, 8s.",default:t.retry.baseDelayMs})),maxAgentDelayMs:e.Optional(e.Number({default:t.retry.maxAgentDelayMs})),provider:e.Optional(h),maxDelayMs:e.Optional(e.Number({description:"Legacy retry delay setting. Use provider.maxRetryDelayMs instead.",deprecated:!0}))}),O=e.Object({showImages:e.Optional(e.Boolean({description:"Show images when the terminal supports them.",default:t.terminal.showImages})),imageWidthCells:e.Optional(e.Number({description:"Preferred inline image width in terminal cells.",default:t.terminal.imageWidthCells})),clearOnShrink:e.Optional(e.Boolean({description:"Clear empty rows when content shrinks.",default:t.terminal.clearOnShrink})),showTerminalProgress:e.Optional(e.Boolean({description:"Show OSC 9;4 terminal progress indicators.",default:t.terminal.showTerminalProgress})),hyperlinks:e.Optional(e.Union([e.Boolean(),e.Literal("auto")])),images:e.Optional(e.Union([e.Literal("kitty"),e.Literal("iterm2"),e.Literal("auto"),e.Literal(!1)])),trueColor:e.Optional(e.Union([e.Boolean(),e.Literal("auto")]))}),b=e.Object({autoResize:e.Optional(e.Boolean({description:"Resize images to 2000x2000 maximum for better model compatibility.",default:t.images.autoResize})),blockImages:e.Optional(e.Boolean({description:"When true, prevents all images from being sent to LLM providers.",default:t.images.blockImages}))});function l(i){return e.Object({minimal:e.Optional(e.Number()),low:e.Optional(e.Number()),medium:e.Optional(e.Number()),high:e.Optional(e.Number())},i)}o(l,"thinkingBudgetsSettings");const U=l(),S=e.Object({codeBlockIndent:e.Optional(e.String({default:t.markdown.codeBlockIndent})),mermaid:e.Optional(e.Union([e.Literal("off"),e.Literal("final"),e.Literal("streaming")],{default:t.markdown.mermaid}))}),y=e.Object({anthropicExtraUsage:e.Optional(e.Boolean({default:t.warnings.anthropicExtraUsage}))});function s(i){return e.Union([e.Literal("on"),e.Literal("only")],i)}o(s,"codemodeMode");const B=s(),k=e.Object({mode:e.Optional(s({description:'How codemode presents tools. "on" keeps direct tools declared and annotates tools callable from scripts; codemode lists only tools without direct exposure. "only" lists every script-callable tool in codemode and does not declare active direct tools.',default:t.codemode.mode})),inlineBudget:e.Optional(e.Number({minimum:0,description:"Estimated tokens available for inline codemode tool declarations.",default:t.codemode.inlineBudget}))}),L=e.Union([e.String({description:"Load all resources from the package."}),e.Object({source:e.String(),autoload:e.Optional(e.Boolean({description:"When false, start empty and only apply explicit resource patterns."})),extensions:e.Optional(e.Array(e.String())),skills:e.Optional(e.Array(e.String())),prompts:e.Optional(e.Array(e.String())),themes:e.Optional(e.Array(e.String()))})],{description:"Package source for npm or git packages. Use the string form to load all resources or the object form to filter resources."}),d=e.Array(e.String()),w=e.Union([d,e.Object({enableSkillCommands:e.Optional(e.Boolean()),customDirectories:e.Optional(d)},{deprecated:!0})],{description:"Local skill file paths or directories."}),C=e.Object({$schema:e.Optional(e.String({description:"JSON Schema reference."})),lastChangelogVersion:e.Optional(e.String()),defaultProvider:e.Optional(e.String()),defaultModel:e.Optional(e.String()),defaultThinkingLevel:e.Optional(r),modelThinkingLevels:e.Optional(e.Record(e.String(),r,{description:'Per-model default thinking level overrides keyed by "provider/modelId".'})),transport:e.Optional(e.Union([e.Literal("auto"),e.Literal("sse"),e.Literal("websocket"),e.Literal("websocket-cached")],{default:t.transport})),sessionShareDestination:e.Optional(e.Union([e.Literal("auto"),e.Literal("gist"),e.Literal("radius")],{description:'Destination used by /share. "auto" uses Radius when authenticated and otherwise creates a GitHub gist.',default:t.sessionShareDestination})),steeringMode:e.Optional(e.Union([e.Literal("all"),e.Literal("one-at-a-time")],{default:t.steeringMode})),followUpMode:e.Optional(e.Union([e.Literal("all"),e.Literal("one-at-a-time")],{default:t.followUpMode})),theme:e.Optional(e.String()),compaction:e.Optional(u),branchSummary:e.Optional(g),retry:e.Optional(f),hideThinkingBlock:e.Optional(e.Boolean({default:t.hideThinkingBlock})),showCacheMissNotices:e.Optional(e.Boolean({description:"Show cache cost and provider recovery notices.",default:t.showCacheMissNotices})),externalEditor:e.Optional(e.String({description:"Command for Ctrl+G external editor; takes precedence over VISUAL and EDITOR."})),shellPath:e.Optional(e.String({description:"Custom shell path, for example for Cygwin on Windows, with support for leading ~ expansion."})),quietStartup:e.Optional(e.Union([e.Boolean(),e.Literal("header")],{description:'When true, hide all startup output. When "header", keep only the startup header.',default:t.quietStartup})),defaultProjectTrust:e.Optional(e.Union([e.Literal("ask"),e.Literal("always"),e.Literal("never")],{description:"Global setting only.",default:t.defaultProjectTrust})),shellCommandPrefix:e.Optional(e.String({description:"Prefix prepended to every bash command, for example to enable shell aliases."})),npmCommand:e.Optional(e.Array(e.String(),{description:'Command used for npm package lookup and installation, in argv form such as ["mise", "exec", "node@20", "--", "npm"].'})),collapseChangelog:e.Optional(e.Boolean({description:"Show the condensed changelog after update; use /changelog for the full changelog.",default:t.collapseChangelog})),enableInstallTelemetry:e.Optional(e.Boolean({description:"Send an anonymous version and update ping after changelog-detected updates.",default:t.enableInstallTelemetry})),enableAnalytics:e.Optional(e.Boolean({description:"Opt in to analytics data sharing.",default:t.enableAnalytics})),trackingId:e.Optional(e.String({description:"Analytics tracking identifier, generated when analytics is enabled."})),packages:e.Optional(e.Array(L,{description:"npm or git package sources, as strings or objects with resource filtering."})),extensions:e.Optional(e.Array(e.String(),{description:"Local extension file paths or directories."})),deviceId:e.Optional(e.String({description:"Stable installation UUID, generated when authentication first needs it. Global only."})),skills:e.Optional(w),prompts:e.Optional(e.Array(e.String(),{description:"Local prompt template file paths or directories."})),themes:e.Optional(e.Array(e.String(),{description:"Local theme file paths or directories."})),enableSkillCommands:e.Optional(e.Boolean({description:"Register skills as /skill:name commands.",default:t.enableSkillCommands})),terminal:e.Optional(O),images:e.Optional(b),enabledModels:e.Optional(e.Array(e.String(),{description:"Model patterns for cycling, in the same format as the --models CLI flag."})),defaultTools:e.Optional(e.Array(e.String(),{description:"Initial tool selection. Plain names replace the inherited selection; +name and -name entries add or remove tools."})),doubleEscapeAction:e.Optional(e.Union([e.Literal("fork"),e.Literal("tree"),e.Literal("none")],{description:"Action for double-escape with an empty editor.",default:t.doubleEscapeAction})),treeFilterMode:e.Optional(e.Union([e.Literal("default"),e.Literal("no-tools"),e.Literal("user-only"),e.Literal("labeled-only"),e.Literal("all")],{description:"Default filter when opening /tree.",default:t.treeFilterMode})),thinkingBudgets:e.Optional(l({description:"Custom token budgets for thinking levels."})),editorPaddingX:e.Optional(e.Number({description:"Horizontal padding for the input editor.",default:t.editorPaddingX})),outputPad:e.Optional(e.Union([e.Literal(0),e.Literal(1)],{description:"Horizontal padding for transcript content.",default:t.outputPad})),autocompleteMaxVisible:e.Optional(e.Number({description:"Maximum visible items in the autocomplete dropdown.",default:t.autocompleteMaxVisible})),showHardwareCursor:e.Optional(e.Boolean({description:"Show the terminal cursor while still positioning it for IME."})),markdown:e.Optional(S),warnings:e.Optional(y),codemode:e.Optional(k),sessionDir:e.Optional(e.String({description:"Custom session storage directory, in the same format as the --session-dir CLI flag."})),httpProxy:e.Optional(e.String({description:"Proxy URL applied as HTTP_PROXY and HTTPS_PROXY for Pi-managed HTTP clients."})),httpIdleTimeoutMs:e.Optional(a({description:'HTTP header or body idle timeout in milliseconds; 0 or "disabled" disables it.'})),stallWatchdogMs:e.Optional(a({description:'Milliseconds a run may go without model output, tool output or a heartbeat before it reports where it is waiting (default 60000); 0 or "disabled" turns the report off.'})),firstTokenTimeoutMs:e.Optional(a({description:'Model requests with no output within this many milliseconds are cancelled and retried; 0 or "disabled" disables it. Default 45000.'})),cacheWarming:e.Optional(e.Union([e.Literal("off"),e.Literal("streaming"),e.Literal("idle")],{description:'Cache-warming profile. "idle" also warms between agent runs. Global only because each refresh costs money.',default:t.cacheWarming})),websocketConnectTimeoutMs:e.Optional(a({description:'WebSocket connect or open handshake timeout in milliseconds; 0 or "disabled" disables it.'})),tuiMode:e.Optional(e.Union([e.Literal("regular"),e.Literal("fullscreen")],{default:t.tuiMode})),fullscreenExitOutput:e.Optional(e.Union([e.Literal("transcript"),e.Literal("resume-hint")],{description:"No effect in regular TUI mode.",default:t.fullscreenExitOutput})),fullscreenScrollbar:e.Optional(e.Union([e.Literal("auto"),e.Literal("always"),e.Literal("hidden")],{description:"No effect in regular TUI mode.",default:t.fullscreenScrollbar})),fullscreenCopyOnSelect:e.Optional(e.Boolean({description:"No effect in regular TUI mode.",default:t.fullscreenCopyOnSelect})),fullscreenWheelScrollLines:e.Optional(e.Union([e.Number(),e.Literal("auto")],{description:"Lines scrolled per wheel event in fullscreen mode; numeric values are clamped from 1 to 100.",default:t.fullscreenWheelScrollLines})),queueMode:e.Optional(e.Union([e.Literal("all"),e.Literal("one-at-a-time")],{description:"Legacy setting migrated to steeringMode.",deprecated:!0})),websockets:e.Optional(e.Boolean({description:"Legacy setting migrated to transport.",deprecated:!0}))},{additionalProperties:!0});export{C as SettingsSchema};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type StallWaitKind = "model" | "tool" | "extension" | "user" | "compaction" | "retry" | "host" | "engine";
|
|
2
|
+
export interface StallStage {
|
|
3
|
+
name: string;
|
|
4
|
+
kind: StallWaitKind;
|
|
5
|
+
detail?: string;
|
|
6
|
+
enteredAt: number;
|
|
7
|
+
}
|
|
8
|
+
export interface StallReport {
|
|
9
|
+
phase: "stalled" | "recovered";
|
|
10
|
+
stage: string;
|
|
11
|
+
kind: StallWaitKind;
|
|
12
|
+
detail?: string;
|
|
13
|
+
idleMs: number;
|
|
14
|
+
stageMs: number;
|
|
15
|
+
runMs: number;
|
|
16
|
+
count: number;
|
|
17
|
+
}
|
|
18
|
+
export interface StallWatchdogOptions {
|
|
19
|
+
thresholdMs: number;
|
|
20
|
+
onReport: (report: StallReport) => void;
|
|
21
|
+
checkEveryMs?: number;
|
|
22
|
+
now?: () => number;
|
|
23
|
+
setInterval?: (fn: () => void, ms: number) => unknown;
|
|
24
|
+
clearInterval?: (handle: unknown) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare const DEFAULT_STALL_WATCHDOG_MS = 60000;
|
|
27
|
+
export declare class StallWatchdog {
|
|
28
|
+
private readonly thresholdMs;
|
|
29
|
+
private readonly onReport;
|
|
30
|
+
private readonly checkEveryMs;
|
|
31
|
+
private readonly now;
|
|
32
|
+
private readonly setTimer;
|
|
33
|
+
private readonly clearTimer;
|
|
34
|
+
private readonly stages;
|
|
35
|
+
private nextId;
|
|
36
|
+
private timer;
|
|
37
|
+
private runStartedAt;
|
|
38
|
+
private lastProgressAt;
|
|
39
|
+
private reported;
|
|
40
|
+
private lastReportStage;
|
|
41
|
+
constructor(options: StallWatchdogOptions);
|
|
42
|
+
get enabled(): boolean;
|
|
43
|
+
get running(): boolean;
|
|
44
|
+
start(): void;
|
|
45
|
+
stop(): void;
|
|
46
|
+
progress(): void;
|
|
47
|
+
enter(name: string, kind: StallWaitKind, detail?: string): () => void;
|
|
48
|
+
within<T>(name: string, kind: StallWaitKind, detail: string | undefined, fn: () => Promise<T> | T): Promise<T>;
|
|
49
|
+
currentStage(): StallStage;
|
|
50
|
+
check(): void;
|
|
51
|
+
private recover;
|
|
52
|
+
}
|
|
53
|
+
export declare function formatStallDuration(ms: number, lang?: "zh" | "en"): string;
|
|
54
|
+
export declare function describeStallStage(report: Pick<StallReport, "stage" | "kind" | "detail">): string;
|
|
55
|
+
export declare function formatStallNotice(report: StallReport): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var u=Object.defineProperty;var o=(n,t)=>u(n,"name",{value:t,configurable:!0});import{fill as a,getLanguage as g,t as i}from"../dal/i18n.js";const A=6e4,f={name:"engine:between-steps",kind:"engine",enteredAt:0};class w{static{o(this,"StallWatchdog")}thresholdMs;onReport;checkEveryMs;now;setTimer;clearTimer;stages=[];nextId=1;timer;runStartedAt=0;lastProgressAt=0;reported=0;lastReportStage;constructor(t){this.thresholdMs=Math.max(0,Math.floor(t.thresholdMs)),this.onReport=t.onReport,this.checkEveryMs=Math.max(50,Math.floor(t.checkEveryMs??Math.min(5e3,Math.max(this.thresholdMs/4,50)))),this.now=t.now??Date.now,this.setTimer=t.setInterval??((e,s)=>setInterval(e,s)),this.clearTimer=t.clearInterval??(e=>clearInterval(e))}get enabled(){return this.thresholdMs>0}get running(){return this.timer!==void 0}start(){if(!this.enabled)return;const t=this.now();if(this.runStartedAt=t,this.lastProgressAt=t,this.reported=0,this.lastReportStage=void 0,this.timer===void 0){const e=this.setTimer(()=>this.check(),this.checkEveryMs);e?.unref?.(),this.timer=e}}stop(){this.timer!==void 0&&(this.clearTimer(this.timer),this.timer=void 0),this.recover(),this.stages.length=0}progress(){this.enabled&&(this.recover(),this.lastProgressAt=this.now())}enter(t,e,s){if(!this.enabled)return m;const r=this.nextId++;this.progress(),this.stages.push({id:r,name:t,kind:e,detail:s,enteredAt:this.now()});let h=!1;return()=>{if(h)return;h=!0;const d=this.stages.findIndex(c=>c.id===r);d!==-1&&this.stages.splice(d,1),this.progress()}}async within(t,e,s,r){const h=this.enter(t,e,s);try{return await r()}finally{h()}}currentStage(){return this.stages[this.stages.length-1]??{...f,enteredAt:this.lastProgressAt}}check(){if(!this.enabled||this.timer===void 0)return;const t=this.now(),e=t-this.lastProgressAt,s=Math.floor(e/this.thresholdMs);if(s<=this.reported)return;this.reported=s;const r=this.currentStage();this.lastReportStage=r,this.onReport({phase:"stalled",stage:r.name,kind:r.kind,...r.detail?{detail:r.detail}:{},idleMs:e,stageMs:t-r.enteredAt,runMs:t-this.runStartedAt,count:s})}recover(){if(this.reported===0)return;const t=this.now(),e=this.lastReportStage??this.currentStage(),s=this.reported;this.reported=0,this.lastReportStage=void 0,this.onReport({phase:"recovered",stage:e.name,kind:e.kind,...e.detail?{detail:e.detail}:{},idleMs:t-this.lastProgressAt,stageMs:t-e.enteredAt,runMs:t-this.runStartedAt,count:s})}}function m(){}o(m,"noop");function p(n,t="zh"){const e=Math.max(0,Math.round(n/1e3)),s=Math.floor(e/60),r=e%60;return t==="en"?s>0?`${s}m ${String(r).padStart(2,"0")}s`:`${r}s`:s>0?`${s} \u5206 ${String(r).padStart(2,"0")} \u79D2`:`${r} \u79D2`}o(p,"formatStallDuration");function l(n){const t=n.detail??"",[,e=""]=n.stage.split(/:(.*)/s);switch(n.kind){case"extension":return a(i("\u6269\u5C55 {name} \u7684 {event} \u5904\u7406"),{name:t||"?",event:e});case"tool":return a(i("\u5DE5\u5177\u8FD0\u884C\u4E2D\uFF0C\u6CA1\u6709\u65B0\u8F93\u51FA\uFF08{detail}\uFF09"),{detail:t||e});case"model":return t?a(i("\u7B49\u5F85\u6A21\u578B {model} \u8F93\u51FA"),{model:t}):i("\u7B49\u5F85\u6A21\u578B\u8F93\u51FA");case"user":return t?a(i("\u7B49\u4F60\u56DE\u5E94\uFF1A{title}"),{title:t}):i("\u7B49\u4F60\u56DE\u5E94");case"compaction":return i("\u538B\u7F29\u4E0A\u4E0B\u6587");case"retry":return t?a(i("\u7B49\u5F85\u7B2C {attempt} \u6B21\u91CD\u8BD5"),{attempt:t}):i("\u7B49\u5F85\u91CD\u8BD5");case"host":return i("\u7B49\u5F85\u754C\u9762\u8BFB\u53D6\u8F93\u51FA");default:return n.stage==="request:preparing"?i("\u51C6\u5907\u8BF7\u6C42"):i("\u4E24\u6B65\u4E4B\u95F4")}}o(l,"describeStallStage");function v(n){const t=p(n.idleMs,g()==="en"?"en":"zh");return n.phase==="recovered"?a(i("\u5DF2\u6062\u590D\uFF08\u505C\u4E86 {duration}\uFF0C\u5728\uFF1A{stage}\uFF09"),{duration:t,stage:l(n)}):a(i("\u5DF2 {duration} \u6CA1\u6709\u8FDB\u5C55\uFF0C\u5361\u5728\uFF1A{stage}"),{duration:t,stage:l(n)})}o(v,"formatStallNotice");export{A as DEFAULT_STALL_WATCHDOG_MS,w as StallWatchdog,l as describeStallStage,p as formatStallDuration,v as formatStallNotice};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
1
|
+
var x=Object.defineProperty;var c=(e,t)=>x(e,"name",{value:t,configurable:!0});import{join as $}from"node:path";import{getSystemMessageText as j}from"@earendil-works/pi-ai";import{APP_NAME as v,APP_TITLE as p,getDalDocsPath as E,getDocsPath as T,getExamplesPath as O,getReadmePath as _,IS_WHITE_LABEL_BUILD as I}from"../config.js";import{describeGitState as N}from"./git-state.js";import{INJECTED_CONTEXT_TAG as R}from"./messages.js";import{describeProjectFacts as A}from"./project-facts.js";import{formatSkillsForPrompt as C}from"./skills.js";const F=/^[a-z][a-z0-9_-]*$/;function M(e){return{customPrompt:e.customPrompt,forceSystemPrompt:e.forceSystemPrompt,selectedTools:[...e.selectedTools??["read","bash","edit","write"]],hiddenTools:[...e.hiddenTools??[]],toolSnippets:{...e.toolSnippets??{}},toolGuidelines:Object.fromEntries(Object.entries(e.toolGuidelines??{}).map(([t,n])=>[t,[...n]])),promptGuidelines:[...e.promptGuidelines??[]],appendSystemPrompt:e.appendSystemPrompt??"",sections:{...e.sections??{}},cwd:e.cwd,gitState:e.gitState,projectFacts:e.projectFacts,contextFiles:(e.contextFiles??[]).map(t=>({...t})),skills:(e.skills??[]).map(t=>({...t}))}}c(M,"normalizeBuildSystemPromptOptions");function D(e){return["Project-specific instructions and guidelines:",...e.map(({path:t,content:n})=>`<project_instructions path="${t}">
|
|
2
2
|
${n}
|
|
3
3
|
</project_instructions>`)].join(`
|
|
4
4
|
|
|
5
|
-
`)}c(
|
|
6
|
-
`)}c(G,"buildRules");function
|
|
7
|
-
`):"(none)";
|
|
5
|
+
`)}c(D,"renderProjectContext");function G(e,t,n){const i=[],d=new Set,o=c(l=>{const m=l.trim();!m||d.has(m)||(d.add(m),i.push(m))},"addRule"),h=e.includes("bash"),u=e.includes("powershell"),a=e.includes("grep"),f=e.includes("find"),y=e.includes("ls");(h||u)&&!a&&!f&&!y&&o(h&&u?"Use bash or PowerShell for file operations like listing, searching, and finding files":u?"Use PowerShell for file operations like listing, searching, and finding files":"Use bash for file operations like ls, rg, find");for(const l of e)for(const m of t[l]??[])o(m);for(const l of n)o(l);return e.length>0&&(o("Plan a step's lookups first, then make the independent calls (reads, searches, read-only commands) together in one response; they run in parallel"),o("Use paths relative to the working directory; do not begin commands with cd into it"),o("Finish the task in this turn; ask only to choose between approaches, or before push, deploy, delete, spend or send"),o("Reproduce a reported bug before changing code; if it does not reproduce, or the premise does not match what the code or tests show, say so plainly, give the evidence and change no product code, whatever a loaded skill assumes"),o("When a protection refuses a call, stop that step and say why; never reach the same data another way"),o(`You are ${p}: adapt instructions written for another agent, and sign commits "Co-Authored-By: ${p} <noreply@deepailab.ai>", never Claude, Codex or Copilot`)),o(`Text inside <${R} type="..."> tags comes from ${p}, not the user: follow it, but do not answer it as the user's words`),o("Reply in the language of the user's latest message, whatever language tool results, skills or injected notices use"),o("Be concise, and show file paths clearly"),i.map(l=>`- ${l}`).join(`
|
|
6
|
+
`)}c(G,"buildRules");function L(e){const t=M(e),{customPrompt:n,selectedTools:i,hiddenTools:d,toolSnippets:o,toolGuidelines:h,promptGuidelines:u,appendSystemPrompt:a,sections:f,cwd:y,contextFiles:l,skills:m}=t;for(const s of Object.keys(f))if(!F.test(s)||s==="preamble")throw new Error(`Invalid system prompt section name: ${s}`);const S=i.filter(s=>!d.includes(s)),r={};if(n)r.preamble=n;else{r.preamble=`You are an expert coding assistant operating inside ${p} (${v}). You help users by reading files, executing commands, editing code, and writing new files.`;const s=S.filter(b=>!!o[b]),g=s.length>0?s.map(b=>`- ${b}: ${o[b]}`).join(`
|
|
7
|
+
`):"(none)";r.tools=`${g}
|
|
8
8
|
|
|
9
|
-
In addition to the tools above, you may have access to other custom tools depending on the project.`,
|
|
9
|
+
In addition to the tools above, you may have access to other custom tools depending on the project.`,r.rules=G(S,h,u),r.docs=z()}a&&(r.addendum=a),l.length>0&&(r.project_context=D(l));const k=["read","bash"],w=k.find(s=>S.includes(s))??(k.some(s=>i.includes(s))?"indirect":void 0);if(f.skills)r.skills=f.skills;else if(w&&m.length>0){const s=C(m,w).trim();s&&(r.skills=s)}if(r.cwd=`Current working directory: ${y.replace(/\\/g,"/")}. Commands and relative paths start here; do not cd into it first.`,t.gitState&&!f.git_state&&(r.git=N(y)),t.projectFacts&&!f.project){const s=A(y);s&&(r.project=s)}for(const[s,g]of Object.entries(f))g&&(r[s]=g);const P={preamble:r.preamble};for(const[s,g]of Object.entries(r))s!=="preamble"&&(P[s]=`<${s}>
|
|
10
10
|
${g}
|
|
11
|
-
</${s}>`);return
|
|
12
|
-
${
|
|
11
|
+
</${s}>`);return P}c(L,"buildSystemPromptSections");const U="cwd",B="Environment of this session, part of the system prompt. Later updates to these sections arrive as system prompt updates.";function Z(e){const t=e[0];if(!t||t.role!=="system"||!t.sections)return e;const n=Object.keys(t.sections),i=n.indexOf(U);if(i===-1)return e;const d=n.slice(i).map(a=>t.sections?.[a]).filter(a=>typeof a=="string"&&a.length>0),o=Object.fromEntries(n.slice(0,i).map(a=>[a,t.sections?.[a]??null])),h={...t,sections:o};if(d.length===0)return[h,...e.slice(1)];const u={role:"user",content:[{type:"text",text:`<session_environment>
|
|
12
|
+
${B}
|
|
13
13
|
|
|
14
14
|
${d.join(`
|
|
15
15
|
|
|
16
16
|
`)}
|
|
17
|
-
</session_environment>`}],timestamp:t.timestamp};return[h,
|
|
18
|
-
- Start with: ${
|
|
17
|
+
</session_environment>`}],timestamp:t.timestamp};return[h,u,...e.slice(1)]}c(Z,"moveSessionEnvironmentOutOfSystemPrompt");function W(e){return e.forceSystemPrompt!==void 0?{content:e.forceSystemPrompt}:{content:"",sections:L(e)}}c(W,"buildSystemPromptState");function ee(e){return j({role:"system",...W(e),timestamp:0})}c(ee,"buildSystemPrompt");function te(e,t){const n={};for(const[i,d]of Object.entries(t))e[i]!==d&&(n[i]=d);for(const i of Object.keys(e))t[i]===void 0&&(n[i]=null);return Object.keys(n).length>0?n:void 0}c(te,"diffSystemPromptSections");function z(){if(I){const e=E();return`${p} documentation (read only when the user asks about ${p} itself: its commands, settings, skills, prompt templates, extensions, packages, themes or keybindings):
|
|
18
|
+
- Start with: ${$(e,"README.md")}
|
|
19
19
|
- Topics, in the same folder: skills.md, prompt-templates.md, extensions.md, packages.md, themes.md, keybindings.md, settings.md
|
|
20
20
|
- Resolve those file names under ${e}, not the current working directory
|
|
21
21
|
- Read the relevant file completely before answering or implementing, and describe the product as ${p}
|
|
@@ -26,4 +26,4 @@ ${d.join(`
|
|
|
26
26
|
- When reading these docs or examples, resolve docs/... under Additional docs and examples/... under Examples, not the current working directory
|
|
27
27
|
- When asked about: extensions (docs/extensions.md, examples/extensions/), themes (docs/themes.md), skills (docs/skills.md), prompt templates (docs/prompt-templates.md), TUI components (docs/tui.md), keybindings (docs/keybindings.md), SDK integrations (docs/sdk.md), custom providers (docs/custom-provider.md), adding models (docs/models.md), packages (docs/packages.md), environment variables (docs/environment-variables.md), MCP servers (docs/mcp.md), codemode scripts and non-LLM models such as classifiers and image models (docs/codemode.md)
|
|
28
28
|
- When working on these topics, read the docs and examples, and follow .md cross-references before implementing
|
|
29
|
-
- Always read these .md files completely and follow links to related docs (e.g., tui.md for TUI API details)`}c(z,"buildDocumentationSection");export{
|
|
29
|
+
- Always read these .md files completely and follow links to related docs (e.g., tui.md for TUI API details)`}c(z,"buildDocumentationSection");export{U as SESSION_ENVIRONMENT_FIRST_SECTION,ee as buildSystemPrompt,L as buildSystemPromptSections,W as buildSystemPromptState,te as diffSystemPromptSections,Z as moveSessionEnvironmentOutOfSystemPrompt,M as normalizeBuildSystemPromptOptions};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isReadOnlyBashCommand(command: unknown): boolean;
|
|
@@ -58,6 +58,7 @@ export interface ShellExecutionRequest {
|
|
|
58
58
|
readonly command: string;
|
|
59
59
|
readonly cwd: string;
|
|
60
60
|
readonly sessionFile?: string;
|
|
61
|
+
readonly tempDir?: string;
|
|
61
62
|
}
|
|
62
63
|
export type ShellExecutionGuard = (request: ShellExecutionRequest) => Promise<string | undefined> | string | undefined;
|
|
63
64
|
export declare function registerShellExecutionGuard(guard: ShellExecutionGuard): () => void;
|