superpowers-mcp 5.1.2 → 6.0.1

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.
Files changed (38) hide show
  1. package/README.md +25 -14
  2. package/README.zh-TW.md +30 -14
  3. package/out/server.js +2 -2
  4. package/package.json +1 -1
  5. package/skills/brainstorming/SKILL.md +5 -10
  6. package/skills/brainstorming/scripts/frame-template.html +25 -26
  7. package/skills/brainstorming/scripts/helper.js +107 -35
  8. package/skills/brainstorming/scripts/server.cjs +377 -30
  9. package/skills/brainstorming/scripts/start-server.sh +70 -9
  10. package/skills/brainstorming/scripts/stop-server.sh +66 -2
  11. package/skills/brainstorming/spec-document-reviewer-prompt.md +1 -1
  12. package/skills/brainstorming/visual-companion.md +29 -25
  13. package/skills/dispatching-parallel-agents/SKILL.md +9 -6
  14. package/skills/executing-plans/SKILL.md +2 -2
  15. package/skills/finishing-a-development-branch/SKILL.md +2 -12
  16. package/skills/receiving-code-review/SKILL.md +2 -2
  17. package/skills/requesting-code-review/SKILL.md +2 -2
  18. package/skills/requesting-code-review/code-reviewer.md +15 -11
  19. package/skills/subagent-driven-development/SKILL.md +206 -67
  20. package/skills/subagent-driven-development/implementer-prompt.md +30 -4
  21. package/skills/subagent-driven-development/scripts/review-package +44 -0
  22. package/skills/subagent-driven-development/scripts/sdd-workspace +22 -0
  23. package/skills/subagent-driven-development/scripts/task-brief +40 -0
  24. package/skills/subagent-driven-development/task-reviewer-prompt.md +188 -0
  25. package/skills/systematic-debugging/SKILL.md +1 -1
  26. package/skills/test-driven-development/SKILL.md +2 -2
  27. package/skills/using-git-worktrees/SKILL.md +9 -22
  28. package/skills/using-superpowers/SKILL.md +17 -72
  29. package/skills/using-superpowers/references/antigravity-tools.md +23 -0
  30. package/skills/using-superpowers/references/codex-tools.md +1 -21
  31. package/skills/using-superpowers/references/pi-tools.md +16 -0
  32. package/skills/writing-plans/SKILL.md +22 -0
  33. package/skills/writing-plans/plan-document-reviewer-prompt.md +1 -1
  34. package/skills/writing-skills/SKILL.md +52 -18
  35. package/skills/writing-skills/anthropic-best-practices.md +91 -91
  36. package/skills/writing-skills/persuasion-principles.md +3 -3
  37. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +0 -25
  38. package/skills/subagent-driven-development/spec-reviewer-prompt.md +0 -61
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [English](README.md) | [繁體中文](README.zh-TW.md)
4
4
 
