dal-code 1.0.0 → 1.0.8
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 +73 -1
- package/dist/core/auth-guidance.d.ts +1 -0
- package/dist/core/auth-guidance.d.ts.map +1 -1
- package/dist/core/auth-guidance.js +6 -0
- package/dist/core/auth-guidance.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +4 -7
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +13 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +47 -48
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +46 -43
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/keybindings.d.ts +10 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +13 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/tools/bash.d.ts +3 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +61 -8
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts.map +1 -1
- package/dist/core/tools/renderers/bash.js +43 -6
- package/dist/core/tools/renderers/bash.js.map +1 -1
- package/dist/dal/builtins.d.ts.map +1 -1
- package/dist/dal/builtins.js +1 -0
- package/dist/dal/builtins.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +6 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +12 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +22 -1
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +2 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +24 -7
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +39 -2
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +200 -29
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +35 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +177 -23
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +1 -1
- package/dist/modes/interactive/theme/light.json +1 -1
- package/dist/modes/interactive/tui-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/tui-renderer.js +2 -2
- package/dist/modes/interactive/tui-renderer.js.map +1 -1
- package/dist/node_modules/@dalcode/dal-bridge/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-gateway/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-guard/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-halo/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-lang/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-mcp/package.json +9 -6
- package/dist/node_modules/@dalcode/dal-mcp/src/add-wizard.ts +142 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/command-parser.ts +218 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/config-edit.ts +99 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/index.ts +161 -18
- package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.ts +8 -3
- package/dist/node_modules/@dalcode/dal-office/LICENSE +21 -0
- package/dist/node_modules/@dalcode/dal-office/package.json +37 -0
- package/dist/node_modules/@dalcode/dal-office/src/extract/csv.ts +84 -0
- package/dist/node_modules/@dalcode/dal-office/src/extract/index.ts +111 -0
- package/dist/node_modules/@dalcode/dal-office/src/extract/ooxml.ts +109 -0
- package/dist/node_modules/@dalcode/dal-office/src/extract/pdf.ts +43 -0
- package/dist/node_modules/@dalcode/dal-office/src/index.ts +43 -0
- package/dist/node_modules/@dalcode/dal-office/src/paths.ts +107 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/chart.ts +111 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/docx.ts +155 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/pptx.ts +386 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.ts +99 -0
- package/dist/node_modules/@dalcode/dal-office/src/scenes.ts +197 -0
- package/dist/node_modules/@dalcode/dal-office/src/scratchpad.ts +49 -0
- package/dist/node_modules/@dalcode/dal-office/src/themes.ts +240 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/chart-generate.ts +122 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/doc-generate.ts +123 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/drawio-generate.ts +99 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/md-generate.ts +76 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-generate.ts +106 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-plan.ts +91 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/read-file.ts +71 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/shared.ts +54 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/sheet-generate.ts +101 -0
- package/dist/node_modules/@dalcode/dal-office/src/truncate.ts +27 -0
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.d.ts.map +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +233 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js.map +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.ts +322 -1
- package/dist/node_modules/@dalcode/dal-skills/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-skills/src/discover.ts +101 -0
- package/dist/node_modules/@dalcode/dal-skills/src/index.ts +71 -9
- package/dist/node_modules/@dalcode/dal-skills/src/install.ts +140 -0
- package/dist/node_modules/@dalcode/dal-skills/src/manage.ts +446 -0
- package/dist/node_modules/@dalcode/dal-skills/src/packages.ts +39 -1
- package/dist/node_modules/@dalcode/dal-subagent/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-subagent/src/index.ts +46 -4
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +3 -3
- package/dist/node_modules/@dalcode/deepailab/package.json +4 -4
- package/dist/node_modules/@dalcode/deepailab/src/index.ts +7 -1
- package/dist/node_modules/@dalcode/deepailab/src/model-defaults.ts +42 -6
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- 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/cloudflare-ai-gateway.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/kimi-coding.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/nvidia.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/vercel-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-client/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-protocol/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +3 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.js +3 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +23 -22
- package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +4 -3
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +4 -2
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/dist/utils/changelog.d.ts +37 -4
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +80 -17
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +13 -1
- package/dist/utils/clipboard.js.map +1 -1
- 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/examples/plugins/pi-example-plugin/package.json +1 -1
- package/npm-shrinkwrap.json +1511 -25
- package/package.json +8 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui-renderer.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/tui-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAmB,KAAK,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAMhG,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,GAAG,YAAY,CAAC;IAC3C,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IACxC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAC1C;AAED,6DAA6D;AAC7D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;CAAE,GAAG,YAAY,CAAC;AACxH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;CAAE,GAAG,aAAa,CAAC;AACtH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,aAAa,GAAG,YAAY,CAAC;AA8BnG,0FAA0F;AAC1F,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,CA4BpE","sourcesContent":["import type { Terminal } from \"@earendil-works/pi-tui\";\nimport { ProcessTerminal, type TUI, TuiAltScreen, TuiMainScreen } from \"@earendil-works/pi-tui\";\nimport { copyToClipboard } from \"../../utils/clipboard.ts\";\nimport { openBrowser } from \"../../utils/open-browser.ts\";\nimport { keyDisplayText } from \"./components/keybinding-hints.ts\";\nimport { theme } from \"./theme/theme.ts\";\n\nexport interface InteractiveTuiOptions {\n\treadonly tuiMode: \"regular\" | \"fullscreen\";\n\treadonly showHardwareCursor: boolean;\n\treadonly logDirectory: string;\n\treadonly terminal?: Terminal;\n\treadonly onRightClickPaste?: () => void;\n\treadonly fullscreenCopyOnSelect?: boolean;\n}\n\n/** Composition root shared by coding-agent presentations. */\nexport function createInteractiveTui(options: InteractiveTuiOptions & { readonly tuiMode: \"fullscreen\" }): TuiAltScreen;\nexport function createInteractiveTui(options: InteractiveTuiOptions & { readonly tuiMode: \"regular\" }): TuiMainScreen;\nexport function createInteractiveTui(options: InteractiveTuiOptions): TuiMainScreen | TuiAltScreen;\nexport function createInteractiveTui(options: InteractiveTuiOptions): TuiMainScreen | TuiAltScreen {\n\tconst terminal = options.terminal ?? new ProcessTerminal();\n\tif (options.tuiMode === \"fullscreen\") {\n\t\tconst styleSearchMatch = (text: string) => theme.bg(\"searchMatchBg\", theme.fg(\"searchMatchText\", text));\n\t\treturn new TuiAltScreen(terminal, options.showHardwareCursor, options.logDirectory, {\n\t\t\tsearchMatchStyle: (text) => theme.underline(styleSearchMatch(text)),\n\t\t\tsearchCurrentMatchStyle: (text) => theme.bold(theme.inverse(styleSearchMatch(text))),\n\t\t\tsearchNavigationButtonStyle: (text, hovered) => (hovered ? theme.underline(text) : text),\n\t\t\tscrollToEndIndicator: () => {\n\t\t\t\tconst shortcut = keyDisplayText(\"tui.altScreen.bottom\");\n\t\t\t\tconst label = ` ↓ Jump to latest message${shortcut ? ` · ${shortcut}` : \"\"} `;\n\t\t\t\treturn theme.bg(\"selectedBg\", theme.fg(\"text\", label));\n\t\t\t},\n\t\t\topenUrl: openBrowser,\n\t\t\tonRightClickPaste: options.onRightClickPaste,\n\t\t\tcopyOnSelect: options.fullscreenCopyOnSelect,\n\t\t\tcopySelection: async (text) => {\n\t\t\t\ttry {\n\t\t\t\t\tawait copyToClipboard(text);\n\t\t\t\t\treturn true;\n\t\t\t\t} catch {\n\t\t\t\t\treturn
|
|
1
|
+
{"version":3,"file":"tui-renderer.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/tui-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAmB,KAAK,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAMhG,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,GAAG,YAAY,CAAC;IAC3C,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IACxC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAC1C;AAED,6DAA6D;AAC7D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;CAAE,GAAG,YAAY,CAAC;AACxH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;CAAE,GAAG,aAAa,CAAC;AACtH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,aAAa,GAAG,YAAY,CAAC;AA8BnG,0FAA0F;AAC1F,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,CA4BpE","sourcesContent":["import type { Terminal } from \"@earendil-works/pi-tui\";\nimport { ProcessTerminal, type TUI, TuiAltScreen, TuiMainScreen } from \"@earendil-works/pi-tui\";\nimport { copyToClipboard } from \"../../utils/clipboard.ts\";\nimport { openBrowser } from \"../../utils/open-browser.ts\";\nimport { keyDisplayText } from \"./components/keybinding-hints.ts\";\nimport { theme } from \"./theme/theme.ts\";\n\nexport interface InteractiveTuiOptions {\n\treadonly tuiMode: \"regular\" | \"fullscreen\";\n\treadonly showHardwareCursor: boolean;\n\treadonly logDirectory: string;\n\treadonly terminal?: Terminal;\n\treadonly onRightClickPaste?: () => void;\n\treadonly fullscreenCopyOnSelect?: boolean;\n}\n\n/** Composition root shared by coding-agent presentations. */\nexport function createInteractiveTui(options: InteractiveTuiOptions & { readonly tuiMode: \"fullscreen\" }): TuiAltScreen;\nexport function createInteractiveTui(options: InteractiveTuiOptions & { readonly tuiMode: \"regular\" }): TuiMainScreen;\nexport function createInteractiveTui(options: InteractiveTuiOptions): TuiMainScreen | TuiAltScreen;\nexport function createInteractiveTui(options: InteractiveTuiOptions): TuiMainScreen | TuiAltScreen {\n\tconst terminal = options.terminal ?? new ProcessTerminal();\n\tif (options.tuiMode === \"fullscreen\") {\n\t\tconst styleSearchMatch = (text: string) => theme.bg(\"searchMatchBg\", theme.fg(\"searchMatchText\", text));\n\t\treturn new TuiAltScreen(terminal, options.showHardwareCursor, options.logDirectory, {\n\t\t\tsearchMatchStyle: (text) => theme.underline(styleSearchMatch(text)),\n\t\t\tsearchCurrentMatchStyle: (text) => theme.bold(theme.inverse(styleSearchMatch(text))),\n\t\t\tsearchNavigationButtonStyle: (text, hovered) => (hovered ? theme.underline(text) : text),\n\t\t\tscrollToEndIndicator: () => {\n\t\t\t\tconst shortcut = keyDisplayText(\"tui.altScreen.bottom\");\n\t\t\t\tconst label = ` ↓ Jump to latest message${shortcut ? ` · ${shortcut}` : \"\"} `;\n\t\t\t\treturn theme.bg(\"selectedBg\", theme.fg(\"text\", label));\n\t\t\t},\n\t\t\topenUrl: openBrowser,\n\t\t\tonRightClickPaste: options.onRightClickPaste,\n\t\t\tcopyOnSelect: options.fullscreenCopyOnSelect,\n\t\t\tcopySelection: async (text) => {\n\t\t\t\ttry {\n\t\t\t\t\tawait copyToClipboard(text);\n\t\t\t\t\treturn true;\n\t\t\t\t} catch (error) {\n\t\t\t\t\treturn error instanceof Error ? error.message : String(error);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\treturn new TuiMainScreen(terminal, options.showHardwareCursor, options.logDirectory);\n}\n\n/** Stable reference for components while InteractiveMode replaces the active renderer. */\nexport function createInteractiveTuiReference(getTui: () => TUI): TUI {\n\treturn new Proxy({} as TUI, {\n\t\tget: (_target, property) => {\n\t\t\tconst tui = getTui();\n\t\t\tconst value = Reflect.get(tui, property, tui);\n\t\t\tif (typeof value !== \"function\") return value;\n\t\t\tlet methodTui = tui;\n\t\t\tlet method = value;\n\t\t\treturn (...args: unknown[]) => {\n\t\t\t\tconst currentTui = getTui();\n\t\t\t\tif (currentTui !== methodTui) {\n\t\t\t\t\tconst currentMethod = Reflect.get(currentTui, property, currentTui);\n\t\t\t\t\tif (typeof currentMethod !== \"function\") {\n\t\t\t\t\t\tthrow new TypeError(`TUI property ${String(property)} is not callable`);\n\t\t\t\t\t}\n\t\t\t\t\tmethodTui = currentTui;\n\t\t\t\t\tmethod = currentMethod;\n\t\t\t\t}\n\t\t\t\treturn Reflect.apply(method, methodTui, args);\n\t\t\t};\n\t\t},\n\t\tset: (_target, property, value) => {\n\t\t\tconst tui = getTui();\n\t\t\treturn Reflect.set(tui, property, value, tui);\n\t\t},\n\t\thas: (_target, property) => Reflect.has(getTui(), property),\n\t\tgetPrototypeOf: () => Reflect.getPrototypeOf(getTui()),\n\t});\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui-renderer.js","sourceRoot":"","sources":["../../../src/modes/interactive/tui-renderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAY,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAezC,MAAM,UAAU,oBAAoB,CAAC,OAA8B,EAAgC;IAClG,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,eAAe,EAAE,CAAC;IAC3D,IAAI,OAAO,CAAC,OAAO,KAAK,YAAY,EAAE,CAAC;QACtC,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,CAAC;QACxG,OAAO,IAAI,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,YAAY,EAAE;YACnF,gBAAgB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;YACnE,uBAAuB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;YACpF,2BAA2B,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CA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AAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;YAAA,CAC9C,CAAC;QAAA,CACF;QACD,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC;YAClC,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;YACrB,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAAA,CAC9C;QACD,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC;QAC3D,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;KACtD,CAAC,CAAC;AAAA,CACH","sourcesContent":["import type { Terminal } from \"@earendil-works/pi-tui\";\nimport { ProcessTerminal, type TUI, TuiAltScreen, TuiMainScreen } from \"@earendil-works/pi-tui\";\nimport { copyToClipboard } from \"../../utils/clipboard.ts\";\nimport { openBrowser } from \"../../utils/open-browser.ts\";\nimport { keyDisplayText } from \"./components/keybinding-hints.ts\";\nimport { theme } from \"./theme/theme.ts\";\n\nexport interface InteractiveTuiOptions {\n\treadonly tuiMode: \"regular\" | \"fullscreen\";\n\treadonly showHardwareCursor: boolean;\n\treadonly logDirectory: string;\n\treadonly terminal?: Terminal;\n\treadonly onRightClickPaste?: () => void;\n\treadonly fullscreenCopyOnSelect?: boolean;\n}\n\n/** Composition root shared by coding-agent presentations. */\nexport function createInteractiveTui(options: InteractiveTuiOptions & { readonly tuiMode: \"fullscreen\" }): TuiAltScreen;\nexport function createInteractiveTui(options: InteractiveTuiOptions & { readonly tuiMode: \"regular\" }): TuiMainScreen;\nexport function createInteractiveTui(options: InteractiveTuiOptions): TuiMainScreen | TuiAltScreen;\nexport function createInteractiveTui(options: InteractiveTuiOptions): TuiMainScreen | TuiAltScreen {\n\tconst terminal = options.terminal ?? new ProcessTerminal();\n\tif (options.tuiMode === \"fullscreen\") {\n\t\tconst styleSearchMatch = (text: string) => theme.bg(\"searchMatchBg\", theme.fg(\"searchMatchText\", text));\n\t\treturn new TuiAltScreen(terminal, options.showHardwareCursor, options.logDirectory, {\n\t\t\tsearchMatchStyle: (text) => theme.underline(styleSearchMatch(text)),\n\t\t\tsearchCurrentMatchStyle: (text) => theme.bold(theme.inverse(styleSearchMatch(text))),\n\t\t\tsearchNavigationButtonStyle: (text, hovered) => (hovered ? theme.underline(text) : text),\n\t\t\tscrollToEndIndicator: () => {\n\t\t\t\tconst shortcut = keyDisplayText(\"tui.altScreen.bottom\");\n\t\t\t\tconst label = ` ↓ Jump to latest message${shortcut ? ` · ${shortcut}` : \"\"} `;\n\t\t\t\treturn theme.bg(\"selectedBg\", theme.fg(\"text\", label));\n\t\t\t},\n\t\t\topenUrl: openBrowser,\n\t\t\tonRightClickPaste: options.onRightClickPaste,\n\t\t\tcopyOnSelect: options.fullscreenCopyOnSelect,\n\t\t\tcopySelection: async (text) => {\n\t\t\t\ttry {\n\t\t\t\t\tawait copyToClipboard(text);\n\t\t\t\t\treturn true;\n\t\t\t\t} catch (error) {\n\t\t\t\t\treturn error instanceof Error ? error.message : String(error);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\treturn new TuiMainScreen(terminal, options.showHardwareCursor, options.logDirectory);\n}\n\n/** Stable reference for components while InteractiveMode replaces the active renderer. */\nexport function createInteractiveTuiReference(getTui: () => TUI): TUI {\n\treturn new Proxy({} as TUI, {\n\t\tget: (_target, property) => {\n\t\t\tconst tui = getTui();\n\t\t\tconst value = Reflect.get(tui, property, tui);\n\t\t\tif (typeof value !== \"function\") return value;\n\t\t\tlet methodTui = tui;\n\t\t\tlet method = value;\n\t\t\treturn (...args: unknown[]) => {\n\t\t\t\tconst currentTui = getTui();\n\t\t\t\tif (currentTui !== methodTui) {\n\t\t\t\t\tconst currentMethod = Reflect.get(currentTui, property, currentTui);\n\t\t\t\t\tif (typeof currentMethod !== \"function\") {\n\t\t\t\t\t\tthrow new TypeError(`TUI property ${String(property)} is not callable`);\n\t\t\t\t\t}\n\t\t\t\t\tmethodTui = currentTui;\n\t\t\t\t\tmethod = currentMethod;\n\t\t\t\t}\n\t\t\t\treturn Reflect.apply(method, methodTui, args);\n\t\t\t};\n\t\t},\n\t\tset: (_target, property, value) => {\n\t\t\tconst tui = getTui();\n\t\t\treturn Reflect.set(tui, property, value, tui);\n\t\t},\n\t\thas: (_target, property) => Reflect.has(getTui(), property),\n\t\tgetPrototypeOf: () => Reflect.getPrototypeOf(getTui()),\n\t});\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-bridge",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
21
|
+
"@dalcode/dal-pi-kit": "1.0.8",
|
|
22
22
|
"typebox": "1.3.7"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
25
|
+
"@earendil-works/pi-coding-agent": "^1.0.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependenciesMeta": {
|
|
28
28
|
"@earendil-works/pi-coding-agent": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-gateway",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@dalcode/deepailab": "1.0.
|
|
20
|
+
"@dalcode/deepailab": "1.0.8"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
23
|
+
"@earendil-works/pi-coding-agent": "^1.0.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependenciesMeta": {
|
|
26
26
|
"@earendil-works/pi-coding-agent": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-guard",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
21
|
-
"@dalcode/dal-bridge": "1.0.
|
|
22
|
-
"@dalcode/dal-halo": "1.0.
|
|
20
|
+
"@dalcode/dal-pi-kit": "1.0.8",
|
|
21
|
+
"@dalcode/dal-bridge": "1.0.8",
|
|
22
|
+
"@dalcode/dal-halo": "1.0.8"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
25
|
+
"@earendil-works/pi-coding-agent": "^1.0.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependenciesMeta": {
|
|
28
28
|
"@earendil-works/pi-coding-agent": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-halo",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
20
|
+
"@earendil-works/pi-coding-agent": "^1.0.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependenciesMeta": {
|
|
23
23
|
"@earendil-works/pi-coding-agent": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-lang",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -17,11 +17,11 @@
|
|
|
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.8",
|
|
21
|
+
"@dalcode/dal-bridge": "1.0.8"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
24
|
+
"@earendil-works/pi-coding-agent": "^1.0.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependenciesMeta": {
|
|
27
27
|
"@earendil-works/pi-coding-agent": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-lsp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -19,13 +19,13 @@
|
|
|
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.8",
|
|
23
|
+
"@dalcode/dal-pi-kit": "1.0.8",
|
|
24
24
|
"cross-spawn": "7.0.6",
|
|
25
25
|
"typebox": "1.3.7"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
28
|
+
"@earendil-works/pi-coding-agent": "^1.0.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependenciesMeta": {
|
|
31
31
|
"@earendil-works/pi-coding-agent": {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/index.ts",
|
|
9
9
|
"./account-layer": "./src/account-layer.ts",
|
|
10
|
+
"./command-parser": "./src/command-parser.ts",
|
|
10
11
|
"./config": "./src/config.ts",
|
|
12
|
+
"./config-edit": "./src/config-edit.ts",
|
|
11
13
|
"./http-client": "./src/http-client.ts",
|
|
12
14
|
"./package.json": "./package.json",
|
|
13
15
|
"./stdio-client": "./src/stdio-client.ts"
|
|
@@ -21,13 +23,14 @@
|
|
|
21
23
|
]
|
|
22
24
|
},
|
|
23
25
|
"dependencies": {
|
|
24
|
-
"@dalcode/dal-bridge": "1.0.
|
|
25
|
-
"@dalcode/dal-guard": "1.0.
|
|
26
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
27
|
-
"@dalcode/deepailab": "1.0.
|
|
26
|
+
"@dalcode/dal-bridge": "1.0.8",
|
|
27
|
+
"@dalcode/dal-guard": "1.0.8",
|
|
28
|
+
"@dalcode/dal-pi-kit": "1.0.8",
|
|
29
|
+
"@dalcode/deepailab": "1.0.8",
|
|
30
|
+
"cross-spawn": "7.0.6"
|
|
28
31
|
},
|
|
29
32
|
"peerDependencies": {
|
|
30
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
33
|
+
"@earendil-works/pi-coding-agent": "^1.0.0"
|
|
31
34
|
},
|
|
32
35
|
"peerDependenciesMeta": {
|
|
33
36
|
"@earendil-works/pi-coding-agent": {
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive /mcp add wizard: a handful of ui prompts → McpAddSpec.
|
|
3
|
+
*
|
|
4
|
+
* Claude Code's terminal /mcp panel offers no way to add a server (the CLI
|
|
5
|
+
* does), and codex's /mcp is read-only — dal gets a real in-session wizard.
|
|
6
|
+
* Every prompt is cancellable with Esc; a cancelled wizard returns undefined
|
|
7
|
+
* and writes nothing. Silence on cancel is deliberate: Esc means "never mind",
|
|
8
|
+
* not "tell me I cancelled".
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { t } from "@dalcode/dal-pi-kit";
|
|
12
|
+
import type { ExtensionUIContext } from "@earendil-works/pi-coding-agent";
|
|
13
|
+
import { assertValidName, type McpAddSpec, tokenizeCommandArgs } from "./command-parser.ts";
|
|
14
|
+
import type { McpConfigScope } from "./config-edit.ts";
|
|
15
|
+
import type { McpServerConfig } from "./types.ts";
|
|
16
|
+
|
|
17
|
+
const STDIO_KIND = t("stdio(本地命令)");
|
|
18
|
+
const HTTP_KIND = t("http(远程 URL)");
|
|
19
|
+
const USER_SCOPE_LABEL = t("用户级 ~/.dal/agent/mcp.json(本机所有项目可用)");
|
|
20
|
+
const PROJECT_SCOPE_LABEL = t("项目级 .dal/mcp.json(仅当前项目,需已信任)");
|
|
21
|
+
|
|
22
|
+
/** Prompts until `validate` passes; undefined (Esc) aborts the whole wizard. */
|
|
23
|
+
async function askValid(
|
|
24
|
+
ui: ExtensionUIContext,
|
|
25
|
+
prompt: string,
|
|
26
|
+
validate: (value: string) => string | undefined,
|
|
27
|
+
): Promise<string | undefined> {
|
|
28
|
+
for (;;) {
|
|
29
|
+
const value = await ui.input(prompt);
|
|
30
|
+
if (value === undefined) return undefined;
|
|
31
|
+
const error = validate(value);
|
|
32
|
+
if (error === undefined) return value;
|
|
33
|
+
ui.notify(error, "error");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function parseEnvList(raw: string): { ok: true; value: Record<string, string> } | { ok: false; error: string } {
|
|
38
|
+
const env: Record<string, string> = {};
|
|
39
|
+
for (const pair of raw.split(/[,,]/)) {
|
|
40
|
+
const trimmed = pair.trim();
|
|
41
|
+
if (!trimmed) continue;
|
|
42
|
+
const index = trimmed.indexOf("=");
|
|
43
|
+
if (index === -1 || !trimmed.slice(0, index).trim()) {
|
|
44
|
+
return { ok: false, error: `${t("无效的环境变量格式(KEY=VALUE):")}${trimmed}` };
|
|
45
|
+
}
|
|
46
|
+
env[trimmed.slice(0, index).trim()] = trimmed.slice(index + 1).trim();
|
|
47
|
+
}
|
|
48
|
+
return { ok: true, value: env };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function parseHeaderList(raw: string): { ok: true; value: Record<string, string> } | { ok: false; error: string } {
|
|
52
|
+
const headers: Record<string, string> = {};
|
|
53
|
+
for (const pair of raw.split(/[,,]/)) {
|
|
54
|
+
const trimmed = pair.trim();
|
|
55
|
+
if (!trimmed) continue;
|
|
56
|
+
const index = trimmed.indexOf(":");
|
|
57
|
+
if (index === -1 || !trimmed.slice(0, index).trim()) {
|
|
58
|
+
return { ok: false, error: `${t("无效的请求头格式(Key: Value):")}${trimmed}` };
|
|
59
|
+
}
|
|
60
|
+
headers[trimmed.slice(0, index).trim()] = trimmed.slice(index + 1).trim();
|
|
61
|
+
}
|
|
62
|
+
return { ok: true, value: headers };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Runs the wizard. `cwd` only feeds the project-scope label in the summary;
|
|
67
|
+
* trust is enforced by the caller before anything is written.
|
|
68
|
+
*/
|
|
69
|
+
export async function runAddWizard(ui: ExtensionUIContext, cwd: string): Promise<McpAddSpec | undefined> {
|
|
70
|
+
const kind = await ui.select(t("要添加的 MCP 服务器类型:"), [STDIO_KIND, HTTP_KIND]);
|
|
71
|
+
if (kind === undefined) return undefined;
|
|
72
|
+
const isHttp = kind === HTTP_KIND;
|
|
73
|
+
|
|
74
|
+
const name = await askValid(ui, t("服务器名称(仅字母、数字、-、_):"), (value) => {
|
|
75
|
+
try {
|
|
76
|
+
assertValidName(value.trim());
|
|
77
|
+
return undefined;
|
|
78
|
+
} catch (error) {
|
|
79
|
+
return error instanceof Error ? error.message : String(error);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
if (name === undefined) return undefined;
|
|
83
|
+
|
|
84
|
+
let config: McpServerConfig;
|
|
85
|
+
if (isHttp) {
|
|
86
|
+
const url = await askValid(ui, t("服务器 URL(http(s)://…):"), (value) => {
|
|
87
|
+
let parsed: URL;
|
|
88
|
+
try {
|
|
89
|
+
parsed = new URL(value.trim());
|
|
90
|
+
} catch {
|
|
91
|
+
return `${t("URL 无效:")}${value.trim()}`;
|
|
92
|
+
}
|
|
93
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
94
|
+
return `${t("URL 仅支持 http(s):")}${value.trim()}`;
|
|
95
|
+
}
|
|
96
|
+
return undefined;
|
|
97
|
+
});
|
|
98
|
+
if (url === undefined) return undefined;
|
|
99
|
+
const headersRaw = await ui.input(t("请求头(可选,逗号分隔 Key: Value):"));
|
|
100
|
+
if (headersRaw === undefined) return undefined;
|
|
101
|
+
const headers = parseHeaderList(headersRaw);
|
|
102
|
+
if (!headers.ok) {
|
|
103
|
+
ui.notify(headers.error, "error");
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
config = { url: url.trim(), ...(Object.keys(headers.value).length > 0 ? { headers: headers.value } : {}) };
|
|
107
|
+
} else {
|
|
108
|
+
const commandLine = await askValid(
|
|
109
|
+
ui,
|
|
110
|
+
t("启动命令(含参数,如 npx -y chrome-devtools-mcp@latest):"),
|
|
111
|
+
(value) => (tokenizeCommandArgs(value).length > 0 ? undefined : t("命令不能为空。")),
|
|
112
|
+
);
|
|
113
|
+
if (commandLine === undefined) return undefined;
|
|
114
|
+
const argv = tokenizeCommandArgs(commandLine);
|
|
115
|
+
const envRaw = await ui.input(t("环境变量(可选,逗号分隔 KEY=VALUE):"));
|
|
116
|
+
if (envRaw === undefined) return undefined;
|
|
117
|
+
const env = parseEnvList(envRaw);
|
|
118
|
+
if (!env.ok) {
|
|
119
|
+
ui.notify(env.error, "error");
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
const [command, ...args] = argv;
|
|
123
|
+
config = {
|
|
124
|
+
command,
|
|
125
|
+
...(args.length > 0 ? { args } : {}),
|
|
126
|
+
...(Object.keys(env.value).length > 0 ? { env: env.value } : {}),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const scopeLabels = [USER_SCOPE_LABEL, PROJECT_SCOPE_LABEL];
|
|
131
|
+
const pickedScope = await ui.select(t("保存位置:"), scopeLabels);
|
|
132
|
+
if (pickedScope === undefined) return undefined;
|
|
133
|
+
const scope: McpConfigScope = pickedScope === PROJECT_SCOPE_LABEL ? "project" : "user";
|
|
134
|
+
|
|
135
|
+
const target = scope === "user" ? "~/.dal/agent/mcp.json" : `${cwd}/.dal/mcp.json`;
|
|
136
|
+
const confirmed = await ui.confirm(
|
|
137
|
+
t("确认保存该 MCP 服务器?"),
|
|
138
|
+
`${name.trim()} → ${target}\n${JSON.stringify(config, null, 2)}`,
|
|
139
|
+
);
|
|
140
|
+
if (!confirmed) return undefined;
|
|
141
|
+
return { name: name.trim(), scope, config };
|
|
142
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Argument parsing for the /mcp subcommands.
|
|
3
|
+
*
|
|
4
|
+
* Pure text-in/spec-out: no filesystem, no UI — trivially unit-testable.
|
|
5
|
+
* Grammar mirrors `claude mcp add` / `codex mcp add`, adapted to dal:
|
|
6
|
+
*
|
|
7
|
+
* add <name> -- <command> [args...] stdio (`--` passes the rest verbatim)
|
|
8
|
+
* add <name> <url> http (bare positional URL)
|
|
9
|
+
* add [flags] <name> (--url <URL> | -- <command> [args...])
|
|
10
|
+
* flags: --scope user|project --env KEY=VALUE (repeatable, stdio only)
|
|
11
|
+
* --header "Key: Value" (repeatable, http only)
|
|
12
|
+
* remove <name> [--scope user|project]
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { t } from "@dalcode/dal-pi-kit";
|
|
16
|
+
import type { McpConfigScope } from "./config-edit.ts";
|
|
17
|
+
import type { McpServerConfig } from "./types.ts";
|
|
18
|
+
|
|
19
|
+
/** A malformed command line — surfaced to the user as guidance, not a stack trace. */
|
|
20
|
+
export class UsageError extends Error {}
|
|
21
|
+
|
|
22
|
+
export const ADD_USAGE = t(
|
|
23
|
+
'用法:/mcp add <name> -- <command> [args...](stdio)或 /mcp add <name> <url>(http);选项:--scope user|project、--env KEY=VALUE、--header "Key: Value"',
|
|
24
|
+
);
|
|
25
|
+
export const REMOVE_USAGE = t("用法:/mcp remove <name> [--scope user|project]");
|
|
26
|
+
|
|
27
|
+
// Same charset codex uses; also safe inside the mcp__<server>__<tool> tool names.
|
|
28
|
+
const NAME_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
29
|
+
|
|
30
|
+
export interface McpAddSpec {
|
|
31
|
+
name: string;
|
|
32
|
+
scope: McpConfigScope;
|
|
33
|
+
config: McpServerConfig;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface McpRemoveSpec {
|
|
37
|
+
name: string;
|
|
38
|
+
scope?: McpConfigScope;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Whitespace tokenizer that keeps quoted segments (including empty ones) as single tokens. */
|
|
42
|
+
export function tokenizeCommandArgs(input: string): string[] {
|
|
43
|
+
const tokens: string[] = [];
|
|
44
|
+
let current = "";
|
|
45
|
+
let started = false;
|
|
46
|
+
let quote: string | undefined;
|
|
47
|
+
for (const char of input) {
|
|
48
|
+
if (quote) {
|
|
49
|
+
if (char === quote) quote = undefined;
|
|
50
|
+
else current += char;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (char === '"' || char === "'") {
|
|
54
|
+
quote = char;
|
|
55
|
+
started = true;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (char === " " || char === "\t" || char === "\n" || char === "\r") {
|
|
59
|
+
if (started) tokens.push(current);
|
|
60
|
+
current = "";
|
|
61
|
+
started = false;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
current += char;
|
|
65
|
+
started = true;
|
|
66
|
+
}
|
|
67
|
+
if (quote) throw new UsageError(t("引号未闭合。"));
|
|
68
|
+
if (started) tokens.push(current);
|
|
69
|
+
return tokens;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function assertValidName(name: string): void {
|
|
73
|
+
if (!NAME_PATTERN.test(name)) {
|
|
74
|
+
throw new UsageError(`${t("服务器名称无效:")}${name}${t("(仅允许字母、数字、-、_)")}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function parseScopeValue(value: string): McpConfigScope {
|
|
79
|
+
if (value === "user" || value === "project") return value;
|
|
80
|
+
throw new UsageError(`${t("--scope 仅支持 user 或 project:")}${value}`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Splits on the first separator; trims both sides; key must be non-empty. */
|
|
84
|
+
function splitPair(pair: string, separator: ":" | "=", what: string): [string, string] {
|
|
85
|
+
const index = pair.indexOf(separator);
|
|
86
|
+
if (index === -1 || !pair.slice(0, index).trim()) {
|
|
87
|
+
throw new UsageError(`${t("无效的")}${what}${t("格式:")}${pair}`);
|
|
88
|
+
}
|
|
89
|
+
return [pair.slice(0, index).trim(), pair.slice(index + separator.length).trim()];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function buildHttpConfig(url: string, headers: Record<string, string>): McpServerConfig {
|
|
93
|
+
let parsed: URL;
|
|
94
|
+
try {
|
|
95
|
+
parsed = new URL(url);
|
|
96
|
+
} catch {
|
|
97
|
+
throw new UsageError(`${t("URL 无效:")}${url}`);
|
|
98
|
+
}
|
|
99
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
100
|
+
throw new UsageError(`${t("URL 仅支持 http(s):")}${url}`);
|
|
101
|
+
}
|
|
102
|
+
return { url, ...(Object.keys(headers).length > 0 ? { headers } : {}) };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function parseAddArgs(tokens: string[]): McpAddSpec {
|
|
106
|
+
const env: Record<string, string> = {};
|
|
107
|
+
const headers: Record<string, string> = {};
|
|
108
|
+
let scope: McpConfigScope = "user";
|
|
109
|
+
let url: string | undefined;
|
|
110
|
+
const positional: string[] = [];
|
|
111
|
+
let verbatim = false;
|
|
112
|
+
|
|
113
|
+
let i = 0;
|
|
114
|
+
while (i < tokens.length) {
|
|
115
|
+
const token = tokens[i];
|
|
116
|
+
i += 1;
|
|
117
|
+
if (!verbatim && token === "--") {
|
|
118
|
+
verbatim = true;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
const isFlag = !verbatim && (token.startsWith("--") || /^-[\w-]$/.test(token));
|
|
122
|
+
if (isFlag) {
|
|
123
|
+
const eq = token.indexOf("=");
|
|
124
|
+
const flag = eq === -1 ? token : token.slice(0, eq);
|
|
125
|
+
const inline = eq === -1 ? undefined : token.slice(eq + 1);
|
|
126
|
+
const takeValue = (): string => {
|
|
127
|
+
if (inline !== undefined) return inline;
|
|
128
|
+
if (i >= tokens.length) throw new UsageError(`${flag}${t(" 缺少值。")}\n${ADD_USAGE}`);
|
|
129
|
+
const value = tokens[i];
|
|
130
|
+
i += 1;
|
|
131
|
+
return value;
|
|
132
|
+
};
|
|
133
|
+
switch (flag) {
|
|
134
|
+
case "--scope":
|
|
135
|
+
case "-s":
|
|
136
|
+
scope = parseScopeValue(takeValue());
|
|
137
|
+
break;
|
|
138
|
+
case "--url":
|
|
139
|
+
case "-u":
|
|
140
|
+
url = takeValue();
|
|
141
|
+
break;
|
|
142
|
+
case "--env":
|
|
143
|
+
case "-e": {
|
|
144
|
+
const [key, value] = splitPair(takeValue(), "=", t("环境变量(KEY=VALUE)"));
|
|
145
|
+
env[key] = value;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
case "--header":
|
|
149
|
+
case "-H": {
|
|
150
|
+
const [key, value] = splitPair(takeValue(), ":", t("请求头(Key: Value)"));
|
|
151
|
+
headers[key] = value;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
default:
|
|
155
|
+
throw new UsageError(`${t("未知参数:")}${flag}\n${ADD_USAGE}`);
|
|
156
|
+
}
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
positional.push(token);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const [name, ...rest] = positional;
|
|
163
|
+
if (!name) throw new UsageError(ADD_USAGE);
|
|
164
|
+
assertValidName(name);
|
|
165
|
+
|
|
166
|
+
if (url !== undefined) {
|
|
167
|
+
if (rest.length > 0) throw new UsageError(`${t("--url 不能与位置参数同时使用。")}\n${ADD_USAGE}`);
|
|
168
|
+
if (Object.keys(env).length > 0) throw new UsageError(t("--env 仅适用于 stdio 服务器。"));
|
|
169
|
+
return { name, scope, config: buildHttpConfig(url, headers) };
|
|
170
|
+
}
|
|
171
|
+
if (rest.length === 0) throw new UsageError(ADD_USAGE);
|
|
172
|
+
// A single token with a scheme is trying to be a URL. If it isn't one we
|
|
173
|
+
// speak, say so — it is almost certainly a typo for an http(s) URL, and it
|
|
174
|
+
// would be a terrible command name in any case.
|
|
175
|
+
if (!verbatim && rest.length === 1 && /^[a-z][a-z0-9+.-]*:\/\//i.test(rest[0])) {
|
|
176
|
+
if (Object.keys(env).length > 0) throw new UsageError(t("--env 仅适用于 stdio 服务器。"));
|
|
177
|
+
return { name, scope, config: buildHttpConfig(rest[0], headers) };
|
|
178
|
+
}
|
|
179
|
+
if (Object.keys(headers).length > 0) throw new UsageError(t("--header 仅适用于 http 服务器。"));
|
|
180
|
+
const [command, ...args] = rest;
|
|
181
|
+
return {
|
|
182
|
+
name,
|
|
183
|
+
scope,
|
|
184
|
+
config: {
|
|
185
|
+
command,
|
|
186
|
+
...(args.length > 0 ? { args } : {}),
|
|
187
|
+
...(Object.keys(env).length > 0 ? { env } : {}),
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export function parseRemoveArgs(tokens: string[]): McpRemoveSpec {
|
|
193
|
+
let scope: McpConfigScope | undefined;
|
|
194
|
+
const positional: string[] = [];
|
|
195
|
+
let i = 0;
|
|
196
|
+
while (i < tokens.length) {
|
|
197
|
+
const token = tokens[i];
|
|
198
|
+
i += 1;
|
|
199
|
+
if (token === "--scope" || token.startsWith("--scope=")) {
|
|
200
|
+
const inline = token.startsWith("--scope=") ? token.slice("--scope=".length) : undefined;
|
|
201
|
+
let value: string;
|
|
202
|
+
if (inline !== undefined) value = inline;
|
|
203
|
+
else {
|
|
204
|
+
if (i >= tokens.length) throw new UsageError(`--scope${t(" 缺少值。")}\n${REMOVE_USAGE}`);
|
|
205
|
+
value = tokens[i];
|
|
206
|
+
i += 1;
|
|
207
|
+
}
|
|
208
|
+
scope = parseScopeValue(value);
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
if (token.startsWith("-")) throw new UsageError(`${t("未知参数:")}${token}\n${REMOVE_USAGE}`);
|
|
212
|
+
positional.push(token);
|
|
213
|
+
}
|
|
214
|
+
const name = positional[0];
|
|
215
|
+
if (!name || positional.length > 1) throw new UsageError(REMOVE_USAGE);
|
|
216
|
+
assertValidName(name);
|
|
217
|
+
return { name, scope };
|
|
218
|
+
}
|