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
package/dist/core/tools/bash.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var $e=Object.defineProperty;var
|
|
2
|
-
Cannot execute ${t} commands.`)}const b=S.commandTransport==="stdin",c=ve(S.shell,b?S.args:[...S.args,n],{cwd:o,detached:process.platform!=="win32",env:w??ce(),stdio:[b?"pipe":"ignore","pipe","pipe"],windowsHide:!0});b&&(c.stdin?.on("error",()=>{}),c.stdin?.end(n)),c.pid&&Fe(c.pid);let
|
|
3
|
-
${x.fg("muted",` \u23BF ${e} ${o.trim()}`)}`}const w=o===null?qe(x):o?x.fg("dim",ze(o.replace(/\s+/g," ").trim(),42)):x.fg("dim","\u2026");return`${x.fg("toolTitle",x.bold(e))} ${w}${y}`}
|
|
1
|
+
var $e=Object.defineProperty;var r=(t,e)=>$e(t,"name",{value:e,configurable:!0});import{constants as Le}from"node:fs";import{access as Te}from"node:fs/promises";import{constants as Ce}from"node:os";import{ToolExecutionError as le}from"@earendil-works/pi-agent-core";import{Container as Pe,Text as W,truncateToWidth as De}from"@earendil-works/pi-tui";import{spawn as ve}from"child_process";import{Type as l}from"typebox";import{fill as G,t as P}from"../../dal/i18n.js";import{keyHint as Ie}from"../../modes/interactive/components/keybinding-hints.js";import{truncateToVisualLines as Ae}from"../../modes/interactive/components/visual-truncate.js";import{theme as x}from"../../modes/interactive/theme/theme.js";import{waitForChildProcess as ke}from"../../utils/child-process.js";import{writeOutputFile as Me}from"../../utils/output-files.js";import{getShellConfig as ue,getShellEnv as ce,killProcessTree as me,trackDetachedChildPid as Fe,untrackDetachedChildPid as Ne}from"../../utils/shell.js";import{missingManagedToolHint as Be}from"../../utils/tools-manager.js";import{describeDenialForModel as Re}from"../sandbox/denial.js";import{getProcessShellSandbox as Ue}from"../sandbox/shell-sandbox.js";import{toolDenial as Ge,withToolDenial as He}from"../tool-denial.js";import{isReadOnlyBashCommand as je}from"./bash-read-only.js";import{OutputAccumulator as We}from"./output-accumulator.js";import{condenseShellOutput as Ve,outputCondenseDisabled as Ye}from"./output-condense.js";import{countOutputLines as Xe,formatCollapsedSummary as Ke,getTextOutput as pe,invalidArgText as qe,str as fe,truncateDisplay as ze}from"./render-utils.js";import{wrapToolDefinition as Je}from"./tool-definition-wrapper.js";import{DEFAULT_MAX_BYTES as Qe,formatSize as Ze,SHELL_OUTPUT_MAX_CHARS as ee,truncateHeadTail as et}from"./truncate.js";const he=2147483647,we=1024*1024,tt=8*1024*1024,nt=he/1e3,te=12e4,ne=30;function ot(t){if(t===void 0)return te;if(!Number.isFinite(t)||t<=0)throw new Error("Invalid timeout: must be a finite number of seconds");const e=t*1e3;if(e>he)throw new Error(`Invalid timeout: maximum is ${nt} seconds`);return e}r(ot,"resolveTimeoutMs");const Se=l.Object({command:l.String({description:"Shell command to execute"}),description:l.String({description:`What it does and why, 3-10 words in the user's language, shown instead of the command: "Find hardcoded key names", not "run grep"`}),timeout:l.Optional(l.Number({description:"Seconds to wait for the command (default in the tool description). Raise it for long builds."}))}),it=l.Optional(l.Object({mode:l.Union([l.Literal("allow"),l.Literal("unsandboxed")],{description:'"allow": stay sandboxed with the domains/paths below; "unsandboxed": run outside the sandbox'}),justification:l.String({description:"Why, in one sentence for the user, who must approve it"}),allow_domains:l.Optional(l.Array(l.String(),{description:"e.g. registry.npmjs.org"})),allow_write:l.Optional(l.Array(l.String(),{description:"Paths to make writable"}))},{description:"Only after the sandbox blocked this command: the access it needs. Never pre-emptively."})),st=l.Object({...Se.properties,sandbox_escalation:it}),be={snippet:"Execute bash commands (ls, grep, find, etc.)",guidelines:["You can inspect DAL_* environment variables for current model and session details."]},rt=l.Object({output:l.String({description:"Combined stdout and stderr, possibly truncated"}),truncated:l.Boolean(),full_output_path:l.Optional(l.String({description:"Full output, when truncated"})),exit_code:l.Number({description:"-1 while the command runs in the background"}),background_id:l.Optional(l.String({description:"Background process id, when it is still running"})),wall_time_seconds:l.Number()});function at(t,e){return{exec:r(async(n,o,{onData:u,signal:i,timeout:y,env:w,yieldTo:s})=>{const $=ot(y);if(i?.aborted)throw new Error("aborted");const S=e();try{await Te(o,Le.F_OK)}catch{throw new Error(`Working directory does not exist: ${o}
|
|
2
|
+
Cannot execute ${t} commands.`)}const b=S.commandTransport==="stdin",c=ve(S.shell,b?S.args:[...S.args,n],{cwd:o,detached:process.platform!=="win32",env:w??ce(),stdio:[b?"pipe":"ignore","pipe","pipe"],windowsHide:!0});b&&(c.stdin?.on("error",()=>{}),c.stdin?.end(n)),c.pid&&Fe(c.pid);let a=!1,m=!1,h;const p=new Promise(A=>{h=r(()=>A("yielded"),"onYielded")});let f;const _=r(()=>{c.pid&&me(c.pid)},"onAbort");try{$!==void 0&&(f=setTimeout(()=>{if(s&&c.exitCode===null&&c.signalCode===null&&s(c)){m=!0,h?.();return}a=!0,c.pid&&me(c.pid)},$)),c.stdout?.on("data",u),c.stderr?.on("data",u),i&&(i.aborted?_():i.addEventListener("abort",_,{once:!0}));const A=ke(c),D=await Promise.race([A,p]);if(D==="yielded")return A.catch(()=>{}),{exitCode:null,yielded:!0};const H=D;if(i?.aborted)throw new Error("aborted");if(a)throw new Error(`timeout:${($??te)/1e3}`);const V=c.signalCode;return{exitCode:H??(V?128+(Ce.signals[V]??0):1)}}finally{c.pid&&!m&&Ne(c.pid),f&&clearTimeout(f),i&&i.removeEventListener("abort",_)}},"exec")}}r(at,"createLocalShellOperations");function dt(t){return at("bash",()=>ue(t?.shellPath))}r(dt,"createLocalBashOperations");const oe=Symbol.for("dal.shell.executionGuards"),ie=globalThis;ie[oe]instanceof Set||(ie[oe]=new Set);const se=ie[oe];function Xt(t){return se.add(t),()=>{se.delete(t)}}r(Xt,"registerShellExecutionGuard");async function lt(t){for(const e of se){let n;try{n=await e(t)}catch(o){return`Command refused: the safety check could not run (${o instanceof Error?o.message:String(o)}).`}if(n!==void 0)return n}}r(lt,"shellExecutionRefusal");const ut=["SESSION_ID","SESSION_FILE","PROVIDER","MODEL","REASONING_LEVEL"];function ct(t,e,n,o,u){const i={...ce()};if(delete i.PI_SESSION_ID,delete i.PI_SESSION_FILE,delete i.PI_PROVIDER,delete i.PI_MODEL,delete i.PI_REASONING_LEVEL,o&&u){const w=u.model;i.PI_SESSION_ID=u.sessionManager.getSessionId();const s=u.sessionManager.getSessionFile();s&&(i.PI_SESSION_FILE=s),w&&(i.PI_PROVIDER=w.provider,i.PI_MODEL=w.id),u.thinkingLevel&&(i.PI_REASONING_LEVEL=u.thinkingLevel)}for(const w of ut){delete i[`DAL_${w}`];const s=i[`PI_${w}`];s!==void 0&&(i[`DAL_${w}`]=s)}const y={command:t,cwd:e,env:i};return n?n(y):y}r(ct,"resolveSpawnContext");const mt=5,pt=100;class ft extends Pe{static{r(this,"BashResultRenderComponent")}state={cachedWidth:void 0,cachedLines:void 0,cachedSkipped:void 0}}function ht(t){const e=t/1e3;if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e),o=Math.floor(n/60),u=n%60;return o<60?`${o}m ${u}s`:`${Math.floor(o/60)}h ${o%60}m ${u}s`}r(ht,"formatDuration");function wt(t,e,n=!1){const o=fe(t?.command),u=fe(t?.description)?.trim(),i=t?.timeout,y=i?x.fg("muted",G(P(" (\u8D85\u65F6 {seconds} \u79D2)"),{seconds:i})):"";if(u){const s=x.fg("toolTitle",x.bold(u))+y;return!n||!o?s:`${s}
|
|
3
|
+
${x.fg("muted",` \u23BF ${e} ${o.trim()}`)}`}const w=o===null?qe(x):o?x.fg("dim",ze(o.replace(/\s+/g," ").trim(),42)):x.fg("dim","\u2026");return`${x.fg("toolTitle",x.bold(e))} ${w}${y}`}r(wt,"formatShellCall");function St(t,e,n,o,u,i,y,w){const s=t.state;t.clear();const $=bt(n,u,i,w);if(!n.expanded&&!y){const a=pe(e,o),m=Xe(a),h=[];m>0&&h.push(G(P("{count} \u884C"),{count:m})),$&&h.push($);const p=Ke(x,h);p&&t.addChild(new W(p,0,0));return}let S=pe(e,o).trim();const b=e.details?.truncation,c=e.details?.fullOutputPath;if(!n.isPartial&&b?.truncated&&c&&S.endsWith("]")){const a=S.lastIndexOf(`
|
|
4
4
|
|
|
5
|
-
[`);
|
|
5
|
+
[`);a!==-1&&S.slice(a).includes(c)&&(S=S.slice(0,a).trimEnd())}if(S){const a=S.split(`
|
|
6
6
|
`).map(m=>x.fg("toolOutput",m)).join(`
|
|
7
|
-
`);n.expanded?t.addChild(new
|
|
8
|
-
${
|
|
9
|
-
${x.fg("warning",`[${
|
|
10
|
-
${x.fg("muted",$)}`,0,0))}
|
|
11
|
-
${_}`:_,
|
|
7
|
+
`);n.expanded?t.addChild(new W(`
|
|
8
|
+
${a}`,0,0)):t.addChild({render:r(m=>{if(s.cachedLines===void 0||s.cachedWidth!==m){const h=Ae(a,mt,m);s.cachedLines=h.visualLines,s.cachedSkipped=h.skippedCount,s.cachedWidth=m}if(s.cachedSkipped&&s.cachedSkipped>0){const h=x.fg("muted",G(P("... (\u524D\u9762\u8FD8\u6709 {count} \u884C\uFF0C"),{count:s.cachedSkipped}))+` ${Ie("app.tools.expand",P("\u5373\u53EF\u5C55\u5F00"))}${x.fg("muted",")")}`;return["",De(h,m,"..."),...s.cachedLines??[]]}return["",...s.cachedLines??[]]},"render"),invalidate:r(()=>{s.cachedWidth=void 0,s.cachedLines=void 0,s.cachedSkipped=void 0},"invalidate")})}if(b?.truncated||c){const a=[];c&&a.push(G(P("\u5B8C\u6574\u8F93\u51FA\uFF1A{path}"),{path:c})),b?.truncated&&(b.truncatedBy==="lines"?a.push(G(P("\u5DF2\u622A\u65AD\uFF1A\u663E\u793A {shown}/{total} \u884C"),{shown:b.outputLines,total:b.totalLines})):a.push(G(P("\u5DF2\u622A\u65AD\uFF1A\u663E\u793A\u4E86 {shown} \u884C\uFF08\u4E0A\u9650 {limit}\uFF09"),{shown:b.outputLines,limit:Ze(b.maxBytes??Qe)}))),t.addChild(new W(`
|
|
9
|
+
${x.fg("warning",`[${a.join(". ")}]`)}`,0,0))}$&&t.addChild(new W(`
|
|
10
|
+
${x.fg("muted",$)}`,0,0))}r(St,"rebuildBashResultRenderComponent");function bt(t,e,n,o){let u;if(!t.isPartial&&o!==void 0)u=o;else if(e!==void 0)u=(n??Date.now())-e;else return;if(!(!t.isPartial&&u<100))return`${t.isPartial?P("\u5DF2\u8FD0\u884C"):P("\u8017\u65F6")} ${ht(u)}`}r(bt,"bashTimingLabel");function xt(t,e,n){const o=n?.operations??e.defaultOperations?.()??dt({shellPath:n?.shellPath}),u=n?.commandPrefix,i=n?.exposeSessionEnvironment??!0,y=n?.spawnHook,w=n?.sandbox,s=n?.operations===void 0,$=w?.describeForModel(),S=n?.background;let b=!1;const c=r(a=>`Execute a ${e.shellName} command in the current working directory; returns stdout and stderr. Long output is cut to its start and end (error lines kept) and the full output saved to a file named in the result. ${a?`A command still running after \`timeout\` seconds (default ${ne}) keeps running in the background: you get its id and the output so far, then use the process tool to poll or kill it.`:`A command still running after \`timeout\` seconds (default ${te/1e3}) is killed.`}${$?` ${$}`:""}`,"describe");return{name:e.name,label:e.label,description:c(!1),prepareLoadout:S&&s?a=>(b=a.declared.some(m=>m.name==="process"),b?{descriptions:{[e.name]:c(!0)}}:void 0):void 0,promptSnippet:e.promptSnippet,promptGuidelines:i&&e.promptGuidelines?[...e.promptGuidelines]:void 0,executionMode:"sequential",executionModeFor:e.readOnlyCommand&&!u?a=>e.readOnlyCommand?.(a?.command)?"parallel":void 0:void 0,parameters:w?.active?st:Se,outputSchema:rt,constrainedSampling:{type:"json_schema",strict:"prefer"},async execute(a,m,h,p,f){const{command:_,timeout:A}=m;p&&p({content:[],details:void 0});const D=w??(s?Ue():void 0),H=await lt({toolName:e.name,command:_,cwd:f?.cwd||t,sessionFile:f?.sessionManager?.getSessionFile(),...D?.active?{tempDir:D.scratchDir()}:{}});if(H!==void 0)throw new le(H,He(void 0,Ge("dangerous-command",H)));const V=u?`${u}
|
|
11
|
+
${_}`:_,k=ct(V,f?.cwd||t,y,i,f);let L;if(D?.active){if(!e.sandboxShell)throw new Error(`Command refused: ${e.shellName} commands cannot run inside the OS sandbox yet, and the sandbox level is "${D.level}". Use the bash tool, or the user can opt out with \`dal --sandbox off\`.`);L=await D.prepare({command:k.command,cwd:k.cwd,shell:e.sandboxShell(n?.shellPath),shellKind:e.sandboxShellKind??"bash",env:k.env,toolCallId:a,toolName:e.name,escalation:m.sandbox_escalation,ctx:f,signal:h})}const C=new We({tempFilePrefix:e.tempFilePrefix,maxBytes:ee});let Y=!0,j,X=!1,re=0;const K=r(()=>{if(!p||!X)return;X=!1,re=Date.now();const d=C.snapshot({persistIfTruncated:!0});p({content:[{type:"text",text:d.content||""}],details:{truncation:d.truncation.truncated?d.truncation:void 0,fullOutputPath:d.fullOutputPath}})},"emitOutputUpdate"),q=r(()=>{j&&(clearTimeout(j),j=void 0)},"clearUpdateTimer"),xe=r(()=>{if(!p)return;X=!0;const d=pt-(Date.now()-re);if(d<=0){q(),K();return}j??=setTimeout(()=>{j=void 0,K()},d)},"scheduleOutputUpdate"),Ee=r(d=>{Y&&(C.append(d),xe())},"handleData"),_e=r(async()=>{Y=!1,C.finish(),q(),K();const d=C.snapshot({persistIfTruncated:!0});return await C.closeTempFile(),d},"finishOutput"),z=r(async(d="(no output)")=>{const O=await _e(),M=await C.readFullOutput(tt),T=Ye()?void 0:Ve(M.content),E=et(T?.text??M.content,ee);let I=O.fullOutputPath;(E.truncated||T)&&!I&&(I=await Me(e.tempFilePrefix,".log",M.content));let F=E.content||d,R;const U=O.truncation.totalLines;return E.truncated?(R={truncation:{content:E.content,truncated:!0,truncatedBy:"bytes",totalLines:U,totalBytes:O.truncation.totalBytes,outputLines:E.headLines+E.tailLines,outputBytes:Buffer.byteLength(E.content,"utf-8"),lastLinePartial:!1,firstLineExceedsLimit:!1,maxLines:U,maxBytes:ee},fullOutputPath:I},F+=`
|
|
12
12
|
|
|
13
|
-
[Truncated: first ${E.headLines} and last ${E.tailLines} of ${E.totalLines} lines shown${
|
|
13
|
+
[Truncated: first ${E.headLines} and last ${E.tailLines} of ${E.totalLines} lines shown${T?`, after condensing ${U} lines (${T.summary})`:""}; read more with read (offset/limit) or grep. Full output: ${I}]`):T&&(R={fullOutputPath:I},F+=`
|
|
14
14
|
|
|
15
|
-
[Condensed: ${
|
|
15
|
+
[Condensed: ${T.summary}. Full output: ${I}]`),{text:F,details:R,snapshot:O}},"modelOutput"),B=r((d,O)=>`${d?`${d}
|
|
16
16
|
|
|
17
|
-
`:""}${O}`,"appendStatus"),
|
|
17
|
+
`:""}${O}`,"appendStatus"),ae=performance.now();let v;const J=S&&s&&b?d=>{Y=!1;try{return v=S.adopt({child:d,command:_,cwd:k.cwd,...L?{prepared:L}:{},...C.handOff()}),!0}catch{return Y=!0,!1}}:void 0;try{let d;try{const g=await o.exec(L?.command??k.command,k.cwd,{onData:Ee,signal:h,timeout:A??(J?ne:void 0),env:k.env,...J?{yieldTo:J}:{}});if(g.yielded&&v){const{text:N,details:Z}=await z(""),Oe=A??ne,ge=v.urls.length>0?` It printed ${v.urls.join(" ")}.`:"",ye=`[Still running after ${Oe}s, now in the background as ${v.id}.${ge} For new output and the exit code call process with action "poll" and id "${v.id}"; "kill" stops it.]`,de=await C.readFullOutput(we);return{content:[{type:"text",text:B(N,ye)}],details:{...Z,background:v},structuredContent:{output:de.content,truncated:de.truncated,exit_code:-1,background_id:v.id,wall_time_seconds:Math.round((performance.now()-ae)/100)/10}}}d=g.exitCode}catch(g){const{text:N}=await z("");if(await L?.finish(null,""),g instanceof Error&&g.message==="aborted")throw new Error(B(N,"Command aborted"));if(g instanceof Error&&g.message.startsWith("timeout:")){const Z=g.message.split(":")[1];throw new Error(B(N,`Command timed out after ${Z} seconds`))}throw g}const{text:O,details:M,snapshot:T}=await z(),E=await L?.finish(d,T.content||"");if(E&&L)throw new le(`${B(O,`Command exited with code ${d??"(none)"}`)}
|
|
18
18
|
|
|
19
|
-
${Re(E)}`,{...
|
|
20
|
-
${g}`:
|
|
19
|
+
${Re(E)}`,{...M,sandbox:L.details});if(d===null)throw new Error(B(O,"Command terminated without an exit code"));const I=Math.round((performance.now()-ae)/100)/10,F=await C.readFullOutput(we),R={output:F.content,truncated:F.truncated,...F.truncated&&T.fullOutputPath?{full_output_path:T.fullOutputPath}:{},exit_code:d,wall_time_seconds:I},U=L?.details.escalation?L.details:void 0,Q=U?{...M,sandbox:U}:M;if(d!==0){const g=d===127?await Be(O):void 0,N=B(O,`Command exited with code ${d}`);return{content:[{type:"text",text:g?`${N}
|
|
20
|
+
${g}`:N}],details:Q,structuredContent:R,isError:!0}}return{content:[{type:"text",text:O}],details:Q,structuredContent:R}}finally{q()}},renderCall(a,m,h){const p=h.state;h.executionStarted&&p.startedAt===void 0&&(p.startedAt=Date.now(),p.endedAt=void 0);const f=h.lastComponent??new W("",0,0);return f.setText(wt(a,e.prompt,h.expanded===!0)),f},renderResult(a,m,h,p){const f=p.state;f.startedAt!==void 0&&m.isPartial&&!f.interval&&(f.interval=setInterval(()=>p.invalidate(),1e3)),(!m.isPartial||p.isError)&&(f.endedAt??=Date.now(),f.interval&&(clearInterval(f.interval),f.interval=void 0));const _=p.lastComponent??new ft;return St(_,a,m,p.showImages,f.startedAt,f.endedAt,p.isError,p.durationMs),_.invalidate(),_}}}r(xt,"createShellToolDefinition");const Et={name:"bash",label:"bash",shellName:"bash",prompt:"$",promptSnippet:be.snippet,promptGuidelines:be.guidelines,tempFilePrefix:"dal-bash",readOnlyCommand:je,sandboxShell:r(t=>ue(t).shell,"sandboxShell")};function _t(t,e){return xt(t,Et,e)}r(_t,"createBashToolDefinition");function Kt(t,e){const n=_t(t,e),o=Je(n);return Object.assign(o,{promptSnippet:n.promptSnippet,promptGuidelines:n.promptGuidelines}),o}r(Kt,"createBashTool");export{be as bashToolSystemPromptContribution,Kt as createBashTool,_t as createBashToolDefinition,dt as createLocalBashOperations,at as createLocalShellOperations,xt as createShellToolDefinition,Xt as registerShellExecutionGuard,it as sandboxEscalationSchema,lt as shellExecutionRefusal};
|
|
@@ -16,7 +16,7 @@ declare const editSchema: Type.TObject<{
|
|
|
16
16
|
}>;
|
|
17
17
|
export declare const editToolSystemPromptContribution: {
|
|
18
18
|
readonly snippet: "Make precise file edits with exact text replacement, including multiple disjoint edits in one call";
|
|
19
|
-
readonly guidelines: readonly ["Use edit for precise changes
|
|
19
|
+
readonly guidelines: readonly ["Use edit for precise changes: each edits[].oldText matches the original file exactly, is unique and as short as that allows; several changes to one file go in one call, without overlapping"];
|
|
20
20
|
};
|
|
21
21
|
export type EditToolInput = Static<typeof editSchema>;
|
|
22
22
|
export interface EditToolDetails {
|
package/dist/core/tools/edit.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var B=Object.defineProperty;var d=(e,t)=>B(e,"name",{value:t,configurable:!0});import{Box as
|
|
2
|
-
`))
|
|
3
|
-
`);return!c||c===o?void 0:
|
|
1
|
+
var B=Object.defineProperty;var d=(e,t)=>B(e,"name",{value:t,configurable:!0});import{Box as b,Container as W,Spacer as x,Text as E}from"@earendil-works/pi-tui";import{constants as A}from"fs";import{access as k,readFile as q,writeFile as N}from"fs/promises";import{Type as g}from"typebox";import{renderDiff as S}from"../../modes/interactive/components/diff.js";import{splitBom as z}from"../../utils/text.js";import{applyEditsToNormalizedContent as J,computeEditsDiff as M,detectLineEnding as U,generateDiffString as G,generateUnifiedPatch as H,normalizeToLF as Q,restoreLineEndings as X}from"./edit-diff.js";import{withFileMutationQueue as V}from"./file-mutation-queue.js";import{resolveToCwd as Y}from"./path-utils.js";import{renderToolPath as Z,str as P}from"./render-utils.js";import{wrapToolDefinition as ee}from"./tool-definition-wrapper.js";const te=g.Object({oldText:g.String({description:"Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call."}),newText:g.String({description:"Replacement text for this targeted edit."})},{}),re=g.Object({path:g.String({description:"Path to the file to edit (relative or absolute)"}),edits:g.Array(te,{description:"One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead."})},{}),D={snippet:"Make precise file edits with exact text replacement, including multiple disjoint edits in one call",guidelines:["Use edit for precise changes: each edits[].oldText matches the original file exactly, is unique and as short as that allows; several changes to one file go in one call, without overlapping"]};function F(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.oldText=="string"&&typeof t.newText=="string"}d(F,"isSingleEditInput");const ie={readFile:d(e=>q(e),"readFile"),writeFile:d((e,t)=>N(e,t,"utf-8"),"writeFile"),access:d(e=>k(e,A.R_OK|A.W_OK),"access")};function ne(e){if(!e||typeof e!="object")return e;const t=e;if(typeof t.edits=="string")try{const o=JSON.parse(t.edits);Array.isArray(o)?t.edits=o:F(o)&&(t.edits=[o])}catch{}else F(t.edits)&&(t.edits=[t.edits]);const i=t;if(typeof i.oldText!="string"||typeof i.newText!="string")return t;const r=Array.isArray(i.edits)?[...i.edits]:[];r.push({oldText:i.oldText,newText:i.newText});const{oldText:f,newText:a,...n}=i;return{...n,edits:r}}d(ne,"prepareEditArguments");function oe(e){if(!Array.isArray(e.edits)||e.edits.length===0)throw new Error("Edit tool input is invalid. edits must contain at least one replacement.");return{path:e.path,edits:e.edits}}d(oe,"validateEditInput");function se(){return Object.assign(new b(0,0),{preview:void 0,previewArgsKey:void 0,previewPending:!1,settledError:!1})}d(se,"createEditCallRenderComponent");function de(e,t){if(t instanceof b){const r=t;return e.callComponent=r,r}if(e.callComponent)return e.callComponent;const i=se();return e.callComponent=i,i}d(de,"getEditCallRenderComponent");function O(e){if(!e)return null;const t=typeof e.path=="string"?e.path:typeof e.file_path=="string"?e.file_path:null;return t?Array.isArray(e.edits)&&e.edits.length>0&&e.edits.every(i=>typeof i?.oldText=="string"&&typeof i?.newText=="string")?{path:t,edits:e.edits}:typeof e.oldText=="string"&&typeof e.newText=="string"?{path:t,edits:[{oldText:e.oldText,newText:e.newText}]}:null:null}d(O,"getRenderablePreviewInput");function ae(e){let t=0,i=0;for(const r of e.split(`
|
|
2
|
+
`))r.startsWith("+")&&!r.startsWith("+++")&&t++,r.startsWith("-")&&!r.startsWith("---")&&i++;return{additions:t,removals:i}}d(ae,"diffStats");function le(e,t,i){const r=Z(P(e?.file_path??e?.path),t,i);return`${t.fg("toolTitle",t.bold("edit"))} ${r}`}d(le,"formatEditCall");function fe(e,t,i,r,f){const a=P(e?.file_path??e?.path),n=t&&!("error"in t)?t.diff:void 0,o=t&&"error"in t?t.error:void 0;if(f){const c=i.content.filter(l=>l.type==="text").map(l=>l.text||"").join(`
|
|
3
|
+
`);return!c||c===o?void 0:r.fg("error",c)}const s=i.details?.diff;if(s&&s!==n)return S(s,{filePath:a??void 0})}d(fe,"formatEditResult");function ce(e,t,i){return e?"error"in e?r=>i.bg("toolErrorBg",r):r=>i.bg("toolSuccessBg",r):t?r=>i.bg("toolErrorBg",r):r=>i.bg("toolPendingBg",r)}d(ce,"getEditHeaderBg");function _(e,t,i,r,f,a){e.setPaddingX(a),e.setBgFn("error"in(e.preview??{})||e.settledError?ce(e.preview,e.settledError,i):void 0),e.clear();let n=le(t,i,r);if(!f&&e.preview&&!("error"in e.preview)){const{additions:s,removals:c}=ae(e.preview.diff);n+=i.fg("muted",` +${s} / -${c}`)}if(e.addChild(new E(n,0,0)),!e.preview||!f&&!("error"in e.preview))return e;const o="error"in e.preview?i.fg("error",e.preview.error):S(e.preview.diff);return e.addChild(new x(1)),e.addChild(new E(o,0,0)),e}d(_,"buildEditCallComponent");function I(e,t,i){const r=e.preview,f=r===void 0||("error"in r&&"error"in t?r.error!==t.error:"error"in r!="error"in t)||!("error"in r)&&!("error"in t)&&(r.diff!==t.diff||r.firstChangedLine!==t.firstChangedLine);return e.preview=t,e.previewArgsKey=i,e.previewPending=!1,f}d(I,"setEditPreview");function pe(e,t){const i=t?.operations??ie;return{name:"edit",label:"edit",description:"Edit a single file using exact text replacement. Every edits[].oldText must match a unique, non-overlapping region of the original file. If two changes affect the same block or nearby lines, merge them into one edit instead of emitting overlapping edits. Do not include large unchanged regions just to connect distant changes.",promptSnippet:D.snippet,promptGuidelines:[...D.guidelines],parameters:re,constrainedSampling:{type:"json_schema",strict:"prefer"},renderShell:"self",prepareArguments:ne,async execute(r,f,a,n,o){const{path:s,edits:c}=oe(f),l=Y(s,o?.cwd||e);return V(l,async()=>{const p=d(()=>{if(a?.aborted)throw new Error("Operation aborted")},"throwIfAborted");p();try{await i.access(l)}catch(y){p();const $=y instanceof Error&&"code"in y?`Error code: ${y.code}`:String(y);throw new Error(`Could not edit file: ${s}. ${$}.`)}p();const w=(await i.readFile(l)).toString("utf-8");p();const{bom:u,text:C}=z(w),K=U(C),R=Q(C),{baseContent:T,newContent:m}=J(R,c,s);p();const j=u+X(m,K);await i.writeFile(l,j),p();const v=G(T,m),L=H(s,T,m);return{content:[{type:"text",text:`Successfully replaced ${c.length} block(s) in ${s}.`}],details:{diff:v.diff,patch:L,firstChangedLine:v.firstChangedLine}}})},renderCall(r,f,a){const n=de(a.state,a.lastComponent),o=O(r),s=o?JSON.stringify({path:o.path,edits:o.edits}):void 0;if(n.previewArgsKey!==s&&(n.preview=void 0,n.previewArgsKey=s,n.previewPending=!1,n.settledError=!1),a.argsComplete&&o&&!n.preview&&!n.previewPending){n.previewPending=!0;const c=s;M(o.path,o.edits,a.cwd).then(l=>{n.previewArgsKey===c&&(I(n,l,c),a.invalidate())})}return _(n,r,f,a.cwd,a.expanded,a.outputPad)},renderResult(r,f,a,n){const o=n.state.callComponent,s=O(n.args),c=s?JSON.stringify({path:s.path,edits:s.edits}):void 0,l=r,p=n.isError?void 0:l.details?.diff;let h=!1;o&&(typeof p=="string"&&(h=I(o,{diff:p,firstChangedLine:l.details?.firstChangedLine},c)||h),o.settledError!==n.isError&&(o.settledError=n.isError,h=!0),h&&_(o,n.args,a,n.cwd,f.expanded,n.outputPad));const w=fe(n.args,o?.preview,l,a,n.isError),u=n.lastComponent??new W;return u.clear(),w&&(u.addChild(new x(1)),u.addChild(new E(w,1+n.outputPad,0))),u}}}d(pe,"createEditToolDefinition");function Ae(e,t){return ee(pe(e,t))}d(Ae,"createEditTool");export{Ae as createEditTool,pe as createEditToolDefinition,D as editToolSystemPromptContribution};
|
package/dist/core/tools/grep.js
CHANGED
|
@@ -6,7 +6,7 @@ ${C(b("... (\u8FD8\u6709 {count} \u884C\uFF0C"),{count:F})}`)} ${bt("app.tools.e
|
|
|
6
6
|
${l.fg("warning",C(b("[\u5DF2\u622A\u65AD\uFF1A{reasons}]"),{reasons:s.join(", ")}))}`}return r}i(Pt,"formatGrepResult");function Rt(n,o){const l=o?.operations;return{name:"grep",label:"grep",description:`Search file contents for a pattern. Returns matching lines with file paths and line numbers. Respects .gitignore. Output is truncated to ${ft} matches or ${z/1024}KB (whichever is hit first). Long lines are truncated to ${pt} chars.`,promptSnippet:_t.snippet,parameters:Mt,async execute(d,{pattern:m,path:p,glob:r,ignoreCase:u,literal:x,context:L,limit:s},O,U,F){return new Promise((P,$)=>{if(O?.aborted){$(new Error("Operation aborted"));return}let H=!1;const T=i(E=>{H||(H=!0,E())},"settle");(async()=>{try{const E=await yt("rg");if(!E){T(()=>$(new Error("ripgrep (rg) is not available and could not be downloaded")));return}const S=Lt(p||".",F?.cwd||n),X=l??At,J=l?void 0:st(S);if(J){T(()=>$(new Error(J)));return}let K;try{K=await X.isDirectory(S)}catch{T(()=>$(new Error(`Path not found: ${S}`)));return}const D=L&&L>0?L:0,M=Math.max(1,s??ft),V=i(e=>{if(K){const t=B.relative(S,e);if(t&&!t.startsWith(".."))return t.replace(/\\/g,"/")}return B.basename(e)},"formatPath"),W=new Map,dt=i(async e=>{let t=W.get(e);if(!t){try{t=(await X.readFile(e)).replace(/\r\n/g,`
|
|
7
7
|
`).replace(/\r/g,`
|
|
8
8
|
`).split(`
|
|
9
|
-
`)}catch{t=[]}W.set(e,t)}return t},"getFileLines"),_=["--json","--line-number","--color=never","--hidden"];u&&_.push("--ignore-case"),x&&_.push("--fixed-strings"),r&&_.push("--glob",r),_.push("--",m,S);const v=$t(E,_,{stdio:["ignore","pipe","pipe"]}),Y=wt({input:v.stdout});let j="",A=0,q=!1,R=!1,Q=!1,Z=!1;const k=[],tt=i(()=>{Y.close(),O?.removeEventListener("abort",nt)},"cleanup"),et=i((e=!1)=>{v.killed||(Z=e,v.kill())},"stopChild"),nt=i(()=>{Q=!0,et()},"onAbort");O?.addEventListener("abort",nt,{once:!0}),v.stderr?.on("data",e=>{j+=e.toString()});const mt=i(async(e,t)=>{const c=V(e),w=await dt(e);if(!w.length)return[`${c}:${t}: (unable to read file)`];const f=[],y=D>0?Math.max(1,t-D):t,h=D>0?Math.min(w.length,t+D):t;for(let g=y;g<=h;g++){const G=(w[g-1]??"").replace(/\r/g,""),N=g===t,{text:it,wasTruncated:ht}=ut(G);ht&&(R=!0),N?f.push(`${c}:${g}: ${it}`):f.push(`${c}-${g}- ${it}`)}return f},"formatBlock"),rt=[];Y.on("line",e=>{if(!e.trim()||A>=M)return;let t;try{t=JSON.parse(e)}catch{return}if(t.type==="match"){A++;const c=t.data?.path?.text,w=t.data?.line_number,f=t.data?.lines?.text;if(c&&!l&&st(B.resolve(S,c))){A--;return}c&&typeof w=="number"&&rt.push({filePath:c,lineNumber:w,lineText:f}),A>=M&&(q=!0,et(!0))}}),v.on("error",e=>{tt(),T(()=>$(new Error(`Failed to run ripgrep: ${e.message}`)))}),v.on("close",async e=>{if(tt(),Q){T(()=>$(new Error("Operation aborted")));return}if(!Z&&e!==0&&e!==1){const h=j.trim()||`ripgrep exited with code ${e}`;T(()=>$(new Error(h)));return}if(A===0){T(()=>P({content:[{type:"text",text:"No matches found"}],details:void 0}));return}for(const h of rt)if(D===0&&h.lineText!==void 0){const g=V(h.filePath),ot=h.lineText.replace(/\r\n/g,`
|
|
9
|
+
`)}catch{t=[]}W.set(e,t)}return t},"getFileLines"),_=["--no-config","--json","--line-number","--color=never","--hidden"];u&&_.push("--ignore-case"),x&&_.push("--fixed-strings"),r&&_.push("--glob",r),_.push("--",m,S);const v=$t(E,_,{stdio:["ignore","pipe","pipe"]}),Y=wt({input:v.stdout});let j="",A=0,q=!1,R=!1,Q=!1,Z=!1;const k=[],tt=i(()=>{Y.close(),O?.removeEventListener("abort",nt)},"cleanup"),et=i((e=!1)=>{v.killed||(Z=e,v.kill())},"stopChild"),nt=i(()=>{Q=!0,et()},"onAbort");O?.addEventListener("abort",nt,{once:!0}),v.stderr?.on("data",e=>{j+=e.toString()});const mt=i(async(e,t)=>{const c=V(e),w=await dt(e);if(!w.length)return[`${c}:${t}: (unable to read file)`];const f=[],y=D>0?Math.max(1,t-D):t,h=D>0?Math.min(w.length,t+D):t;for(let g=y;g<=h;g++){const G=(w[g-1]??"").replace(/\r/g,""),N=g===t,{text:it,wasTruncated:ht}=ut(G);ht&&(R=!0),N?f.push(`${c}:${g}: ${it}`):f.push(`${c}-${g}- ${it}`)}return f},"formatBlock"),rt=[];Y.on("line",e=>{if(!e.trim()||A>=M)return;let t;try{t=JSON.parse(e)}catch{return}if(t.type==="match"){A++;const c=t.data?.path?.text,w=t.data?.line_number,f=t.data?.lines?.text;if(c&&!l&&st(B.resolve(S,c))){A--;return}c&&typeof w=="number"&&rt.push({filePath:c,lineNumber:w,lineText:f}),A>=M&&(q=!0,et(!0))}}),v.on("error",e=>{tt(),T(()=>$(new Error(`Failed to run ripgrep: ${e.message}`)))}),v.on("close",async e=>{if(tt(),Q){T(()=>$(new Error("Operation aborted")));return}if(!Z&&e!==0&&e!==1){const h=j.trim()||`ripgrep exited with code ${e}`;T(()=>$(new Error(h)));return}if(A===0){T(()=>P({content:[{type:"text",text:"No matches found"}],details:void 0}));return}for(const h of rt)if(D===0&&h.lineText!==void 0){const g=V(h.filePath),ot=h.lineText.replace(/\r\n/g,`
|
|
10
10
|
`).replace(/\r/g,"").replace(/\n$/,""),{text:G,wasTruncated:N}=ut(ot);N&&(R=!0),k.push(`${g}:${h.lineNumber}: ${G}`)}else{const g=await mt(h.filePath,h.lineNumber);k.push(...g)}const t=k.join(`
|
|
11
11
|
`),c=Dt(t,{maxLines:Number.MAX_SAFE_INTEGER});let w=c.content;const f={},y=[];q&&(y.push(`${M} matches limit reached. Use limit=${M*2} for more, or refine pattern`),f.matchLimitReached=M),c.truncated&&(y.push(`${lt(z)} limit reached`),f.truncation=c),R&&(y.push(`Some lines truncated to ${pt} chars. Use read tool to see full lines`),f.linesTruncated=!0),y.length>0&&(w+=`
|
|
12
12
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare function pathExists(filePath: string): Promise<boolean>;
|
|
2
|
+
export declare function expandTempDirVariable(filePath: string, tempDir: string): string;
|
|
2
3
|
export declare function expandPath(filePath: string): string;
|
|
3
4
|
export declare function resolveToCwd(filePath: string, cwd: string): string;
|
|
4
5
|
export declare function resolveReadPath(filePath: string, cwd: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var d=Object.defineProperty;var n=(t,
|
|
1
|
+
var d=Object.defineProperty;var n=(t,e)=>d(t,"name",{value:e,configurable:!0});import{accessSync as x,constants as l}from"node:fs";import{access as P}from"node:fs/promises";import{normalizePath as V,resolvePath as h}from"../../utils/paths.js";const A="\u202F";function p(t){return t.replace(/ (AM|PM)\./gi,`${A}$1.`)}n(p,"tryMacOSScreenshotPath");function m(t){return t.normalize("NFD")}n(m,"tryNFDVariant");function f(t){return t.replace(/'/g,"\u2019")}n(f,"tryCurlyQuoteVariant");function u(t){try{return x(t,l.F_OK),!0}catch{return!1}}n(u,"fileExists");async function s(t){try{return await P(t,l.F_OK),!0}catch{return!1}}n(s,"pathExists");const R=/^(?:\$TMPDIR|\$\{TMPDIR\})(?=[\\/]|$)/;function E(t,e){const r=R.exec(t);return r?e+t.slice(r[0].length):t}n(E,"expandTempDirVariable");function M(t){return V(t,{normalizeUnicodeSpaces:!0,stripAtPrefix:!0})}n(M,"expandPath");function y(t,e){return h(t,e,{normalizeUnicodeSpaces:!0,stripAtPrefix:!0})}n(y,"resolveToCwd");function S(t,e){const r=y(t,e);if(u(r))return r;const i=p(r);if(i!==r&&u(i))return i;const a=m(r);if(a!==r&&u(a))return a;const o=f(r);if(o!==r&&u(o))return o;const c=f(a);return c!==r&&u(c)?c:r}n(S,"resolveReadPath");async function C(t,e){const r=y(t,e);if(await s(r))return r;const i=p(r);if(i!==r&&await s(i))return i;const a=m(r);if(a!==r&&await s(a))return a;const o=f(r);if(o!==r&&await s(o))return o;const c=f(a);return c!==r&&await s(c)?c:r}n(C,"resolveReadPathAsync");export{M as expandPath,E as expandTempDirVariable,s as pathExists,S as resolveReadPath,C as resolveReadPathAsync,y as resolveToCwd};
|
package/dist/core/tools/read.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var Y=Object.defineProperty;var
|
|
2
|
-
`),
|
|
1
|
+
var Y=Object.defineProperty;var a=(e,t)=>Y(e,"name",{value:t,configurable:!0});import{basename as W,dirname as G,isAbsolute as J,relative as Q,resolve as K,sep as H}from"node:path";import{Text as V}from"@earendil-works/pi-tui";import{constants as Z}from"fs";import{access as ee,readFile as te}from"fs/promises";import{Type as f}from"typebox";import{getReadmePath as ne}from"../../config.js";import{fill as I,t as O}from"../../dal/i18n.js";import{keyHint as ie}from"../../modes/interactive/components/keybinding-hints.js";import{getLanguageFromPath as oe,highlightCode as re}from"../../modes/interactive/theme/theme.js";import{processImage as ae}from"../../utils/image-process.js";import{detectSupportedImageMimeTypeFromFile as se}from"../../utils/mime.js";import{formatPathRelativeToCwdOrAbsolute as le}from"../../utils/paths.js";import{readAccessDenial as de}from"../permissions/tool-policy.js";import{resolveReadPathAsync as fe,resolveToCwd as me}from"./path-utils.js";import{formatReadLineRange as ce,getTextOutput as ue,renderToolPath as pe,replaceTabs as N,str as U}from"./render-utils.js";import{wrapToolDefinition as ge}from"./tool-definition-wrapper.js";import{DEFAULT_MAX_BYTES as T,DEFAULT_MAX_LINES as X,formatSize as A,truncateHead as he}from"./truncate.js";const be=f.Object({path:f.String({description:"Path to the file to read (relative or absolute)"}),offset:f.Optional(f.Number({description:"Line number to start reading from (1-indexed)"})),limit:f.Optional(f.Number({description:"Maximum number of lines to read"}))}),q={snippet:"Read file contents",guidelines:["Use read to examine files instead of cat or sed."]},Le=f.Union([f.String(),f.Object({type:f.Literal("image"),data:f.String(),mimeType:f.String(),note:f.String()})]),xe=new Set(["AGENTS.override.md","AGENTS.md","AGENTS.MD","CLAUDE.md","CLAUDE.MD"]),we={readFile:a(e=>te(e),"readFile"),access:a(e=>ee(e,Z.R_OK),"access"),detectImageMimeType:se};function k(e,t){const n=ce(e?.offset,e?.limit);return n?t.fg("warning",n):""}a(k,"formatReadLineRange");function $e(e,t,n){const i=pe(U(e?.file_path??e?.path),t,n);return`${t.fg("toolTitle",t.bold("read"))} ${i}${k(e,t)}`}a($e,"formatReadCall");function ye(e){let t=e.length;for(;t>0&&e[t-1]==="";)t--;return e.slice(0,t)}a(ye,"trimTrailingEmptyLines");function Te(e){const t=e.find(i=>i.type==="text")?.text??"",n=e.find(i=>i.type==="image");return n?{type:"image",data:n.data,mimeType:n.mimeType,note:t}:t}a(Te,"toReadOutput");function Re(e){if(!(!e||e.input.includes("image")))return"[Current model does not support images. The image will be omitted from this request.]"}a(Re,"getNonVisionImageNote");function Se(e){return e.split(H).join("/")}a(Se,"toPosixPath");function Ce(e){const t=G(ne()),n=Q(K(t),K(e));if(n===""||n===".."||n.startsWith(`..${H}`)||J(n))return;const i=Se(n);if(i==="README.md"||i.startsWith("docs/")||i.startsWith("dal-docs/")||i.startsWith("examples/"))return{kind:"docs",label:i}}a(Ce,"getPiDocsClassification");function Ee(e,t){const n=U(e?.file_path??e?.path);if(!n)return;const i=me(n,t),m=W(i);if(m==="SKILL.md")return{kind:"skill",label:W(G(i))||m};const c=Ce(i);if(c)return c;if(xe.has(m))return{kind:"resource",label:le(i,t)}}a(Ee,"getCompactReadClassification");function Oe(e,t,n){return e.kind==="skill"?n.fg("customMessageLabel","\x1B[1m[skill]\x1B[22m ")+n.fg("customMessageText",e.label)+k(t,n):n.fg("toolTitle",n.bold(`read ${e.kind}`))+" "+n.fg("accent",e.label)+k(t,n)}a(Oe,"formatCompactReadCall");function Ae(e,t,n,i,m,c,u){if(!n.expanded&&!u)return"";const d=U(e?.file_path??e?.path),s=ue(t,m),l=!u&&d?oe(d):void 0,z=l?re(N(s),l):s.split(`
|
|
2
|
+
`),w=ye(z),$=n.expanded?w.length:10,R=w.slice(0,$),L=w.length-$;let h=`
|
|
3
3
|
${R.map(S=>l?N(S):i.fg("toolOutput",N(S))).join(`
|
|
4
|
-
`)}`;
|
|
5
|
-
${I(O("... (\u8FD8\u6709 {count} \u884C\uFF0C"),{count:
|
|
4
|
+
`)}`;L>0&&(h+=`${i.fg("muted",`
|
|
5
|
+
${I(O("... (\u8FD8\u6709 {count} \u884C\uFF0C"),{count:L})}`)} ${ie("app.tools.expand",O("\u5373\u53EF\u5C55\u5F00"))}${i.fg("muted",")")}`);const o=t.details?.truncation;return o?.truncated&&(o.firstLineExceedsLimit?h+=`
|
|
6
6
|
${i.fg("warning",I(O("[\u9996\u884C\u8D85\u51FA {limit} \u4E0A\u9650]"),{limit:A(o.maxBytes??T)}))}`:o.truncatedBy==="lines"?h+=`
|
|
7
7
|
${i.fg("warning",I(O("[\u5DF2\u622A\u65AD\uFF1A\u663E\u793A {shown}/{total} \u884C\uFF08\u4E0A\u9650 {max} \u884C\uFF09]"),{shown:o.outputLines,total:o.totalLines,max:o.maxLines??X}))}`:h+=`
|
|
8
|
-
${i.fg("warning",I(O("[\u5DF2\u622A\u65AD\uFF1A\u663E\u793A\u4E86 {shown} \u884C\uFF08\u4E0A\u9650 {limit}\uFF09]"),{shown:o.outputLines,limit:A(o.maxBytes??T)}))}`),h}
|
|
9
|
-
${
|
|
8
|
+
${i.fg("warning",I(O("[\u5DF2\u622A\u65AD\uFF1A\u663E\u793A\u4E86 {shown} \u884C\uFF08\u4E0A\u9650 {limit}\uFF09]"),{shown:o.outputLines,limit:A(o.maxBytes??T)}))}`),h}a(Ae,"formatReadResult");function Pe(e,t){const n=t?.autoResizeImages??!0,i=t?.resizeOptions,m=t?.operations??we;return{name:"read",label:"read",description:`Read the contents of a file. Supports text files and images (jpg, png, gif, webp, bmp). Images are sent as attachments. For text files, output is truncated to ${X} lines or ${T/1024}KB (whichever is hit first). Use offset/limit for large files. When you need the full file, continue with offset until complete.`,promptSnippet:q.snippet,promptGuidelines:[...q.guidelines],parameters:be,outputSchema:Le,constrainedSampling:{type:"json_schema",strict:"prefer"},async execute(c,{path:u,offset:d,limit:s},l,z,w){return new Promise(($,R)=>{if(l?.aborted){R(new Error("Operation aborted"));return}let L=!1;const h=a(()=>{L=!0,R(new Error("Operation aborted"))},"onAbort");l?.addEventListener("abort",h,{once:!0}),(async()=>{try{const o=await fe(u,w?.cwd||e);if(L)return;const S=t?.operations?void 0:de(o);if(S)throw new Error(S);if(await m.access(o),L)return;const _=m.detectImageMimeType?await m.detectImageMimeType(o):void 0;let P,D;const M=Re(w?.model);if(_){const j=await m.readFile(o),x=await ae(j,_,{autoResizeImages:n,resizeOptions:w?.model?.inputLimits?.images?.resize??i});if(x.ok){let r=`Read image file [${x.mimeType}]`;x.hints.length>0&&(r+=`
|
|
9
|
+
${x.hints.join(`
|
|
10
10
|
`)}`),M&&(r+=`
|
|
11
|
-
${M}`),P=[{type:"text",text:r},{type:"image",data:
|
|
12
|
-
${
|
|
11
|
+
${M}`),P=[{type:"text",text:r},{type:"image",data:x.data,mimeType:x.mimeType}]}else{let r=`Read image file [${_}]
|
|
12
|
+
${x.message}`;M&&(r+=`
|
|
13
13
|
${M}`),P=[{type:"text",text:r}]}}else{const r=(await m.readFile(o)).toString("utf-8").split(`
|
|
14
|
-
`),B=r.length,p=
|
|
14
|
+
`),B=r.length,p=d?Math.max(0,d-1):0,C=p+1;if(p>=r.length)throw new Error(`Offset ${d} is beyond end of file (${r.length} lines total)`);let F,E;if(s!==void 0){const g=Math.min(p+s,r.length);F=r.slice(p,g).join(`
|
|
15
15
|
`),E=g-p}else F=r.slice(p).join(`
|
|
16
|
-
`);const
|
|
16
|
+
`);const b=he(F);let y;if(b.firstLineExceedsLimit){const g=A(Buffer.byteLength(r[p],"utf-8"));y=`[Line ${C} is ${g}, exceeds ${A(T)} limit. Use bash: sed -n '${C}p' ${u} | head -c ${T}]`,D={truncation:b}}else if(b.truncated){const g=C+b.outputLines-1,v=g+1;y=b.content,b.truncatedBy==="lines"?y+=`
|
|
17
17
|
|
|
18
18
|
[Showing lines ${C}-${g} of ${B}. Use offset=${v} to continue.]`:y+=`
|
|
19
19
|
|
|
20
|
-
[Showing lines ${C}-${g} of ${B} (${A(T)} limit). Use offset=${v} to continue.]`,D={truncation
|
|
20
|
+
[Showing lines ${C}-${g} of ${B} (${A(T)} limit). Use offset=${v} to continue.]`,D={truncation:b}}else if(E!==void 0&&p+E<r.length){const g=r.length-(p+E),v=p+E+1;y=`${b.content}
|
|
21
21
|
|
|
22
|
-
[${g} more lines in file. Use offset=${v} to continue.]`}else y
|
|
22
|
+
[${g} more lines in file. Use offset=${v} to continue.]`}else y=b.content;P=[{type:"text",text:y}]}if(L)return;l?.removeEventListener("abort",h),$({content:P,details:D})}catch(o){l?.removeEventListener("abort",h),L||R(o)}})()}).then($=>({...$,structuredContent:Te($.content)}))},renderCall(c,u,d){const s=d.lastComponent??new V("",0,0),l=d.expanded?void 0:Ee(c,d.cwd);return s.setText(l?Oe(l,c,u):$e(c,u,d.cwd)),s},renderResult(c,u,d,s){const l=s.lastComponent??new V("",0,0);return l.setText(Ae(s.args,c,u,d,s.showImages,s.cwd,s.isError)),l}}}a(Pe,"createReadToolDefinition");function qe(e,t){return ge(Pe(e,t))}a(qe,"createReadTool");export{qe as createReadTool,Pe as createReadToolDefinition,q as readToolSystemPromptContribution};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ImageContent, TextContent } from "@earendil-works/pi-ai";
|
|
2
|
+
import type { Theme } from "../../modes/interactive/theme/theme.ts";
|
|
3
|
+
import type { ToolRenderContext } from "../extensions/types.ts";
|
|
4
|
+
export declare function shortenPath(path: unknown): string;
|
|
5
|
+
export declare function linkPath(styledText: string, rawPath: string, cwd: string): string;
|
|
6
|
+
export declare function str(value: unknown): string | null;
|
|
7
|
+
export declare function formatReadLineRange(offset: unknown, limit: unknown): string;
|
|
8
|
+
export declare function replaceTabs(text: string): string;
|
|
9
|
+
export declare function normalizeDisplayText(text: string): string;
|
|
10
|
+
export declare function getTextOutput(result: {
|
|
11
|
+
content: Array<{
|
|
12
|
+
type: string;
|
|
13
|
+
text?: string;
|
|
14
|
+
data?: string;
|
|
15
|
+
mimeType?: string;
|
|
16
|
+
}>;
|
|
17
|
+
} | undefined, showImages: boolean): string;
|
|
18
|
+
export type ToolRenderResultLike<TDetails> = {
|
|
19
|
+
content: (TextContent | ImageContent)[];
|
|
20
|
+
details: TDetails;
|
|
21
|
+
};
|
|
22
|
+
export declare function formatToolCallWithArgs(title: string, args: unknown, theme: Theme, expanded: boolean): string;
|
|
23
|
+
export declare function formatToolDuration(ms: number): string;
|
|
24
|
+
interface ToolTimerState {
|
|
25
|
+
startedAt?: number;
|
|
26
|
+
endedAt?: number;
|
|
27
|
+
interval?: ReturnType<typeof setInterval>;
|
|
28
|
+
}
|
|
29
|
+
export declare function startToolTimer(context: ToolRenderContext<ToolTimerState>): void;
|
|
30
|
+
export declare function toolTimerText(context: ToolRenderContext<ToolTimerState>, isPartial: boolean): string | undefined;
|
|
31
|
+
export declare function invalidArgText(theme: Theme): string;
|
|
32
|
+
export declare function countOutputLines(output: string): number;
|
|
33
|
+
export declare function formatCollapsedSummary(theme: Theme, parts: string[]): string;
|
|
34
|
+
export declare function compactToolArgHint(args: unknown, maxLength?: number): string;
|
|
35
|
+
export declare function prettyToolLabel(toolName: string): string;
|
|
36
|
+
export declare function truncateDisplay(text: string, maxLength?: number): string;
|
|
37
|
+
export declare function renderToolPath(rawPath: string | null, theme: Theme, cwd: string, options?: {
|
|
38
|
+
emptyFallback?: string;
|
|
39
|
+
}): string;
|
|
40
|
+
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
`);const
|
|
1
|
+
var h=Object.defineProperty;var o=(t,n)=>h(t,"name",{value:n,configurable:!0});import*as T from"node:os";import{pathToFileURL as A}from"node:url";import{getCapabilities as d,getImageDimensions as x,hyperlink as b,imageFallback as S}from"@earendil-works/pi-tui";import{t as a}from"../../dal/i18n.js";import{stripAnsi as _}from"../../utils/ansi.js";import{resolvePath as j}from"../../utils/paths.js";import{sanitizeBinaryOutput as k}from"../../utils/shell.js";function O(t){if(typeof t!="string")return"";const n=T.homedir();return t.startsWith(n)?`~${t.slice(n.length)}`:t}o(O,"shortenPath");function D(t,n,e){if(!d().hyperlinks)return t;const i=j(n,e);return b(t,A(i).href)}o(D,"linkPath");function W(t){return typeof t=="string"?t:t==null?"":null}o(W,"str");function m(t){return typeof t=="string"&&t.trim()!==""&&(t=Number(t)),typeof t=="number"&&Number.isFinite(t)?t:void 0}o(m,"parseLineNumber");function z(t,n){if(t==null&&n==null)return"";const e=t==null?1:m(t);if(e===void 0)return"";if(n==null)return`:${e}`;const i=m(n);if(i===void 0)return"";const r=e+i-1;return`:${e}${r?`-${r}`:""}`}o(z,"formatReadLineRange");function C(t){return t.replace(/\t/g," ")}o(C,"replaceTabs");function G(t){return t.replace(/\r/g,"")}o(G,"normalizeDisplayText");function H(t,n){if(!t)return"";const e=t.content.filter(u=>u.type==="text"),i=t.content.filter(u=>u.type==="image");let r=e.map(u=>k(_(u.text||"")).replace(/\r/g,"")).join(`
|
|
2
|
+
`);const c=d();if(i.length>0&&(!c.images||!n)){const u=i.map(f=>{const l=f.mimeType??"image/unknown",s=f.data&&f.mimeType?x(f.data,f.mimeType)??void 0:void 0;return S(l,s)}).join(`
|
|
3
3
|
`);r=r?`${r}
|
|
4
|
-
${
|
|
4
|
+
${u}`:u}return r}o(H,"getTextOutput");const g=100;function J(t,n,e,i){const r=e.fg("toolTitle",e.bold(t));if(n==null)return r;const c=typeof n=="object"&&!Array.isArray(n)?Object.entries(n):[["args",n]];if(c.length===0)return r;if(i){const l=c.map(([s,p])=>{const y=typeof p=="string"?p:JSON.stringify(p,null,2)??String(p);return` ${s}: ${C(y).replace(/\r/g,"").split(`
|
|
5
5
|
`).join(`
|
|
6
6
|
`)}`});return`${r}
|
|
7
|
-
${e.fg("muted",
|
|
8
|
-
`))}`}const c
|
|
9
|
-
`).length:0}
|
|
10
|
-
${t.fg("muted",e.join(" \xB7 "))}`}
|
|
7
|
+
${e.fg("muted",l.join(`
|
|
8
|
+
`))}`}const u=c.map(([l,s])=>`${l}=${JSON.stringify(s)??String(s)}`).join(" "),f=u.length>g?`${u.slice(0,g-3)}...`:u;return`${r} ${e.fg("muted",f)}`}o(J,"formatToolCallWithArgs");function $(t){const n=t/1e3;if(n<60)return`${n.toFixed(1)}s`;const e=Math.floor(n),i=Math.floor(e/60),r=e%60;return i<60?`${i}m ${r}s`:`${Math.floor(i/60)}h ${i%60}m ${r}s`}o($,"formatToolDuration");function N(t){const n=t.state;t.executionStarted&&n.startedAt===void 0&&(n.startedAt=Date.now(),n.endedAt=void 0)}o(N,"startToolTimer");function q(t,n){const e=t.state;if(e.startedAt!==void 0&&n&&!e.interval&&(e.interval=setInterval(()=>t.invalidate(),1e3)),(!n||t.isError)&&(e.endedAt??=Date.now(),e.interval&&(clearInterval(e.interval),e.interval=void 0)),!n&&t.durationMs!==void 0)return`${a("\u8017\u65F6")} ${$(t.durationMs)}`;if(e.startedAt===void 0)return;const i=e.endedAt??Date.now();return`${n?a("\u5DF2\u8FD0\u884C"):a("\u8017\u65F6")} ${$(i-e.startedAt)}`}o(q,"toolTimerText");function M(t){return t.fg("error",a("[\u53C2\u6570\u65E0\u6548]"))}o(M,"invalidArgText");function v(t){const n=t.trim();return n?n.split(`
|
|
9
|
+
`).length:0}o(v,"countOutputLines");function K(t,n){const e=n.filter(i=>i.length>0);return e.length===0?"":`
|
|
10
|
+
${t.fg("muted",e.join(" \xB7 "))}`}o(K,"formatCollapsedSummary");const R=["path","file_path","filePath","command","query","pattern","description","uri","name","file","goal"];function U(t,n=48){if(!t||typeof t!="object")return"";const e=t;for(const i of R){const r=e[i];if(typeof r=="string"&&r.length>0)return r.length>n?`${r.slice(0,n-1)}\u2026`:r}return""}o(U,"compactToolArgHint");function Y(t){if(!t.startsWith("mcp__"))return t;const n=t.split("__");return n.length<3?t:`${n[1]}:${n.slice(2).join("__")}`}o(Y,"prettyToolLabel");function Q(t,n=72){return t.length<=n?t:`${t.slice(0,n-1)}\u2026`}o(Q,"truncateDisplay");function V(t,n,e,i){if(t===null)return M(n);const r=t||i?.emptyFallback;return r?D(n.fg("accent",O(r)),r,e):n.fg("toolOutput","...")}o(V,"renderToolPath");export{U as compactToolArgHint,v as countOutputLines,K as formatCollapsedSummary,z as formatReadLineRange,J as formatToolCallWithArgs,$ as formatToolDuration,H as getTextOutput,M as invalidArgText,D as linkPath,G as normalizeDisplayText,Y as prettyToolLabel,V as renderToolPath,C as replaceTabs,O as shortenPath,N as startToolTimer,W as str,q as toolTimerText,Q as truncateDisplay};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var S=Object.defineProperty;var
|
|
2
|
-
`),c=
|
|
3
|
-
${
|
|
4
|
-
`)}`;h>0&&(d+=`${
|
|
5
|
-
${f(l("... (\u8FD8\u6709 {count} \u884C\uFF0C"),{count:h})}`)} ${N("app.tools.expand",l("\u5373\u53EF\u5C55\u5F00"))}${
|
|
6
|
-
${
|
|
7
|
-
${
|
|
8
|
-
${
|
|
1
|
+
var S=Object.defineProperty;var r=(e,i)=>S(e,"name",{value:i,configurable:!0});import{basename as E,dirname as R,isAbsolute as D,relative as M,resolve as b,sep as A}from"node:path";import{Text as k}from"@earendil-works/pi-tui";import{getReadmePath as v}from"../../../config.js";import{fill as f,t as l}from"../../../dal/i18n.js";import{keyHint as N,keyText as O}from"../../../modes/interactive/components/keybinding-hints.js";import{getLanguageFromPath as U,highlightCode as B}from"../../../modes/interactive/theme/theme.js";import{formatPathRelativeToCwdOrAbsolute as F}from"../../../utils/paths.js";import{resolveToCwd as I}from"../path-utils.js";import{formatReadLineRange as W,getTextOutput as G,renderToolPath as j,replaceTabs as m,str as p}from"../render-utils.js";import{DEFAULT_MAX_BYTES as P,DEFAULT_MAX_LINES as H,formatSize as $}from"../truncate.js";const X=new Set(["AGENTS.override.md","AGENTS.md","AGENTS.MD","CLAUDE.md","CLAUDE.MD"]);function g(e,i){const t=W(e?.offset,e?.limit);return t?i.fg("warning",t):""}r(g,"styledReadLineRange");function z(e,i,t){const n=j(p(e?.file_path??e?.path),i,t);return`${i.fg("toolTitle",i.bold("read"))} ${n}${g(e,i)}`}r(z,"formatReadCall");function K(e){let i=e.length;for(;i>0&&e[i-1]==="";)i--;return e.slice(0,i)}r(K,"trimTrailingEmptyLines");function Y(e){return e.split(A).join("/")}r(Y,"toPosixPath");function q(e){const i=R(v()),t=M(b(i),b(e));if(t===""||t===".."||t.startsWith(`..${A}`)||D(t))return;const n=Y(t);if(n==="README.md"||n.startsWith("docs/")||n.startsWith("dal-docs/")||n.startsWith("examples/"))return{kind:"docs",label:n}}r(q,"getPiDocsClassification");function J(e,i){const t=p(e?.file_path??e?.path);if(!t)return;const n=I(t,i),o=E(n);if(o==="SKILL.md")return{kind:"skill",label:E(R(n))||o};const s=q(n);if(s)return s;if(X.has(o))return{kind:"resource",label:F(n,i)}}r(J,"getCompactReadClassification");function Q(e,i,t){const n=t.fg("dim",f(l(" ({key} \u5373\u53EF\u5C55\u5F00)"),{key:O("app.tools.expand")}));return e.kind==="skill"?t.fg("customMessageLabel","\x1B[1m[skill]\x1B[22m ")+t.fg("customMessageText",e.label)+g(i,t)+n:t.fg("toolTitle",t.bold(`read ${e.kind}`))+" "+t.fg("accent",e.label)+g(i,t)+n}r(Q,"formatCompactReadCall");function V(e,i,t,n,o,s,L){if(!t.expanded&&!L)return"";const w=p(e?.file_path??e?.path),x=G(i,o),u=!L&&w?U(w):void 0,y=u?B(m(x),u):x.split(`
|
|
2
|
+
`),c=K(y),T=t.expanded?c.length:10,_=c.slice(0,T),h=c.length-T;let d=`
|
|
3
|
+
${_.map(C=>u?m(C):n.fg("toolOutput",m(C))).join(`
|
|
4
|
+
`)}`;h>0&&(d+=`${n.fg("muted",`
|
|
5
|
+
${f(l("... (\u8FD8\u6709 {count} \u884C\uFF0C"),{count:h})}`)} ${N("app.tools.expand",l("\u5373\u53EF\u5C55\u5F00"))}${n.fg("muted",")")}`);const a=i.details?.truncation;return a?.truncated&&(a.firstLineExceedsLimit?d+=`
|
|
6
|
+
${n.fg("warning",f(l("[\u9996\u884C\u8D85\u51FA {limit} \u4E0A\u9650]"),{limit:$(a.maxBytes??P)}))}`:a.truncatedBy==="lines"?d+=`
|
|
7
|
+
${n.fg("warning",f(l("[\u5DF2\u622A\u65AD\uFF1A\u663E\u793A {shown}/{total} \u884C\uFF08\u4E0A\u9650 {max} \u884C\uFF09]"),{shown:a.outputLines,total:a.totalLines,max:a.maxLines??H}))}`:d+=`
|
|
8
|
+
${n.fg("warning",f(l("[\u5DF2\u622A\u65AD\uFF1A\u663E\u793A\u4E86 {shown} \u884C\uFF08\u4E0A\u9650 {limit}\uFF09]"),{shown:a.outputLines,limit:$(a.maxBytes??P)}))}`),d}r(V,"formatReadResult");const ft={renderCall(e,i,t){const n=e,o=t.lastComponent??new k("",0,0),s=t.expanded?void 0:J(n,t.cwd);return o.setText(s?Q(s,n,i):z(n,i,t.cwd)),o},renderResult(e,i,t,n){const o=n.lastComponent??new k("",0,0);return o.setText(V(n.args,e,i,t,n.showImages,n.cwd,n.isError)),o}};export{ft as readRenderers};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var D=Object.defineProperty;var i=(o,t)=>D(o,"name",{value:t,configurable:!0});import{existsSync as h,mkdirSync as m,readFileSync as T}from"node:fs";import{homedir as w}from"node:os";import{dirname as l,join as c}from"node:path";import O from"proper-lockfile";import{CONFIG_DIR_NAME as k,SHARED_SKILL_CONFIG_DIRS as y}from"../config.js";import{projectFileDeclaresHooks as j,TRUST_REQUIRING_PROJECT_HOOK_FILES as R}from"../dal/hooks/config.js";import{canonicalizePath as p,resolvePath as a}from"../utils/paths.js";import{stripBom as g}from"../utils/text.js";import{writeFileAtomicSync as _}from"./shared-data.js";const v=["settings.json","mcp.json","extensions","mcp.json","lsp.json","skills","prompts","themes","SYSTEM.md","APPEND_SYSTEM.md"];function f(o){return p(a(o))}i(f,"normalizeCwd");function I(o,t){let r=f(t);for(;;){const e=o[r];if(e===!0||e===!1)return{path:r,decision:e};const s=l(r);if(s===r)return null;r=s}}i(I,"findNearestTrustEntry");function F(o){const t=f(o),r=l(t);return r===t?void 0:r}i(F,"getProjectTrustParentPath");function q(o,t){const r=f(o),e=[{label:"Trust",trusted:!0,updates:[{path:r,decision:!0}],savedPath:r}],s=F(o);return s!==void 0&&e.push({label:`Trust parent folder (${s})`,trusted:!0,updates:[{path:s,decision:!0},{path:r,decision:null}],savedPath:s}),t?.includeSessionOnly&&e.push({label:"Trust (this session only)",trusted:!0,updates:[]}),e.push({label:"Do not trust",trusted:!1,updates:[{path:r,decision:!1}],savedPath:r}),t?.includeSessionOnly&&e.push({label:"Do not trust (this session only)",trusted:!1,updates:[]}),e}i(q,"getProjectTrustOptions");function S(o){if(!h(o))return{};let t;try{t=JSON.parse(g(T(o,"utf-8")))}catch(e){const s=e instanceof Error?e.message:String(e);throw new Error(`Failed to read trust store ${o}: ${s}`)}if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`Invalid trust store ${o}: expected an object`);const r={};for(const[e,s]of Object.entries(t)){if(s!==!0&&s!==!1&&s!==null)throw new Error(`Invalid trust store ${o}: value for ${JSON.stringify(e)} must be true, false, or null`);r[e]=s}return r}i(S,"readTrustFile");function b(o,t){const r={};for(const e of Object.keys(t).sort()){const s=t[e];(s===!0||s===!1||s===null)&&(r[e]=s)}m(l(o),{recursive:!0}),_(o,`${JSON.stringify(r,null,2)}
|
|
1
|
+
var D=Object.defineProperty;var i=(o,t)=>D(o,"name",{value:t,configurable:!0});import{existsSync as h,mkdirSync as m,readFileSync as T}from"node:fs";import{homedir as w}from"node:os";import{dirname as l,join as c}from"node:path";import O from"proper-lockfile";import{CONFIG_DIR_NAME as k,SHARED_SKILL_CONFIG_DIRS as y}from"../config.js";import{projectFileDeclaresHooks as j,TRUST_REQUIRING_PROJECT_HOOK_FILES as R}from"../dal/hooks/config.js";import{canonicalizePath as p,resolvePath as a}from"../utils/paths.js";import{stripBom as g}from"../utils/text.js";import{writeFileAtomicSync as _}from"./shared-data.js";const v=["settings.json","mcp.json","extensions","mcp.json","lsp.json","skills","prompts","commands","themes","SYSTEM.md","APPEND_SYSTEM.md"];function f(o){return p(a(o))}i(f,"normalizeCwd");function I(o,t){let r=f(t);for(;;){const e=o[r];if(e===!0||e===!1)return{path:r,decision:e};const s=l(r);if(s===r)return null;r=s}}i(I,"findNearestTrustEntry");function F(o){const t=f(o),r=l(t);return r===t?void 0:r}i(F,"getProjectTrustParentPath");function q(o,t){const r=f(o),e=[{label:"Trust",trusted:!0,updates:[{path:r,decision:!0}],savedPath:r}],s=F(o);return s!==void 0&&e.push({label:`Trust parent folder (${s})`,trusted:!0,updates:[{path:s,decision:!0},{path:r,decision:null}],savedPath:s}),t?.includeSessionOnly&&e.push({label:"Trust (this session only)",trusted:!0,updates:[]}),e.push({label:"Do not trust",trusted:!1,updates:[{path:r,decision:!1}],savedPath:r}),t?.includeSessionOnly&&e.push({label:"Do not trust (this session only)",trusted:!1,updates:[]}),e}i(q,"getProjectTrustOptions");function S(o){if(!h(o))return{};let t;try{t=JSON.parse(g(T(o,"utf-8")))}catch(e){const s=e instanceof Error?e.message:String(e);throw new Error(`Failed to read trust store ${o}: ${s}`)}if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`Invalid trust store ${o}: expected an object`);const r={};for(const[e,s]of Object.entries(t)){if(s!==!0&&s!==!1&&s!==null)throw new Error(`Invalid trust store ${o}: value for ${JSON.stringify(e)} must be true, false, or null`);r[e]=s}return r}i(S,"readTrustFile");function b(o,t){const r={};for(const e of Object.keys(t).sort()){const s=t[e];(s===!0||s===!1||s===null)&&(r[e]=s)}m(l(o),{recursive:!0}),_(o,`${JSON.stringify(r,null,2)}
|
|
2
2
|
`)}i(b,"writeTrustFile");function N(o){const t=l(o);m(t,{recursive:!0});const r=100,e=20;let s;for(let n=1;n<=r;n++)try{return O.lockSync(t,{realpath:!1,lockfilePath:`${o}.lock`})}catch(u){if((typeof u=="object"&&u!==null&&"code"in u?String(u.code):void 0)!=="ELOCKED"||n===r)throw u;s=u;const E=Date.now();for(;Date.now()-E<e;);}throw s instanceof Error?s:new Error("Failed to acquire trust store lock")}i(N,"acquireTrustLockSync");function P(o,t){const r=N(o);try{return t()}finally{r()}}i(P,"withTrustFileLock");function K(o){const t=p(a(process.env.HOME||w())),r=new Set(y.map(n=>c(t,n,"skills")));let e=p(a(o));const s=c(e,k);if(v.some(n=>h(c(s,n)))||R.some(n=>j(c(e,n))))return!0;for(;;){for(const u of y){const d=c(e,u,"skills");if(!r.has(d)&&h(d))return!0}const n=l(e);if(n===e)return!1;e=n}}i(K,"hasTrustRequiringProjectResources");class z{static{i(this,"ProjectTrustStore")}trustPath;constructor(t){this.trustPath=c(a(t),"trust.json")}get(t){return this.getEntry(t)?.decision??null}getEntry(t){return P(this.trustPath,()=>{const r=S(this.trustPath);return I(r,t)})}set(t,r){this.setMany([{path:t,decision:r}])}setMany(t){P(this.trustPath,()=>{const r=S(this.trustPath);for(const{path:e,decision:s}of t){const n=f(e);s===null?delete r[n]:r[n]=s}b(this.trustPath,r)})}}export{z as ProjectTrustStore,q as getProjectTrustOptions,F as getProjectTrustParentPath,K as hasTrustRequiringProjectResources};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
export declare const WORKSPACE_LOCK_DIR_NAME = "workspace-locks";
|
|
1
2
|
export declare const WORKSPACE_LOCK_FILE = "dal-workspace.lock";
|
|
3
|
+
export declare function defaultWorkspaceLockDir(): string;
|
|
4
|
+
export declare function workspaceLockPath(gitDir: string, lockDir?: string): string;
|
|
2
5
|
export declare const STALE_AFTER_MS: number;
|
|
3
6
|
export interface WorkspaceLock {
|
|
4
7
|
pid: number;
|
|
@@ -18,12 +21,13 @@ export declare function gitDirOf(dir: string): {
|
|
|
18
21
|
worktree?: string;
|
|
19
22
|
} | undefined;
|
|
20
23
|
export declare function workspaceOwnerSessionId(sessionId: string, env?: NodeJS.ProcessEnv): string;
|
|
21
|
-
export declare function readWorkspaceLock(gitDir: string): WorkspaceLock | undefined;
|
|
24
|
+
export declare function readWorkspaceLock(gitDir: string, lockDir?: string): WorkspaceLock | undefined;
|
|
22
25
|
export declare function workspaceLockIsLive(lock: WorkspaceLock, now?: number): boolean;
|
|
23
26
|
export declare function claimWorkspace(dir: string, sessionId: string, options?: {
|
|
24
27
|
now?: number;
|
|
25
28
|
env?: NodeJS.ProcessEnv;
|
|
26
29
|
force?: boolean;
|
|
30
|
+
lockDir?: string;
|
|
27
31
|
}): WorkspaceClaim | undefined;
|
|
28
|
-
export declare function releaseWorkspace(gitDir: string): void;
|
|
32
|
+
export declare function releaseWorkspace(gitDir: string, lockDir?: string): void;
|
|
29
33
|
export declare function shellCommandDirectory(command: string, cwd: string): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),
|
|
3
|
-
`),
|
|
1
|
+
var A=Object.defineProperty;var i=(t,e)=>A(t,"name",{value:e,configurable:!0});import{execFileSync as E}from"node:child_process";import{createHash as I}from"node:crypto";import{mkdirSync as O,readFileSync as x,realpathSync as _,renameSync as L,rmSync as v,writeFileSync as R}from"node:fs";import{hostname as l}from"node:os";import{basename as h,isAbsolute as C,join as g,resolve as p}from"node:path";import{getAgentDir as N}from"../config.js";const F="workspace-locks",S="dal-workspace.lock";function P(){return g(N(),F)}i(P,"defaultWorkspaceLockDir");function w(t,e=P()){let r=p(t);try{r=_.native(r)}catch{}const o=I("sha256").update(r).digest("hex").slice(0,16),n=h(r)===".git"?h(p(r,"..")):h(r);return g(e,`${n.replace(/[^\w.-]/g,"_").slice(0,40)||"repo"}-${o}.lock`)}i(w,"workspaceLockPath");const $=7200*1e3,b=60*1e3,M="DALCODE_PARENT_SESSION_ID",k=new Map;function W(t){const e=p(t),r=k.get(e);if(r!==void 0)return r??void 0;let o=null;try{const n=E("git",["rev-parse","--git-dir","--show-toplevel"],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:3e3}).trim().split(`
|
|
2
|
+
`),s=n[0]?.trim();s&&(o={gitDir:C(s)?s:p(e,s),worktree:n[1]?.trim()})}catch{o=null}return k.set(e,o),o??void 0}i(W,"gitDirOf");function H(t,e=process.env){return e[M]||t}i(H,"workspaceOwnerSessionId");function f(t){try{const e=JSON.parse(x(t,"utf8"));return typeof e.pid!="number"||typeof e.sessionId!="string"||typeof e.host!="string"?void 0:{pid:e.pid,host:e.host,sessionId:e.sessionId,startedAt:typeof e.startedAt=="string"?e.startedAt:new Date(0).toISOString(),refreshedAt:typeof e.refreshedAt=="string"?e.refreshedAt:new Date(0).toISOString(),...typeof e.worktree=="string"?{worktree:e.worktree}:{}}}catch{return}}i(f,"readLockFile");function z(t,e){return f(w(t,e))??f(g(t,S))}i(z,"readWorkspaceLock");function K(t){try{return process.kill(t,0),!0}catch(e){return e.code==="EPERM"}}i(K,"processAlive");function m(t,e=Date.now()){const r=Date.parse(t.refreshedAt);return!Number.isFinite(r)||e-r>$?!1:t.host===l()?K(t.pid):!0}i(m,"workspaceLockIsLive");function y(t,e){O(p(t,".."),{recursive:!0});const r=`${t}.${process.pid}.tmp`;R(r,`${JSON.stringify(e,null,2)}
|
|
3
|
+
`),L(r,t)}i(y,"writeLock");function G(t,e,r={}){const o=W(t);if(!o)return;const n=r.now??Date.now(),s=H(e,r.env),a=w(o.gitDir,r.lockDir),c=f(a),u={gitDir:o.gitDir,...o.worktree?{worktree:o.worktree}:{}},D=f(g(o.gitDir,S));for(const d of[c,D])if(d&&d.sessionId!==s&&m(d,n)&&!r.force)return{...u,heldBy:d};if(c?.sessionId===s&&m(c,n)){if(!(c.pid===process.pid&&c.host===l())||n-Date.parse(c.refreshedAt)<b)return u;try{y(a,{...c,refreshedAt:new Date(n).toISOString()})}catch{}return u}try{y(a,{pid:process.pid,host:l(),sessionId:s,startedAt:new Date(n).toISOString(),refreshedAt:new Date(n).toISOString(),...o.worktree?{worktree:o.worktree}:{}})}catch{return}return u}i(G,"claimWorkspace");function Q(t,e){const r=w(t,e),o=f(r);if(!(!o||o.pid!==process.pid||o.host!==l()))try{v(r,{force:!0})}catch{}}i(Q,"releaseWorkspace");function U(t,e){let r=e;for(const n of t.split(/&&|;|\n/)){const s=/^\s*cd\s+("([^"]+)"|'([^']+)'|(\S+))\s*$/.exec(n);if(!s)break;const a=(s[2]??s[3]??s[4]??"").replace(/^~(?=\/|$)/,process.env.HOME??"~");r=p(r,a)}const o=/\bgit\s+-C\s+("([^"]+)"|'([^']+)'|(\S+))/.exec(t);return o&&(r=p(r,o[2]??o[3]??o[4]??".")),r}i(U,"shellCommandDirectory");export{$ as STALE_AFTER_MS,F as WORKSPACE_LOCK_DIR_NAME,S as WORKSPACE_LOCK_FILE,G as claimWorkspace,P as defaultWorkspaceLockDir,W as gitDirOf,z as readWorkspaceLock,Q as releaseWorkspace,U as shellCommandDirectory,m as workspaceLockIsLive,w as workspaceLockPath,H as workspaceOwnerSessionId};
|
package/dist/dal/builtins.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a=Object.defineProperty;var r=(n,e)=>a(n,"name",{value:e,configurable:!0});import{execFileSync as P}from"node:child_process";import{readFileSync as l}from"node:fs";import{createRequire as f}from"node:module";import{dirname as u,join as T}from"node:path";import{setAmbientAuthPolicy as m,setEnvApiKeyPolicy as d}from"@earendil-works/pi-ai";import{houseProvidersEnforced as E,isProviderConfigurable as y}from"../core/house-providers.js";import{BUNDLED_EXTENSION_PACKAGES as S,PROVIDER_EXTENSION_PACKAGES as x,SAFETY_CRITICAL_PACKAGES as _}from"./manifest.js";function H(){if(!E())return;const n=r(e=>y(e),"allowed");d(n),m(n)}r(H,"applyDalEnvApiKeyPolicy");import{BUNDLED_EXTENSION_PACKAGES as D,SAFETY_CRITICAL_PACKAGES as b}from"./manifest.js";function p(n=S){const e=f(import.meta.url),t=[];for(const i of n)try{const o=e.resolve(`${i}/package.json`),c=JSON.parse(l(o,"utf8"));for(const s of c.pi?.extensions??[])t.push(T(u(o),s))}catch(o){_.has(i)&&process.stderr.write(`dal: \u5B89\u5168\u6269\u5C55 ${i} \u52A0\u8F7D\u5931\u8D25\uFF0C\u5371\u9669\u547D\u4EE4\u7684\u5BA1\u6279\u95E8\u5DF2\u5931\u6548 \u2014 ${o instanceof Error?o.message:String(o)}
|
|
2
2
|
\u91CD\u65B0\u5B89\u88C5\u53EF\u6062\u590D\uFF1Anpm i -g dal-code@latest
|
|
3
|
-
`)}return
|
|
3
|
+
`)}return t}r(p,"bundledPackageExtensionPaths");function X(){return p()}r(X,"dalBuiltinExtensionPaths");function K(){return p(x)}r(K,"dalProviderExtensionPaths");function Y(){if(!(process.platform!=="darwin"||["HTTPS_PROXY","https_proxy","HTTP_PROXY","http_proxy","ALL_PROXY","all_proxy"].some(e=>process.env[e])))try{const e=P("scutil",["--proxy"],{encoding:"utf8",timeout:2e3}),t=r(s=>e.match(new RegExp(`${s}\\s*:\\s*(\\S+)`))?.[1],"get"),i=r(s=>t(`${s}Enable`)==="1","enabled"),o=i("HTTPS")?`http://${t("HTTPSProxy")}:${t("HTTPSPort")}`:i("HTTP")?`http://${t("HTTPProxy")}:${t("HTTPPort")}`:void 0;if(!o||o.includes("undefined"))return;process.env.HTTPS_PROXY=o,process.env.HTTP_PROXY=o;const c=new Set((process.env.NO_PROXY??process.env.no_proxy??"").split(",").filter(Boolean));for(const s of["localhost","127.0.0.1","::1"])c.add(s);process.env.NO_PROXY=[...c].join(",")}catch{}}r(Y,"applyDalSystemProxyFallback");export{D as BUNDLED_EXTENSION_PACKAGES,b as SAFETY_CRITICAL_PACKAGES,H as applyDalEnvApiKeyPolicy,Y as applyDalSystemProxyFallback,X as dalBuiltinExtensionPaths,K as dalProviderExtensionPaths};
|