5
- [![Version](https://img.shields.io/badge/version-5.1.2-blue.svg)](https://github.com/Poseidoncode/superpowers-mcp)
5
+ [![Version](https://img.shields.io/badge/version-6.0.0-blue.svg)](https://github.com/Poseidoncode/superpowers-mcp)
6
6
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
7
7
 
8
8
  This document summarizes the information and usage instructions for packaging the original Superpowers skills library into an independent MCP Toolpack.
@@ -72,15 +72,15 @@ This is the easiest way as it handles path resolution automatically.
72
72
  ## 🔄 Recommended Prompt Sequences
73
73
 
74
74
  ### 1. New Feature Development Sequence
75
- 1. `[superpowers:brainstorm : Confirm requirements and architecture]`
76
- 2. `[superpowers:writing-plans : Create an execution plan with specific steps]`
77
- 3. `[superpowers:test-driven-development : Implement the feature with tests]`
78
- 4. `[superpowers:verification-before-completion : Run test suites to ensure everything works]`
75
+ 1. "Read the brainstorming skill to confirm requirements and architecture."
76
+ 2. "Read the writing-plans skill to create an execution plan with specific steps."
77
+ 3. "Read the test-driven-development skill to implement the feature with tests."
78
+ 4. "Read the verification-before-completion skill to run test suites and ensure everything works."
79
79
 
80
80
  ### 2. Emergency Hotfix Sequence
81
- 1. `[superpowers:systematic-debugging : Locate the root cause of the current issue]`
82
- 2. `[superpowers:test-driven-development : Write a failing test for the bug and fix it]`
83
- 3. `[superpowers:verification-before-completion : Validate the applied hotfix]`
81
+ 1. "Read the systematic-debugging skill to locate the root cause of the current issue."
82
+ 2. "Read the test-driven-development skill to write a failing test for the bug and fix it."
83
+ 3. "Read the verification-before-completion skill to validate the applied hotfix."
84
84
 
85
85
  ---
86
86
 
@@ -90,7 +90,7 @@ To help you choose the right skill, we've categorized them into 6 logical phases
90
90
 
91
91
  ### 🚀 1. Planning & Design
92
92
  - `brainstorming`: Software design and requirements analysis process
93
- - **NEW**: Visual Companion for browser-based mockups and design reviews
93
+ - Visual Companion for browser-based mockups and design reviews (just-in-time)
94
94
  - `writing-plans`: Creating detailed implementation plans
95
95
 
96
96
  ### 💻 2. Implementation & Debugging
@@ -112,12 +112,13 @@ To help you choose the right skill, we've categorized them into 6 logical phases
112
112
  These skills are designed for orchestrating complex meta-execution patterns within supported IDEs (like Antigravity or Cursor).
113
113
 
114
114
  - **`subagent-driven-development`**: Driving sub-agents to execute tasks
115
- - **Usage**: Used to execute a predefined plan task-by-task. The system will spawn a fresh "implementer" sub-agent for a single task, followed by "spec reviewer" and "code quality reviewer" sub-agents to ensure high-quality output before moving to the next task.
116
- - **Example**: `[superpowers:subagent-driven-development : Execute the tasks listed in docs/plans/feature-plan.md one by one]`
115
+ - **Usage**: Used to execute a predefined plan task-by-task. The system spawns a fresh "implementer" sub-agent per task, followed by a consolidated **task reviewer** (spec compliance + code quality) sub-agent, plus a **whole-branch final review** at the end. A **Pre-Flight Plan Review** scans for task conflicts before execution begins.
116
+ - **Model Selection**: Choose sub-agent models based on task complexity — cheaper models for mechanical work, capable models for architecture and subtle concurrency changes.
117
+ - **Example**: "Read the subagent-driven-development skill, then execute the tasks listed in docs/plans/feature-plan.md one by one."
117
118
  - **`dispatching-parallel-agents`**: Dispatching tasks to parallel agents
118
119
  - **Usage**: Used for tackling multiple *independent* issues (e.g., 3 unrelated failing tests or 3 separate web research topics). The AI will adopt a parallel-execution mindset, addressing each task independently without crossing state or experiencing context pollution, significantly speeding up output generation.
119
- - **Debugging Example**: `[superpowers:dispatching-parallel-agents : Tests A, B, and C are failing independently. Dispatch 3 parallel agents to investigate and fix them]`
120
- - **Research Example**: `[superpowers:dispatching-parallel-agents : Dispatch 3 parallel agents to search the web for: 1. React 19 features, 2. Vue 3.5 updates, 3. Svelte 5 Runes. Summarize each independently]`
120
+ - **Debugging Example**: "Read the dispatching-parallel-agents skill, then dispatch 3 parallel agents to investigate the independently failing tests A, B, and C."
121
+ - **Research Example**: "Read the dispatching-parallel-agents skill, then search the web for React 19 features, Vue 3.5 updates, and Svelte 5 Runes in parallel — summarize each independently."
121
122
 
122
123
  ### ⚙️ 6. Customization & Meta
123
124
  - `using-superpowers`: Guidelines and self-checks for using Superpowers
@@ -127,7 +128,17 @@ These skills are designed for orchestrating complex meta-execution patterns with
127
128
 
128
129
  ## 🆕 Recent Updates
129
130
 
130
- ### v5.1.2 (Latest)
131
+ ### v6.0.1 (Latest)
132
+ - **Security Fix — Reflected XSS (#2)**: Fixed server-side reflected cross-site scripting in `skills/brainstorming/scripts/server.cjs`. The `bootstrapPage()` function was called with the user-supplied `keyFromQuery` parameter (even though validated via `timingSafeEqualStr`). Changed to use the server-side `TOKEN` constant instead, eliminating user-tainted data from the HTML response sink. Zero behavior change (the validated value is identical).
133
+
134
+ ### v6.0.0
135
+ - **Upstream Sync with obra/superpowers v6.1.1**: Major synchronization bringing upstream improvements across all skills.
136
+ - **subagent-driven-development Redesign**: Consolidated two-stage review (spec → code quality) into a single "task reviewer" sub-agent, plus added a broad **whole-branch final review** at completion. New **Pre-Flight Plan Review** catches task conflicts before execution begins. Added **Model Selection Guidance** to optimize cost vs. turn count.
137
+ - **using-superpowers Simplified**: Removed platform-specific sections and Graphviz diagram. Introduced **per-platform reference files** (`antigravity-tools.md`, `pi-tools.md`) and updated `codex-tools.md` for cleaner multi-environment support.
138
+ - **brainstorming Visual Companion**: Changed to **just-in-time** offering — no longer offered upfront, only when a visual question actually arises.
139
+ - **Type Safety & Code Quality**: Fixed `Record<string,string>` cast in `server.ts` with proper `typeof` guard. Replaced remaining `innerHTML` with safe DOM methods. Removed redundant checks and verbose comments across the codebase.
140
+
141
+ ### v5.1.2
131
142
  - **Security Hardening**: Removed the last remaining `innerHTML` usage in `skills/brainstorming/scripts/helper.js`, replacing it with safe DOM creation methods — now zero `innerHTML` in the entire codebase.
132
143
  - **Dependency Security**: Upgraded `hono` from `4.12.23` to `4.12.26` to patch 5 advisories including CORS origin reflection, Lambda body-limit bypass, and Set-Cookie header merging.
133
144
  - **Clean Slate**: All 37 Dependabot advisories and npm audit warnings now fully resolved — zero outstanding vulnerabilities.
package/README.zh-TW.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [English](README.md) | [繁體中文](README.zh-TW.md)
4
4
 
5
- [![版本](https://img.shields.io/badge/version-5.1.1-blue.svg)](https://github.com/Poseidoncode/superpowers-mcp)
5
+ [![版本](https://img.shields.io/badge/version-6.0.0-blue.svg)](https://github.com/Poseidoncode/superpowers-mcp)
6
6
  [![授權](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
7
7
 
8
8
  本文檔總結了將原始 Superpowers 技能庫打包成獨立 MCP Toolpack 的相關資訊與使用說明。
@@ -72,15 +72,15 @@
72
72
  ## 🔄 推薦的指令 (Command Sequences)
73
73
 
74
74
  ### 1. 新功能開發
75
- 1. `[superpowers:brainstorm : 確認需求與架構]`
76
- 2. `[superpowers:writing-plans : 寫下具體步驟]`
77
- 3. `[superpowers:test-driven-development : 撰寫測試與實作]`
78
- 4. `[superpowers:verification-before-completion : 跑測試確認無誤]`
75
+ 1. 「用 read_skill 讀取 brainstorming 技能,確認需求與架構。」
76
+ 2. 「用 read_skill 讀取 writing-plans 技能,建立具體的實作步驟。」
77
+ 3. 「用 read_skill 讀取 test-driven-development 技能,以 TDD 方式實作功能。」
78
+ 4. 「用 read_skill 讀取 verification-before-completion 技能,跑測試確認一切正常。」
79
79
 
80
80
  ### 2. 緊急修復 (Hotfix)
81
- 1. `[superpowers:systematic-debugging : 定位問題根源]`
82
- 2. `[superpowers:test-driven-development : 寫一個失敗測試重現問題,再修復]`
83
- 3. `[superpowers:verification-before-completion : 驗證修復結果]`
81
+ 1. 「用 read_skill 讀取 systematic-debugging 技能,定位目前問題的根因。」
82
+ 2. 「用 read_skill 讀取 test-driven-development 技能,寫一個失敗測試再修復它。」
83
+ 3. 「用 read_skill 讀取 verification-before-completion 技能,驗證修復結果。」
84
84
 
85
85
  ---
86
86
 
@@ -90,7 +90,7 @@
90
90
 
91
91
  ### 🚀 1. 規劃與設計 (Planning & Design)
92
92
  - `brainstorming`: 軟體設計與需求分析流程
93
- - **新增**: Visual Companion 瀏覽器視覺化設計審查工具
93
+ - Visual Companion 瀏覽器視覺化設計審查工具(just-in-time 觸發)
94
94
  - `writing-plans`: 建立詳細的實作計畫
95
95
 
96
96
  ### 💻 2. 開發與除錯 (Implementation & Debugging)
@@ -112,12 +112,13 @@
112
112
  這是特別針對在支援多重代理 (Multi-Agent) 協作或具備強大推論能力的 IDE(如 Antigravity 或 Cursor)中所設計的高階操作技巧。
113
113
 
114
114
  - **`subagent-driven-development`**: 驅動子代理執行複雜任務
115
- - **具體用法**:適用於「執行已規劃好的詳細計畫」。針對每一個小任務,AI 會派發全新的「實作代理」去寫 Code,完成後立刻啟動「規格審查」與「品質審查」的雙重把關,審查通過才進入下一關。
116
- - **指令範例**:`[superpowers:subagent-driven-development : 請依照 docs/plans/feature-plan.md 的內容,幫我逐一派發子代理實作]`
115
+ - **具體用法**:適用於「執行已規劃好的詳細計畫」。針對每一個小任務,AI 會派發全新的「實作代理」去寫 Code,完成後啟動合併的 **task reviewer**(規格 + 品質一次審查),並在最後執行 **whole-branch final review**(全分支最終審查)。在執行前還會進行 **Pre-Flight Plan Review**,掃描任務之間的潛在衝突。
116
+ - **模型選擇**:根據任務複雜度選擇子代理模型 — 機械性工作用低成本模型,架構設計與細微併發變更需要強大模型。
117
+ - **指令範例**:「用 read_skill 讀取 subagent-driven-development 技能,然後依照 docs/plans/feature-plan.md 的內容逐一派發子代理實作。」
117
118
  - **`dispatching-parallel-agents`**: 派發平行代理同步執行任務
118
119
  - **具體用法**:適用於「同時處理多個互不干擾的獨立問題」(例如 3 個無關聯的 Bug,或 3 個獨立的網路查詢需求)。AI 會切換為平行處理的思維模型,將各個問題視為獨立專案同時處理,避免記憶混亂(Context 污染)並加速多任務產出。
119
- - **偵錯範例**:`[superpowers:dispatching-parallel-agents : 現在有 A, B, C 三個獨立的測試報錯,請派發 3 個代理同時去排查並修復]`
120
- - **查詢範例**:`[superpowers:dispatching-parallel-agents : 幫我派發 3 個代理去網路上分別查詢:1. React 19 新特性, 2. Vue 3.5 更新重點, 3. Svelte 5 的 Runes 系統,並各自整理成摘要]`
120
+ - **偵錯範例**:「用 read_skill 讀取 dispatching-parallel-agents 技能,然後派發 3 個平行代理去分別排查 A、B、C 三個獨立測試報錯。」
121
+ - **查詢範例**:「用 read_skill 讀取 dispatching-parallel-agents 技能,然後平行查詢 React 19 新特性、Vue 3.5 更新重點、Svelte 5 的 Runes 系統,各自獨立摘要。」
121
122
 
122
123
  ### ⚙️ 6. 系統與自定義 (Meta & Customization)
123
124
  - `using-superpowers`: Superpowers 核心操作指南與自我檢查
@@ -127,7 +128,22 @@
127
128
 
128
129
  ## 🆕 最近更新
129
130
 
130
- ### v5.1.1 (最新版)
131
+ ### v6.0.1 (最新版)
132
+ - **安全性修復 — Reflected XSS (#2)**: 修復 `skills/brainstorming/scripts/server.cjs` 中的伺服器端反射型跨站腳本漏洞。原本 `bootstrapPage()` 使用使用者提供的 `keyFromQuery` 參數(雖已通過 `timingSafeEqualStr` 驗證),現改為使用伺服器端 `TOKEN` 常數,徹底消除使用者可控資料進入 HTML 回應的風險。行為完全不變(驗證後的值相同)。
133
+
134
+ ### v6.0.0
135
+ - **同步上游 obra/superpowers v6.1.1**: 大規模同步,引入上游對所有技能的改進。
136
+ - **subagent-driven-development 流程改造**: 將原本的兩階段審查(規格 → 程式碼品質)合併為單一 **task reviewer** 子代理,並在最後增加 **whole-branch final review**。新增 **Pre-Flight Plan Review** 在執行前掃描任務衝突。新增 **Model Selection Guidance** 以最佳化成本與回合數。
137
+ - **using-superpowers 簡化**: 移除平台特定說明與 Graphviz 圖表,改為 **各平台獨立參考檔案**(新增 `antigravity-tools.md`、`pi-tools.md`,更新 `codex-tools.md`),更乾淨地支援多種 AI 環境。
138
+ - **brainstorming Visual Companion**: 改為 **just-in-time 觸發** — 不再預先詢問,只在真正需要視覺呈現時才提議。
139
+ - **型別安全與程式碼品質**: 修正 `server.ts` 中的 `Record<string,string>` 型別強轉為正確的 `typeof` 守衛。以安全的 DOM 方法取代殘餘的 `innerHTML`。移除冗餘檢查與囉嗦註解。
140
+
141
+ ### v5.1.2
142
+ - **安全性強化**: 移除 `skills/brainstorming/scripts/helper.js` 中最後一個 `innerHTML` 用法,以安全的 DOM 創建方法取代 — 現在整個程式庫 zero `innerHTML`。
143
+ - **依賴安全性**: 升級 `hono` 從 `4.12.23` 至 `4.12.26`,修補 5 個安全公告,包括 CORS origin reflection、Lambda body-limit bypass 和 Set-Cookie header merging。
144
+ - **乾淨狀態**: 所有 37 個 Dependabot 安全公告與 npm audit 警告全部解決 — 零未修補漏洞。
145
+
146
+ ### v5.1.1
131
147
  - **資安檢測與加固**: 進行了專案發布前的全方位安全性審查,並更新 `.gitignore` 設定以防未來潛在的金鑰與敏感環境變數檔案外洩。
132
148
  - **漏洞修補 (Patches)**: 修復了 brainstorming 技能中 Visual Companion (`helper.js`) 的 DOM XSS 漏洞,將不安全的 `innerHTML` 替換為安全的 DOM 操作 API;同時將 `path-to-regexp` 套件安全升級至 `8.4.2` 以解決高風險的 ReDoS 漏洞。
133
149
  - **開發依賴升級**: 將 `esbuild` 套件版本升級至 `0.28.1`。
package/out/server.js CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&e.reused==="ref"){i(a);continue}}}function Bi(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=e.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let m=e.seen.get(l),f=m.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),a._zod.parent===l)for(let v in c)v==="$ref"||v==="allOf"||v in u||delete c[v];if(f.$ref&&m.def)for(let v in c)v==="$ref"||v==="allOf"||v in m.def&&JSON.stringify(c[v])===JSON.stringify(m.def[v])&&delete c[v]}let d=a._zod.parent;if(d&&d!==l){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(let f in c)f==="$ref"||f==="allOf"||f in m.def&&JSON.stringify(c[f])===JSON.stringify(m.def[f])&&delete c[f]}e.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);let i=e.external?.defs??{};for(let a of e.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:lo(t,"input",e.processors),output:lo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function De(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return De(n.element,r);if(n.type==="set")return De(n.valueType,r);if(n.type==="lazy")return De(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return De(n.innerType,r);if(n.type==="intersection")return De(n.left,r)||De(n.right,r);if(n.type==="record"||n.type==="map")return De(n.keyType,r)||De(n.valueType,r);if(n.type==="pipe")return De(n.in,r)||De(n.out,r);if(n.type==="object"){for(let o in n.shape)if(De(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(De(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(De(o,r))return!0;return!!(n.rest&&De(n.rest,r))}return!1}var Sm=(e,t={})=>r=>{let n=Ji({...r,processors:t});return de(e,n),Ki(n,e),Bi(n,e)},lo=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=Ji({...o??{},target:i,io:t,processors:r});return de(e,a),Ki(a,e),Bi(a,e)};var sb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},wm=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=sb[s]??s,o.format===""&&delete o.format,s==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},zm=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&t.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},Im=(e,t,r,n)=>{r.type="boolean"},Pm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Tm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},jm=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Om=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Em=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Nm=(e,t,r,n)=>{r.not={}},Zm=(e,t,r,n)=>{},Dm=(e,t,r,n)=>{},Rm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Um=(e,t,r,n)=>{let o=e._zod.def,i=En(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},Am=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},Cm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Mm=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},qm=(e,t,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},Lm=(e,t,r,n)=>{r.type="boolean"},Vm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Fm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Jm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Km=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Bm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Gm=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=de(i.element,t,{...n,path:[...n.path,"items"]})},Hm=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=de(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=de(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},il=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>de(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},Wm=(e,t,r,n)=>{let o=e._zod.def,i=de(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=de(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},Xm=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((m,f)=>de(m,t,{...n,path:[...n.path,a,f]})),u=i.rest?de(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},Ym=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=de(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=de(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=de(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},Qm=(e,t,r,n)=>{let o=e._zod.def,i=de(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},eh=(e,t,r,n)=>{let o=e._zod.def;de(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},th=(e,t,r,n)=>{let o=e._zod.def;de(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},rh=(e,t,r,n)=>{let o=e._zod.def;de(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},nh=(e,t,r,n)=>{let o=e._zod.def;de(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},oh=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;de(i,t,n);let a=t.seen.get(e);a.ref=i},ih=(e,t,r,n)=>{let o=e._zod.def;de(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},ah=(e,t,r,n)=>{let o=e._zod.def;de(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},al=(e,t,r,n)=>{let o=e._zod.def;de(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},sh=(e,t,r,n)=>{let o=e._zod.innerType;de(o,t,n);let i=t.seen.get(e);i.ref=o};function Kr(e){return!!e._zod}function Kt(e,t){return Kr(e)?qr(e,t):e.safeParse(t)}function Gi(e){if(!e)return;let t;if(Kr(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function dh(e){if(Kr(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var po={};vn(po,{ZodAny:()=>Th,ZodArray:()=>Nh,ZodBase64:()=>jl,ZodBase64URL:()=>Ol,ZodBigInt:()=>na,ZodBigIntFormat:()=>Zl,ZodBoolean:()=>ra,ZodCIDRv4:()=>Pl,ZodCIDRv6:()=>Tl,ZodCUID:()=>bl,ZodCUID2:()=>xl,ZodCatch:()=>Qh,ZodCodec:()=>ql,ZodCustom:()=>ca,ZodCustomStringFormat:()=>mo,ZodDate:()=>Rl,ZodDefault:()=>Bh,ZodDiscriminatedUnion:()=>Dh,ZodE164:()=>El,ZodEmail:()=>yl,ZodEmoji:()=>_l,ZodEnum:()=>fo,ZodExactOptional:()=>Fh,ZodFile:()=>Lh,ZodFunction:()=>cg,ZodGUID:()=>Wi,ZodIPv4:()=>zl,ZodIPv6:()=>Il,ZodIntersection:()=>Rh,ZodJWT:()=>Nl,ZodKSUID:()=>wl,ZodLazy:()=>ig,ZodLiteral:()=>qh,ZodMAC:()=>wh,ZodMap:()=>Ch,ZodNaN:()=>tg,ZodNanoID:()=>$l,ZodNever:()=>Oh,ZodNonOptional:()=>Cl,ZodNull:()=>Ph,ZodNullable:()=>Kh,ZodNumber:()=>ta,ZodNumberFormat:()=>Br,ZodObject:()=>oa,ZodOptional:()=>Al,ZodPipe:()=>Ml,ZodPrefault:()=>Hh,ZodPromise:()=>sg,ZodReadonly:()=>rg,ZodRecord:()=>sa,ZodSet:()=>Mh,ZodString:()=>Qi,ZodStringFormat:()=>ce,ZodSuccess:()=>Yh,ZodSymbol:()=>zh,ZodTemplateLiteral:()=>og,ZodTransform:()=>Vh,ZodTuple:()=>Uh,ZodType:()=>J,ZodULID:()=>kl,ZodURL:()=>ea,ZodUUID:()=>Et,ZodUndefined:()=>Ih,ZodUnion:()=>ia,ZodUnknown:()=>jh,ZodVoid:()=>Eh,ZodXID:()=>Sl,ZodXor:()=>Zh,_ZodString:()=>vl,_default:()=>Gh,_function:()=>wx,any:()=>sx,array:()=>W,base64:()=>Fb,base64url:()=>Jb,bigint:()=>rx,boolean:()=>ve,catch:()=>eg,check:()=>zx,cidrv4:()=>Lb,cidrv6:()=>Vb,codec:()=>xx,cuid:()=>Zb,cuid2:()=>Db,custom:()=>Ll,date:()=>ux,describe:()=>Ix,discriminatedUnion:()=>aa,e164:()=>Kb,email:()=>Sb,emoji:()=>Eb,enum:()=>Ie,exactOptional:()=>Jh,file:()=>yx,float32:()=>Yb,float64:()=>Qb,function:()=>wx,guid:()=>wb,hash:()=>Xb,hex:()=>Wb,hostname:()=>Hb,httpUrl:()=>Ob,instanceof:()=>Tx,int:()=>gl,int32:()=>ex,int64:()=>nx,intersection:()=>go,ipv4:()=>Cb,ipv6:()=>qb,json:()=>Ox,jwt:()=>Bb,keyof:()=>lx,ksuid:()=>Ab,lazy:()=>ag,literal:()=>T,looseObject:()=>ze,looseRecord:()=>mx,mac:()=>Mb,map:()=>hx,meta:()=>Px,nan:()=>bx,nanoid:()=>Nb,nativeEnum:()=>vx,never:()=>Dl,nonoptional:()=>Xh,null:()=>ho,nullable:()=>Xi,nullish:()=>_x,number:()=>ne,object:()=>z,optional:()=>fe,partialRecord:()=>fx,pipe:()=>Yi,prefault:()=>Wh,preprocess:()=>ua,promise:()=>Sx,readonly:()=>ng,record:()=>pe,refine:()=>ug,set:()=>gx,strictObject:()=>dx,string:()=>h,stringFormat:()=>Gb,stringbool:()=>jx,success:()=>$x,superRefine:()=>lg,symbol:()=>ix,templateLiteral:()=>kx,transform:()=>Ul,tuple:()=>Ah,uint32:()=>tx,uint64:()=>ox,ulid:()=>Rb,undefined:()=>ax,union:()=>ie,unknown:()=>ue,url:()=>jb,uuid:()=>zb,uuidv4:()=>Ib,uuidv6:()=>Pb,uuidv7:()=>Tb,void:()=>cx,xid:()=>Ub,xor:()=>px});var Hi={};vn(Hi,{endsWith:()=>oo,gt:()=>jt,gte:()=>Ze,includes:()=>ro,length:()=>Fr,lowercase:()=>eo,lt:()=>Tt,lte:()=>Ke,maxLength:()=>Vr,maxSize:()=>lr,mime:()=>io,minLength:()=>Jt,minSize:()=>Ot,multipleOf:()=>ur,negative:()=>Gu,nonnegative:()=>Wu,nonpositive:()=>Hu,normalize:()=>ao,overwrite:()=>yt,positive:()=>Bu,property:()=>Xu,regex:()=>Qn,size:()=>Lr,slugify:()=>Fi,startsWith:()=>no,toLowerCase:()=>co,toUpperCase:()=>uo,trim:()=>so,uppercase:()=>to});var dr={};vn(dr,{ZodISODate:()=>ll,ZodISODateTime:()=>cl,ZodISODuration:()=>ml,ZodISOTime:()=>pl,date:()=>dl,datetime:()=>ul,duration:()=>hl,time:()=>fl});var cl=p("ZodISODateTime",(e,t)=>{xc.init(e,t),ce.init(e,t)});function ul(e){return Su(cl,e)}var ll=p("ZodISODate",(e,t)=>{kc.init(e,t),ce.init(e,t)});function dl(e){return wu(ll,e)}var pl=p("ZodISOTime",(e,t)=>{Sc.init(e,t),ce.init(e,t)});function fl(e){return zu(pl,e)}var ml=p("ZodISODuration",(e,t)=>{wc.init(e,t),ce.init(e,t)});function hl(e){return Iu(ml,e)}var ph=(e,t)=>{ui.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>di(e,r)},flatten:{value:r=>li(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Ar,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Ar,2)}},isEmpty:{get(){return e.issues.length===0}}})},$1=p("ZodError",ph),Be=p("ZodError",ph,{Parent:Error});var fh=An(Be),mh=Mn(Be),hh=Ln(Be),gh=Vn(Be),vh=If(Be),yh=Pf(Be),_h=Tf(Be),$h=jf(Be),bh=Of(Be),xh=Ef(Be),kh=Nf(Be),Sh=Zf(Be);var J=p("ZodType",(e,t)=>(q.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:lo(e,"input"),output:lo(e,"output")}}),e.toJSONSchema=Sm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(_.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Ee(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>fh(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>hh(e,r,n),e.parseAsync=async(r,n)=>mh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>gh(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>vh(e,r,n),e.decode=(r,n)=>yh(e,r,n),e.encodeAsync=async(r,n)=>_h(e,r,n),e.decodeAsync=async(r,n)=>$h(e,r,n),e.safeEncode=(r,n)=>bh(e,r,n),e.safeDecode=(r,n)=>xh(e,r,n),e.safeEncodeAsync=async(r,n)=>kh(e,r,n),e.safeDecodeAsync=async(r,n)=>Sh(e,r,n),e.refine=(r,n)=>e.check(ug(r,n)),e.superRefine=r=>e.check(lg(r)),e.overwrite=r=>e.check(yt(r)),e.optional=()=>fe(e),e.exactOptional=()=>Jh(e),e.nullable=()=>Xi(e),e.nullish=()=>fe(Xi(e)),e.nonoptional=r=>Xh(e,r),e.array=()=>W(e),e.or=r=>ie([e,r]),e.and=r=>go(e,r),e.transform=r=>Yi(e,Ul(r)),e.default=r=>Gh(e,r),e.prefault=r=>Wh(e,r),e.catch=r=>eg(e,r),e.pipe=r=>Yi(e,r),e.readonly=()=>ng(e),e.describe=r=>{let n=e.clone();return Ne.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ne.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ne.get(e);let n=e.clone();return Ne.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),vl=p("_ZodString",(e,t)=>{cr.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,i)=>wm(e,n,o,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(Qn(...n)),e.includes=(...n)=>e.check(ro(...n)),e.startsWith=(...n)=>e.check(no(...n)),e.endsWith=(...n)=>e.check(oo(...n)),e.min=(...n)=>e.check(Jt(...n)),e.max=(...n)=>e.check(Vr(...n)),e.length=(...n)=>e.check(Fr(...n)),e.nonempty=(...n)=>e.check(Jt(1,...n)),e.lowercase=n=>e.check(eo(n)),e.uppercase=n=>e.check(to(n)),e.trim=()=>e.check(so()),e.normalize=(...n)=>e.check(ao(...n)),e.toLowerCase=()=>e.check(co()),e.toUpperCase=()=>e.check(uo()),e.slugify=()=>e.check(Fi())}),Qi=p("ZodString",(e,t)=>{cr.init(e,t),vl.init(e,t),e.email=r=>e.check(Si(yl,r)),e.url=r=>e.check(Yn(ea,r)),e.jwt=r=>e.check(Vi(Nl,r)),e.emoji=r=>e.check(Ti(_l,r)),e.guid=r=>e.check(Xn(Wi,r)),e.uuid=r=>e.check(wi(Et,r)),e.uuidv4=r=>e.check(zi(Et,r)),e.uuidv6=r=>e.check(Ii(Et,r)),e.uuidv7=r=>e.check(Pi(Et,r)),e.nanoid=r=>e.check(ji($l,r)),e.guid=r=>e.check(Xn(Wi,r)),e.cuid=r=>e.check(Oi(bl,r)),e.cuid2=r=>e.check(Ei(xl,r)),e.ulid=r=>e.check(Ni(kl,r)),e.base64=r=>e.check(Mi(jl,r)),e.base64url=r=>e.check(qi(Ol,r)),e.xid=r=>e.check(Zi(Sl,r)),e.ksuid=r=>e.check(Di(wl,r)),e.ipv4=r=>e.check(Ri(zl,r)),e.ipv6=r=>e.check(Ui(Il,r)),e.cidrv4=r=>e.check(Ai(Pl,r)),e.cidrv6=r=>e.check(Ci(Tl,r)),e.e164=r=>e.check(Li(El,r)),e.datetime=r=>e.check(ul(r)),e.date=r=>e.check(dl(r)),e.time=r=>e.check(fl(r)),e.duration=r=>e.check(hl(r))});function h(e){return xu(Qi,e)}var ce=p("ZodStringFormat",(e,t)=>{oe.init(e,t),vl.init(e,t)}),yl=p("ZodEmail",(e,t)=>{fc.init(e,t),ce.init(e,t)});function Sb(e){return Si(yl,e)}var Wi=p("ZodGUID",(e,t)=>{dc.init(e,t),ce.init(e,t)});function wb(e){return Xn(Wi,e)}var Et=p("ZodUUID",(e,t)=>{pc.init(e,t),ce.init(e,t)});function zb(e){return wi(Et,e)}function Ib(e){return zi(Et,e)}function Pb(e){return Ii(Et,e)}function Tb(e){return Pi(Et,e)}var ea=p("ZodURL",(e,t)=>{mc.init(e,t),ce.init(e,t)});function jb(e){return Yn(ea,e)}function Ob(e){return Yn(ea,{protocol:/^https?$/,hostname:Xe.domain,..._.normalizeParams(e)})}var _l=p("ZodEmoji",(e,t)=>{hc.init(e,t),ce.init(e,t)});function Eb(e){return Ti(_l,e)}var $l=p("ZodNanoID",(e,t)=>{gc.init(e,t),ce.init(e,t)});function Nb(e){return ji($l,e)}var bl=p("ZodCUID",(e,t)=>{vc.init(e,t),ce.init(e,t)});function Zb(e){return Oi(bl,e)}var xl=p("ZodCUID2",(e,t)=>{yc.init(e,t),ce.init(e,t)});function Db(e){return Ei(xl,e)}var kl=p("ZodULID",(e,t)=>{_c.init(e,t),ce.init(e,t)});function Rb(e){return Ni(kl,e)}var Sl=p("ZodXID",(e,t)=>{$c.init(e,t),ce.init(e,t)});function Ub(e){return Zi(Sl,e)}var wl=p("ZodKSUID",(e,t)=>{bc.init(e,t),ce.init(e,t)});function Ab(e){return Di(wl,e)}var zl=p("ZodIPv4",(e,t)=>{zc.init(e,t),ce.init(e,t)});function Cb(e){return Ri(zl,e)}var wh=p("ZodMAC",(e,t)=>{Pc.init(e,t),ce.init(e,t)});function Mb(e){return ku(wh,e)}var Il=p("ZodIPv6",(e,t)=>{Ic.init(e,t),ce.init(e,t)});function qb(e){return Ui(Il,e)}var Pl=p("ZodCIDRv4",(e,t)=>{Tc.init(e,t),ce.init(e,t)});function Lb(e){return Ai(Pl,e)}var Tl=p("ZodCIDRv6",(e,t)=>{jc.init(e,t),ce.init(e,t)});function Vb(e){return Ci(Tl,e)}var jl=p("ZodBase64",(e,t)=>{Oc.init(e,t),ce.init(e,t)});function Fb(e){return Mi(jl,e)}var Ol=p("ZodBase64URL",(e,t)=>{Ec.init(e,t),ce.init(e,t)});function Jb(e){return qi(Ol,e)}var El=p("ZodE164",(e,t)=>{Nc.init(e,t),ce.init(e,t)});function Kb(e){return Li(El,e)}var Nl=p("ZodJWT",(e,t)=>{Zc.init(e,t),ce.init(e,t)});function Bb(e){return Vi(Nl,e)}var mo=p("ZodCustomStringFormat",(e,t)=>{Dc.init(e,t),ce.init(e,t)});function Gb(e,t,r={}){return Jr(mo,e,t,r)}function Hb(e){return Jr(mo,"hostname",Xe.hostname,e)}function Wb(e){return Jr(mo,"hex",Xe.hex,e)}function Xb(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=Xe[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Jr(mo,n,o,t)}var ta=p("ZodNumber",(e,t)=>{$i.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,i)=>zm(e,n,o,i),e.gt=(n,o)=>e.check(jt(n,o)),e.gte=(n,o)=>e.check(Ze(n,o)),e.min=(n,o)=>e.check(Ze(n,o)),e.lt=(n,o)=>e.check(Tt(n,o)),e.lte=(n,o)=>e.check(Ke(n,o)),e.max=(n,o)=>e.check(Ke(n,o)),e.int=n=>e.check(gl(n)),e.safe=n=>e.check(gl(n)),e.positive=n=>e.check(jt(0,n)),e.nonnegative=n=>e.check(Ze(0,n)),e.negative=n=>e.check(Tt(0,n)),e.nonpositive=n=>e.check(Ke(0,n)),e.multipleOf=(n,o)=>e.check(ur(n,o)),e.step=(n,o)=>e.check(ur(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function ne(e){return Pu(ta,e)}var Br=p("ZodNumberFormat",(e,t)=>{Rc.init(e,t),ta.init(e,t)});function gl(e){return Tu(Br,e)}function Yb(e){return ju(Br,e)}function Qb(e){return Ou(Br,e)}function ex(e){return Eu(Br,e)}function tx(e){return Nu(Br,e)}var ra=p("ZodBoolean",(e,t)=>{Gn.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Im(e,r,n,o)});function ve(e){return Zu(ra,e)}var na=p("ZodBigInt",(e,t)=>{bi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Pm(e,n,o,i),e.gte=(n,o)=>e.check(Ze(n,o)),e.min=(n,o)=>e.check(Ze(n,o)),e.gt=(n,o)=>e.check(jt(n,o)),e.gte=(n,o)=>e.check(Ze(n,o)),e.min=(n,o)=>e.check(Ze(n,o)),e.lt=(n,o)=>e.check(Tt(n,o)),e.lte=(n,o)=>e.check(Ke(n,o)),e.max=(n,o)=>e.check(Ke(n,o)),e.positive=n=>e.check(jt(BigInt(0),n)),e.negative=n=>e.check(Tt(BigInt(0),n)),e.nonpositive=n=>e.check(Ke(BigInt(0),n)),e.nonnegative=n=>e.check(Ze(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(ur(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function rx(e){return Du(na,e)}var Zl=p("ZodBigIntFormat",(e,t)=>{Uc.init(e,t),na.init(e,t)});function nx(e){return Ru(Zl,e)}function ox(e){return Uu(Zl,e)}var zh=p("ZodSymbol",(e,t)=>{Ac.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tm(e,r,n,o)});function ix(e){return Au(zh,e)}var Ih=p("ZodUndefined",(e,t)=>{Cc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Om(e,r,n,o)});function ax(e){return Cu(Ih,e)}var Ph=p("ZodNull",(e,t)=>{Mc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jm(e,r,n,o)});function ho(e){return Mu(Ph,e)}var Th=p("ZodAny",(e,t)=>{qc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zm(e,r,n,o)});function sx(){return qu(Th)}var jh=p("ZodUnknown",(e,t)=>{Lc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dm(e,r,n,o)});function ue(){return Lu(jh)}var Oh=p("ZodNever",(e,t)=>{Vc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nm(e,r,n,o)});function Dl(e){return Vu(Oh,e)}var Eh=p("ZodVoid",(e,t)=>{Fc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Em(e,r,n,o)});function cx(e){return Fu(Eh,e)}var Rl=p("ZodDate",(e,t)=>{Jc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Rm(e,n,o,i),e.min=(n,o)=>e.check(Ze(n,o)),e.max=(n,o)=>e.check(Ke(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function ux(e){return Ju(Rl,e)}var Nh=p("ZodArray",(e,t)=>{Kc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gm(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Jt(r,n)),e.nonempty=r=>e.check(Jt(1,r)),e.max=(r,n)=>e.check(Vr(r,n)),e.length=(r,n)=>e.check(Fr(r,n)),e.unwrap=()=>e.element});function W(e,t){return km(Nh,e,t)}function lx(e){let t=e._zod.def.shape;return Ie(Object.keys(t))}var oa=p("ZodObject",(e,t)=>{bm.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hm(e,r,n,o),_.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Ie(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ue()}),e.loose=()=>e.clone({...e._zod.def,catchall:ue()}),e.strict=()=>e.clone({...e._zod.def,catchall:Dl()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>_.extend(e,r),e.safeExtend=r=>_.safeExtend(e,r),e.merge=r=>_.merge(e,r),e.pick=r=>_.pick(e,r),e.omit=r=>_.omit(e,r),e.partial=(...r)=>_.partial(Al,e,r[0]),e.required=(...r)=>_.required(Cl,e,r[0])});function z(e,t){let r={type:"object",shape:e??{},..._.normalizeParams(t)};return new oa(r)}function dx(e,t){return new oa({type:"object",shape:e,catchall:Dl(),..._.normalizeParams(t)})}function ze(e,t){return new oa({type:"object",shape:e,catchall:ue(),..._.normalizeParams(t)})}var ia=p("ZodUnion",(e,t)=>{Hn.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>il(e,r,n,o),e.options=t.options});function ie(e,t){return new ia({type:"union",options:e,..._.normalizeParams(t)})}var Zh=p("ZodXor",(e,t)=>{ia.init(e,t),Bc.init(e,t),e._zod.processJSONSchema=(r,n,o)=>il(e,r,n,o),e.options=t.options});function px(e,t){return new Zh({type:"union",options:e,inclusive:!1,..._.normalizeParams(t)})}var Dh=p("ZodDiscriminatedUnion",(e,t)=>{ia.init(e,t),Gc.init(e,t)});function aa(e,t,r){return new Dh({type:"union",options:t,discriminator:e,..._.normalizeParams(r)})}var Rh=p("ZodIntersection",(e,t)=>{Hc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wm(e,r,n,o)});function go(e,t){return new Rh({type:"intersection",left:e,right:t})}var Uh=p("ZodTuple",(e,t)=>{xi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xm(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});function Ah(e,t,r){let n=t instanceof q,o=n?r:t,i=n?t:null;return new Uh({type:"tuple",items:e,rest:i,..._.normalizeParams(o)})}var sa=p("ZodRecord",(e,t)=>{Wc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ym(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function pe(e,t,r){return new sa({type:"record",keyType:e,valueType:t,..._.normalizeParams(r)})}function fx(e,t,r){let n=Ee(e);return n._zod.values=void 0,new sa({type:"record",keyType:n,valueType:t,..._.normalizeParams(r)})}function mx(e,t,r){return new sa({type:"record",keyType:e,valueType:t,mode:"loose",..._.normalizeParams(r)})}var Ch=p("ZodMap",(e,t)=>{Xc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Km(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Ot(...r)),e.nonempty=r=>e.check(Ot(1,r)),e.max=(...r)=>e.check(lr(...r)),e.size=(...r)=>e.check(Lr(...r))});function hx(e,t,r){return new Ch({type:"map",keyType:e,valueType:t,..._.normalizeParams(r)})}var Mh=p("ZodSet",(e,t)=>{Yc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bm(e,r,n,o),e.min=(...r)=>e.check(Ot(...r)),e.nonempty=r=>e.check(Ot(1,r)),e.max=(...r)=>e.check(lr(...r)),e.size=(...r)=>e.check(Lr(...r))});function gx(e,t){return new Mh({type:"set",valueType:e,..._.normalizeParams(t)})}var fo=p("ZodEnum",(e,t)=>{Qc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Um(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new fo({...t,checks:[],..._.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new fo({...t,checks:[],..._.normalizeParams(o),entries:i})}});function Ie(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new fo({type:"enum",entries:r,..._.normalizeParams(t)})}function vx(e,t){return new fo({type:"enum",entries:e,..._.normalizeParams(t)})}var qh=p("ZodLiteral",(e,t)=>{eu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Am(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function T(e,t){return new qh({type:"literal",values:Array.isArray(e)?e:[e],..._.normalizeParams(t)})}var Lh=p("ZodFile",(e,t)=>{tu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qm(e,r,n,o),e.min=(r,n)=>e.check(Ot(r,n)),e.max=(r,n)=>e.check(lr(r,n)),e.mime=(r,n)=>e.check(io(Array.isArray(r)?r:[r],n))});function yx(e){return Yu(Lh,e)}var Vh=p("ZodTransform",(e,t)=>{ru.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jm(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ir(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(_.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(_.issue(a))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Ul(e){return new Vh({type:"transform",transform:e})}var Al=p("ZodOptional",(e,t)=>{ki.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>al(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fe(e){return new Al({type:"optional",innerType:e})}var Fh=p("ZodExactOptional",(e,t)=>{nu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>al(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Jh(e){return new Fh({type:"optional",innerType:e})}var Kh=p("ZodNullable",(e,t)=>{ou.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qm(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Xi(e){return new Kh({type:"nullable",innerType:e})}function _x(e){return fe(Xi(e))}var Bh=p("ZodDefault",(e,t)=>{iu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>th(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Gh(e,t){return new Bh({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():_.shallowClone(t)}})}var Hh=p("ZodPrefault",(e,t)=>{au.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Wh(e,t){return new Hh({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():_.shallowClone(t)}})}var Cl=p("ZodNonOptional",(e,t)=>{su.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Xh(e,t){return new Cl({type:"nonoptional",innerType:e,..._.normalizeParams(t)})}var Yh=p("ZodSuccess",(e,t)=>{cu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lm(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $x(e){return new Yh({type:"success",innerType:e})}var Qh=p("ZodCatch",(e,t)=>{uu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function eg(e,t){return new Qh({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var tg=p("ZodNaN",(e,t)=>{lu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cm(e,r,n,o)});function bx(e){return Ku(tg,e)}var Ml=p("ZodPipe",(e,t)=>{du.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oh(e,r,n,o),e.in=t.in,e.out=t.out});function Yi(e,t){return new Ml({type:"pipe",in:e,out:t})}var ql=p("ZodCodec",(e,t)=>{Ml.init(e,t),Wn.init(e,t)});function xx(e,t,r){return new ql({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var rg=p("ZodReadonly",(e,t)=>{pu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ih(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ng(e){return new rg({type:"readonly",innerType:e})}var og=p("ZodTemplateLiteral",(e,t)=>{fu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mm(e,r,n,o)});function kx(e,t){return new og({type:"template_literal",parts:e,..._.normalizeParams(t)})}var ig=p("ZodLazy",(e,t)=>{gu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sh(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function ag(e){return new ig({type:"lazy",getter:e})}var sg=p("ZodPromise",(e,t)=>{hu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ah(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Sx(e){return new sg({type:"promise",innerType:e})}var cg=p("ZodFunction",(e,t)=>{mu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fm(e,r,n,o)});function wx(e){return new cg({type:"function",input:Array.isArray(e?.input)?Ah(e?.input):e?.input??W(ue()),output:e?.output??ue()})}var ca=p("ZodCustom",(e,t)=>{vu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vm(e,r,n,o)});function zx(e){let t=new se({check:"custom"});return t._zod.check=e,t}function Ll(e,t){return Qu(ca,e??(()=>!0),t)}function ug(e,t={}){return el(ca,e,t)}function lg(e){return tl(e)}var Ix=rl,Px=nl;function Tx(e,t={}){let r=new ca({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,..._.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var jx=(...e)=>ol({Codec:ql,Boolean:ra,String:Qi},...e);function Ox(e){let t=ag(()=>ie([h(e),ne(),ve(),ho(),W(t),pe(h(),t)]));return t}function ua(e,t){return Yi(Ul(e),t)}var dg;dg||(dg={});var P1={...po,...Hi,iso:dr};ye(yu());var Fl="2025-11-25";var pg=[Fl,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Bt="io.modelcontextprotocol/related-task",da="2.0",_e=Ll(e=>e!==null&&(typeof e=="object"||typeof e=="function")),fg=ie([h(),ne().int()]),mg=h(),B1=ze({ttl:ie([ne(),ho()]).optional(),pollInterval:ne().optional()}),Dx=z({ttl:ne().optional()}),Rx=z({taskId:h()}),Jl=ze({progressToken:fg.optional(),[Bt]:Rx.optional()}),Ge=z({_meta:Jl.optional()}),vo=Ge.extend({task:Dx.optional()}),hg=e=>vo.safeParse(e).success,$e=z({method:h(),params:Ge.loose().optional()}),Ye=z({_meta:Jl.optional()}),Qe=z({method:h(),params:Ye.loose().optional()}),be=ze({_meta:Jl.optional()}),pa=ie([h(),ne().int()]),gg=z({jsonrpc:T(da),id:pa,...$e.shape}).strict(),Kl=e=>gg.safeParse(e).success,vg=z({jsonrpc:T(da),...Qe.shape}).strict(),yg=e=>vg.safeParse(e).success,Bl=z({jsonrpc:T(da),id:pa,result:be}).strict(),yo=e=>Bl.safeParse(e).success;var L;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(L||(L={}));var Gl=z({jsonrpc:T(da),id:pa.optional(),error:z({code:ne().int(),message:h(),data:ue().optional()})}).strict();var _g=e=>Gl.safeParse(e).success;var $g=ie([gg,vg,Bl,Gl]),G1=ie([Bl,Gl]),fa=be.strict(),Ux=Ye.extend({requestId:pa.optional(),reason:h().optional()}),ma=Qe.extend({method:T("notifications/cancelled"),params:Ux}),Ax=z({src:h(),mimeType:h().optional(),sizes:W(h()).optional(),theme:Ie(["light","dark"]).optional()}),_o=z({icons:W(Ax).optional()}),Gr=z({name:h(),title:h().optional()}),bg=Gr.extend({...Gr.shape,..._o.shape,version:h(),websiteUrl:h().optional(),description:h().optional()}),Cx=go(z({applyDefaults:ve().optional()}),pe(h(),ue())),Mx=ua(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,go(z({form:Cx.optional(),url:_e.optional()}),pe(h(),ue()).optional())),qx=ze({list:_e.optional(),cancel:_e.optional(),requests:ze({sampling:ze({createMessage:_e.optional()}).optional(),elicitation:ze({create:_e.optional()}).optional()}).optional()}),Lx=ze({list:_e.optional(),cancel:_e.optional(),requests:ze({tools:ze({call:_e.optional()}).optional()}).optional()}),Vx=z({experimental:pe(h(),_e).optional(),sampling:z({context:_e.optional(),tools:_e.optional()}).optional(),elicitation:Mx.optional(),roots:z({listChanged:ve().optional()}).optional(),tasks:qx.optional()}),Fx=Ge.extend({protocolVersion:h(),capabilities:Vx,clientInfo:bg}),Hl=$e.extend({method:T("initialize"),params:Fx});var Jx=z({experimental:pe(h(),_e).optional(),logging:_e.optional(),completions:_e.optional(),prompts:z({listChanged:ve().optional()}).optional(),resources:z({subscribe:ve().optional(),listChanged:ve().optional()}).optional(),tools:z({listChanged:ve().optional()}).optional(),tasks:Lx.optional()}),Kx=be.extend({protocolVersion:h(),capabilities:Jx,serverInfo:bg,instructions:h().optional()}),Wl=Qe.extend({method:T("notifications/initialized"),params:Ye.optional()});var ha=$e.extend({method:T("ping"),params:Ge.optional()}),Bx=z({progress:ne(),total:fe(ne()),message:fe(h())}),Gx=z({...Ye.shape,...Bx.shape,progressToken:fg}),ga=Qe.extend({method:T("notifications/progress"),params:Gx}),Hx=Ge.extend({cursor:mg.optional()}),$o=$e.extend({params:Hx.optional()}),bo=be.extend({nextCursor:mg.optional()}),Wx=Ie(["working","input_required","completed","failed","cancelled"]),xo=z({taskId:h(),status:Wx,ttl:ie([ne(),ho()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:fe(ne()),statusMessage:fe(h())}),Hr=be.extend({task:xo}),Xx=Ye.merge(xo),ko=Qe.extend({method:T("notifications/tasks/status"),params:Xx}),va=$e.extend({method:T("tasks/get"),params:Ge.extend({taskId:h()})}),ya=be.merge(xo),_a=$e.extend({method:T("tasks/result"),params:Ge.extend({taskId:h()})}),H1=be.loose(),$a=$o.extend({method:T("tasks/list")}),ba=bo.extend({tasks:W(xo)}),xa=$e.extend({method:T("tasks/cancel"),params:Ge.extend({taskId:h()})}),xg=be.merge(xo),kg=z({uri:h(),mimeType:fe(h()),_meta:pe(h(),ue()).optional()}),Sg=kg.extend({text:h()}),Xl=h().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),wg=kg.extend({blob:Xl}),So=Ie(["user","assistant"]),Wr=z({audience:W(So).optional(),priority:ne().min(0).max(1).optional(),lastModified:dr.datetime({offset:!0}).optional()}),zg=z({...Gr.shape,..._o.shape,uri:h(),description:fe(h()),mimeType:fe(h()),annotations:Wr.optional(),_meta:fe(ze({}))}),Yx=z({...Gr.shape,..._o.shape,uriTemplate:h(),description:fe(h()),mimeType:fe(h()),annotations:Wr.optional(),_meta:fe(ze({}))}),Yl=$o.extend({method:T("resources/list")}),Qx=bo.extend({resources:W(zg)}),ek=$o.extend({method:T("resources/templates/list")}),tk=bo.extend({resourceTemplates:W(Yx)}),Ql=Ge.extend({uri:h()}),rk=Ql,ed=$e.extend({method:T("resources/read"),params:rk}),nk=be.extend({contents:W(ie([Sg,wg]))}),ok=Qe.extend({method:T("notifications/resources/list_changed"),params:Ye.optional()}),ik=Ql,ak=$e.extend({method:T("resources/subscribe"),params:ik}),sk=Ql,ck=$e.extend({method:T("resources/unsubscribe"),params:sk}),uk=Ye.extend({uri:h()}),lk=Qe.extend({method:T("notifications/resources/updated"),params:uk}),dk=z({name:h(),description:fe(h()),required:fe(ve())}),pk=z({...Gr.shape,..._o.shape,description:fe(h()),arguments:fe(W(dk)),_meta:fe(ze({}))}),td=$o.extend({method:T("prompts/list")}),fk=bo.extend({prompts:W(pk)}),mk=Ge.extend({name:h(),arguments:pe(h(),h()).optional()}),rd=$e.extend({method:T("prompts/get"),params:mk}),nd=z({type:T("text"),text:h(),annotations:Wr.optional(),_meta:pe(h(),ue()).optional()}),od=z({type:T("image"),data:Xl,mimeType:h(),annotations:Wr.optional(),_meta:pe(h(),ue()).optional()}),id=z({type:T("audio"),data:Xl,mimeType:h(),annotations:Wr.optional(),_meta:pe(h(),ue()).optional()}),hk=z({type:T("tool_use"),name:h(),id:h(),input:pe(h(),ue()),_meta:pe(h(),ue()).optional()}),gk=z({type:T("resource"),resource:ie([Sg,wg]),annotations:Wr.optional(),_meta:pe(h(),ue()).optional()}),vk=zg.extend({type:T("resource_link")}),ad=ie([nd,od,id,vk,gk]),yk=z({role:So,content:ad}),_k=be.extend({description:h().optional(),messages:W(yk)}),$k=Qe.extend({method:T("notifications/prompts/list_changed"),params:Ye.optional()}),bk=z({title:h().optional(),readOnlyHint:ve().optional(),destructiveHint:ve().optional(),idempotentHint:ve().optional(),openWorldHint:ve().optional()}),xk=z({taskSupport:Ie(["required","optional","forbidden"]).optional()}),Ig=z({...Gr.shape,..._o.shape,description:h().optional(),inputSchema:z({type:T("object"),properties:pe(h(),_e).optional(),required:W(h()).optional()}).catchall(ue()),outputSchema:z({type:T("object"),properties:pe(h(),_e).optional(),required:W(h()).optional()}).catchall(ue()).optional(),annotations:bk.optional(),execution:xk.optional(),_meta:pe(h(),ue()).optional()}),sd=$o.extend({method:T("tools/list")}),kk=bo.extend({tools:W(Ig)}),ka=be.extend({content:W(ad).default([]),structuredContent:pe(h(),ue()).optional(),isError:ve().optional()}),W1=ka.or(be.extend({toolResult:ue()})),Sk=vo.extend({name:h(),arguments:pe(h(),ue()).optional()}),wo=$e.extend({method:T("tools/call"),params:Sk}),wk=Qe.extend({method:T("notifications/tools/list_changed"),params:Ye.optional()}),X1=z({autoRefresh:ve().default(!0),debounceMs:ne().int().nonnegative().default(300)}),zo=Ie(["debug","info","notice","warning","error","critical","alert","emergency"]),zk=Ge.extend({level:zo}),cd=$e.extend({method:T("logging/setLevel"),params:zk}),Ik=Ye.extend({level:zo,logger:h().optional(),data:ue()}),Pk=Qe.extend({method:T("notifications/message"),params:Ik}),Tk=z({name:h().optional()}),jk=z({hints:W(Tk).optional(),costPriority:ne().min(0).max(1).optional(),speedPriority:ne().min(0).max(1).optional(),intelligencePriority:ne().min(0).max(1).optional()}),Ok=z({mode:Ie(["auto","required","none"]).optional()}),Ek=z({type:T("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:W(ad).default([]),structuredContent:z({}).loose().optional(),isError:ve().optional(),_meta:pe(h(),ue()).optional()}),Nk=aa("type",[nd,od,id]),la=aa("type",[nd,od,id,hk,Ek]),Zk=z({role:So,content:ie([la,W(la)]),_meta:pe(h(),ue()).optional()}),Dk=vo.extend({messages:W(Zk),modelPreferences:jk.optional(),systemPrompt:h().optional(),includeContext:Ie(["none","thisServer","allServers"]).optional(),temperature:ne().optional(),maxTokens:ne().int(),stopSequences:W(h()).optional(),metadata:_e.optional(),tools:W(Ig).optional(),toolChoice:Ok.optional()}),Rk=$e.extend({method:T("sampling/createMessage"),params:Dk}),ud=be.extend({model:h(),stopReason:fe(Ie(["endTurn","stopSequence","maxTokens"]).or(h())),role:So,content:Nk}),ld=be.extend({model:h(),stopReason:fe(Ie(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:So,content:ie([la,W(la)])}),Uk=z({type:T("boolean"),title:h().optional(),description:h().optional(),default:ve().optional()}),Ak=z({type:T("string"),title:h().optional(),description:h().optional(),minLength:ne().optional(),maxLength:ne().optional(),format:Ie(["email","uri","date","date-time"]).optional(),default:h().optional()}),Ck=z({type:Ie(["number","integer"]),title:h().optional(),description:h().optional(),minimum:ne().optional(),maximum:ne().optional(),default:ne().optional()}),Mk=z({type:T("string"),title:h().optional(),description:h().optional(),enum:W(h()),default:h().optional()}),qk=z({type:T("string"),title:h().optional(),description:h().optional(),oneOf:W(z({const:h(),title:h()})),default:h().optional()}),Lk=z({type:T("string"),title:h().optional(),description:h().optional(),enum:W(h()),enumNames:W(h()).optional(),default:h().optional()}),Vk=ie([Mk,qk]),Fk=z({type:T("array"),title:h().optional(),description:h().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:z({type:T("string"),enum:W(h())}),default:W(h()).optional()}),Jk=z({type:T("array"),title:h().optional(),description:h().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:z({anyOf:W(z({const:h(),title:h()}))}),default:W(h()).optional()}),Kk=ie([Fk,Jk]),Bk=ie([Lk,Vk,Kk]),Gk=ie([Bk,Uk,Ak,Ck]),Hk=vo.extend({mode:T("form").optional(),message:h(),requestedSchema:z({type:T("object"),properties:pe(h(),Gk),required:W(h()).optional()})}),Wk=vo.extend({mode:T("url"),message:h(),elicitationId:h(),url:h().url()}),Xk=ie([Hk,Wk]),Yk=$e.extend({method:T("elicitation/create"),params:Xk}),Qk=Ye.extend({elicitationId:h()}),eS=Qe.extend({method:T("notifications/elicitation/complete"),params:Qk}),Sa=be.extend({action:Ie(["accept","decline","cancel"]),content:ua(e=>e===null?void 0:e,pe(h(),ie([h(),ne(),ve(),W(h())])).optional())}),tS=z({type:T("ref/resource"),uri:h()});var rS=z({type:T("ref/prompt"),name:h()}),nS=Ge.extend({ref:ie([rS,tS]),argument:z({name:h(),value:h()}),context:z({arguments:pe(h(),h()).optional()}).optional()}),oS=$e.extend({method:T("completion/complete"),params:nS});var iS=be.extend({completion:ze({values:W(h()).max(100),total:fe(ne().int()),hasMore:fe(ve())})}),aS=z({uri:h().startsWith("file://"),name:h().optional(),_meta:pe(h(),ue()).optional()}),sS=$e.extend({method:T("roots/list"),params:Ge.optional()}),dd=be.extend({roots:W(aS)}),cS=Qe.extend({method:T("notifications/roots/list_changed"),params:Ye.optional()}),Y1=ie([ha,Hl,oS,cd,rd,td,Yl,ek,ed,ak,ck,wo,sd,va,_a,$a,xa]),Q1=ie([ma,ga,Wl,cS,ko]),eN=ie([fa,ud,ld,Sa,dd,ya,ba,Hr]),tN=ie([ha,Rk,Yk,sS,va,_a,$a,xa]),rN=ie([ma,ga,Pk,lk,ok,wk,$k,ko,eS]),nN=ie([fa,Kx,iS,_k,fk,Qx,tk,nk,ka,kk,ya,ba,Hr]),A=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===L.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Vl(o.elicitations,r)}return new e(t,r,n)}},Vl=class extends A{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(L.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function Gt(e){return e==="completed"||e==="failed"||e==="cancelled"}var UN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function pd(e){let r=Gi(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=dh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function fd(e,t){let r=Kt(e,t);if(!r.success)throw r.error;return r.data}var mS=6e4,wa=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(ma,r=>{this._oncancel(r)}),this.setNotificationHandler(ga,r=>{this._onprogress(r)}),this.setRequestHandler(ha,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(va,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new A(L.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(_a,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,m=new A(d.error.code,d.error.message,d.error.data);l(m)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new A(L.InvalidParams,`Task not found: ${i}`);if(!Gt(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(Gt(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[Bt]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler($a,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new A(L.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(xa,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new A(L.InvalidParams,`Task not found: ${r.params.taskId}`);if(Gt(o.status))throw new A(L.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new A(L.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof A?o:new A(L.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),A.fromError(L.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),yo(i)||_g(i)?this._onresponse(i):Kl(i)?this._onrequest(i,a):yg(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=A.fromError(L.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[Bt]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:L.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=hg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:t.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,m)=>{if(a.signal.aborted)throw new A(L.ConnectionClosed,"Request was cancelled");let f={...m,relatedRequestId:t.id};i&&!f.relatedTask&&(f.relatedTask={taskId:i});let g=f.relatedTask?.taskId??i;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:L.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),yo(t))n(t);else{let a=new A(t.error.code,t.error.message,t.error.data);n(a)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(yo(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),yo(t))o(t);else{let a=A.fromError(t.error.code,t.error.message,t.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(a){yield{type:"error",error:a instanceof A?a:new A(L.InternalError,String(a))}}return}let i;try{let a=await this.request(t,Hr,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new A(L.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},Gt(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new A(L.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new A(L.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof A?a:new A(L.InternalError,String(a))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=E=>{l(E)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(E){d(E);return}n?.signal?.throwIfAborted();let m=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:m};n?.onprogress&&(this._progressHandlers.set(m,n.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:m}}),s&&(f.params={...f.params,task:s}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Bt]:c}});let g=E=>{this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(E)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`)));let P=E instanceof A?E:new A(L.RequestTimeout,String(E));l(P)};this._responseHandlers.set(m,E=>{if(!n?.signal?.aborted){if(E instanceof Error)return l(E);try{let P=Kt(r,E.result);P.success?u(P.data):l(P.error)}catch(P){l(P)}}}),n?.signal?.addEventListener("abort",()=>{g(n?.signal?.reason)});let v=n?.timeout??mS,$=()=>g(A.fromError(L.RequestTimeout,"Request timed out",{timeout:v}));this._setupTimeout(m,v,n?.maxTotalTimeout,$,n?.resetTimeoutOnProgress??!1);let k=c?.taskId;if(k){let E=P=>{let C=this._responseHandlers.get(m);C?C(P):this._onerror(new Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,E),this._enqueueTaskMessage(k,{type:"request",message:f,timestamp:Date.now()}).catch(P=>{this._cleanupTimeout(m),l(P)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(E=>{this._cleanupTimeout(m),l(E)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},ya,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},ba,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},xg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Bt]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Bt]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Bt]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=pd(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=fd(t,o);return Promise.resolve(r(a,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=pd(t);this._notificationHandlers.set(n,o=>{let i=fd(t,o);return Promise.resolve(r(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&Kl(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new A(L.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new A(L.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new A(L.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new A(L.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=ko.parse({method:"notifications/tasks/status",params:s});await this.notification(c),Gt(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new A(L.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Gt(s.status))throw new A(L.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=ko.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Gt(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Pg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Tg(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let a=r[o];Pg(a)&&Pg(i)?r[o]={...a,...i}:r[o]=i}return r}var $_=yn(Qp(),1),b_=yn(__(),1);function vT(){let e=new $_.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,b_.default)(e),e}var as=class{constructor(t){this._ajv=t??vT()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var ss=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function x_(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function k_(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var cs=class extends wa{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(zo.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new as,this.setRequestHandler(Hl,n=>this._oninitialize(n)),this.setNotificationHandler(Wl,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(cd,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=zo.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new ss(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Tg(this._capabilities,t)}setRequestHandler(t,r){let o=Gi(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(Kr(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=Kt(wo,c);if(!l.success){let g=l.error instanceof Error?l.error.message:String(l.error);throw new A(L.InvalidParams,`Invalid tools/call request: ${g}`)}let{params:d}=l.data,m=await Promise.resolve(r(c,u));if(d.task){let g=Kt(Hr,m);if(!g.success){let v=g.error instanceof Error?g.error.message:String(g.error);throw new A(L.InvalidParams,`Invalid task creation result: ${v}`)}return g.data}let f=Kt(ka,m);if(!f.success){let g=f.error instanceof Error?f.error.message:String(f.error);throw new A(L.InvalidParams,`Invalid tools/call result: ${g}`)}return f.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){k_(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&x_(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:pg.includes(r)?r:Fl,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},fa)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],i=o.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(i){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},ld,r):this.request({method:"sampling/createMessage",params:t},ud,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=t;return this.request({method:"elicitation/create",params:o},Sa,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},i=await this.request({method:"elicitation/create",params:o},Sa,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new A(L.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof A?a:new A(L.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},dd,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var cf=yn(require("node:process"),1);var us=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
48
48
  `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),yT(r)}clear(){this._buffer=void 0}};function yT(e){return $g.parse(JSON.parse(e))}function S_(e){return JSON.stringify(e)+`
49
- `}var ls=class{constructor(t=cf.default.stdin,r=cf.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new us,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=S_(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var ds=process.env.SKILLS_PATH?process.env.SKILLS_PATH:ot.existsSync(ht.join(__dirname,"..","skills"))?ht.join(__dirname,"..","skills"):ht.join(__dirname,"skills");function _T(e){let t=e.match(/^---\n([\s\S]*?)\n---/);if(!t)return{name:"",description:""};let r=t[1],n=r.match(/^name:\s*["']?(.+?)["']?\s*$/m),o=r.match(/^description:\s*["']?([\s\S]+?)["']?\s*$/m);return{name:n?n[1].trim():"",description:o?o[1].trim().replace(/\n\s*/g," "):""}}function ps(){if(!ot.existsSync(ds))return[];let e=[];for(let t of ot.readdirSync(ds,{withFileTypes:!0})){if(!t.isDirectory())continue;let r=ht.join(ds,t.name),n=ht.join(r,"SKILL.md");if(!ot.existsSync(n))continue;let o=ot.readFileSync(n,"utf-8"),{name:i,description:a}=_T(o);e.push({name:i||t.name,description:a,skillPath:n})}return e.sort((t,r)=>t.name.localeCompare(r.name))}function w_(e){let t=ps();return t.find(r=>r.name===e)??t.find(r=>ht.basename(ht.dirname(r.skillPath))===e)}var kr=new cs({name:"superpowers-mcp",version:"5.1.1"},{capabilities:{resources:{subscribe:!1},prompts:{},tools:{}}});kr.setRequestHandler(Yl,async()=>({resources:ps().map(t=>({uri:`skill://superpowers/${t.name}`,name:t.name,description:t.description,mimeType:"text/markdown"}))}));kr.setRequestHandler(ed,async e=>{let t=e.params.uri,r=t.match(/^skill:\/\/superpowers\/(.+)$/);if(!r)throw new A(L.InvalidRequest,`Invalid skill URI: ${t}`);let n=r[1],o=w_(n);if(!o)throw new A(L.InvalidRequest,`Skill not found: ${n}`);let i=ot.readFileSync(o.skillPath,"utf-8");return{contents:[{uri:t,mimeType:"text/markdown",text:i}]}});kr.setRequestHandler(td,async()=>({prompts:[{name:"session-start",description:"Inject the Superpowers context into an AI agent session. Tells the agent it has superpowers and how to use the skill system."}]}));kr.setRequestHandler(rd,async e=>{if(e.params.name!=="session-start")throw new A(L.InvalidRequest,`Unknown prompt: ${e.params.name}`);let t=ht.join(ds,"using-superpowers","SKILL.md"),r="";return ot.existsSync(t)?r=ot.readFileSync(t,"utf-8"):r=`# Superpowers
49
+ `}var ls=class{constructor(t=cf.default.stdin,r=cf.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new us,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=S_(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var ds=process.env.SKILLS_PATH?process.env.SKILLS_PATH:ot.existsSync(ht.join(__dirname,"..","skills"))?ht.join(__dirname,"..","skills"):ht.join(__dirname,"skills");function _T(e){let t=e.match(/^---\n([\s\S]*?)\n---/);if(!t)return{name:"",description:""};let r=t[1],n=r.match(/^name:\s*["']?(.+?)["']?\s*$/m),o=r.match(/^description:\s*["']?([\s\S]+?)["']?\s*$/m);return{name:n?n[1].trim():"",description:o?o[1].trim().replace(/\n\s*/g," "):""}}function ps(){if(!ot.existsSync(ds))return[];let e=[];for(let t of ot.readdirSync(ds,{withFileTypes:!0})){if(!t.isDirectory())continue;let r=ht.join(ds,t.name),n=ht.join(r,"SKILL.md");if(!ot.existsSync(n))continue;let o=ot.readFileSync(n,"utf-8"),{name:i,description:a}=_T(o);e.push({name:i||t.name,description:a,skillPath:n})}return e.sort((t,r)=>t.name.localeCompare(r.name))}function w_(e){let t=ps();return t.find(r=>r.name===e)??t.find(r=>ht.basename(ht.dirname(r.skillPath))===e)}var kr=new cs({name:"superpowers-mcp",version:"6.0.0"},{capabilities:{resources:{subscribe:!1},prompts:{},tools:{}}});kr.setRequestHandler(Yl,async()=>({resources:ps().map(t=>({uri:`skill://superpowers/${t.name}`,name:t.name,description:t.description,mimeType:"text/markdown"}))}));kr.setRequestHandler(ed,async e=>{let t=e.params.uri,r=t.match(/^skill:\/\/superpowers\/(.+)$/);if(!r)throw new A(L.InvalidRequest,`Invalid skill URI: ${t}`);let n=r[1],o=w_(n);if(!o)throw new A(L.InvalidRequest,`Skill not found: ${n}`);let i=ot.readFileSync(o.skillPath,"utf-8");return{contents:[{uri:t,mimeType:"text/markdown",text:i}]}});kr.setRequestHandler(td,async()=>({prompts:[{name:"session-start",description:"Inject the Superpowers context into an AI agent session. Tells the agent it has superpowers and how to use the skill system."}]}));kr.setRequestHandler(rd,async e=>{if(e.params.name!=="session-start")throw new A(L.InvalidRequest,`Unknown prompt: ${e.params.name}`);let t=ht.join(ds,"using-superpowers","SKILL.md"),r="";return ot.existsSync(t)?r=ot.readFileSync(t,"utf-8"):r=`# Superpowers
50
50
 
51
51
  You have superpowers. Use the read_skill and list_skills tools to discover and load skills.`,{description:"Superpowers session start context \u2014 establishes how to find and use skills",messages:[{role:"user",content:{type:"text",text:`<EXTREMELY_IMPORTANT>
52
52
  You have superpowers.
@@ -65,7 +65,7 @@ Use \`read_skill\` with the skill name to load its full content.
65
65
 
66
66
  ---
67
67
 
68
- ${o}`}]}}if(t==="read_skill"){let n=r?.skill_name;if(!n)throw new A(L.InvalidParams,"skill_name is required");let o=w_(n);if(!o){let a=ps().map(s=>s.name).join(", ");throw new A(L.InvalidRequest,`Skill "${n}" not found. Available skills: ${a}`)}let i=ot.readFileSync(o.skillPath,"utf-8");return{content:[{type:"text",text:`# Skill: ${o.name}
68
+ ${o}`}]}}if(t==="read_skill"){let n=typeof r?.skill_name=="string"?r.skill_name:void 0;if(!n)throw new A(L.InvalidParams,"skill_name is required");let o=w_(n);if(!o){let a=ps().map(s=>s.name).join(", ");throw new A(L.InvalidRequest,`Skill "${n}" not found. Available skills: ${a}`)}let i=ot.readFileSync(o.skillPath,"utf-8");return{content:[{type:"text",text:`# Skill: ${o.name}
69
69
 
70
70
  ${i}`}]}}throw new A(L.MethodNotFound,`Unknown tool: ${t}`)});async function $T(){let e=new ls;await kr.connect(e)}$T().catch(e=>{process.stderr.write(`MCP Server fatal error: ${String(e)}
71
71
  `),process.exit(1)});
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "superpowers-mcp",
3
3
  "displayName": "Superpowers MCP",
4
4
  "description": "Superpowers skills library (TDD, debugging, collaboration workflows) as an MCP server for VSCode and Antigravity",
5
- "version": "5.1.2",
5
+ "version": "6.0.1",
6
6
  "publisher": "superpowers",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -22,7 +22,7 @@ Every project goes through this process. A todo list, a single-function utility,
22
22
  You MUST create a task for each of these items and complete them in order:
23
23
 
24
24
  1. **Explore project context** — check files, docs, recent commits
25
- 2. **Offer visual companion** (if topic will involve visual questions) — this is its own message, not combined with a clarifying question. See the Visual Companion section below.
25
+ 2. **Offer the visual companion just-in-time** — NOT upfront. The first time a question would genuinely be clearer shown than described, offer it then (its own message); on approval its browser tab opens for you. If no visual question ever arises, never offer it. See the Visual Companion section below.
26
26
  3. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria
27
27
  4. **Propose 2-3 approaches** — with trade-offs and your recommendation
28
28
  5. **Present design** — in sections scaled to their complexity, get user approval after each section
@@ -36,8 +36,6 @@ You MUST create a task for each of these items and complete them in order:
36
36
  ```dot
37
37
  digraph brainstorming {
38
38
  "Explore project context" [shape=box];
39
- "Visual questions ahead?" [shape=diamond];
40
- "Offer Visual Companion\n(own message, no other content)" [shape=box];
41
39
  "Ask clarifying questions" [shape=box];
42
40
  "Propose 2-3 approaches" [shape=box];
43
41
  "Present design sections" [shape=box];
@@ -47,10 +45,7 @@ digraph brainstorming {
47
45
  "User reviews spec?" [shape=diamond];
48
46
  "Invoke writing-plans skill" [shape=doublecircle];
49
47
 
50
- "Explore project context" -> "Visual questions ahead?";
51
- "Visual questions ahead?" -> "Offer Visual Companion\n(own message, no other content)" [label="yes"];
52
- "Visual questions ahead?" -> "Ask clarifying questions" [label="no"];
53
- "Offer Visual Companion\n(own message, no other content)" -> "Ask clarifying questions";
48
+ "Explore project context" -> "Ask clarifying questions";
54
49
  "Ask clarifying questions" -> "Propose 2-3 approaches";
55
50
  "Propose 2-3 approaches" -> "Present design sections";
56
51
  "Present design sections" -> "User approves design?";
@@ -148,10 +143,10 @@ Wait for the user's response. If they request changes, make them and re-run the
148
143
 
149
144
  A browser-based companion for showing mockups, diagrams, and visual options during brainstorming. Available as a tool — not a mode. Accepting the companion means it's available for questions that benefit from visual treatment; it does NOT mean every question goes through the browser.
150
145
 
151
- **Offering the companion:** When you anticipate that upcoming questions will involve visual content (mockups, layouts, diagrams), offer it once for consent:
152
- > "Some of what we're working on might be easier to explain if I can show it to you in a web browser. I can put together mockups, diagrams, comparisons, and other visuals as we go. This feature is still new and can be token-intensive. Want to try it? (Requires opening a local URL)"
146
+ **Offering the companion (just-in-time):** Do NOT offer it upfront. Wait until a question would genuinely be clearer shown than told — a real mockup / layout / diagram question, not merely a UI *topic*. The first time that happens, offer it then, as its own message:
147
+ > "This next part might be easier if I show you — I can put together mockups, diagrams, and comparisons in a browser tab as we go. It's still new and can be token-intensive. Want me to? I'll open it for you."
153
148
 
154
- **This offer MUST be its own message.** Do not combine it with clarifying questions, context summaries, or any other content. The message should contain ONLY the offer above and nothing else. Wait for the user's response before continuing. If they decline, proceed with text-only brainstorming.
149
+ **This offer MUST be its own message.** Only the offer — no clarifying question, summary, or other content. Wait for the user's response. If they accept, start the server with `--open` so their browser opens to the first screen automatically. If they decline, continue text-only and don't offer again unless they raise it.
155
150
 
156
151
  **Per-question decision:** Even after the user accepts, decide FOR EACH QUESTION whether to use the browser or the terminal. The test: **would the user understand this better by seeing it than reading it?**
157
152
 
@@ -9,11 +9,11 @@
9
9
  *
10
10
  * This template provides a consistent frame with:
11
11
  * - OS-aware light/dark theming
12
- * - Fixed header and selection indicator bar
12
+ * - Header branding and connection status
13
13
  * - Scrollable main content area
14
14
  * - CSS helpers for common UI patterns
15
15
  *
16
- * Content is injected via placeholder comment in #claude-content.
16
+ * Content is injected via placeholder comment in #frame-content.
17
17
  */
18
18
 
19
19
  * { box-sizing: border-box; margin: 0; padding: 0; }
@@ -63,34 +63,37 @@
63
63
  }
64
64
 
65
65
  /* ===== FRAME STRUCTURE ===== */
66
- .header {
67
- background: var(--bg-secondary);
68
- padding: 0.5rem 1.5rem;
69
- display: flex;
70
- justify-content: space-between;
71
- align-items: center;
72
- border-bottom: 1px solid var(--border);
73
- flex-shrink: 0;
66
+ .brand { display: flex; align-items: center; min-width: 0; overflow: hidden; color: var(--text-secondary); line-height: 1; }
67
+ .brand a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 0.5rem; min-width: 0; max-width: 100%; line-height: 1; }
68
+ .brand-copy { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1; transform: translateY(-1px); }
69
+ .brand-logo { display: block; height: 1em; width: auto; max-width: 180px; flex-shrink: 0; filter: invert(1); }
70
+ @media (prefers-color-scheme: dark) {
71
+ .brand-logo { filter: none; }
74
72
  }
75
- .header h1 { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
76
- .header .status { font-size: 0.7rem; color: var(--success); display: flex; align-items: center; gap: 0.4rem; }
77
- .header .status::before { content: ''; width: 6px; height: 6px; background: var(--success); border-radius: 50%; }
73
+ .status { font-size: 0.7rem; color: var(--status-color, var(--success)); display: flex; align-items: center; gap: 0.4rem; justify-self: end; white-space: nowrap; line-height: 1; }
74
+ .status::before { content: ''; width: 6px; height: 6px; background: var(--status-color, var(--success)); border-radius: 50%; }
78
75
 
79
76
  .main { flex: 1; overflow-y: auto; }
80
- #claude-content { padding: 2rem; min-height: 100%; }
77
+ #frame-content { padding: 2rem; min-height: 100%; }
81
78
 
82
- .indicator-bar {
79
+ .header {
83
80
  background: var(--bg-secondary);
84
- border-top: 1px solid var(--border);
81
+ border-bottom: 1px solid var(--border);
85
82
  padding: 0.5rem 1.5rem;
86
83
  flex-shrink: 0;
87
- text-align: center;
84
+ display: grid;
85
+ grid-template-columns: minmax(0, 1fr) auto;
86
+ align-items: center;
87
+ gap: 1rem;
88
+ min-height: 42px;
88
89
  }
89
- .indicator-bar span {
90
+ .header .brand { justify-self: start; width: 100%; font-size: 0.75rem; line-height: 1; }
91
+ .header .status { grid-column: 2; line-height: 1; }
92
+ .header span {
90
93
  font-size: 0.75rem;
91
94
  color: var(--text-secondary);
92
95
  }
93
- .indicator-bar .selected-text {
96
+ .header .selected-text {
94
97
  color: var(--accent);
95
98
  font-weight: 500;
96
99
  }
@@ -196,19 +199,15 @@
196
199
  </head>
197
200
  <body>
198
201
  <div class="header">
199
- <h1><a href="https://github.com/obra/superpowers" style="color: inherit; text-decoration: none;">Superpowers Brainstorming</a></h1>
200
- <div class="status">Connected</div>
202
+ <!-- BRANDING -->
203
+ <div class="status">Connecting…</div>
201
204
  </div>
202
205
 
203
206
  <div class="main">
204
- <div id="claude-content">
207
+ <div id="frame-content">
205
208
  <!-- CONTENT -->
206
209
  </div>
207
210
  </div>
208
211
 
209
- <div class="indicator-bar">
210
- <span id="indicator-text">Click an option above, then return to the terminal</span>
211
- </div>
212
-
213
212
  </body>
214
213
  </html>