@mcpc-tech/unplugin-dev-inspector-mcp 0.0.38 → 0.0.39
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/README.md +117 -9
- package/client/dist/inspector.iife.js +10 -6
- package/dist/config-updater.cjs +98 -19
- package/dist/config-updater.js +98 -19
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +19 -4
- package/dist/index.js +3 -0
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ Works with any MCP-compatible AI client. Supports ACP agents: **Claude Code**, *
|
|
|
20
20
|
- [Quick Start](#-quick-start)
|
|
21
21
|
- [Framework Support](#framework-support)
|
|
22
22
|
- [Configuration](#-configuration)
|
|
23
|
+
- [Agent Installation](#agent-installation)
|
|
23
24
|
- [How It Works](#-what-it-does)
|
|
24
25
|
- [Workflow Modes](#-two-workflow-modes)
|
|
25
26
|
- [MCP Tools](#-mcp-tools)
|
|
@@ -54,17 +55,22 @@ Switch between agents (Claude Code, Goose) and track their debugging progress vi
|
|
|
54
55
|
### Installation
|
|
55
56
|
|
|
56
57
|
```bash
|
|
57
|
-
# npm
|
|
58
|
+
# npm - basic installation
|
|
58
59
|
npm i -D @mcpc-tech/unplugin-dev-inspector-mcp
|
|
59
60
|
|
|
60
|
-
# pnpm
|
|
61
|
+
# pnpm - basic installation
|
|
61
62
|
pnpm add -D @mcpc-tech/unplugin-dev-inspector-mcp
|
|
62
63
|
|
|
63
|
-
# yarn
|
|
64
|
+
# yarn - basic installation
|
|
64
65
|
yarn add -D @mcpc-tech/unplugin-dev-inspector-mcp
|
|
65
66
|
```
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
> **Note:** If you don't need the ACP agents (Inspector Bar mode), add `--no-optional` to skip installing agent packages:
|
|
69
|
+
> ```bash
|
|
70
|
+
> npm i -D @mcpc-tech/unplugin-dev-inspector-mcp --no-optional
|
|
71
|
+
> pnpm add -D @mcpc-tech/unplugin-dev-inspector-mcp --no-optional
|
|
72
|
+
> yarn add -D @mcpc-tech/unplugin-dev-inspector-mcp --no-optional
|
|
73
|
+
> ```
|
|
68
74
|
|
|
69
75
|
### ⚡ Automated Setup (Recommended)
|
|
70
76
|
|
|
@@ -289,6 +295,90 @@ DevInspector.vite({
|
|
|
289
295
|
})
|
|
290
296
|
```
|
|
291
297
|
|
|
298
|
+
### Agent Installation
|
|
299
|
+
|
|
300
|
+
DevInspector supports multiple AI agents via [ACP](https://agentclientprotocol.com).
|
|
301
|
+
|
|
302
|
+
**For npm-based agents** (Claude Code, Codex CLI, Cursor Agent, Droid), you can pre-install them as dev dependencies for faster loading.
|
|
303
|
+
|
|
304
|
+
**For system-level agents**, install globally:
|
|
305
|
+
|
|
306
|
+
#### Gemini CLI
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
npm install -g @google/gemini-cli
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
[Documentation →](https://github.com/google-gemini/gemini-cli)
|
|
313
|
+
|
|
314
|
+
#### Kimi CLI
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
uv tool install --python 3.13 kimi-cli
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
[Documentation →](https://github.com/MoonshotAI/kimi-cli)
|
|
321
|
+
|
|
322
|
+
#### Goose
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
pipx install goose-ai
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
[Documentation →](https://block.github.io/goose/docs/guides/acp-clients)
|
|
329
|
+
|
|
330
|
+
#### Opencode
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
curl -fsSL https://opencode.ai/install | bash
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
[Documentation →](https://github.com/sst/opencode)
|
|
337
|
+
|
|
338
|
+
#### CodeBuddy Code
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
npm install -g @tencent-ai/codebuddy-code
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
[Documentation →](https://copilot.tencent.com/docs/cli/acp)
|
|
345
|
+
|
|
346
|
+
> **Note:** If you don't pre-install npm-based agents, they will be launched via `npx` on first use (slower startup).
|
|
347
|
+
|
|
348
|
+
#### Pre-installing npm-based Agents (Recommended)
|
|
349
|
+
|
|
350
|
+
The recommended way is to install agents during initial setup (see [Installation](#installation) above).
|
|
351
|
+
|
|
352
|
+
Alternatively, install them later as dev dependencies:
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
# npm
|
|
356
|
+
npm i -D @zed-industries/claude-code-acp
|
|
357
|
+
|
|
358
|
+
# pnpm
|
|
359
|
+
pnpm add -D @zed-industries/claude-code-acp
|
|
360
|
+
|
|
361
|
+
# Or add directly to package.json
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
```json
|
|
365
|
+
{
|
|
366
|
+
"devDependencies": {
|
|
367
|
+
"@zed-industries/claude-code-acp": "^0.12.4",
|
|
368
|
+
"@zed-industries/codex-acp": "^0.7.1",
|
|
369
|
+
"@blowmage/cursor-agent-acp": "^0.1.0",
|
|
370
|
+
"@yaonyan/droid-acp": "^0.0.8"
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
> **About optionalDependencies:** Agent packages are installed by default. If you don't need them, use `--no-optional` when installing.
|
|
376
|
+
|
|
377
|
+
**Why install as `devDependencies`?**
|
|
378
|
+
- Ensures faster startup (uses local package via `require.resolve` instead of `npx`)
|
|
379
|
+
- Won't affect production bundle (tree-shaken out unless imported)
|
|
380
|
+
- Standard practice for development tools
|
|
381
|
+
|
|
292
382
|
### Custom Agents
|
|
293
383
|
|
|
294
384
|
This plugin uses the [Agent Client Protocol (ACP)](https://agentclientprotocol.com) to connect with AI agents.
|
|
@@ -297,7 +387,7 @@ This plugin uses the [Agent Client Protocol (ACP)](https://agentclientprotocol.c
|
|
|
297
387
|
|
|
298
388
|
Default agents: [View configuration →](https://github.com/mcpc-tech/dev-inspector-mcp/blob/main/packages/unplugin-dev-inspector/client/constants/agents.ts)
|
|
299
389
|
|
|
300
|
-
You can customize available AI agents and set a default agent:
|
|
390
|
+
You can customize available AI agents, filter visible agents, and set a default agent:
|
|
301
391
|
|
|
302
392
|
```typescript
|
|
303
393
|
// vite.config.ts
|
|
@@ -305,7 +395,11 @@ export default {
|
|
|
305
395
|
plugins: [
|
|
306
396
|
DevInspector.vite({
|
|
307
397
|
enabled: true,
|
|
308
|
-
|
|
398
|
+
|
|
399
|
+
// Option 1: Only show specific agents (filters merged agents)
|
|
400
|
+
visibleAgents: ['Claude Code', 'Gemini CLI', 'Goose'],
|
|
401
|
+
|
|
402
|
+
// Option 2: Add custom agents (merges with defaults)
|
|
309
403
|
agents: [
|
|
310
404
|
{
|
|
311
405
|
name: "Claude Code", // Matches default - auto-fills icon and env
|
|
@@ -320,6 +414,19 @@ export default {
|
|
|
320
414
|
meta: { icon: "https://example.com/icon.svg" }
|
|
321
415
|
}
|
|
322
416
|
],
|
|
417
|
+
|
|
418
|
+
// Option 3: Combine both - add custom agents and filter visibility
|
|
419
|
+
agents: [
|
|
420
|
+
{
|
|
421
|
+
name: "My Custom Agent",
|
|
422
|
+
command: "my-agent-cli",
|
|
423
|
+
args: ["--mode", "acp"],
|
|
424
|
+
env: [{ key: "MY_API_KEY", required: true }],
|
|
425
|
+
meta: { icon: "https://example.com/icon.svg" }
|
|
426
|
+
}
|
|
427
|
+
],
|
|
428
|
+
visibleAgents: ['Claude Code', 'My Custom Agent'], // Only show these
|
|
429
|
+
|
|
323
430
|
// Set default agent to show on startup
|
|
324
431
|
defaultAgent: "Claude Code"
|
|
325
432
|
}),
|
|
@@ -329,9 +436,10 @@ export default {
|
|
|
329
436
|
|
|
330
437
|
**Key Features:**
|
|
331
438
|
|
|
332
|
-
-
|
|
333
|
-
-
|
|
334
|
-
-
|
|
439
|
+
- **`agents`**: Merges your custom agents with defaults. Agents with the **same name** as [default agents](https://agentclientprotocol.com/overview/agents) automatically inherit missing properties (icons, env)
|
|
440
|
+
- **`visibleAgents`**: Filters which agents appear in the UI (applies after merging). Great for limiting options to only what your team uses
|
|
441
|
+
- **`defaultAgent`**: Sets which agent is selected on startup
|
|
442
|
+
- If no custom agents provided, defaults are: Claude Code, Codex CLI, Gemini CLI, Kimi CLI, Goose, Opencode, Cursor Agent, Droid, CodeBuddy Code
|
|
335
443
|
|
|
336
444
|
## What It Does
|
|
337
445
|
|
|
@@ -59,7 +59,7 @@ update_inspection_status({
|
|
|
59
59
|
\`\`\``,inputSchema:{type:`object`,properties:{inspectionId:{type:`string`,description:`Optional inspection ID. If not provided, uses the current active inspection.`},status:{type:`string`,enum:[`in-progress`,`completed`,`failed`,`deleted`],description:`Current status: 'in-progress' for updates, 'completed' when resolved, 'failed' if unresolvable, 'deleted' to remove inspection`},progress:{type:`object`,properties:{steps:{type:`array`,items:{type:`object`,properties:{id:{type:`number`},title:{type:`string`},status:{type:`string`,enum:[`pending`,`in-progress`,`completed`,`failed`]}},required:[`id`,`title`,`status`]}}},description:`Optional step-by-step progress tracking`},message:{type:`string`,description:`Summary of findings or resolution. REQUIRED when status is 'completed' or 'failed'`}},required:[`status`]}},execute_page_script:{name:`execute_page_script`,description:`Execute JavaScript in browser context (synchronous only, must return value). Access: window, document, DOM APIs, React/Vue instances, localStorage. For deeper diagnostics, use chrome_devtools MCP (Network.getHAR, Console.getMessages, Performance.getMetrics, Debugger, HeapProfiler).`,inputSchema:{type:`object`,properties:{code:{type:`string`,description:`JavaScript code to execute in page context. Must return a value for diagnostic output.`}},required:[`code`]}}},Oc={claude:`<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Claude</title><path d="M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z" fill="#D97757" fill-rule="nonzero"></path></svg>`,openai:`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>OpenAI</title><path d="M21.55 10.004a5.416 5.416 0 00-.478-4.501c-1.217-2.09-3.662-3.166-6.05-2.66A5.59 5.59 0 0010.831 1C8.39.995 6.224 2.546 5.473 4.838A5.553 5.553 0 001.76 7.496a5.487 5.487 0 00.691 6.5 5.416 5.416 0 00.477 4.502c1.217 2.09 3.662 3.165 6.05 2.66A5.586 5.586 0 0013.168 23c2.443.006 4.61-1.546 5.361-3.84a5.553 5.553 0 003.715-2.66 5.488 5.488 0 00-.693-6.497v.001zm-8.381 11.558a4.199 4.199 0 01-2.675-.954c.034-.018.093-.05.132-.074l4.44-2.53a.71.71 0 00.364-.623v-6.176l1.877 1.069c.02.01.033.029.036.05v5.115c-.003 2.274-1.87 4.118-4.174 4.123zM4.192 17.78a4.059 4.059 0 01-.498-2.763c.032.02.09.055.131.078l4.44 2.53c.225.13.504.13.73 0l5.42-3.088v2.138a.068.068 0 01-.027.057L9.9 19.288c-1.999 1.136-4.552.46-5.707-1.51h-.001zM3.023 8.216A4.15 4.15 0 015.198 6.41l-.002.151v5.06a.711.711 0 00.364.624l5.42 3.087-1.876 1.07a.067.067 0 01-.063.005l-4.489-2.559c-1.995-1.14-2.679-3.658-1.53-5.63h.001zm15.417 3.54l-5.42-3.088L14.896 7.6a.067.067 0 01.063-.006l4.489 2.557c1.998 1.14 2.683 3.662 1.529 5.633a4.163 4.163 0 01-2.174 1.807V12.38a.71.71 0 00-.363-.623zm1.867-2.773a6.04 6.04 0 00-.132-.078l-4.44-2.53a.731.731 0 00-.729 0l-5.42 3.088V7.325a.068.068 0 01.027-.057L14.1 4.713c2-1.137 4.555-.46 5.707 1.513.487.833.664 1.809.499 2.757h.001zm-11.741 3.81l-1.877-1.068a.065.065 0 01-.036-.051V6.559c.001-2.277 1.873-4.122 4.181-4.12.976 0 1.92.338 2.671.954-.034.018-.092.05-.131.073l-4.44 2.53a.71.71 0 00-.365.623l-.003 6.173v.002zm1.02-2.168L12 9.25l2.414 1.375v2.75L12 14.75l-2.415-1.375v-2.75z"></path></svg>`,gemini:`<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Gemini</title><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="#3186FF"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#lobe-icons-gemini-fill-0)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#lobe-icons-gemini-fill-1)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#lobe-icons-gemini-fill-2)"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-gemini-fill-0" x1="7" x2="11" y1="15.5" y2="12"><stop stop-color="#08B962"></stop><stop offset="1" stop-color="#08B962" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-gemini-fill-1" x1="8" x2="11.5" y1="5.5" y2="11"><stop stop-color="#F94543"></stop><stop offset="1" stop-color="#F94543" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-gemini-fill-2" x1="3.5" x2="17.5" y1="13.5" y2="12"><stop stop-color="#FABC12"></stop><stop offset=".46" stop-color="#FABC12" stop-opacity="0"></stop></linearGradient></defs></svg>`,moonshot:`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>MoonshotAI</title><path d="M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z"></path></svg>`,goose:`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Goose</title><path d="M21.595 23.61c1.167-.254 2.405-.944 2.405-.944l-2.167-1.784a12.124 12.124 0 01-2.695-3.131 12.127 12.127 0 00-3.97-4.049l-.794-.462a1.115 1.115 0 01-.488-.815.844.844 0 01.154-.575c.413-.582 2.548-3.115 2.94-3.44.503-.416 1.065-.762 1.586-1.159.074-.056.148-.112.221-.17.003-.002.007-.004.009-.007.167-.131.325-.272.45-.438.453-.524.563-.988.59-1.193-.061-.197-.244-.639-.753-1.148.319.02.705.272 1.056.569.235-.376.481-.773.727-1.171.165-.266-.08-.465-.086-.471h-.001V3.22c-.007-.007-.206-.25-.471-.086-.567.35-1.134.702-1.639 1.021 0 0-.597-.012-1.305.599a2.464 2.464 0 00-.438.45l-.007.009c-.058.072-.114.147-.17.221-.397.521-.743 1.083-1.16 1.587-.323.391-2.857 2.526-3.44 2.94a.842.842 0 01-.574.153 1.115 1.115 0 01-.815-.488l-.462-.794a12.123 12.123 0 00-4.049-3.97 12.133 12.133 0 01-3.13-2.695L1.332 0S.643 1.238.39 2.405c.352.428 1.27 1.49 2.34 2.302C1.58 4.167.73 3.75.06 3.4c-.103.765-.063 1.92.043 2.816.726.317 1.961.806 3.219 1.066-1.006.236-2.11.278-2.961.262.15.554.358 1.119.64 1.688.119.263.25.52.39.77.452.125 2.222.383 3.164.171l-2.51.897a27.776 27.776 0 002.544 2.726c2.031-1.092 2.494-1.241 4.018-2.238-2.467 2.008-3.108 2.828-3.8 3.67l-.483.678c-.25.351-.469.725-.65 1.117-.61 1.31-1.47 4.1-1.47 4.1-.154.486.202.842.674.674 0 0 2.79-.861 4.1-1.47.392-.182.766-.4 1.118-.65l.677-.483c.227-.187.453-.37.701-.586 0 0 1.705 2.02 3.458 3.349l.896-2.511c-.211.942.046 2.712.17 3.163.252.142.509.272.772.392.569.28 1.134.49 1.688.64-.016-.853.026-1.956.261-2.962.26 1.258.75 2.493 1.067 3.219.895.106 2.051.146 2.816.043a73.87 73.87 0 01-1.308-2.67c.811 1.07 1.874 1.988 2.302 2.34h-.001z"></path></svg>`,cursor:`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Cursor</title><path d="M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"></path></svg>`,droid:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="1em" height="1em" style="flex:none;line-height:1">
|
|
60
60
|
<path d="M13.9062 3.20484C13.8706 3.19623 13.8373 3.18019 13.8086 3.15788C13.7799 3.13552 13.7565 3.10743 13.74 3.07546C13.7234 3.04349 13.7142 3.00841 13.7128 2.97263C13.7115 2.93682 13.7181 2.90121 13.7322 2.86815C14.2188 1.71337 14.4334 0.789376 14.087 0.402562C13.1693 -0.623688 9.48933 1.41705 8.31598 2.10822C8.28457 2.12665 8.24942 2.13825 8.21299 2.14222C8.17656 2.14618 8.13967 2.14242 8.10486 2.13122C8.07004 2.12003 8.03809 2.10163 8.01123 2.0773C7.98437 2.05297 7.96323 2.02326 7.94918 1.99024C7.45597 0.83788 6.93748 0.036362 6.41194 0.00160127C5.01894 -0.0913635 3.89616 3.88951 3.56749 5.18697C3.5587 5.22173 3.54233 5.25423 3.5195 5.2822C3.49662 5.31021 3.46781 5.33305 3.43507 5.34918C3.40233 5.3653 3.36639 5.37432 3.32971 5.37561C3.29307 5.37694 3.25656 5.37052 3.22266 5.35677C2.03854 4.88225 1.09066 4.67288 0.694439 5.01078C-0.35788 5.90567 1.73432 9.49452 2.44305 10.6388C2.462 10.6694 2.47393 10.7037 2.47804 10.7392C2.48214 10.7748 2.47833 10.8108 2.46684 10.8447C2.45536 10.8787 2.43646 10.9099 2.41147 10.9361C2.38648 10.9623 2.35598 10.9828 2.32203 10.9965C1.14081 11.4775 0.318936 11.9831 0.282878 12.4956C0.187966 13.8541 4.26959 14.9491 5.60043 15.2696C5.63599 15.2783 5.66919 15.2943 5.69783 15.3167C5.72642 15.339 5.7498 15.3671 5.76625 15.399C5.78275 15.4309 5.79199 15.4659 5.79332 15.5016C5.79469 15.5373 5.78814 15.5729 5.77409 15.6059C5.28751 16.7607 5.07282 17.6851 5.41931 18.0715C6.33693 19.0977 10.0173 17.0574 11.1907 16.3662C11.2221 16.3477 11.2573 16.3361 11.2937 16.3321C11.3302 16.3281 11.3671 16.3318 11.4019 16.343C11.4368 16.3542 11.4687 16.3727 11.4955 16.397C11.5224 16.4214 11.5435 16.4511 11.5575 16.4842C12.0507 17.6362 12.5688 18.4377 13.0947 18.4729C14.4877 18.5654 15.6105 14.5849 15.9388 13.2871C15.9476 13.2524 15.9641 13.2199 15.987 13.192C16.0099 13.164 16.0388 13.1412 16.0716 13.1251C16.1043 13.1091 16.1403 13.1001 16.177 13.0988C16.2136 13.0975 16.2502 13.1039 16.284 13.1177C17.4681 13.5922 18.4156 13.8012 18.8122 13.4637C19.8646 12.5688 17.7719 8.97953 17.0632 7.83525C17.0444 7.80462 17.0326 7.77034 17.0286 7.73485C17.0245 7.69932 17.0284 7.66335 17.0399 7.62944C17.0514 7.59549 17.0702 7.56436 17.0951 7.53817C17.12 7.51198 17.1504 7.49129 17.1842 7.47758C18.3659 6.99659 19.1877 6.4909 19.2234 5.97838C19.3187 4.61989 15.2367 3.52497 13.9062 3.20484ZM12.3081 1.90249C12.5758 2.37055 11.1961 5.48935 10.1699 7.67079C10.1527 7.70725 10.1245 7.73772 10.0891 7.75809C10.0536 7.77847 10.0126 7.78776 9.97155 7.78473C9.93052 7.7817 9.8914 7.76646 9.85952 7.74112C9.82761 7.71573 9.80444 7.68146 9.79313 7.64286C9.37866 6.22454 8.90493 4.55809 8.39805 3.14341C8.37815 3.08787 8.37915 3.02724 8.40087 2.97239C8.42258 2.9175 8.46361 2.87195 8.51658 2.84386C9.78235 2.16966 11.9483 1.27437 12.3081 1.90249ZM6.24201 2.28849C6.77045 2.43481 8.05612 5.59161 8.91198 7.84176C8.92628 7.87935 8.92839 7.9203 8.91811 7.95914C8.90779 7.99794 8.88558 8.03274 8.85441 8.0589C8.8232 8.08505 8.78457 8.10126 8.74367 8.10534C8.70276 8.10946 8.66156 8.10126 8.62559 8.08185C7.30304 7.36603 5.76082 6.51318 4.37652 5.86242C4.32231 5.83676 4.27921 5.79322 4.25483 5.73947C4.23046 5.68575 4.22644 5.62532 4.24348 5.56898C4.65089 4.22058 5.53204 2.09246 6.24201 2.28849ZM2.23251 6.74474C2.71204 6.48363 5.91044 7.82923 8.14688 8.83002C8.18431 8.84675 8.21556 8.87424 8.23645 8.90884C8.25734 8.94339 8.26687 8.98341 8.26376 9.02343C8.26061 9.06344 8.24503 9.10156 8.219 9.13268C8.19301 9.16376 8.15787 9.1864 8.11828 9.19743C6.66435 9.60162 4.95511 10.0636 3.50449 10.558C3.44763 10.5772 3.38554 10.5762 3.32938 10.555C3.27322 10.5339 3.22655 10.4939 3.19779 10.4423C2.50771 9.2079 1.58802 7.09558 2.23251 6.74474ZM2.62832 12.6606C2.77794 12.1452 6.0153 10.8914 8.32261 10.0567C8.36116 10.0428 8.40319 10.0407 8.44297 10.0508C8.4828 10.0608 8.51849 10.0825 8.5453 10.1129C8.57208 10.1433 8.58874 10.181 8.59293 10.2209C8.59711 10.2607 8.5887 10.3009 8.56881 10.336C7.83438 11.6258 6.95986 13.1298 6.29258 14.4794C6.26651 14.5325 6.22187 14.5747 6.16671 14.5986C6.11158 14.6224 6.04954 14.6263 5.99168 14.6096C4.60903 14.2147 2.42689 13.353 2.62832 12.6606ZM7.19776 16.5707C6.92961 16.1031 8.30977 12.9839 9.33597 10.8029C9.35313 10.7664 9.38136 10.7359 9.41679 10.7155C9.45227 10.6952 9.49326 10.6859 9.53429 10.6889C9.57537 10.6919 9.61445 10.7072 9.64632 10.7325C9.67824 10.7579 9.7014 10.7922 9.71272 10.8308C10.1272 12.2487 10.6009 13.9156 11.1078 15.3303C11.1276 15.3858 11.1265 15.4463 11.1047 15.5011C11.0829 15.5559 11.0418 15.6014 10.9888 15.6294C9.7235 16.3023 7.5571 17.1993 7.19901 16.5707H7.19776ZM13.2638 16.1847C12.735 16.0388 11.4493 12.8817 10.5935 10.6315C10.5791 10.5938 10.5769 10.5528 10.5872 10.5139C10.5975 10.475 10.6198 10.4401 10.6511 10.414C10.6823 10.3878 10.7211 10.3716 10.762 10.3676C10.803 10.3635 10.8443 10.3719 10.8803 10.3914C12.2024 11.1072 13.745 11.9605 15.1289 12.6113C15.1832 12.6368 15.2264 12.6803 15.2508 12.7341C15.2752 12.7878 15.2792 12.8483 15.262 12.9047C14.855 14.2551 13.9738 16.3811 13.2638 16.1847ZM17.2733 11.7285C16.7934 11.99 13.5954 10.644 11.3586 9.64322C11.3211 9.62648 11.2899 9.599 11.269 9.5644C11.2481 9.52984 11.2386 9.48983 11.2417 9.44981C11.2448 9.40979 11.2604 9.37168 11.2864 9.34056C11.3124 9.30947 11.3476 9.28688 11.3871 9.27584C12.8415 8.87165 14.5503 8.40962 16.0009 7.91529C16.0579 7.89601 16.1201 7.89706 16.1763 7.91832C16.2326 7.93958 16.2793 7.97963 16.3081 8.03133C16.9977 9.26534 17.9174 11.378 17.2733 11.7285ZM16.8775 5.81266C16.7275 6.32842 13.4905 7.58227 11.1832 8.41693C11.1446 8.43092 11.1025 8.43302 11.0627 8.42299C11.0228 8.41293 10.987 8.39122 10.9602 8.36075C10.9334 8.33027 10.9168 8.29248 10.9126 8.2525C10.9085 8.21257 10.917 8.17231 10.937 8.13719C11.6711 6.84781 12.5456 5.3434 13.2129 3.99379C13.2391 3.94088 13.2837 3.8988 13.3389 3.87504C13.394 3.85127 13.456 3.84735 13.5138 3.86404C14.8964 4.26096 17.0785 5.12028 16.8775 5.81266Z" fill="currentColor" style="translate: none; rotate: none; scale: none; transform-origin: 0px 0px 0px; filter: drop-shadow(rgb(255, 255, 255) 0px 0px 0px); opacity: 1;" data-svg-origin="9.75314524769783 9.237242697738111" transform="matrix(1,0,0,1,0,0)"></path>
|
|
61
61
|
</svg>
|
|
62
|
-
`,opencode:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAADWklEQVR4nGKRktJjGEyAaaAdgA5GHUQIjDqIEBh1ECEw6iBCYNRBhMCgcxALkeoc7C3zchK5ubnIsOP48bMNzf1EKmYkprYXEhI4enA9Hx/PxUvXDh859f//f+JdE+jvwcvLraXnTKR6okKoqCCVj4/n/v1HAUEpv37/Jt41/Hy8oSE+fRNmE6+FcBpSU1WKjQ5mYGC4fPUmSa5hYGCoqy188eLV/IWriNdCOIQa6gpZWJhJcgcE2NmaBwW4e/jE/f37j2oOcnW2tbezwCrFz8+XEB8qyM+HS6+Pj8uPHz8jw/0YYEnu379/O3YdOHX6IvkOqq7MxSU1a3q7srLC2nXbfvz4iVXB0mXr0UT0dDWXLJxkYOLx7dt3chzEwcGuqqqIVSrA393czNDVI+r2nQd4TEADQoL8ly/sERTgx+MgfImakZERqzg3N2dNVd6yFRtJcg0DAwMxiYmEklpIkB/CyMtJ4uPlmTBxDkmuIRIQW1IzMDBYWZqkpURdvnIjLSX6zNmLIiJCIiJCBHX9Z2C4d+/hz5+/iLQFX0nNyclx58ZhZJF/IPD/P8P////+MzD8hwEoC5chp05fCA5Lh5ST1y7vM7P0ffrsBS5LiQ2hHz9+5hfVb9+xn6RChYGBYeWyaSRVNfgchJyoG5r6tmzdS5JTGBgYHB0sLcwN3b1iiNdCVKJet3774qXrSHUNGxtrU33xvAUrb9y8CxFhZmYCpyp8AYYvhP7+/csADu2qmk40KStLYxNj/M0ERhtrUyUlee0Xr/NyEiFChgY6//79//zpC5kO+vnz17adB7w8HPfsXP7l61dkKSVFudNnLl2/cRuP9us3bkMUCAsLMjAw8HBzu7nYXrl26/OXr/j8gb89xMjIaKCvxcrKiizY1lz29dv3oNBUkhK4sLDg2ZPbCoobNmzciUcZgVz2////8xeuIosE+LvLykq5ekaTmt0a6grPX7iC3zWkFYwMDAwiwoItjSWNzRMePXpKkkZrKxN/P3dv3ziCKklzUFFh2rdvP46fPKugIEu8LilJ8e6O6tWrt1y+cpPKDrp+/ba7q926VbNI0vXnz9+jx07XNfYSo5ioRj49waDrl406iBAYdRAhMOogQmDUQYTAqIMIgUHnIEAAAAD//xjiMCmHkZcfAAAAAElFTkSuQmCC`,codebuddy:`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none"><g clip-path="url(#clip0_830_6638)"><rect width="32" height="32" rx="6.90526" fill="url(#paint0_linear_830_6638)"></rect><g filter="url(#filter0_f_830_6638)"><circle cx="10.0861" cy="27.9835" r="11.2648" fill="#28B894" fill-opacity="0.4"></circle></g><g filter="url(#filter1_f_830_6638)"><circle cx="26.6723" cy="34.895" r="10.2963" fill="#28B894"></circle></g><path d="M24.4736 2.50224C24.7872 2.22094 24.8063 2.20926 25.0362 2.19546C25.4089 2.16822 25.7503 2.34741 26.3314 2.87637C27.6892 4.11019 29.5803 6.64682 30.7558 8.81306L31.2096 9.65385L31.8518 9.9732C32.4712 10.2862 33.4867 10.9279 33.9109 11.272C34.1027 11.4306 34.13 11.4338 34.3294 11.3562C35.2298 11.0056 36.5196 11.4703 37.6573 12.5618C38.6815 13.5434 39.6628 15.2201 40.0386 16.6199C40.0935 16.8452 40.1656 17.3298 40.1921 17.6905C40.2778 18.9568 39.8722 19.9685 39.0902 20.4264C38.9304 20.5186 38.9197 20.5434 38.9242 20.9417C38.9603 22.8383 38.4489 24.7316 37.4219 26.5778C36.2625 28.6509 34.1977 30.7958 31.4037 32.8162C29.9032 33.9081 26.3539 35.9762 24.7491 36.7022C20.9046 38.4331 17.8221 39.0965 15.145 38.7685C13.5483 38.5749 11.7415 37.9516 10.6721 37.2282C10.3906 37.0336 10.3455 37.0216 10.1305 37.0831C8.98558 37.412 7.48603 36.7359 6.21222 35.3219C5.70416 34.7565 4.88467 33.3691 4.61888 32.6266C4.00401 30.8887 4.1254 29.3203 4.94436 28.3837C5.15595 28.1425 5.16291 28.1326 5.11671 27.7272C5.04038 27.0631 5.00615 26.0799 5.04102 25.4457L5.06891 24.8533L4.17863 23.2801C2.80144 20.8296 1.92687 18.7717 1.58932 17.1996C1.41119 16.3377 1.42249 15.9551 1.64114 15.6721C1.77434 15.5012 2.21128 15.3234 2.73792 15.2261C4.06379 14.9934 6.95525 15.2039 10.1717 15.7718L10.5056 15.8305L11.2401 15.1809C12.459 14.1012 13.2686 13.4957 14.7613 12.5649C16.3172 11.5914 18.0733 10.7902 20.0507 10.1561L20.6856 9.95303L21.034 9.03695C22.2826 5.74089 23.5617 3.31103 24.4736 2.50224ZM14.0131 19.394C12.6022 20.2085 11.897 20.6164 11.3785 21.0729C9.27869 22.922 8.49391 25.8508 9.38789 28.502C9.60867 29.1567 10.0158 29.8629 10.8305 31.2742C11.6451 32.6851 12.053 33.3903 12.5095 33.9087C14.3585 36.0086 17.2873 36.7933 19.9386 35.8994C20.5931 35.6786 21.299 35.2718 22.7099 34.4572L30.8289 29.7697C32.2401 28.955 32.9458 28.5468 33.4643 28.0903C35.5641 26.2412 36.3489 23.3124 35.4549 20.6612C35.2342 20.0066 34.8273 19.3008 34.0128 17.8899C33.198 16.4787 32.7899 15.773 32.3333 15.2545C30.4843 13.1546 27.5555 12.3699 24.9042 13.2638C24.2496 13.4846 23.5433 13.8917 22.1321 14.7065L14.0131 19.394Z" fill="url(#paint1_linear_830_6638)"></path><rect x="14.7959" y="25.0674" width="3.20723" height="6.66117" rx="1.60361" transform="rotate(-30 14.7959 25.0674)" fill="white"></rect><rect x="23.4492" y="20.0713" width="3.20723" height="6.66117" rx="1.60361" transform="rotate(-30 23.4492 20.0713)" fill="white"></rect></g><defs><filter id="filter0_f_830_6638" x="-11.9327" y="5.96479" width="44.0372" height="44.0372" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="5.37698" result="effect1_foregroundBlur_830_6638"></feGaussianBlur></filter><filter id="filter1_f_830_6638" x="7.57568" y="15.7983" width="38.1934" height="38.1934" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="4.40015" result="effect1_foregroundBlur_830_6638"></feGaussianBlur></filter><linearGradient id="paint0_linear_830_6638" x1="16" y1="0" x2="16" y2="32" gradientUnits="userSpaceOnUse"><stop stop-color="#6C4DFF"></stop><stop offset="1" stop-color="#583ED3"></stop></linearGradient><linearGradient id="paint1_linear_830_6638" x1="13.3307" y1="8.86225" x2="28.3004" y2="34.7904" gradientUnits="userSpaceOnUse"><stop stop-color="white" stop-opacity="0.8"></stop><stop offset="0.437689" stop-color="white"></stop></linearGradient><clipPath id="clip0_830_6638"><rect width="32" height="32" rx="6.90526" fill="white"></rect></clipPath></defs></svg>`};function kc(e){return`data:image/svg+xml,${encodeURIComponent(e)}`}let Ac=[{name:`Claude Code`,command:`npx`,args:[`-y`,`@zed-industries/claude-code-acp`],env:[{key:`ANTHROPIC_API_KEY`,required:!1},{key:`ANTHROPIC_BASE_URL`,required:!1}],configHint:`Anthropic's official CLI agent via Zed adapter`,configLink:`https://github.com/zed-industries/claude-code-acp`,meta:{icon:kc(Oc.claude)}},{name:`Codex CLI`,command:`npx`,args:[`-y`,`@zed-industries/codex-acp`],env:[{key:`OPENAI_API_KEY`,required:!1}],configHint:`OpenAI Codex CLI via Zed adapter`,configLink:`https://github.com/zed-industries/codex-acp`,meta:{icon:kc(Oc.openai)}},{name:`Gemini CLI`,command:`
|
|
62
|
+
`,opencode:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAADWklEQVR4nGKRktJjGEyAaaAdgA5GHUQIjDqIEBh1ECEw6iBCYNRBhMCgcxALkeoc7C3zchK5ubnIsOP48bMNzf1EKmYkprYXEhI4enA9Hx/PxUvXDh859f//f+JdE+jvwcvLraXnTKR6okKoqCCVj4/n/v1HAUEpv37/Jt41/Hy8oSE+fRNmE6+FcBpSU1WKjQ5mYGC4fPUmSa5hYGCoqy188eLV/IWriNdCOIQa6gpZWJhJcgcE2NmaBwW4e/jE/f37j2oOcnW2tbezwCrFz8+XEB8qyM+HS6+Pj8uPHz8jw/0YYEnu379/O3YdOHX6IvkOqq7MxSU1a3q7srLC2nXbfvz4iVXB0mXr0UT0dDWXLJxkYOLx7dt3chzEwcGuqqqIVSrA393czNDVI+r2nQd4TEADQoL8ly/sERTgx+MgfImakZERqzg3N2dNVd6yFRtJcg0DAwMxiYmEklpIkB/CyMtJ4uPlmTBxDkmuIRIQW1IzMDBYWZqkpURdvnIjLSX6zNmLIiJCIiJCBHX9Z2C4d+/hz5+/iLQFX0nNyclx58ZhZJF/IPD/P8P////+MzD8hwEoC5chp05fCA5Lh5ST1y7vM7P0ffrsBS5LiQ2hHz9+5hfVb9+xn6RChYGBYeWyaSRVNfgchJyoG5r6tmzdS5JTGBgYHB0sLcwN3b1iiNdCVKJet3774qXrSHUNGxtrU33xvAUrb9y8CxFhZmYCpyp8AYYvhP7+/csADu2qmk40KStLYxNj/M0ERhtrUyUlee0Xr/NyEiFChgY6//79//zpC5kO+vnz17adB7w8HPfsXP7l61dkKSVFudNnLl2/cRuP9us3bkMUCAsLMjAw8HBzu7nYXrl26/OXr/j8gb89xMjIaKCvxcrKiizY1lz29dv3oNBUkhK4sLDg2ZPbCoobNmzciUcZgVz2////8xeuIosE+LvLykq5ekaTmt0a6grPX7iC3zWkFYwMDAwiwoItjSWNzRMePXpKkkZrKxN/P3dv3ziCKklzUFFh2rdvP46fPKugIEu8LilJ8e6O6tWrt1y+cpPKDrp+/ba7q926VbNI0vXnz9+jx07XNfYSo5ioRj49waDrl406iBAYdRAhMOogQmDUQYTAqIMIgUHnIEAAAAD//xjiMCmHkZcfAAAAAElFTkSuQmCC`,codebuddy:`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none"><g clip-path="url(#clip0_830_6638)"><rect width="32" height="32" rx="6.90526" fill="url(#paint0_linear_830_6638)"></rect><g filter="url(#filter0_f_830_6638)"><circle cx="10.0861" cy="27.9835" r="11.2648" fill="#28B894" fill-opacity="0.4"></circle></g><g filter="url(#filter1_f_830_6638)"><circle cx="26.6723" cy="34.895" r="10.2963" fill="#28B894"></circle></g><path d="M24.4736 2.50224C24.7872 2.22094 24.8063 2.20926 25.0362 2.19546C25.4089 2.16822 25.7503 2.34741 26.3314 2.87637C27.6892 4.11019 29.5803 6.64682 30.7558 8.81306L31.2096 9.65385L31.8518 9.9732C32.4712 10.2862 33.4867 10.9279 33.9109 11.272C34.1027 11.4306 34.13 11.4338 34.3294 11.3562C35.2298 11.0056 36.5196 11.4703 37.6573 12.5618C38.6815 13.5434 39.6628 15.2201 40.0386 16.6199C40.0935 16.8452 40.1656 17.3298 40.1921 17.6905C40.2778 18.9568 39.8722 19.9685 39.0902 20.4264C38.9304 20.5186 38.9197 20.5434 38.9242 20.9417C38.9603 22.8383 38.4489 24.7316 37.4219 26.5778C36.2625 28.6509 34.1977 30.7958 31.4037 32.8162C29.9032 33.9081 26.3539 35.9762 24.7491 36.7022C20.9046 38.4331 17.8221 39.0965 15.145 38.7685C13.5483 38.5749 11.7415 37.9516 10.6721 37.2282C10.3906 37.0336 10.3455 37.0216 10.1305 37.0831C8.98558 37.412 7.48603 36.7359 6.21222 35.3219C5.70416 34.7565 4.88467 33.3691 4.61888 32.6266C4.00401 30.8887 4.1254 29.3203 4.94436 28.3837C5.15595 28.1425 5.16291 28.1326 5.11671 27.7272C5.04038 27.0631 5.00615 26.0799 5.04102 25.4457L5.06891 24.8533L4.17863 23.2801C2.80144 20.8296 1.92687 18.7717 1.58932 17.1996C1.41119 16.3377 1.42249 15.9551 1.64114 15.6721C1.77434 15.5012 2.21128 15.3234 2.73792 15.2261C4.06379 14.9934 6.95525 15.2039 10.1717 15.7718L10.5056 15.8305L11.2401 15.1809C12.459 14.1012 13.2686 13.4957 14.7613 12.5649C16.3172 11.5914 18.0733 10.7902 20.0507 10.1561L20.6856 9.95303L21.034 9.03695C22.2826 5.74089 23.5617 3.31103 24.4736 2.50224ZM14.0131 19.394C12.6022 20.2085 11.897 20.6164 11.3785 21.0729C9.27869 22.922 8.49391 25.8508 9.38789 28.502C9.60867 29.1567 10.0158 29.8629 10.8305 31.2742C11.6451 32.6851 12.053 33.3903 12.5095 33.9087C14.3585 36.0086 17.2873 36.7933 19.9386 35.8994C20.5931 35.6786 21.299 35.2718 22.7099 34.4572L30.8289 29.7697C32.2401 28.955 32.9458 28.5468 33.4643 28.0903C35.5641 26.2412 36.3489 23.3124 35.4549 20.6612C35.2342 20.0066 34.8273 19.3008 34.0128 17.8899C33.198 16.4787 32.7899 15.773 32.3333 15.2545C30.4843 13.1546 27.5555 12.3699 24.9042 13.2638C24.2496 13.4846 23.5433 13.8917 22.1321 14.7065L14.0131 19.394Z" fill="url(#paint1_linear_830_6638)"></path><rect x="14.7959" y="25.0674" width="3.20723" height="6.66117" rx="1.60361" transform="rotate(-30 14.7959 25.0674)" fill="white"></rect><rect x="23.4492" y="20.0713" width="3.20723" height="6.66117" rx="1.60361" transform="rotate(-30 23.4492 20.0713)" fill="white"></rect></g><defs><filter id="filter0_f_830_6638" x="-11.9327" y="5.96479" width="44.0372" height="44.0372" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="5.37698" result="effect1_foregroundBlur_830_6638"></feGaussianBlur></filter><filter id="filter1_f_830_6638" x="7.57568" y="15.7983" width="38.1934" height="38.1934" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="4.40015" result="effect1_foregroundBlur_830_6638"></feGaussianBlur></filter><linearGradient id="paint0_linear_830_6638" x1="16" y1="0" x2="16" y2="32" gradientUnits="userSpaceOnUse"><stop stop-color="#6C4DFF"></stop><stop offset="1" stop-color="#583ED3"></stop></linearGradient><linearGradient id="paint1_linear_830_6638" x1="13.3307" y1="8.86225" x2="28.3004" y2="34.7904" gradientUnits="userSpaceOnUse"><stop stop-color="white" stop-opacity="0.8"></stop><stop offset="0.437689" stop-color="white"></stop></linearGradient><clipPath id="clip0_830_6638"><rect width="32" height="32" rx="6.90526" fill="white"></rect></clipPath></defs></svg>`};function kc(e){return`data:image/svg+xml,${encodeURIComponent(e)}`}let Ac=[{name:`Claude Code`,command:`npx`,args:[`-y`,`@zed-industries/claude-code-acp`],env:[{key:`ANTHROPIC_API_KEY`,required:!1},{key:`ANTHROPIC_BASE_URL`,required:!1}],configHint:`Anthropic's official CLI agent via Zed adapter`,configLink:`https://github.com/zed-industries/claude-code-acp`,npmPackage:`@zed-industries/claude-code-acp`,npmArgs:[],meta:{icon:kc(Oc.claude)}},{name:`Codex CLI`,command:`npx`,args:[`-y`,`@zed-industries/codex-acp`],env:[{key:`OPENAI_API_KEY`,required:!1}],configHint:`OpenAI Codex CLI via Zed adapter`,configLink:`https://github.com/zed-industries/codex-acp`,npmPackage:`@zed-industries/codex-acp`,npmArgs:[],meta:{icon:kc(Oc.openai)}},{name:`Gemini CLI`,command:`gemini`,args:[`--experimental-acp`],env:[{key:`GEMINI_API_KEY`,required:!1}],authMethodId:`gemini-api-key`,configHint:`Official Google Gemini CLI with ACP support`,configLink:`https://github.com/google-gemini/gemini-cli`,meta:{icon:kc(Oc.gemini)}},{name:`Kimi CLI`,command:`kimi`,args:[`--acp`],env:[],configHint:`Moonshot AI's CLI with built-in ACP support`,configLink:`https://github.com/MoonshotAI/kimi-cli`,installCommand:`uv tool install --python 3.13 kimi-cli`,meta:{icon:kc(Oc.moonshot)}},{name:`Goose`,command:`goose`,args:[`acp`],env:[],configHint:`Block's open-source agent with ACP support`,configLink:`https://block.github.io/goose/docs/guides/acp-clients`,installCommand:`pipx install goose-ai`,meta:{icon:kc(Oc.goose)}},{name:`Opencode`,command:`opencode`,args:[`acp`],env:[],configHint:`SST's open source agent with ACP support`,configLink:`https://github.com/sst/opencode`,meta:{icon:Oc.opencode}},{name:`Cursor Agent`,command:`npx`,args:[`@blowmage/cursor-agent-acp`],env:[],configHint:`Unofficial ACP adapter for Cursor's agent`,configLink:`https://github.com/blowmage/cursor-agent-acp`,npmPackage:`@blowmage/cursor-agent-acp`,npmArgs:[],meta:{icon:kc(Oc.cursor)}},{name:`Droid (Experimental)`,command:`npx`,args:[`-y`,`@yaonyan/droid-acp`],env:[{key:`FACTORY_API_KEY`,required:!1}],configHint:`Unofficial ACP adapter for Droid CLI`,configLink:`https://github.com/yaonyan/droid-acp`,npmPackage:`@yaonyan/droid-acp`,npmArgs:[],meta:{icon:kc(Oc.droid)}},{name:`CodeBuddy Code`,command:`codebuddy`,args:[`--acp`],env:[{key:`CODEBUDDY_API_KEY`,required:!1},{key:`CODEBUDDY_INTERNET_ENVIRONMENT`,required:!1}],configHint:`Tencent Cloud's coding assistant`,configLink:`https://copilot.tencent.com/docs/cli/acp`,meta:{icon:kc(Oc.codebuddy)},acpDelay:2e3}],jc=`Claude Code`,Mc=null,Nc=null;function Pc(){let e=window.__DEV_INSPECTOR_CONFIG__;return`http://${e?.host||`localhost`}:${e?.port||`5173`}${e?.base||`/`}`.replace(/\/$/,``)}function Fc(){return window.__DEV_INSPECTOR_CONFIG__?.showInspectorBar??!0}async function Ic(){if(Mc)return Mc;if(Nc)return Nc;let e=Pc();return Nc=fetch(`${e}/__inspector__/config.json`).then(e=>e.json()).then(e=>(Mc=e,e)).catch(e=>(console.warn(`[Inspector] Failed to load config:`,e),Mc={},{})).finally(()=>{Nc=null}),Nc}async function Lc(){let e=(await Ic()).defaultAgent;return e&&Ac.some(t=>t.name===e)?e:jc}let Rc=`inspector-inspection-items`,zc=`inspector-current-inspection-id`,Bc=null,Vc=null;function Hc(){Bc=null,Vc=null}function Uc(e){Vc&&(Vc(Error(e)),Hc())}function Wc(){return window.dispatchEvent(new CustomEvent(`activate-inspector`)),{success:!0}}function Gc(e){return{content:[{type:`text`,text:e}]}}function Kc(e){if(!e)return``;let{tagName:t,textContent:n,className:r,id:i,styles:a}=e;return`
|
|
63
63
|
**DOM Element**:
|
|
64
64
|
\`\`\`
|
|
65
65
|
Tag: <${t}${i?` id="${i}"`:``}${r?` class="${r}"`:``}>
|
|
@@ -1169,8 +1169,8 @@ ${t}
|
|
|
1169
1169
|
width: 190px;
|
|
1170
1170
|
}
|
|
1171
1171
|
|
|
1172
|
-
.w-\\[
|
|
1173
|
-
width:
|
|
1172
|
+
.w-\\[480px\\] {
|
|
1173
|
+
width: 480px;
|
|
1174
1174
|
}
|
|
1175
1175
|
|
|
1176
1176
|
.w-auto {
|
|
@@ -1189,8 +1189,8 @@ ${t}
|
|
|
1189
1189
|
width: 1px;
|
|
1190
1190
|
}
|
|
1191
1191
|
|
|
1192
|
-
.max-w-\\[
|
|
1193
|
-
max-width:
|
|
1192
|
+
.max-w-\\[480px\\] {
|
|
1193
|
+
max-width: 480px;
|
|
1194
1194
|
}
|
|
1195
1195
|
|
|
1196
1196
|
.max-w-\\[calc\\(100\\%-2rem\\)\\] {
|
|
@@ -1528,6 +1528,10 @@ ${t}
|
|
|
1528
1528
|
overflow: hidden;
|
|
1529
1529
|
}
|
|
1530
1530
|
|
|
1531
|
+
.overflow-x-auto {
|
|
1532
|
+
overflow-x: auto;
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1531
1535
|
.overflow-x-hidden {
|
|
1532
1536
|
overflow-x: hidden;
|
|
1533
1537
|
}
|
|
@@ -6878,7 +6882,7 @@ ${e.themeCSS}`),e.fontFamily!==void 0&&(n+=`
|
|
|
6878
6882
|
`)||(e.endsWith("```\n")||e.endsWith("```"))&&t%2==0)return e;let r=e.match(B7t);if(r&&!n){let t=r[2];if(!t||z7.test(t))return e;if(n9t(e)%2==1)return`${e}\``}return e},i9t=e=>{let t=e.match(V7t);if(t){let n=t[2];if(!n||z7.test(n))return e;if((e.match(/~~/g)||[]).length%2==1)return`${e}~~`}return e},a9t=e=>{if((e.match(/\$\$/g)||[]).length%2==0)return e;let t=e.indexOf(`$$`);return t!==-1&&e.indexOf(`
|
|
6879
6883
|
`,t)!==-1&&!e.endsWith(`
|
|
6880
6884
|
`)?`${e}
|
|
6881
|
-
$$`:`${e}$$`},o9t=e=>{let t=0,n=e.match(/\*+/g)||[];for(let e of n){let n=e.length;n>=3&&(t+=Math.floor(n/3))}return t},s9t=e=>{if(V7(e)||K7t.test(e))return e;let t=e.match(L7t);if(t){let n=t[2];if(!n||z7.test(n))return e;if(o9t(e)%2==1)return`${e}***`}return e},c9t=e=>{if(!e||typeof e!=`string`)return e;let t=e,n=q7t(t);return n.endsWith(`](streamdown:incomplete-link)`)?n:(t=n,t=s9t(t),t=J7t(t),t=Y7t(t),t=Z7t(t),t=e9t(t),t=r9t(t),t=i9t(t),t=a9t(t),t)},l9t={harden:[Qfe,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],defaultOrigin:void 0,allowDataImages:!0}],raw:Ebe,katex:[sy,{errorColor:`var(--color-muted-foreground)`}]},u9t={gfm:[GCe,{}],math:[rwe,{singleDollarTextMath:!1}],cjkFriendly:[axe,{}],cjkFriendlyGfmStrikethrough:[sxe,{}]},d9t=(0,_.createContext)([`github-light`,`github-dark`]),f9t=(0,_.createContext)(void 0),p9t=(0,_.createContext)(!0),H7=(0,_.createContext)({isAnimating:!1}),m9t=(0,_.memo)(({content:e,shouldParseIncompleteMarkdown:t,...n})=>{let r=(0,_.useMemo)(()=>typeof e==`string`&&t?c9t(e.trim()):e,[e,t]);return(0,S.jsx)(qfe,{...n,children:r})},(e,t)=>e.content===t.content);m9t.displayName=`Block`;var h9t=[`github-light`,`github-dark`],g9t=(0,_.memo)(({children:e,parseIncompleteMarkdown:t=!0,components:n,rehypePlugins:r=Object.values(l9t),remarkPlugins:i=Object.values(u9t),className:a,shikiTheme:o=h9t,mermaidConfig:s,controls:l=!0,isAnimating:u=!1,urlTransform:d=e=>e,BlockComponent:f=m9t,parseMarkdownIntoBlocksFn:m=N7t,...h})=>{let g=(0,_.useId)(),v=(0,_.useMemo)(()=>m(typeof e==`string`?e:``),[e,m]);(0,_.useEffect)(()=>{Array.isArray(r)&&r.some(e=>Array.isArray(e)?e[0]===sy:e===sy)&&Promise.resolve().then(()=>p(O5t(),1))},[r]);let y=(0,_.useMemo)(()=>({isAnimating:u}),[u]);return(0,S.jsx)(d9t.Provider,{value:o,children:(0,S.jsx)(f9t.Provider,{value:s,children:(0,S.jsx)(p9t.Provider,{value:l,children:(0,S.jsx)(H7.Provider,{value:y,children:(0,S.jsx)(`div`,{className:F7(`space-y-4`,a),children:v.map((e,a)=>(0,S.jsx)(f,{components:{...O7t,...n},content:e,index:a,rehypePlugins:r,remarkPlugins:i,shouldParseIncompleteMarkdown:t,urlTransform:d,...h},`${g}-block-${a}`))})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating);g9t.displayName=`Streamdown`;let _9t=(0,_.createContext)(null),v9t=()=>{let e=(0,_.useContext)(_9t);if(!e)throw Error(`Reasoning components must be used within Reasoning`);return e},y9t=(0,_.memo)(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:i,duration:a,children:o,...s})=>{let[l,u]=Yt({prop:n,defaultProp:r,onChange:i}),[d,f]=Yt({prop:a,defaultProp:void 0}),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(null);return(0,_.useEffect)(()=>{t?h===null&&g(Date.now()):h!==null&&(f(Math.ceil((Date.now()-h)/1e3)),g(null))},[t,h,f]),(0,_.useEffect)(()=>{if(r&&!t&&l&&!p){let e=setTimeout(()=>{u(!1),m(!0)},1e3);return()=>clearTimeout(e)}},[t,l,r,u,p]),(0,S.jsx)(_9t.Provider,{value:{isStreaming:t,isOpen:l,setIsOpen:u,duration:d},children:(0,S.jsx)(xn,{className:nt(`not-prose mb-4`,e),onOpenChange:e=>{u(e)},open:l,...s,children:o})})}),b9t=(e,t)=>e||t===0?(0,S.jsx)(Foe,{duration:1,children:`Thinking...`}):t===void 0?(0,S.jsx)(`p`,{children:`Thought for a few seconds`}):(0,S.jsxs)(`p`,{children:[`Thought for `,t,` seconds`]}),x9t=(0,_.memo)(({className:e,children:t,...n})=>{let{isStreaming:r,isOpen:i,duration:a}=v9t();return(0,S.jsx)(Sn,{className:nt(`flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,e),...n,children:t??(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(gt,{className:`size-4`}),b9t(r,a),(0,S.jsx)(_t,{className:nt(`size-4 transition-transform`,i?`rotate-180`:`rotate-0`)})]})})}),S9t=(0,_.memo)(({className:e,children:t,...n})=>(0,S.jsx)(Cn,{className:nt(`mt-4 text-sm`,`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...n,children:(0,S.jsx)(g9t,{...n,children:t})}));y9t.displayName=`Reasoning`,x9t.displayName=`ReasoningTrigger`,S9t.displayName=`ReasoningContent`,(0,_.createContext)(null);let C9t=(0,_.memo)(({className:e,...t})=>(0,S.jsx)(g9t,{className:nt(`size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,e),...t}),(e,t)=>e.children===t.children);C9t.displayName=`MessageResponse`;let w9t=(0,_.createContext)({code:``}),T9t={name:`line-numbers`,line(e,t){e.children.unshift({type:`element`,tagName:`span`,properties:{className:[`inline-block`,`min-w-10`,`mr-4`,`text-right`,`select-none`,`text-muted-foreground`]},children:[{type:`text`,value:String(t)}]})}};async function E9t(e,t,n=!1){let r=n?[T9t]:[];return await Promise.all([Gqe(e,{lang:t,theme:`one-light`,transformers:r}),Gqe(e,{lang:t,theme:`one-dark-pro`,transformers:r})])}let U7=({code:e,language:t,showLineNumbers:n=!1,className:r,children:i,...a})=>{let[o,s]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),d=(0,_.useRef)(!1);return(0,_.useEffect)(()=>(E9t(e,t,n).then(([e,t])=>{d.current||=(s(e),u(t),!0)}),()=>{d.current=!1}),[e,t,n]),(0,S.jsx)(w9t.Provider,{value:{code:e},children:(0,S.jsx)(`div`,{className:nt(`group relative w-full overflow-hidden rounded-md border bg-background text-foreground`,r),...a,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`overflow-hidden dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:o}}),(0,S.jsx)(`div`,{className:`hidden overflow-hidden dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:l}}),i&&(0,S.jsx)(`div`,{className:`absolute top-2 right-2 flex items-center gap-2`,children:i})]})})})},D9t=({className:e,...t})=>(0,S.jsx)(xn,{className:nt(`not-prose mb-4 w-full rounded-md border`,e),...t}),O9t=e=>{let t={"input-streaming":`Pending`,"input-available":`Running`,"approval-requested":`Awaiting Approval`,"approval-responded":`Responded`,"output-available":`Completed`,"output-error":`Error`,"output-denied":`Denied`};return(0,S.jsxs)(it,{className:`gap-1.5 rounded-full text-xs`,variant:`secondary`,children:[{"input-streaming":(0,S.jsx)(wt,{className:`size-4`}),"input-available":(0,S.jsx)(Tt,{className:`size-4 animate-pulse`}),"approval-requested":(0,S.jsx)(Tt,{className:`size-4 text-yellow-600`}),"approval-responded":(0,S.jsx)(xt,{className:`size-4 text-blue-600`}),"output-available":(0,S.jsx)(xt,{className:`size-4 text-green-600`}),"output-error":(0,S.jsx)(Ct,{className:`size-4 text-red-600`}),"output-denied":(0,S.jsx)(Ct,{className:`size-4 text-orange-600`})}[e],t[e]]})},k9t=({className:e,title:t,type:n,state:r,...i})=>(0,S.jsxs)(Sn,{className:nt(`flex w-full items-center justify-between gap-4 p-3`,e),...i,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(Ft,{className:`size-4 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`font-medium text-sm`,children:t??n.split(`-`).slice(1).join(`-`)}),O9t(r)]}),(0,S.jsx)(_t,{className:`size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]}),A9t=({className:e,...t})=>(0,S.jsx)(Cn,{className:nt(`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...t}),j9t=({className:e,input:t,...n})=>(0,S.jsxs)(`div`,{className:nt(`space-y-2 overflow-hidden p-4`,e),...n,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:`Parameters`}),(0,S.jsx)(`div`,{className:`rounded-md bg-muted/50`,children:(0,S.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`})})]}),M9t=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,S.jsx)(`div`,{children:t});return typeof t==`object`&&!(0,_.isValidElement)(t)?i=(0,S.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`}):typeof t==`string`&&(i=(0,S.jsx)(U7,{code:t,language:`json`})),(0,S.jsxs)(`div`,{className:nt(`space-y-2 p-4`,e),...r,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:n?`Error`:`Result`}),(0,S.jsxs)(`div`,{className:nt(`overflow-x-auto rounded-md text-xs [&_table]:w-full`,n?`bg-destructive/10 text-destructive`:`bg-muted/50 text-foreground`),children:[n&&(0,S.jsx)(`div`,{children:n}),i]})]})};function N9t({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card`,className:nt(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm`,e),...t})}function P9t({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-header`,className:nt(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),...t})}function F9t({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-content`,className:nt(`px-6`,e),...t})}let I9t=(0,_.createContext)(null),L9t=({className:e,isStreaming:t=!1,children:n,...r})=>(0,S.jsx)(I9t.Provider,{value:{isStreaming:t},children:(0,S.jsx)(xn,{asChild:!0,"data-slot":`plan`,...r,children:(0,S.jsx)(N9t,{className:nt(`shadow-none`,e),children:n})})}),R9t=({className:e,...t})=>(0,S.jsx)(P9t,{className:nt(`flex items-start justify-between`,e),"data-slot":`plan-header`,...t}),z9t=e=>(0,S.jsx)(Cn,{asChild:!0,children:(0,S.jsx)(F9t,{"data-slot":`plan-content`,...e})}),B9t=({className:e,...t})=>(0,S.jsx)(Sn,{asChild:!0,children:(0,S.jsxs)(Wt,{className:nt(`size-8`,e),"data-slot":`plan-trigger`,size:`icon`,variant:`ghost`,...t,children:[(0,S.jsx)(yt,{className:`size-4`}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Toggle plan`})]})});function V9t(e){let t=e;return typeof t.type==`string`&&t.type.startsWith(`tool-`)&&`state`in t}function H9t(e,t,n,r,i){if(e.type===`text`&&e.text)return(0,S.jsx)(C9t,{className:`whitespace-pre-wrap`,children:e.text},`${t}-${n}`);if(e.type===`reasoning`)return(0,S.jsxs)(y9t,{className:`w-full`,isStreaming:r,children:[(0,S.jsx)(x9t,{}),(0,S.jsx)(S9t,{children:e.text})]},`${t}-${n}`);let a=i?.plan;if(a&&n===0)return(0,S.jsx)(`div`,{className:`w-full`,children:(0,S.jsxs)(L9t,{defaultOpen:!0,isStreaming:r,children:[(0,S.jsx)(R9t,{className:`flex flex-row items-center`,children:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h1`,{className:`text-base`,children:`Agent Plan`}),(0,S.jsx)(B9t,{className:`mb-2`})]})}),(0,S.jsx)(z9t,{children:(0,S.jsx)(`ul`,{className:`space-y-2`,children:a.map((e,t)=>{let n=e.content||JSON.stringify(e),r=e.priority,i=e.status;return(0,S.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex-1`,children:[(0,S.jsx)(`div`,{className:`text-sm ${i===`done`?`line-through text-muted-foreground`:`text-foreground`}`,children:n}),r&&(0,S.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Priority: `,r]})]}),(0,S.jsx)(`div`,{className:`shrink-0 text-xs`,children:(0,S.jsx)(`span`,{className:`px-2 py-1 rounded-full font-medium text-[10px] uppercase tracking-wide ${i===`pending`?`bg-muted text-muted-foreground`:`bg-primary/10 text-primary`}`,children:i??`pending`})})]},`plan-${t}`)})})})]})},`${t}-plan`);if(V9t(e)){let r=e=>(e=e.replace(`acp-ai-sdk-tools`,``),e),i=e.input;if(!i||!i.toolName)return null;let a=r(i.toolName),o=e.state,s=o===`output-available`||o===`output-error`;return(0,S.jsxs)(D9t,{defaultOpen:s,children:[(0,S.jsx)(k9t,{title:r(a.length>20?`${a.slice(0,20)}...`:a),type:a,state:o}),(0,S.jsxs)(A9t,{children:[e.input!==void 0&&(0,S.jsx)(j9t,{input:i}),s&&(0,S.jsx)(M9t,{output:e.output?(0,S.jsx)(U7,{code:JSON.stringify(e.output,null,2),language:`json`}):null,errorText:e.errorText})]})]},`${t}-${n}`)}return null}let U9t=({messages:e,status:t,selectedAgent:n})=>{let r=Ac.find(e=>e.name===(n||jc))||Ac[0],i=t===`submitted`||t===`streaming`,a=e[e.length-1],o=i&&(!a||a.role===`user`);return(0,S.jsxs)(qoe,{className:`w-full h-full`,children:[(0,S.jsx)(Joe,{className:`p-3 space-y-3`,children:e.length===0&&!i?(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`p`,{className:`text-sm`,children:`No messages yet`}),(0,S.jsx)(`p`,{className:`text-xs mt-1`,children:`Enter a question below to start`})]})}):(0,S.jsxs)(S.Fragment,{children:[e.map(e=>(0,S.jsxs)(kse,{className:`items-start`,from:e.role,children:[(0,S.jsx)(Ase,{children:e.parts.map((n,r)=>H9t(n,e.id,r,t===`streaming`,e.metadata))}),e.role===`assistant`&&(0,S.jsx)(jse,{name:r.name,src:r.meta?.icon??``})]},e.id)),o&&(0,S.jsxs)(kse,{className:`items-start`,from:`assistant`,children:[(0,S.jsx)(Ase,{children:(0,S.jsx)(Nse,{size:16})}),(0,S.jsx)(jse,{name:r.name,src:r.meta?.icon??``})]})]})}),(0,S.jsx)(Yoe,{})]})};function W9t(e,t,n=50){let[r,i]=(0,_.useState)(``),a=(0,_.useRef)(0),o=(0,_.useRef)(``);return(0,_.useEffect)(()=>{if(e.length<r.length||r&&!e.startsWith(r.slice(0,Math.min(r.length,20)))){i(e),o.current=e,a.current=Date.now();return}if(!t){r!==e&&(i(e),o.current=e);return}let s=e.slice(o.current.length);if(!s)return;let l=Date.now();if(l-a.current<n)return;let u=/[.?!。?!](\s|$)|[\n]/.test(s),d=s.length>50,f=s.trim().length<5;(u&&!f||d)&&(i(e),o.current=e,a.current=l)},[e,t,n,r]),r}function G9t({initialOffset:e={x:0,y:0}}={}){let t=(0,_.useRef)(null),[n,r]=(0,_.useState)(!1),i=(0,_.useRef)(e),a=(0,_.useRef)({x:0,y:0}),o=(0,_.useRef)({x:0,y:0}),s=(0,_.useCallback)(()=>{if(t.current){let{x:e,y:n}=i.current;t.current.style.transform=`translate3d(calc(-50% + ${e}px), ${n}px, 0)`}},[]),l=(0,_.useCallback)(e=>{e.target.closest(`button, input, a, [data-no-drag]`)||(e.preventDefault(),r(!0),a.current={x:e.clientX,y:e.clientY},o.current={...i.current})},[]);return(0,_.useEffect)(()=>{let e=e=>{if(!n)return;let t=e.clientX-a.current.x,r=e.clientY-a.current.y;i.current={x:o.current.x+t,y:o.current.y+r},s()},t=()=>{r(!1)};return n&&(window.addEventListener(`mousemove`,e,{passive:!0}),window.addEventListener(`mouseup`,t)),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[n,s]),(0,_.useEffect)(()=>{s()},[s]),{elementRef:t,isDragging:n,handleMouseDown:l}}let K9t=`AI_SELECTED_AGENT`,q9t=e=>{let[t,n]=(0,_.useState)(()=>{if(typeof window<`u`){let e=localStorage.getItem(K9t);if(e)return e}return e}),[r,i]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{typeof window<`u`?Lc().then(e=>{e&&e!==jc&&n(e)}).finally(()=>{i(!0)}):i(!0)},[]),{agent:t,setAgent:e=>{n(e),!(typeof window>`u`)&&(e?.trim()?localStorage.setItem(K9t,e):localStorage.removeItem(K9t))},isReady:r}},J9t=({isActive:e,onToggleInspector:t,onSubmitAgent:n,onCancel:r,isAgentWorking:i,messages:a,status:o,inspectionCount:s=0,inspectionItems:l=[],onRemoveInspection:u=()=>{},toolsReady:d=!0})=>{let[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(null),[y,b]=(0,_.useState)(`none`),[x,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(!0),{agent:O,setAgent:k,isReady:A}=q9t(jc),[j,M]=(0,_.useState)(!1),[N,P]=(0,_.useState)(null),[F,I]=(0,_.useState)(null),L=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!A||!d)return;let e=!0,t=Ac.find(e=>e.name===O)||Ac[0];return(async()=>{if(L.current){try{await fetch(`${Pc()}/api/acp/cleanup-session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:L.current})})}catch(e){console.warn(`[InspectorBar] Failed to cleanup previous session:`,e)}L.current=null,e&&I(null)}console.log(`[InspectorBar] Initializing session for ${t.name}...`);try{let n=await fetch(`${Pc()}/api/acp/init-session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({agent:t,envVars:{}})});if(!n.ok)throw Error(`Failed to init session`);let r=await n.json();e&&r.sessionId&&(console.log(`[InspectorBar] Session initialized: ${r.sessionId}`),I(r.sessionId),L.current=r.sessionId)}catch(e){console.error(`[InspectorBar] Failed to initialize session:`,e)}})(),()=>{e=!1}},[O,A,d]),(0,_.useEffect)(()=>()=>{L.current&&(console.log(`[InspectorBar] Cleaning up session on unmount: ${L.current}`),fetch(`${Pc()}/api/acp/cleanup-session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:L.current}),keepalive:!0}).catch(e=>console.warn(`[InspectorBar] Failed to cleanup session:`,e)))},[]);let R=Ac.find(e=>e.name===O)||Ac[0],{elementRef:ee,isDragging:te,handleMouseDown:z}=G9t(),[B,ne]=(0,_.useState)(null),[re,ie]=(0,_.useState)(``),ae=W9t(re,i,50),[oe,se]=(0,_.useState)(``),ce=(0,_.useRef)(``),le=(0,_.useRef)(``);(0,_.useEffect)(()=>{let e=ae,t=ce.current;if(e.length<t.length||!e.startsWith(t)){se(e),ce.current=e;return}if(e.length>t.length){let n=e.slice(t.length).trim();n&&se(n),ce.current=e}},[ae]);let ue=(0,_.useRef)(null),de=(0,_.useRef)(null),fe=(0,_.useRef)(null),pe=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(a.length===0){ie(``),v(null),fe.current=null,pe.current=!1,se(``),ce.current=``;return}let e=a[a.length-1];if(e.role!==`assistant`)return;let t=Roe(e),{displayText:n,toolCall:r}=Boe(e,t||fe.current);ie(n||``),t&&(fe.current=t),r?(de.current&&=(clearTimeout(de.current),null),v(r),pe.current=!0):pe.current=!1},[a]),(0,_.useEffect)(()=>{oe!==le.current&&(pe.current||v(null),le.current=oe)},[oe]),(0,_.useEffect)(()=>{f&&ue.current&&ue.current.focus()},[f]),(0,_.useEffect)(()=>{if(!i&&w){C(!1),T(!1),D(!1);let e=setTimeout(()=>{D(!0)},2e3);return()=>clearTimeout(e)}},[i,w]),(0,_.useEffect)(()=>{function e(e){let{plan:t,inspectionId:n}=e.detail;if(t?.steps){let e=t.steps.find(e=>e.status===`in-progress`),r=t.steps.filter(e=>e.status===`completed`).length;ne({id:n,status:`in-progress`,currentStep:e?{title:e.title,index:r+1,total:t.steps.length}:void 0})}}function t(e){let{status:t,result:n,inspectionId:r}=e.detail;ne({id:r,status:t,message:n?.message||n})}return window.addEventListener(`plan-progress-reported`,e),window.addEventListener(`inspection-result-received`,t),()=>{window.removeEventListener(`plan-progress-reported`,e),window.removeEventListener(`inspection-result-received`,t)}},[]);let me=e=>{e.preventDefault(),m.trim()&&(de.current&&=(clearTimeout(de.current),null),v(null),ie(``),se(``),ne(null),fe.current=null,ce.current=``,C(!0),T(!0),n(m,O,F||void 0),h(``),p(!0),b(`chat`))},he=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),me(e)),e.key===`Escape`&&(p(!1),ue.current?.blur())},ge=o===`error`,_e=a.length>0,ve=f&&!x,ye=(!f||x)&&(i||_e||B);return(0,S.jsxs)(S.Fragment,{children:[(f||y!==`none`)&&(0,S.jsx)(`div`,{className:`fixed inset-0 z-[999998] bg-transparent`,onClick:()=>{!w&&!i&&(p(!1),b(`none`))}}),(0,S.jsxs)(`div`,{ref:ee,className:nt(`fixed bottom-8 left-1/2 z-[999999]`,`transition-all duration-300 ease-[cubic-bezier(0.23,1,0.32,1)]`,f?`w-[450px]`:ye?`w-auto min-w-[200px] max-w-[450px]`:`w-[190px]`,te?`cursor-grabbing`:`cursor-grab`),onMouseDown:z,onMouseEnter:()=>{te||(i||w?(p(!0),b(`chat`)):E&&p(!0))},onMouseLeave:()=>{!m.trim()&&!w&&!te&&(p(!1),b(`none`)),D(!0)},children:[(0,S.jsxs)(`div`,{className:nt(`relative flex items-center backdrop-blur-xl shadow-2xl border border-border`,`transition-[width,height,padding,background-color,border-color] duration-200 ease-out`,f?`h-12 p-2 pl-4`:`h-9 px-2 py-1`,y===`none`?`bg-muted/90 rounded-full`:`bg-muted/95 rounded-b-lg rounded-t-none border-t-0`,ge&&!f&&`bg-destructive/10 border-destructive/20`),children:[(0,S.jsxs)(`div`,{className:nt(`flex items-center transition-opacity duration-300 w-full relative`,ve?`absolute left-3 opacity-0 pointer-events-none`:`relative opacity-100`),children:[!ye&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:(0,S.jsx)(Mt,{className:`w-3.5 h-3.5 text-foreground`})}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground/70 ml-3 whitespace-nowrap`,children:`⌥I or hover to inspect`})]}),ye&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[(0,S.jsx)(`div`,{className:`relative flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:i?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-foreground`}),(0,S.jsx)(Mt,{className:`w-3.5 h-3.5 animate-pulse text-foreground`})]}):B?B.status===`in-progress`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-blue-500`}),(0,S.jsx)(Nt,{className:`w-3.5 h-3.5 animate-pulse text-blue-500`})]}):B.status===`completed`?(0,S.jsx)(St,{className:`w-5 h-5 text-green-500`}):(0,S.jsx)(Ct,{className:`w-5 h-5 text-red-500`}):ge?(0,S.jsx)(Ct,{className:`w-5 h-5 text-red-500`}):(0,S.jsx)(St,{className:`w-5 h-5 text-green-500`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsx)(`div`,{className:`flex-1 flex justify-center min-w-0 pl-2`,children:(0,S.jsx)(`div`,{className:`flex flex-col min-w-0 max-w-full pr-2 max-h-[24px] overflow-hidden`,children:B&&B.status===`in-progress`&&B.currentStep?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(Nt,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsxs)(`span`,{className:`truncate min-w-0`,children:[`Step `,B.currentStep.index,`/`,B.currentStep.total,`: `,B.currentStep.title]})]}):B?.message?(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:B.message}):g?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(Nt,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsx)(`span`,{className:`truncate min-w-0`,children:g})]}):(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:i&&!oe?(0,S.jsx)(Foe,{duration:2,spread:2,children:o===`submitted`&&R?.command===`npx`?`Starting ${R.name}... This may take a moment.`:`Thinking...`}):oe||`Processing...`})})})]})]}),(0,S.jsxs)(`div`,{className:nt(`flex items-center w-full gap-3 transition-all duration-500 delay-75`,ve?`opacity-100 translate-y-0 relative pointer-events-auto`:`opacity-0 translate-y-4 pointer-events-none absolute top-2 left-4 right-2`),onClick:e=>e.stopPropagation(),children:[(0,S.jsx)(`button`,{onClick:t,className:nt(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,e?`bg-blue-500 text-white shadow-[0_0_15px_rgba(59,130,246,0.5)]`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:`Toggle Inspector (⌥I)`,children:(0,S.jsx)(Et,{className:`w-3.5 h-3.5`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`}),s>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>b(e=>e===`inspections`?`none`:`inspections`),className:nt(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,`hover:bg-accent/50`,y===`inspections`&&`bg-accent/50 text-foreground`),title:`View Inspections`,children:[(0,S.jsx)(Dt,{className:`w-3.5 h-3.5`}),(0,S.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 flex items-center justify-center min-w-[12px] h-[12px] px-0.5 text-[8px] font-bold text-white bg-red-500 rounded-full border border-background shadow-sm leading-none`,children:s>99?`99+`:s})]}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsxs)(`form`,{onSubmit:me,className:`flex-1 flex items-center gap-2 min-w-0`,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`div`,{className:`relative flex-shrink-0`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>M(!j),className:`flex items-center justify-center w-7 h-7 rounded-full hover:bg-accent/50 transition-colors`,title:`Select Agent`,children:(0,S.jsx)(`img`,{src:Ac.find(e=>e.name===O)?.meta?.icon,alt:O,className:`w-3.5 h-3.5`})}),j&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`fixed inset-0 z-[999998]`,onClick:()=>M(!1)}),(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 mb-2 w-64 bg-popover border border-border rounded-lg shadow-lg overflow-hidden z-[999999] animate-in fade-in zoom-in-95 duration-200`,children:Ac.map(e=>(0,S.jsxs)(`div`,{className:nt(`w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-accent transition-colors group`,O===e.name&&`bg-accent/50 font-medium`),children:[(0,S.jsxs)(`button`,{onClick:()=>{k(e.name),M(!1)},className:`flex items-center gap-2 flex-1 text-left`,children:[e.meta?.icon&&(0,S.jsx)(`img`,{src:e.meta.icon,alt:``,className:`w-4 h-4 flex-shrink-0`}),(0,S.jsx)(`span`,{className:`flex-1`,children:e.name})]}),(e.configHint||e.configLink)&&(0,S.jsx)(`button`,{onClick:t=>{t.stopPropagation(),P(e.name)},className:`p-1 rounded hover:bg-accent-foreground/10 transition-colors`,title:`Configuration info`,children:(0,S.jsx)(Ot,{className:`w-3.5 h-3.5 text-muted-foreground`})})]},e.name))})]})]}),(0,S.jsx)(`input`,{ref:ue,type:`text`,value:m,onChange:e=>h(e.target.value),onKeyDown:he,placeholder:`Ask ${O}...`,className:`w-full bg-transparent border-none outline-none text-foreground placeholder-muted-foreground text-sm h-7 disabled:opacity-50`,tabIndex:0,disabled:i}),(a.length>0||i||w)&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>b(e=>e===`chat`?`none`:`chat`),className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,y===`chat`?`bg-foreground text-background`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:y===`chat`?`Collapse`:`Expand messages`,children:(0,S.jsx)(vt,{className:nt(`w-3.5 h-3.5 transition-transform duration-300`,y===`chat`&&`rotate-180`)})}),i?(0,S.jsx)(`button`,{type:`button`,onClick:r,className:`flex items-center justify-center w-7 h-7 rounded-full bg-destructive text-destructive-foreground transition-all flex-shrink-0 hover:bg-destructive/90`,title:`Cancel request`,children:(0,S.jsx)(tee,{className:`w-3 h-3`})}):(0,S.jsx)(`button`,{type:`submit`,disabled:!m.trim(),className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,m.trim()?`bg-foreground text-background scale-100`:`bg-accent text-muted-foreground/50 scale-90`),children:(0,S.jsx)(ht,{className:`w-3.5 h-3.5`})})]})]})]}),y!==`none`&&(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 right-0 pointer-events-auto max-w-[450px] mx-auto animate-panel-in`,children:(0,S.jsxs)(`div`,{className:`bg-muted/95 backdrop-blur-xl rounded-t-xl border border-border border-b-0 shadow-2xl overflow-hidden`,children:[y===`inspections`&&l.length>0&&(0,S.jsx)(`div`,{className:`border-b border-border`,children:(0,S.jsx)(pee,{items:l,onRemove:u})}),y===`chat`&&(0,S.jsx)(`div`,{className:`h-[500px]`,children:(0,S.jsx)(U9t,{messages:a,status:o,selectedAgent:O})})]})})]}),N&&(()=>{let e=Ac.find(e=>e.name===N);return e?(0,S.jsx)(Lt,{open:!!N,onOpenChange:()=>P(null),children:(0,S.jsxs)(Rt,{onClose:()=>P(null),className:`w-80`,children:[(0,S.jsxs)(zt,{children:[(0,S.jsxs)(nee,{className:`flex items-center gap-3`,children:[e.meta?.icon&&(0,S.jsx)(`img`,{src:e.meta.icon,alt:``,className:`w-6 h-6`}),e.name]}),e.configHint&&(0,S.jsx)(Vt,{children:e.configHint})]}),e.configLink&&(0,S.jsx)(`a`,{href:e.configLink,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-sm text-blue-500 hover:text-blue-600 underline`,children:`View ACP Documentation →`})]})}):null})()]})};var Y9t=`vercel.ai.error`,X9t=Symbol.for(Y9t),Z9t,Q9t=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[Z9t]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Y9t)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};Z9t=X9t;var W7=Q9t;function $9t(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var een=`AI_InvalidArgumentError`,ten=`vercel.ai.error.${een}`,nen=Symbol.for(ten),ren,ien=class extends W7{constructor({message:e,cause:t,argument:n}){super({name:een,message:e,cause:t}),this[ren]=!0,this.argument=n}static isInstance(e){return W7.hasMarker(e,ten)}};ren=nen;var aen=`AI_JSONParseError`,oen=`vercel.ai.error.${aen}`,sen=Symbol.for(oen),cen,len=class extends W7{constructor({text:e,cause:t}){super({name:aen,message:`JSON parsing failed: Text: ${e}.
|
|
6885
|
+
$$`:`${e}$$`},o9t=e=>{let t=0,n=e.match(/\*+/g)||[];for(let e of n){let n=e.length;n>=3&&(t+=Math.floor(n/3))}return t},s9t=e=>{if(V7(e)||K7t.test(e))return e;let t=e.match(L7t);if(t){let n=t[2];if(!n||z7.test(n))return e;if(o9t(e)%2==1)return`${e}***`}return e},c9t=e=>{if(!e||typeof e!=`string`)return e;let t=e,n=q7t(t);return n.endsWith(`](streamdown:incomplete-link)`)?n:(t=n,t=s9t(t),t=J7t(t),t=Y7t(t),t=Z7t(t),t=e9t(t),t=r9t(t),t=i9t(t),t=a9t(t),t)},l9t={harden:[Qfe,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],defaultOrigin:void 0,allowDataImages:!0}],raw:Ebe,katex:[sy,{errorColor:`var(--color-muted-foreground)`}]},u9t={gfm:[GCe,{}],math:[rwe,{singleDollarTextMath:!1}],cjkFriendly:[axe,{}],cjkFriendlyGfmStrikethrough:[sxe,{}]},d9t=(0,_.createContext)([`github-light`,`github-dark`]),f9t=(0,_.createContext)(void 0),p9t=(0,_.createContext)(!0),H7=(0,_.createContext)({isAnimating:!1}),m9t=(0,_.memo)(({content:e,shouldParseIncompleteMarkdown:t,...n})=>{let r=(0,_.useMemo)(()=>typeof e==`string`&&t?c9t(e.trim()):e,[e,t]);return(0,S.jsx)(qfe,{...n,children:r})},(e,t)=>e.content===t.content);m9t.displayName=`Block`;var h9t=[`github-light`,`github-dark`],g9t=(0,_.memo)(({children:e,parseIncompleteMarkdown:t=!0,components:n,rehypePlugins:r=Object.values(l9t),remarkPlugins:i=Object.values(u9t),className:a,shikiTheme:o=h9t,mermaidConfig:s,controls:l=!0,isAnimating:u=!1,urlTransform:d=e=>e,BlockComponent:f=m9t,parseMarkdownIntoBlocksFn:m=N7t,...h})=>{let g=(0,_.useId)(),v=(0,_.useMemo)(()=>m(typeof e==`string`?e:``),[e,m]);(0,_.useEffect)(()=>{Array.isArray(r)&&r.some(e=>Array.isArray(e)?e[0]===sy:e===sy)&&Promise.resolve().then(()=>p(O5t(),1))},[r]);let y=(0,_.useMemo)(()=>({isAnimating:u}),[u]);return(0,S.jsx)(d9t.Provider,{value:o,children:(0,S.jsx)(f9t.Provider,{value:s,children:(0,S.jsx)(p9t.Provider,{value:l,children:(0,S.jsx)(H7.Provider,{value:y,children:(0,S.jsx)(`div`,{className:F7(`space-y-4`,a),children:v.map((e,a)=>(0,S.jsx)(f,{components:{...O7t,...n},content:e,index:a,rehypePlugins:r,remarkPlugins:i,shouldParseIncompleteMarkdown:t,urlTransform:d,...h},`${g}-block-${a}`))})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating);g9t.displayName=`Streamdown`;let _9t=(0,_.createContext)(null),v9t=()=>{let e=(0,_.useContext)(_9t);if(!e)throw Error(`Reasoning components must be used within Reasoning`);return e},y9t=(0,_.memo)(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:i,duration:a,children:o,...s})=>{let[l,u]=Yt({prop:n,defaultProp:r,onChange:i}),[d,f]=Yt({prop:a,defaultProp:void 0}),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(null);return(0,_.useEffect)(()=>{t?h===null&&g(Date.now()):h!==null&&(f(Math.ceil((Date.now()-h)/1e3)),g(null))},[t,h,f]),(0,_.useEffect)(()=>{if(r&&!t&&l&&!p){let e=setTimeout(()=>{u(!1),m(!0)},1e3);return()=>clearTimeout(e)}},[t,l,r,u,p]),(0,S.jsx)(_9t.Provider,{value:{isStreaming:t,isOpen:l,setIsOpen:u,duration:d},children:(0,S.jsx)(xn,{className:nt(`not-prose mb-4`,e),onOpenChange:e=>{u(e)},open:l,...s,children:o})})}),b9t=(e,t)=>e||t===0?(0,S.jsx)(Foe,{duration:1,children:`Thinking...`}):t===void 0?(0,S.jsx)(`p`,{children:`Thought for a few seconds`}):(0,S.jsxs)(`p`,{children:[`Thought for `,t,` seconds`]}),x9t=(0,_.memo)(({className:e,children:t,...n})=>{let{isStreaming:r,isOpen:i,duration:a}=v9t();return(0,S.jsx)(Sn,{className:nt(`flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,e),...n,children:t??(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(gt,{className:`size-4`}),b9t(r,a),(0,S.jsx)(_t,{className:nt(`size-4 transition-transform`,i?`rotate-180`:`rotate-0`)})]})})}),S9t=(0,_.memo)(({className:e,children:t,...n})=>(0,S.jsx)(Cn,{className:nt(`mt-4 text-sm`,`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...n,children:(0,S.jsx)(g9t,{...n,children:t})}));y9t.displayName=`Reasoning`,x9t.displayName=`ReasoningTrigger`,S9t.displayName=`ReasoningContent`,(0,_.createContext)(null);let C9t=(0,_.memo)(({className:e,...t})=>(0,S.jsx)(g9t,{className:nt(`size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,e),...t}),(e,t)=>e.children===t.children);C9t.displayName=`MessageResponse`;let w9t=(0,_.createContext)({code:``}),T9t={name:`line-numbers`,line(e,t){e.children.unshift({type:`element`,tagName:`span`,properties:{className:[`inline-block`,`min-w-10`,`mr-4`,`text-right`,`select-none`,`text-muted-foreground`]},children:[{type:`text`,value:String(t)}]})}};async function E9t(e,t,n=!1){let r=n?[T9t]:[];return await Promise.all([Gqe(e,{lang:t,theme:`one-light`,transformers:r}),Gqe(e,{lang:t,theme:`one-dark-pro`,transformers:r})])}let U7=({code:e,language:t,showLineNumbers:n=!1,className:r,children:i,...a})=>{let[o,s]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),d=(0,_.useRef)(!1);return(0,_.useEffect)(()=>(E9t(e,t,n).then(([e,t])=>{d.current||=(s(e),u(t),!0)}),()=>{d.current=!1}),[e,t,n]),(0,S.jsx)(w9t.Provider,{value:{code:e},children:(0,S.jsx)(`div`,{className:nt(`group relative w-full overflow-hidden rounded-md border bg-background text-foreground`,r),...a,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`overflow-x-auto dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:o}}),(0,S.jsx)(`div`,{className:`hidden overflow-x-auto dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:l}}),i&&(0,S.jsx)(`div`,{className:`absolute top-2 right-2 flex items-center gap-2`,children:i})]})})})},D9t=({className:e,...t})=>(0,S.jsx)(xn,{className:nt(`not-prose mb-4 w-full rounded-md border`,e),...t}),O9t=e=>{let t={"input-streaming":`Pending`,"input-available":`Running`,"approval-requested":`Awaiting Approval`,"approval-responded":`Responded`,"output-available":`Completed`,"output-error":`Error`,"output-denied":`Denied`};return(0,S.jsxs)(it,{className:`gap-1.5 rounded-full text-xs`,variant:`secondary`,children:[{"input-streaming":(0,S.jsx)(wt,{className:`size-4`}),"input-available":(0,S.jsx)(Tt,{className:`size-4 animate-pulse`}),"approval-requested":(0,S.jsx)(Tt,{className:`size-4 text-yellow-600`}),"approval-responded":(0,S.jsx)(xt,{className:`size-4 text-blue-600`}),"output-available":(0,S.jsx)(xt,{className:`size-4 text-green-600`}),"output-error":(0,S.jsx)(Ct,{className:`size-4 text-red-600`}),"output-denied":(0,S.jsx)(Ct,{className:`size-4 text-orange-600`})}[e],t[e]]})},k9t=({className:e,title:t,type:n,state:r,...i})=>(0,S.jsxs)(Sn,{className:nt(`flex w-full items-center justify-between gap-4 p-3`,e),...i,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(Ft,{className:`size-4 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`font-medium text-sm`,children:t??n.split(`-`).slice(1).join(`-`)}),O9t(r)]}),(0,S.jsx)(_t,{className:`size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]}),A9t=({className:e,...t})=>(0,S.jsx)(Cn,{className:nt(`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...t}),j9t=({className:e,input:t,...n})=>(0,S.jsxs)(`div`,{className:nt(`space-y-2 overflow-hidden p-4`,e),...n,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:`Parameters`}),(0,S.jsx)(`div`,{className:`rounded-md bg-muted/50`,children:(0,S.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`})})]}),M9t=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,S.jsx)(`div`,{children:t});return typeof t==`object`&&!(0,_.isValidElement)(t)?i=(0,S.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`}):typeof t==`string`&&(i=(0,S.jsx)(U7,{code:t,language:`json`})),(0,S.jsxs)(`div`,{className:nt(`space-y-2 p-4`,e),...r,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:n?`Error`:`Result`}),(0,S.jsxs)(`div`,{className:nt(`overflow-x-auto rounded-md text-xs [&_table]:w-full`,n?`bg-destructive/10 text-destructive`:`bg-muted/50 text-foreground`),children:[n&&(0,S.jsx)(`div`,{children:n}),i]})]})};function N9t({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card`,className:nt(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm`,e),...t})}function P9t({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-header`,className:nt(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),...t})}function F9t({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-content`,className:nt(`px-6`,e),...t})}let I9t=(0,_.createContext)(null),L9t=({className:e,isStreaming:t=!1,children:n,...r})=>(0,S.jsx)(I9t.Provider,{value:{isStreaming:t},children:(0,S.jsx)(xn,{asChild:!0,"data-slot":`plan`,...r,children:(0,S.jsx)(N9t,{className:nt(`shadow-none`,e),children:n})})}),R9t=({className:e,...t})=>(0,S.jsx)(P9t,{className:nt(`flex items-start justify-between`,e),"data-slot":`plan-header`,...t}),z9t=e=>(0,S.jsx)(Cn,{asChild:!0,children:(0,S.jsx)(F9t,{"data-slot":`plan-content`,...e})}),B9t=({className:e,...t})=>(0,S.jsx)(Sn,{asChild:!0,children:(0,S.jsxs)(Wt,{className:nt(`size-8`,e),"data-slot":`plan-trigger`,size:`icon`,variant:`ghost`,...t,children:[(0,S.jsx)(yt,{className:`size-4`}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Toggle plan`})]})});function V9t(e){let t=e;return typeof t.type==`string`&&t.type.startsWith(`tool-`)&&`state`in t}function H9t(e,t,n,r,i){if(e.type===`text`&&e.text)return(0,S.jsx)(C9t,{className:`whitespace-pre-wrap`,children:e.text},`${t}-${n}`);if(e.type===`reasoning`)return(0,S.jsxs)(y9t,{className:`w-full`,isStreaming:r,children:[(0,S.jsx)(x9t,{}),(0,S.jsx)(S9t,{children:e.text})]},`${t}-${n}`);let a=i?.plan;if(a&&n===0)return(0,S.jsx)(`div`,{className:`w-full`,children:(0,S.jsxs)(L9t,{defaultOpen:!0,isStreaming:r,children:[(0,S.jsx)(R9t,{className:`flex flex-row items-center`,children:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h1`,{className:`text-base`,children:`Agent Plan`}),(0,S.jsx)(B9t,{className:`mb-2`})]})}),(0,S.jsx)(z9t,{children:(0,S.jsx)(`ul`,{className:`space-y-2`,children:a.map((e,t)=>{let n=e.content||JSON.stringify(e),r=e.priority,i=e.status;return(0,S.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex-1`,children:[(0,S.jsx)(`div`,{className:`text-sm ${i===`done`?`line-through text-muted-foreground`:`text-foreground`}`,children:n}),r&&(0,S.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Priority: `,r]})]}),(0,S.jsx)(`div`,{className:`shrink-0 text-xs`,children:(0,S.jsx)(`span`,{className:`px-2 py-1 rounded-full font-medium text-[10px] uppercase tracking-wide ${i===`pending`?`bg-muted text-muted-foreground`:`bg-primary/10 text-primary`}`,children:i??`pending`})})]},`plan-${t}`)})})})]})},`${t}-plan`);if(V9t(e)){let r=e=>(e=e.replace(`acp-ai-sdk-tools`,``),e),i=e.input;if(!i||!i.toolName)return null;let a=r(i.toolName),o=e.state,s=o===`output-available`||o===`output-error`;return(0,S.jsxs)(D9t,{defaultOpen:s,children:[(0,S.jsx)(k9t,{title:r(a.length>20?`${a.slice(0,20)}...`:a),type:a,state:o}),(0,S.jsxs)(A9t,{children:[e.input!==void 0&&(0,S.jsx)(j9t,{input:i.args}),s&&(0,S.jsx)(M9t,{output:e.output?(0,S.jsx)(U7,{code:JSON.stringify(e.output,null,2),language:`json`}):null,errorText:e.errorText})]})]},`${t}-${n}`)}return null}let U9t=({messages:e,status:t,selectedAgent:n})=>{let r=Ac.find(e=>e.name===(n||jc))||Ac[0],i=t===`submitted`||t===`streaming`,a=e[e.length-1],o=i&&(!a||a.role===`user`);return(0,S.jsxs)(qoe,{className:`w-full h-full`,children:[(0,S.jsx)(Joe,{className:`p-3 space-y-3`,children:e.length===0&&!i?(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`p`,{className:`text-sm`,children:`No messages yet`}),(0,S.jsx)(`p`,{className:`text-xs mt-1`,children:`Enter a question below to start`})]})}):(0,S.jsxs)(S.Fragment,{children:[e.map(e=>(0,S.jsxs)(kse,{className:`items-start`,from:e.role,children:[(0,S.jsx)(Ase,{children:e.parts.map((n,r)=>H9t(n,e.id,r,t===`streaming`,e.metadata))}),e.role===`assistant`&&(0,S.jsx)(jse,{name:r.name,src:r.meta?.icon??``})]},e.id)),o&&(0,S.jsxs)(kse,{className:`items-start`,from:`assistant`,children:[(0,S.jsx)(Ase,{children:(0,S.jsx)(Nse,{size:16})}),(0,S.jsx)(jse,{name:r.name,src:r.meta?.icon??``})]})]})}),(0,S.jsx)(Yoe,{})]})};function W9t(e,t,n=50){let[r,i]=(0,_.useState)(``),a=(0,_.useRef)(0),o=(0,_.useRef)(``);return(0,_.useEffect)(()=>{if(e.length<r.length||r&&!e.startsWith(r.slice(0,Math.min(r.length,20)))){i(e),o.current=e,a.current=Date.now();return}if(!t){r!==e&&(i(e),o.current=e);return}let s=e.slice(o.current.length);if(!s)return;let l=Date.now();if(l-a.current<n)return;let u=/[.?!。?!](\s|$)|[\n]/.test(s),d=s.length>50,f=s.trim().length<5;(u&&!f||d)&&(i(e),o.current=e,a.current=l)},[e,t,n,r]),r}function G9t({initialOffset:e={x:0,y:0}}={}){let t=(0,_.useRef)(null),[n,r]=(0,_.useState)(!1),i=(0,_.useRef)(e),a=(0,_.useRef)({x:0,y:0}),o=(0,_.useRef)({x:0,y:0}),s=(0,_.useCallback)(()=>{if(t.current){let{x:e,y:n}=i.current;t.current.style.transform=`translate3d(calc(-50% + ${e}px), ${n}px, 0)`}},[]),l=(0,_.useCallback)(e=>{e.target.closest(`button, input, a, [data-no-drag]`)||(e.preventDefault(),r(!0),a.current={x:e.clientX,y:e.clientY},o.current={...i.current})},[]);return(0,_.useEffect)(()=>{let e=e=>{if(!n)return;let t=e.clientX-a.current.x,r=e.clientY-a.current.y;i.current={x:o.current.x+t,y:o.current.y+r},s()},t=()=>{r(!1)};return n&&(window.addEventListener(`mousemove`,e,{passive:!0}),window.addEventListener(`mouseup`,t)),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[n,s]),(0,_.useEffect)(()=>{s()},[s]),{elementRef:t,isDragging:n,handleMouseDown:l}}let K9t=`AI_SELECTED_AGENT`,q9t=e=>{let[t,n]=(0,_.useState)(()=>{if(typeof window<`u`){let e=localStorage.getItem(K9t);if(e)return e}return e}),[r,i]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{typeof window<`u`?Lc().then(e=>{e&&e!==jc&&n(e)}).finally(()=>{i(!0)}):i(!0)},[]),{agent:t,setAgent:e=>{n(e),!(typeof window>`u`)&&(e?.trim()?localStorage.setItem(K9t,e):localStorage.removeItem(K9t))},isReady:r}},J9t=({isActive:e,onToggleInspector:t,onSubmitAgent:n,onCancel:r,isAgentWorking:i,messages:a,status:o,inspectionCount:s=0,inspectionItems:l=[],onRemoveInspection:u=()=>{},toolsReady:d=!0})=>{let[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(null),[y,b]=(0,_.useState)(`none`),[x,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(!0),{agent:O,setAgent:k,isReady:A}=q9t(jc),[j,M]=(0,_.useState)(!1),[N,P]=(0,_.useState)(null),[F,I]=(0,_.useState)(null),L=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!A||!d)return;let e=!0,t=Ac.find(e=>e.name===O)||Ac[0];return(async()=>{if(L.current){try{await fetch(`${Pc()}/api/acp/cleanup-session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:L.current})})}catch(e){console.warn(`[InspectorBar] Failed to cleanup previous session:`,e)}L.current=null,e&&I(null)}console.log(`[InspectorBar] Initializing session for ${t.name}...`);try{let n=await fetch(`${Pc()}/api/acp/init-session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({agent:t,envVars:{}})});if(!n.ok)throw Error(`Failed to init session`);let r=await n.json();e&&r.sessionId&&(console.log(`[InspectorBar] Session initialized: ${r.sessionId}`),I(r.sessionId),L.current=r.sessionId)}catch(e){console.error(`[InspectorBar] Failed to initialize session:`,e)}})(),()=>{e=!1}},[O,A,d]),(0,_.useEffect)(()=>()=>{L.current&&(console.log(`[InspectorBar] Cleaning up session on unmount: ${L.current}`),fetch(`${Pc()}/api/acp/cleanup-session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:L.current}),keepalive:!0}).catch(e=>console.warn(`[InspectorBar] Failed to cleanup session:`,e)))},[]);let R=Ac.find(e=>e.name===O)||Ac[0],{elementRef:ee,isDragging:te,handleMouseDown:z}=G9t(),[B,ne]=(0,_.useState)(null),[re,ie]=(0,_.useState)(``),ae=W9t(re,i,50),[oe,se]=(0,_.useState)(``),ce=(0,_.useRef)(``),le=(0,_.useRef)(``);(0,_.useEffect)(()=>{let e=ae,t=ce.current;if(e.length<t.length||!e.startsWith(t)){se(e),ce.current=e;return}if(e.length>t.length){let n=e.slice(t.length).trim();n&&se(n),ce.current=e}},[ae]);let ue=(0,_.useRef)(null),de=(0,_.useRef)(null),fe=(0,_.useRef)(null),pe=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(a.length===0){ie(``),v(null),fe.current=null,pe.current=!1,se(``),ce.current=``;return}let e=a[a.length-1];if(e.role!==`assistant`)return;let t=Roe(e),{displayText:n,toolCall:r}=Boe(e,t||fe.current);ie(n||``),t&&(fe.current=t),r?(de.current&&=(clearTimeout(de.current),null),v(r),pe.current=!0):pe.current=!1},[a]),(0,_.useEffect)(()=>{oe!==le.current&&(pe.current||v(null),le.current=oe)},[oe]),(0,_.useEffect)(()=>{f&&ue.current&&ue.current.focus()},[f]),(0,_.useEffect)(()=>{if(!i&&w){C(!1),T(!1),D(!1);let e=setTimeout(()=>{D(!0)},2e3);return()=>clearTimeout(e)}},[i,w]),(0,_.useEffect)(()=>{function e(e){let{plan:t,inspectionId:n}=e.detail;if(t?.steps){let e=t.steps.find(e=>e.status===`in-progress`),r=t.steps.filter(e=>e.status===`completed`).length;ne({id:n,status:`in-progress`,currentStep:e?{title:e.title,index:r+1,total:t.steps.length}:void 0})}}function t(e){let{status:t,result:n,inspectionId:r}=e.detail;ne({id:r,status:t,message:n?.message||n})}return window.addEventListener(`plan-progress-reported`,e),window.addEventListener(`inspection-result-received`,t),()=>{window.removeEventListener(`plan-progress-reported`,e),window.removeEventListener(`inspection-result-received`,t)}},[]);let me=e=>{e.preventDefault(),m.trim()&&(de.current&&=(clearTimeout(de.current),null),v(null),ie(``),se(``),ne(null),fe.current=null,ce.current=``,C(!0),T(!0),n(m,O,F||void 0),h(``),p(!0),b(`chat`))},he=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),me(e)),e.key===`Escape`&&(p(!1),ue.current?.blur())},ge=o===`error`,_e=a.length>0,ve=f&&!x,ye=(!f||x)&&(i||_e||B);return(0,S.jsxs)(S.Fragment,{children:[(f||y!==`none`)&&(0,S.jsx)(`div`,{className:`fixed inset-0 z-[999998] bg-transparent`,onClick:()=>{!w&&!i&&(p(!1),b(`none`))}}),(0,S.jsxs)(`div`,{ref:ee,className:nt(`fixed bottom-8 left-1/2 z-[999999]`,`transition-all duration-300 ease-[cubic-bezier(0.23,1,0.32,1)]`,f?`w-[480px]`:ye?`w-auto min-w-[200px] max-w-[480px]`:`w-[190px]`,te?`cursor-grabbing`:`cursor-grab`),onMouseDown:z,onMouseEnter:()=>{te||(i||w?(p(!0),b(`chat`)):E&&p(!0))},onMouseLeave:()=>{!m.trim()&&!w&&!te&&(p(!1),b(`none`)),D(!0)},children:[(0,S.jsxs)(`div`,{className:nt(`relative flex items-center backdrop-blur-xl shadow-2xl border border-border`,`transition-[width,height,padding,background-color,border-color] duration-200 ease-out`,f?`h-12 p-2 pl-4`:`h-9 px-2 py-1`,y===`none`?`bg-muted/90 rounded-full`:`bg-muted/95 rounded-b-lg rounded-t-none border-t-0`,ge&&!f&&`bg-destructive/10 border-destructive/20`),children:[(0,S.jsxs)(`div`,{className:nt(`flex items-center transition-opacity duration-300 w-full relative`,ve?`absolute left-3 opacity-0 pointer-events-none`:`relative opacity-100`),children:[!ye&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:(0,S.jsx)(Mt,{className:`w-3.5 h-3.5 text-foreground`})}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground/70 ml-3 whitespace-nowrap`,children:`⌥I or hover to inspect`})]}),ye&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[(0,S.jsx)(`div`,{className:`relative flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:i?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-foreground`}),(0,S.jsx)(Mt,{className:`w-3.5 h-3.5 animate-pulse text-foreground`})]}):B?B.status===`in-progress`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-blue-500`}),(0,S.jsx)(Nt,{className:`w-3.5 h-3.5 animate-pulse text-blue-500`})]}):B.status===`completed`?(0,S.jsx)(St,{className:`w-5 h-5 text-green-500`}):(0,S.jsx)(Ct,{className:`w-5 h-5 text-red-500`}):ge?(0,S.jsx)(Ct,{className:`w-5 h-5 text-red-500`}):(0,S.jsx)(St,{className:`w-5 h-5 text-green-500`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsx)(`div`,{className:`flex-1 flex justify-center min-w-0 pl-2`,children:(0,S.jsx)(`div`,{className:`flex flex-col min-w-0 max-w-full pr-2 max-h-[24px] overflow-hidden`,children:B&&B.status===`in-progress`&&B.currentStep?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(Nt,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsxs)(`span`,{className:`truncate min-w-0`,children:[`Step `,B.currentStep.index,`/`,B.currentStep.total,`: `,B.currentStep.title]})]}):B?.message?(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:B.message}):g?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(Nt,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsx)(`span`,{className:`truncate min-w-0`,children:g})]}):(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:i&&!oe?(0,S.jsx)(Foe,{duration:2,spread:2,children:o===`submitted`&&R?.command===`npx`?`Starting ${R.name}... This may take a moment.`:`Thinking...`}):oe||`Processing...`})})})]})]}),(0,S.jsxs)(`div`,{className:nt(`flex items-center w-full gap-3 transition-all duration-500 delay-75`,ve?`opacity-100 translate-y-0 relative pointer-events-auto`:`opacity-0 translate-y-4 pointer-events-none absolute top-2 left-4 right-2`),onClick:e=>e.stopPropagation(),children:[(0,S.jsx)(`button`,{onClick:t,className:nt(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,e?`bg-blue-500 text-white shadow-[0_0_15px_rgba(59,130,246,0.5)]`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:`Toggle Inspector (⌥I)`,children:(0,S.jsx)(Et,{className:`w-3.5 h-3.5`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`}),s>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>b(e=>e===`inspections`?`none`:`inspections`),className:nt(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,`hover:bg-accent/50`,y===`inspections`&&`bg-accent/50 text-foreground`),title:`View Inspections`,children:[(0,S.jsx)(Dt,{className:`w-3.5 h-3.5`}),(0,S.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 flex items-center justify-center min-w-[12px] h-[12px] px-0.5 text-[8px] font-bold text-white bg-red-500 rounded-full border border-background shadow-sm leading-none`,children:s>99?`99+`:s})]}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsxs)(`form`,{onSubmit:me,className:`flex-1 flex items-center gap-2 min-w-0`,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`div`,{className:`relative flex-shrink-0`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>M(!j),className:`flex items-center justify-center w-7 h-7 rounded-full hover:bg-accent/50 transition-colors`,title:`Select Agent`,children:(0,S.jsx)(`img`,{src:Ac.find(e=>e.name===O)?.meta?.icon,alt:O,className:`w-3.5 h-3.5`})}),j&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`fixed inset-0 z-[999998]`,onClick:()=>M(!1)}),(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 mb-2 w-64 bg-popover border border-border rounded-lg shadow-lg overflow-hidden z-[999999] animate-in fade-in zoom-in-95 duration-200`,children:Ac.map(e=>(0,S.jsxs)(`div`,{className:nt(`w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-accent transition-colors group`,O===e.name&&`bg-accent/50 font-medium`),children:[(0,S.jsxs)(`button`,{onClick:()=>{k(e.name),M(!1)},className:`flex items-center gap-2 flex-1 text-left`,children:[e.meta?.icon&&(0,S.jsx)(`img`,{src:e.meta.icon,alt:``,className:`w-4 h-4 flex-shrink-0`}),(0,S.jsx)(`span`,{className:`flex-1`,children:e.name})]}),(e.configHint||e.configLink)&&(0,S.jsx)(`button`,{onClick:t=>{t.stopPropagation(),P(e.name)},className:`p-1 rounded hover:bg-accent-foreground/10 transition-colors`,title:`Configuration info`,children:(0,S.jsx)(Ot,{className:`w-3.5 h-3.5 text-muted-foreground`})})]},e.name))})]})]}),(0,S.jsx)(`input`,{ref:ue,type:`text`,value:m,onChange:e=>h(e.target.value),onKeyDown:he,placeholder:`Ask ${O}...`,className:`w-full bg-transparent border-none outline-none text-foreground placeholder-muted-foreground text-sm h-7 disabled:opacity-50`,tabIndex:0,disabled:i}),(a.length>0||i||w)&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>b(e=>e===`chat`?`none`:`chat`),className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,y===`chat`?`bg-foreground text-background`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:y===`chat`?`Collapse`:`Expand messages`,children:(0,S.jsx)(vt,{className:nt(`w-3.5 h-3.5 transition-transform duration-300`,y===`chat`&&`rotate-180`)})}),i?(0,S.jsx)(`button`,{type:`button`,onClick:r,className:`flex items-center justify-center w-7 h-7 rounded-full bg-destructive text-destructive-foreground transition-all flex-shrink-0 hover:bg-destructive/90`,title:`Cancel request`,children:(0,S.jsx)(tee,{className:`w-3 h-3`})}):(0,S.jsx)(`button`,{type:`submit`,disabled:!m.trim(),className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,m.trim()?`bg-foreground text-background scale-100`:`bg-accent text-muted-foreground/50 scale-90`),children:(0,S.jsx)(ht,{className:`w-3.5 h-3.5`})})]})]})]}),y!==`none`&&(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 right-0 pointer-events-auto max-w-[480px] mx-auto animate-panel-in`,children:(0,S.jsxs)(`div`,{className:`bg-muted/95 backdrop-blur-xl rounded-t-xl border border-border border-b-0 shadow-2xl overflow-hidden`,children:[y===`inspections`&&l.length>0&&(0,S.jsx)(`div`,{className:`border-b border-border`,children:(0,S.jsx)(pee,{items:l,onRemove:u})}),y===`chat`&&(0,S.jsx)(`div`,{className:`h-[500px]`,children:(0,S.jsx)(U9t,{messages:a,status:o,selectedAgent:O})})]})})]}),N&&(()=>{let e=Ac.find(e=>e.name===N);return e?(0,S.jsx)(Lt,{open:!!N,onOpenChange:()=>P(null),children:(0,S.jsxs)(Rt,{onClose:()=>P(null),className:`w-80`,children:[(0,S.jsxs)(zt,{children:[(0,S.jsxs)(nee,{className:`flex items-center gap-3`,children:[e.meta?.icon&&(0,S.jsx)(`img`,{src:e.meta.icon,alt:``,className:`w-6 h-6`}),e.name]}),e.configHint&&(0,S.jsx)(Vt,{children:e.configHint})]}),e.configLink&&(0,S.jsx)(`a`,{href:e.configLink,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-sm text-blue-500 hover:text-blue-600 underline`,children:`View ACP Documentation →`})]})}):null})()]})};var Y9t=`vercel.ai.error`,X9t=Symbol.for(Y9t),Z9t,Q9t=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[Z9t]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Y9t)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};Z9t=X9t;var W7=Q9t;function $9t(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var een=`AI_InvalidArgumentError`,ten=`vercel.ai.error.${een}`,nen=Symbol.for(ten),ren,ien=class extends W7{constructor({message:e,cause:t,argument:n}){super({name:een,message:e,cause:t}),this[ren]=!0,this.argument=n}static isInstance(e){return W7.hasMarker(e,ten)}};ren=nen;var aen=`AI_JSONParseError`,oen=`vercel.ai.error.${aen}`,sen=Symbol.for(oen),cen,len=class extends W7{constructor({text:e,cause:t}){super({name:aen,message:`JSON parsing failed: Text: ${e}.
|
|
6882
6886
|
Error message: ${$9t(t)}`,cause:t}),this[cen]=!0,this.text=e}static isInstance(e){return W7.hasMarker(e,oen)}};cen=sen;var uen=`AI_TypeValidationError`,den=`vercel.ai.error.${uen}`,fen=Symbol.for(den),pen,men=class e extends W7{constructor({value:e,cause:t}){super({name:uen,message:`Type validation failed: Value: ${JSON.stringify(e)}.
|
|
6883
6887
|
Error message: ${$9t(t)}`,cause:t}),this[pen]=!0,this.value=e}static isInstance(e){return W7.hasMarker(e,den)}static wrap({value:t,cause:n}){return e.isInstance(n)&&n.value===t?n:new e({value:t,cause:n})}};pen=fen;var G7=men,hen=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let r;super({start(i){r=Lo({onEvent:e=>{i.enqueue(e)},onError(t){e===`terminate`?i.error(t):typeof e==`function`&&e(t)},onRetry:t,onComment:n})},transform(e){r.feed(e)}})}};Object.freeze({status:`aborted`});function K7(e,t,n){function r(n,r){var i;for(let a in Object.defineProperty(n,`_zod`,{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r),o.prototype)a in n||Object.defineProperty(n,a,{value:o.prototype[a].bind(n)});n._zod.constr=o,n._zod.def=r}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var q7=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};let gen={};function J7(e){return e&&Object.assign(gen,e),gen}function _en(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ven(e,t){return typeof t==`bigint`?t.toString():t}function yen(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function ben(e){return e==null}function xen(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Sen(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}function Y7(e,t,n){Object.defineProperty(e,t,{get(){{let r=n();return e[t]=r,r}throw Error(`cached value already set`)},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function X7(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Z7(e){return JSON.stringify(e)}let Cen=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Q7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let wen=yen(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function $7(e){if(Q7(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(Q7(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}let Ten=new Set([`string`,`number`,`symbol`]);function e9(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function t9(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function n9(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Een(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}let Den={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Oen(e,t){let n={},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=r.shape[e])}return t9(e,{...e._zod.def,shape:n,checks:[]})}function ken(e,t){let n={...e._zod.def.shape},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return t9(e,{...e._zod.def,shape:n,checks:[]})}function Aen(e,t){if(!$7(t))throw Error(`Invalid input to extend: expected a plain object`);return t9(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return X7(this,`shape`,n),n},checks:[]})}function jen(e,t){return t9(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return X7(this,`shape`,n),n},catchall:t._zod.def.catchall,checks:[]})}function Men(e,t,n){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return t9(t,{...t._zod.def,shape:i,checks:[]})}function Nen(e,t,n){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return t9(t,{...t._zod.def,shape:i,checks:[]})}function r9(e,t=0){for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function i9(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function a9(e){return typeof e==`string`?e:e?.message}function o9(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=a9(e.inst?._zod.def?.error?.(e))??a9(t?.error?.(e))??a9(n.customError?.(e))??a9(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Pen(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function s9(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}let Fen=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),Object.defineProperty(e,`message`,{get(){return JSON.stringify(t,ven,2)},enumerable:!0}),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Ien=K7(`$ZodError`,Fen),Len=K7(`$ZodError`,Fen,{Parent:Error});function Ren(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function zen(e,t){let n=t||function(e){return e.message},r={_errors:[]},i=e=>{for(let t of e.issues)if(t.code===`invalid_union`&&t.errors.length)t.errors.map(e=>i({issues:e}));else if(t.code===`invalid_key`)i({issues:t.issues});else if(t.code===`invalid_element`)i({issues:t.issues});else if(t.path.length===0)r._errors.push(n(t));else{let e=r,i=0;for(;i<t.path.length;){let r=t.path[i];i===t.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(n(t))):e[r]=e[r]||{_errors:[]},e=e[r],i++}}};return i(e),r}let Ben=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new q7;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>o9(e,a,J7())));throw Cen(t,i?.callee),t}return o.value},Ven=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>o9(e,a,J7())));throw Cen(t,i?.callee),t}return o.value},Hen=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new q7;return a.issues.length?{success:!1,error:new(e??Ien)(a.issues.map(e=>o9(e,i,J7())))}:{success:!0,data:a.value}},Uen=Hen(Len),Wen=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>o9(e,i,J7())))}:{success:!0,data:a.value}},Gen=Wen(Len),Ken=/^[cC][^\s-]{8,}$/,qen=/^[0-9a-z]+$/,Jen=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Yen=/^[0-9a-vA-V]{20}$/,Xen=/^[A-Za-z0-9]{27}$/,Zen=/^[a-zA-Z0-9_-]{21}$/,Qen=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,$en=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,etn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,ttn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function ntn(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}let rtn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,itn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,atn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,otn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,stn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ctn=/^[A-Za-z0-9_-]*$/,ltn=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,utn=/^\+(?:[0-9]){6,14}[0-9]$/,dtn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,ftn=RegExp(`^${dtn}$`);function ptn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function mtn(e){return RegExp(`^${ptn(e)}$`)}function htn(e){let t=ptn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-]\\d{2}:\\d{2})`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${dtn}T(?:${r})$`)}let gtn=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},_tn=/^\d+$/,vtn=/^-?\d+(?:\.\d+)?/i,ytn=/true|false/i,btn=/null/i,xtn=/^[^A-Z]*$/,Stn=/^[^a-z]*$/,c9=K7(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ctn={number:`number`,bigint:`bigint`,object:`date`},wtn=K7(`$ZodCheckLessThan`,(e,t)=>{c9.init(e,t);let n=Ctn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ttn=K7(`$ZodCheckGreaterThan`,(e,t)=>{c9.init(e,t);let n=Ctn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Etn=K7(`$ZodCheckMultipleOf`,(e,t)=>{c9.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Sen(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Dtn=K7(`$ZodCheckNumberFormat`,(e,t)=>{c9.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Den[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=_tn)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inst:e})}}),Otn=K7(`$ZodCheckMaxLength`,(e,t)=>{var n;c9.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ben(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Pen(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ktn=K7(`$ZodCheckMinLength`,(e,t)=>{var n;c9.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ben(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Pen(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Atn=K7(`$ZodCheckLengthEquals`,(e,t)=>{var n;c9.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ben(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Pen(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),l9=K7(`$ZodCheckStringFormat`,(e,t)=>{var n,r;c9.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),jtn=K7(`$ZodCheckRegex`,(e,t)=>{l9.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Mtn=K7(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=xtn,l9.init(e,t)}),Ntn=K7(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Stn,l9.init(e,t)}),Ptn=K7(`$ZodCheckIncludes`,(e,t)=>{c9.init(e,t);let n=e9(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ftn=K7(`$ZodCheckStartsWith`,(e,t)=>{c9.init(e,t);let n=RegExp(`^${e9(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Itn=K7(`$ZodCheckEndsWith`,(e,t)=>{c9.init(e,t);let n=RegExp(`.*${e9(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Ltn=K7(`$ZodCheckOverwrite`,(e,t)=>{c9.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Rtn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
6884
6888
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
package/dist/config-updater.cjs
CHANGED
|
@@ -37,6 +37,7 @@ let url = require("url");
|
|
|
37
37
|
let ai = require("ai");
|
|
38
38
|
let _agentclientprotocol_sdk = require("@agentclientprotocol/sdk");
|
|
39
39
|
let node_child_process = require("node:child_process");
|
|
40
|
+
let module$1 = require("module");
|
|
40
41
|
let fs_promises = require("fs/promises");
|
|
41
42
|
|
|
42
43
|
//#region ../../node_modules/.pnpm/@mcpc-tech+cmcp@0.0.15/node_modules/@mcpc-tech/cmcp/index.mjs
|
|
@@ -34870,7 +34871,7 @@ var require_snapshot_utils = /* @__PURE__ */ require_chunk.__commonJSMin(((expor
|
|
|
34870
34871
|
//#region ../../node_modules/.pnpm/undici@7.16.0/node_modules/undici/lib/mock/snapshot-recorder.js
|
|
34871
34872
|
var require_snapshot_recorder = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
|
|
34872
34873
|
const { writeFile: writeFile$1, readFile: readFile$1, mkdir: mkdir$1 } = require("node:fs/promises");
|
|
34873
|
-
const { dirname: dirname$
|
|
34874
|
+
const { dirname: dirname$2, resolve } = require("node:path");
|
|
34874
34875
|
const { setTimeout: setTimeout$1, clearTimeout: clearTimeout$1 } = require("node:timers");
|
|
34875
34876
|
const { InvalidArgumentError, UndiciError } = require_errors$1();
|
|
34876
34877
|
const { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -35149,7 +35150,7 @@ var require_snapshot_recorder = /* @__PURE__ */ require_chunk.__commonJSMin(((ex
|
|
|
35149
35150
|
const path$3 = filePath || this.#snapshotPath;
|
|
35150
35151
|
if (!path$3) throw new InvalidArgumentError("Snapshot path is required");
|
|
35151
35152
|
const resolvedPath = resolve(path$3);
|
|
35152
|
-
await mkdir$1(dirname$
|
|
35153
|
+
await mkdir$1(dirname$2(resolvedPath), { recursive: true });
|
|
35153
35154
|
const data$1 = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
35154
35155
|
hash,
|
|
35155
35156
|
snapshot
|
|
@@ -83446,6 +83447,19 @@ async function getOrCreateMcpClient(defKey, def) {
|
|
|
83446
83447
|
mcpClientConnecting.delete(defKey);
|
|
83447
83448
|
}
|
|
83448
83449
|
}
|
|
83450
|
+
async function releaseMcpClient(defKey) {
|
|
83451
|
+
const entry = mcpClientPool.get(defKey);
|
|
83452
|
+
if (!entry) return;
|
|
83453
|
+
entry.refCount -= 1;
|
|
83454
|
+
if (entry.refCount <= 0) {
|
|
83455
|
+
mcpClientPool.delete(defKey);
|
|
83456
|
+
try {
|
|
83457
|
+
await entry.client.close();
|
|
83458
|
+
} catch (err) {
|
|
83459
|
+
console.error("Error closing MCP client:", err);
|
|
83460
|
+
}
|
|
83461
|
+
}
|
|
83462
|
+
}
|
|
83449
83463
|
var cleanupAllPooledClients = async () => {
|
|
83450
83464
|
const entries = Array.from(mcpClientPool.entries());
|
|
83451
83465
|
mcpClientPool.clear();
|
|
@@ -83503,7 +83517,12 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
83503
83517
|
console.error(`Error creating MCP client for ${name}:`, error);
|
|
83504
83518
|
}
|
|
83505
83519
|
}
|
|
83506
|
-
const cleanupClients = async () => {
|
|
83520
|
+
const cleanupClients = async () => {
|
|
83521
|
+
await Promise.all(acquiredKeys.map((k) => releaseMcpClient(k)));
|
|
83522
|
+
acquiredKeys.length = 0;
|
|
83523
|
+
Object.keys(allTools).forEach((key) => delete allTools[key]);
|
|
83524
|
+
Object.keys(allClients).forEach((key) => delete allClients[key]);
|
|
83525
|
+
};
|
|
83507
83526
|
return {
|
|
83508
83527
|
tools: allTools,
|
|
83509
83528
|
clients: allClients,
|
|
@@ -86305,6 +86324,17 @@ var ComposableMCPServer = class extends _modelcontextprotocol_sdk_server_index_j
|
|
|
86305
86324
|
server: this,
|
|
86306
86325
|
toolNames: Object.keys(allTools)
|
|
86307
86326
|
});
|
|
86327
|
+
this.onclose = async () => {
|
|
86328
|
+
await cleanupClients();
|
|
86329
|
+
await this.disposePlugins();
|
|
86330
|
+
await this.logger.info(`[${name}] Event: closed - cleaned up dependent clients and plugins`);
|
|
86331
|
+
};
|
|
86332
|
+
this.onerror = async (error) => {
|
|
86333
|
+
await this.logger.error(`[${name}] Event: error - ${error?.stack ?? String(error)}`);
|
|
86334
|
+
await cleanupClients();
|
|
86335
|
+
await this.disposePlugins();
|
|
86336
|
+
await this.logger.info(`[${name}] Action: cleaned up dependent clients and plugins`);
|
|
86337
|
+
};
|
|
86308
86338
|
const toolNameToDetailList = Object.entries(allTools);
|
|
86309
86339
|
const publicToolNames = this.getPublicToolNames();
|
|
86310
86340
|
const hiddenToolNames = this.getHiddenToolNames();
|
|
@@ -87209,7 +87239,7 @@ function setupInspectorMiddleware(middlewares, config) {
|
|
|
87209
87239
|
}
|
|
87210
87240
|
|
|
87211
87241
|
//#endregion
|
|
87212
|
-
//#region ../../node_modules/.pnpm/@mcpc-tech+acp-ai-provider@0.1.
|
|
87242
|
+
//#region ../../node_modules/.pnpm/@mcpc-tech+acp-ai-provider@0.1.43/node_modules/@mcpc-tech/acp-ai-provider/index.mjs
|
|
87213
87243
|
(0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
87214
87244
|
function formatToolError(toolResult) {
|
|
87215
87245
|
if (!toolResult || toolResult.length === 0) return "Unknown tool error";
|
|
@@ -87652,7 +87682,6 @@ var ACPLanguageModel = class {
|
|
|
87652
87682
|
*/
|
|
87653
87683
|
parseToolCall(update$1) {
|
|
87654
87684
|
if (update$1.sessionUpdate !== "tool_call") throw new Error("Invalid update type for parseToolCall");
|
|
87655
|
-
console.log("Parsing tool call update:", JSON.stringify(update$1, null, 2));
|
|
87656
87685
|
return {
|
|
87657
87686
|
toolCallId: update$1.toolCallId,
|
|
87658
87687
|
toolName: update$1.title || update$1.toolCallId,
|
|
@@ -87954,11 +87983,6 @@ var ACPLanguageModel = class {
|
|
|
87954
87983
|
this.currentThinkingId = null;
|
|
87955
87984
|
}
|
|
87956
87985
|
const { toolCallId, toolName, toolInput } = this.parseToolCall(update$1);
|
|
87957
|
-
console.log(`Parsing tool call: ${JSON.stringify({
|
|
87958
|
-
toolCallId,
|
|
87959
|
-
toolName,
|
|
87960
|
-
toolInput
|
|
87961
|
-
}, null, 2)}`);
|
|
87962
87986
|
const existingToolCall = this.toolCallsMap.get(toolCallId);
|
|
87963
87987
|
const hasInput = toolInput && typeof toolInput === "object" && Object.keys(toolInput).length > 0;
|
|
87964
87988
|
if (!existingToolCall) {
|
|
@@ -87985,13 +88009,14 @@ var ACPLanguageModel = class {
|
|
|
87985
88009
|
});
|
|
87986
88010
|
} else if (!existingToolCall.inputAvailable && hasInput) {
|
|
87987
88011
|
existingToolCall.inputAvailable = true;
|
|
88012
|
+
if (update$1.title && existingToolCall.name !== update$1.title && update$1.title !== toolCallId) existingToolCall.name = update$1.title;
|
|
87988
88013
|
controller.enqueue({
|
|
87989
88014
|
type: "tool-call",
|
|
87990
88015
|
toolCallId,
|
|
87991
88016
|
toolName: ACP_PROVIDER_AGENT_DYNAMIC_TOOL_NAME2,
|
|
87992
88017
|
input: JSON.stringify({
|
|
87993
88018
|
toolCallId,
|
|
87994
|
-
toolName,
|
|
88019
|
+
toolName: existingToolCall.name,
|
|
87995
88020
|
args: toolInput
|
|
87996
88021
|
})
|
|
87997
88022
|
});
|
|
@@ -88018,13 +88043,14 @@ var ACPLanguageModel = class {
|
|
|
88018
88043
|
}
|
|
88019
88044
|
if (!toolInfo.inputAvailable) {
|
|
88020
88045
|
toolInfo.inputAvailable = true;
|
|
88046
|
+
if (update$1.title && toolInfo.name !== update$1.title && update$1.title !== toolCallId) toolInfo.name = update$1.title;
|
|
88021
88047
|
controller.enqueue({
|
|
88022
88048
|
type: "tool-call",
|
|
88023
88049
|
toolCallId,
|
|
88024
88050
|
toolName: ACP_PROVIDER_AGENT_DYNAMIC_TOOL_NAME2,
|
|
88025
88051
|
input: JSON.stringify({
|
|
88026
88052
|
toolCallId,
|
|
88027
|
-
toolName,
|
|
88053
|
+
toolName: toolInfo.name,
|
|
88028
88054
|
args: {}
|
|
88029
88055
|
})
|
|
88030
88056
|
});
|
|
@@ -88050,13 +88076,14 @@ var ACPLanguageModel = class {
|
|
|
88050
88076
|
});
|
|
88051
88077
|
} else if (!toolInfo.inputAvailable) {
|
|
88052
88078
|
toolInfo.inputAvailable = true;
|
|
88079
|
+
if (update$1.title && toolInfo.name !== update$1.title && update$1.title !== toolCallId) toolInfo.name = update$1.title;
|
|
88053
88080
|
controller.enqueue({
|
|
88054
88081
|
type: "tool-call",
|
|
88055
88082
|
toolCallId,
|
|
88056
88083
|
toolName: ACP_PROVIDER_AGENT_DYNAMIC_TOOL_NAME2,
|
|
88057
88084
|
input: JSON.stringify({
|
|
88058
88085
|
toolCallId,
|
|
88059
|
-
toolName,
|
|
88086
|
+
toolName: toolInfo.name,
|
|
88060
88087
|
args: {}
|
|
88061
88088
|
})
|
|
88062
88089
|
});
|
|
@@ -88083,7 +88110,6 @@ var ACPLanguageModel = class {
|
|
|
88083
88110
|
try {
|
|
88084
88111
|
await this.ensureConnected();
|
|
88085
88112
|
const promptContent = convertAiSdkMessagesToAcp(options, this.isFreshSession);
|
|
88086
|
-
console.log(`###########`, promptContent);
|
|
88087
88113
|
this.isFreshSession = false;
|
|
88088
88114
|
let accumulatedText = "";
|
|
88089
88115
|
const toolCalls = [];
|
|
@@ -88290,6 +88316,36 @@ function createACPProvider(config) {
|
|
|
88290
88316
|
return new ACPProvider(config);
|
|
88291
88317
|
}
|
|
88292
88318
|
|
|
88319
|
+
//#endregion
|
|
88320
|
+
//#region src/utils/npm-package.ts
|
|
88321
|
+
/**
|
|
88322
|
+
* Resolve npm package bin entry point
|
|
88323
|
+
* Returns the absolute path to the bin file, or null if resolution fails
|
|
88324
|
+
*/
|
|
88325
|
+
function resolveNpmPackageBin(packageName) {
|
|
88326
|
+
try {
|
|
88327
|
+
const packageJsonPath = (0, module$1.createRequire)(require("url").pathToFileURL(__filename).href).resolve(`${packageName}/package.json`);
|
|
88328
|
+
const packageJson = JSON.parse((0, fs.readFileSync)(packageJsonPath, "utf-8"));
|
|
88329
|
+
let binPath;
|
|
88330
|
+
if (typeof packageJson.bin === "string") binPath = packageJson.bin;
|
|
88331
|
+
else if (typeof packageJson.bin === "object") {
|
|
88332
|
+
const binEntries = Object.entries(packageJson.bin);
|
|
88333
|
+
const matchingEntry = binEntries.find(([name]) => name === packageJson.name.split("/").pop());
|
|
88334
|
+
binPath = matchingEntry ? matchingEntry[1] : binEntries[0]?.[1];
|
|
88335
|
+
}
|
|
88336
|
+
if (!binPath) {
|
|
88337
|
+
console.warn(`[dev-inspector] [acp] No bin entry found in ${packageName}/package.json`);
|
|
88338
|
+
return null;
|
|
88339
|
+
}
|
|
88340
|
+
const binFullPath = (0, path.join)((0, path.dirname)(packageJsonPath), binPath);
|
|
88341
|
+
console.log(`[dev-inspector] [acp] Resolved ${packageName} bin to: ${binFullPath}`);
|
|
88342
|
+
return binFullPath;
|
|
88343
|
+
} catch (error) {
|
|
88344
|
+
console.warn(`[dev-inspector] [acp] Failed to resolve npm package ${packageName}:`, error);
|
|
88345
|
+
return null;
|
|
88346
|
+
}
|
|
88347
|
+
}
|
|
88348
|
+
|
|
88293
88349
|
//#endregion
|
|
88294
88350
|
//#region src/middleware/acp-middleware.ts
|
|
88295
88351
|
/**
|
|
@@ -88358,10 +88414,13 @@ async function loadMcpToolsV5(transport) {
|
|
|
88358
88414
|
inputSchema: (0, ai.jsonSchema)(toolInfo.inputSchema),
|
|
88359
88415
|
execute: async (args) => {
|
|
88360
88416
|
console.log(`[dev-inspector] [acp] Executing MCP tool: ${toolName}`);
|
|
88361
|
-
|
|
88417
|
+
const result = await callMcpMethodViaTransport(transport, "tools/call", {
|
|
88362
88418
|
name: toolName,
|
|
88363
88419
|
arguments: args
|
|
88364
88420
|
});
|
|
88421
|
+
const parsedResult = _modelcontextprotocol_sdk_types_js.CallToolResultSchema.safeParse(result);
|
|
88422
|
+
if (!parsedResult.success) return result;
|
|
88423
|
+
return parsedResult.data?.content?.map((item) => item?.text).join("\n");
|
|
88365
88424
|
}
|
|
88366
88425
|
});
|
|
88367
88426
|
}
|
|
@@ -88451,9 +88510,19 @@ function setupAcpMiddleware(middlewares, serverContext, acpOptions) {
|
|
|
88451
88510
|
return;
|
|
88452
88511
|
}
|
|
88453
88512
|
console.log(`[dev-inspector] [acp] Creating new global provider for ${agent.name}`);
|
|
88513
|
+
let command = agent.command;
|
|
88514
|
+
let args = agent.args;
|
|
88515
|
+
if (agent.npmPackage) {
|
|
88516
|
+
const binPath = resolveNpmPackageBin(agent.npmPackage);
|
|
88517
|
+
if (binPath) {
|
|
88518
|
+
command = binPath;
|
|
88519
|
+
args = agent.npmArgs || [];
|
|
88520
|
+
console.log(`[dev-inspector] [acp] Using resolved npm package: ${agent.npmPackage}`);
|
|
88521
|
+
} else console.log(`[dev-inspector] [acp] Failed to resolve npm package, falling back to: ${agent.command}`);
|
|
88522
|
+
}
|
|
88454
88523
|
provider = createACPProvider({
|
|
88455
|
-
command
|
|
88456
|
-
args
|
|
88524
|
+
command,
|
|
88525
|
+
args,
|
|
88457
88526
|
env: {
|
|
88458
88527
|
...process.env,
|
|
88459
88528
|
...envVars
|
|
@@ -88588,9 +88657,19 @@ function setupAcpMiddleware(middlewares, serverContext, acpOptions) {
|
|
|
88588
88657
|
shouldCleanupProvider = false;
|
|
88589
88658
|
} else {
|
|
88590
88659
|
console.log(`[dev-inspector] [acp] Creating new provider (no session found or provided)`);
|
|
88660
|
+
let command = agent.command;
|
|
88661
|
+
let args = agent.args;
|
|
88662
|
+
if (agent.npmPackage) {
|
|
88663
|
+
const binPath = resolveNpmPackageBin(agent.npmPackage);
|
|
88664
|
+
if (binPath) {
|
|
88665
|
+
command = binPath;
|
|
88666
|
+
args = agent.npmArgs || [];
|
|
88667
|
+
console.log(`[dev-inspector] [acp] Using resolved npm package: ${agent.npmPackage}`);
|
|
88668
|
+
}
|
|
88669
|
+
}
|
|
88591
88670
|
provider = createACPProvider({
|
|
88592
|
-
command
|
|
88593
|
-
args
|
|
88671
|
+
command,
|
|
88672
|
+
args,
|
|
88594
88673
|
env: {
|
|
88595
88674
|
...process.env,
|
|
88596
88675
|
...envVars
|
package/dist/config-updater.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|
3
3
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
4
4
|
import { randomUUID } from "crypto";
|
|
5
|
-
import { CallToolRequestSchema, CompleteRequestSchema, ErrorCode, GetPromptRequestSchema, JSONRPCMessageSchema, ListPromptsRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, McpError, PingRequestSchema, ReadResourceRequestSchema, SetLevelRequestSchema, SubscribeRequestSchema, UnsubscribeRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import { CallToolRequestSchema, CallToolResultSchema, CompleteRequestSchema, ErrorCode, GetPromptRequestSchema, JSONRPCMessageSchema, ListPromptsRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, McpError, PingRequestSchema, ReadResourceRequestSchema, SetLevelRequestSchema, SubscribeRequestSchema, UnsubscribeRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
6
6
|
import z$1, { z } from "zod";
|
|
7
7
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
8
8
|
import { Readable, Writable } from "node:stream";
|
|
@@ -18,7 +18,7 @@ import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
|
|
|
18
18
|
import process$1, { cwd } from "node:process";
|
|
19
19
|
import { homedir } from "os";
|
|
20
20
|
import { execSync } from "child_process";
|
|
21
|
-
import fs, { existsSync } from "fs";
|
|
21
|
+
import fs, { existsSync, readFileSync } from "fs";
|
|
22
22
|
import * as http from "http";
|
|
23
23
|
import * as https from "https";
|
|
24
24
|
import * as zlib from "zlib";
|
|
@@ -28,6 +28,7 @@ import { fileURLToPath as fileURLToPath$1 } from "url";
|
|
|
28
28
|
import { asSchema, convertToModelMessages, jsonSchema, streamText, tool } from "ai";
|
|
29
29
|
import { ClientSideConnection, PROTOCOL_VERSION, ndJsonStream, planEntrySchema } from "@agentclientprotocol/sdk";
|
|
30
30
|
import { spawn } from "node:child_process";
|
|
31
|
+
import { createRequire as createRequire$1 } from "module";
|
|
31
32
|
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
32
33
|
|
|
33
34
|
//#region rolldown:runtime
|
|
@@ -83481,6 +83482,19 @@ async function getOrCreateMcpClient(defKey, def) {
|
|
|
83481
83482
|
mcpClientConnecting.delete(defKey);
|
|
83482
83483
|
}
|
|
83483
83484
|
}
|
|
83485
|
+
async function releaseMcpClient(defKey) {
|
|
83486
|
+
const entry = mcpClientPool.get(defKey);
|
|
83487
|
+
if (!entry) return;
|
|
83488
|
+
entry.refCount -= 1;
|
|
83489
|
+
if (entry.refCount <= 0) {
|
|
83490
|
+
mcpClientPool.delete(defKey);
|
|
83491
|
+
try {
|
|
83492
|
+
await entry.client.close();
|
|
83493
|
+
} catch (err) {
|
|
83494
|
+
console.error("Error closing MCP client:", err);
|
|
83495
|
+
}
|
|
83496
|
+
}
|
|
83497
|
+
}
|
|
83484
83498
|
var cleanupAllPooledClients = async () => {
|
|
83485
83499
|
const entries = Array.from(mcpClientPool.entries());
|
|
83486
83500
|
mcpClientPool.clear();
|
|
@@ -83538,7 +83552,12 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
83538
83552
|
console.error(`Error creating MCP client for ${name}:`, error);
|
|
83539
83553
|
}
|
|
83540
83554
|
}
|
|
83541
|
-
const cleanupClients = async () => {
|
|
83555
|
+
const cleanupClients = async () => {
|
|
83556
|
+
await Promise.all(acquiredKeys.map((k) => releaseMcpClient(k)));
|
|
83557
|
+
acquiredKeys.length = 0;
|
|
83558
|
+
Object.keys(allTools).forEach((key) => delete allTools[key]);
|
|
83559
|
+
Object.keys(allClients).forEach((key) => delete allClients[key]);
|
|
83560
|
+
};
|
|
83542
83561
|
return {
|
|
83543
83562
|
tools: allTools,
|
|
83544
83563
|
clients: allClients,
|
|
@@ -86340,6 +86359,17 @@ var ComposableMCPServer = class extends Server {
|
|
|
86340
86359
|
server: this,
|
|
86341
86360
|
toolNames: Object.keys(allTools)
|
|
86342
86361
|
});
|
|
86362
|
+
this.onclose = async () => {
|
|
86363
|
+
await cleanupClients();
|
|
86364
|
+
await this.disposePlugins();
|
|
86365
|
+
await this.logger.info(`[${name}] Event: closed - cleaned up dependent clients and plugins`);
|
|
86366
|
+
};
|
|
86367
|
+
this.onerror = async (error) => {
|
|
86368
|
+
await this.logger.error(`[${name}] Event: error - ${error?.stack ?? String(error)}`);
|
|
86369
|
+
await cleanupClients();
|
|
86370
|
+
await this.disposePlugins();
|
|
86371
|
+
await this.logger.info(`[${name}] Action: cleaned up dependent clients and plugins`);
|
|
86372
|
+
};
|
|
86343
86373
|
const toolNameToDetailList = Object.entries(allTools);
|
|
86344
86374
|
const publicToolNames = this.getPublicToolNames();
|
|
86345
86375
|
const hiddenToolNames = this.getHiddenToolNames();
|
|
@@ -87244,7 +87274,7 @@ function setupInspectorMiddleware(middlewares, config) {
|
|
|
87244
87274
|
}
|
|
87245
87275
|
|
|
87246
87276
|
//#endregion
|
|
87247
|
-
//#region ../../node_modules/.pnpm/@mcpc-tech+acp-ai-provider@0.1.
|
|
87277
|
+
//#region ../../node_modules/.pnpm/@mcpc-tech+acp-ai-provider@0.1.43/node_modules/@mcpc-tech/acp-ai-provider/index.mjs
|
|
87248
87278
|
createRequire(import.meta.url);
|
|
87249
87279
|
function formatToolError(toolResult) {
|
|
87250
87280
|
if (!toolResult || toolResult.length === 0) return "Unknown tool error";
|
|
@@ -87687,7 +87717,6 @@ var ACPLanguageModel = class {
|
|
|
87687
87717
|
*/
|
|
87688
87718
|
parseToolCall(update$1) {
|
|
87689
87719
|
if (update$1.sessionUpdate !== "tool_call") throw new Error("Invalid update type for parseToolCall");
|
|
87690
|
-
console.log("Parsing tool call update:", JSON.stringify(update$1, null, 2));
|
|
87691
87720
|
return {
|
|
87692
87721
|
toolCallId: update$1.toolCallId,
|
|
87693
87722
|
toolName: update$1.title || update$1.toolCallId,
|
|
@@ -87989,11 +88018,6 @@ var ACPLanguageModel = class {
|
|
|
87989
88018
|
this.currentThinkingId = null;
|
|
87990
88019
|
}
|
|
87991
88020
|
const { toolCallId, toolName, toolInput } = this.parseToolCall(update$1);
|
|
87992
|
-
console.log(`Parsing tool call: ${JSON.stringify({
|
|
87993
|
-
toolCallId,
|
|
87994
|
-
toolName,
|
|
87995
|
-
toolInput
|
|
87996
|
-
}, null, 2)}`);
|
|
87997
88021
|
const existingToolCall = this.toolCallsMap.get(toolCallId);
|
|
87998
88022
|
const hasInput = toolInput && typeof toolInput === "object" && Object.keys(toolInput).length > 0;
|
|
87999
88023
|
if (!existingToolCall) {
|
|
@@ -88020,13 +88044,14 @@ var ACPLanguageModel = class {
|
|
|
88020
88044
|
});
|
|
88021
88045
|
} else if (!existingToolCall.inputAvailable && hasInput) {
|
|
88022
88046
|
existingToolCall.inputAvailable = true;
|
|
88047
|
+
if (update$1.title && existingToolCall.name !== update$1.title && update$1.title !== toolCallId) existingToolCall.name = update$1.title;
|
|
88023
88048
|
controller.enqueue({
|
|
88024
88049
|
type: "tool-call",
|
|
88025
88050
|
toolCallId,
|
|
88026
88051
|
toolName: ACP_PROVIDER_AGENT_DYNAMIC_TOOL_NAME2,
|
|
88027
88052
|
input: JSON.stringify({
|
|
88028
88053
|
toolCallId,
|
|
88029
|
-
toolName,
|
|
88054
|
+
toolName: existingToolCall.name,
|
|
88030
88055
|
args: toolInput
|
|
88031
88056
|
})
|
|
88032
88057
|
});
|
|
@@ -88053,13 +88078,14 @@ var ACPLanguageModel = class {
|
|
|
88053
88078
|
}
|
|
88054
88079
|
if (!toolInfo.inputAvailable) {
|
|
88055
88080
|
toolInfo.inputAvailable = true;
|
|
88081
|
+
if (update$1.title && toolInfo.name !== update$1.title && update$1.title !== toolCallId) toolInfo.name = update$1.title;
|
|
88056
88082
|
controller.enqueue({
|
|
88057
88083
|
type: "tool-call",
|
|
88058
88084
|
toolCallId,
|
|
88059
88085
|
toolName: ACP_PROVIDER_AGENT_DYNAMIC_TOOL_NAME2,
|
|
88060
88086
|
input: JSON.stringify({
|
|
88061
88087
|
toolCallId,
|
|
88062
|
-
toolName,
|
|
88088
|
+
toolName: toolInfo.name,
|
|
88063
88089
|
args: {}
|
|
88064
88090
|
})
|
|
88065
88091
|
});
|
|
@@ -88085,13 +88111,14 @@ var ACPLanguageModel = class {
|
|
|
88085
88111
|
});
|
|
88086
88112
|
} else if (!toolInfo.inputAvailable) {
|
|
88087
88113
|
toolInfo.inputAvailable = true;
|
|
88114
|
+
if (update$1.title && toolInfo.name !== update$1.title && update$1.title !== toolCallId) toolInfo.name = update$1.title;
|
|
88088
88115
|
controller.enqueue({
|
|
88089
88116
|
type: "tool-call",
|
|
88090
88117
|
toolCallId,
|
|
88091
88118
|
toolName: ACP_PROVIDER_AGENT_DYNAMIC_TOOL_NAME2,
|
|
88092
88119
|
input: JSON.stringify({
|
|
88093
88120
|
toolCallId,
|
|
88094
|
-
toolName,
|
|
88121
|
+
toolName: toolInfo.name,
|
|
88095
88122
|
args: {}
|
|
88096
88123
|
})
|
|
88097
88124
|
});
|
|
@@ -88118,7 +88145,6 @@ var ACPLanguageModel = class {
|
|
|
88118
88145
|
try {
|
|
88119
88146
|
await this.ensureConnected();
|
|
88120
88147
|
const promptContent = convertAiSdkMessagesToAcp(options, this.isFreshSession);
|
|
88121
|
-
console.log(`###########`, promptContent);
|
|
88122
88148
|
this.isFreshSession = false;
|
|
88123
88149
|
let accumulatedText = "";
|
|
88124
88150
|
const toolCalls = [];
|
|
@@ -88325,6 +88351,36 @@ function createACPProvider(config) {
|
|
|
88325
88351
|
return new ACPProvider(config);
|
|
88326
88352
|
}
|
|
88327
88353
|
|
|
88354
|
+
//#endregion
|
|
88355
|
+
//#region src/utils/npm-package.ts
|
|
88356
|
+
/**
|
|
88357
|
+
* Resolve npm package bin entry point
|
|
88358
|
+
* Returns the absolute path to the bin file, or null if resolution fails
|
|
88359
|
+
*/
|
|
88360
|
+
function resolveNpmPackageBin(packageName) {
|
|
88361
|
+
try {
|
|
88362
|
+
const packageJsonPath = createRequire$1(import.meta.url).resolve(`${packageName}/package.json`);
|
|
88363
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
88364
|
+
let binPath;
|
|
88365
|
+
if (typeof packageJson.bin === "string") binPath = packageJson.bin;
|
|
88366
|
+
else if (typeof packageJson.bin === "object") {
|
|
88367
|
+
const binEntries = Object.entries(packageJson.bin);
|
|
88368
|
+
const matchingEntry = binEntries.find(([name]) => name === packageJson.name.split("/").pop());
|
|
88369
|
+
binPath = matchingEntry ? matchingEntry[1] : binEntries[0]?.[1];
|
|
88370
|
+
}
|
|
88371
|
+
if (!binPath) {
|
|
88372
|
+
console.warn(`[dev-inspector] [acp] No bin entry found in ${packageName}/package.json`);
|
|
88373
|
+
return null;
|
|
88374
|
+
}
|
|
88375
|
+
const binFullPath = join(dirname(packageJsonPath), binPath);
|
|
88376
|
+
console.log(`[dev-inspector] [acp] Resolved ${packageName} bin to: ${binFullPath}`);
|
|
88377
|
+
return binFullPath;
|
|
88378
|
+
} catch (error) {
|
|
88379
|
+
console.warn(`[dev-inspector] [acp] Failed to resolve npm package ${packageName}:`, error);
|
|
88380
|
+
return null;
|
|
88381
|
+
}
|
|
88382
|
+
}
|
|
88383
|
+
|
|
88328
88384
|
//#endregion
|
|
88329
88385
|
//#region src/middleware/acp-middleware.ts
|
|
88330
88386
|
/**
|
|
@@ -88393,10 +88449,13 @@ async function loadMcpToolsV5(transport) {
|
|
|
88393
88449
|
inputSchema: jsonSchema(toolInfo.inputSchema),
|
|
88394
88450
|
execute: async (args) => {
|
|
88395
88451
|
console.log(`[dev-inspector] [acp] Executing MCP tool: ${toolName}`);
|
|
88396
|
-
|
|
88452
|
+
const result = await callMcpMethodViaTransport(transport, "tools/call", {
|
|
88397
88453
|
name: toolName,
|
|
88398
88454
|
arguments: args
|
|
88399
88455
|
});
|
|
88456
|
+
const parsedResult = CallToolResultSchema.safeParse(result);
|
|
88457
|
+
if (!parsedResult.success) return result;
|
|
88458
|
+
return parsedResult.data?.content?.map((item) => item?.text).join("\n");
|
|
88400
88459
|
}
|
|
88401
88460
|
});
|
|
88402
88461
|
}
|
|
@@ -88486,9 +88545,19 @@ function setupAcpMiddleware(middlewares, serverContext, acpOptions) {
|
|
|
88486
88545
|
return;
|
|
88487
88546
|
}
|
|
88488
88547
|
console.log(`[dev-inspector] [acp] Creating new global provider for ${agent.name}`);
|
|
88548
|
+
let command = agent.command;
|
|
88549
|
+
let args = agent.args;
|
|
88550
|
+
if (agent.npmPackage) {
|
|
88551
|
+
const binPath = resolveNpmPackageBin(agent.npmPackage);
|
|
88552
|
+
if (binPath) {
|
|
88553
|
+
command = binPath;
|
|
88554
|
+
args = agent.npmArgs || [];
|
|
88555
|
+
console.log(`[dev-inspector] [acp] Using resolved npm package: ${agent.npmPackage}`);
|
|
88556
|
+
} else console.log(`[dev-inspector] [acp] Failed to resolve npm package, falling back to: ${agent.command}`);
|
|
88557
|
+
}
|
|
88489
88558
|
provider = createACPProvider({
|
|
88490
|
-
command
|
|
88491
|
-
args
|
|
88559
|
+
command,
|
|
88560
|
+
args,
|
|
88492
88561
|
env: {
|
|
88493
88562
|
...process.env,
|
|
88494
88563
|
...envVars
|
|
@@ -88623,9 +88692,19 @@ function setupAcpMiddleware(middlewares, serverContext, acpOptions) {
|
|
|
88623
88692
|
shouldCleanupProvider = false;
|
|
88624
88693
|
} else {
|
|
88625
88694
|
console.log(`[dev-inspector] [acp] Creating new provider (no session found or provided)`);
|
|
88695
|
+
let command = agent.command;
|
|
88696
|
+
let args = agent.args;
|
|
88697
|
+
if (agent.npmPackage) {
|
|
88698
|
+
const binPath = resolveNpmPackageBin(agent.npmPackage);
|
|
88699
|
+
if (binPath) {
|
|
88700
|
+
command = binPath;
|
|
88701
|
+
args = agent.npmArgs || [];
|
|
88702
|
+
console.log(`[dev-inspector] [acp] Using resolved npm package: ${agent.npmPackage}`);
|
|
88703
|
+
}
|
|
88704
|
+
}
|
|
88626
88705
|
provider = createACPProvider({
|
|
88627
|
-
command
|
|
88628
|
-
args
|
|
88706
|
+
command,
|
|
88707
|
+
args,
|
|
88629
88708
|
env: {
|
|
88630
88709
|
...process.env,
|
|
88631
88710
|
...envVars
|
package/dist/index.cjs
CHANGED
|
@@ -40,6 +40,7 @@ async function launchBrowserWithDevTools(options) {
|
|
|
40
40
|
chrome_navigate_page: { url }
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
+
await new Promise((r) => setTimeout(r, 1e3));
|
|
43
44
|
return true;
|
|
44
45
|
} catch (error) {
|
|
45
46
|
console.error(`[dev-inspector] ⚠️ Failed to auto-open browser:`, error instanceof Error ? error.message : String(error));
|
|
@@ -204,6 +205,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
|
204
205
|
}
|
|
205
206
|
require_config_updater.setupInspectorMiddleware(server.middlewares, {
|
|
206
207
|
agents: options.agents,
|
|
208
|
+
visibleAgents: options.visibleAgents,
|
|
207
209
|
defaultAgent: options.defaultAgent,
|
|
208
210
|
showInspectorBar: options.showInspectorBar
|
|
209
211
|
});
|
|
@@ -266,6 +268,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
|
266
268
|
}
|
|
267
269
|
require_config_updater.setupInspectorMiddleware(server, {
|
|
268
270
|
agents: options.agents,
|
|
271
|
+
visibleAgents: options.visibleAgents,
|
|
269
272
|
defaultAgent: options.defaultAgent
|
|
270
273
|
});
|
|
271
274
|
callback();
|
package/dist/index.d.cts
CHANGED
|
@@ -82,6 +82,14 @@ interface Agent extends AcpOptions {
|
|
|
82
82
|
* Installation command for the agent (shown in error messages)
|
|
83
83
|
*/
|
|
84
84
|
installCommand?: string;
|
|
85
|
+
/**
|
|
86
|
+
* NPM package name for agents that use npm packages (for faster loading via require.resolve)
|
|
87
|
+
*/
|
|
88
|
+
npmPackage?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Arguments to pass when using npm package resolution (separate from npx args)
|
|
91
|
+
*/
|
|
92
|
+
npmArgs?: string[];
|
|
85
93
|
}
|
|
86
94
|
//#endregion
|
|
87
95
|
//#region src/utils/create-plugin.d.ts
|
|
@@ -111,6 +119,13 @@ interface DevInspectorOptions extends McpConfigOptions, AcpOptions {
|
|
|
111
119
|
* @see AVAILABLE_AGENTS https://github.com/mcpc-tech/dev-inspector-mcp/blob/main/packages/unplugin-dev-inspector/client/constants/agents.ts
|
|
112
120
|
*/
|
|
113
121
|
agents?: Agent[];
|
|
122
|
+
/**
|
|
123
|
+
* Filter which agents are visible in the UI
|
|
124
|
+
* Only agents with names in this list will be shown (applies after merging custom agents)
|
|
125
|
+
* If not specified or empty array, all agents are visible
|
|
126
|
+
* @example ['Claude Code', 'Gemini CLI', 'My Custom Agent']
|
|
127
|
+
*/
|
|
128
|
+
visibleAgents?: string[];
|
|
114
129
|
/**
|
|
115
130
|
* Default agent name to use
|
|
116
131
|
* @default "Claude Code"
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as unplugin0 from "unplugin";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/config-updater.d.ts
|
|
4
4
|
type EditorId = "cursor" | "vscode" | "windsurf" | "claude-code" | "antigravity";
|
|
@@ -82,6 +82,14 @@ interface Agent extends AcpOptions {
|
|
|
82
82
|
* Installation command for the agent (shown in error messages)
|
|
83
83
|
*/
|
|
84
84
|
installCommand?: string;
|
|
85
|
+
/**
|
|
86
|
+
* NPM package name for agents that use npm packages (for faster loading via require.resolve)
|
|
87
|
+
*/
|
|
88
|
+
npmPackage?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Arguments to pass when using npm package resolution (separate from npx args)
|
|
91
|
+
*/
|
|
92
|
+
npmArgs?: string[];
|
|
85
93
|
}
|
|
86
94
|
//#endregion
|
|
87
95
|
//#region src/utils/create-plugin.d.ts
|
|
@@ -111,6 +119,13 @@ interface DevInspectorOptions extends McpConfigOptions, AcpOptions {
|
|
|
111
119
|
* @see AVAILABLE_AGENTS https://github.com/mcpc-tech/dev-inspector-mcp/blob/main/packages/unplugin-dev-inspector/client/constants/agents.ts
|
|
112
120
|
*/
|
|
113
121
|
agents?: Agent[];
|
|
122
|
+
/**
|
|
123
|
+
* Filter which agents are visible in the UI
|
|
124
|
+
* Only agents with names in this list will be shown (applies after merging custom agents)
|
|
125
|
+
* If not specified or empty array, all agents are visible
|
|
126
|
+
* @example ['Claude Code', 'Gemini CLI', 'My Custom Agent']
|
|
127
|
+
*/
|
|
128
|
+
visibleAgents?: string[];
|
|
114
129
|
/**
|
|
115
130
|
* Default agent name to use
|
|
116
131
|
* @default "Claude Code"
|
|
@@ -151,10 +166,10 @@ interface DevInspectorOptions extends McpConfigOptions, AcpOptions {
|
|
|
151
166
|
}
|
|
152
167
|
//#endregion
|
|
153
168
|
//#region src/core.d.ts
|
|
154
|
-
declare const unplugin:
|
|
169
|
+
declare const unplugin: unplugin0.UnpluginInstance<DevInspectorOptions | undefined, boolean>;
|
|
155
170
|
//#endregion
|
|
156
171
|
//#region src/core-external.d.ts
|
|
157
|
-
declare const unpluginExternal:
|
|
172
|
+
declare const unpluginExternal: unplugin0.UnpluginInstance<DevInspectorOptions | undefined, boolean>;
|
|
158
173
|
//#endregion
|
|
159
174
|
//#region src/turbopack.d.ts
|
|
160
175
|
interface TurbopackDevInspectorOptions extends DevInspectorOptions {
|
|
@@ -179,7 +194,7 @@ interface TurbopackDevInspectorOptions extends DevInspectorOptions {
|
|
|
179
194
|
declare function turbopackDevInspector(options?: TurbopackDevInspectorOptions): any;
|
|
180
195
|
//#endregion
|
|
181
196
|
//#region src/index.d.ts
|
|
182
|
-
declare const external:
|
|
197
|
+
declare const external: unplugin0.UnpluginInstance<DevInspectorOptions | undefined, boolean>;
|
|
183
198
|
declare module "virtual:dev-inspector-mcp" {}
|
|
184
199
|
//#endregion
|
|
185
200
|
export { type CustomEditorConfig, type DevInspectorOptions, type EditorId, type McpConfigOptions, type TurbopackDevInspectorOptions, unplugin as default, unplugin, external, turbopackDevInspector, unpluginExternal };
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ async function launchBrowserWithDevTools(options) {
|
|
|
36
36
|
chrome_navigate_page: { url }
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
|
+
await new Promise((r) => setTimeout(r, 1e3));
|
|
39
40
|
return true;
|
|
40
41
|
} catch (error) {
|
|
41
42
|
console.error(`[dev-inspector] ⚠️ Failed to auto-open browser:`, error instanceof Error ? error.message : String(error));
|
|
@@ -200,6 +201,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
|
200
201
|
}
|
|
201
202
|
setupInspectorMiddleware(server.middlewares, {
|
|
202
203
|
agents: options.agents,
|
|
204
|
+
visibleAgents: options.visibleAgents,
|
|
203
205
|
defaultAgent: options.defaultAgent,
|
|
204
206
|
showInspectorBar: options.showInspectorBar
|
|
205
207
|
});
|
|
@@ -262,6 +264,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
|
262
264
|
}
|
|
263
265
|
setupInspectorMiddleware(server, {
|
|
264
266
|
agents: options.agents,
|
|
267
|
+
visibleAgents: options.visibleAgents,
|
|
265
268
|
defaultAgent: options.defaultAgent
|
|
266
269
|
});
|
|
267
270
|
callback();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcpc-tech/unplugin-dev-inspector-mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"description": "Universal dev inspector plugin for React/Vue - inspect component sources and API calls in any bundler",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"@babel/parser": "^7.28.5",
|
|
114
114
|
"@babel/traverse": "^7.28.5",
|
|
115
115
|
"@code-inspector/core": "^1.3.0",
|
|
116
|
-
"@mcpc-tech/acp-ai-provider": "^0.1.
|
|
116
|
+
"@mcpc-tech/acp-ai-provider": "^0.1.43",
|
|
117
117
|
"@mcpc-tech/cmcp": "^0.0.15",
|
|
118
118
|
"@mcpc-tech/core": "^0.3.8",
|
|
119
119
|
"@modelcontextprotocol/sdk": "^1.20.1",
|
|
@@ -168,6 +168,12 @@
|
|
|
168
168
|
"use-stick-to-bottom": "^1.1.1",
|
|
169
169
|
"zod": "^3.24.1"
|
|
170
170
|
},
|
|
171
|
+
"optionalDependencies": {
|
|
172
|
+
"@blowmage/cursor-agent-acp": "^0.1.0",
|
|
173
|
+
"@yaonyan/droid-acp": "^0.0.8",
|
|
174
|
+
"@zed-industries/claude-code-acp": "^0.12.4",
|
|
175
|
+
"@zed-industries/codex-acp": "^0.7.1"
|
|
176
|
+
},
|
|
171
177
|
"devDependencies": {
|
|
172
178
|
"@babel/types": "^7.28.5",
|
|
173
179
|
"@tailwindcss/postcss": "^4.1.14",
|