dal-code 1.0.23 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dal-docs/README.md +96 -0
- package/dal-docs/extensions.md +98 -0
- package/dal-docs/keybindings.md +40 -0
- package/dal-docs/packages.md +62 -0
- package/dal-docs/prompt-templates.md +42 -0
- package/dal-docs/settings.md +86 -0
- package/dal-docs/skills.md +65 -0
- package/dal-docs/themes.md +44 -0
- package/dist/cli/args.d.ts +56 -0
- package/dist/config.d.ts +63 -0
- package/dist/config.js +1 -1
- package/dist/core/agent-session-runtime.d.ts +74 -0
- package/dist/core/agent-session-services.d.ts +48 -0
- package/dist/core/agent-session.d.ts +409 -0
- package/dist/core/agent-session.js +6 -6
- package/dist/core/auth-storage.d.ts +56 -0
- package/dist/core/bash-executor.d.ts +13 -0
- package/dist/core/cache-warmer.d.ts +60 -0
- package/dist/core/compaction/branch-summarization.d.ts +43 -0
- package/dist/core/compaction/compaction.d.ts +62 -0
- package/dist/core/compaction/index.d.ts +3 -0
- package/dist/core/compaction/utils.d.ts +16 -0
- package/dist/core/diagnostics.d.ts +14 -0
- package/dist/core/event-bus.d.ts +8 -0
- package/dist/core/exec.d.ts +12 -0
- package/dist/core/extensions/index.d.ts +8 -0
- package/dist/core/extensions/loader.d.ts +13 -0
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/extensions/permission-surface.js +1 -1
- package/dist/core/extensions/runner.d.ts +165 -0
- package/dist/core/extensions/runner.js +1 -1
- package/dist/core/extensions/types.d.ts +1000 -0
- package/dist/core/extensions/wrapper.d.ts +5 -0
- package/dist/core/footer-data-provider.d.ts +46 -0
- package/dist/core/keybindings.d.ts +525 -0
- package/dist/core/keybindings.js +1 -1
- package/dist/core/messages.d.ts +50 -0
- package/dist/core/model-config.d.ts +1212 -0
- package/dist/core/model-registry.d.ts +41 -0
- package/dist/core/model-resolver.d.ts +67 -0
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-runtime.d.ts +101 -0
- package/dist/core/model-runtime.js +2 -2
- package/dist/core/package-manager.d.ts +213 -0
- package/dist/core/package-manager.js +2 -2
- package/dist/core/project-map.d.ts +18 -0
- package/dist/core/prompt-templates.d.ts +24 -0
- package/dist/core/provider-composer.d.ts +55 -0
- package/dist/core/remote-catalog-provider.js +1 -1
- package/dist/core/resolve-config-value.d.ts +11 -0
- package/dist/core/resource-loader.d.ts +220 -0
- package/dist/core/resource-loader.js +1 -1
- package/dist/core/sdk.d.ts +40 -0
- package/dist/core/session-manager.d.ts +208 -0
- package/dist/core/settings-manager.d.ts +348 -0
- package/dist/core/settings-manager.js +1 -1
- package/dist/core/skills.d.ts +33 -0
- package/dist/core/slash-commands.d.ts +14 -0
- package/dist/core/source-info.d.ts +17 -0
- package/dist/core/system-prompt.d.ts +39 -0
- package/dist/core/system-prompt.js +15 -11
- package/dist/core/tools/bash.d.ts +75 -0
- package/dist/core/tools/bash.js +14 -14
- package/dist/core/tools/edit-diff.d.ts +44 -0
- package/dist/core/tools/edit.d.ts +48 -0
- package/dist/core/tools/file-mutation-queue.d.ts +1 -0
- package/dist/core/tools/find.d.ts +34 -0
- package/dist/core/tools/grep.d.ts +34 -0
- package/dist/core/tools/index.d.ts +42 -0
- package/dist/core/tools/index.js +1 -1
- package/dist/core/tools/ls.d.ts +33 -0
- package/dist/core/tools/powershell.d.ts +17 -0
- package/dist/core/tools/read.d.ts +33 -0
- package/dist/core/tools/read.js +2 -2
- package/dist/core/tools/renderers/bash.d.ts +3 -0
- package/dist/core/tools/renderers/edit.d.ts +15 -0
- package/dist/core/tools/renderers/find.d.ts +2 -0
- package/dist/core/tools/renderers/grep.d.ts +2 -0
- package/dist/core/tools/renderers/index.d.ts +13 -0
- package/dist/core/tools/renderers/ls.d.ts +2 -0
- package/dist/core/tools/renderers/read.d.ts +3 -0
- package/dist/core/tools/renderers/read.js +8 -8
- package/dist/core/tools/renderers/write.d.ts +2 -0
- package/dist/core/tools/truncate.d.ts +27 -0
- package/dist/core/tools/write.d.ts +24 -0
- package/dist/core/trust-manager.d.ts +28 -0
- package/dist/core/trust-manager.js +2 -2
- package/dist/dal/child-env.d.ts +12 -0
- package/dist/dal/child-env.js +1 -0
- package/dist/dal/hooks/activity.d.ts +17 -0
- package/dist/dal/hooks/activity.js +1 -0
- package/dist/dal/hooks/config.d.ts +47 -0
- package/dist/dal/hooks/config.js +1 -0
- package/dist/dal/hooks/events.d.ts +43 -0
- package/dist/dal/hooks/events.js +4 -0
- package/dist/dal/hooks/extension.d.ts +3 -0
- package/dist/dal/hooks/extension.js +4 -0
- package/dist/dal/hooks/index.d.ts +5 -0
- package/dist/dal/hooks/index.js +1 -0
- package/dist/dal/hooks/runner.d.ts +57 -0
- package/dist/dal/hooks/runner.js +1 -0
- package/dist/dal/safety-net.js +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +1 -1
- package/dist/main.d.ts +9 -0
- package/dist/main.js +2 -2
- package/dist/modes/acp/acp-mode.d.ts +2 -0
- package/dist/modes/index.d.ts +7 -0
- package/dist/modes/interactive/components/armin.d.ts +30 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +26 -0
- package/dist/modes/interactive/components/assistant-message.js +2 -2
- package/dist/modes/interactive/components/bash-execution.d.ts +22 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +14 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +11 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +11 -0
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/dist/modes/interactive/components/custom-message.d.ts +17 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +17 -0
- package/dist/modes/interactive/components/diff.d.ts +4 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +12 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +19 -0
- package/dist/modes/interactive/components/extension-input.d.ts +21 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +22 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts +23 -0
- package/dist/modes/interactive/components/footer.d.ts +18 -0
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/index.d.ts +33 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +9 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +27 -0
- package/dist/modes/interactive/components/model-selector.d.ts +81 -0
- package/dist/modes/interactive/components/model-selector.js +2 -2
- package/dist/modes/interactive/components/oauth-selector.d.ts +29 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +39 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +20 -0
- package/dist/modes/interactive/components/session-selector.d.ts +88 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +92 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +6 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +11 -0
- package/dist/modes/interactive/components/status-indicator.d.ts +44 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +7 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +19 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +76 -0
- package/dist/modes/interactive/components/tool-execution.js +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +65 -0
- package/dist/modes/interactive/components/trust-selector.d.ts +22 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +23 -0
- package/dist/modes/interactive/components/user-message.d.ts +14 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +5 -0
- package/dist/modes/interactive/interactive-mode.d.ts +326 -0
- package/dist/modes/interactive/interactive-mode.js +48 -48
- package/dist/modes/interactive/theme/theme-json.d.ts +257 -0
- package/dist/modes/interactive/theme/theme.d.ts +106 -0
- package/dist/modes/interactive/tui-renderer.d.ts +18 -0
- package/dist/modes/json-event.d.ts +26 -0
- package/dist/modes/print-mode.d.ts +9 -0
- package/dist/modes/rpc/rpc-client.d.ts +119 -0
- package/dist/modes/rpc/rpc-client.js +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +3 -0
- package/dist/modes/rpc/rpc-types.d.ts +483 -0
- package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-bridge/src/ask-user.js +12 -0
- package/dist/node_modules/@dalcode/dal-bridge/src/client.js +1 -1
- package/dist/node_modules/@dalcode/dal-bridge/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-gateway/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-guard/package.json +5 -4
- package/dist/node_modules/@dalcode/dal-guard/src/hooks.js +1 -0
- package/dist/node_modules/@dalcode/dal-guard/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-lsp/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-lsp/src/client.js +3 -3
- package/dist/node_modules/@dalcode/dal-mcp/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-mcp/src/command-parser.d.ts +19 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/config-edit.d.ts +19 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/config.d.ts +9 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/http-client.d.ts +16 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.d.ts +22 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.js +2 -2
- package/dist/node_modules/@dalcode/dal-mcp/src/types.d.ts +30 -0
- package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-office/src/extract/csv.d.ts +3 -0
- package/dist/node_modules/@dalcode/dal-office/src/extract/csv.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/extract/ooxml.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/index.d.ts +11 -0
- package/dist/node_modules/@dalcode/dal-office/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/paths.d.ts +3 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/chart.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/render/docx.d.ts +19 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/pptx.d.ts +40 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/pptx.js +2 -2
- package/dist/node_modules/@dalcode/dal-office/src/render/thumbnails.d.ts +19 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/thumbnails.js +1 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.d.ts +14 -0
- package/dist/node_modules/@dalcode/dal-office/src/scratchpad.d.ts +16 -0
- package/dist/node_modules/@dalcode/dal-office/src/themes.d.ts +13 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/docx-edit.js +10 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/edit-shared.js +1 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/pptx-edit.js +9 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/read-file.js +4 -2
- package/dist/node_modules/@dalcode/dal-office/src/tools/xlsx-edit.js +5 -0
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +2 -2
- package/dist/node_modules/@dalcode/dal-plugins/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-rewind/src/core.d.ts +61 -0
- package/dist/node_modules/@dalcode/dal-router/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-router/src/commands.js +6 -6
- package/dist/node_modules/@dalcode/dal-router/src/config.d.ts +50 -0
- package/dist/node_modules/@dalcode/dal-router/src/index.js +4 -4
- package/dist/node_modules/@dalcode/dal-router/src/jev.d.ts +51 -0
- package/dist/node_modules/@dalcode/dal-router/src/pool.d.ts +6 -0
- package/dist/node_modules/@dalcode/dal-router/src/router.d.ts +32 -0
- package/dist/node_modules/@dalcode/dal-router/src/runtime.d.ts +37 -0
- package/dist/node_modules/@dalcode/dal-router/src/runtime.js +1 -1
- package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-skills/src/discover.js +4 -4
- package/dist/node_modules/@dalcode/dal-skills/src/index.js +9 -9
- package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-subagent/src/index.js +14 -8
- package/dist/node_modules/@dalcode/dal-subagent/src/process-runner.js +3 -3
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/src/groups.js +1 -1
- package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/plan-mode.js +1 -1
- package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
- package/dist/node_modules/@dalcode/deepailab/src/index.js +3 -3
- package/dist/node_modules/@dalcode/deepailab/src/model-defaults.js +1 -1
- package/dist/node_modules/@earendil-works/chord/dist/api.d.ts +21 -0
- package/dist/node_modules/@earendil-works/chord/dist/context/index.d.ts +12 -0
- package/dist/node_modules/@earendil-works/chord/dist/delta/index.d.ts +127 -0
- package/dist/node_modules/@earendil-works/chord/dist/index.d.ts +8 -0
- package/dist/node_modules/@earendil-works/chord/dist/json.d.ts +2 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/errors.d.ts +16 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/provider.d.ts +32 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts +12 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/wire.d.ts +59 -0
- package/dist/node_modules/@earendil-works/chord/dist/state/draft.d.ts +13 -0
- package/dist/node_modules/@earendil-works/chord/dist/types.d.ts +188 -0
- package/dist/node_modules/@earendil-works/chord/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +7 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +80 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +711 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts +44 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +80 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts +15 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/context.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/events.d.ts +22 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.d.ts +17 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.d.ts +34 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +50 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts +28 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/result.d.ts +132 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.d.ts +56 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.d.ts +94 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.d.ts +99 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.d.ts +52 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.d.ts +19 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts +13 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.d.ts +33 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.d.ts +37 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.d.ts +36 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.d.ts +46 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +75 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.d.ts +473 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.d.ts +94 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts +26 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.d.ts +1495 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.d.ts +26 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.d.ts +18 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.d.ts +32 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +185 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.d.ts +22 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts +22 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts +28 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +27 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +61 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/index.d.ts +28 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/stream-fn.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +150 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +4 -4
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts +18 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts +13 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts +18 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts +12 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts +24 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts +14 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts +8 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts +15 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts +30 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts +24 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts +85 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/context.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/helpers.d.ts +8 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts +20 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +127 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js +0 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts +34 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/compat.d.ts +47 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts +9 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts +9 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +829 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts +13 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/images-models.d.ts +37 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/images.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/index.d.ts +38 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/legacy-api-aliases.d.ts +25 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/model-catalog.d.ts +16 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models-store.d.ts +21 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.d.ts +97 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +84 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts +18 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/baseten.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts +100 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/meta.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius.d.ts +7 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/together.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/types.d.ts +502 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.d.ts +63 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts +19 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +19 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts +16 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/text.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/transcript.d.ts +29 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/uuid.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-client/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-coding-agent/LICENSE +21 -0
- package/dist/node_modules/@earendil-works/pi-coding-agent/index.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-coding-agent/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +15 -0
- package/dist/node_modules/@earendil-works/pi-protocol/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-server/package.json +5 -5
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.d.ts +200 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.d.ts +20 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/noop.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +55 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +20 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts +9 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +151 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/h-stack.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts +25 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +43 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +28 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +61 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts +61 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +52 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +50 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts +8 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/stack.d.ts +35 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +15 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts +9 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/v-stack.d.ts +7 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts +17 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/index.d.ts +32 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +329 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/keys.d.ts +101 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/latex.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/layout-node.d.ts +41 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/native-platform.d.ts +13 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +30 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-colors.d.ts +9 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +82 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +76 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +138 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.d.ts +32 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +252 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +38 -0
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/dist/package-manager-cli.js +32 -32
- package/dist/sdk/index.d.ts +14 -0
- package/dist/sdk/index.js +1 -0
- package/dist/sdk/mcp.d.ts +8 -0
- package/dist/sdk/mcp.js +1 -0
- package/dist/sdk/office.d.ts +1 -0
- package/dist/sdk/office.js +1 -0
- package/dist/sdk/rewind.d.ts +1 -0
- package/dist/sdk/rewind.js +1 -0
- package/dist/sdk/router.d.ts +6 -0
- package/dist/sdk/router.js +1 -0
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/frontmatter.d.ts +7 -0
- package/dist/utils/image-convert.d.ts +5 -0
- package/dist/utils/image-resize-core.d.ts +16 -0
- package/dist/utils/image-resize.d.ts +4 -0
- package/dist/utils/mime.d.ts +2 -0
- package/dist/utils/shell.d.ts +20 -0
- package/dist/utils/shell.js +3 -3
- package/dist/utils/version-check.d.ts +20 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +22 -1
- package/dist/bun/register-bedrock.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +0 -5
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.js +0 -1
- package/dist/node_modules/@earendil-works/pi-client/dist/session-handle.js +0 -1
- package/dist/node_modules/@earendil-works/pi-client/dist/state.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/cli.js +0 -16
- package/dist/node_modules/@earendil-works/pi-server/dist/config.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/handler.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/client.js +0 -2
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/protocol.js +0 -2
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/server.js +0 -3
- package/dist/node_modules/@earendil-works/pi-server/dist/protocol.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/radius.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/rpc-process.js +0 -4
- package/dist/node_modules/@earendil-works/pi-server/dist/serve.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/sessions.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/snapshots.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/storage.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/supervisor.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/service.js +0 -1
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/branch-cache.js +0 -7
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/search-backend.js +0 -36
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/branch-entries.js +0 -25
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/branch-tips.js +0 -2
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/entries.js +0 -7
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/facts.js +0 -20
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/lanes.js +0 -26
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/records.js +0 -9
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/session-sequences.js +0 -1
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/session-stats.js +0 -10
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/sessions.js +0 -29
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/writer-leases.js +0 -14
- package/dist/server/create-harness.js +0 -1
- package/dist/utils/clipboard-native.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var T=Object.defineProperty;var l=(u,s)=>T(u,"name",{value:s,configurable:!0});var z=Object.defineProperty,o=l((u,s)=>z(u,"name",{value:s,configurable:!0}),"i");import{realpathSync as y}from"node:fs";import{basename as R,dirname as H,isAbsolute as v,join as L,relative as M,resolve as p,sep as q}from"node:path";import{readBridgeConfig as x}from"@dalcode/dal-bridge/client";import{getOwnTty as V,requestHaloApproval as W}from"@dalcode/dal-halo";import{t}from"@dalcode/dal-pi-kit";import{DAL_HOOK_NOTIFICATION_CHANNEL as J}from"@earendil-works/pi-coding-agent";import{credentialBlockReason as K,namesDalCredential as U,redactContent as Z}from"./credentials.js";import{reviewBashCommand as G}from"./review.js";import{dalSecretValues as Q,namesDalCredential as X,REDACTED as Y,redactContent as uu,redactDalSecrets as eu}from"./credentials.js";import{reviewBashCommand as tu,suspicionFor as su}from"./review.js";function h(u){try{return y(u)}catch{try{return L(y(H(u)),R(u))}catch{return u}}}l(h,"_"),o(h,"realPathBestEffort");const i=o(u=>s=>u.test(s),"has"),au=[{id:"sudo",label:t("\u7279\u6743\u6267\u884C\uFF08sudo/doas\uFF09"),test:i(/(^|[;&|\n]\s*)(sudo|doas)\s/)},{id:"force-push",label:t("\u5F3A\u5236\u63A8\u9001\u5C06\u6539\u5199\u8FDC\u7A0B\u5386\u53F2"),test:i(/git\s+push\b[^;&|]*(--force\b|--force-with-lease\b|\s-f\b)/)},{id:"hard-reset",label:t("\u786C\u91CD\u7F6E\u4F1A\u4E22\u5F03\u672C\u5730\u6539\u52A8"),test:i(/git\s+reset\b[^;&|]*--hard/)},{id:"git-clean",label:t("git clean \u4F1A\u5220\u9664\u672A\u8DDF\u8E2A\u6587\u4EF6"),test:i(/git\s+clean\b[^;&|]*(-[a-z]*f|--force)/)},{id:"pipe-to-shell",label:t("\u5C06\u4E0B\u8F7D\u5185\u5BB9\u76F4\u63A5\u7BA1\u9053\u6267\u884C"),test:i(/(curl|wget)\b[^;&|]*\|\s*(ba|z|da|fi)?sh\b/)},{id:"exec-download",label:t("\u6267\u884C\u4E0B\u8F7D\u7684\u811A\u672C"),test:i(/\b(ba|z|da|fi)?sh\s+<\(\s*(curl|wget)\b|eval\b[^;&|\n]*\$\(\s*(curl|wget)\b/)},{id:"recursive-perms",label:t("\u9012\u5F52\u4FEE\u6539\u6743\u9650/\u5C5E\u4E3B"),test:i(/(chmod|chown)\b[^;&|]*-[a-zA-Z]*R/)},{id:"publish",label:t("\u53D1\u5E03\u8F6F\u4EF6\u5305"),test:i(/(npm|pnpm|yarn)\s+publish\b/)},{id:"kill",label:t("\u6309\u540D\u79F0\u7ED3\u675F\u8FDB\u7A0B"),test:i(/(^|[;&|\n]\s*)(killall|pkill)\s/)},{id:"disk",label:t("\u5E95\u5C42\u78C1\u76D8\u64CD\u4F5C"),test:i(/(^|[;&|\n]\s*)(dd|mkfs\w*|diskutil|fdisk)\s/)}];function C(u){return au.find(s=>s.test(u))}l(C,"G"),o(C,"riskForBash");function b(u,s){const e=h(v(u)?p(u):p(s,u)),a=h(p(s)),n=M(a,e);return n===".."||n.startsWith(`..${q}`)||v(n)}l(b,"q"),o(b,"pathOutsideProject");function B(u,s){if(u.toolName.startsWith("mcp__")){const e=u.toolName.split("__")[1]||"unknown",a=JSON.stringify(u.input??{});return{ruleId:`mcp:${e}`,title:`${t("\u7B2C\u4E09\u65B9 MCP \u5DE5\u5177\u8C03\u7528\uFF08")}${e}${t("\uFF09")}`,detail:`${u.toolName} ${a.length>200?`${a.slice(0,200)}\u2026`:a}`}}if(u.toolName==="bash"){const e=String(u.input.command??""),a=C(e);return a?{ruleId:`bash:${a.id}`,title:a.label,detail:e}:void 0}if(u.toolName==="edit"||u.toolName==="write"){const e=String(u.input.path??u.input.file_path??"");if(e&&b(e,s))return{ruleId:`${u.toolName}:outside-project`,title:t("\u9879\u76EE\u76EE\u5F55\u4E4B\u5916\u7684\u6587\u4EF6\u6539\u52A8"),detail:e}}}l(B,"J"),o(B,"classify");async function _(u,s){if(u.toolName!=="bash")return;const e=String(u.input.command??""),a=await G(e,s);if(a)return{ruleId:`bash:jev-${a.suspicion.id}`,title:`${t("jev \u590D\u6838\u5224\u5B9A\u53EF\u7591")} (${Math.round(a.confidence*100)}%)`,detail:e}}l(_,"K"),o(_,"secondOpinion");const ou=o(()=>t("\u4EC5\u672C\u6B21\u5141\u8BB8"),"allowOnce"),iu=o(()=>t("\u672C\u6B21\u4F1A\u8BDD\u5185\u5141\u8BB8\uFF08\u540C\u7C7B\u64CD\u4F5C\uFF09"),"allowSession"),ru=o(()=>t("\u62D2\u7EDD"),"deny"),N=Symbol.for("dalcode.guard.state"),k=globalThis;k[N]??={mode:"default",sessionAllows:new Set};const d=k[N],F=d.sessionAllows;async function A(u,s,e,a,n,S=process.env,O){if(U(u,s))return{block:!0,reason:K()};if(d.mode==="yolo"||x(S))return;const r=B(u,s)??await _(u,s);if(!r||F.has(r.ruleId))return;if(!e||!a)return{block:!0,reason:`${t('dal-guard\uFF1A"')}${r.title}${t('"\u9700\u8981\u4EA4\u4E92\u5F0F\u5BA1\u6279\uFF08')}${r.detail}${t("\uFF09\u3002\u8BF7\u5728\u4EA4\u4E92\u6A21\u5F0F\u4E0B\u91CD\u8BD5\uFF0C\u6216\u7528 /guard yolo \u5173\u95ED\u5BA1\u6279\u95E8\u3002")}`};const m=n?W({session_id:n.sessionId,cwd:s,event:"PermissionRequest",status:"waiting_for_approval",pid:process.pid,tty:V(),tool:u.toolName,tool_input:{command:r.detail},tool_use_id:u.toolCallId,productName:"dal"}):void 0;O?.({type:"permission_prompt",message:`DAL needs your permission to use ${u.toolName}`});const D=new AbortController,[f,E,g]=[ou(),iu(),ru()],P=a.select(`${t("\u9700\u8981\u5BA1\u6279\uFF1A")}${r.title} \u2014 ${r.detail}`,[f,E,g],{signal:D.signal}).then(c=>({surface:"terminal",choice:c})),j=m?m.decision.then(c=>c===void 0?new Promise(()=>{}):{surface:"halo",choice:c==="allow"?f:g}):new Promise(()=>{}),$=await Promise.race([P,j]);$.surface==="halo"?D.abort():m?.cancel();const w=$.choice;if(w!==f){if(w===E){F.add(r.ruleId);return}return{block:!0,reason:`${t("dal-guard\uFF1A\u7528\u6237\u5DF2\u62D2\u7EDD\uFF08")}${r.title}${t("\uFF09\u3002")}`}}}l(A,"Q"),o(A,"evaluateToolCall");function I(u){u.on("tool_call",async(s,e)=>A(s,e.cwd,e.hasUI,e.ui,{sessionId:e.sessionManager.getSessionId()},process.env,a=>u.events.emit(J,a))),u.on("tool_result",async s=>{const e=Z(s.content);return e?{content:e}:void 0}),u.registerCommand("guard",{description:t("\u67E5\u770B\u6216\u5207\u6362 dal-guard \u5BA1\u6279\u95E8\uFF08default | yolo\uFF09"),handler:o(async(s,e)=>{const a=s.trim();(a==="yolo"||a==="default")&&(d.mode=a);const n=F.size?`${t(" \xB7 \u672C\u6B21\u4F1A\u8BDD\u5DF2\u5141\u8BB8\uFF1A")}${[...F].join(", ")}`:"";e.ui.notify(`${t("dal-guard \u6A21\u5F0F\uFF1A")}${d.mode}${n}`,d.mode==="yolo"?"warning":"info")},"handler")})}l(I,"X"),o(I,"default");export{Y as REDACTED,B as classify,Q as dalSecretValues,I as default,A as evaluateToolCall,X as namesDalCredential,b as pathOutsideProject,uu as redactContent,eu as redactDalSecrets,tu as reviewBashCommand,C as riskForBash,su as suspicionFor};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-lang",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
21
|
-
"@dalcode/dal-bridge": "1.0.
|
|
20
|
+
"@dalcode/dal-pi-kit": "1.0.25",
|
|
21
|
+
"@dalcode/dal-bridge": "1.0.25"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-lsp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
]
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@dalcode/dal-bridge": "1.0.
|
|
23
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
22
|
+
"@dalcode/dal-bridge": "1.0.25",
|
|
23
|
+
"@dalcode/dal-pi-kit": "1.0.25",
|
|
24
24
|
"cross-spawn": "7.0.6",
|
|
25
25
|
"typebox": "1.3.7"
|
|
26
26
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var y=Object.defineProperty;var
|
|
1
|
+
var y=Object.defineProperty;var m=(l,t)=>y(l,"name",{value:t,configurable:!0});var v=Object.defineProperty,u=m((l,t)=>v(l,"name",{value:t,configurable:!0}),"u");import{readFile as D}from"node:fs/promises";import{basename as x}from"node:path";import{pathToFileURL as d}from"node:url";import{withoutDalCodeCredentials as S}from"@earendil-works/pi-coding-agent";import P from"cross-spawn";const p=Buffer.from(`\r
|
|
2
2
|
\r
|
|
3
|
-
`),
|
|
3
|
+
`),L=3e4,q=12e4,k=5e3,w=3e4,b=600,M=16,T={textDocument:{synchronization:{dynamicRegistration:!1,didSave:!1},publishDiagnostics:{relatedInformation:!1,versionSupport:!0},documentSymbol:{hierarchicalDocumentSymbolSupport:!0},hover:{contentFormat:["markdown","plaintext"]},definition:{linkSupport:!0},references:{}},workspace:{configuration:!0,workspaceFolders:!0,symbol:{}}};class C{static{m(this,"O")}static{u(this,"LspClient")}rootPath;command;config;onUnexpectedDisconnect;child;nextId=1;buffer=Buffer.alloc(0);contentLength;pending=new Map;documentVersions=new Map;documentTexts=new Map;published=new Map;publishListeners=new Set;publishSeq=0;queryQueue=Promise.resolve();stderr="";initialized=!1;closing=!1;get root(){return this.rootPath}get running(){return this.initialized}constructor(t,e,s,i){this.rootPath=t,this.command=e,this.config=s,this.onUnexpectedDisconnect=i}async connect(){if(this.child)return;const t=P(this.command,this.config.args??[],{cwd:this.rootPath,env:{...S(process.env),...this.config.env},stdio:["pipe","pipe","pipe"]});this.child=t,t.unref();for(const e of[t.stdin,t.stdout,t.stderr])e.unref?.();t.stdin.on("error",()=>{}),t.stdout.on("data",e=>this.onStdout(e)),t.stderr.setEncoding("utf8"),t.stderr.on("data",e=>{this.stderr=`${this.stderr}${e}`.slice(-4e3)}),t.on("exit",(e,s)=>{this.child===t&&(this.child=void 0),this.initialized=!1,this.failAllPending(new Error(`Language server exited (code=${String(e)}, signal=${String(s)})${this.stderr?`: ${this.stderr.trim()}`:""}`)),this.closing||this.onUnexpectedDisconnect?.()}),t.on("error",e=>{this.child===t&&(this.child=void 0),this.initialized=!1,this.failAllPending(e),this.closing||this.onUnexpectedDisconnect?.()}),await this.request("initialize",{processId:process.pid,clientInfo:{name:"dal-lsp",version:"0.1.0"},rootUri:d(this.rootPath).href,capabilities:T,workspaceFolders:this.workspaceFolders()},q),this.notify("initialized",{}),this.initialized=!0}query(t,e,s,i,n){return this.enqueue(async()=>{const r={textDocument:{uri:await this.syncDocument(t,e,!1)},position:{line:i-1,character:n-1},...s==="references"?{context:{includeDeclaration:!0}}:{}};return this.request(`textDocument/${s}`,r)})}documentSymbols(t,e){return this.enqueue(async()=>{const s=await this.syncDocument(t,e,!1);return this.request("textDocument/documentSymbol",{textDocument:{uri:s}})})}workspaceSymbols(t,e){return this.enqueue(async()=>(e&&await this.syncDocument(e.filePath,e.languageId,!1),this.request("workspace/symbol",{query:t})))}diagnostics(t,e,s={}){return this.enqueue(async()=>{const i=s.timeoutMs??w,n=s.settleMs??b,r=Date.now()+i,o=this.published.get(d(t).href)?.diagnostics,h=await this.syncDocument(t,e,!0),a=this.documentVersions.get(h)??0;try{await this.request("$/dal/barrier",void 0,Math.max(1,r-Date.now()))}catch{}let c=this.publishSeq;const f=await this.waitForPublish(h,c,a,r-Date.now());for(;f;){c=this.published.get(h)?.seq??c;const g=r-Date.now();if(g<=0||!await this.waitForPublish(h,c,a,Math.min(n,g)))break}return{diagnostics:(f?this.published.get(h)?.diagnostics:o)??[],fresh:f}})}cachedDiagnostics(t){const e=d(t).href;return this.documentVersions.has(e)?this.published.get(e)?.diagnostics:void 0}enqueue(t){const e=this.queryQueue.then(async()=>{if(!this.initialized)throw new Error("Language server is not initialized");return t()});return this.queryQueue=e.then(()=>{},()=>{}),e}async syncDocument(t,e,s){const i=d(t).href,n=await D(t,"utf8"),r=this.documentVersions.get(i),o=(r??0)+1;if(r===void 0&&this.closeOldestDocuments(),r===void 0||s)r!==void 0&&this.notify("textDocument/didClose",{textDocument:{uri:i}}),this.notify("textDocument/didOpen",{textDocument:{uri:i,languageId:e,version:o,text:n}});else if(this.documentTexts.get(i)!==n)this.notify("textDocument/didChange",{textDocument:{uri:i,version:o},contentChanges:[{text:n}]});else return i;return this.documentVersions.delete(i),this.documentVersions.set(i,o),this.documentTexts.set(i,n),i}closeOldestDocuments(){for(const t of this.documentVersions.keys()){if(this.documentVersions.size<M)return;this.notify("textDocument/didClose",{textDocument:{uri:t}}),this.documentVersions.delete(t),this.documentTexts.delete(t),this.published.delete(t)}}waitForPublish(t,e,s,i){const n=u(()=>{const r=this.published.get(t);return!!(r&&r.seq>e&&(r.version===void 0||r.version>=s))},"isFresh");return n()?Promise.resolve(!0):i<=0||!this.child?Promise.resolve(!1):new Promise(r=>{const o=u(()=>{this.child?n()&&a(!0):a(!1)},"listener"),h=setTimeout(()=>a(!1),i),a=u(c=>{clearTimeout(h),this.publishListeners.delete(o),r(c)},"finish");this.publishListeners.add(o)})}workspaceFolders(){return[{uri:d(this.rootPath).href,name:x(this.rootPath)||this.rootPath}]}async shutdown(){const t=this.child;if(t){this.closing=!0,await this.queryQueue;try{this.initialized&&await this.request("shutdown",void 0,k)}catch{}this.notify("exit"),t.kill(),this.child=void 0,this.initialized=!1,this.failAllPending(new Error("Language server client shut down"))}}dispose(){this.closing=!0,this.child?.kill(),this.child=void 0,this.initialized=!1,this.failAllPending(new Error("Language server client disposed"))}failAllPending(t){for(const e of this.pending.values())e.reject(t);this.pending.clear();for(const e of[...this.publishListeners])e()}onStdout(t){for(this.buffer=Buffer.concat([this.buffer,t]);;){if(this.contentLength===void 0){const s=this.buffer.indexOf(p);if(s<0)return;const i=this.buffer.subarray(0,s).toString("ascii");this.buffer=this.buffer.subarray(s+p.length);const n=/^Content-Length:\s*(\d+)\s*$/im.exec(i);if(!n){this.failAllPending(new Error("Invalid LSP frame: missing Content-Length"));continue}this.contentLength=Number(n[1])}if(this.buffer.length<this.contentLength)return;const e=this.buffer.subarray(0,this.contentLength);this.buffer=this.buffer.subarray(this.contentLength),this.contentLength=void 0,this.handleMessage(e.toString("utf8"))}}handleMessage(t){let e;try{e=JSON.parse(t)}catch{return}if(e.id===void 0){e.method==="textDocument/publishDiagnostics"&&this.onPublishDiagnostics(e.params);return}if(typeof e.method=="string"){this.answerServerRequest(e.id,e.method,e.params);return}if(typeof e.id!="number")return;const s=this.pending.get(e.id);s&&(this.pending.delete(e.id),e.error?s.reject(new Error(e.error.message??`LSP error ${String(e.error.code)}`)):s.resolve(e.result))}answerServerRequest(t,e,s){let i;switch(e){case"workspace/configuration":{const n=s?.items;i=Array.isArray(n)?n.map(()=>null):[];break}case"workspace/workspaceFolders":i=this.workspaceFolders();break;case"client/registerCapability":case"client/unregisterCapability":case"window/workDoneProgress/create":i=null;break;default:this.writeMessage({jsonrpc:"2.0",id:t,error:{code:-32601,message:`Method not found: ${e}`}});return}this.writeMessage({jsonrpc:"2.0",id:t,result:i})}onPublishDiagnostics(t){if(!t||typeof t!="object")return;const{uri:e,version:s,diagnostics:i}=t;if(!(typeof e!="string"||!Array.isArray(i))){this.published.set(e,{seq:++this.publishSeq,...typeof s=="number"?{version:s}:{},diagnostics:i});for(const n of[...this.publishListeners])n()}}notify(t,e){this.writeMessage({jsonrpc:"2.0",method:t,...e===void 0?{}:{params:e}})}request(t,e,s=L){if(!this.child)return Promise.reject(new Error("Language server is not running"));const i=this.nextId++;return new Promise((n,r)=>{const o=setTimeout(()=>{this.pending.delete(i),r(new Error(`LSP request ${JSON.stringify(t)} timed out after ${s}ms`))},s);this.pending.set(i,{resolve:u(h=>{clearTimeout(o),n(h)},"resolve"),reject:u(h=>{clearTimeout(o),r(h)},"reject")}),this.writeMessage({jsonrpc:"2.0",id:i,method:t,...e===void 0?{}:{params:e}})})}writeMessage(t){const e=JSON.stringify(t);this.child?.stdin.write(`Content-Length: ${Buffer.byteLength(e,"utf8")}\r
|
|
4
4
|
\r
|
|
5
|
-
${e}`)}}export{b as DEFAULT_DIAGNOSTICS_SETTLE_MS,w as DEFAULT_DIAGNOSTICS_TIMEOUT_MS,
|
|
5
|
+
${e}`)}}export{b as DEFAULT_DIAGNOSTICS_SETTLE_MS,w as DEFAULT_DIAGNOSTICS_TIMEOUT_MS,C as LspClient};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
]
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@dalcode/dal-bridge": "1.0.
|
|
30
|
-
"@dalcode/dal-guard": "1.0.
|
|
31
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
32
|
-
"@dalcode/deepailab": "1.0.
|
|
29
|
+
"@dalcode/dal-bridge": "1.0.25",
|
|
30
|
+
"@dalcode/dal-guard": "1.0.25",
|
|
31
|
+
"@dalcode/dal-pi-kit": "1.0.25",
|
|
32
|
+
"@dalcode/deepailab": "1.0.25",
|
|
33
33
|
"cross-spawn": "7.0.6"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { McpConfigScope } from "./config-edit.js";
|
|
2
|
+
import type { McpServerConfig } from "./types.js";
|
|
3
|
+
export declare class UsageError extends Error {
|
|
4
|
+
}
|
|
5
|
+
export declare const ADD_USAGE: string;
|
|
6
|
+
export declare const REMOVE_USAGE: string;
|
|
7
|
+
export interface McpAddSpec {
|
|
8
|
+
name: string;
|
|
9
|
+
scope: McpConfigScope;
|
|
10
|
+
config: McpServerConfig;
|
|
11
|
+
}
|
|
12
|
+
export interface McpRemoveSpec {
|
|
13
|
+
name: string;
|
|
14
|
+
scope?: McpConfigScope;
|
|
15
|
+
}
|
|
16
|
+
export declare function tokenizeCommandArgs(input: string): string[];
|
|
17
|
+
export declare function assertValidName(name: string): void;
|
|
18
|
+
export declare function parseAddArgs(tokens: string[]): McpAddSpec;
|
|
19
|
+
export declare function parseRemoveArgs(tokens: string[]): McpRemoveSpec;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { McpServerConfig } from "./types.js";
|
|
2
|
+
export type McpConfigScope = "user" | "project";
|
|
3
|
+
export declare function mcpConfigPath(scope: McpConfigScope, cwd: string): string;
|
|
4
|
+
export declare function addMcpServerEntry(scope: McpConfigScope, cwd: string, name: string, config: McpServerConfig): {
|
|
5
|
+
path: string;
|
|
6
|
+
created: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function addMcpServerEntries(scope: McpConfigScope, cwd: string, entries: Array<{
|
|
9
|
+
name: string;
|
|
10
|
+
config: McpServerConfig;
|
|
11
|
+
}>): {
|
|
12
|
+
path: string;
|
|
13
|
+
added: string[];
|
|
14
|
+
existing: string[];
|
|
15
|
+
};
|
|
16
|
+
export declare function removeMcpServerEntry(scope: McpConfigScope, cwd: string, name: string): {
|
|
17
|
+
path: string;
|
|
18
|
+
removed: boolean;
|
|
19
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { McpServerConfig } from "./types.js";
|
|
2
|
+
export interface LoadMcpServerConfigsOptions {
|
|
3
|
+
includeDefaults?: boolean;
|
|
4
|
+
projectTrusted?: boolean;
|
|
5
|
+
accountServers?: Record<string, McpServerConfig>;
|
|
6
|
+
}
|
|
7
|
+
export declare const DEFAULT_MCP_SERVERS: Record<string, McpServerConfig>;
|
|
8
|
+
export declare function takeMcpConfigProblems(): string[];
|
|
9
|
+
export declare function loadMcpServerConfigs(cwd: string, opts?: LoadMcpServerConfigsOptions): Record<string, McpServerConfig>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { McpClient, McpHttpServerConfig, McpTool, McpToolCallResult } from "./types.js";
|
|
2
|
+
export declare class McpHttpClient implements McpClient {
|
|
3
|
+
private readonly config;
|
|
4
|
+
private readonly timeoutMs;
|
|
5
|
+
private nextId;
|
|
6
|
+
private sessionId?;
|
|
7
|
+
private connected;
|
|
8
|
+
constructor(config: McpHttpServerConfig, timeoutMs?: number);
|
|
9
|
+
connect(): Promise<void>;
|
|
10
|
+
listTools(): Promise<McpTool[]>;
|
|
11
|
+
callTool(name: string, args: Record<string, unknown>): Promise<McpToolCallResult>;
|
|
12
|
+
disconnect(): void;
|
|
13
|
+
private notify;
|
|
14
|
+
private request;
|
|
15
|
+
private post;
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { McpClient, McpStdioServerConfig, McpTool, McpToolCallResult } from "./types.js";
|
|
2
|
+
export type { McpStdioServerConfig, McpTool, McpToolCallResult } from "./types.js";
|
|
3
|
+
export declare class McpStdioClient implements McpClient {
|
|
4
|
+
private child?;
|
|
5
|
+
private nextId;
|
|
6
|
+
private buffer;
|
|
7
|
+
private readonly pending;
|
|
8
|
+
private readonly config;
|
|
9
|
+
private readonly timeoutMs;
|
|
10
|
+
private readonly onUnexpectedDisconnect?;
|
|
11
|
+
private intentionalDisconnect;
|
|
12
|
+
constructor(config: McpStdioServerConfig, timeoutMs?: number, onUnexpectedDisconnect?: () => void);
|
|
13
|
+
connect(): Promise<void>;
|
|
14
|
+
listTools(): Promise<McpTool[]>;
|
|
15
|
+
callTool(name: string, args: Record<string, unknown>): Promise<McpToolCallResult>;
|
|
16
|
+
disconnect(): void;
|
|
17
|
+
private failAllPending;
|
|
18
|
+
private onStdout;
|
|
19
|
+
private handleLine;
|
|
20
|
+
private notify;
|
|
21
|
+
private request;
|
|
22
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var h=Object.defineProperty;var r=(n,e)=>h(n,"name",{value:e,configurable:!0});var f=Object.defineProperty,c=r((n,e)=>f(n,"name",{value:e,configurable:!0}),"n");import u from"cross-spawn";const
|
|
1
|
+
var h=Object.defineProperty;var r=(n,e)=>h(n,"name",{value:e,configurable:!0});var f=Object.defineProperty,c=r((n,e)=>f(n,"name",{value:e,configurable:!0}),"n");import{withoutDalCodeCredentials as u}from"@earendil-works/pi-coding-agent";import p from"cross-spawn";const m=3e4,g="2024-11-05";class w{static{r(this,"w")}static{c(this,"McpStdioClient")}child;nextId=1;buffer="";pending=new Map;config;timeoutMs;onUnexpectedDisconnect;intentionalDisconnect=!1;constructor(e,t=m,i){this.config=e,this.timeoutMs=t,this.onUnexpectedDisconnect=i}async connect(){const e=p(this.config.command,this.config.args??[],{cwd:this.config.cwd,env:{...u(process.env),...this.config.env},stdio:["pipe","pipe","pipe"]});this.child=e,e.unref();for(const t of[e.stdin,e.stdout,e.stderr])t.unref?.();e.stdout.setEncoding("utf8"),e.stdout.on("data",t=>this.onStdout(t)),e.on("exit",()=>{this.failAllPending(new Error("MCP server process exited")),this.intentionalDisconnect||this.onUnexpectedDisconnect?.()}),e.on("error",t=>{this.failAllPending(t instanceof Error?t:new Error(String(t))),this.intentionalDisconnect||this.onUnexpectedDisconnect?.()}),await this.request("initialize",{protocolVersion:g,capabilities:{},clientInfo:{name:"dal",version:"0.1.0"}}),this.notify("notifications/initialized")}async listTools(){return(await this.request("tools/list")).tools??[]}async callTool(e,t){const i=await this.request("tools/call",{name:e,arguments:t});return{content:i.content??[],isError:i.isError}}disconnect(){this.intentionalDisconnect=!0,this.failAllPending(new Error("MCP client disconnected")),this.child?.kill()}failAllPending(e){for(const t of this.pending.values())t.reject(e);this.pending.clear()}onStdout(e){this.buffer+=e;let t=this.buffer.indexOf(`
|
|
2
2
|
`);for(;t>=0;){const i=this.buffer.slice(0,t).trim();this.buffer=this.buffer.slice(t+1),t=this.buffer.indexOf(`
|
|
3
3
|
`),i&&this.handleLine(i)}}handleLine(e){let t;try{t=JSON.parse(e)}catch{return}if(typeof t.id!="number")return;const i=this.pending.get(t.id);i&&(this.pending.delete(t.id),t.error?i.reject(new Error(t.error.message)):i.resolve(t.result))}notify(e,t){this.child?.stdin.write(`${JSON.stringify({jsonrpc:"2.0",method:e,params:t})}
|
|
4
4
|
`)}request(e,t){const i=this.child;if(!i)return Promise.reject(new Error("MCP client not connected"));const s=this.nextId++;return new Promise((a,l)=>{const d=setTimeout(()=>{this.pending.delete(s),l(new Error(`MCP request "${e}" timed out after ${this.timeoutMs}ms`))},this.timeoutMs);this.pending.set(s,{resolve:c(o=>{clearTimeout(d),a(o)},"resolve"),reject:c(o=>{clearTimeout(d),l(o)},"reject")}),i.stdin.write(`${JSON.stringify({jsonrpc:"2.0",id:s,method:e,params:t})}
|
|
5
|
-
`)})}}export{
|
|
5
|
+
`)})}}export{w as McpStdioClient};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface McpTool {
|
|
2
|
+
name: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
inputSchema?: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
export interface McpToolCallResult {
|
|
7
|
+
content: Array<{
|
|
8
|
+
type: string;
|
|
9
|
+
text?: string;
|
|
10
|
+
}>;
|
|
11
|
+
isError?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface McpClient {
|
|
14
|
+
connect(): Promise<void>;
|
|
15
|
+
listTools(): Promise<McpTool[]>;
|
|
16
|
+
callTool(name: string, args: Record<string, unknown>): Promise<McpToolCallResult>;
|
|
17
|
+
disconnect(): void;
|
|
18
|
+
}
|
|
19
|
+
export interface McpStdioServerConfig {
|
|
20
|
+
command: string;
|
|
21
|
+
args?: string[];
|
|
22
|
+
env?: Record<string, string>;
|
|
23
|
+
cwd?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface McpHttpServerConfig {
|
|
26
|
+
url: string;
|
|
27
|
+
headers?: Record<string, string>;
|
|
28
|
+
}
|
|
29
|
+
export type McpServerConfig = McpStdioServerConfig | McpHttpServerConfig;
|
|
30
|
+
export declare function isHttpMcpConfig(config: McpServerConfig): config is McpHttpServerConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-office",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
20
|
+
"@dalcode/dal-pi-kit": "1.0.25",
|
|
21
21
|
"docx": "9.7.1",
|
|
22
22
|
"echarts": "6.1.0",
|
|
23
23
|
"exceljs": "4.4.0",
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
var g=Object.defineProperty;var s=(e,r)=>g(e,"name",{value:r,configurable:!0});var d=Object.defineProperty,h=s((e,r)=>d(e,"name",{value:r,configurable:!0}),"c");function p(e){const r=e.split(/\r?\n/,1)[0]??"",a=(r.match(/\t/g)??[]).length,t=(r.match(/,/g)??[]).length;return a>t?" ":","}s(p,"m"),h(p,"detectDelimiter");function u(e,r){const a=[];let t=[],n="",l=!1;const m=h(()=>{t.push(n),n=""},"pushField"),c=h(()=>{m(),a.push(t),t=[]},"pushRow");for(let o=0;o<e.length;o++){const i=e[o];if(l){i==='"'?e[o+1]==='"'?(n+='"',o++):l=!1:n+=i;continue}i==='"'?l=!0:i===r?m():i===`
|
|
2
|
-
`?c():i==="\r"||(n+=i)}return(n.length>0||t.length>0)&&c(),a.filter(o=>o.some(i=>i.trim().length>0))}s(u,"u"),h(u,"parseDelimited");function f(e){const r=Math.max(...e.map(t=>t.length)),a=[];for(let t=0;t<r;t++){let n=0;for(const l of e)n=Math.max(n,(l[t]??"").length);a.push(Math.min(Math.max(n,4),28))}return e.map(t=>t.map((n,l)=>(n??"").slice(0,28).padEnd(a[l])).join(" ").trimEnd()).join(`
|
|
2
|
+
`?c():i==="\r"||(n+=i)}return(n.length>0||t.length>0)&&c(),a.filter(o=>o.some(i=>i.trim().length>0))}s(u,"u"),h(u,"parseDelimited");function f(e){const r=Math.max(...e.map(t=>t.length)),a=[];for(let t=0;t<r;t++){let n=0;for(const l of e)n=Math.max(n,(l[t]??"").length);a.push(Math.min(Math.max(n,4),28))}return e.map(t=>t.map((n,l)=>(n??"").slice(0,28).padEnd(a[l]??4)).join(" ").trimEnd()).join(`
|
|
3
3
|
`)}s(f,"p"),h(f,"formatAligned");export{p as detectDelimiter,f as formatAligned,u as parseDelimited};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var w=Object.defineProperty;var s=(n,t)=>w(n,"name",{value:t,configurable:!0});var y=Object.defineProperty,a=s((n,t)=>y(n,"name",{value:t,configurable:!0}),"o");import f from"jszip";const E={"&":"&","<":"<",">":">",""":'"',"'":"'"};function p(n){return n.replace(/&#x([0-9a-fA-F]+);/g,(t,e)=>String.fromCodePoint(Number.parseInt(e,16))).replace(/&#(\d+);/g,(t,e)=>String.fromCodePoint(Number.parseInt(e,10))).replace(/&(amp|lt|gt|quot|apos);/g,t=>E[t]??t)}s(p,"f"),a(p,"decodeXmlEntities");function x(n,t){const e=new RegExp(`<${t}(?:\\s[^>]*)?>([\\s\\S]*?)</${t}>`,"g"),o=[];for(const r of n.matchAll(e))o.push({text:p(r[1]),index:r.index??0});return o}s(x,"p"),a(x,"collectRuns");function u(n){const t=n.split(/<\/w:p>/),e=[];for(const o of t){const r=x(o,"w:t");if(r.length===0)continue;const i=r.map(c=>c.text).join("").trim();i.length>0&&e.push(i)}return e.join(`
|
|
1
|
+
var w=Object.defineProperty;var s=(n,t)=>w(n,"name",{value:t,configurable:!0});var y=Object.defineProperty,a=s((n,t)=>y(n,"name",{value:t,configurable:!0}),"o");import f from"jszip";const E={"&":"&","<":"<",">":">",""":'"',"'":"'"};function p(n){return n.replace(/&#x([0-9a-fA-F]+);/g,(t,e)=>String.fromCodePoint(Number.parseInt(e,16))).replace(/&#(\d+);/g,(t,e)=>String.fromCodePoint(Number.parseInt(e,10))).replace(/&(amp|lt|gt|quot|apos);/g,t=>E[t]??t)}s(p,"f"),a(p,"decodeXmlEntities");function x(n,t){const e=new RegExp(`<${t}(?:\\s[^>]*)?>([\\s\\S]*?)</${t}>`,"g"),o=[];for(const r of n.matchAll(e))o.push({text:p(r[1]??""),index:r.index??0});return o}s(x,"p"),a(x,"collectRuns");function u(n){const t=n.split(/<\/w:p>/),e=[];for(const o of t){const r=x(o,"w:t");if(r.length===0)continue;const i=r.map(c=>c.text).join("").trim();i.length>0&&e.push(i)}return e.join(`
|
|
2
2
|
`)}s(u,"m"),a(u,"extractDocxText");function d(n){return x(n,"a:t").map(t=>t.text.trim()).filter(t=>t.length>0)}s(d,"d"),a(d,"extractSlideTexts");async function l(n,t){const e=n.file(t);return e?e.async("string"):void 0}s(l,"l"),a(l,"zipEntryText");async function m(n){const t=await f.loadAsync(n),e=await l(t,"word/document.xml");if(e===void 0)throw new Error("invalid docx: missing word/document.xml");const o=u(e),r=o.split(`
|
|
3
3
|
`).filter(i=>i.length>0).length;return{text:o,meta:`${r} paragraphs`}}s(m,"E"),a(m,"extractDocx");async function g(n){const t=await f.loadAsync(n),e=Object.keys(t.files).filter(r=>/^ppt\/slides\/slide\d+\.xml$/.test(r)).sort((r,i)=>{const c=Number.parseInt(r.replace(/\D+/g,""),10),h=Number.parseInt(i.replace(/\D+/g,""),10);return c-h});if(e.length===0)throw new Error("invalid pptx: no slides found");const o=[];for(const[r,i]of e.entries()){const c=await l(t,i);c&&(o.push(`--- Page ${r+1} ---`),o.push(...d(c)))}return{text:o.join(`
|
|
4
4
|
`),meta:`${e.length} slides`}}s(g,"y"),a(g,"extractPptx");export{p as decodeXmlEntities,m as extractDocx,u as extractDocxText,g as extractPptx,d as extractSlideTexts,l as zipEntryText};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
export { default as ExcelJS } from "exceljs";
|
|
3
|
+
export { default as JSZip } from "jszip";
|
|
4
|
+
export { detectDelimiter, parseDelimited } from "./extract/csv.js";
|
|
5
|
+
export { sanitizeFilename } from "./paths.js";
|
|
6
|
+
export { type DocOutputInput, type DocSectionInput, type DocTableInput, renderDocx } from "./render/docx.js";
|
|
7
|
+
export { layoutSlides, renderPptx, type ShapeSpec, type SlideElement, type TextSpec, themeThumbnailSvg, } from "./render/pptx.js";
|
|
8
|
+
export { THUMBNAIL_CHANNEL, type ThumbnailRequest, thumbnailSvg } from "./render/thumbnails.js";
|
|
9
|
+
export { renderXlsx, type SheetOutputInput, type SheetTableInput } from "./render/xlsx.js";
|
|
10
|
+
export { type ThemeName, themePalettes } from "./themes.js";
|
|
11
|
+
export default function officeExtension(pi: ExtensionAPI): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var o=Object.defineProperty;var a=(e,t)=>o(e,"name",{value:t,configurable:!0});var m=Object.defineProperty,n=a((e,t)=>m(e,"name",{value:t,configurable:!0}),"n");import{THUMBNAIL_CHANNEL as f,thumbnailSvg as p}from"./render/thumbnails.js";import{clearPresentationPlan as l}from"./scratchpad.js";import{registerChartGenerate as d}from"./tools/chart-generate.js";import{registerDocGenerate as g}from"./tools/doc-generate.js";import{registerDocxEdit as c}from"./tools/docx-edit.js";import{registerDrawioGenerate as u}from"./tools/drawio-generate.js";import{registerMdGenerate as h}from"./tools/md-generate.js";import{registerPptGenerate as x}from"./tools/ppt-generate.js";import{registerPptPlan as S}from"./tools/ppt-plan.js";import{registerPptxEdit as P}from"./tools/pptx-edit.js";import{registerReadFile as v}from"./tools/read-file.js";import{registerSheetGenerate as y}from"./tools/sheet-generate.js";import{registerXlsxEdit as D}from"./tools/xlsx-edit.js";import{default as E}from"exceljs";import{default as N}from"jszip";import{detectDelimiter as b,parseDelimited as A}from"./extract/csv.js";import{sanitizeFilename as G}from"./paths.js";import{renderDocx as H}from"./render/docx.js";import{layoutSlides as L,renderPptx as M,themeThumbnailSvg as T}from"./render/pptx.js";import{THUMBNAIL_CHANNEL as C,thumbnailSvg as F}from"./render/thumbnails.js";import{renderXlsx as I}from"./render/xlsx.js";import{themePalettes as U}from"./themes.js";function i(e){S(e),x(e),g(e),h(e),y(e),d(e),u(e),v(e),c(e),P(e),D(e),e.events.on(f,t=>{const r=t;if(typeof r.ref!="string"||typeof r.reply!="function")return;const s=p(r.ref,r.title);s!==void 0&&r.reply(s)}),e.on("session_shutdown",async(t,r)=>{l(r.sessionManager.getSessionId())})}a(i,"E"),n(i,"officeExtension");export{E as ExcelJS,N as JSZip,C as THUMBNAIL_CHANNEL,i as default,b as detectDelimiter,L as layoutSlides,A as parseDelimited,H as renderDocx,M as renderPptx,I as renderXlsx,G as sanitizeFilename,U as themePalettes,T as themeThumbnailSvg,F as thumbnailSvg};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var c=Object.defineProperty;var r=(t,e)=>c(t,"name",{value:e,configurable:!0});var h=Object.defineProperty,n=r((t,e)=>h(t,"name",{value:e,configurable:!0}),"r");import*as m from"echarts";const d=960,g=600;function i(t,e){return t.map((a,u)=>({name:a,value:e[u]}))}r(i,"a"),n(i,"nameValueData");function l(t){const e=t.seriesName??"",a={title:{text:t.title,left:"center"},animation:!1};switch(t.chartType){case"pie":return{...a,tooltip:{trigger:"item"},legend:{bottom:0},series:[{type:"pie",radius:"62%",name:e,data:i(t.labels,t.values)}]};case"funnel":return{...a,tooltip:{trigger:"item"},series:[{type:"funnel",name:e,data:i(t.labels,t.values)}]};case"gauge":return{...a,series:[{type:"gauge",data:[{value:t.values[0],name:e||t.labels[0]||""}]}]};default:return{...a,tooltip:{trigger:"axis"},xAxis:{type:"category",data:t.labels},yAxis:{type:"value"},series:[{type:t.chartType,name:e,data:t.values,smooth:t.chartType==="line",symbolSize:t.chartType==="scatter"?12:void 0}]}}}r(l,"m"),n(l,"buildChartOption");function s(t){const e=m.init(null,null,{ssr:!0,renderer:"svg",width:d,height:g});try{return e.setOption(t),e.renderToSVGString()}finally{e.dispose()}}r(s,"p"),n(s,"renderChartSvg");function o(t,e){return["<!DOCTYPE html>",'<html lang="zh-CN">',"<head>",'<meta charset="utf-8">',`<title>${e}</title>`,"<style>body{margin:0;display:flex;align-items:center;justify-content:center;min-height:100vh;background:#f8fafc;}","svg{max-width:96vw;height:auto;}</style>","</head>","<body>",t,"</body>","</html>"].join(`
|
|
1
|
+
var c=Object.defineProperty;var r=(t,e)=>c(t,"name",{value:e,configurable:!0});var h=Object.defineProperty,n=r((t,e)=>h(t,"name",{value:e,configurable:!0}),"r");import*as m from"echarts";const d=960,g=600;function i(t,e){return t.map((a,u)=>({name:a,value:e[u]??0}))}r(i,"a"),n(i,"nameValueData");function l(t){const e=t.seriesName??"",a={title:{text:t.title,left:"center"},animation:!1};switch(t.chartType){case"pie":return{...a,tooltip:{trigger:"item"},legend:{bottom:0},series:[{type:"pie",radius:"62%",name:e,data:i(t.labels,t.values)}]};case"funnel":return{...a,tooltip:{trigger:"item"},series:[{type:"funnel",name:e,data:i(t.labels,t.values)}]};case"gauge":return{...a,series:[{type:"gauge",data:[{value:t.values[0],name:e||t.labels[0]||""}]}]};default:return{...a,tooltip:{trigger:"axis"},xAxis:{type:"category",data:t.labels},yAxis:{type:"value"},series:[{type:t.chartType,name:e,data:t.values,smooth:t.chartType==="line",symbolSize:t.chartType==="scatter"?12:void 0}]}}}r(l,"m"),n(l,"buildChartOption");function s(t){const e=m.init(null,null,{ssr:!0,renderer:"svg",width:d,height:g});try{return e.setOption(t),e.renderToSVGString()}finally{e.dispose()}}r(s,"p"),n(s,"renderChartSvg");function o(t,e){return["<!DOCTYPE html>",'<html lang="zh-CN">',"<head>",'<meta charset="utf-8">',`<title>${e}</title>`,"<style>body{margin:0;display:flex;align-items:center;justify-content:center;min-height:100vh;background:#f8fafc;}","svg{max-width:96vw;height:auto;}</style>","</head>","<body>",t,"</body>","</html>"].join(`
|
|
2
2
|
`)}r(o,"y"),n(o,"chartHtml");export{l as buildChartOption,o as chartHtml,s as renderChartSvg};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TextRun } from "docx";
|
|
2
|
+
export interface DocTableInput {
|
|
3
|
+
headers: string[];
|
|
4
|
+
rows: string[][];
|
|
5
|
+
}
|
|
6
|
+
export interface DocSectionInput {
|
|
7
|
+
heading: string;
|
|
8
|
+
headingLevel?: number;
|
|
9
|
+
paragraphs?: string[];
|
|
10
|
+
bullets?: string[];
|
|
11
|
+
table?: DocTableInput;
|
|
12
|
+
}
|
|
13
|
+
export interface DocOutputInput {
|
|
14
|
+
title: string;
|
|
15
|
+
sections: DocSectionInput[];
|
|
16
|
+
summary?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function parseInlineRuns(text: string, size: number): TextRun[];
|
|
19
|
+
export declare function renderDocx(doc: DocOutputInput): Promise<Buffer>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { OfficePresentationPlan } from "../scratchpad.js";
|
|
2
|
+
import { type ThemeName } from "../themes.js";
|
|
3
|
+
export type PptxTextRun = {
|
|
4
|
+
text: string;
|
|
5
|
+
options?: Record<string, unknown>;
|
|
6
|
+
};
|
|
7
|
+
export interface ShapeSpec {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
w: number;
|
|
11
|
+
h: number;
|
|
12
|
+
fill: string;
|
|
13
|
+
shape: "rect" | "roundRect" | "ellipse" | "line";
|
|
14
|
+
transparency?: number;
|
|
15
|
+
rectRadius?: number;
|
|
16
|
+
lineWidth?: number;
|
|
17
|
+
shadowOpacity?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface TextSpec {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
w: number;
|
|
23
|
+
h: number;
|
|
24
|
+
content: string | PptxTextRun[];
|
|
25
|
+
fontSize: number;
|
|
26
|
+
color?: string;
|
|
27
|
+
bold?: boolean;
|
|
28
|
+
align?: "left" | "center" | "right";
|
|
29
|
+
valign?: "top" | "middle" | "bottom";
|
|
30
|
+
transparency?: number;
|
|
31
|
+
charSpacing?: number;
|
|
32
|
+
lineSpacingMultiple?: number;
|
|
33
|
+
}
|
|
34
|
+
export type SlideElement = ShapeSpec | TextSpec;
|
|
35
|
+
export declare function isText(element: SlideElement): element is TextSpec;
|
|
36
|
+
export declare function layoutSlides(plan: OfficePresentationPlan, theme: ThemeName): SlideElement[][];
|
|
37
|
+
export declare function renderPptx(plan: OfficePresentationPlan, theme: ThemeName): Promise<Buffer>;
|
|
38
|
+
export declare const MAX_THUMBNAIL_SVG_BYTES: number;
|
|
39
|
+
export declare function slideElementsSvg(elements: SlideElement[]): string;
|
|
40
|
+
export declare function themeThumbnailSvg(theme: ThemeName, title: string, subtitle?: string): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`))}),await
|
|
1
|
+
var C=Object.defineProperty;var a=(e,t)=>C(e,"name",{value:t,configurable:!0});var G=Object.defineProperty,c=a((e,t)=>G(e,"name",{value:t,configurable:!0}),"a");import*as M from"pptxgenjs";import{themePalettes as I}from"../themes.js";const T=M.default??M,V=T.default??T,g=13.33,b=7.5,X="Microsoft YaHei",D="[\u5F85\u586B\u5199]";function J(e){return e}a(J,"q"),c(J,"text");function K(e){return e}a(K,"D"),c(K,"shape");function x(e){return"content"in e}a(x,"T"),c(x,"isText");function y(e){return String(e).padStart(2,"0")}a(y,"m"),c(y,"marker");function d(e){return e?.trim()||void 0}a(d,"h"),c(d,"filled");function E(e,t){const o=d(e.subtitle);return[{x:0,y:0,w:g,h:b,fill:t.bg,shape:"rect"},{x:8.1,y:-2.1,w:7.2,h:7.2,fill:t.accent,shape:"ellipse",transparency:84},{x:10.4,y:-1.2,w:4.4,h:4.4,fill:t.primary,shape:"ellipse",transparency:88},{x:11.35,y:1.15,w:.5,h:.5,fill:t.primary,shape:"ellipse"},{x:.92,y:2.14,w:.42,h:.065,fill:t.primary,shape:"rect"},{x:.9,y:2.52,w:11.6,h:1.15,content:e.title,fontSize:46,color:t.dark,bold:!0},{x:.95,y:3.98,w:2.1,h:0,fill:t.accent,shape:"line",lineWidth:2.25},...o?[{x:.9,y:4.22,w:10.2,h:.55,content:o,fontSize:20,color:t.muted}]:[],{x:9.9,y:6.82,w:2.55,h:.3,content:"\xB7 \xB7 \xB7 \xB7",fontSize:12,color:t.accent,align:"right",charSpacing:2}]}a(E,"j"),c(E,"titleSlideElements");function k(e,t,o){const n=d(e.subtitle);return[{x:0,y:0,w:g,h:b,fill:t.primary,shape:"rect"},{x:8.9,y:-1.6,w:5.6,h:5.6,fill:t.accent,shape:"ellipse",transparency:74},{x:7.6,y:2.15,w:4.9,h:2.6,content:y(o),fontSize:120,color:t.bg,bold:!0,align:"right",transparency:72},{x:1,y:2.98,w:.6,h:.07,fill:t.bg,shape:"rect",transparency:30},{x:.98,y:3.22,w:8.2,h:1,content:e.title,fontSize:40,color:t.bg,bold:!0},...n?[{x:1.02,y:4.42,w:9,h:.5,content:n,fontSize:18,color:t.bg,transparency:22}]:[]]}a(k,"G"),c(k,"sectionSlideElements");function w(e,t,o,n=1){return e.flatMap((h,r)=>[{text:`${y(n+r)} `,options:{color:t.primary,bold:!0}},{text:h,options:{color:t.body,breakLine:!0,paraSpaceAfter:o}}])}a(w,"S"),c(w,"numberedPoints");function B(e,t,o,n,h){const r=[{x:0,y:0,w:g,h:b,fill:t.bg,shape:"rect"},{x:.75,y:.7,w:11.83,h:6.1,fill:t.card,shape:"roundRect",rectRadius:.13,shadowOpacity:t.shadowOpacity},{x:1.16,y:1,w:8.5,h:.3,content:o,fontSize:11,color:t.muted,charSpacing:1.5},{x:10.2,y:1,w:2,h:.3,content:`${y(n+1)} / ${y(h)}`,fontSize:11,color:t.muted,align:"right"},{x:1.13,y:1.36,w:11,h:.78,content:e.title,fontSize:30,color:t.dark,bold:!0},{x:1.16,y:2.26,w:.85,h:.055,fill:t.primary,shape:"rect"}],l=(e.points??[]).map(p=>p.trim()).filter(p=>p.length>0).slice(0,8);if(l.length===0)r.push({x:1.2,y:2.62,w:10.9,h:.6,content:D,fontSize:18.5,color:t.muted});else if(e.layout==="two-column"||l.length>4){const p=Math.ceil(l.length/2);r.push({x:6.6,y:2.78,w:0,h:3.1,fill:t.line,shape:"line",lineWidth:1},{x:1.2,y:2.72,w:5.05,h:3.4,content:w(l.slice(0,p),t,10),fontSize:16.5,valign:"top",lineSpacingMultiple:1.16},{x:6.95,y:2.72,w:5.15,h:3.4,content:w(l.slice(p),t,10,p+1),fontSize:16.5,valign:"top",lineSpacingMultiple:1.16})}else r.push({x:1.2,y:2.62,w:10.9,h:3.6,content:w(l,t,15),fontSize:18.5,valign:"top",lineSpacingMultiple:1.22});const u=d(e.subtitle);return u&&r.push({x:1.2,y:6.28,w:.055,h:.32,fill:t.primary,shape:"rect"},{x:1.38,y:6.24,w:10.6,h:.4,content:u,fontSize:12.5,color:t.muted,valign:"middle"}),r}a(B,"L"),c(B,"contentSlideElements");function j(e,t){return t===0||e.layout==="title"}a(j,"C"),c(j,"isTitleSlide");function m(e,t){const o=I(t),n=e.slides.length,h=new Map;let r=0;return e.slides.forEach((l,u)=>{l.layout==="section"&&(r+=1,h.set(u,r))}),e.slides.map((l,u)=>{const p=o[u%o.length];return j(l,u)?E(l,p):l.layout==="section"?k(l,p,h.get(u)??r):B(l,p,e.title,u,n)})}a(m,"v"),c(m,"layoutSlides");async function R(e,t){const o=new V;o.defineLayout({name:"W16x9",width:13.333,height:7.5}),o.layout="W16x9",o.title=e.title,o.subject="",o.author="",o.company="";const n=m(e,t);return e.slides.forEach((h,r)=>{const l=o.addSlide(),u=n[r];for(const i of u)if(x(i))l.addText(i.content,{x:i.x,y:i.y,w:i.w,h:i.h,fontSize:i.fontSize,fontFace:X,...i.color!==void 0?{color:i.color}:{},bold:i.bold??!1,align:i.align??"left",valign:i.valign??"top",margin:0,...i.transparency!==void 0?{transparency:i.transparency}:{},...i.charSpacing!==void 0?{charSpacing:i.charSpacing}:{},...i.lineSpacingMultiple!==void 0?{lineSpacingMultiple:i.lineSpacingMultiple}:{}});else{const f={x:i.x,y:i.y,w:i.w,h:i.h,fill:{color:i.fill,...i.transparency!==void 0?{transparency:i.transparency}:{}}};i.shape==="line"&&(f.line={color:i.fill,width:i.lineWidth??1}),i.rectRadius!==void 0&&(f.rectRadius=i.rectRadius),i.shadowOpacity!==void 0&&(f.shadow={type:"outer",angle:90,blur:14,offset:4,color:"0F172A",opacity:i.shadowOpacity}),l.addShape(i.shape,f)}const p=[d(h.goal),d(h.visual)].filter(i=>i!==void 0);p.length>0&&l.addNotes(p.join(`
|
|
2
|
+
`))}),await o.write({outputType:"nodebuffer"})}a(R,"V"),c(R,"renderPptx");const v=320,W=180,Q=20*1024;function P(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}a(P,"Y"),c(P,"escapeXml");function s(e){return String(Math.round(e*100)/100)}a(s,"c"),c(s,"svgNumber");function z(e,t){let o=0;for(const n of e)o+=/[\u2E80-\u9FFF\uF900-\uFAFF\uFF00-\uFFEF]/u.test(n)?t:t*.56;return o}a(z,"z"),c(z,"estimateTextWidth");function A(e,t,o){if(z(e,t)<=o)return e;const n=[...e];for(;n.length>0&&z(`${n.join("")}\u2026`,t)>o;)n.pop();return`${n.join("")}\u2026`}a(A,"I"),c(A,"fitText");function S(e,t){return e===void 0?"":` ${t}="${s(1-e/100)}"`}a(S,"b"),c(S,"opacityAttr");function F(e){const t=v/g,o=[];for(const n of e){const h=n.x*t,r=n.y*t,l=n.w*t,u=n.h*t;if(x(n)){const i=(typeof n.content=="string"?n.content:n.content.map(q=>q.text).join("")).replace(/\s+/g," ").trim();if(i.length===0)continue;const f=n.fontSize/72*t,H=A(i,f,Math.max(l,f)),$=n.align==="right"?"end":n.align==="center"?"middle":"start",L=$==="end"?h+l:$==="middle"?h+l/2:h,N=n.valign==="middle"?r+u/2+f*.35:r+f*.9,Y=typeof n.content=="string"?void 0:n.content[0]?.options?.color,_=n.color??Y??"333333";o.push(`<text x="${s(L)}" y="${s(N)}" font-size="${s(f)}" fill="#${_}"${n.bold?' font-weight="700"':""} text-anchor="${$}"${S(n.transparency,"fill-opacity")}>${P(H)}</text>`);continue}const p=`#${n.fill}`;switch(n.shape){case"ellipse":o.push(`<ellipse cx="${s(h+l/2)}" cy="${s(r+u/2)}" rx="${s(l/2)}" ry="${s(u/2)}" fill="${p}"${S(n.transparency,"fill-opacity")}/>`);break;case"line":o.push(`<line x1="${s(h)}" y1="${s(r)}" x2="${s(h+l)}" y2="${s(r+u)}" stroke="${p}" stroke-width="${s(Math.max((n.lineWidth??1)/72*t,.5))}"/>`);break;default:{const i=n.shape==="roundRect"?` rx="${s((n.rectRadius??.1)*t)}"`:"";o.push(`<rect x="${s(h)}" y="${s(r)}" width="${s(l)}" height="${s(u)}"${i} fill="${p}"${S(n.transparency,"fill-opacity")}/>`)}}}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${v} ${W}" width="${v}" height="${W}" font-family="Microsoft YaHei, PingFang SC, sans-serif">${o.join("")}</svg>`}a(F,"J"),c(F,"slideElementsSvg");function O(e,t,o){const[n]=m({title:t,slides:[{title:t,layout:"title",...o?{subtitle:o}:{}}]},e);return F(n)}a(O,"Q"),c(O,"themeThumbnailSvg");export{Q as MAX_THUMBNAIL_SVG_BYTES,x as isText,m as layoutSlides,R as renderPptx,F as slideElementsSvg,O as themeThumbnailSvg};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ThemeName } from "../themes.js";
|
|
2
|
+
export declare const THUMBNAIL_CHANNEL = "dal:ask-user-thumbnail";
|
|
3
|
+
export interface ThumbnailRequest {
|
|
4
|
+
ref: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
reply: (svg: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const THEME_THUMBNAILS: readonly ThemeName[];
|
|
9
|
+
export declare const PAGE_THUMBNAILS: readonly [
|
|
10
|
+
"hero",
|
|
11
|
+
"split",
|
|
12
|
+
"dashboard"
|
|
13
|
+
];
|
|
14
|
+
export declare const DOC_THUMBNAILS: readonly [
|
|
15
|
+
"report",
|
|
16
|
+
"brief",
|
|
17
|
+
"handout"
|
|
18
|
+
];
|
|
19
|
+
export declare function thumbnailSvg(ref: string, title?: string): string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=Object.defineProperty;var l=(t,o)=>g(t,"name",{value:o,configurable:!0});var v=Object.defineProperty,r=l((t,o)=>v(t,"name",{value:o,configurable:!0}),"r");import{t as w}from"@dalcode/dal-pi-kit";import{MAX_THUMBNAIL_SVG_BYTES as k,themeThumbnailSvg as C}from"./pptx.js";const D="dal:ask-user-thumbnail",A=["default","business","tech","warm","minimal"],T=["hero","split","dashboard"],S=["report","brief","handout"],u=320,m=180;function d(t,o="#FFFFFF"){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${u} ${m}" width="${u}" height="${m}"><rect x="0" y="0" width="${u}" height="${m}" fill="${o}"/>${t}</svg>`}l(d,"a"),r(d,"frame");function e(t,o,a,i,n,c=2){return`<rect x="${t}" y="${o}" width="${a}" height="${i}" rx="${c}" fill="${n}"/>`}l(e,"e"),r(e,"bar");function h(t,o,a,i,n="#CBD5E1",c=9){let p="";for(let f=0;f<i;f++){const b=f===i-1?a*.6:a;p+=e(t,o+f*c,b,4,n)}return p}l(h,"m"),r(h,"lines");const s="#0F172A",F="#2563EB",M="#E2E8F0",x={hero:r(()=>d(e(0,0,u,16,"#F8FAFC",0)+e(14,5,34,6,s)+e(250,5,56,6,M)+e(60,34,200,12,s)+e(90,52,140,6,"#94A3B8")+e(130,66,60,14,F,7)+[20,120,220].map(t=>e(t,100,80,62,"#F1F5F9",6)+e(t+10,112,18,18,F,4)+h(t+10,138,58,2)).join("")),"hero"),split:r(()=>d(e(0,0,u,16,"#F8FAFC",0)+e(14,5,34,6,s)+e(20,44,130,12,s)+e(20,62,100,12,s)+h(20,86,120,3,"#94A3B8")+e(20,124,56,14,F,7)+e(172,34,130,124,"#DBEAFE",8)+'<ellipse cx="237" cy="86" rx="28" ry="28" fill="#93C5FD"/>'+e(196,128,82,8,"#93C5FD")),"split"),dashboard:r(()=>d(e(0,0,58,m,s,0)+[18,34,50,66].map(t=>e(12,t,34,5,"#475569")).join("")+[70,152,234].map(t=>e(t,14,74,38,"#FFFFFF",5)+e(t+8,22,26,5,"#94A3B8")+e(t+8,34,40,9,s)).join("")+e(70,62,238,104,"#FFFFFF",5)+`<line x1="84" y1="146" x2="130" y2="118" stroke="${F}" stroke-width="2"/><line x1="130" y1="118" x2="180" y2="128" stroke="${F}" stroke-width="2"/><line x1="180" y1="128" x2="230" y2="92" stroke="${F}" stroke-width="2"/><line x1="230" y1="92" x2="292" y2="80" stroke="${F}" stroke-width="2"/>`,"#F1F5F9"),"dashboard")};function $(t){return d(e(98,8,124,164,"#FFFFFF",2)+t,"#E5E7EB")}l($,"c"),r($,"page");const B={report:r(()=>$(e(110,20,80,8,s)+e(110,32,50,4,"#94A3B8")+e(110,46,40,5,F)+h(110,56,100,3)+e(110,88,40,5,F)+h(110,98,100,2)+e(110,120,100,36,"#F1F5F9",1)+[128,140].map(t=>`<line x1="110" y1="${t}" x2="210" y2="${t}" stroke="#CBD5E1" stroke-width="1"/>`).join("")),"report"),brief:r(()=>$(e(110,20,70,8,s)+e(110,36,100,30,"#DBEAFE",3)+h(116,44,88,2,"#60A5FA")+[78,94,110,126].map(t=>`<ellipse cx="113" cy="${t+2}" rx="2" ry="2" fill="${F}"/>${e(120,t,80,4,"#CBD5E1")}`).join("")),"brief"),handout:r(()=>$(e(110,20,60,10,F)+h(110,38,100,2)+e(110,58,100,24,"#FEF3C7",3)+e(116,66,60,5,"#D97706")+e(110,94,60,10,F)+h(110,112,100,3)+e(110,144,100,16,"#F1F5F9",3)),"handout")};function E(t){return A.includes(t)}l(E,"C"),r(E,"isThemeName");function y(t,o){const[a,i]=t.split(":",2);let n;if(a==="theme"&&i!==void 0&&E(i)?n=C(i,o?.trim()||w("\u6F14\u793A\u6587\u7A3F\u6807\u9898")):a==="page"&&i!==void 0&&i in x?n=x[i]():a==="doc"&&i!==void 0&&i in B&&(n=B[i]()),!(n===void 0||Buffer.byteLength(n,"utf8")>k))return n}l(y,"D"),r(y,"thumbnailSvg");export{S as DOC_THUMBNAILS,T as PAGE_THUMBNAILS,A as THEME_THUMBNAILS,D as THUMBNAIL_CHANNEL,y as thumbnailSvg};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SheetTableInput {
|
|
2
|
+
title: string;
|
|
3
|
+
headers: string[];
|
|
4
|
+
rows: string[][];
|
|
5
|
+
summary?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SheetOutputInput {
|
|
8
|
+
title: string;
|
|
9
|
+
summary?: string;
|
|
10
|
+
tables: SheetTableInput[];
|
|
11
|
+
}
|
|
12
|
+
export declare function sanitizeSheetName(name: string, used: Set<string>): string;
|
|
13
|
+
export declare function coerceCell(value: string): string | number;
|
|
14
|
+
export declare function renderXlsx(output: SheetOutputInput): Promise<Buffer>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface OfficeSlidePlan {
|
|
2
|
+
title: string;
|
|
3
|
+
layout?: "title" | "content" | "two-column" | "section";
|
|
4
|
+
subtitle?: string;
|
|
5
|
+
goal?: string;
|
|
6
|
+
visual?: string;
|
|
7
|
+
points?: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface OfficePresentationPlan {
|
|
10
|
+
title: string;
|
|
11
|
+
slides: OfficeSlidePlan[];
|
|
12
|
+
}
|
|
13
|
+
export declare function savePresentationPlan(sessionId: string, plan: OfficePresentationPlan): void;
|
|
14
|
+
export declare function loadPresentationPlan(sessionId: string): OfficePresentationPlan | undefined;
|
|
15
|
+
export declare function takePresentationPlan(sessionId: string): OfficePresentationPlan | undefined;
|
|
16
|
+
export declare function clearPresentationPlan(sessionId: string): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ThemeName = "default" | "business" | "tech" | "warm" | "minimal";
|
|
2
|
+
export interface SlidePalette {
|
|
3
|
+
bg: string;
|
|
4
|
+
card: string;
|
|
5
|
+
primary: string;
|
|
6
|
+
accent: string;
|
|
7
|
+
dark: string;
|
|
8
|
+
body: string;
|
|
9
|
+
muted: string;
|
|
10
|
+
line: string;
|
|
11
|
+
shadowOpacity: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function themePalettes(theme: ThemeName): SlidePalette[];
|