cheumk commited on
Commit
4e039c5
·
verified ·
1 Parent(s): 34b901f

Upload 32 files

Browse files
README.md CHANGED
@@ -11,104 +11,73 @@ pinned: false
11
 
12
  # 🤖 Agent Studio
13
 
14
- 一個基於 React 18 + Vite + Tailwind CSS 的 AI Agent 工作室,支援串流聊天、多步工具呼叫與多 Agent 切換。
15
 
16
  ## ✨ 功能
17
 
18
- - **即時串流聊天** — 接駁任何 OpenAI 相容端點(OpenRouter / Groq / Cohere / 自訂),SSE 打字機效果
19
- - **完整對話歷史** — 聊天頁每次送完整對話,不只最新一則
20
- - **多步工具呼叫迴圈** — 自訂實作(非 LangGraph),最多 6 步,邊跑邊顯示每個 assistant / tool 訊息
21
- - **工具管理** — 加入 / 移除工具(內建 `search_web`、`calculate`)
22
- - **多 Agent 切換** — Researcher / Writer / Analyst,各自注入不同的 system prompt
23
- - **主題切換** — 深色 / 亮色,走 CSS 變數,記憶至 localStorage
24
- - **錯誤可見** — 401/400/429、逾時、網路錯誤都會顯示在對話裡,不會靜默失敗
25
- - **對話匯出** — 匯出 Agent 頁的對話為 JSON
26
- - **設定持久化** — API 設定存瀏覽器 localStorage,重新整理不丟失,可另存多組切換
27
-
28
- ## 🚀 使用方式
29
-
30
- ### 本地開發
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  ```bash
33
  npm install
34
- npm run dev
 
35
  ```
36
 
37
- ### 建置
38
-
39
- ```bash
40
- npm run build
41
- npm run preview
42
- ```
43
-
44
- ### 部署至 Hugging Face Spaces
45
-
46
- 1. 於 HF Spaces 建立新 Space(**Static** 模式,免費)
47
- 2. 上傳整個專案(已含建置好的 `dist/`)
48
- 3. 提交後 HF 會從 `dist/index.html` 伺服已建置好的靜態檔案
49
 
50
- > ✅ **完全免費** — 不需要 `app_build_command`,`dist/` 已預先建置好。
51
- >
52
- > ⚠️ **不要指望 HF Secrets**:Static Space 沒有 `API_KEY` Secret 機制
53
- > (那是 Docker / Gradio 的功能)。金鑰是**填在網頁的輸入框裡**,只存在你的
54
- > 瀏覽器 localStorage,直接從瀏覽器連到供應商 API。
55
-
56
- ## 📁 目錄結構
57
 
58
  ```
59
- agent-studio/
60
- ├── README.md # 本檔(含 HF YAML frontmatter)
61
- ├── package.json
62
- ├── vite.config.js # base: './',讓資產用相對路徑
63
- ├── tailwind.config.js # 語意化色板,接 index.css 的 CSS 變數
64
- ├── postcss.config.js
65
- ├── index.html
66
- ├── public/vite.svg
67
- ├── src/
68
- │ ├── main.jsx
69
- ��� ├── index.css # .theme-dark / .theme-light 變數
70
- │ ├── App.jsx # 導覽、設定、主題(單一 apiConfig 來源)
71
- │ ├── components/
72
- │ │ ├── ChatInterface.jsx # 串流聊天
73
- │ │ ├── AgentInterface.jsx # 工具呼叫迴圈 UI
74
- │ │ └── ExportDialog.jsx
75
- │ ├── store/agentStore.js # 迴圈、請求、錯誤處理
76
- │ └── utils/
77
- │ ├── tools.js # 工具定義 + OpenAI 格式轉換
78
- │ ├── agents.js # Agent 角色與 system prompt
79
- │ └── calc.js # 安全四則運算解析器(無 eval)
80
- └── dist/ # 已建置好的靜態檔案(可直接伺服)
81
  ```
82
 
83
- ## ⚙️ 設定
84
-
85
- | 項目 | 說明 | 預設值 |
86
- |------|------|--------|
87
- | API URL | OpenAI 相容端點 | `https://openrouter.ai/api/v1` |
88
- | API Key | 供應商金鑰 | 空(需手動填入) |
89
- | Model | 模型 id | `nvidia/nemotron-3-ultra-550b-a55b:free` |
90
-
91
- 聊天頁與 Agent 頁**共用同一組設定**,任一頁修改都會同步。
92
-
93
- ## 🔒 安全設計
94
-
95
- - `calculate` 工具用**遞迴下降解析器**求值,只接受數字與 `+ - * / ( ) . %`。
96
- 絕不用 `Function()` / `eval()` 執行模型輸出的字串(避免被 prompt injection 挾持成遠端碼執行)。
97
- - API Key 只存在瀏覽器 localStorage,程式碼裡沒有任何金鑰。
98
- - 所有外部請求都經過 CORS,不經任何中間伺服器。
99
-
100
- ## ⚠️ 已知限制
101
 
102
- - **`search_web` 是模擬的**:純前端沒有網路存取權限(只能跨域打設定裡的 API),
103
- 所以 `search_web` 回傳的是佔位文字。要真的搜尋需自架一個後端代理。
104
- - **自訂工具只有格式、沒有執行器**:加入的自訂工具會送進 API 讓模型呼叫,
105
- 但本機沒有對應實作,會回傳「未實作」。
106
- - **Agent 迴圈是同步的**:`stream: false`,每一步等完整回應,複雜任務可能較慢;
107
- 單步逾時 120 秒。
108
- - **匯出只含 Agent 頁**的對話,聊天頁是獨立狀態。
109
- - **對話不跨重新整理**:聊天頁與 Agent 頁的訊息都存在記憶體(React state / zustand),
110
- 重整頁面會清空。只有 API 設定與主題會寫進 localStorage。
111
 
112
  ## 📄 License
113
 
114
- MIT License.
 
11
 
12
  # 🤖 Agent Studio
13
 
14
+ React 18 + Vite + Tailwind 的 AI Agent 工作室。**以專案為主軸**,全程串流、真的能用的工具、多供應商多模型,所有設定集中在側邊欄。
15
 
16
  ## ✨ 功能
17
 
18
+ - **專案為主軸**:專案 → 多個對話 + 專案指示(自動附加到 system prompt)+ 專案筆記 + 預設 Agent / 模型
19
+ - **側邊欄**:專案、對話、模型、Agent、工具、設定六個分頁;桌面可收合,行動版為可滑出的抽屜
20
+ - **多供應商、多模型**:內建 OpenRouter、OpenAI、Gemini、Groq、DeepSeek、Mistral、Together、SiliconFlow、Cohere、Ollama、LM Studio 等預設(皆為 OpenAI 相容端點),可「抓取模型」自動讀 `/models`;每個對話可各自選模型,途中可換
21
+ - **12 個 Agent 角色**:通用助理、純聊天、研究員、事實查核、寫手、摘要、分析師、工程師、科技新聞、翻譯、家教、規劃師;可編輯、複製、自建,並逐一勾選工具
22
+ - **全程串流、不設逾時**:一般回答與多步工具呼叫都用 `stream: true`,工具呼叫的 delta 會即時累積顯示;也支援推理模型的 `reasoning_content`。只有按「停止」才會中斷
23
+ - **真的工具**(皆從瀏覽器直連有開 CORS 的公開 API,可在「工具」頁直接測試):
24
+
25
+ | 工具 | 來源 | 需金鑰 |
26
+ |---|---|---|
27
+ | `web_search` 網路搜尋 | Wikipedia + DuckDuckGo;填 Tavily 金鑰則改全網搜尋 | 選填 |
28
+ | `wikipedia_article` 條目全文 | Wikipedia | 否 |
29
+ | `fetch_url` 讀網頁 | Jina Reader / 直接讀取(限有開 CORS 的站) | 選填 |
30
+ | `get_weather` 天氣 | Open-Meteo | 否 |
31
+ | `currency_convert` 匯率 | open.er-api.com | 否 |
32
+ | `calculate` 計算機 | 本機安全解析器(無 eval),支援 ^、sqrt、sin… | 否 |
33
+ | `get_current_time` 時間 | 本機 Intl | 否 |
34
+ | `search_github` | GitHub API | 否 |
35
+ | `search_hackernews` | HN Algolia | 否 |
36
+ | `search_papers` 論文 | Crossref | 否 |
37
+ | `search_books` 書籍 | Open Library | 否 |
38
+ | `save_note` / `read_notes` | 專案筆記 | 否 |
39
+
40
+ - **自訂 HTTP 工具**:填 endpoint(`https://api.x.com/q?term={q}`)、method、headers,就能把任何允許 CORS 的 API 變成工具
41
+ - **一鍵匯入 / 匯出**:全部(設定 + 專案 + 對話)、只有設定、單一專案、單一對話(JSON 或 Markdown);可選擇不含金鑰;相容舊版對話 JSON
42
+ - **持久化**:所有資料存在瀏覽器 localStorage(串流時節流寫入),重新整理不會丟;首次開啟會自動沿用舊版的 API 設定
43
+ - **Markdown 渲染**:marked + DOMPurify 消毒,防 XSS
44
+
45
+ ## 🚀 使用
46
 
47
  ```bash
48
  npm install
49
+ npm run dev # 開發
50
+ npm run build # 建置到 dist/
51
  ```
52
 
53
+ 部署到 Hugging Face Spaces(Static):上傳整個專案(含已建置的 `dist/`)即可。金鑰填在網頁裡,只存在你的瀏覽器。
 
 
 
 
 
 
 
 
 
 
 
54
 
55
+ ## 📁 結構
 
 
 
 
 
 
56
 
57
  ```
58
+ src/
59
+ ├── App.jsx # 版面:側邊欄 + 對話
60
+ ├── store/useStore.js # zustand + persist:專案、對話、供應商、Agent、串流迴圈、匯入匯出
61
+ ├── lib/
62
+ │ ├── llm.js # SSE 串流解析(文字 / 推理 / tool_calls 累積),不設逾時
63
+ │ ├── tools.js # 工具定義 + 實作 + 自訂 HTTP 工具
64
+ │ ├── agents.js # 內建 Agent 角色
65
+ │ └── providers.js # 供應商預設、抓取模型
66
+ ├── utils/calc.js # 安全數學解析器
67
+ └── components/
68
+ ├── Sidebar.jsx
69
+ ├── ChatView.jsx
70
+ ├── Markdown.jsx
71
+ ├── ui.jsx
72
+ └── panels/ # Project / Conversation / Models / Agents / Tools / Settings
 
 
 
 
 
 
 
73
  ```
74
 
75
+ ## ⚠️ 限制
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
+ - 純前端只能呼叫有開 CORS 的 API。部分供應商(例如 Anthropic 原生 API)不允許瀏覽器直連,請改走 OpenRouter。
78
+ - `fetch_url` 不填 Jina 金鑰時,只能讀有開 CORS 的網站。
79
+ - localStorage 約 5 MB,對話很多時建議定期「匯出全部」備份;工具結果會截斷到 8000 字。
 
 
 
 
 
 
80
 
81
  ## 📄 License
82
 
83
+ MIT
dist/assets/index-COF6Yw5f.js ADDED
The diff for this file is too large to render. See raw diff
 
dist/assets/index-CnEw9R0T.css ADDED
@@ -0,0 +1 @@
 
 
1
+ *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{top:0;bottom:0}.left-0{left:0}.z-30{z-index:30}.z-40{z-index:40}.col-span-2{grid-column:span 2 / span 2}.mx-auto{margin-left:auto;margin-right:auto}.-ml-1{margin-left:-.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.ml-1{margin-left:.25rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-12{height:3rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-\[100dvh\]{height:100dvh}.h-full{height:100%}.max-h-48{max-height:12rem}.max-h-60{max-height:15rem}.max-h-80{max-height:20rem}.max-h-\[220px\]{max-height:220px}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-\[86vw\]{width:86vw}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-3xl{max-width:48rem}.max-w-\[340px\]{max-width:340px}.max-w-\[85\%\]{max-width:85%}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-col{flex-direction:column}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-edge{border-color:var(--edge)}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-red-900{--tw-border-opacity: 1;border-color:rgb(127 29 29 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.bg-app{background-color:var(--bg)}.bg-black\/60{background-color:#0009}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-field{background-color:var(--field)}.bg-panel{background-color:var(--panel)}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-purple-600\/20{background-color:#9333ea33}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-600\/90{background-color:#dc2626e6}.bg-red-900\/40{background-color:#7f1d1d66}.fill-current{fill:currentColor}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pb-3{padding-bottom:.75rem}.pb-\[max\(0\.75rem\,env\(safe-area-inset-bottom\)\)\]{padding-bottom:max(.75rem,env(safe-area-inset-bottom))}.pl-11{padding-left:2.75rem}.pl-3{padding-left:.75rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-5xl{font-size:3rem;line-height:1}.text-\[11px\]{font-size:11px}.text-\[15px\]{font-size:15px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.tracking-wide{letter-spacing:.025em}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-ink{color:var(--ink)}.text-muted{color:var(--muted)}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.opacity-0{opacity:0}.opacity-100{opacity:1}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-purple-500\/50{--tw-ring-color: rgb(168 85 247 / .5)}.ring-purple-500\/60{--tw-ring-color: rgb(168 85 247 / .6)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.theme-dark{color-scheme:dark;--bg: #09090b;--panel: #131316;--field: #232327;--edge: #34343a;--ink: #fafafa;--muted: #a1a1aa}.theme-light{color-scheme:light;--bg: #f4f4f5;--panel: #ffffff;--field: #f0f0f2;--edge: #dcdce0;--ink: #18181b;--muted: #5b5b66}html,body,#root{height:100%}body{background:var(--bg);color:var(--ink);-webkit-tap-highlight-color:transparent}*{scrollbar-width:thin;scrollbar-color:var(--edge) transparent}.md{line-height:1.7;word-break:break-word}.md>*:first-child{margin-top:0}.md>*:last-child{margin-bottom:0}.md p,.md ul,.md ol,.md pre,.md blockquote,.md table{margin:.6em 0}.md h1,.md h2,.md h3,.md h4{font-weight:700;margin:1em 0 .5em;line-height:1.3}.md h1{font-size:1.35em}.md h2{font-size:1.2em}.md h3{font-size:1.08em}.md ul{list-style:disc;padding-left:1.4em}.md ol{list-style:decimal;padding-left:1.4em}.md li{margin:.2em 0}.md a{color:#a78bfa;text-decoration:underline;text-underline-offset:2px}.theme-light .md a{color:#7c3aed}.md code{background:var(--field);border:1px solid var(--edge);padding:.1em .35em;border-radius:4px;font-size:.88em}.md pre{background:var(--bg);border:1px solid var(--edge);padding:.8em 1em;border-radius:8px;overflow-x:auto}.md pre code{background:none;border:0;padding:0;font-size:.85em}.md blockquote{border-left:3px solid var(--edge);padding-left:.8em;color:var(--muted)}.md table{border-collapse:collapse;display:block;overflow-x:auto}.md th,.md td{border:1px solid var(--edge);padding:.35em .6em}.md th{background:var(--field)}.md hr{border-color:var(--edge);margin:1em 0}.cursor-blink:after{content:"▍";animation:blink 1s steps(2) infinite;margin-left:1px;color:var(--muted)}@keyframes blink{to{opacity:0}}.placeholder\:text-muted::-moz-placeholder{color:var(--muted)}.placeholder\:text-muted::placeholder{color:var(--muted)}.hover\:bg-edge:hover{background-color:var(--edge)}.hover\:bg-field:hover{background-color:var(--field)}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:text-ink:hover{color:var(--ink)}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.focus\:border-purple-500:focus{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media (min-width: 768px){.md\:static{position:static}.md\:flex{display:flex}.md\:inline-flex{display:inline-flex}.md\:hidden{display:none}.md\:w-\[330px\]{width:330px}.md\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\:px-6{padding-left:1.5rem;padding-right:1.5rem}.md\:opacity-0{opacity:0}.group:hover .md\:group-hover\:opacity-100{opacity:1}}
dist/index.html CHANGED
@@ -5,8 +5,8 @@
5
  <link rel="icon" type="image/svg+xml" href="./vite.svg" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
  <title>Agent Studio</title>
8
- <script type="module" crossorigin src="./assets/index-DhW9DyYw.js"></script>
9
- <link rel="stylesheet" crossorigin href="./assets/index-BNH0Jkfv.css">
10
  </head>
11
  <body>
12
  <div id="root"></div>
 
5
  <link rel="icon" type="image/svg+xml" href="./vite.svg" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
  <title>Agent Studio</title>
8
+ <script type="module" crossorigin src="./assets/index-COF6Yw5f.js"></script>
9
+ <link rel="stylesheet" crossorigin href="./assets/index-CnEw9R0T.css">
10
  </head>
11
  <body>
12
  <div id="root"></div>
package-lock.json ADDED
@@ -0,0 +1,2711 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "agent-studio",
3
+ "version": "0.1.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "agent-studio",
9
+ "version": "0.1.0",
10
+ "dependencies": {
11
+ "dompurify": "^3.5.0",
12
+ "lucide-react": "^0.441.0",
13
+ "marked": "^18.3.0",
14
+ "react": "^18.3.1",
15
+ "react-dom": "^18.3.1",
16
+ "zustand": "^4.5.5"
17
+ },
18
+ "devDependencies": {
19
+ "@vitejs/plugin-react": "^4.3.4",
20
+ "autoprefixer": "^10.4.20",
21
+ "postcss": "^8.4.47",
22
+ "tailwindcss": "^3.4.14",
23
+ "vite": "^5.4.8"
24
+ }
25
+ },
26
+ "node_modules/@alloc/quick-lru": {
27
+ "version": "5.3.0",
28
+ "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.3.0.tgz",
29
+ "integrity": "sha512-U4+70Pc5ZS9osnCBCE5Jha/ciHM+Yp+CNMNC/7HvYbNRk1Ldd+f7qO65W5qfhu/TCv+/ozljlXXe9Nj8419DMA==",
30
+ "dev": true,
31
+ "license": "MIT",
32
+ "engines": {
33
+ "node": ">=10"
34
+ },
35
+ "funding": {
36
+ "url": "https://github.com/sponsors/sindresorhus"
37
+ }
38
+ },
39
+ "node_modules/@babel/code-frame": {
40
+ "version": "7.29.7",
41
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz",
42
+ "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==",
43
+ "dev": true,
44
+ "license": "MIT",
45
+ "dependencies": {
46
+ "@babel/helper-validator-identifier": "^7.29.7",
47
+ "js-tokens": "^4.0.0",
48
+ "picocolors": "^1.1.1"
49
+ },
50
+ "engines": {
51
+ "node": ">=6.9.0"
52
+ }
53
+ },
54
+ "node_modules/@babel/compat-data": {
55
+ "version": "7.29.7",
56
+ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz",
57
+ "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==",
58
+ "dev": true,
59
+ "license": "MIT",
60
+ "engines": {
61
+ "node": ">=6.9.0"
62
+ }
63
+ },
64
+ "node_modules/@babel/core": {
65
+ "version": "7.29.7",
66
+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz",
67
+ "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
68
+ "dev": true,
69
+ "license": "MIT",
70
+ "dependencies": {
71
+ "@babel/code-frame": "^7.29.7",
72
+ "@babel/generator": "^7.29.7",
73
+ "@babel/helper-compilation-targets": "^7.29.7",
74
+ "@babel/helper-module-transforms": "^7.29.7",
75
+ "@babel/helpers": "^7.29.7",
76
+ "@babel/parser": "^7.29.7",
77
+ "@babel/template": "^7.29.7",
78
+ "@babel/traverse": "^7.29.7",
79
+ "@babel/types": "^7.29.7",
80
+ "@jridgewell/remapping": "^2.3.5",
81
+ "convert-source-map": "^2.0.0",
82
+ "debug": "^4.1.0",
83
+ "gensync": "^1.0.0-beta.2",
84
+ "json5": "^2.2.3",
85
+ "semver": "^6.3.1"
86
+ },
87
+ "engines": {
88
+ "node": ">=6.9.0"
89
+ },
90
+ "funding": {
91
+ "type": "opencollective",
92
+ "url": "https://opencollective.com/babel"
93
+ }
94
+ },
95
+ "node_modules/@babel/generator": {
96
+ "version": "7.29.8",
97
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.8.tgz",
98
+ "integrity": "sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==",
99
+ "dev": true,
100
+ "license": "MIT",
101
+ "dependencies": {
102
+ "@babel/parser": "^7.29.8",
103
+ "@babel/types": "^7.29.8",
104
+ "@jridgewell/gen-mapping": "^0.3.12",
105
+ "@jridgewell/trace-mapping": "^0.3.28",
106
+ "jsesc": "^3.0.2"
107
+ },
108
+ "engines": {
109
+ "node": ">=6.9.0"
110
+ }
111
+ },
112
+ "node_modules/@babel/helper-compilation-targets": {
113
+ "version": "7.29.7",
114
+ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz",
115
+ "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==",
116
+ "dev": true,
117
+ "license": "MIT",
118
+ "dependencies": {
119
+ "@babel/compat-data": "^7.29.7",
120
+ "@babel/helper-validator-option": "^7.29.7",
121
+ "browserslist": "^4.24.0",
122
+ "lru-cache": "^5.1.1",
123
+ "semver": "^6.3.1"
124
+ },
125
+ "engines": {
126
+ "node": ">=6.9.0"
127
+ }
128
+ },
129
+ "node_modules/@babel/helper-globals": {
130
+ "version": "7.29.7",
131
+ "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz",
132
+ "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==",
133
+ "dev": true,
134
+ "license": "MIT",
135
+ "engines": {
136
+ "node": ">=6.9.0"
137
+ }
138
+ },
139
+ "node_modules/@babel/helper-module-imports": {
140
+ "version": "7.29.7",
141
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz",
142
+ "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==",
143
+ "dev": true,
144
+ "license": "MIT",
145
+ "dependencies": {
146
+ "@babel/traverse": "^7.29.7",
147
+ "@babel/types": "^7.29.7"
148
+ },
149
+ "engines": {
150
+ "node": ">=6.9.0"
151
+ }
152
+ },
153
+ "node_modules/@babel/helper-module-transforms": {
154
+ "version": "7.29.7",
155
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz",
156
+ "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==",
157
+ "dev": true,
158
+ "license": "MIT",
159
+ "dependencies": {
160
+ "@babel/helper-module-imports": "^7.29.7",
161
+ "@babel/helper-validator-identifier": "^7.29.7",
162
+ "@babel/traverse": "^7.29.7"
163
+ },
164
+ "engines": {
165
+ "node": ">=6.9.0"
166
+ },
167
+ "peerDependencies": {
168
+ "@babel/core": "^7.0.0"
169
+ }
170
+ },
171
+ "node_modules/@babel/helper-plugin-utils": {
172
+ "version": "7.29.7",
173
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz",
174
+ "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==",
175
+ "dev": true,
176
+ "license": "MIT",
177
+ "engines": {
178
+ "node": ">=6.9.0"
179
+ }
180
+ },
181
+ "node_modules/@babel/helper-string-parser": {
182
+ "version": "7.29.7",
183
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz",
184
+ "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==",
185
+ "dev": true,
186
+ "license": "MIT",
187
+ "engines": {
188
+ "node": ">=6.9.0"
189
+ }
190
+ },
191
+ "node_modules/@babel/helper-validator-identifier": {
192
+ "version": "7.29.7",
193
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz",
194
+ "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==",
195
+ "dev": true,
196
+ "license": "MIT",
197
+ "engines": {
198
+ "node": ">=6.9.0"
199
+ }
200
+ },
201
+ "node_modules/@babel/helper-validator-option": {
202
+ "version": "7.29.7",
203
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz",
204
+ "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==",
205
+ "dev": true,
206
+ "license": "MIT",
207
+ "engines": {
208
+ "node": ">=6.9.0"
209
+ }
210
+ },
211
+ "node_modules/@babel/helpers": {
212
+ "version": "7.29.10",
213
+ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.10.tgz",
214
+ "integrity": "sha512-EMCx3AGZ3WfAl6ht7AyQoPm2Lh+BGYEMdc4Q6Hf7uSCDOZFuLq44qNwL+iaim8VlyYhRAo4X43+weadK8ZB4Yg==",
215
+ "dev": true,
216
+ "license": "MIT",
217
+ "dependencies": {
218
+ "@babel/template": "^7.29.7",
219
+ "@babel/types": "^7.29.8"
220
+ },
221
+ "engines": {
222
+ "node": ">=6.9.0"
223
+ }
224
+ },
225
+ "node_modules/@babel/parser": {
226
+ "version": "7.29.9",
227
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.9.tgz",
228
+ "integrity": "sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==",
229
+ "dev": true,
230
+ "license": "MIT",
231
+ "dependencies": {
232
+ "@babel/types": "^7.29.8"
233
+ },
234
+ "bin": {
235
+ "parser": "bin/babel-parser.js"
236
+ },
237
+ "engines": {
238
+ "node": ">=6.0.0"
239
+ }
240
+ },
241
+ "node_modules/@babel/plugin-transform-react-jsx-self": {
242
+ "version": "7.29.7",
243
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz",
244
+ "integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==",
245
+ "dev": true,
246
+ "license": "MIT",
247
+ "dependencies": {
248
+ "@babel/helper-plugin-utils": "^7.29.7"
249
+ },
250
+ "engines": {
251
+ "node": ">=6.9.0"
252
+ },
253
+ "peerDependencies": {
254
+ "@babel/core": "^7.0.0-0"
255
+ }
256
+ },
257
+ "node_modules/@babel/plugin-transform-react-jsx-source": {
258
+ "version": "7.29.7",
259
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz",
260
+ "integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==",
261
+ "dev": true,
262
+ "license": "MIT",
263
+ "dependencies": {
264
+ "@babel/helper-plugin-utils": "^7.29.7"
265
+ },
266
+ "engines": {
267
+ "node": ">=6.9.0"
268
+ },
269
+ "peerDependencies": {
270
+ "@babel/core": "^7.0.0-0"
271
+ }
272
+ },
273
+ "node_modules/@babel/template": {
274
+ "version": "7.29.7",
275
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz",
276
+ "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==",
277
+ "dev": true,
278
+ "license": "MIT",
279
+ "dependencies": {
280
+ "@babel/code-frame": "^7.29.7",
281
+ "@babel/parser": "^7.29.7",
282
+ "@babel/types": "^7.29.7"
283
+ },
284
+ "engines": {
285
+ "node": ">=6.9.0"
286
+ }
287
+ },
288
+ "node_modules/@babel/traverse": {
289
+ "version": "7.29.10",
290
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.10.tgz",
291
+ "integrity": "sha512-B3lYAs2nkKskbgQ1nfy8Ma9ao9Q1rntTAQHrzzyDuj+TSO+X3le6PfWwqDvodsb+OumE10eMFfuMCTQSQ5iuIQ==",
292
+ "dev": true,
293
+ "license": "MIT",
294
+ "dependencies": {
295
+ "@babel/code-frame": "^7.29.7",
296
+ "@babel/generator": "^7.29.8",
297
+ "@babel/helper-globals": "^7.29.7",
298
+ "@babel/parser": "^7.29.9",
299
+ "@babel/template": "^7.29.7",
300
+ "@babel/types": "^7.29.8",
301
+ "debug": "^4.3.1"
302
+ },
303
+ "engines": {
304
+ "node": ">=6.9.0"
305
+ }
306
+ },
307
+ "node_modules/@babel/types": {
308
+ "version": "7.29.8",
309
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz",
310
+ "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==",
311
+ "dev": true,
312
+ "license": "MIT",
313
+ "dependencies": {
314
+ "@babel/helper-string-parser": "^7.29.7",
315
+ "@babel/helper-validator-identifier": "^7.29.7"
316
+ },
317
+ "engines": {
318
+ "node": ">=6.9.0"
319
+ }
320
+ },
321
+ "node_modules/@esbuild/aix-ppc64": {
322
+ "version": "0.21.5",
323
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz",
324
+ "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==",
325
+ "cpu": [
326
+ "ppc64"
327
+ ],
328
+ "dev": true,
329
+ "license": "MIT",
330
+ "optional": true,
331
+ "os": [
332
+ "aix"
333
+ ],
334
+ "engines": {
335
+ "node": ">=12"
336
+ }
337
+ },
338
+ "node_modules/@esbuild/android-arm": {
339
+ "version": "0.21.5",
340
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz",
341
+ "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==",
342
+ "cpu": [
343
+ "arm"
344
+ ],
345
+ "dev": true,
346
+ "license": "MIT",
347
+ "optional": true,
348
+ "os": [
349
+ "android"
350
+ ],
351
+ "engines": {
352
+ "node": ">=12"
353
+ }
354
+ },
355
+ "node_modules/@esbuild/android-arm64": {
356
+ "version": "0.21.5",
357
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz",
358
+ "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==",
359
+ "cpu": [
360
+ "arm64"
361
+ ],
362
+ "dev": true,
363
+ "license": "MIT",
364
+ "optional": true,
365
+ "os": [
366
+ "android"
367
+ ],
368
+ "engines": {
369
+ "node": ">=12"
370
+ }
371
+ },
372
+ "node_modules/@esbuild/android-x64": {
373
+ "version": "0.21.5",
374
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz",
375
+ "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==",
376
+ "cpu": [
377
+ "x64"
378
+ ],
379
+ "dev": true,
380
+ "license": "MIT",
381
+ "optional": true,
382
+ "os": [
383
+ "android"
384
+ ],
385
+ "engines": {
386
+ "node": ">=12"
387
+ }
388
+ },
389
+ "node_modules/@esbuild/darwin-arm64": {
390
+ "version": "0.21.5",
391
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz",
392
+ "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==",
393
+ "cpu": [
394
+ "arm64"
395
+ ],
396
+ "dev": true,
397
+ "license": "MIT",
398
+ "optional": true,
399
+ "os": [
400
+ "darwin"
401
+ ],
402
+ "engines": {
403
+ "node": ">=12"
404
+ }
405
+ },
406
+ "node_modules/@esbuild/darwin-x64": {
407
+ "version": "0.21.5",
408
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz",
409
+ "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==",
410
+ "cpu": [
411
+ "x64"
412
+ ],
413
+ "dev": true,
414
+ "license": "MIT",
415
+ "optional": true,
416
+ "os": [
417
+ "darwin"
418
+ ],
419
+ "engines": {
420
+ "node": ">=12"
421
+ }
422
+ },
423
+ "node_modules/@esbuild/freebsd-arm64": {
424
+ "version": "0.21.5",
425
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz",
426
+ "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==",
427
+ "cpu": [
428
+ "arm64"
429
+ ],
430
+ "dev": true,
431
+ "license": "MIT",
432
+ "optional": true,
433
+ "os": [
434
+ "freebsd"
435
+ ],
436
+ "engines": {
437
+ "node": ">=12"
438
+ }
439
+ },
440
+ "node_modules/@esbuild/freebsd-x64": {
441
+ "version": "0.21.5",
442
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz",
443
+ "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==",
444
+ "cpu": [
445
+ "x64"
446
+ ],
447
+ "dev": true,
448
+ "license": "MIT",
449
+ "optional": true,
450
+ "os": [
451
+ "freebsd"
452
+ ],
453
+ "engines": {
454
+ "node": ">=12"
455
+ }
456
+ },
457
+ "node_modules/@esbuild/linux-arm": {
458
+ "version": "0.21.5",
459
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz",
460
+ "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==",
461
+ "cpu": [
462
+ "arm"
463
+ ],
464
+ "dev": true,
465
+ "license": "MIT",
466
+ "optional": true,
467
+ "os": [
468
+ "linux"
469
+ ],
470
+ "engines": {
471
+ "node": ">=12"
472
+ }
473
+ },
474
+ "node_modules/@esbuild/linux-arm64": {
475
+ "version": "0.21.5",
476
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz",
477
+ "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==",
478
+ "cpu": [
479
+ "arm64"
480
+ ],
481
+ "dev": true,
482
+ "license": "MIT",
483
+ "optional": true,
484
+ "os": [
485
+ "linux"
486
+ ],
487
+ "engines": {
488
+ "node": ">=12"
489
+ }
490
+ },
491
+ "node_modules/@esbuild/linux-ia32": {
492
+ "version": "0.21.5",
493
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz",
494
+ "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==",
495
+ "cpu": [
496
+ "ia32"
497
+ ],
498
+ "dev": true,
499
+ "license": "MIT",
500
+ "optional": true,
501
+ "os": [
502
+ "linux"
503
+ ],
504
+ "engines": {
505
+ "node": ">=12"
506
+ }
507
+ },
508
+ "node_modules/@esbuild/linux-loong64": {
509
+ "version": "0.21.5",
510
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz",
511
+ "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==",
512
+ "cpu": [
513
+ "loong64"
514
+ ],
515
+ "dev": true,
516
+ "license": "MIT",
517
+ "optional": true,
518
+ "os": [
519
+ "linux"
520
+ ],
521
+ "engines": {
522
+ "node": ">=12"
523
+ }
524
+ },
525
+ "node_modules/@esbuild/linux-mips64el": {
526
+ "version": "0.21.5",
527
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz",
528
+ "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==",
529
+ "cpu": [
530
+ "mips64el"
531
+ ],
532
+ "dev": true,
533
+ "license": "MIT",
534
+ "optional": true,
535
+ "os": [
536
+ "linux"
537
+ ],
538
+ "engines": {
539
+ "node": ">=12"
540
+ }
541
+ },
542
+ "node_modules/@esbuild/linux-ppc64": {
543
+ "version": "0.21.5",
544
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz",
545
+ "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==",
546
+ "cpu": [
547
+ "ppc64"
548
+ ],
549
+ "dev": true,
550
+ "license": "MIT",
551
+ "optional": true,
552
+ "os": [
553
+ "linux"
554
+ ],
555
+ "engines": {
556
+ "node": ">=12"
557
+ }
558
+ },
559
+ "node_modules/@esbuild/linux-riscv64": {
560
+ "version": "0.21.5",
561
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz",
562
+ "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==",
563
+ "cpu": [
564
+ "riscv64"
565
+ ],
566
+ "dev": true,
567
+ "license": "MIT",
568
+ "optional": true,
569
+ "os": [
570
+ "linux"
571
+ ],
572
+ "engines": {
573
+ "node": ">=12"
574
+ }
575
+ },
576
+ "node_modules/@esbuild/linux-s390x": {
577
+ "version": "0.21.5",
578
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz",
579
+ "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==",
580
+ "cpu": [
581
+ "s390x"
582
+ ],
583
+ "dev": true,
584
+ "license": "MIT",
585
+ "optional": true,
586
+ "os": [
587
+ "linux"
588
+ ],
589
+ "engines": {
590
+ "node": ">=12"
591
+ }
592
+ },
593
+ "node_modules/@esbuild/linux-x64": {
594
+ "version": "0.21.5",
595
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz",
596
+ "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==",
597
+ "cpu": [
598
+ "x64"
599
+ ],
600
+ "dev": true,
601
+ "license": "MIT",
602
+ "optional": true,
603
+ "os": [
604
+ "linux"
605
+ ],
606
+ "engines": {
607
+ "node": ">=12"
608
+ }
609
+ },
610
+ "node_modules/@esbuild/netbsd-x64": {
611
+ "version": "0.21.5",
612
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz",
613
+ "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==",
614
+ "cpu": [
615
+ "x64"
616
+ ],
617
+ "dev": true,
618
+ "license": "MIT",
619
+ "optional": true,
620
+ "os": [
621
+ "netbsd"
622
+ ],
623
+ "engines": {
624
+ "node": ">=12"
625
+ }
626
+ },
627
+ "node_modules/@esbuild/openbsd-x64": {
628
+ "version": "0.21.5",
629
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz",
630
+ "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==",
631
+ "cpu": [
632
+ "x64"
633
+ ],
634
+ "dev": true,
635
+ "license": "MIT",
636
+ "optional": true,
637
+ "os": [
638
+ "openbsd"
639
+ ],
640
+ "engines": {
641
+ "node": ">=12"
642
+ }
643
+ },
644
+ "node_modules/@esbuild/sunos-x64": {
645
+ "version": "0.21.5",
646
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz",
647
+ "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==",
648
+ "cpu": [
649
+ "x64"
650
+ ],
651
+ "dev": true,
652
+ "license": "MIT",
653
+ "optional": true,
654
+ "os": [
655
+ "sunos"
656
+ ],
657
+ "engines": {
658
+ "node": ">=12"
659
+ }
660
+ },
661
+ "node_modules/@esbuild/win32-arm64": {
662
+ "version": "0.21.5",
663
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz",
664
+ "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==",
665
+ "cpu": [
666
+ "arm64"
667
+ ],
668
+ "dev": true,
669
+ "license": "MIT",
670
+ "optional": true,
671
+ "os": [
672
+ "win32"
673
+ ],
674
+ "engines": {
675
+ "node": ">=12"
676
+ }
677
+ },
678
+ "node_modules/@esbuild/win32-ia32": {
679
+ "version": "0.21.5",
680
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz",
681
+ "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==",
682
+ "cpu": [
683
+ "ia32"
684
+ ],
685
+ "dev": true,
686
+ "license": "MIT",
687
+ "optional": true,
688
+ "os": [
689
+ "win32"
690
+ ],
691
+ "engines": {
692
+ "node": ">=12"
693
+ }
694
+ },
695
+ "node_modules/@esbuild/win32-x64": {
696
+ "version": "0.21.5",
697
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz",
698
+ "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==",
699
+ "cpu": [
700
+ "x64"
701
+ ],
702
+ "dev": true,
703
+ "license": "MIT",
704
+ "optional": true,
705
+ "os": [
706
+ "win32"
707
+ ],
708
+ "engines": {
709
+ "node": ">=12"
710
+ }
711
+ },
712
+ "node_modules/@jridgewell/gen-mapping": {
713
+ "version": "0.3.13",
714
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
715
+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
716
+ "dev": true,
717
+ "license": "MIT",
718
+ "dependencies": {
719
+ "@jridgewell/sourcemap-codec": "^1.5.0",
720
+ "@jridgewell/trace-mapping": "^0.3.24"
721
+ }
722
+ },
723
+ "node_modules/@jridgewell/remapping": {
724
+ "version": "2.3.5",
725
+ "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz",
726
+ "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==",
727
+ "dev": true,
728
+ "license": "MIT",
729
+ "dependencies": {
730
+ "@jridgewell/gen-mapping": "^0.3.5",
731
+ "@jridgewell/trace-mapping": "^0.3.24"
732
+ }
733
+ },
734
+ "node_modules/@jridgewell/resolve-uri": {
735
+ "version": "3.1.2",
736
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
737
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
738
+ "dev": true,
739
+ "license": "MIT",
740
+ "engines": {
741
+ "node": ">=6.0.0"
742
+ }
743
+ },
744
+ "node_modules/@jridgewell/sourcemap-codec": {
745
+ "version": "1.6.0",
746
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz",
747
+ "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==",
748
+ "dev": true,
749
+ "license": "MIT"
750
+ },
751
+ "node_modules/@jridgewell/trace-mapping": {
752
+ "version": "0.3.31",
753
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
754
+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
755
+ "dev": true,
756
+ "license": "MIT",
757
+ "dependencies": {
758
+ "@jridgewell/resolve-uri": "^3.1.0",
759
+ "@jridgewell/sourcemap-codec": "^1.4.14"
760
+ }
761
+ },
762
+ "node_modules/@napi-rs/lzma-linux-x64-gnu": {
763
+ "version": "1.5.1",
764
+ "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz",
765
+ "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==",
766
+ "cpu": [
767
+ "x64"
768
+ ],
769
+ "dev": true,
770
+ "license": "MIT",
771
+ "optional": true,
772
+ "os": [
773
+ "linux"
774
+ ],
775
+ "engines": {
776
+ "node": "^22.20 || ^24.12 || >=25"
777
+ }
778
+ },
779
+ "node_modules/@nodelib/fs.scandir": {
780
+ "version": "2.1.5",
781
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
782
+ "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
783
+ "dev": true,
784
+ "license": "MIT",
785
+ "dependencies": {
786
+ "@nodelib/fs.stat": "2.0.5",
787
+ "run-parallel": "^1.1.9"
788
+ },
789
+ "engines": {
790
+ "node": ">= 8"
791
+ }
792
+ },
793
+ "node_modules/@nodelib/fs.stat": {
794
+ "version": "2.0.5",
795
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
796
+ "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
797
+ "dev": true,
798
+ "license": "MIT",
799
+ "engines": {
800
+ "node": ">= 8"
801
+ }
802
+ },
803
+ "node_modules/@nodelib/fs.walk": {
804
+ "version": "1.2.8",
805
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
806
+ "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
807
+ "dev": true,
808
+ "license": "MIT",
809
+ "dependencies": {
810
+ "@nodelib/fs.scandir": "2.1.5",
811
+ "fastq": "^1.6.0"
812
+ },
813
+ "engines": {
814
+ "node": ">= 8"
815
+ }
816
+ },
817
+ "node_modules/@rolldown/pluginutils": {
818
+ "version": "1.0.0-beta.27",
819
+ "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz",
820
+ "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==",
821
+ "dev": true,
822
+ "license": "MIT"
823
+ },
824
+ "node_modules/@rollup/rollup-android-arm-eabi": {
825
+ "version": "4.64.5",
826
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.64.5.tgz",
827
+ "integrity": "sha512-MrfgRQSpD5hkkRg6XI16B6EDLb+6+xp8xje6bpdSwkYw+qxrBKbUVrRAQu9h82UT+QumSIVQ8HXsXjPd2dlhqw==",
828
+ "cpu": [
829
+ "arm"
830
+ ],
831
+ "dev": true,
832
+ "license": "MIT",
833
+ "optional": true,
834
+ "os": [
835
+ "android"
836
+ ]
837
+ },
838
+ "node_modules/@rollup/rollup-android-arm64": {
839
+ "version": "4.64.5",
840
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.64.5.tgz",
841
+ "integrity": "sha512-+uu2p/R9Tzn8GpoQyX1pAo5dmKT1DhXevfaCzqzmPFhnLjHLWw7uWkaVGlxmhwYoRiYYhsGfRcD5cTBpL7rgSw==",
842
+ "cpu": [
843
+ "arm64"
844
+ ],
845
+ "dev": true,
846
+ "license": "MIT",
847
+ "optional": true,
848
+ "os": [
849
+ "android"
850
+ ]
851
+ },
852
+ "node_modules/@rollup/rollup-darwin-arm64": {
853
+ "version": "4.64.5",
854
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.64.5.tgz",
855
+ "integrity": "sha512-17dys+YEmzwzzFVHQAVDONg5FALXY9kd99HFEpfk4gJVHYxoh5bGea3D4t1fXXnwkTcOe25wPyd6nWS0I8IdLQ==",
856
+ "cpu": [
857
+ "arm64"
858
+ ],
859
+ "dev": true,
860
+ "license": "MIT",
861
+ "optional": true,
862
+ "os": [
863
+ "darwin"
864
+ ]
865
+ },
866
+ "node_modules/@rollup/rollup-darwin-x64": {
867
+ "version": "4.64.5",
868
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.64.5.tgz",
869
+ "integrity": "sha512-wg0zQEKkEvFZf1UaaX1UELOoPs//OSKUG7D+yITuqOsAvza7LvHTv5Wu4nmMfzNG7EYI2jp2PJC7Id6OETmsYQ==",
870
+ "cpu": [
871
+ "x64"
872
+ ],
873
+ "dev": true,
874
+ "license": "MIT",
875
+ "optional": true,
876
+ "os": [
877
+ "darwin"
878
+ ]
879
+ },
880
+ "node_modules/@rollup/rollup-freebsd-arm64": {
881
+ "version": "4.64.5",
882
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.64.5.tgz",
883
+ "integrity": "sha512-CoJmWcpEMuwin+TZ/ev/H9uDyF/uxUKQSWXdmIPn/UBx/uGV9+4ebMp0FwnlhWR9PE1AdzYsKf3bZevhif38+A==",
884
+ "cpu": [
885
+ "arm64"
886
+ ],
887
+ "dev": true,
888
+ "license": "MIT",
889
+ "optional": true,
890
+ "os": [
891
+ "freebsd"
892
+ ]
893
+ },
894
+ "node_modules/@rollup/rollup-freebsd-x64": {
895
+ "version": "4.64.5",
896
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.64.5.tgz",
897
+ "integrity": "sha512-PxZnLAaTUAL5xG0W2BXLeYPKrK2b3LIASV2/e/Kf7PZvSLI1iAQIm9B9aJD+YyFIT7hc6qaMV3+OOO35R28LfA==",
898
+ "cpu": [
899
+ "x64"
900
+ ],
901
+ "dev": true,
902
+ "license": "MIT",
903
+ "optional": true,
904
+ "os": [
905
+ "freebsd"
906
+ ]
907
+ },
908
+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
909
+ "version": "4.64.5",
910
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.64.5.tgz",
911
+ "integrity": "sha512-uPo3IvnONjhbFXwWgroBeFwOicuhT7ZwQrnzkzmOtBJzeQbkUJUE1SJDfDI31ijQ5+ZUIA6sPrdUMxTSnxUWAg==",
912
+ "cpu": [
913
+ "arm"
914
+ ],
915
+ "dev": true,
916
+ "license": "MIT",
917
+ "optional": true,
918
+ "os": [
919
+ "linux"
920
+ ]
921
+ },
922
+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {
923
+ "version": "4.64.5",
924
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.64.5.tgz",
925
+ "integrity": "sha512-ywI8Jyuc4LyHYTjC0mw4yA1ulvZBkHusdpWnoiEBsmBuHvSnt90btTBGCZ+s/2y+YNNfVAEKy33nPo5UI9zTmg==",
926
+ "cpu": [
927
+ "arm"
928
+ ],
929
+ "dev": true,
930
+ "license": "MIT",
931
+ "optional": true,
932
+ "os": [
933
+ "linux"
934
+ ]
935
+ },
936
+ "node_modules/@rollup/rollup-linux-arm64-gnu": {
937
+ "version": "4.64.5",
938
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.64.5.tgz",
939
+ "integrity": "sha512-tmuXJoQ/3ovSr637aykZMdQteU/CB2APAz2CrvsbibuoHZi1BS1Db13cVViBdEARGwXCLn1DSJ8wsjoThLJPGA==",
940
+ "cpu": [
941
+ "arm64"
942
+ ],
943
+ "dev": true,
944
+ "license": "MIT",
945
+ "optional": true,
946
+ "os": [
947
+ "linux"
948
+ ]
949
+ },
950
+ "node_modules/@rollup/rollup-linux-arm64-musl": {
951
+ "version": "4.64.5",
952
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.64.5.tgz",
953
+ "integrity": "sha512-5FMjSYNcUOHx7oW8Qu9KB6jGPpvF/8sG7+BDHwU/Ihh1/6FMJ9ySmsFG4tJ1qbNRuP8OLzCBDso4sF0mQaLuFQ==",
954
+ "cpu": [
955
+ "arm64"
956
+ ],
957
+ "dev": true,
958
+ "license": "MIT",
959
+ "optional": true,
960
+ "os": [
961
+ "linux"
962
+ ]
963
+ },
964
+ "node_modules/@rollup/rollup-linux-loong64-gnu": {
965
+ "version": "4.64.5",
966
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.64.5.tgz",
967
+ "integrity": "sha512-K8ZJ+neLDbUkIrL8dqF/5LtuVCrKwo27kREgOlxjBEjlOXwHvDnHLU8Z/UKv/B49qi7e8hsSDOyoJwhwqhvX4w==",
968
+ "cpu": [
969
+ "loong64"
970
+ ],
971
+ "dev": true,
972
+ "license": "MIT",
973
+ "optional": true,
974
+ "os": [
975
+ "linux"
976
+ ]
977
+ },
978
+ "node_modules/@rollup/rollup-linux-loong64-musl": {
979
+ "version": "4.64.5",
980
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.64.5.tgz",
981
+ "integrity": "sha512-NlVxsq7PFPv0DBKGuNWRDKixQYQCjM53zl04mxEcKMBmJbCBIUm1JdPfIWDRHyOOFzzYPmLQzfeEwh4716ayQg==",
982
+ "cpu": [
983
+ "loong64"
984
+ ],
985
+ "dev": true,
986
+ "license": "MIT",
987
+ "optional": true,
988
+ "os": [
989
+ "linux"
990
+ ]
991
+ },
992
+ "node_modules/@rollup/rollup-linux-ppc64-gnu": {
993
+ "version": "4.64.5",
994
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.64.5.tgz",
995
+ "integrity": "sha512-ARhRHJYs5eCFet5azfrHD97vOkD8OzNW2RSMlvo5CcBqXaTOLfp0OHDtUQh7/K5AL5fUYoFp2fgC9KDg4vVYMQ==",
996
+ "cpu": [
997
+ "ppc64"
998
+ ],
999
+ "dev": true,
1000
+ "license": "MIT",
1001
+ "optional": true,
1002
+ "os": [
1003
+ "linux"
1004
+ ]
1005
+ },
1006
+ "node_modules/@rollup/rollup-linux-ppc64-musl": {
1007
+ "version": "4.64.5",
1008
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.64.5.tgz",
1009
+ "integrity": "sha512-atSgreM5C7jpxd9aEXN+6vJ5wTd05iYw+S3FiQpw7VsoEl8B90llbq35ARON+GOHj5QlVQEq2vOKWCHTob/BSQ==",
1010
+ "cpu": [
1011
+ "ppc64"
1012
+ ],
1013
+ "dev": true,
1014
+ "license": "MIT",
1015
+ "optional": true,
1016
+ "os": [
1017
+ "linux"
1018
+ ]
1019
+ },
1020
+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {
1021
+ "version": "4.64.5",
1022
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.64.5.tgz",
1023
+ "integrity": "sha512-vmlmwBFGnjVWxSRoVabNkyYuscSmg52Pd0fM8jEbNT3Jmka4A6HcB84x4uAmuumznWfBVaxKOqU6jbEgomWKCA==",
1024
+ "cpu": [
1025
+ "riscv64"
1026
+ ],
1027
+ "dev": true,
1028
+ "license": "MIT",
1029
+ "optional": true,
1030
+ "os": [
1031
+ "linux"
1032
+ ]
1033
+ },
1034
+ "node_modules/@rollup/rollup-linux-riscv64-musl": {
1035
+ "version": "4.64.5",
1036
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.64.5.tgz",
1037
+ "integrity": "sha512-hhJrP6S9WkbsbcHgUkvCBS5Cn8IdsG8XjlLZyxjnv9+NdoYfbbZE4TWJYr8apdaj1M5t5Y1id2StnEslxpNFyA==",
1038
+ "cpu": [
1039
+ "riscv64"
1040
+ ],
1041
+ "dev": true,
1042
+ "license": "MIT",
1043
+ "optional": true,
1044
+ "os": [
1045
+ "linux"
1046
+ ]
1047
+ },
1048
+ "node_modules/@rollup/rollup-linux-s390x-gnu": {
1049
+ "version": "4.64.5",
1050
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.64.5.tgz",
1051
+ "integrity": "sha512-NNVCyN9pGrwFmQa4bf+Cnf5aVH3g6ZpnlOg1Cs/H9swIHT9bRixijfzUqyEIWm1WtiAuR1LJ+rJH6zpBm8kgQA==",
1052
+ "cpu": [
1053
+ "s390x"
1054
+ ],
1055
+ "dev": true,
1056
+ "license": "MIT",
1057
+ "optional": true,
1058
+ "os": [
1059
+ "linux"
1060
+ ]
1061
+ },
1062
+ "node_modules/@rollup/rollup-linux-x64-gnu": {
1063
+ "version": "4.64.5",
1064
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.64.5.tgz",
1065
+ "integrity": "sha512-dR9nd6OKnvSS60Ifz/L7Mj5zzYyoqyRn2NwTuaOONKaa3xsVGXyp8YusMbvFyEOR94DxnwgcbgsFqkHd29ZSzQ==",
1066
+ "cpu": [
1067
+ "x64"
1068
+ ],
1069
+ "dev": true,
1070
+ "license": "MIT",
1071
+ "optional": true,
1072
+ "os": [
1073
+ "linux"
1074
+ ]
1075
+ },
1076
+ "node_modules/@rollup/rollup-linux-x64-musl": {
1077
+ "version": "4.64.5",
1078
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.64.5.tgz",
1079
+ "integrity": "sha512-1tzsMjaqhsh3bAO6SJiJqh8hIr9sSPRd+i2vPPxJHod8/XYnf9TEnK0z/u3r1z1AkI347X0KbRSg9dWcxeGahw==",
1080
+ "cpu": [
1081
+ "x64"
1082
+ ],
1083
+ "dev": true,
1084
+ "license": "MIT",
1085
+ "optional": true,
1086
+ "os": [
1087
+ "linux"
1088
+ ]
1089
+ },
1090
+ "node_modules/@rollup/rollup-openbsd-x64": {
1091
+ "version": "4.64.5",
1092
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.64.5.tgz",
1093
+ "integrity": "sha512-01mWMQblKoXXsmk28KXtpbA96w7g/aOWUoV3AC16fdHdqkykGalqyyM+5u8M7uP5/MEMiiPv69Hv7iv/hEH/dA==",
1094
+ "cpu": [
1095
+ "x64"
1096
+ ],
1097
+ "dev": true,
1098
+ "license": "MIT",
1099
+ "optional": true,
1100
+ "os": [
1101
+ "openbsd"
1102
+ ]
1103
+ },
1104
+ "node_modules/@rollup/rollup-openharmony-arm64": {
1105
+ "version": "4.64.5",
1106
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.64.5.tgz",
1107
+ "integrity": "sha512-trdnMPb/DNm4V/CgsaoGgr90HfQQ071wfK0KoIs4YpLvjBgVQGXhGabg2Z6nK4EcYNilrb9ZZPcsP6+zpJIdxQ==",
1108
+ "cpu": [
1109
+ "arm64"
1110
+ ],
1111
+ "dev": true,
1112
+ "license": "MIT",
1113
+ "optional": true,
1114
+ "os": [
1115
+ "openharmony"
1116
+ ]
1117
+ },
1118
+ "node_modules/@rollup/rollup-win32-arm64-msvc": {
1119
+ "version": "4.64.5",
1120
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.64.5.tgz",
1121
+ "integrity": "sha512-x2LxZlfdfsw99T6/qb9EqE/Qi84JWzibjyOJyhJsgFJy6CafaTiqIXCCnslCGrV5XWNh7fwrS3FbRENcuKnooA==",
1122
+ "cpu": [
1123
+ "arm64"
1124
+ ],
1125
+ "dev": true,
1126
+ "license": "MIT",
1127
+ "optional": true,
1128
+ "os": [
1129
+ "win32"
1130
+ ]
1131
+ },
1132
+ "node_modules/@rollup/rollup-win32-ia32-msvc": {
1133
+ "version": "4.64.5",
1134
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.64.5.tgz",
1135
+ "integrity": "sha512-/Qd/9aDQIo0+jmItgBmPIs8195YVbDxRRApn47GyufgbutCDOh7eP5vSKKlI4QNFeaI+wKQAkSMsPnF3EuMpaA==",
1136
+ "cpu": [
1137
+ "ia32"
1138
+ ],
1139
+ "dev": true,
1140
+ "license": "MIT",
1141
+ "optional": true,
1142
+ "os": [
1143
+ "win32"
1144
+ ]
1145
+ },
1146
+ "node_modules/@rollup/rollup-win32-x64-gnu": {
1147
+ "version": "4.64.5",
1148
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.64.5.tgz",
1149
+ "integrity": "sha512-ngUJ/XvOWrqbd2IMsfXfh2xXFLTP3sY7sCKvxbGvYdBZ1KmXFd3ewDZ9n3/GNzAUgzRuhLT/UvJRivbNoAQRBw==",
1150
+ "cpu": [
1151
+ "x64"
1152
+ ],
1153
+ "dev": true,
1154
+ "license": "MIT",
1155
+ "optional": true,
1156
+ "os": [
1157
+ "win32"
1158
+ ]
1159
+ },
1160
+ "node_modules/@rollup/rollup-win32-x64-msvc": {
1161
+ "version": "4.64.5",
1162
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.64.5.tgz",
1163
+ "integrity": "sha512-IhV6ew/DuzUWwHaYmlh7MrPCV3lKFUq/amTEwysi4r/mwNPAEfAMh5dYWeTSPTeMy2pFHGMEWYtPkHzfX3tG5A==",
1164
+ "cpu": [
1165
+ "x64"
1166
+ ],
1167
+ "dev": true,
1168
+ "license": "MIT",
1169
+ "optional": true,
1170
+ "os": [
1171
+ "win32"
1172
+ ]
1173
+ },
1174
+ "node_modules/@types/babel__core": {
1175
+ "version": "7.20.5",
1176
+ "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
1177
+ "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==",
1178
+ "dev": true,
1179
+ "license": "MIT",
1180
+ "dependencies": {
1181
+ "@babel/parser": "^7.20.7",
1182
+ "@babel/types": "^7.20.7",
1183
+ "@types/babel__generator": "*",
1184
+ "@types/babel__template": "*",
1185
+ "@types/babel__traverse": "*"
1186
+ }
1187
+ },
1188
+ "node_modules/@types/babel__generator": {
1189
+ "version": "7.27.0",
1190
+ "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz",
1191
+ "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==",
1192
+ "dev": true,
1193
+ "license": "MIT",
1194
+ "dependencies": {
1195
+ "@babel/types": "^7.0.0"
1196
+ }
1197
+ },
1198
+ "node_modules/@types/babel__template": {
1199
+ "version": "7.4.4",
1200
+ "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz",
1201
+ "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==",
1202
+ "dev": true,
1203
+ "license": "MIT",
1204
+ "dependencies": {
1205
+ "@babel/parser": "^7.1.0",
1206
+ "@babel/types": "^7.0.0"
1207
+ }
1208
+ },
1209
+ "node_modules/@types/babel__traverse": {
1210
+ "version": "7.28.0",
1211
+ "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz",
1212
+ "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==",
1213
+ "dev": true,
1214
+ "license": "MIT",
1215
+ "dependencies": {
1216
+ "@babel/types": "^7.28.2"
1217
+ }
1218
+ },
1219
+ "node_modules/@types/estree": {
1220
+ "version": "1.0.9",
1221
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",
1222
+ "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",
1223
+ "dev": true,
1224
+ "license": "MIT"
1225
+ },
1226
+ "node_modules/@types/trusted-types": {
1227
+ "version": "2.0.7",
1228
+ "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
1229
+ "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
1230
+ "license": "MIT",
1231
+ "optional": true
1232
+ },
1233
+ "node_modules/@vitejs/plugin-react": {
1234
+ "version": "4.7.0",
1235
+ "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz",
1236
+ "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==",
1237
+ "dev": true,
1238
+ "license": "MIT",
1239
+ "dependencies": {
1240
+ "@babel/core": "^7.28.0",
1241
+ "@babel/plugin-transform-react-jsx-self": "^7.27.1",
1242
+ "@babel/plugin-transform-react-jsx-source": "^7.27.1",
1243
+ "@rolldown/pluginutils": "1.0.0-beta.27",
1244
+ "@types/babel__core": "^7.20.5",
1245
+ "react-refresh": "^0.17.0"
1246
+ },
1247
+ "engines": {
1248
+ "node": "^14.18.0 || >=16.0.0"
1249
+ },
1250
+ "peerDependencies": {
1251
+ "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
1252
+ }
1253
+ },
1254
+ "node_modules/any-promise": {
1255
+ "version": "1.3.0",
1256
+ "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
1257
+ "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==",
1258
+ "dev": true,
1259
+ "license": "MIT"
1260
+ },
1261
+ "node_modules/anymatch": {
1262
+ "version": "3.1.3",
1263
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
1264
+ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
1265
+ "dev": true,
1266
+ "license": "ISC",
1267
+ "dependencies": {
1268
+ "normalize-path": "^3.0.0",
1269
+ "picomatch": "^2.0.4"
1270
+ },
1271
+ "engines": {
1272
+ "node": ">= 8"
1273
+ }
1274
+ },
1275
+ "node_modules/arg": {
1276
+ "version": "5.0.2",
1277
+ "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz",
1278
+ "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==",
1279
+ "dev": true,
1280
+ "license": "MIT"
1281
+ },
1282
+ "node_modules/autoprefixer": {
1283
+ "version": "10.6.1",
1284
+ "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.6.1.tgz",
1285
+ "integrity": "sha512-cL1Qz6ADZhcEbny/8HPfe99J6HhNoYtpX2LFLIbhgGE7Q1hlQVkYFdetDN7Id3KiQxhDrHwzlHr/YQCnZ8+xSA==",
1286
+ "dev": true,
1287
+ "funding": [
1288
+ {
1289
+ "type": "opencollective",
1290
+ "url": "https://opencollective.com/postcss/"
1291
+ },
1292
+ {
1293
+ "type": "tidelift",
1294
+ "url": "https://tidelift.com/funding/github/npm/autoprefixer"
1295
+ },
1296
+ {
1297
+ "type": "github",
1298
+ "url": "https://github.com/sponsors/ai"
1299
+ }
1300
+ ],
1301
+ "license": "MIT",
1302
+ "dependencies": {
1303
+ "browserslist": "^4.28.9",
1304
+ "caniuse-lite": "^1.0.30001810",
1305
+ "fraction.js": "^5.3.4",
1306
+ "picocolors": "^1.1.1",
1307
+ "postcss-value-parser": "^4.2.0"
1308
+ },
1309
+ "bin": {
1310
+ "autoprefixer": "bin/autoprefixer"
1311
+ },
1312
+ "engines": {
1313
+ "node": "^10 || ^12 || >=14"
1314
+ },
1315
+ "peerDependencies": {
1316
+ "postcss": "^8.1.0"
1317
+ }
1318
+ },
1319
+ "node_modules/baseline-browser-mapping": {
1320
+ "version": "2.11.28",
1321
+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.28.tgz",
1322
+ "integrity": "sha512-br0LOmjJqr6Rt4AEkadbcNf67Zpo7EPwKsWbjnRrJIa1QYFHQBqM4C7F2WTbV8ahTEcg1Eo+Y0aWjjORInYFyA==",
1323
+ "dev": true,
1324
+ "license": "Apache-2.0",
1325
+ "bin": {
1326
+ "baseline-browser-mapping": "dist/cli.cjs"
1327
+ },
1328
+ "engines": {
1329
+ "node": ">=6.0.0"
1330
+ }
1331
+ },
1332
+ "node_modules/binary-extensions": {
1333
+ "version": "2.3.0",
1334
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
1335
+ "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
1336
+ "dev": true,
1337
+ "license": "MIT",
1338
+ "engines": {
1339
+ "node": ">=8"
1340
+ },
1341
+ "funding": {
1342
+ "url": "https://github.com/sponsors/sindresorhus"
1343
+ }
1344
+ },
1345
+ "node_modules/braces": {
1346
+ "version": "3.0.3",
1347
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
1348
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
1349
+ "dev": true,
1350
+ "license": "MIT",
1351
+ "dependencies": {
1352
+ "fill-range": "^7.1.1"
1353
+ },
1354
+ "engines": {
1355
+ "node": ">=8"
1356
+ }
1357
+ },
1358
+ "node_modules/browserslist": {
1359
+ "version": "4.29.3",
1360
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.3.tgz",
1361
+ "integrity": "sha512-1R4kiYKXGViqEN0CnoDrXc1StD9niAwu+j2dukWzrD4bJgsD4lDmEp0CRbc6E/vYJIfTHwPmwyaKtVSudICdPA==",
1362
+ "dev": true,
1363
+ "funding": [
1364
+ {
1365
+ "type": "opencollective",
1366
+ "url": "https://opencollective.com/browserslist"
1367
+ },
1368
+ {
1369
+ "type": "tidelift",
1370
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
1371
+ },
1372
+ {
1373
+ "type": "github",
1374
+ "url": "https://github.com/sponsors/ai"
1375
+ }
1376
+ ],
1377
+ "license": "MIT",
1378
+ "dependencies": {
1379
+ "baseline-browser-mapping": "^2.11.26",
1380
+ "caniuse-lite": "^1.0.30001813",
1381
+ "electron-to-chromium": "^1.5.439",
1382
+ "node-releases": "^2.0.57",
1383
+ "update-browserslist-db": "^1.3.3"
1384
+ },
1385
+ "bin": {
1386
+ "browserslist": "cli.js"
1387
+ },
1388
+ "engines": {
1389
+ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
1390
+ }
1391
+ },
1392
+ "node_modules/camelcase-css": {
1393
+ "version": "2.0.1",
1394
+ "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz",
1395
+ "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==",
1396
+ "dev": true,
1397
+ "license": "MIT",
1398
+ "engines": {
1399
+ "node": ">= 6"
1400
+ }
1401
+ },
1402
+ "node_modules/caniuse-lite": {
1403
+ "version": "1.0.30001815",
1404
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001815.tgz",
1405
+ "integrity": "sha512-uDybUEyfgbyJJ93J1vikTylBX31AkdVYeVPeffMQpf8XN7hSfr0oZOn4VFOIMNvtU5+rHvC5Udg2TgtJKHm23Q==",
1406
+ "dev": true,
1407
+ "funding": [
1408
+ {
1409
+ "type": "opencollective",
1410
+ "url": "https://opencollective.com/browserslist"
1411
+ },
1412
+ {
1413
+ "type": "tidelift",
1414
+ "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
1415
+ },
1416
+ {
1417
+ "type": "github",
1418
+ "url": "https://github.com/sponsors/ai"
1419
+ }
1420
+ ],
1421
+ "license": "CC-BY-4.0"
1422
+ },
1423
+ "node_modules/chokidar": {
1424
+ "version": "3.6.0",
1425
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
1426
+ "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
1427
+ "dev": true,
1428
+ "license": "MIT",
1429
+ "dependencies": {
1430
+ "anymatch": "~3.1.2",
1431
+ "braces": "~3.0.2",
1432
+ "glob-parent": "~5.1.2",
1433
+ "is-binary-path": "~2.1.0",
1434
+ "is-glob": "~4.0.1",
1435
+ "normalize-path": "~3.0.0",
1436
+ "readdirp": "~3.6.0"
1437
+ },
1438
+ "engines": {
1439
+ "node": ">= 8.10.0"
1440
+ },
1441
+ "funding": {
1442
+ "url": "https://paulmillr.com/funding/"
1443
+ },
1444
+ "optionalDependencies": {
1445
+ "fsevents": "~2.3.2"
1446
+ }
1447
+ },
1448
+ "node_modules/chokidar/node_modules/glob-parent": {
1449
+ "version": "5.1.2",
1450
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
1451
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
1452
+ "dev": true,
1453
+ "license": "ISC",
1454
+ "dependencies": {
1455
+ "is-glob": "^4.0.1"
1456
+ },
1457
+ "engines": {
1458
+ "node": ">= 6"
1459
+ }
1460
+ },
1461
+ "node_modules/commander": {
1462
+ "version": "4.1.1",
1463
+ "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
1464
+ "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==",
1465
+ "dev": true,
1466
+ "license": "MIT",
1467
+ "engines": {
1468
+ "node": ">= 6"
1469
+ }
1470
+ },
1471
+ "node_modules/convert-source-map": {
1472
+ "version": "2.0.0",
1473
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
1474
+ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
1475
+ "dev": true,
1476
+ "license": "MIT"
1477
+ },
1478
+ "node_modules/cssesc": {
1479
+ "version": "3.0.0",
1480
+ "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
1481
+ "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==",
1482
+ "dev": true,
1483
+ "license": "MIT",
1484
+ "bin": {
1485
+ "cssesc": "bin/cssesc"
1486
+ },
1487
+ "engines": {
1488
+ "node": ">=4"
1489
+ }
1490
+ },
1491
+ "node_modules/debug": {
1492
+ "version": "4.4.3",
1493
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
1494
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
1495
+ "dev": true,
1496
+ "license": "MIT",
1497
+ "dependencies": {
1498
+ "ms": "^2.1.3"
1499
+ },
1500
+ "engines": {
1501
+ "node": ">=6.0"
1502
+ },
1503
+ "peerDependenciesMeta": {
1504
+ "supports-color": {
1505
+ "optional": true
1506
+ }
1507
+ }
1508
+ },
1509
+ "node_modules/didyoumean": {
1510
+ "version": "1.2.2",
1511
+ "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
1512
+ "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==",
1513
+ "dev": true,
1514
+ "license": "Apache-2.0"
1515
+ },
1516
+ "node_modules/dlv": {
1517
+ "version": "1.1.3",
1518
+ "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
1519
+ "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==",
1520
+ "dev": true,
1521
+ "license": "MIT"
1522
+ },
1523
+ "node_modules/dompurify": {
1524
+ "version": "3.5.0",
1525
+ "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.5.0.tgz",
1526
+ "integrity": "sha512-LYC0ZkE8P1V42JsRYTwMdme/2ET8SpOc5AA2eOFjP/IadvRd2fwiT4TVz5vkfy0XUx12aS2UaRkTnfVPNOv9vw==",
1527
+ "license": "(MPL-2.0 OR Apache-2.0)",
1528
+ "optionalDependencies": {
1529
+ "@types/trusted-types": "^2.0.7"
1530
+ }
1531
+ },
1532
+ "node_modules/electron-to-chromium": {
1533
+ "version": "1.5.452",
1534
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.452.tgz",
1535
+ "integrity": "sha512-cVvk1YBSj6571VmV6hdJTqj94Y79xSu8cj6Y9t6ae4Y4431z8/7EJFvu3rVp90xhfuv9BpPKUmaLfTo4+FOGBg==",
1536
+ "dev": true,
1537
+ "license": "ISC"
1538
+ },
1539
+ "node_modules/es-errors": {
1540
+ "version": "1.3.0",
1541
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
1542
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
1543
+ "dev": true,
1544
+ "license": "MIT",
1545
+ "engines": {
1546
+ "node": ">= 0.4"
1547
+ }
1548
+ },
1549
+ "node_modules/esbuild": {
1550
+ "version": "0.21.5",
1551
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz",
1552
+ "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==",
1553
+ "dev": true,
1554
+ "hasInstallScript": true,
1555
+ "license": "MIT",
1556
+ "bin": {
1557
+ "esbuild": "bin/esbuild"
1558
+ },
1559
+ "engines": {
1560
+ "node": ">=12"
1561
+ },
1562
+ "optionalDependencies": {
1563
+ "@esbuild/aix-ppc64": "0.21.5",
1564
+ "@esbuild/android-arm": "0.21.5",
1565
+ "@esbuild/android-arm64": "0.21.5",
1566
+ "@esbuild/android-x64": "0.21.5",
1567
+ "@esbuild/darwin-arm64": "0.21.5",
1568
+ "@esbuild/darwin-x64": "0.21.5",
1569
+ "@esbuild/freebsd-arm64": "0.21.5",
1570
+ "@esbuild/freebsd-x64": "0.21.5",
1571
+ "@esbuild/linux-arm": "0.21.5",
1572
+ "@esbuild/linux-arm64": "0.21.5",
1573
+ "@esbuild/linux-ia32": "0.21.5",
1574
+ "@esbuild/linux-loong64": "0.21.5",
1575
+ "@esbuild/linux-mips64el": "0.21.5",
1576
+ "@esbuild/linux-ppc64": "0.21.5",
1577
+ "@esbuild/linux-riscv64": "0.21.5",
1578
+ "@esbuild/linux-s390x": "0.21.5",
1579
+ "@esbuild/linux-x64": "0.21.5",
1580
+ "@esbuild/netbsd-x64": "0.21.5",
1581
+ "@esbuild/openbsd-x64": "0.21.5",
1582
+ "@esbuild/sunos-x64": "0.21.5",
1583
+ "@esbuild/win32-arm64": "0.21.5",
1584
+ "@esbuild/win32-ia32": "0.21.5",
1585
+ "@esbuild/win32-x64": "0.21.5"
1586
+ }
1587
+ },
1588
+ "node_modules/escalade": {
1589
+ "version": "3.2.0",
1590
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
1591
+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
1592
+ "dev": true,
1593
+ "license": "MIT",
1594
+ "engines": {
1595
+ "node": ">=6"
1596
+ }
1597
+ },
1598
+ "node_modules/fast-glob": {
1599
+ "version": "3.3.3",
1600
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz",
1601
+ "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==",
1602
+ "dev": true,
1603
+ "license": "MIT",
1604
+ "dependencies": {
1605
+ "@nodelib/fs.stat": "^2.0.2",
1606
+ "@nodelib/fs.walk": "^1.2.3",
1607
+ "glob-parent": "^5.1.2",
1608
+ "merge2": "^1.3.0",
1609
+ "micromatch": "^4.0.8"
1610
+ },
1611
+ "engines": {
1612
+ "node": ">=8.6.0"
1613
+ }
1614
+ },
1615
+ "node_modules/fast-glob/node_modules/glob-parent": {
1616
+ "version": "5.1.2",
1617
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
1618
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
1619
+ "dev": true,
1620
+ "license": "ISC",
1621
+ "dependencies": {
1622
+ "is-glob": "^4.0.1"
1623
+ },
1624
+ "engines": {
1625
+ "node": ">= 6"
1626
+ }
1627
+ },
1628
+ "node_modules/fastq": {
1629
+ "version": "1.20.3",
1630
+ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.3.tgz",
1631
+ "integrity": "sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw==",
1632
+ "dev": true,
1633
+ "license": "ISC",
1634
+ "dependencies": {
1635
+ "reusify": "^1.0.4"
1636
+ }
1637
+ },
1638
+ "node_modules/fill-range": {
1639
+ "version": "7.1.1",
1640
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
1641
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
1642
+ "dev": true,
1643
+ "license": "MIT",
1644
+ "dependencies": {
1645
+ "to-regex-range": "^5.0.1"
1646
+ },
1647
+ "engines": {
1648
+ "node": ">=8"
1649
+ }
1650
+ },
1651
+ "node_modules/fraction.js": {
1652
+ "version": "5.3.4",
1653
+ "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz",
1654
+ "integrity": "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==",
1655
+ "dev": true,
1656
+ "license": "MIT",
1657
+ "engines": {
1658
+ "node": "*"
1659
+ },
1660
+ "funding": {
1661
+ "type": "github",
1662
+ "url": "https://github.com/sponsors/rawify"
1663
+ }
1664
+ },
1665
+ "node_modules/fsevents": {
1666
+ "version": "2.3.3",
1667
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
1668
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
1669
+ "dev": true,
1670
+ "hasInstallScript": true,
1671
+ "license": "MIT",
1672
+ "optional": true,
1673
+ "os": [
1674
+ "darwin"
1675
+ ],
1676
+ "engines": {
1677
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
1678
+ }
1679
+ },
1680
+ "node_modules/function-bind": {
1681
+ "version": "1.1.2",
1682
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
1683
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
1684
+ "dev": true,
1685
+ "license": "MIT",
1686
+ "funding": {
1687
+ "url": "https://github.com/sponsors/ljharb"
1688
+ }
1689
+ },
1690
+ "node_modules/gensync": {
1691
+ "version": "1.0.0-beta.2",
1692
+ "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
1693
+ "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
1694
+ "dev": true,
1695
+ "license": "MIT",
1696
+ "engines": {
1697
+ "node": ">=6.9.0"
1698
+ }
1699
+ },
1700
+ "node_modules/glob-parent": {
1701
+ "version": "6.0.2",
1702
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
1703
+ "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
1704
+ "dev": true,
1705
+ "license": "ISC",
1706
+ "dependencies": {
1707
+ "is-glob": "^4.0.3"
1708
+ },
1709
+ "engines": {
1710
+ "node": ">=10.13.0"
1711
+ }
1712
+ },
1713
+ "node_modules/hasown": {
1714
+ "version": "2.0.4",
1715
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
1716
+ "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
1717
+ "dev": true,
1718
+ "license": "MIT",
1719
+ "dependencies": {
1720
+ "function-bind": "^1.1.2"
1721
+ },
1722
+ "engines": {
1723
+ "node": ">= 0.4"
1724
+ }
1725
+ },
1726
+ "node_modules/is-binary-path": {
1727
+ "version": "2.1.0",
1728
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
1729
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
1730
+ "dev": true,
1731
+ "license": "MIT",
1732
+ "dependencies": {
1733
+ "binary-extensions": "^2.0.0"
1734
+ },
1735
+ "engines": {
1736
+ "node": ">=8"
1737
+ }
1738
+ },
1739
+ "node_modules/is-core-module": {
1740
+ "version": "2.17.0",
1741
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.17.0.tgz",
1742
+ "integrity": "sha512-J/vG0zBCbIKOQFfufSwyXdMrsohyJIUNkrnmo6WZGzoM7tr/lsbfW5b2BvisL6zsyMzK9UxV9L6c7AoFbyXHOA==",
1743
+ "dev": true,
1744
+ "license": "MIT",
1745
+ "dependencies": {
1746
+ "hasown": "^2.0.4"
1747
+ },
1748
+ "engines": {
1749
+ "node": ">= 0.4"
1750
+ },
1751
+ "funding": {
1752
+ "url": "https://github.com/sponsors/ljharb"
1753
+ }
1754
+ },
1755
+ "node_modules/is-extglob": {
1756
+ "version": "2.1.1",
1757
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
1758
+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
1759
+ "dev": true,
1760
+ "license": "MIT",
1761
+ "engines": {
1762
+ "node": ">=0.10.0"
1763
+ }
1764
+ },
1765
+ "node_modules/is-glob": {
1766
+ "version": "4.0.3",
1767
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
1768
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
1769
+ "dev": true,
1770
+ "license": "MIT",
1771
+ "dependencies": {
1772
+ "is-extglob": "^2.1.1"
1773
+ },
1774
+ "engines": {
1775
+ "node": ">=0.10.0"
1776
+ }
1777
+ },
1778
+ "node_modules/is-number": {
1779
+ "version": "7.0.0",
1780
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
1781
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
1782
+ "dev": true,
1783
+ "license": "MIT",
1784
+ "engines": {
1785
+ "node": ">=0.12.0"
1786
+ }
1787
+ },
1788
+ "node_modules/jiti": {
1789
+ "version": "1.21.7",
1790
+ "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz",
1791
+ "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==",
1792
+ "dev": true,
1793
+ "license": "MIT",
1794
+ "bin": {
1795
+ "jiti": "bin/jiti.js"
1796
+ }
1797
+ },
1798
+ "node_modules/js-tokens": {
1799
+ "version": "4.0.0",
1800
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
1801
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
1802
+ "license": "MIT"
1803
+ },
1804
+ "node_modules/jsesc": {
1805
+ "version": "3.1.0",
1806
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
1807
+ "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==",
1808
+ "dev": true,
1809
+ "license": "MIT",
1810
+ "bin": {
1811
+ "jsesc": "bin/jsesc"
1812
+ },
1813
+ "engines": {
1814
+ "node": ">=6"
1815
+ }
1816
+ },
1817
+ "node_modules/json5": {
1818
+ "version": "2.2.3",
1819
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
1820
+ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
1821
+ "dev": true,
1822
+ "license": "MIT",
1823
+ "bin": {
1824
+ "json5": "lib/cli.js"
1825
+ },
1826
+ "engines": {
1827
+ "node": ">=6"
1828
+ }
1829
+ },
1830
+ "node_modules/lilconfig": {
1831
+ "version": "3.1.3",
1832
+ "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz",
1833
+ "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==",
1834
+ "dev": true,
1835
+ "license": "MIT",
1836
+ "engines": {
1837
+ "node": ">=14"
1838
+ },
1839
+ "funding": {
1840
+ "url": "https://github.com/sponsors/antonk52"
1841
+ }
1842
+ },
1843
+ "node_modules/lines-and-columns": {
1844
+ "version": "1.2.4",
1845
+ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
1846
+ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
1847
+ "dev": true,
1848
+ "license": "MIT"
1849
+ },
1850
+ "node_modules/loose-envify": {
1851
+ "version": "1.4.0",
1852
+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
1853
+ "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
1854
+ "license": "MIT",
1855
+ "dependencies": {
1856
+ "js-tokens": "^3.0.0 || ^4.0.0"
1857
+ },
1858
+ "bin": {
1859
+ "loose-envify": "cli.js"
1860
+ }
1861
+ },
1862
+ "node_modules/lru-cache": {
1863
+ "version": "5.1.1",
1864
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
1865
+ "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
1866
+ "dev": true,
1867
+ "license": "ISC",
1868
+ "dependencies": {
1869
+ "yallist": "^3.0.2"
1870
+ }
1871
+ },
1872
+ "node_modules/lucide-react": {
1873
+ "version": "0.441.0",
1874
+ "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.441.0.tgz",
1875
+ "integrity": "sha512-0vfExYtvSDhkC2lqg0zYVW1Uu9GsI4knuV9GP9by5z0Xhc4Zi5RejTxfz9LsjRmCyWVzHCJvxGKZWcRyvQCWVg==",
1876
+ "license": "ISC",
1877
+ "peerDependencies": {
1878
+ "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0-rc"
1879
+ }
1880
+ },
1881
+ "node_modules/marked": {
1882
+ "version": "18.3.0",
1883
+ "resolved": "https://registry.npmjs.org/marked/-/marked-18.3.0.tgz",
1884
+ "integrity": "sha512-ed8zmPXlBb3UfGXN5iHMQyMhFpdqLgoV5umUXx/Q1R+FW3q8VpqpyoKUwlENL9appo2UMvNLURDVaT3AMOryGA==",
1885
+ "license": "MIT",
1886
+ "bin": {
1887
+ "marked": "bin/marked.js"
1888
+ },
1889
+ "engines": {
1890
+ "node": ">= 20"
1891
+ }
1892
+ },
1893
+ "node_modules/merge2": {
1894
+ "version": "1.4.1",
1895
+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
1896
+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
1897
+ "dev": true,
1898
+ "license": "MIT",
1899
+ "engines": {
1900
+ "node": ">= 8"
1901
+ }
1902
+ },
1903
+ "node_modules/micromatch": {
1904
+ "version": "4.0.8",
1905
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
1906
+ "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
1907
+ "dev": true,
1908
+ "license": "MIT",
1909
+ "dependencies": {
1910
+ "braces": "^3.0.3",
1911
+ "picomatch": "^2.3.1"
1912
+ },
1913
+ "engines": {
1914
+ "node": ">=8.6"
1915
+ }
1916
+ },
1917
+ "node_modules/ms": {
1918
+ "version": "2.1.3",
1919
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
1920
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
1921
+ "dev": true,
1922
+ "license": "MIT"
1923
+ },
1924
+ "node_modules/mz": {
1925
+ "version": "2.7.0",
1926
+ "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz",
1927
+ "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==",
1928
+ "dev": true,
1929
+ "license": "MIT",
1930
+ "dependencies": {
1931
+ "any-promise": "^1.0.0",
1932
+ "object-assign": "^4.0.1",
1933
+ "thenify-all": "^1.0.0"
1934
+ }
1935
+ },
1936
+ "node_modules/nanoid": {
1937
+ "version": "3.3.20",
1938
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
1939
+ "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",
1940
+ "dev": true,
1941
+ "funding": [
1942
+ {
1943
+ "type": "github",
1944
+ "url": "https://github.com/sponsors/ai"
1945
+ }
1946
+ ],
1947
+ "license": "MIT",
1948
+ "bin": {
1949
+ "nanoid": "bin/nanoid.cjs"
1950
+ },
1951
+ "engines": {
1952
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
1953
+ }
1954
+ },
1955
+ "node_modules/node-releases": {
1956
+ "version": "2.0.58",
1957
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.58.tgz",
1958
+ "integrity": "sha512-BdiKAgbfRlvfMq/XzO/AF9NPmaA8a+YpLAyAFTVFBj3gARrAIfWvNq7Q7NE4se3KgFu0KkrvQMxTS0XVnsGzHg==",
1959
+ "dev": true,
1960
+ "license": "MIT",
1961
+ "engines": {
1962
+ "node": ">=18"
1963
+ }
1964
+ },
1965
+ "node_modules/normalize-path": {
1966
+ "version": "3.0.0",
1967
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
1968
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
1969
+ "dev": true,
1970
+ "license": "MIT",
1971
+ "engines": {
1972
+ "node": ">=0.10.0"
1973
+ }
1974
+ },
1975
+ "node_modules/object-assign": {
1976
+ "version": "4.1.1",
1977
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
1978
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
1979
+ "dev": true,
1980
+ "license": "MIT",
1981
+ "engines": {
1982
+ "node": ">=0.10.0"
1983
+ }
1984
+ },
1985
+ "node_modules/object-hash": {
1986
+ "version": "3.0.0",
1987
+ "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz",
1988
+ "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==",
1989
+ "dev": true,
1990
+ "license": "MIT",
1991
+ "engines": {
1992
+ "node": ">= 6"
1993
+ }
1994
+ },
1995
+ "node_modules/path-parse": {
1996
+ "version": "1.0.7",
1997
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
1998
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
1999
+ "dev": true,
2000
+ "license": "MIT"
2001
+ },
2002
+ "node_modules/picocolors": {
2003
+ "version": "1.1.1",
2004
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
2005
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
2006
+ "dev": true,
2007
+ "license": "ISC"
2008
+ },
2009
+ "node_modules/picomatch": {
2010
+ "version": "2.3.2",
2011
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
2012
+ "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
2013
+ "dev": true,
2014
+ "license": "MIT",
2015
+ "engines": {
2016
+ "node": ">=8.6"
2017
+ },
2018
+ "funding": {
2019
+ "url": "https://github.com/sponsors/jonschlinkert"
2020
+ }
2021
+ },
2022
+ "node_modules/pirates": {
2023
+ "version": "4.0.7",
2024
+ "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz",
2025
+ "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==",
2026
+ "dev": true,
2027
+ "license": "MIT",
2028
+ "engines": {
2029
+ "node": ">= 6"
2030
+ }
2031
+ },
2032
+ "node_modules/postcss": {
2033
+ "version": "8.5.29",
2034
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.29.tgz",
2035
+ "integrity": "sha512-49cGhUbXj8Qenv0iTMxA1cFBzxXoctpC9Ujd77t1WcbJIr6nF/eI7g/8MgxrYldFRuAXvja7xQRwavoW7kgrxQ==",
2036
+ "dev": true,
2037
+ "funding": [
2038
+ {
2039
+ "type": "opencollective",
2040
+ "url": "https://opencollective.com/postcss/"
2041
+ },
2042
+ {
2043
+ "type": "tidelift",
2044
+ "url": "https://tidelift.com/funding/github/npm/postcss"
2045
+ },
2046
+ {
2047
+ "type": "github",
2048
+ "url": "https://github.com/sponsors/ai"
2049
+ }
2050
+ ],
2051
+ "license": "MIT",
2052
+ "dependencies": {
2053
+ "nanoid": "^3.3.19",
2054
+ "picocolors": "^1.1.1",
2055
+ "source-map-js": "^1.2.2"
2056
+ },
2057
+ "engines": {
2058
+ "node": "^10 || ^12 || >=14"
2059
+ }
2060
+ },
2061
+ "node_modules/postcss-import": {
2062
+ "version": "15.1.0",
2063
+ "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz",
2064
+ "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==",
2065
+ "dev": true,
2066
+ "license": "MIT",
2067
+ "dependencies": {
2068
+ "postcss-value-parser": "^4.0.0",
2069
+ "read-cache": "^1.0.0",
2070
+ "resolve": "^1.1.7"
2071
+ },
2072
+ "engines": {
2073
+ "node": ">=14.0.0"
2074
+ },
2075
+ "peerDependencies": {
2076
+ "postcss": "^8.0.0"
2077
+ }
2078
+ },
2079
+ "node_modules/postcss-js": {
2080
+ "version": "4.1.0",
2081
+ "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.1.0.tgz",
2082
+ "integrity": "sha512-oIAOTqgIo7q2EOwbhb8UalYePMvYoIeRY2YKntdpFQXNosSu3vLrniGgmH9OKs/qAkfoj5oB3le/7mINW1LCfw==",
2083
+ "dev": true,
2084
+ "funding": [
2085
+ {
2086
+ "type": "opencollective",
2087
+ "url": "https://opencollective.com/postcss/"
2088
+ },
2089
+ {
2090
+ "type": "github",
2091
+ "url": "https://github.com/sponsors/ai"
2092
+ }
2093
+ ],
2094
+ "license": "MIT",
2095
+ "dependencies": {
2096
+ "camelcase-css": "^2.0.1"
2097
+ },
2098
+ "engines": {
2099
+ "node": "^12 || ^14 || >= 16"
2100
+ },
2101
+ "peerDependencies": {
2102
+ "postcss": "^8.4.21"
2103
+ }
2104
+ },
2105
+ "node_modules/postcss-load-config": {
2106
+ "version": "6.0.1",
2107
+ "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz",
2108
+ "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==",
2109
+ "dev": true,
2110
+ "funding": [
2111
+ {
2112
+ "type": "opencollective",
2113
+ "url": "https://opencollective.com/postcss/"
2114
+ },
2115
+ {
2116
+ "type": "github",
2117
+ "url": "https://github.com/sponsors/ai"
2118
+ }
2119
+ ],
2120
+ "license": "MIT",
2121
+ "dependencies": {
2122
+ "lilconfig": "^3.1.1"
2123
+ },
2124
+ "engines": {
2125
+ "node": ">= 18"
2126
+ },
2127
+ "peerDependencies": {
2128
+ "jiti": ">=1.21.0",
2129
+ "postcss": ">=8.0.9",
2130
+ "tsx": "^4.8.1",
2131
+ "yaml": "^2.4.2"
2132
+ },
2133
+ "peerDependenciesMeta": {
2134
+ "jiti": {
2135
+ "optional": true
2136
+ },
2137
+ "postcss": {
2138
+ "optional": true
2139
+ },
2140
+ "tsx": {
2141
+ "optional": true
2142
+ },
2143
+ "yaml": {
2144
+ "optional": true
2145
+ }
2146
+ }
2147
+ },
2148
+ "node_modules/postcss-nested": {
2149
+ "version": "6.2.0",
2150
+ "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.2.0.tgz",
2151
+ "integrity": "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==",
2152
+ "dev": true,
2153
+ "funding": [
2154
+ {
2155
+ "type": "opencollective",
2156
+ "url": "https://opencollective.com/postcss/"
2157
+ },
2158
+ {
2159
+ "type": "github",
2160
+ "url": "https://github.com/sponsors/ai"
2161
+ }
2162
+ ],
2163
+ "license": "MIT",
2164
+ "dependencies": {
2165
+ "postcss-selector-parser": "^6.1.1"
2166
+ },
2167
+ "engines": {
2168
+ "node": ">=12.0"
2169
+ },
2170
+ "peerDependencies": {
2171
+ "postcss": "^8.2.14"
2172
+ }
2173
+ },
2174
+ "node_modules/postcss-selector-parser": {
2175
+ "version": "6.1.4",
2176
+ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.4.tgz",
2177
+ "integrity": "sha512-bIoJLOmjCO1S9XdY/DcnR5hJxvrDir1PbGChrzXG3vw0/FOliy/fA3dmdhQ441kah4gKv+TwckGzex6wNS5cnQ==",
2178
+ "dev": true,
2179
+ "license": "MIT",
2180
+ "dependencies": {
2181
+ "cssesc": "^3.0.0",
2182
+ "util-deprecate": "^1.0.2"
2183
+ },
2184
+ "engines": {
2185
+ "node": ">=4"
2186
+ }
2187
+ },
2188
+ "node_modules/postcss-value-parser": {
2189
+ "version": "4.2.0",
2190
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
2191
+ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==",
2192
+ "dev": true,
2193
+ "license": "MIT"
2194
+ },
2195
+ "node_modules/queue-microtask": {
2196
+ "version": "1.2.3",
2197
+ "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
2198
+ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
2199
+ "dev": true,
2200
+ "funding": [
2201
+ {
2202
+ "type": "github",
2203
+ "url": "https://github.com/sponsors/feross"
2204
+ },
2205
+ {
2206
+ "type": "patreon",
2207
+ "url": "https://www.patreon.com/feross"
2208
+ },
2209
+ {
2210
+ "type": "consulting",
2211
+ "url": "https://feross.org/support"
2212
+ }
2213
+ ],
2214
+ "license": "MIT"
2215
+ },
2216
+ "node_modules/react": {
2217
+ "version": "18.3.1",
2218
+ "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
2219
+ "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
2220
+ "license": "MIT",
2221
+ "dependencies": {
2222
+ "loose-envify": "^1.1.0"
2223
+ },
2224
+ "engines": {
2225
+ "node": ">=0.10.0"
2226
+ }
2227
+ },
2228
+ "node_modules/react-dom": {
2229
+ "version": "18.3.1",
2230
+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
2231
+ "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
2232
+ "license": "MIT",
2233
+ "dependencies": {
2234
+ "loose-envify": "^1.1.0",
2235
+ "scheduler": "^0.23.2"
2236
+ },
2237
+ "peerDependencies": {
2238
+ "react": "^18.3.1"
2239
+ }
2240
+ },
2241
+ "node_modules/react-refresh": {
2242
+ "version": "0.17.0",
2243
+ "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz",
2244
+ "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==",
2245
+ "dev": true,
2246
+ "license": "MIT",
2247
+ "engines": {
2248
+ "node": ">=0.10.0"
2249
+ }
2250
+ },
2251
+ "node_modules/read-cache": {
2252
+ "version": "1.0.2",
2253
+ "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.2.tgz",
2254
+ "integrity": "sha512-/peqiBB/n07gQGLsWaHho3WfvUyRscw0gYTsEFMhrIe/nWLkYaf5SbKYjGYqtRV3aPwykJgF2VEMo1ac4bnsGA==",
2255
+ "dev": true,
2256
+ "license": "MIT"
2257
+ },
2258
+ "node_modules/readdirp": {
2259
+ "version": "3.6.0",
2260
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
2261
+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
2262
+ "dev": true,
2263
+ "license": "MIT",
2264
+ "dependencies": {
2265
+ "picomatch": "^2.2.1"
2266
+ },
2267
+ "engines": {
2268
+ "node": ">=8.10.0"
2269
+ }
2270
+ },
2271
+ "node_modules/resolve": {
2272
+ "version": "1.22.13",
2273
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.13.tgz",
2274
+ "integrity": "sha512-Dj/cW9zBV2aRj6XzCxuGIs3ESZKv02jixne3q6jFZYZ3/Tg09gHHviSMDL4kObh9pqSahdRHEnDoaP2gn8YLhA==",
2275
+ "dev": true,
2276
+ "license": "MIT",
2277
+ "dependencies": {
2278
+ "es-errors": "^1.3.0",
2279
+ "is-core-module": "^2.17.0",
2280
+ "path-parse": "^1.0.7",
2281
+ "supports-preserve-symlinks-flag": "^1.0.0"
2282
+ },
2283
+ "bin": {
2284
+ "resolve": "bin/resolve"
2285
+ },
2286
+ "engines": {
2287
+ "node": ">= 0.4"
2288
+ },
2289
+ "funding": {
2290
+ "url": "https://github.com/sponsors/ljharb"
2291
+ }
2292
+ },
2293
+ "node_modules/reusify": {
2294
+ "version": "1.1.0",
2295
+ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz",
2296
+ "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==",
2297
+ "dev": true,
2298
+ "license": "MIT",
2299
+ "engines": {
2300
+ "iojs": ">=1.0.0",
2301
+ "node": ">=0.10.0"
2302
+ }
2303
+ },
2304
+ "node_modules/rollup": {
2305
+ "version": "4.64.5",
2306
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.64.5.tgz",
2307
+ "integrity": "sha512-EAP5ZHcz2ijbgCWwPkpI7zh6bfsri2Ez5FtCy2dCp1k62duXzfG7DLGGh7RU2QQXWwavT+u4qpvDF/TWOiiGTw==",
2308
+ "dev": true,
2309
+ "license": "MIT",
2310
+ "dependencies": {
2311
+ "@types/estree": "1.0.9"
2312
+ },
2313
+ "bin": {
2314
+ "rollup": "dist/bin/rollup"
2315
+ },
2316
+ "engines": {
2317
+ "node": ">=18.0.0",
2318
+ "npm": ">=8.0.0"
2319
+ },
2320
+ "optionalDependencies": {
2321
+ "@napi-rs/lzma-linux-x64-gnu": "1.5.1",
2322
+ "@rollup/rollup-android-arm-eabi": "4.64.5",
2323
+ "@rollup/rollup-android-arm64": "4.64.5",
2324
+ "@rollup/rollup-darwin-arm64": "4.64.5",
2325
+ "@rollup/rollup-darwin-x64": "4.64.5",
2326
+ "@rollup/rollup-freebsd-arm64": "4.64.5",
2327
+ "@rollup/rollup-freebsd-x64": "4.64.5",
2328
+ "@rollup/rollup-linux-arm-gnueabihf": "4.64.5",
2329
+ "@rollup/rollup-linux-arm-musleabihf": "4.64.5",
2330
+ "@rollup/rollup-linux-arm64-gnu": "4.64.5",
2331
+ "@rollup/rollup-linux-arm64-musl": "4.64.5",
2332
+ "@rollup/rollup-linux-loong64-gnu": "4.64.5",
2333
+ "@rollup/rollup-linux-loong64-musl": "4.64.5",
2334
+ "@rollup/rollup-linux-ppc64-gnu": "4.64.5",
2335
+ "@rollup/rollup-linux-ppc64-musl": "4.64.5",
2336
+ "@rollup/rollup-linux-riscv64-gnu": "4.64.5",
2337
+ "@rollup/rollup-linux-riscv64-musl": "4.64.5",
2338
+ "@rollup/rollup-linux-s390x-gnu": "4.64.5",
2339
+ "@rollup/rollup-linux-x64-gnu": "4.64.5",
2340
+ "@rollup/rollup-linux-x64-musl": "4.64.5",
2341
+ "@rollup/rollup-openbsd-x64": "4.64.5",
2342
+ "@rollup/rollup-openharmony-arm64": "4.64.5",
2343
+ "@rollup/rollup-win32-arm64-msvc": "4.64.5",
2344
+ "@rollup/rollup-win32-ia32-msvc": "4.64.5",
2345
+ "@rollup/rollup-win32-x64-gnu": "4.64.5",
2346
+ "@rollup/rollup-win32-x64-msvc": "4.64.5",
2347
+ "fsevents": "~2.3.2"
2348
+ }
2349
+ },
2350
+ "node_modules/run-parallel": {
2351
+ "version": "1.2.0",
2352
+ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
2353
+ "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
2354
+ "dev": true,
2355
+ "funding": [
2356
+ {
2357
+ "type": "github",
2358
+ "url": "https://github.com/sponsors/feross"
2359
+ },
2360
+ {
2361
+ "type": "patreon",
2362
+ "url": "https://www.patreon.com/feross"
2363
+ },
2364
+ {
2365
+ "type": "consulting",
2366
+ "url": "https://feross.org/support"
2367
+ }
2368
+ ],
2369
+ "license": "MIT",
2370
+ "dependencies": {
2371
+ "queue-microtask": "^1.2.2"
2372
+ }
2373
+ },
2374
+ "node_modules/scheduler": {
2375
+ "version": "0.23.2",
2376
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz",
2377
+ "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==",
2378
+ "license": "MIT",
2379
+ "dependencies": {
2380
+ "loose-envify": "^1.1.0"
2381
+ }
2382
+ },
2383
+ "node_modules/semver": {
2384
+ "version": "6.3.1",
2385
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
2386
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
2387
+ "dev": true,
2388
+ "license": "ISC",
2389
+ "bin": {
2390
+ "semver": "bin/semver.js"
2391
+ }
2392
+ },
2393
+ "node_modules/source-map-js": {
2394
+ "version": "1.2.2",
2395
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
2396
+ "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
2397
+ "dev": true,
2398
+ "license": "BSD-3-Clause",
2399
+ "engines": {
2400
+ "node": ">=0.10.0"
2401
+ }
2402
+ },
2403
+ "node_modules/sucrase": {
2404
+ "version": "3.35.1",
2405
+ "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz",
2406
+ "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==",
2407
+ "dev": true,
2408
+ "license": "MIT",
2409
+ "dependencies": {
2410
+ "@jridgewell/gen-mapping": "^0.3.2",
2411
+ "commander": "^4.0.0",
2412
+ "lines-and-columns": "^1.1.6",
2413
+ "mz": "^2.7.0",
2414
+ "pirates": "^4.0.1",
2415
+ "tinyglobby": "^0.2.11",
2416
+ "ts-interface-checker": "^0.1.9"
2417
+ },
2418
+ "bin": {
2419
+ "sucrase": "bin/sucrase",
2420
+ "sucrase-node": "bin/sucrase-node"
2421
+ },
2422
+ "engines": {
2423
+ "node": ">=16 || 14 >=14.17"
2424
+ }
2425
+ },
2426
+ "node_modules/supports-preserve-symlinks-flag": {
2427
+ "version": "1.0.0",
2428
+ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
2429
+ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
2430
+ "dev": true,
2431
+ "license": "MIT",
2432
+ "engines": {
2433
+ "node": ">= 0.4"
2434
+ },
2435
+ "funding": {
2436
+ "url": "https://github.com/sponsors/ljharb"
2437
+ }
2438
+ },
2439
+ "node_modules/tailwindcss": {
2440
+ "version": "3.4.19",
2441
+ "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz",
2442
+ "integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==",
2443
+ "dev": true,
2444
+ "license": "MIT",
2445
+ "dependencies": {
2446
+ "@alloc/quick-lru": "^5.2.0",
2447
+ "arg": "^5.0.2",
2448
+ "chokidar": "^3.6.0",
2449
+ "didyoumean": "^1.2.2",
2450
+ "dlv": "^1.1.3",
2451
+ "fast-glob": "^3.3.2",
2452
+ "glob-parent": "^6.0.2",
2453
+ "is-glob": "^4.0.3",
2454
+ "jiti": "^1.21.7",
2455
+ "lilconfig": "^3.1.3",
2456
+ "micromatch": "^4.0.8",
2457
+ "normalize-path": "^3.0.0",
2458
+ "object-hash": "^3.0.0",
2459
+ "picocolors": "^1.1.1",
2460
+ "postcss": "^8.4.47",
2461
+ "postcss-import": "^15.1.0",
2462
+ "postcss-js": "^4.0.1",
2463
+ "postcss-load-config": "^4.0.2 || ^5.0 || ^6.0",
2464
+ "postcss-nested": "^6.2.0",
2465
+ "postcss-selector-parser": "^6.1.2",
2466
+ "resolve": "^1.22.8",
2467
+ "sucrase": "^3.35.0"
2468
+ },
2469
+ "bin": {
2470
+ "tailwind": "lib/cli.js",
2471
+ "tailwindcss": "lib/cli.js"
2472
+ },
2473
+ "engines": {
2474
+ "node": ">=14.0.0"
2475
+ }
2476
+ },
2477
+ "node_modules/thenify": {
2478
+ "version": "3.3.1",
2479
+ "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",
2480
+ "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==",
2481
+ "dev": true,
2482
+ "license": "MIT",
2483
+ "dependencies": {
2484
+ "any-promise": "^1.0.0"
2485
+ }
2486
+ },
2487
+ "node_modules/thenify-all": {
2488
+ "version": "1.6.0",
2489
+ "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz",
2490
+ "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==",
2491
+ "dev": true,
2492
+ "license": "MIT",
2493
+ "dependencies": {
2494
+ "thenify": ">= 3.1.0 < 4"
2495
+ },
2496
+ "engines": {
2497
+ "node": ">=0.8"
2498
+ }
2499
+ },
2500
+ "node_modules/tinyglobby": {
2501
+ "version": "0.2.17",
2502
+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
2503
+ "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
2504
+ "dev": true,
2505
+ "license": "MIT",
2506
+ "dependencies": {
2507
+ "fdir": "^6.5.0",
2508
+ "picomatch": "^4.0.4"
2509
+ },
2510
+ "engines": {
2511
+ "node": ">=12.0.0"
2512
+ },
2513
+ "funding": {
2514
+ "url": "https://github.com/sponsors/SuperchupuDev"
2515
+ }
2516
+ },
2517
+ "node_modules/tinyglobby/node_modules/fdir": {
2518
+ "version": "6.5.0",
2519
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
2520
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
2521
+ "dev": true,
2522
+ "license": "MIT",
2523
+ "engines": {
2524
+ "node": ">=12.0.0"
2525
+ },
2526
+ "peerDependencies": {
2527
+ "picomatch": "^3 || ^4"
2528
+ },
2529
+ "peerDependenciesMeta": {
2530
+ "picomatch": {
2531
+ "optional": true
2532
+ }
2533
+ }
2534
+ },
2535
+ "node_modules/tinyglobby/node_modules/picomatch": {
2536
+ "version": "4.0.7",
2537
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
2538
+ "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
2539
+ "dev": true,
2540
+ "license": "MIT",
2541
+ "engines": {
2542
+ "node": ">=12"
2543
+ },
2544
+ "funding": {
2545
+ "url": "https://github.com/sponsors/jonschlinkert"
2546
+ }
2547
+ },
2548
+ "node_modules/to-regex-range": {
2549
+ "version": "5.0.1",
2550
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
2551
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
2552
+ "dev": true,
2553
+ "license": "MIT",
2554
+ "dependencies": {
2555
+ "is-number": "^7.0.0"
2556
+ },
2557
+ "engines": {
2558
+ "node": ">=8.0"
2559
+ }
2560
+ },
2561
+ "node_modules/ts-interface-checker": {
2562
+ "version": "0.1.13",
2563
+ "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",
2564
+ "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==",
2565
+ "dev": true,
2566
+ "license": "Apache-2.0"
2567
+ },
2568
+ "node_modules/update-browserslist-db": {
2569
+ "version": "1.3.4",
2570
+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.4.tgz",
2571
+ "integrity": "sha512-t8wonIOdQyOjtPd2VktlBu6QjTVTks6v8bSi7kd0r2Vll8TK1JYDZtRRdbmCHOAMphkZgrzK+L+vXK4pyZ8t4A==",
2572
+ "dev": true,
2573
+ "funding": [
2574
+ {
2575
+ "type": "opencollective",
2576
+ "url": "https://opencollective.com/browserslist"
2577
+ },
2578
+ {
2579
+ "type": "tidelift",
2580
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
2581
+ },
2582
+ {
2583
+ "type": "github",
2584
+ "url": "https://github.com/sponsors/ai"
2585
+ }
2586
+ ],
2587
+ "license": "MIT",
2588
+ "dependencies": {
2589
+ "escalade": "^3.2.0",
2590
+ "picocolors": "^1.1.1"
2591
+ },
2592
+ "bin": {
2593
+ "update-browserslist-db": "cli.js"
2594
+ },
2595
+ "peerDependencies": {
2596
+ "browserslist": ">= 4.21.0"
2597
+ }
2598
+ },
2599
+ "node_modules/use-sync-external-store": {
2600
+ "version": "1.7.0",
2601
+ "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.7.0.tgz",
2602
+ "integrity": "sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==",
2603
+ "license": "MIT",
2604
+ "peerDependencies": {
2605
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
2606
+ }
2607
+ },
2608
+ "node_modules/util-deprecate": {
2609
+ "version": "1.0.2",
2610
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
2611
+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
2612
+ "dev": true,
2613
+ "license": "MIT"
2614
+ },
2615
+ "node_modules/vite": {
2616
+ "version": "5.4.21",
2617
+ "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz",
2618
+ "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
2619
+ "dev": true,
2620
+ "license": "MIT",
2621
+ "dependencies": {
2622
+ "esbuild": "^0.21.3",
2623
+ "postcss": "^8.4.43",
2624
+ "rollup": "^4.20.0"
2625
+ },
2626
+ "bin": {
2627
+ "vite": "bin/vite.js"
2628
+ },
2629
+ "engines": {
2630
+ "node": "^18.0.0 || >=20.0.0"
2631
+ },
2632
+ "funding": {
2633
+ "url": "https://github.com/vitejs/vite?sponsor=1"
2634
+ },
2635
+ "optionalDependencies": {
2636
+ "fsevents": "~2.3.3"
2637
+ },
2638
+ "peerDependencies": {
2639
+ "@types/node": "^18.0.0 || >=20.0.0",
2640
+ "less": "*",
2641
+ "lightningcss": "^1.21.0",
2642
+ "sass": "*",
2643
+ "sass-embedded": "*",
2644
+ "stylus": "*",
2645
+ "sugarss": "*",
2646
+ "terser": "^5.4.0"
2647
+ },
2648
+ "peerDependenciesMeta": {
2649
+ "@types/node": {
2650
+ "optional": true
2651
+ },
2652
+ "less": {
2653
+ "optional": true
2654
+ },
2655
+ "lightningcss": {
2656
+ "optional": true
2657
+ },
2658
+ "sass": {
2659
+ "optional": true
2660
+ },
2661
+ "sass-embedded": {
2662
+ "optional": true
2663
+ },
2664
+ "stylus": {
2665
+ "optional": true
2666
+ },
2667
+ "sugarss": {
2668
+ "optional": true
2669
+ },
2670
+ "terser": {
2671
+ "optional": true
2672
+ }
2673
+ }
2674
+ },
2675
+ "node_modules/yallist": {
2676
+ "version": "3.1.1",
2677
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
2678
+ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
2679
+ "dev": true,
2680
+ "license": "ISC"
2681
+ },
2682
+ "node_modules/zustand": {
2683
+ "version": "4.5.7",
2684
+ "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.5.7.tgz",
2685
+ "integrity": "sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw==",
2686
+ "license": "MIT",
2687
+ "dependencies": {
2688
+ "use-sync-external-store": "^1.2.2"
2689
+ },
2690
+ "engines": {
2691
+ "node": ">=12.7.0"
2692
+ },
2693
+ "peerDependencies": {
2694
+ "@types/react": ">=16.8",
2695
+ "immer": ">=9.0.6",
2696
+ "react": ">=16.8"
2697
+ },
2698
+ "peerDependenciesMeta": {
2699
+ "@types/react": {
2700
+ "optional": true
2701
+ },
2702
+ "immer": {
2703
+ "optional": true
2704
+ },
2705
+ "react": {
2706
+ "optional": true
2707
+ }
2708
+ }
2709
+ }
2710
+ }
2711
+ }
package.json CHANGED
@@ -9,10 +9,12 @@
9
  "preview": "vite preview"
10
  },
11
  "dependencies": {
 
 
 
12
  "react": "^18.3.1",
13
  "react-dom": "^18.3.1",
14
- "zustand": "^4.5.5",
15
- "lucide-react": "^0.441.0"
16
  },
17
  "devDependencies": {
18
  "@vitejs/plugin-react": "^4.3.4",
 
9
  "preview": "vite preview"
10
  },
11
  "dependencies": {
12
+ "dompurify": "^3.5.0",
13
+ "lucide-react": "^0.441.0",
14
+ "marked": "^18.3.0",
15
  "react": "^18.3.1",
16
  "react-dom": "^18.3.1",
17
+ "zustand": "^4.5.5"
 
18
  },
19
  "devDependencies": {
20
  "@vitejs/plugin-react": "^4.3.4",
src/App.jsx CHANGED
@@ -1,207 +1,46 @@
1
- import { useState, useEffect } from 'react'
2
- import { Settings, MessageSquare, Play, Sun, Moon, Download, Save } from 'lucide-react'
3
- import ChatInterface from './components/ChatInterface'
4
- import AgentInterface from './components/AgentInterface'
5
- import ExportDialog from './components/ExportDialog'
6
-
7
- const DEFAULT_CONFIG = {
8
- supplier: 'https://openrouter.ai/api/v1',
9
- apiKey: '',
10
- model: 'nvidia/nemotron-3-ultra-550b-a55b:free',
11
- }
12
- const CONFIG_KEY = 'agentStudioConfig'
13
- const CONFIGS_KEY = 'agentStudioConfigs'
14
-
15
- function loadInitialConfig() {
16
- try {
17
- const raw = localStorage.getItem(CONFIG_KEY)
18
- if (raw) return { ...DEFAULT_CONFIG, ...JSON.parse(raw) }
19
- } catch { /* 讀取失敗就用預設值 */ }
20
- return DEFAULT_CONFIG
21
- }
22
-
23
- function SettingsModal({ apiConfig, onApply, onDuplicate, savedConfigs, onLoadSaved, onClose }) {
24
- const [draft, setDraft] = useState(apiConfig)
25
- const set = (field, value) => setDraft({ ...draft, [field]: value })
26
-
27
- return (
28
- <div className="fixed inset-0 bg-black/80 flex items-center justify-center z-50">
29
- <div className="bg-panel p-8 rounded-3xl w-full max-w-md border border-edge">
30
- <h2 className="text-2xl font-bold mb-6">API 連線設定</h2>
31
- <div className="space-y-5">
32
- <div>
33
- <label className="block text-sm mb-1">供應商 API URL</label>
34
- <input
35
- type="text"
36
- value={draft.supplier}
37
- onChange={(e) => set('supplier', e.target.value)}
38
- placeholder="https://openrouter.ai/api/v1"
39
- className="w-full bg-field px-4 py-3 rounded-2xl focus:outline-none"
40
- />
41
- </div>
42
- <div>
43
- <label className="block text-sm mb-1">API Key</label>
44
- <input
45
- type="password"
46
- value={draft.apiKey}
47
- onChange={(e) => set('apiKey', e.target.value)}
48
- placeholder="sk-..."
49
- className="w-full bg-field px-4 py-3 rounded-2xl focus:outline-none"
50
- />
51
- <p className="text-xs text-muted mt-1">
52
- 只存在你的瀏覽器 localStorage,不會送到任何伺服器。
53
- </p>
54
- </div>
55
- <div>
56
- <label className="block text-sm mb-1">Model</label>
57
- <input
58
- type="text"
59
- value={draft.model}
60
- onChange={(e) => set('model', e.target.value)}
61
- placeholder="nvidia/nemotron-3-ultra-550b-a55b:free"
62
- className="w-full bg-field px-4 py-3 rounded-2xl focus:outline-none"
63
- />
64
- </div>
65
- </div>
66
-
67
- <div className="flex gap-3 mt-7">
68
- <button
69
- onClick={() => onApply({ ...draft })}
70
- className="flex-1 flex items-center justify-center gap-2 bg-purple-600 py-3 rounded-2xl font-medium"
71
- >
72
- <Save className="w-4 h-4" /> 套用並關閉
73
- </button>
74
- <button
75
- onClick={() => onDuplicate({ ...draft })}
76
- className="px-4 py-3 bg-field rounded-2xl"
77
- title="另存為可切換的配置"
78
- >
79
- <Save className="w-4 h-4" />
80
- </button>
81
- <button onClick={onClose} className="px-6 bg-red-600 rounded-2xl">關閉</button>
82
- </div>
83
-
84
- {savedConfigs.length > 0 && (
85
- <div className="mt-6">
86
- <p className="text-xs text-muted mb-2">已儲存配置(點一下套用):</p>
87
- <div className="space-y-1">
88
- {savedConfigs.map((c, i) => (
89
- <button
90
- key={i}
91
- onClick={() => onLoadSaved(c)}
92
- className="w-full text-left text-xs text-blue-400 hover:underline break-all"
93
- >
94
- {c.model || '(無模型)'} · {String(c.apiKey).slice(0, 6)}…
95
- </button>
96
- ))}
97
- </div>
98
- </div>
99
- )}
100
- </div>
101
- </div>
102
- )
103
- }
104
-
105
- function App() {
106
- const [view, setView] = useState('chat')
107
- const [showSettings, setShowSettings] = useState(false)
108
- const [showExport, setShowExport] = useState(false)
109
- const [theme, setTheme] = useState(() => localStorage.getItem('theme') || 'dark')
110
- const [apiConfig, setApiConfig] = useState(loadInitialConfig)
111
- const [savedConfigs, setSavedConfigs] = useState(() => {
112
- try {
113
- return JSON.parse(localStorage.getItem(CONFIGS_KEY) || '[]')
114
- } catch {
115
- return []
116
- }
117
- })
118
 
119
  useEffect(() => {
120
  document.documentElement.classList.remove('theme-dark', 'theme-light')
121
  document.documentElement.classList.add(`theme-${theme}`)
122
- localStorage.setItem('theme', theme)
123
  }, [theme])
124
 
125
- // 金鑰與模型設定即時寫回 localStorage,重新整理不丟失
126
  useEffect(() => {
127
- localStorage.setItem(CONFIG_KEY, JSON.stringify(apiConfig))
128
- }, [apiConfig])
129
-
130
- const applyConfig = (config) => {
131
- setApiConfig(config)
132
- setShowSettings(false)
133
- }
134
 
135
- const duplicateConfig = () => {
136
- const updated = [...savedConfigs, apiConfig]
137
- setSavedConfigs(updated)
138
- localStorage.setItem(CONFIGS_KEY, JSON.stringify(updated))
139
- setShowSettings(false)
140
- }
141
 
142
  return (
143
- <div className="min-h-screen bg-app text-ink">
144
- <div className="max-w-7xl mx-auto p-4">
145
- <div className="flex items-center justify-between gap-3 flex-wrap mb-6">
146
- <div className="flex items-center gap-3">
147
- <img src="./vite.svg" className="w-8 h-8" alt="Agent" />
148
- <h1 className="text-3xl font-bold">Agent Studio</h1>
149
- </div>
150
- <div className="flex gap-2 flex-wrap">
151
- <button
152
- onClick={() => setView('chat')}
153
- className={`px-4 py-2 rounded-xl flex items-center gap-2 ${view === 'chat' ? 'bg-blue-600' : 'bg-field'}`}
154
- >
155
- <MessageSquare className="w-4 h-4" /> 聊天
156
- </button>
157
- <button
158
- onClick={() => setView('agent')}
159
- className={`px-4 py-2 rounded-xl flex items-center gap-2 ${view === 'agent' ? 'bg-purple-600' : 'bg-field'}`}
160
- >
161
- <Play className="w-4 h-4" /> Agent
162
- </button>
163
- <button
164
- onClick={() => setShowSettings(true)}
165
- className="flex items-center gap-2 px-4 py-2 bg-field rounded-xl"
166
- >
167
- <Settings className="w-4 h-4" /> 設定
168
- </button>
169
- <button
170
- onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
171
- className="flex items-center gap-2 px-4 py-2 bg-field rounded-xl"
172
- title={theme === 'dark' ? '切換亮色' : '切換深色'}
173
- >
174
- {theme === 'dark' ? <Sun className="w-4 h-4" /> : <Moon className="w-4 h-4" />}
175
- </button>
176
- <button
177
- onClick={() => setShowExport(true)}
178
- className="flex items-center gap-2 px-4 py-2 bg-field rounded-xl"
179
- >
180
- <Download className="w-4 h-4" /> 匯出
181
- </button>
182
- </div>
183
- </div>
184
-
185
- {view === 'chat' ? (
186
- <ChatInterface apiConfig={apiConfig} onChange={setApiConfig} />
187
- ) : (
188
- <AgentInterface apiConfig={apiConfig} onOpenSettings={() => setShowSettings(true)} />
189
- )}
190
- </div>
191
-
192
- {showSettings && (
193
- <SettingsModal
194
- apiConfig={apiConfig}
195
- onApply={applyConfig}
196
- onDuplicate={duplicateConfig}
197
- savedConfigs={savedConfigs}
198
- onLoadSaved={(c) => applyConfig(c)}
199
- onClose={() => setShowSettings(false)}
200
- />
201
- )}
202
- {showExport && <ExportDialog onClose={() => setShowExport(false)} />}
203
  </div>
204
  )
205
  }
206
-
207
- export default App
 
1
+ import { useEffect, useState } from 'react'
2
+ import { useStore } from './store/useStore'
3
+ import Sidebar from './components/Sidebar'
4
+ import ChatView from './components/ChatView'
5
+
6
+ export default function App() {
7
+ const theme = useStore((s) => s.settings.theme)
8
+ const mobileOpen = useStore((s) => s.sidebarOpen)
9
+ const setMobileOpen = useStore((s) => s.setSidebarOpen)
10
+ const [tab, setTab] = useState('project')
11
+ const [desktopCollapsed, setDesktopCollapsed] = useState(() => localStorage.getItem('agentStudio.sidebarCollapsed') === '1')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  useEffect(() => {
14
  document.documentElement.classList.remove('theme-dark', 'theme-light')
15
  document.documentElement.classList.add(`theme-${theme}`)
 
16
  }, [theme])
17
 
 
18
  useEffect(() => {
19
+ localStorage.setItem('agentStudio.sidebarCollapsed', desktopCollapsed ? '1' : '0')
20
+ }, [desktopCollapsed])
 
 
 
 
 
21
 
22
+ // 行動版按返回鍵 / Esc 關閉側邊欄
23
+ useEffect(() => {
24
+ const onKey = (e) => e.key === 'Escape' && setMobileOpen(false)
25
+ window.addEventListener('keydown', onKey)
26
+ return () => window.removeEventListener('keydown', onKey)
27
+ }, [setMobileOpen])
28
 
29
  return (
30
+ <div className="h-[100dvh] flex bg-app text-ink overflow-hidden">
31
+ <Sidebar
32
+ tab={tab}
33
+ setTab={setTab}
34
+ mobileOpen={mobileOpen}
35
+ onCloseMobile={() => setMobileOpen(false)}
36
+ desktopCollapsed={desktopCollapsed}
37
+ onCollapseDesktop={() => setDesktopCollapsed(true)}
38
+ />
39
+ <ChatView
40
+ onOpenSidebar={(t) => { if (t) setTab(t); setMobileOpen(true) }}
41
+ desktopCollapsed={desktopCollapsed}
42
+ onExpandDesktop={() => setDesktopCollapsed(false)}
43
+ />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  </div>
45
  )
46
  }
 
 
src/components/ChatView.jsx ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useEffect, useRef, useState } from 'react'
2
+ import {
3
+ Menu, Send, Square, Wrench, Copy, Trash2, RotateCcw, Brain, Loader2, Check, PanelLeftOpen, Plus,
4
+ } from 'lucide-react'
5
+ import { useStore, useActiveConversation, useActiveProject } from '../store/useStore'
6
+ import Markdown from './Markdown'
7
+
8
+ function CopyBtn({ text }) {
9
+ const [ok, setOk] = useState(false)
10
+ return (
11
+ <button
12
+ type="button"
13
+ title="複製"
14
+ className="p-1 rounded hover:bg-field text-muted"
15
+ onClick={async () => {
16
+ try { await navigator.clipboard.writeText(text); setOk(true); setTimeout(() => setOk(false), 1200) } catch { /* ignore */ }
17
+ }}
18
+ >
19
+ {ok ? <Check className="w-3.5 h-3.5" /> : <Copy className="w-3.5 h-3.5" />}
20
+ </button>
21
+ )
22
+ }
23
+
24
+ function ToolCallBlock({ call, result }) {
25
+ let args = call.function?.arguments || ''
26
+ try { args = JSON.stringify(JSON.parse(args), null, 2) } catch { /* 串流中可能還不完整 */ }
27
+ const pending = !result || result.pending
28
+ return (
29
+ <details className="mt-2 rounded-lg border border-edge bg-app text-sm group">
30
+ <summary className="cursor-pointer select-none px-3 py-2 flex items-center gap-2 text-amber-500">
31
+ {pending ? <Loader2 className="w-3.5 h-3.5 animate-spin" /> : <Wrench className="w-3.5 h-3.5" />}
32
+ <span className="font-medium">{call.function?.name || '…'}</span>
33
+ <span className="text-xs text-muted truncate">
34
+ {pending ? '執行中…' : String(result.content).slice(0, 60).replace(/\s+/g, ' ')}
35
+ </span>
36
+ </summary>
37
+ <div className="px-3 pb-3 space-y-2">
38
+ <div>
39
+ <div className="text-[11px] text-muted mb-1">參數</div>
40
+ <pre className="text-xs whitespace-pre-wrap break-words bg-field rounded p-2">{args || '{}'}</pre>
41
+ </div>
42
+ {result && !result.pending && (
43
+ <div>
44
+ <div className="text-[11px] text-muted mb-1 flex items-center justify-between">結果 <CopyBtn text={String(result.content)} /></div>
45
+ <pre className="text-xs whitespace-pre-wrap break-words bg-field rounded p-2 max-h-80 overflow-y-auto">{String(result.content)}</pre>
46
+ </div>
47
+ )}
48
+ </div>
49
+ </details>
50
+ )
51
+ }
52
+
53
+ function AssistantMessage({ msg, results, onDelete, agentIcon }) {
54
+ const isError = msg.error
55
+ const isInfo = msg.info
56
+ return (
57
+ <div className="group flex gap-3">
58
+ <div className="w-8 h-8 shrink-0 rounded-full bg-field flex items-center justify-center text-base">{agentIcon || '🤖'}</div>
59
+ <div className="min-w-0 flex-1">
60
+ {msg.reasoning && (
61
+ <details className="mb-2 text-sm" open={msg.streaming && !msg.content}>
62
+ <summary className="cursor-pointer select-none text-muted flex items-center gap-1.5">
63
+ <Brain className="w-3.5 h-3.5" /> 推理過程
64
+ </summary>
65
+ <div className="mt-1 pl-3 border-l-2 border-edge text-muted whitespace-pre-wrap text-xs leading-relaxed">{msg.reasoning}</div>
66
+ </details>
67
+ )}
68
+ {(msg.content || (msg.streaming && !msg.tool_calls?.length && !msg.reasoning)) && (
69
+ <div
70
+ className={`rounded-2xl px-4 py-3 ${isError ? 'bg-red-900/40 text-red-300 border border-red-900' : isInfo ? 'bg-field text-muted text-sm' : 'bg-panel border border-edge'} ${msg.streaming ? 'cursor-blink' : ''}`}
71
+ >
72
+ {msg.content ? <Markdown text={msg.content} /> : <span className="text-muted text-sm">思考中</span>}
73
+ </div>
74
+ )}
75
+ {(msg.tool_calls || []).map((c, i) => <ToolCallBlock key={c.id || i} call={c} result={results[c.id]} />)}
76
+ {!msg.streaming && (
77
+ <div className="flex items-center gap-1 mt-1 opacity-100 md:opacity-0 md:group-hover:opacity-100 transition">
78
+ {msg.content && <CopyBtn text={msg.content} />}
79
+ <button type="button" title="刪除這則" className="p-1 rounded hover:bg-field text-muted" onClick={onDelete}>
80
+ <Trash2 className="w-3.5 h-3.5" />
81
+ </button>
82
+ {msg.model && <span className="text-[11px] text-muted ml-1 truncate">{msg.model}</span>}
83
+ </div>
84
+ )}
85
+ </div>
86
+ </div>
87
+ )
88
+ }
89
+
90
+ export default function ChatView({ onOpenSidebar, desktopCollapsed, onExpandDesktop }) {
91
+ const conv = useActiveConversation()
92
+ const project = useActiveProject()
93
+ const agents = useStore((s) => s.agents)
94
+ const providers = useStore((s) => s.providers)
95
+ const running = useStore((s) => (conv ? s.running[conv.id] : 0))
96
+ const { send, stop, regenerate, deleteMessage, createConversation } = useStore.getState()
97
+ const [input, setInput] = useState('')
98
+ const scrollRef = useRef(null)
99
+ const stickRef = useRef(true)
100
+ const taRef = useRef(null)
101
+
102
+ const agent = agents.find((a) => a.id === conv?.agentId)
103
+ const provider = providers.find((p) => p.id === conv?.providerId)
104
+
105
+ // 使用者沒往上捲時自動捲到底
106
+ useEffect(() => {
107
+ const el = scrollRef.current
108
+ if (el && stickRef.current) el.scrollTop = el.scrollHeight
109
+ }, [conv?.messages])
110
+
111
+ useEffect(() => {
112
+ const ta = taRef.current
113
+ if (!ta) return
114
+ ta.style.height = 'auto'
115
+ ta.style.height = `${Math.min(ta.scrollHeight, 220)}px`
116
+ }, [input])
117
+
118
+ const submit = async () => {
119
+ const text = input.trim()
120
+ if (!text || running) return
121
+ let id = conv?.id
122
+ if (!id) id = createConversation()
123
+ setInput('')
124
+ stickRef.current = true
125
+ await useStore.getState().send(id, text)
126
+ }
127
+
128
+ const results = {}
129
+ ;(conv?.messages || []).forEach((m) => { if (m.role === 'tool') results[m.tool_call_id] = m })
130
+ const lastIsAssistant = conv?.messages?.length && conv.messages[conv.messages.length - 1].role !== 'user'
131
+
132
+ return (
133
+ <div className="flex flex-col h-full min-w-0 flex-1">
134
+ {/* 頂列:只有開關側邊欄與標題,所有設定都在側邊欄 */}
135
+ <div className="h-12 shrink-0 flex items-center gap-2 px-3 border-b border-edge bg-panel">
136
+ <button type="button" className="md:hidden p-2 -ml-1 rounded-lg hover:bg-field" onClick={() => onOpenSidebar()} aria-label="開啟側邊欄">
137
+ <Menu className="w-5 h-5" />
138
+ </button>
139
+ {desktopCollapsed && (
140
+ <button type="button" className="hidden md:inline-flex p-2 -ml-1 rounded-lg hover:bg-field" onClick={onExpandDesktop} title="展開側邊欄">
141
+ <PanelLeftOpen className="w-5 h-5" />
142
+ </button>
143
+ )}
144
+ <div className="min-w-0 flex-1">
145
+ <div className="text-sm font-semibold truncate">{conv?.title || '新對話'}</div>
146
+ <div className="text-[11px] text-muted truncate">
147
+ {project?.name} · {agent ? `${agent.icon} ${agent.name}` : '未選 Agent'} · {provider ? `${provider.name} / ${conv?.model || '未選模型'}` : '未選供應商'}
148
+ </div>
149
+ </div>
150
+ <button type="button" className="md:hidden p-2 rounded-lg hover:bg-field" onClick={() => onOpenSidebar('conversation')} title="對話設定">
151
+ <span className="text-lg leading-none">{agent?.icon || '🤖'}</span>
152
+ </button>
153
+ </div>
154
+
155
+ <div
156
+ ref={scrollRef}
157
+ onScroll={(e) => {
158
+ const el = e.currentTarget
159
+ stickRef.current = el.scrollHeight - el.scrollTop - el.clientHeight < 80
160
+ }}
161
+ className="flex-1 overflow-y-auto"
162
+ >
163
+ <div className="max-w-3xl mx-auto px-3 md:px-6 py-6 space-y-5">
164
+ {(!conv || conv.messages.length === 0) && (
165
+ <div className="text-center text-muted py-16 space-y-3">
166
+ <div className="text-5xl">{agent?.icon || '💬'}</div>
167
+ <div className="text-lg text-ink font-semibold">{agent?.name || '開始新對話'}</div>
168
+ <p className="text-sm">{agent?.description || '輸入訊息開始'}</p>
169
+ <p className="text-xs">
170
+ 專案「{project?.name}」· 可用工具 {agent?.tools?.length || 0} 個
171
+ </p>
172
+ {!conv && (
173
+ <button type="button" onClick={() => createConversation()} className="inline-flex items-center gap-1.5 text-sm px-3 py-2 rounded-lg bg-field hover:bg-edge text-ink">
174
+ <Plus className="w-4 h-4" /> 新對話
175
+ </button>
176
+ )}
177
+ </div>
178
+ )}
179
+
180
+ {(conv?.messages || []).map((m) => {
181
+ if (m.role === 'tool') return null // 結果併入對應的工具呼叫區塊顯示
182
+ if (m.role === 'user') {
183
+ return (
184
+ <div key={m.id} className="group flex justify-end">
185
+ <div className="max-w-[85%]">
186
+ <div className="bg-purple-600 text-white rounded-2xl px-4 py-3 whitespace-pre-wrap break-words">{m.content}</div>
187
+ <div className="flex justify-end gap-1 mt-1 opacity-100 md:opacity-0 md:group-hover:opacity-100 transition">
188
+ <CopyBtn text={m.content} />
189
+ {!running && (
190
+ <button type="button" title="刪除這則" className="p-1 rounded hover:bg-field text-muted" onClick={() => deleteMessage(conv.id, m.id)}>
191
+ <Trash2 className="w-3.5 h-3.5" />
192
+ </button>
193
+ )}
194
+ </div>
195
+ </div>
196
+ </div>
197
+ )
198
+ }
199
+ return (
200
+ <AssistantMessage
201
+ key={m.id}
202
+ msg={m}
203
+ results={results}
204
+ agentIcon={agents.find((a) => a.id === m.agentId)?.icon || agent?.icon}
205
+ onDelete={() => !running && deleteMessage(conv.id, m.id)}
206
+ />
207
+ )
208
+ })}
209
+
210
+ {running > 0 && (
211
+ <div className="flex items-center gap-2 text-xs text-muted pl-11">
212
+ <Loader2 className="w-3.5 h-3.5 animate-spin" /> 第 {running} 步執行中(不設逾時,可隨時停止)
213
+ </div>
214
+ )}
215
+ {!running && lastIsAssistant && (
216
+ <div className="pl-11">
217
+ <button type="button" onClick={() => regenerate(conv.id)} className="inline-flex items-center gap-1.5 text-xs text-muted hover:text-ink">
218
+ <RotateCcw className="w-3.5 h-3.5" /> 重新生成
219
+ </button>
220
+ </div>
221
+ )}
222
+ </div>
223
+ </div>
224
+
225
+ <div className="shrink-0 border-t border-edge bg-panel px-3 md:px-6 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]">
226
+ <div className="max-w-3xl mx-auto flex items-end gap-2">
227
+ <textarea
228
+ ref={taRef}
229
+ rows={1}
230
+ value={input}
231
+ onChange={(e) => setInput(e.target.value)}
232
+ onKeyDown={(e) => {
233
+ if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
234
+ e.preventDefault()
235
+ submit()
236
+ }
237
+ }}
238
+ placeholder={`傳訊息給 ${agent?.name || 'Agent'}…`}
239
+ className="flex-1 resize-none bg-field border border-edge rounded-2xl px-4 py-3 text-[15px] focus:outline-none focus:border-purple-500 max-h-[220px]"
240
+ />
241
+ {running ? (
242
+ <button type="button" onClick={() => stop(conv.id)} className="h-12 w-12 shrink-0 rounded-2xl bg-red-600 hover:bg-red-700 text-white flex items-center justify-center" title="停止">
243
+ <Square className="w-4 h-4 fill-current" />
244
+ </button>
245
+ ) : (
246
+ <button type="button" onClick={submit} disabled={!input.trim()} className="h-12 w-12 shrink-0 rounded-2xl bg-purple-600 hover:bg-purple-700 text-white flex items-center justify-center disabled:opacity-40" title="送出">
247
+ <Send className="w-4 h-4" />
248
+ </button>
249
+ )}
250
+ </div>
251
+ </div>
252
+ </div>
253
+ )
254
+ }
src/components/Markdown.jsx ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useMemo } from 'react'
2
+ import { marked } from 'marked'
3
+ import DOMPurify from 'dompurify'
4
+
5
+ marked.setOptions({ gfm: true, breaks: true })
6
+
7
+ // 連結一律開新分頁
8
+ DOMPurify.addHook('afterSanitizeAttributes', (node) => {
9
+ if (node.tagName === 'A') {
10
+ node.setAttribute('target', '_blank')
11
+ node.setAttribute('rel', 'noopener noreferrer')
12
+ }
13
+ })
14
+
15
+ /** 模型輸出 → Markdown → HTML,經 DOMPurify 消毒後才插入,避免 XSS */
16
+ export default function Markdown({ text }) {
17
+ const html = useMemo(() => DOMPurify.sanitize(marked.parse(String(text || ''))), [text])
18
+ return <div className="md" dangerouslySetInnerHTML={{ __html: html }} />
19
+ }
src/components/Sidebar.jsx ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { X, PanelLeftClose, FolderKanban, SlidersHorizontal, Server, Bot, Wrench, Settings } from 'lucide-react'
2
+ import ProjectPanel from './panels/ProjectPanel'
3
+ import ConversationPanel from './panels/ConversationPanel'
4
+ import ModelsPanel from './panels/ModelsPanel'
5
+ import AgentsPanel from './panels/AgentsPanel'
6
+ import ToolsPanel from './panels/ToolsPanel'
7
+ import SettingsPanel from './panels/SettingsPanel'
8
+
9
+ const TABS = [
10
+ { id: 'project', label: '專案', icon: FolderKanban, Panel: ProjectPanel },
11
+ { id: 'conversation', label: '對話', icon: SlidersHorizontal, Panel: ConversationPanel },
12
+ { id: 'models', label: '模型', icon: Server, Panel: ModelsPanel },
13
+ { id: 'agents', label: 'Agent', icon: Bot, Panel: AgentsPanel },
14
+ { id: 'tools', label: '工具', icon: Wrench, Panel: ToolsPanel },
15
+ { id: 'settings', label: '設定', icon: Settings, Panel: SettingsPanel },
16
+ ]
17
+
18
+ /**
19
+ * 側邊欄:所有設定與操作都集中在這裡。
20
+ * - 桌面(md 以上):固定在左側,可收合
21
+ * - 行動版:抽屜,從左側滑出,點遮罩或 X 關閉
22
+ */
23
+ export default function Sidebar({ tab, setTab, mobileOpen, onCloseMobile, desktopCollapsed, onCollapseDesktop }) {
24
+ const Active = (TABS.find((t) => t.id === tab) || TABS[0]).Panel
25
+
26
+ return (
27
+ <>
28
+ {/* 行動版遮罩 */}
29
+ <div
30
+ className={`md:hidden fixed inset-0 z-30 bg-black/60 transition-opacity ${mobileOpen ? 'opacity-100' : 'opacity-0 pointer-events-none'}`}
31
+ onClick={onCloseMobile}
32
+ />
33
+ <aside
34
+ className={`fixed md:static z-40 inset-y-0 left-0 w-[86vw] max-w-[340px] md:w-[330px] shrink-0 flex flex-col bg-panel border-r border-edge
35
+ transition-transform duration-200 ${mobileOpen ? 'translate-x-0' : '-translate-x-full'} md:translate-x-0
36
+ ${desktopCollapsed ? 'md:hidden' : 'md:flex'}`}
37
+ >
38
+ <div className="h-12 shrink-0 flex items-center gap-2 px-3 border-b border-edge">
39
+ <img src="./vite.svg" className="w-6 h-6" alt="" />
40
+ <div className="font-bold flex-1">Agent Studio</div>
41
+ <button type="button" className="hidden md:inline-flex p-1.5 rounded-lg hover:bg-field" onClick={onCollapseDesktop} title="收合側邊欄">
42
+ <PanelLeftClose className="w-4 h-4" />
43
+ </button>
44
+ <button type="button" className="md:hidden p-1.5 rounded-lg hover:bg-field" onClick={onCloseMobile} aria-label="關閉側邊欄">
45
+ <X className="w-5 h-5" />
46
+ </button>
47
+ </div>
48
+
49
+ <nav className="shrink-0 grid grid-cols-6 border-b border-edge">
50
+ {TABS.map(({ id, label, icon: Icon }) => (
51
+ <button
52
+ key={id}
53
+ type="button"
54
+ onClick={() => setTab(id)}
55
+ className={`flex flex-col items-center gap-0.5 py-2 text-[11px] border-b-2 transition ${
56
+ tab === id ? 'border-purple-500 text-ink' : 'border-transparent text-muted hover:text-ink'
57
+ }`}
58
+ >
59
+ <Icon className="w-4 h-4" />
60
+ {label}
61
+ </button>
62
+ ))}
63
+ </nav>
64
+
65
+ <div className="flex-1 overflow-y-auto">
66
+ <Active onDone={onCloseMobile} goTab={setTab} />
67
+ </div>
68
+ </aside>
69
+ </>
70
+ )
71
+ }
src/components/panels/AgentsPanel.jsx ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from 'react'
2
+ import { Plus, Trash2, Copy, Save, RotateCcw, ArrowLeft } from 'lucide-react'
3
+ import { useStore } from '../../store/useStore'
4
+ import { BUILTIN_TOOLS } from '../../lib/tools'
5
+ import { uid } from '../../lib/providers'
6
+ import { Btn, Field, Section, inputCls } from '../ui'
7
+
8
+ function AgentEditor({ agent, onBack }) {
9
+ const customTools = useStore((s) => s.customTools)
10
+ const { saveAgent, removeAgent } = useStore.getState()
11
+ const [d, setD] = useState({ ...agent, tools: [...(agent.tools || [])] })
12
+ const all = [...BUILTIN_TOOLS.map((t) => ({ name: t.name, label: t.label })), ...customTools.map((t) => ({ name: t.name, label: `${t.name}(自訂)` }))]
13
+ const toggle = (name) => setD({ ...d, tools: d.tools.includes(name) ? d.tools.filter((x) => x !== name) : [...d.tools, name] })
14
+
15
+ return (
16
+ <div className="p-3 space-y-3">
17
+ <button type="button" onClick={onBack} className="text-xs text-muted hover:text-ink inline-flex items-center gap-1"><ArrowLeft className="w-3.5 h-3.5" /> 返回清單</button>
18
+ <div className="flex gap-2">
19
+ <Field label="圖示"><input className={`${inputCls} w-16 text-center`} value={d.icon} onChange={(e) => setD({ ...d, icon: e.target.value })} /></Field>
20
+ <div className="flex-1"><Field label="名稱"><input className={inputCls} value={d.name} onChange={(e) => setD({ ...d, name: e.target.value })} /></Field></div>
21
+ </div>
22
+ <Field label="說明"><input className={inputCls} value={d.description} onChange={(e) => setD({ ...d, description: e.target.value })} /></Field>
23
+ <Field label="System prompt">
24
+ <textarea className={`${inputCls} text-xs leading-relaxed`} rows={8} value={d.systemPrompt} onChange={(e) => setD({ ...d, systemPrompt: e.target.value })} />
25
+ </Field>
26
+ <div>
27
+ <div className="text-xs text-muted mb-1 flex justify-between">
28
+ 啟用工具({d.tools.length})
29
+ <span className="space-x-2">
30
+ <button type="button" className="hover:text-ink" onClick={() => setD({ ...d, tools: all.map((t) => t.name) })}>全選</button>
31
+ <button type="button" className="hover:text-ink" onClick={() => setD({ ...d, tools: [] })}>全不選</button>
32
+ </span>
33
+ </div>
34
+ <div className="grid grid-cols-2 gap-1">
35
+ {all.map((t) => (
36
+ <label key={t.name} className="flex items-center gap-1.5 text-xs bg-field rounded px-2 py-1.5 cursor-pointer">
37
+ <input type="checkbox" checked={d.tools.includes(t.name)} onChange={() => toggle(t.name)} />
38
+ <span className="truncate" title={t.name}>{t.label}</span>
39
+ </label>
40
+ ))}
41
+ </div>
42
+ </div>
43
+ <div className="flex gap-2">
44
+ <Btn variant="primary" className="flex-1" onClick={() => { saveAgent(d); onBack() }}><Save className="w-4 h-4" /> 儲存</Btn>
45
+ <Btn title="複製成新角色" onClick={() => { saveAgent({ ...d, id: uid(), name: `${d.name}(副本)`, builtin: false }); onBack() }}><Copy className="w-4 h-4" /></Btn>
46
+ <Btn variant="danger" title="刪除" onClick={() => { if (confirm(`刪除 Agent「${d.name}」?`)) { removeAgent(d.id); onBack() } }}><Trash2 className="w-4 h-4" /></Btn>
47
+ </div>
48
+ </div>
49
+ )
50
+ }
51
+
52
+ export default function AgentsPanel() {
53
+ const agents = useStore((s) => s.agents)
54
+ const [editing, setEditing] = useState(null)
55
+
56
+ if (editing) {
57
+ const agent = agents.find((a) => a.id === editing) || { id: editing, name: '新角色', icon: '🤖', description: '', systemPrompt: '你是一個樂於助人的助手。', tools: ['web_search'] }
58
+ return <AgentEditor key={editing} agent={agent} onBack={() => setEditing(null)} />
59
+ }
60
+
61
+ return (
62
+ <div>
63
+ <Section title={`Agent 角色(${agents.length})`}>
64
+ <p className="text-[11px] text-muted">每個角色有自己的 system prompt 與工具組合。點一下編輯。</p>
65
+ <div className="space-y-1.5">
66
+ {agents.map((a) => (
67
+ <button key={a.id} type="button" onClick={() => setEditing(a.id)} className="w-full text-left px-3 py-2 rounded-lg bg-field hover:bg-edge flex items-center gap-3">
68
+ <span className="text-xl">{a.icon}</span>
69
+ <span className="min-w-0 flex-1">
70
+ <span className="block text-sm font-medium truncate">{a.name}{a.builtin ? '' : ' ✦'}</span>
71
+ <span className="block text-[11px] text-muted truncate">{a.description}</span>
72
+ </span>
73
+ <span className="text-[11px] text-muted">{a.tools?.length || 0}🔧</span>
74
+ </button>
75
+ ))}
76
+ </div>
77
+ <div className="flex gap-2">
78
+ <Btn variant="primary" className="flex-1" onClick={() => setEditing(uid())}><Plus className="w-4 h-4" /> 新角色</Btn>
79
+ <Btn title="還原內建角色" onClick={() => confirm('把內建角色還原成預設?(自建角色不受影響)') && useStore.getState().resetBuiltinAgents()}>
80
+ <RotateCcw className="w-4 h-4" />
81
+ </Btn>
82
+ </div>
83
+ </Section>
84
+ </div>
85
+ )
86
+ }
src/components/panels/ConversationPanel.jsx ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Download, Eraser, FileText, Plus } from 'lucide-react'
2
+ import { useStore, useActiveConversation } from '../../store/useStore'
3
+ import { Btn, Field, Section, inputCls, download, stamp } from '../ui'
4
+ import ModelPicker from './ModelPicker'
5
+
6
+ function toMarkdown(conv, agents) {
7
+ const lines = [`# ${conv.title}`, '', `> 匯出於 ${new Date().toLocaleString()} · 模型 ${conv.model}`, '']
8
+ for (const m of conv.messages) {
9
+ if (m.role === 'user') lines.push('## 🧑 使用者', '', m.content, '')
10
+ else if (m.role === 'assistant') {
11
+ const a = agents.find((x) => x.id === m.agentId)
12
+ if (m.content) lines.push(`## ${a?.icon || '🤖'} ${a?.name || 'Assistant'}`, '', m.content, '')
13
+ for (const c of m.tool_calls || []) lines.push(`> 🔧 呼叫 \`${c.function?.name}\` ${c.function?.arguments || ''}`, '')
14
+ } else if (m.role === 'tool') {
15
+ lines.push(`<details><summary>🔧 ${m.name} 結果</summary>`, '', '```', String(m.content), '```', '</details>', '')
16
+ }
17
+ }
18
+ return lines.join('\n')
19
+ }
20
+
21
+ export default function ConversationPanel({ onDone }) {
22
+ const conv = useActiveConversation()
23
+ const agents = useStore((s) => s.agents)
24
+ const running = useStore((s) => (conv ? s.running[conv.id] : 0))
25
+ const st = useStore.getState()
26
+
27
+ if (!conv) {
28
+ return (
29
+ <div className="p-4 space-y-3 text-sm text-muted">
30
+ <p>目前沒有開啟的對話。</p>
31
+ <Btn variant="primary" className="w-full" onClick={() => st.createConversation()}>
32
+ <Plus className="w-4 h-4" /> 新對話
33
+ </Btn>
34
+ </div>
35
+ )
36
+ }
37
+ const agent = agents.find((a) => a.id === conv.agentId)
38
+ const up = (patch) => st.updateConversation(conv.id, patch)
39
+
40
+ return (
41
+ <div>
42
+ <Section title="目前對話">
43
+ <Field label="標題">
44
+ <input className={inputCls} value={conv.title} onChange={(e) => up({ title: e.target.value })} />
45
+ </Field>
46
+ <ModelPicker providerId={conv.providerId} model={conv.model} onChange={(providerId, model) => up({ providerId, model })} />
47
+ <p className="text-[11px] text-muted">對話途中可以隨時換模型或 Agent,下一輪就會生效。</p>
48
+ </Section>
49
+
50
+ <Section title="Agent 角色">
51
+ <div className="grid grid-cols-1 gap-1.5">
52
+ {agents.map((a) => (
53
+ <button
54
+ key={a.id}
55
+ type="button"
56
+ onClick={() => { up({ agentId: a.id }); onDone?.() }}
57
+ className={`text-left px-3 py-2 rounded-lg flex items-center gap-3 ${a.id === conv.agentId ? 'bg-purple-600/20 ring-1 ring-purple-500/60' : 'bg-field hover:bg-edge'}`}
58
+ >
59
+ <span className="text-xl">{a.icon}</span>
60
+ <span className="min-w-0">
61
+ <span className="block text-sm font-medium truncate">{a.name}</span>
62
+ <span className="block text-[11px] text-muted truncate">{a.description} · {a.tools?.length || 0} 個工具</span>
63
+ </span>
64
+ </button>
65
+ ))}
66
+ </div>
67
+ {agent && (
68
+ <p className="text-[11px] text-muted">
69
+ 啟用工具:{agent.tools?.length ? agent.tools.join('、') : '無'}(到「Agent」頁可修改)
70
+ </p>
71
+ )}
72
+ </Section>
73
+
74
+ <Section title="操作">
75
+ <div className="grid grid-cols-2 gap-2">
76
+ <Btn onClick={() => download(`chat-${conv.title}-${stamp()}.json`, JSON.stringify(st.exportData('conversation', { id: conv.id }), null, 2))}>
77
+ <Download className="w-4 h-4" /> JSON
78
+ </Btn>
79
+ <Btn onClick={() => download(`chat-${conv.title}-${stamp()}.md`, toMarkdown(conv, agents), 'text/markdown')}>
80
+ <FileText className="w-4 h-4" /> Markdown
81
+ </Btn>
82
+ <Btn className="col-span-2" disabled={!!running || conv.messages.length === 0} onClick={() => confirm('清空這個對話的所有訊息?') && st.clearConversation(conv.id)}>
83
+ <Eraser className="w-4 h-4" /> 清空訊息
84
+ </Btn>
85
+ </div>
86
+ </Section>
87
+ </div>
88
+ )
89
+ }
src/components/panels/ModelPicker.jsx ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useStore } from '../../store/useStore'
2
+ import { Field, inputCls } from '../ui'
3
+
4
+ /** 供應商 + 模型選擇(模型可從清單選,也可手動輸入) */
5
+ export default function ModelPicker({ label = '模型', providerId, model, onChange }) {
6
+ const providers = useStore((s) => s.providers)
7
+ const provider = providers.find((p) => p.id === providerId)
8
+ const listId = `models-${providerId}`
9
+
10
+ return (
11
+ <Field label={label} hint={provider && !provider.models?.length ? '這個供應商還沒有模型清單,可直接輸入模型 id,或到「模型」頁按抓取。' : undefined}>
12
+ <div className="space-y-2">
13
+ <select
14
+ className={inputCls}
15
+ value={provider ? providerId : ''}
16
+ onChange={(e) => {
17
+ const p = providers.find((x) => x.id === e.target.value)
18
+ onChange(e.target.value, p?.models?.includes(model) ? model : p?.models?.[0] || '')
19
+ }}
20
+ >
21
+ <option value="" disabled>選擇供應商…</option>
22
+ {providers.map((p) => (
23
+ <option key={p.id} value={p.id}>
24
+ {p.name}{!p.noKey && !p.apiKey ? '(未填金鑰)' : ''}
25
+ </option>
26
+ ))}
27
+ </select>
28
+ <input
29
+ className={inputCls}
30
+ list={listId}
31
+ value={model || ''}
32
+ onChange={(e) => onChange(providerId, e.target.value)}
33
+ placeholder="模型 id,例如 openai/gpt-4o-mini"
34
+ disabled={!provider}
35
+ />
36
+ <datalist id={listId}>
37
+ {(provider?.models || []).map((m) => <option key={m} value={m} />)}
38
+ </datalist>
39
+ {provider?.models?.length > 0 && (
40
+ <select className={inputCls} value={provider.models.includes(model) ? model : ''} onChange={(e) => onChange(providerId, e.target.value)}>
41
+ <option value="" disabled>從清單選({provider.models.length} 個)…</option>
42
+ {provider.models.map((m) => <option key={m} value={m}>{m}</option>)}
43
+ </select>
44
+ )}
45
+ </div>
46
+ </Field>
47
+ )
48
+ }
src/components/panels/ModelsPanel.jsx ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from 'react'
2
+ import { Plus, Trash2, RefreshCw, X, Server } from 'lucide-react'
3
+ import { useStore } from '../../store/useStore'
4
+ import { PROVIDER_PRESETS, fetchModels } from '../../lib/providers'
5
+ import { Btn, Field, Section, inputCls } from '../ui'
6
+
7
+ function ProviderCard({ p }) {
8
+ const { updateProvider, removeProvider } = useStore.getState()
9
+ const [newModel, setNewModel] = useState('')
10
+ const [busy, setBusy] = useState(false)
11
+ const [msg, setMsg] = useState('')
12
+ const [filter, setFilter] = useState('')
13
+ const up = (patch) => updateProvider(p.id, patch)
14
+
15
+ const addModel = () => {
16
+ const m = newModel.trim()
17
+ if (m && !p.models.includes(m)) up({ models: [...p.models, m] })
18
+ setNewModel('')
19
+ }
20
+ const doFetch = async () => {
21
+ setBusy(true); setMsg('')
22
+ try {
23
+ const list = await fetchModels(p)
24
+ up({ models: [...new Set([...p.models, ...list])] })
25
+ setMsg(`抓到 ${list.length} 個模型`)
26
+ } catch (e) {
27
+ setMsg(`抓取失敗:${e.message}(可手動新增)`)
28
+ } finally { setBusy(false) }
29
+ }
30
+ const shown = filter ? p.models.filter((m) => m.toLowerCase().includes(filter.toLowerCase())) : p.models
31
+
32
+ return (
33
+ <details className="bg-field rounded-lg">
34
+ <summary className="cursor-pointer px-3 py-2.5 text-sm flex items-center gap-2">
35
+ <Server className="w-3.5 h-3.5 text-muted" />
36
+ <span className="flex-1 truncate font-medium">{p.name}</span>
37
+ <span className={`text-[11px] ${p.noKey || p.apiKey ? 'text-emerald-500' : 'text-red-400'}`}>
38
+ {p.noKey ? '免金鑰' : p.apiKey ? '已填金鑰' : '未填金鑰'}
39
+ </span>
40
+ <span className="text-[11px] text-muted">{p.models.length}</span>
41
+ </summary>
42
+ <div className="px-3 pb-3 space-y-3">
43
+ <Field label="名稱"><input className={inputCls} value={p.name} onChange={(e) => up({ name: e.target.value })} /></Field>
44
+ <Field label="API URL(OpenAI 相容,到 /v1 為止)">
45
+ <input className={inputCls} value={p.baseUrl} onChange={(e) => up({ baseUrl: e.target.value })} placeholder="https://.../v1" />
46
+ </Field>
47
+ <Field label="API Key" hint="只存在瀏覽器 localStorage,直接從瀏覽器連到供應商。">
48
+ <input type="password" className={inputCls} value={p.apiKey} onChange={(e) => up({ apiKey: e.target.value })} placeholder="sk-..." disabled={p.noKey} />
49
+ </Field>
50
+ <label className="flex items-center gap-2 text-xs text-muted">
51
+ <input type="checkbox" checked={!!p.noKey} onChange={(e) => up({ noKey: e.target.checked })} /> 不需要金鑰(本機模型)
52
+ </label>
53
+
54
+ <div>
55
+ <div className="text-xs text-muted mb-1 flex items-center justify-between">
56
+ 模型({p.models.length})
57
+ <button type="button" onClick={doFetch} disabled={busy} className="inline-flex items-center gap-1 text-purple-400 hover:underline disabled:opacity-50">
58
+ <RefreshCw className={`w-3 h-3 ${busy ? 'animate-spin' : ''}`} /> 抓取模型
59
+ </button>
60
+ </div>
61
+ {msg && <p className="text-[11px] text-muted mb-1">{msg}</p>}
62
+ {p.models.length > 8 && (
63
+ <input className={`${inputCls} mb-2`} placeholder="篩選模型…" value={filter} onChange={(e) => setFilter(e.target.value)} />
64
+ )}
65
+ <div className="max-h-48 overflow-y-auto space-y-1">
66
+ {shown.map((m) => (
67
+ <div key={m} className="flex items-center gap-2 text-xs bg-app rounded px-2 py-1">
68
+ <span className="flex-1 break-all">{m}</span>
69
+ <button type="button" className="text-muted hover:text-red-500" onClick={() => up({ models: p.models.filter((x) => x !== m) })}><X className="w-3 h-3" /></button>
70
+ </div>
71
+ ))}
72
+ </div>
73
+ <div className="flex gap-2 mt-2">
74
+ <input className={inputCls} value={newModel} onChange={(e) => setNewModel(e.target.value)} onKeyDown={(e) => e.key === 'Enter' && addModel()} placeholder="手動新增模型 id" />
75
+ <Btn onClick={addModel}><Plus className="w-4 h-4" /></Btn>
76
+ </div>
77
+ {p.models.length > 0 && (
78
+ <button type="button" className="text-[11px] text-muted hover:text-red-400 mt-1" onClick={() => confirm('清空這個供應商的模型清單?') && up({ models: [] })}>
79
+ 清空清單
80
+ </button>
81
+ )}
82
+ </div>
83
+
84
+ <Btn variant="danger" className="w-full" onClick={() => confirm(`刪除供應商「${p.name}」?`) && removeProvider(p.id)}>
85
+ <Trash2 className="w-4 h-4" /> 刪除供應商
86
+ </Btn>
87
+ </div>
88
+ </details>
89
+ )
90
+ }
91
+
92
+ export default function ModelsPanel() {
93
+ const providers = useStore((s) => s.providers)
94
+ const [preset, setPreset] = useState(0)
95
+ return (
96
+ <div>
97
+ <Section title={`供應商(${providers.length})`}>
98
+ <p className="text-[11px] text-muted">
99
+ 可同時設定多個��應商、每個供應商多個模型;在「對話」頁替每個對話選用,或在專案設定預設值。
100
+ </p>
101
+ <div className="space-y-2">
102
+ {providers.map((p) => <ProviderCard key={p.id} p={p} />)}
103
+ </div>
104
+ </Section>
105
+ <Section title="新增供應商">
106
+ <select className={inputCls} value={preset} onChange={(e) => setPreset(Number(e.target.value))}>
107
+ {PROVIDER_PRESETS.map((p, i) => <option key={p.name} value={i}>{p.name}</option>)}
108
+ </select>
109
+ <Btn variant="primary" className="w-full" onClick={() => useStore.getState().addProvider(PROVIDER_PRESETS[preset])}>
110
+ <Plus className="w-4 h-4" /> 新增
111
+ </Btn>
112
+ </Section>
113
+ </div>
114
+ )
115
+ }
src/components/panels/ProjectPanel.jsx ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from 'react'
2
+ import { Plus, Trash2, MessageSquare, Download, StickyNote, Pencil, Check, X } from 'lucide-react'
3
+ import { useStore, useActiveProject } from '../../store/useStore'
4
+ import { Btn, Field, Section, inputCls, download, stamp } from '../ui'
5
+ import ModelPicker from './ModelPicker'
6
+
7
+ function NoteItem({ note, projectId }) {
8
+ const { updateNote, removeNote } = useStore.getState()
9
+ const [edit, setEdit] = useState(false)
10
+ const [draft, setDraft] = useState(note)
11
+ if (edit) {
12
+ return (
13
+ <div className="space-y-2 bg-field rounded-lg p-2">
14
+ <input className={inputCls} value={draft.title} onChange={(e) => setDraft({ ...draft, title: e.target.value })} />
15
+ <textarea className={`${inputCls} font-mono text-xs`} rows={5} value={draft.content} onChange={(e) => setDraft({ ...draft, content: e.target.value })} />
16
+ <div className="flex gap-2">
17
+ <Btn variant="primary" className="flex-1" onClick={() => { updateNote(projectId, note.id, { title: draft.title, content: draft.content }); setEdit(false) }}>
18
+ <Check className="w-4 h-4" /> 儲存
19
+ </Btn>
20
+ <Btn onClick={() => setEdit(false)}><X className="w-4 h-4" /></Btn>
21
+ </div>
22
+ </div>
23
+ )
24
+ }
25
+ return (
26
+ <details className="bg-field rounded-lg group">
27
+ <summary className="cursor-pointer px-3 py-2 text-sm flex items-center gap-2">
28
+ <StickyNote className="w-3.5 h-3.5 text-amber-500 shrink-0" />
29
+ <span className="truncate flex-1">{note.title}</span>
30
+ <button type="button" onClick={(e) => { e.preventDefault(); setDraft(note); setEdit(true) }} className="text-muted hover:text-ink"><Pencil className="w-3.5 h-3.5" /></button>
31
+ <button type="button" onClick={(e) => { e.preventDefault(); if (confirm(`刪除筆記「${note.title}」?`)) removeNote(projectId, note.id) }} className="text-muted hover:text-red-500"><Trash2 className="w-3.5 h-3.5" /></button>
32
+ </summary>
33
+ <div className="px-3 pb-3 text-xs whitespace-pre-wrap text-muted">{note.content}</div>
34
+ </details>
35
+ )
36
+ }
37
+
38
+ export default function ProjectPanel({ onDone }) {
39
+ const project = useActiveProject()
40
+ const projects = useStore((s) => s.projects)
41
+ const agents = useStore((s) => s.agents)
42
+ const conversations = useStore((s) => s.conversations)
43
+ const activeConversationId = useStore((s) => s.activeConversationId)
44
+ const running = useStore((s) => s.running)
45
+ const st = useStore.getState()
46
+
47
+ const convs = Object.values(conversations)
48
+ .filter((c) => c.projectId === project.id)
49
+ .sort((a, b) => b.updatedAt.localeCompare(a.updatedAt))
50
+
51
+ const up = (patch) => st.updateProject(project.id, patch)
52
+
53
+ return (
54
+ <div>
55
+ <Section
56
+ title="專案"
57
+ right={
58
+ <button type="button" title="新專案" className="p-1 rounded hover:bg-field" onClick={() => {
59
+ const name = prompt('新專案名稱', '新專案')
60
+ if (name !== null) st.createProject(name.trim() || '新專案')
61
+ }}>
62
+ <Plus className="w-4 h-4" />
63
+ </button>
64
+ }
65
+ >
66
+ <div className="space-y-1">
67
+ {projects.map((p) => {
68
+ const count = Object.values(conversations).filter((c) => c.projectId === p.id).length
69
+ return (
70
+ <button
71
+ key={p.id}
72
+ type="button"
73
+ onClick={() => st.selectProject(p.id)}
74
+ className={`w-full text-left px-3 py-2 rounded-lg text-sm flex items-center gap-2 ${p.id === project.id ? 'bg-purple-600/20 text-ink ring-1 ring-purple-500/50' : 'hover:bg-field text-muted'}`}
75
+ >
76
+ <span className="truncate flex-1">📁 {p.name}</span>
77
+ <span className="text-[11px]">{count}</span>
78
+ </button>
79
+ )
80
+ })}
81
+ </div>
82
+ </Section>
83
+
84
+ <Section
85
+ title={`對話(${convs.length})`}
86
+ right={
87
+ <button type="button" title="新對話" className="p-1 rounded hover:bg-field" onClick={() => { st.createConversation(); onDone?.() }}>
88
+ <Plus className="w-4 h-4" />
89
+ </button>
90
+ }
91
+ >
92
+ <Btn variant="primary" className="w-full" onClick={() => { st.createConversation(); onDone?.() }}>
93
+ <Plus className="w-4 h-4" /> 新對話
94
+ </Btn>
95
+ <div className="space-y-1">
96
+ {convs.length === 0 && <p className="text-xs text-muted">這個專案還沒有對話</p>}
97
+ {convs.map((c) => {
98
+ const a = agents.find((x) => x.id === c.agentId)
99
+ return (
100
+ <div
101
+ key={c.id}
102
+ className={`group flex items-center gap-2 px-3 py-2 rounded-lg text-sm cursor-pointer ${c.id === activeConversationId ? 'bg-field text-ink' : 'hover:bg-field text-muted'}`}
103
+ onClick={() => st.selectConversation(c.id)}
104
+ >
105
+ {running[c.id] ? <span className="w-2 h-2 rounded-full bg-emerald-500 animate-pulse shrink-0" /> : <MessageSquare className="w-3.5 h-3.5 shrink-0" />}
106
+ <span className="truncate flex-1">{c.title}</span>
107
+ <span className="text-xs">{a?.icon}</span>
108
+ <button
109
+ type="button"
110
+ title="刪除對話"
111
+ className="opacity-100 md:opacity-0 md:group-hover:opacity-100 text-muted hover:text-red-500"
112
+ onClick={(e) => { e.stopPropagation(); if (confirm(`刪除對話「${c.title}」?`)) st.removeConversation(c.id) }}
113
+ >
114
+ <Trash2 className="w-3.5 h-3.5" />
115
+ </button>
116
+ </div>
117
+ )
118
+ })}
119
+ </div>
120
+ </Section>
121
+
122
+ <Section title={`專案筆記(${project.notes?.length || 0})`} defaultOpen={false}>
123
+ <p className="text-[11px] text-muted">筆記會自動帶進這個專案所有對話的 system prompt;Agent 也能用 save_note / read_notes 工具讀寫。</p>
124
+ <div className="space-y-1">
125
+ {(project.notes || []).map((n) => <NoteItem key={n.id} note={n} projectId={project.id} />)}
126
+ </div>
127
+ <Btn className="w-full" onClick={() => st.addNote(project.id, { title: '新筆記', content: '' })}>
128
+ <Plus className="w-4 h-4" /> 新增筆記
129
+ </Btn>
130
+ </Section>
131
+
132
+ <Section title="專案設定" defaultOpen={false}>
133
+ <Field label="名稱">
134
+ <input className={inputCls} value={project.name} onChange={(e) => up({ name: e.target.value })} />
135
+ </Field>
136
+ <Field label="說明">
137
+ <input className={inputCls} value={project.description} onChange={(e) => up({ description: e.target.value })} placeholder="這個專案在做什麼" />
138
+ </Field>
139
+ <Field label="專案指示" hint="附加在每個對話的 system prompt 後面,例如:讀者是國中生、輸出一律用表格。">
140
+ <textarea className={inputCls} rows={4} value={project.instructions} onChange={(e) => up({ instructions: e.target.value })} />
141
+ </Field>
142
+ <Field label="新對話預設 Agent">
143
+ <select className={inputCls} value={project.defaultAgentId} onChange={(e) => up({ defaultAgentId: e.target.value })}>
144
+ {agents.map((a) => <option key={a.id} value={a.id}>{a.icon} {a.name}</option>)}
145
+ </select>
146
+ </Field>
147
+ <ModelPicker
148
+ label="新對話預設模型"
149
+ providerId={project.defaultProviderId}
150
+ model={project.defaultModel}
151
+ onChange={(providerId, model) => up({ defaultProviderId: providerId, defaultModel: model })}
152
+ />
153
+ <div className="flex gap-2">
154
+ <Btn className="flex-1" onClick={() => {
155
+ const data = st.exportData('project', { id: project.id })
156
+ download(`project-${project.name}-${stamp()}.json`, JSON.stringify(data, null, 2))
157
+ }}>
158
+ <Download className="w-4 h-4" /> 匯出專案
159
+ </Btn>
160
+ <Btn variant="danger" onClick={() => {
161
+ if (confirm(`刪除專案「${project.name}」與其中 ${convs.length} 個對話?此動作無法復原。`)) st.removeProject(project.id)
162
+ }}>
163
+ <Trash2 className="w-4 h-4" />
164
+ </Btn>
165
+ </div>
166
+ </Section>
167
+ </div>
168
+ )
169
+ }
src/components/panels/SettingsPanel.jsx ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from 'react'
2
+ import { Sun, Moon, Download, Upload, RotateCcw } from 'lucide-react'
3
+ import { useStore } from '../../store/useStore'
4
+ import { Btn, Field, Section, inputCls, download, pickJsonFile, stamp } from '../ui'
5
+
6
+ export default function SettingsPanel() {
7
+ const settings = useStore((s) => s.settings)
8
+ const st = useStore.getState()
9
+ const [includeKeys, setIncludeKeys] = useState(true)
10
+ const [msg, setMsg] = useState('')
11
+ const up = (patch) => st.updateSettings(patch)
12
+
13
+ const doExport = (scope) => {
14
+ const data = st.exportData(scope, { includeKeys })
15
+ download(`agent-studio-${scope === 'all' ? 'backup' : 'settings'}-${stamp()}.json`, JSON.stringify(data, null, 2))
16
+ setMsg(scope === 'all' ? '已匯出全部(設定 + 專案 + 對話)' : '已匯出設定')
17
+ }
18
+
19
+ const doImport = async () => {
20
+ setMsg('')
21
+ try {
22
+ const json = await pickJsonFile()
23
+ let mode = 'merge'
24
+ if (json?.type === 'all') {
25
+ mode = confirm('這是完整備份。\n按「確定」= 完全取代目前資料\n按「取消」= 合併(同 id 覆蓋,其餘保留)') ? 'replace' : 'merge'
26
+ }
27
+ setMsg(st.importData(json, mode))
28
+ } catch (e) {
29
+ setMsg(`匯入失敗:${e.message}`)
30
+ }
31
+ }
32
+
33
+ return (
34
+ <div>
35
+ <Section title="一鍵匯入 / 匯出">
36
+ <div className="grid grid-cols-2 gap-2">
37
+ <Btn variant="primary" onClick={() => doExport('all')}><Download className="w-4 h-4" /> 匯出全部</Btn>
38
+ <Btn variant="primary" onClick={doImport}><Upload className="w-4 h-4" /> 匯入</Btn>
39
+ <Btn className="col-span-2" onClick={() => doExport('settings')}><Download className="w-4 h-4" /> 只匯出設定(供應商、Agent、工具)</Btn>
40
+ </div>
41
+ <label className="flex items-center gap-2 text-xs text-muted">
42
+ <input type="checkbox" checked={includeKeys} onChange={(e) => setIncludeKeys(e.target.checked)} />
43
+ 匯出時包含 API 金鑰(分享給別人前請取消勾選)
44
+ </label>
45
+ <p className="text-[11px] text-muted">
46
+ 匯入會自動辨識檔案類型:完整備份、設定、單一專案、單一對話(也相容舊版匯出的對話 JSON)。單一專案 / 對話也可在「專案」「對話」頁匯出。
47
+ </p>
48
+ {msg && <p className="text-xs text-emerald-500">{msg}</p>}
49
+ </Section>
50
+
51
+ <Section title="外觀">
52
+ <div className="grid grid-cols-2 gap-2">
53
+ <Btn variant={settings.theme === 'dark' ? 'primary' : 'ghost'} onClick={() => up({ theme: 'dark' })}><Moon className="w-4 h-4" /> 深色</Btn>
54
+ <Btn variant={settings.theme === 'light' ? 'primary' : 'ghost'} onClick={() => up({ theme: 'light' })}><Sun className="w-4 h-4" /> 亮色</Btn>
55
+ </div>
56
+ </Section>
57
+
58
+ <Section title="Agent 執行">
59
+ <Field label="每輪最多工具步數" hint="模型每呼叫一次工具算一步。全程串流,不設逾時,可隨時按停止。">
60
+ <input type="number" min={1} max={50} className={inputCls} value={settings.maxSteps} onChange={(e) => up({ maxSteps: e.target.value })} />
61
+ </Field>
62
+ <Field label="Temperature" hint="留空 = 用模型預設值。">
63
+ <input type="number" step="0.1" min={0} max={2} className={inputCls} value={settings.temperature} onChange={(e) => up({ temperature: e.target.value })} placeholder="預設" />
64
+ </Field>
65
+ </Section>
66
+
67
+ <Section title="搜尋與讀網頁(選填)">
68
+ <Field label="Tavily API Key" hint="填了之後 web_search 會用 Tavily 做真正的全網搜尋(免費額度每月 1000 次,tavily.com)。不填則用 Wikipedia + DuckDuckGo。">
69
+ <input type="password" className={inputCls} value={settings.tavilyKey} onChange={(e) => up({ tavilyKey: e.target.value })} placeholder="tvly-..." />
70
+ </Field>
71
+ <Field label="Jina Reader API Key" hint="fetch_url 透過 Jina Reader 讀任意網頁(jina.ai 可領免費金鑰)。不填時只能讀有開 CORS 的網址。">
72
+ <input type="password" className={inputCls} value={settings.jinaKey} onChange={(e) => up({ jinaKey: e.target.value })} placeholder="jina_..." />
73
+ </Field>
74
+ </Section>
75
+
76
+ <Section title="危險區" defaultOpen={false}>
77
+ <Btn variant="danger" className="w-full" onClick={() => {
78
+ if (confirm('清除所有專案、對話與設定?建議先「匯出全部」備份。')) st.resetAll()
79
+ }}>
80
+ <RotateCcw className="w-4 h-4" /> 重設所有資料
81
+ </Btn>
82
+ </Section>
83
+ </div>
84
+ )
85
+ }
src/components/panels/ToolsPanel.jsx ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from 'react'
2
+ import { Plus, Trash2, Play, Loader2, Save } from 'lucide-react'
3
+ import { useStore, useActiveProject } from '../../store/useStore'
4
+ import { BUILTIN_TOOLS, executeToolCall, resolveTools } from '../../lib/tools'
5
+ import { Btn, Field, Section, inputCls } from '../ui'
6
+
7
+ const SAMPLE_ARGS = {
8
+ web_search: { query: '大型語言模型' },
9
+ wikipedia_article: { title: 'Taipei', lang: 'en' },
10
+ fetch_url: { url: 'https://example.com' },
11
+ get_weather: { city: 'Taipei', days: 2 },
12
+ currency_convert: { amount: 100, from: 'USD', to: 'TWD' },
13
+ calculate: { expression: '(2+3)^2 * sqrt(16)' },
14
+ get_current_time: { timezone: 'Asia/Taipei' },
15
+ search_github: { query: 'llm agent', limit: 3 },
16
+ search_hackernews: { query: 'LLM', recent: true },
17
+ search_papers: { query: 'retrieval augmented generation' },
18
+ search_books: { query: '三體' },
19
+ save_note: { title: '測試筆記', content: '由工具測試寫入' },
20
+ read_notes: {},
21
+ }
22
+
23
+ function Tester({ name, defaultArgs }) {
24
+ const project = useActiveProject()
25
+ const customTools = useStore((s) => s.customTools)
26
+ const [args, setArgs] = useState(JSON.stringify(defaultArgs || {}, null, 0))
27
+ const [out, setOut] = useState('')
28
+ const [busy, setBusy] = useState(false)
29
+ const run = async () => {
30
+ setBusy(true); setOut('')
31
+ const st = useStore.getState()
32
+ const tools = resolveTools([name], customTools)
33
+ const res = await executeToolCall(
34
+ { function: { name, arguments: args } },
35
+ tools,
36
+ { settings: st.settings, project, addNote: st.addNote, signal: undefined },
37
+ )
38
+ setOut(res); setBusy(false)
39
+ }
40
+ return (
41
+ <div className="space-y-2">
42
+ <div className="flex gap-2">
43
+ <input className={`${inputCls} font-mono text-xs`} value={args} onChange={(e) => setArgs(e.target.value)} />
44
+ <Btn onClick={run} disabled={busy} title="測試執行">{busy ? <Loader2 className="w-4 h-4 animate-spin" /> : <Play className="w-4 h-4" />}</Btn>
45
+ </div>
46
+ {out && <pre className="text-[11px] whitespace-pre-wrap break-words bg-app rounded p-2 max-h-60 overflow-y-auto">{out}</pre>}
47
+ </div>
48
+ )
49
+ }
50
+
51
+ const EMPTY = { name: '', description: '', method: 'GET', endpoint: '', headers: '', parameters: '{"type":"object","properties":{"q":{"type":"string","description":"查詢字串"}},"required":["q"]}' }
52
+
53
+ function CustomToolForm({ initial, onDone }) {
54
+ const [d, setD] = useState(initial ? { ...initial, parameters: JSON.stringify(initial.parameters, null, 2) } : EMPTY)
55
+ const [err, setErr] = useState('')
56
+ const save = () => {
57
+ const name = d.name.trim()
58
+ if (!/^[a-zA-Z0-9_-]{1,64}$/.test(name)) return setErr('名稱只能用英數字、底線、連字號')
59
+ if (!initial && [...BUILTIN_TOOLS, ...useStore.getState().customTools].some((t) => t.name === name)) return setErr('名稱重複')
60
+ let parameters
61
+ try { parameters = JSON.parse(d.parameters || '{}') } catch { return setErr('parameters 不是合法 JSON') }
62
+ if (d.headers?.trim()) { try { JSON.parse(d.headers) } catch { return setErr('headers 不是合法 JSON') } }
63
+ useStore.getState().saveCustomTool({ ...d, name, parameters })
64
+ onDone()
65
+ }
66
+ return (
67
+ <div className="space-y-2 bg-field rounded-lg p-3">
68
+ <input className={inputCls} placeholder="name,例如 get_joke" value={d.name} disabled={!!initial} onChange={(e) => setD({ ...d, name: e.target.value })} />
69
+ <input className={inputCls} placeholder="description(模型靠它決定何時呼叫)" value={d.description} onChange={(e) => setD({ ...d, description: e.target.value })} />
70
+ <div className="flex gap-2">
71
+ <select className={`${inputCls} w-24`} value={d.method} onChange={(e) => setD({ ...d, method: e.target.value })}>
72
+ <option>GET</option><option>POST</option><option>PUT</option>
73
+ </select>
74
+ <input className={inputCls} placeholder="https://api.example.com/x?q={q}" value={d.endpoint} onChange={(e) => setD({ ...d, endpoint: e.target.value })} />
75
+ </div>
76
+ <Field hint="{參數名} 會替換成參數值;POST/PUT 會把全部參數以 JSON body 送出。目標 API 必須允許 CORS。">
77
+ <textarea className={`${inputCls} font-mono text-[11px]`} rows={4} placeholder="parameters(JSON Schema)" value={d.parameters} onChange={(e) => setD({ ...d, parameters: e.target.value })} />
78
+ </Field>
79
+ <input className={`${inputCls} font-mono text-[11px]`} placeholder='headers(選填 JSON),例如 {"X-Api-Key":"..."}' value={d.headers} onChange={(e) => setD({ ...d, headers: e.target.value })} />
80
+ {err && <p className="text-xs text-red-400">{err}</p>}
81
+ <div className="flex gap-2">
82
+ <Btn variant="primary" className="flex-1" onClick={save}><Save className="w-4 h-4" /> 儲存</Btn>
83
+ <Btn onClick={onDone}>取消</Btn>
84
+ </div>
85
+ </div>
86
+ )
87
+ }
88
+
89
+ export default function ToolsPanel() {
90
+ const customTools = useStore((s) => s.customTools)
91
+ const [form, setForm] = useState(null) // null | 'new' | tool
92
+ return (
93
+ <div>
94
+ <Section title={`內建工具(${BUILTIN_TOOLS.length})`}>
95
+ <p className="text-[11px] text-muted">全部是真的,直接從瀏覽器呼叫公開 API。展開可測試。要給哪個 Agent 用,到「Agent」頁勾選。</p>
96
+ <div className="space-y-1.5">
97
+ {BUILTIN_TOOLS.map((t) => (
98
+ <details key={t.name} className="bg-field rounded-lg">
99
+ <summary className="cursor-pointer px-3 py-2 text-sm">
100
+ <span className="font-medium">{t.label}</span> <span className="text-[11px] text-muted font-mono">{t.name}</span>
101
+ </summary>
102
+ <div className="px-3 pb-3 space-y-2">
103
+ <p className="text-[11px] text-muted">{t.description}</p>
104
+ <Tester name={t.name} defaultArgs={SAMPLE_ARGS[t.name]} />
105
+ </div>
106
+ </details>
107
+ ))}
108
+ </div>
109
+ </Section>
110
+
111
+ <Section title={`自訂 HTTP 工具(${customTools.length})`}>
112
+ <p className="text-[11px] text-muted">設定 endpoint 就能真的執行:把任何允許 CORS 的 API 變成 Agent 工具。</p>
113
+ {customTools.map((t) => (
114
+ form?.name === t.name ? <CustomToolForm key={t.name} initial={t} onDone={() => setForm(null)} /> : (
115
+ <details key={t.name} className="bg-field rounded-lg">
116
+ <summary className="cursor-pointer px-3 py-2 text-sm flex items-center gap-2">
117
+ <span className="flex-1 font-mono truncate">{t.name}</span>
118
+ <button type="button" className="text-[11px] text-muted hover:text-ink" onClick={(e) => { e.preventDefault(); setForm(t) }}>編輯</button>
119
+ <button type="button" className="text-muted hover:text-red-500" onClick={(e) => { e.preventDefault(); confirm(`刪除工具 ${t.name}?`) && useStore.getState().removeCustomTool(t.name) }}><Trash2 className="w-3.5 h-3.5" /></button>
120
+ </summary>
121
+ <div className="px-3 pb-3 space-y-2">
122
+ <p className="text-[11px] text-muted">{t.description} · {t.method} {t.endpoint || '(未設定 endpoint)'}</p>
123
+ <Tester name={t.name} defaultArgs={{}} />
124
+ </div>
125
+ </details>
126
+ )
127
+ ))}
128
+ {form === 'new' ? <CustomToolForm onDone={() => setForm(null)} /> : (
129
+ <Btn className="w-full" onClick={() => setForm('new')}><Plus className="w-4 h-4" /> 新增自訂工具</Btn>
130
+ )}
131
+ </Section>
132
+ </div>
133
+ )
134
+ }
src/components/ui.jsx ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* 共用小元件 */
2
+ import { useState } from 'react'
3
+ import { ChevronDown, ChevronRight } from 'lucide-react'
4
+
5
+ export const inputCls =
6
+ 'w-full bg-field border border-edge px-3 py-2 rounded-lg text-sm focus:outline-none focus:border-purple-500 placeholder:text-muted'
7
+
8
+ export function Field({ label, hint, children }) {
9
+ return (
10
+ <label className="block">
11
+ {label && <span className="block text-xs text-muted mb-1">{label}</span>}
12
+ {children}
13
+ {hint && <span className="block text-[11px] text-muted mt-1 leading-snug">{hint}</span>}
14
+ </label>
15
+ )
16
+ }
17
+
18
+ export function Btn({ children, variant = 'ghost', className = '', ...props }) {
19
+ const styles = {
20
+ primary: 'bg-purple-600 hover:bg-purple-700 text-white',
21
+ ghost: 'bg-field hover:bg-edge',
22
+ danger: 'bg-red-600/90 hover:bg-red-600 text-white',
23
+ subtle: 'hover:bg-field',
24
+ }
25
+ return (
26
+ <button
27
+ type="button"
28
+ className={`inline-flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg text-sm transition disabled:opacity-40 disabled:cursor-not-allowed ${styles[variant]} ${className}`}
29
+ {...props}
30
+ >
31
+ {children}
32
+ </button>
33
+ )
34
+ }
35
+
36
+ export function Section({ title, defaultOpen = true, right, children }) {
37
+ const [open, setOpen] = useState(defaultOpen)
38
+ return (
39
+ <div className="border-b border-edge">
40
+ <div className="flex items-center gap-1 px-3 py-2">
41
+ <button type="button" onClick={() => setOpen(!open)} className="flex items-center gap-1 flex-1 text-left text-xs font-semibold uppercase tracking-wide text-muted">
42
+ {open ? <ChevronDown className="w-3.5 h-3.5" /> : <ChevronRight className="w-3.5 h-3.5" />}
43
+ {title}
44
+ </button>
45
+ {right}
46
+ </div>
47
+ {open && <div className="px-3 pb-3 space-y-3">{children}</div>}
48
+ </div>
49
+ )
50
+ }
51
+
52
+ /** 觸發瀏覽器下載 */
53
+ export function download(filename, text, type = 'application/json') {
54
+ const blob = new Blob([text], { type })
55
+ const url = URL.createObjectURL(blob)
56
+ const a = document.createElement('a')
57
+ a.href = url
58
+ a.download = filename
59
+ document.body.appendChild(a)
60
+ a.click()
61
+ a.remove()
62
+ setTimeout(() => URL.revokeObjectURL(url), 1000)
63
+ }
64
+
65
+ /** 開檔案選擇器讀 JSON */
66
+ export function pickJsonFile() {
67
+ return new Promise((resolve, reject) => {
68
+ const input = document.createElement('input')
69
+ input.type = 'file'
70
+ input.accept = 'application/json,.json'
71
+ input.onchange = async () => {
72
+ const file = input.files?.[0]
73
+ if (!file) return reject(new Error('沒有選擇檔案'))
74
+ try { resolve(JSON.parse(await file.text())) } catch { reject(new Error('不是合法的 JSON 檔')) }
75
+ }
76
+ input.click()
77
+ })
78
+ }
79
+
80
+ export const stamp = () => new Date().toISOString().slice(0, 16).replace(/[:T]/g, '-')
src/index.css CHANGED
@@ -6,19 +6,49 @@
6
  .theme-dark {
7
  color-scheme: dark;
8
  --bg: #09090b;
9
- --panel: #18181b;
10
- --field: #27272a;
11
- --edge: #3f3f46;
12
  --ink: #fafafa;
13
  --muted: #a1a1aa;
14
  }
15
 
16
  .theme-light {
17
  color-scheme: light;
18
- --bg: #e4e4e7;
19
  --panel: #ffffff;
20
- --field: #f4f4f5;
21
- --edge: #d4d4d8;
22
  --ink: #18181b;
23
- --muted: #52525b;
24
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  .theme-dark {
7
  color-scheme: dark;
8
  --bg: #09090b;
9
+ --panel: #131316;
10
+ --field: #232327;
11
+ --edge: #34343a;
12
  --ink: #fafafa;
13
  --muted: #a1a1aa;
14
  }
15
 
16
  .theme-light {
17
  color-scheme: light;
18
+ --bg: #f4f4f5;
19
  --panel: #ffffff;
20
+ --field: #f0f0f2;
21
+ --edge: #dcdce0;
22
  --ink: #18181b;
23
+ --muted: #5b5b66;
24
  }
25
+
26
+ html, body, #root { height: 100%; }
27
+ body { background: var(--bg); color: var(--ink); -webkit-tap-highlight-color: transparent; }
28
+
29
+ /* 細捲軸 */
30
+ * { scrollbar-width: thin; scrollbar-color: var(--edge) transparent; }
31
+
32
+ /* Markdown 樣式 */
33
+ .md { line-height: 1.7; word-break: break-word; }
34
+ .md > *:first-child { margin-top: 0; }
35
+ .md > *:last-child { margin-bottom: 0; }
36
+ .md p, .md ul, .md ol, .md pre, .md blockquote, .md table { margin: 0.6em 0; }
37
+ .md h1, .md h2, .md h3, .md h4 { font-weight: 700; margin: 1em 0 0.5em; line-height: 1.3; }
38
+ .md h1 { font-size: 1.35em; } .md h2 { font-size: 1.2em; } .md h3 { font-size: 1.08em; }
39
+ .md ul { list-style: disc; padding-left: 1.4em; }
40
+ .md ol { list-style: decimal; padding-left: 1.4em; }
41
+ .md li { margin: 0.2em 0; }
42
+ .md a { color: #a78bfa; text-decoration: underline; text-underline-offset: 2px; }
43
+ .theme-light .md a { color: #7c3aed; }
44
+ .md code { background: var(--field); border: 1px solid var(--edge); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.88em; }
45
+ .md pre { background: var(--bg); border: 1px solid var(--edge); padding: 0.8em 1em; border-radius: 8px; overflow-x: auto; }
46
+ .md pre code { background: none; border: 0; padding: 0; font-size: 0.85em; }
47
+ .md blockquote { border-left: 3px solid var(--edge); padding-left: 0.8em; color: var(--muted); }
48
+ .md table { border-collapse: collapse; display: block; overflow-x: auto; }
49
+ .md th, .md td { border: 1px solid var(--edge); padding: 0.35em 0.6em; }
50
+ .md th { background: var(--field); }
51
+ .md hr { border-color: var(--edge); margin: 1em 0; }
52
+
53
+ .cursor-blink::after { content: '▍'; animation: blink 1s steps(2) infinite; margin-left: 1px; color: var(--muted); }
54
+ @keyframes blink { to { opacity: 0; } }
src/lib/agents.js ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* 內建 Agent 角色。tools 列出預設啟用的工具名稱,可在側邊欄調整或自建角色。 */
2
+
3
+ const SEARCH = ['web_search', 'wikipedia_article', 'fetch_url']
4
+ const NOTES = ['save_note', 'read_notes']
5
+ const BASE_RULES =
6
+ '使用繁體中文回答(除非使用者用其他語言)。需要外部事實時先用工具查證,不要編造;' +
7
+ '引用搜尋結果時附上來源網址。無法確定的部分要明確說明。'
8
+
9
+ export const BUILTIN_AGENTS = [
10
+ {
11
+ id: 'assistant',
12
+ name: '通用助理',
13
+ icon: '💬',
14
+ description: '日常問答,需要時才查資料',
15
+ tools: ['web_search', 'wikipedia_article', 'calculate', 'get_current_time', 'get_weather', 'currency_convert'],
16
+ systemPrompt: `你是一個友善、精準的通用助理。${BASE_RULES}`,
17
+ },
18
+ {
19
+ id: 'chat',
20
+ name: '純聊天',
21
+ icon: '🗨️',
22
+ description: '不用任何工具,最快',
23
+ tools: [],
24
+ systemPrompt: '你是一個友善的聊天夥伴,回答自然簡潔。',
25
+ },
26
+ {
27
+ id: 'researcher',
28
+ name: 'Researcher 研究員',
29
+ icon: '🔍',
30
+ description: '多來源搜尋、交叉查證、整理報告',
31
+ tools: [...SEARCH, 'search_papers', 'search_books', 'calculate', ...NOTES],
32
+ systemPrompt:
33
+ '你是 Researcher,擅長資訊研究與事實查核。先拆解問題,再用 web_search 從多個角度搜尋,' +
34
+ '必要時用 wikipedia_article / fetch_url 讀原文。最後給出有條理的結論與來源清單。' +
35
+ `重要結論可用 save_note 存進專案筆記。${BASE_RULES}`,
36
+ },
37
+ {
38
+ id: 'fact_checker',
39
+ name: '事實查核員',
40
+ icon: '✅',
41
+ description: '逐條驗證說法真偽',
42
+ tools: [...SEARCH, 'search_papers'],
43
+ systemPrompt:
44
+ '你是事實查核員。把使用者給的內容拆成可驗證的主張,逐條搜尋證據,' +
45
+ '每條標示「正確 / 部分正確 / 錯誤 / 無法證實」並附來源。' + BASE_RULES,
46
+ },
47
+ {
48
+ id: 'writer',
49
+ name: 'Writer 寫手',
50
+ icon: '✍️',
51
+ description: '寫作、改寫、潤稿、文案',
52
+ tools: ['web_search', ...NOTES],
53
+ systemPrompt:
54
+ '你是 Writer,擅長寫作、改寫與內容整理。直接產出內容,不要列計畫。語氣自然流暢、結構清楚。' +
55
+ '只有在確實需要事實時才呼叫工具。' + BASE_RULES,
56
+ },
57
+ {
58
+ id: 'summarizer',
59
+ name: '摘要員',
60
+ icon: '📝',
61
+ description: '把長文或網址濃縮成重點',
62
+ tools: ['fetch_url', 'wikipedia_article', ...NOTES],
63
+ systemPrompt:
64
+ '你是摘要專家。使用者給網址就用 fetch_url 讀取;給文字就直接處理。' +
65
+ '輸出:一句話總結、3-7 個重點、值得注意的細節。' + BASE_RULES,
66
+ },
67
+ {
68
+ id: 'analyst',
69
+ name: 'Analyst 分析師',
70
+ icon: '📊',
71
+ description: '數據分析、計算、評估',
72
+ tools: ['calculate', 'currency_convert', 'web_search', 'get_current_time', ...NOTES],
73
+ systemPrompt:
74
+ '你是 Analyst,擅長數據分析與量化評估。涉及運算一律呼叫 calculate 取得精確結果,不要口頭估算。' +
75
+ '先給結論再給依據,必要時列出假設條件。' + BASE_RULES,
76
+ },
77
+ {
78
+ id: 'coder',
79
+ name: '工程師',
80
+ icon: '👩‍💻',
81
+ description: '寫程式、除錯、找開源套件',
82
+ tools: ['search_github', 'fetch_url', 'web_search', 'search_hackernews', 'calculate'],
83
+ systemPrompt:
84
+ '你是資深軟體工程師。給出可直接執行的完整程式碼(用 Markdown 程式碼區塊標語言),' +
85
+ '說明關鍵設計取捨。需要推薦套件時用 search_github 查實際存在的專案與星數,' +
86
+ '需要讀文件時用 fetch_url。' + BASE_RULES,
87
+ },
88
+ {
89
+ id: 'tech_news',
90
+ name: '科技新聞',
91
+ icon: '📰',
92
+ description: '追科技趨勢與討論',
93
+ tools: ['search_hackernews', 'web_search', 'fetch_url', 'search_github'],
94
+ systemPrompt:
95
+ '你是科技新聞編輯。用 search_hackernews(recent=true 取最新)與 web_search 蒐集資訊,' +
96
+ '整理成條列快訊,每條附連結與一句評論。' + BASE_RULES,
97
+ },
98
+ {
99
+ id: 'translator',
100
+ name: '翻譯',
101
+ icon: '🌐',
102
+ description: '多語翻譯與在地化',
103
+ tools: ['wikipedia_article'],
104
+ systemPrompt:
105
+ '你是專業譯者。忠實、通順、符合目標語言習慣地翻譯。未指定目標語言時:中文譯成英文,其他語言譯成繁體中文。' +
106
+ '專有名詞不確定時可查 Wikipedia 確認通行譯名。只輸出譯文,除非使用者要求說明。',
107
+ },
108
+ {
109
+ id: 'tutor',
110
+ name: '家教老師',
111
+ icon: '🎓',
112
+ description: '循序漸進講解概念',
113
+ tools: ['wikipedia_article', 'web_search', 'calculate'],
114
+ systemPrompt:
115
+ '你是耐心的家教老師。先確認學生程度,用生活化例子由淺入深講解,最後出 1-2 題小練習檢查理解。' + BASE_RULES,
116
+ },
117
+ {
118
+ id: 'planner',
119
+ name: '規劃師',
120
+ icon: '🗺️',
121
+ description: '旅行、專案、行程規劃',
122
+ tools: ['get_weather', 'currency_convert', 'get_current_time', 'web_search', 'calculate', ...NOTES],
123
+ systemPrompt:
124
+ '你是規劃師,擅長旅行與專案規劃。釐清目標、時間與預算後,產出具體可執行的計畫(時間表、預算、清單)。' +
125
+ '旅行要查天氣與匯率。定案的計畫用 save_note 存進專案。' + BASE_RULES,
126
+ },
127
+ ]
src/lib/llm.js ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ------------------------------------------------------------------ *
2
+ * 串流呼叫 OpenAI 相容 /chat/completions
3
+ *
4
+ * - 一律 stream: true,邊收邊回呼 onDelta(文字、推理內容、工具呼叫)
5
+ * - 工具呼叫的 delta 依 index 累積成完整 tool_calls
6
+ * - 不設逾時:只有使用者按「停止」(signal abort)才會中斷
7
+ * ------------------------------------------------------------------ */
8
+
9
+ async function readErrorMessage(res) {
10
+ const text = await res.text().catch(() => '')
11
+ try {
12
+ const data = JSON.parse(text)
13
+ const e = Array.isArray(data) ? data[0]?.error : data?.error
14
+ return e?.message || e?.metadata?.raw || data?.message || text.slice(0, 300) || '無錯誤訊息'
15
+ } catch {
16
+ return text.slice(0, 300) || '無錯誤訊息'
17
+ }
18
+ }
19
+
20
+ /**
21
+ * @returns {Promise<{content:string, reasoning:string, tool_calls:Array, finish_reason:string|null}>}
22
+ */
23
+ export async function streamChat({ provider, model, messages, tools, temperature, signal, onDelta }) {
24
+ const base = String(provider.baseUrl || '').replace(/\/+$/, '')
25
+ const headers = { 'Content-Type': 'application/json' }
26
+ if (provider.apiKey?.trim()) headers.Authorization = `Bearer ${provider.apiKey.trim()}`
27
+ if (/openrouter\.ai/.test(base)) {
28
+ headers['HTTP-Referer'] = window.location.origin
29
+ headers['X-Title'] = 'Agent Studio'
30
+ }
31
+
32
+ const body = { model, messages, stream: true }
33
+ if (tools?.length) body.tools = tools
34
+ if (typeof temperature === 'number') body.temperature = temperature
35
+
36
+ const res = await fetch(`${base}/chat/completions`, {
37
+ method: 'POST',
38
+ signal,
39
+ headers,
40
+ body: JSON.stringify(body),
41
+ })
42
+
43
+ if (!res.ok) throw new Error(`API 錯誤 ${res.status}:${await readErrorMessage(res)}`)
44
+ if (!res.body) throw new Error('回應不含可讀取的串流')
45
+
46
+ const out = { content: '', reasoning: '', tool_calls: [], finish_reason: null }
47
+ const reader = res.body.getReader()
48
+ const decoder = new TextDecoder()
49
+ let buffer = ''
50
+ let sawSse = false
51
+
52
+ const handle = (data) => {
53
+ if (data.error) throw new Error(data.error.message || 'API 串流回傳錯誤')
54
+ const choice = data.choices?.[0]
55
+ if (!choice) return
56
+ const d = choice.delta || choice.message || {}
57
+ if (choice.finish_reason) out.finish_reason = choice.finish_reason
58
+
59
+ const reasoning = d.reasoning_content ?? d.reasoning
60
+ if (typeof reasoning === 'string' && reasoning) {
61
+ out.reasoning += reasoning
62
+ onDelta?.({ reasoning: out.reasoning })
63
+ }
64
+ if (typeof d.content === 'string' && d.content) {
65
+ out.content += d.content
66
+ onDelta?.({ content: out.content })
67
+ }
68
+ if (Array.isArray(d.tool_calls)) {
69
+ d.tool_calls.forEach((tc, pos) => {
70
+ // 有些供應商(如 Gemini)不給 index,就用陣列位置;給了新的 id 就視為新呼叫
71
+ let idx = typeof tc.index === 'number' ? tc.index : pos
72
+ if (tc.id && out.tool_calls[idx]?.id && out.tool_calls[idx].id !== tc.id && typeof tc.index !== 'number') {
73
+ idx = out.tool_calls.length
74
+ }
75
+ const cur = out.tool_calls[idx] || { id: '', type: 'function', function: { name: '', arguments: '' } }
76
+ if (tc.id) cur.id = tc.id
77
+ if (tc.function?.name) cur.function.name += tc.function.name
78
+ if (tc.function?.arguments) {
79
+ cur.function.arguments += typeof tc.function.arguments === 'string'
80
+ ? tc.function.arguments
81
+ : JSON.stringify(tc.function.arguments)
82
+ }
83
+ out.tool_calls[idx] = cur
84
+ })
85
+ onDelta?.({ tool_calls: out.tool_calls })
86
+ }
87
+ }
88
+
89
+ for (;;) {
90
+ const { value, done } = await reader.read()
91
+ if (done) break
92
+ buffer += decoder.decode(value, { stream: true })
93
+ const lines = buffer.split('\n')
94
+ buffer = lines.pop()
95
+ for (const raw of lines) {
96
+ const line = raw.trim()
97
+ if (!line.startsWith('data:')) continue
98
+ sawSse = true
99
+ const payload = line.slice(5).trim()
100
+ if (!payload || payload === '[DONE]') continue
101
+ let data
102
+ try { data = JSON.parse(payload) } catch { continue }
103
+ handle(data)
104
+ }
105
+ }
106
+
107
+ // 少數端點忽略 stream:true 直接回整包 JSON
108
+ if (!sawSse && buffer.trim().startsWith('{')) {
109
+ let data = null
110
+ try { data = JSON.parse(buffer) } catch { /* 不是 JSON 就忽略 */ }
111
+ if (data) handle(data)
112
+ }
113
+
114
+ out.tool_calls = out.tool_calls.filter(Boolean).map((tc, i) => ({
115
+ ...tc,
116
+ id: tc.id || `call_${Date.now().toString(36)}_${i}`,
117
+ }))
118
+ return out
119
+ }
src/lib/providers.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* OpenAI 相容供應商預設。模型清單可在側邊欄按「抓取模型」從 /models 取得,或手動輸入。 */
2
+
3
+ export const PROVIDER_PRESETS = [
4
+ { name: 'OpenRouter', baseUrl: 'https://openrouter.ai/api/v1', models: ['nvidia/nemotron-3-ultra-550b-a55b:free'] },
5
+ { name: 'OpenAI', baseUrl: 'https://api.openai.com/v1', models: [] },
6
+ { name: 'Google Gemini', baseUrl: 'https://generativelanguage.googleapis.com/v1beta/openai', models: [] },
7
+ { name: 'Groq', baseUrl: 'https://api.groq.com/openai/v1', models: [] },
8
+ { name: 'DeepSeek', baseUrl: 'https://api.deepseek.com/v1', models: ['deepseek-chat', 'deepseek-reasoner'] },
9
+ { name: 'Mistral', baseUrl: 'https://api.mistral.ai/v1', models: [] },
10
+ { name: 'Together', baseUrl: 'https://api.together.xyz/v1', models: [] },
11
+ { name: 'SiliconFlow', baseUrl: 'https://api.siliconflow.cn/v1', models: [] },
12
+ { name: 'Cohere', baseUrl: 'https://api.cohere.ai/compatibility/v1', models: [] },
13
+ { name: 'Ollama(本機)', baseUrl: 'http://localhost:11434/v1', models: [], noKey: true },
14
+ { name: 'LM Studio(本機)', baseUrl: 'http://localhost:1234/v1', models: [], noKey: true },
15
+ { name: '自訂', baseUrl: '', models: [] },
16
+ ]
17
+
18
+ export const uid = () => Math.random().toString(36).slice(2, 10) + Date.now().toString(36).slice(-4)
19
+
20
+ export function makeProvider(preset) {
21
+ return {
22
+ id: uid(),
23
+ name: preset.name,
24
+ baseUrl: preset.baseUrl,
25
+ apiKey: '',
26
+ noKey: !!preset.noKey,
27
+ models: [...(preset.models || [])],
28
+ }
29
+ }
30
+
31
+ /** 從供應商的 /models 端點抓模型 id 清單 */
32
+ export async function fetchModels(provider) {
33
+ const base = String(provider.baseUrl).replace(/\/+$/, '')
34
+ const res = await fetch(`${base}/models`, {
35
+ headers: provider.apiKey?.trim() ? { Authorization: `Bearer ${provider.apiKey.trim()}` } : {},
36
+ })
37
+ if (!res.ok) throw new Error(`HTTP ${res.status}`)
38
+ const data = await res.json()
39
+ const list = (data.data || data.models || []).map((m) => (typeof m === 'string' ? m : m.id || m.name)).filter(Boolean)
40
+ return [...new Set(list.map((id) => String(id).replace(/^models\//, '')))].sort()
41
+ }
src/lib/tools.js ADDED
@@ -0,0 +1,487 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ------------------------------------------------------------------ *
2
+ * 工具:定義 + 真正可執行的實作
3
+ *
4
+ * 純前端只能呼叫「有開 CORS」的公開 API,以下每個都實測過可從瀏覽器直連:
5
+ * Wikipedia / Wikidata(origin=*)、DuckDuckGo Instant Answer、
6
+ * Open-Meteo(天氣)、open.er-api.com(匯率)、GitHub、HN Algolia、
7
+ * Crossref(論文)、Open Library(書)、
8
+ * Tavily(選用,需金鑰,真正的全網搜尋)、Jina Reader(選用,讀任意網頁)
9
+ * ------------------------------------------------------------------ */
10
+ import { safeCalc } from '../utils/calc'
11
+
12
+ const MAX_RESULT_CHARS = 8000
13
+
14
+ const clip = (s, n = MAX_RESULT_CHARS) => {
15
+ const str = typeof s === 'string' ? s : JSON.stringify(s, null, 2)
16
+ return str.length > n ? `${str.slice(0, n)}\n…(已截斷,共 ${str.length} 字)` : str
17
+ }
18
+
19
+ const stripHtml = (html) =>
20
+ String(html || '')
21
+ .replace(/<script[\s\S]*?<\/script>/gi, ' ')
22
+ .replace(/<style[\s\S]*?<\/style>/gi, ' ')
23
+ .replace(/<[^>]+>/g, ' ')
24
+ .replace(/&nbsp;/g, ' ')
25
+ .replace(/&quot;/g, '"')
26
+ .replace(/&#39;/g, "'")
27
+ .replace(/&amp;/g, '&')
28
+ .replace(/&lt;/g, '<')
29
+ .replace(/&gt;/g, '>')
30
+ .replace(/\s+/g, ' ')
31
+ .trim()
32
+
33
+ /** 依查詢字串猜 Wikipedia 語言:含中日韓字元就用 zh,否則 en */
34
+ const guessLang = (q) => (/[\u3040-\u30ff\u3400-\u9fff\uac00-\ud7af]/.test(q || '') ? 'zh' : 'en')
35
+
36
+ async function getJSON(url, init = {}) {
37
+ const res = await fetch(url, init)
38
+ if (!res.ok) {
39
+ let detail = ''
40
+ try { detail = (await res.text()).slice(0, 200) } catch { /* ignore */ }
41
+ throw new Error(`HTTP ${res.status} ${detail}`)
42
+ }
43
+ return res.json()
44
+ }
45
+
46
+ /* ------------------------------ 搜尋 ------------------------------ */
47
+
48
+ async function wikipediaSearch(query, lang, limit = 5, signal) {
49
+ const base = `https://${lang}.wikipedia.org/w/api.php`
50
+ const params = new URLSearchParams({
51
+ action: 'query', format: 'json', origin: '*',
52
+ generator: 'search', gsrsearch: query, gsrlimit: String(limit),
53
+ prop: 'extracts|info', exintro: '1', explaintext: '1', exsentences: '4', inprop: 'url',
54
+ ...(lang === 'zh' ? { variant: 'zh-tw' } : {}),
55
+ })
56
+ const data = await getJSON(`${base}?${params}`, { signal })
57
+ const pages = Object.values(data?.query?.pages || {}).sort((a, b) => (a.index || 0) - (b.index || 0))
58
+ return pages.map((p) => ({
59
+ source: `Wikipedia (${lang})`,
60
+ title: p.title,
61
+ url: p.fullurl || `https://${lang}.wikipedia.org/wiki/${encodeURIComponent(p.title)}`,
62
+ snippet: (p.extract || '').trim(),
63
+ }))
64
+ }
65
+
66
+ async function duckduckgo(query, signal) {
67
+ const params = new URLSearchParams({ q: query, format: 'json', no_html: '1', skip_disambig: '1' })
68
+ const data = await getJSON(`https://api.duckduckgo.com/?${params}`, { signal })
69
+ const out = []
70
+ if (data.AbstractText) out.push({ source: 'DuckDuckGo', title: data.Heading, url: data.AbstractURL, snippet: data.AbstractText })
71
+ if (data.Answer) out.push({ source: 'DuckDuckGo', title: '即時答案', url: '', snippet: String(data.Answer) })
72
+ for (const t of (data.RelatedTopics || []).slice(0, 5)) {
73
+ if (t.Text) out.push({ source: 'DuckDuckGo', title: t.Text.split(' - ')[0], url: t.FirstURL, snippet: t.Text })
74
+ }
75
+ return out
76
+ }
77
+
78
+ async function tavily(query, key, signal, maxResults = 6) {
79
+ const data = await getJSON('https://api.tavily.com/search', {
80
+ method: 'POST',
81
+ signal,
82
+ headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${key}` },
83
+ body: JSON.stringify({ query, max_results: maxResults, include_answer: true }),
84
+ })
85
+ const out = []
86
+ if (data.answer) out.push({ source: 'Tavily', title: '摘要答案', url: '', snippet: data.answer })
87
+ for (const r of data.results || []) out.push({ source: 'Tavily', title: r.title, url: r.url, snippet: r.content })
88
+ return out
89
+ }
90
+
91
+ function formatResults(query, results, notes) {
92
+ if (!results.length) return `「${query}」沒有找到結果。${notes.length ? `\n${notes.join('\n')}` : ''}`
93
+ const body = results
94
+ .map((r, i) => `[${i + 1}] ${r.title}\n來源:${r.source}${r.url ? ` · ${r.url}` : ''}\n${r.snippet}`)
95
+ .join('\n\n')
96
+ return `搜尋「${query}」的結果:\n\n${body}${notes.length ? `\n\n(${notes.join(';')})` : ''}`
97
+ }
98
+
99
+ /* ------------------------------ 定義 ------------------------------ */
100
+
101
+ export const BUILTIN_TOOLS = [
102
+ {
103
+ name: 'web_search',
104
+ label: '網路搜尋',
105
+ description:
106
+ '搜尋網路資訊。預設查 Wikipedia + DuckDuckGo;若使用者在設定填了 Tavily 金鑰,會改用 Tavily 做全網搜尋。回傳標題、網址與摘要。',
107
+ parameters: {
108
+ type: 'object',
109
+ properties: {
110
+ query: { type: 'string', description: '搜尋關鍵字或問題' },
111
+ lang: { type: 'string', description: 'Wikipedia 語言代碼,例如 zh、en、ja;省略則自動判斷' },
112
+ },
113
+ required: ['query'],
114
+ },
115
+ async run({ query, lang }, ctx) {
116
+ const results = []
117
+ const notes = []
118
+ const key = ctx.settings?.tavilyKey?.trim()
119
+ if (key) {
120
+ try { results.push(...(await tavily(query, key, ctx.signal))) } catch (e) { notes.push(`Tavily 失敗:${e.message}`) }
121
+ }
122
+ const wl = lang || guessLang(query)
123
+ try { results.push(...(await wikipediaSearch(query, wl, key ? 3 : 5, ctx.signal))) } catch (e) { notes.push(`Wikipedia 失敗:${e.message}`) }
124
+ // 中文查不到時再用英文 Wikipedia 補
125
+ if (!results.length && wl !== 'en') {
126
+ try { results.push(...(await wikipediaSearch(query, 'en', 4, ctx.signal))) } catch { /* ignore */ }
127
+ }
128
+ if (!key) {
129
+ try { results.push(...(await duckduckgo(query, ctx.signal))) } catch (e) { notes.push(`DuckDuckGo 失敗:${e.message}`) }
130
+ }
131
+ return formatResults(query, results, notes)
132
+ },
133
+ },
134
+ {
135
+ name: 'wikipedia_article',
136
+ label: 'Wikipedia 全文',
137
+ description: '讀取指定 Wikipedia 條目的內容(純文字)。適合在 web_search 找到條目後讀細節。',
138
+ parameters: {
139
+ type: 'object',
140
+ properties: {
141
+ title: { type: 'string', description: '條目標題,例如「臺北市」或「Large language model」' },
142
+ lang: { type: 'string', description: '語言代碼,預設依標題自動判斷' },
143
+ full: { type: 'boolean', description: 'true 讀全文,false 只讀導言(預設 false)' },
144
+ },
145
+ required: ['title'],
146
+ },
147
+ async run({ title, lang, full }, ctx) {
148
+ const wl = lang || guessLang(title)
149
+ const params = new URLSearchParams({
150
+ action: 'query', format: 'json', origin: '*', redirects: '1',
151
+ prop: 'extracts|info', explaintext: '1', inprop: 'url', titles: title,
152
+ ...(full ? {} : { exintro: '1' }),
153
+ ...(wl === 'zh' ? { variant: 'zh-tw' } : {}),
154
+ })
155
+ const data = await getJSON(`https://${wl}.wikipedia.org/w/api.php?${params}`, { signal: ctx.signal })
156
+ const page = Object.values(data?.query?.pages || {})[0]
157
+ if (!page || page.missing !== undefined) return `找不到條目「${title}」(${wl}.wikipedia.org)。可先用 web_search 找正確標題。`
158
+ return clip(`# ${page.title}\n${page.fullurl}\n\n${page.extract || '(無內容)'}`)
159
+ },
160
+ },
161
+ {
162
+ name: 'fetch_url',
163
+ label: '讀取網頁',
164
+ description: '讀取任意網址的文字內容(透過 Jina Reader 轉成純文字;對有開 CORS 的網址也能直接讀)。',
165
+ parameters: {
166
+ type: 'object',
167
+ properties: { url: { type: 'string', description: '完整網址,http(s):// 開頭' } },
168
+ required: ['url'],
169
+ },
170
+ async run({ url }, ctx) {
171
+ if (!/^https?:\/\//i.test(url || '')) return '網址必須以 http:// 或 https:// 開頭'
172
+ const errors = []
173
+ const jinaKey = ctx.settings?.jinaKey?.trim()
174
+ try {
175
+ const res = await fetch(`https://r.jina.ai/${url}`, {
176
+ signal: ctx.signal,
177
+ headers: jinaKey ? { Authorization: `Bearer ${jinaKey}` } : {},
178
+ })
179
+ if (res.ok) return clip(await res.text())
180
+ errors.push(`Jina Reader HTTP ${res.status}${res.status === 401 ? '(需在設定填 Jina 金鑰)' : ''}`)
181
+ } catch (e) { errors.push(`Jina Reader:${e.message}`) }
182
+ try {
183
+ const res = await fetch(url, { signal: ctx.signal })
184
+ const type = res.headers.get('content-type') || ''
185
+ const text = await res.text()
186
+ return clip(type.includes('html') ? stripHtml(text) : text)
187
+ } catch (e) {
188
+ errors.push(`直接讀取:${e.message}(多半是對方網站沒開 CORS)`)
189
+ }
190
+ return `無法讀取 ${url}:\n${errors.join('\n')}`
191
+ },
192
+ },
193
+ {
194
+ name: 'get_weather',
195
+ label: '天氣',
196
+ description: '查詢城市的目前天氣與未來幾天預報(Open-Meteo)。',
197
+ parameters: {
198
+ type: 'object',
199
+ properties: {
200
+ city: { type: 'string', description: '城市名稱,例如 Taipei、東京' },
201
+ days: { type: 'integer', description: '預報天數 1-7,預設 3' },
202
+ },
203
+ required: ['city'],
204
+ },
205
+ async run({ city, days = 3 }, ctx) {
206
+ const geo = await getJSON(
207
+ `https://geocoding-api.open-meteo.com/v1/search?${new URLSearchParams({ name: city, count: '1', language: 'zh' })}`,
208
+ { signal: ctx.signal },
209
+ )
210
+ const place = geo?.results?.[0]
211
+ if (!place) return `找不到城市「${city}」,可改用英文名稱再試。`
212
+ const d = Math.min(Math.max(Number(days) || 3, 1), 7)
213
+ const params = new URLSearchParams({
214
+ latitude: place.latitude, longitude: place.longitude, timezone: 'auto', forecast_days: String(d),
215
+ current: 'temperature_2m,apparent_temperature,relative_humidity_2m,precipitation,weather_code,wind_speed_10m',
216
+ daily: 'weather_code,temperature_2m_max,temperature_2m_min,precipitation_probability_max',
217
+ })
218
+ const w = await getJSON(`https://api.open-meteo.com/v1/forecast?${params}`, { signal: ctx.signal })
219
+ const c = w.current || {}
220
+ const daily = (w.daily?.time || []).map((t, i) =>
221
+ `${t}:${weatherText(w.daily.weather_code[i])},${w.daily.temperature_2m_min[i]}~${w.daily.temperature_2m_max[i]}°C,降雨機率 ${w.daily.precipitation_probability_max?.[i] ?? '?'}%`)
222
+ return [
223
+ `${place.name}${place.admin1 ? `,${place.admin1}` : ''},${place.country}(${w.timezone})`,
224
+ `現在(${c.time}):${weatherText(c.weather_code)},${c.temperature_2m}°C(體感 ${c.apparent_temperature}°C),濕度 ${c.relative_humidity_2m}%,風速 ${c.wind_speed_10m} km/h,降水 ${c.precipitation} mm`,
225
+ '預報:',
226
+ ...daily,
227
+ ].join('\n')
228
+ },
229
+ },
230
+ {
231
+ name: 'currency_convert',
232
+ label: '匯率換算',
233
+ description: '用最新匯率換算貨幣(open.er-api.com,每日更新)。',
234
+ parameters: {
235
+ type: 'object',
236
+ properties: {
237
+ amount: { type: 'number', description: '金額' },
238
+ from: { type: 'string', description: '來源幣別代碼,例如 USD' },
239
+ to: { type: 'string', description: '目標幣別代碼,例如 TWD' },
240
+ },
241
+ required: ['amount', 'from', 'to'],
242
+ },
243
+ async run({ amount, from, to }, ctx) {
244
+ const f = String(from).toUpperCase()
245
+ const t = String(to).toUpperCase()
246
+ const data = await getJSON(`https://open.er-api.com/v6/latest/${encodeURIComponent(f)}`, { signal: ctx.signal })
247
+ if (data.result !== 'success') return `查不到 ${f} 的匯率`
248
+ const rate = data.rates?.[t]
249
+ if (!rate) return `查不到 ${t} 的匯率`
250
+ const value = Math.round(Number(amount) * rate * 100) / 100
251
+ return `${amount} ${f} = ${value} ${t}(匯率 1 ${f} = ${rate} ${t},更新於 ${data.time_last_update_utc})`
252
+ },
253
+ },
254
+ {
255
+ name: 'calculate',
256
+ label: '計算機',
257
+ description: '精確計算數學運算式。支援 + - * / % ^、括號、pi、e、sqrt、abs、round、floor、ceil、exp、ln、log、sin、cos、tan、min、max、pow。',
258
+ parameters: {
259
+ type: 'object',
260
+ properties: { expression: { type: 'string', description: '運算式,例如 (2+3)^2 * sqrt(16)' } },
261
+ required: ['expression'],
262
+ },
263
+ run: ({ expression }) => safeCalc(expression),
264
+ },
265
+ {
266
+ name: 'get_current_time',
267
+ label: '目前時間',
268
+ description: '取得目前日期時間,可指定 IANA 時區(例如 Asia/Taipei、America/New_York)。',
269
+ parameters: {
270
+ type: 'object',
271
+ properties: { timezone: { type: 'string', description: 'IANA 時區,省略則用使用者瀏覽器時區' } },
272
+ },
273
+ run({ timezone }) {
274
+ const tz = timezone || Intl.DateTimeFormat().resolvedOptions().timeZone
275
+ try {
276
+ const fmt = new Intl.DateTimeFormat('zh-TW', {
277
+ timeZone: tz, dateStyle: 'full', timeStyle: 'long', hour12: false,
278
+ })
279
+ return `${tz}:${fmt.format(new Date())}(ISO:${new Date().toISOString()})`
280
+ } catch {
281
+ return `無效的時區:${tz}`
282
+ }
283
+ },
284
+ },
285
+ {
286
+ name: 'search_github',
287
+ label: 'GitHub 搜尋',
288
+ description: '搜尋 GitHub 開源專案(依星數排序),回傳名稱、星數、說明、網址。',
289
+ parameters: {
290
+ type: 'object',
291
+ properties: {
292
+ query: { type: 'string', description: '關鍵字,可用 GitHub 語法,例如 "agent language:python"' },
293
+ limit: { type: 'integer', description: '筆數,預設 5' },
294
+ },
295
+ required: ['query'],
296
+ },
297
+ async run({ query, limit = 5 }, ctx) {
298
+ const params = new URLSearchParams({ q: query, sort: 'stars', order: 'desc', per_page: String(Math.min(limit, 10)) })
299
+ const data = await getJSON(`https://api.github.com/search/repositories?${params}`, {
300
+ signal: ctx.signal, headers: { Accept: 'application/vnd.github+json' },
301
+ })
302
+ const items = data.items || []
303
+ if (!items.length) return `GitHub 找不到「${query}」`
304
+ return items.map((r, i) =>
305
+ `[${i + 1}] ${r.full_name} ⭐${r.stargazers_count}${r.language ? ` · ${r.language}` : ''}\n${r.description || ''}\n${r.html_url}(最後更新 ${r.pushed_at?.slice(0, 10)})`).join('\n\n')
306
+ },
307
+ },
308
+ {
309
+ name: 'search_hackernews',
310
+ label: 'Hacker News',
311
+ description: '搜尋 Hacker News 上的科技新聞與討論(Algolia)。',
312
+ parameters: {
313
+ type: 'object',
314
+ properties: {
315
+ query: { type: 'string', description: '關鍵字' },
316
+ recent: { type: 'boolean', description: 'true 依時間排序(最新),false 依熱門度(預設)' },
317
+ },
318
+ required: ['query'],
319
+ },
320
+ async run({ query, recent }, ctx) {
321
+ const ep = recent ? 'search_by_date' : 'search'
322
+ const params = new URLSearchParams({ query, tags: 'story', hitsPerPage: '8', ...(recent ? { numericFilters: 'points>=5' } : {}) })
323
+ const data = await getJSON(`https://hn.algolia.com/api/v1/${ep}?${params}`, { signal: ctx.signal })
324
+ const hits = data.hits || []
325
+ if (!hits.length) return `Hacker News 找不到「${query}」`
326
+ return hits.map((h, i) =>
327
+ `[${i + 1}] ${h.title}(${h.points} 分,${h.num_comments} 則留言,${h.created_at?.slice(0, 10)})\n${h.url || ''}\n討論:https://news.ycombinator.com/item?id=${h.objectID}`).join('\n\n')
328
+ },
329
+ },
330
+ {
331
+ name: 'search_papers',
332
+ label: '論文搜尋',
333
+ description: '搜尋學術論文(Crossref),回傳標題、作者、年份、期刊、DOI。',
334
+ parameters: {
335
+ type: 'object',
336
+ properties: { query: { type: 'string', description: '論文關鍵字' } },
337
+ required: ['query'],
338
+ },
339
+ async run({ query }, ctx) {
340
+ const params = new URLSearchParams({ query, rows: '6', select: 'title,author,issued,container-title,DOI,URL,is-referenced-by-count' })
341
+ const data = await getJSON(`https://api.crossref.org/works?${params}`, { signal: ctx.signal })
342
+ const items = data?.message?.items || []
343
+ if (!items.length) return `找不到「${query}」相關論文`
344
+ return items.map((p, i) => {
345
+ const authors = (p.author || []).slice(0, 3).map((a) => [a.given, a.family].filter(Boolean).join(' ')).join(', ')
346
+ const year = p.issued?.['date-parts']?.[0]?.[0] || '?'
347
+ return `[${i + 1}] ${p.title?.[0] || '(無標題)'}\n${authors}${(p.author || []).length > 3 ? ' 等' : ''} · ${year} · ${p['container-title']?.[0] || ''} · 被引用 ${p['is-referenced-by-count'] ?? 0}\nhttps://doi.org/${p.DOI}`
348
+ }).join('\n\n')
349
+ },
350
+ },
351
+ {
352
+ name: 'search_books',
353
+ label: '書籍搜尋',
354
+ description: '搜尋書籍(Open Library),回傳書名、作者、出版年。',
355
+ parameters: {
356
+ type: 'object',
357
+ properties: { query: { type: 'string', description: '書名或作者' } },
358
+ required: ['query'],
359
+ },
360
+ async run({ query }, ctx) {
361
+ // Open Library 要求查詢至少 3 字元;短的中文書名加萬用字元
362
+ const q = query.trim().length < 3 ? `${query.trim()}*` : query.trim()
363
+ const params = new URLSearchParams({ q, limit: '6', fields: 'title,author_name,first_publish_year,key,edition_count' })
364
+ const data = await getJSON(`https://openlibrary.org/search.json?${params}`, { signal: ctx.signal })
365
+ const docs = data.docs || []
366
+ if (!docs.length) return `找不到「${query}」`
367
+ return docs.map((b, i) =>
368
+ `[${i + 1}] ${b.title} — ${(b.author_name || []).slice(0, 2).join(', ')}(${b.first_publish_year || '?'},${b.edition_count || 1} 個版本)\nhttps://openlibrary.org${b.key}`).join('\n\n')
369
+ },
370
+ },
371
+ {
372
+ name: 'save_note',
373
+ label: '寫入專案筆記',
374
+ description: '把重要資訊、結論或待辦寫進目前專案的筆記,之後同專案的任何對話都讀得到。',
375
+ parameters: {
376
+ type: 'object',
377
+ properties: {
378
+ title: { type: 'string', description: '筆記標題' },
379
+ content: { type: 'string', description: '筆記內容(可用 Markdown)' },
380
+ },
381
+ required: ['title', 'content'],
382
+ },
383
+ run({ title, content }, ctx) {
384
+ if (!ctx.project) return '目前沒有專案'
385
+ ctx.addNote(ctx.project.id, { title, content })
386
+ return `已寫入專案「${ctx.project.name}」的筆記:${title}`
387
+ },
388
+ },
389
+ {
390
+ name: 'read_notes',
391
+ label: '讀取專案筆記',
392
+ description: '讀取目前專案的筆記,可用關鍵字過濾。',
393
+ parameters: {
394
+ type: 'object',
395
+ properties: { keyword: { type: 'string', description: '關鍵字(可省略,省略則全部列出)' } },
396
+ },
397
+ run({ keyword }, ctx) {
398
+ const notes = ctx.project?.notes || []
399
+ const k = (keyword || '').toLowerCase()
400
+ const hit = k ? notes.filter((n) => `${n.title}\n${n.content}`.toLowerCase().includes(k)) : notes
401
+ if (!hit.length) return k ? `沒有包含「${keyword}」的筆記` : '專案目前沒有筆記'
402
+ return clip(hit.map((n) => `## ${n.title}(${n.updatedAt?.slice(0, 10) || ''})\n${n.content}`).join('\n\n'))
403
+ },
404
+ },
405
+ ]
406
+
407
+ export const BUILTIN_TOOL_NAMES = BUILTIN_TOOLS.map((t) => t.name)
408
+
409
+ /* ------------------------------ 自訂 HTTP 工具 ------------------------------ */
410
+
411
+ /**
412
+ * 自訂工具可設定 endpoint,例如:
413
+ * GET https://api.example.com/v1/items?q={query}
414
+ * POST https://api.example.com/run (參數以 JSON body 送出)
415
+ * {參數名} 會被替換成 URL 編碼後的參數值。沒有 endpoint 的自訂工具只會回「未實作」。
416
+ */
417
+ async function runCustomTool(tool, args, ctx) {
418
+ if (!tool.endpoint?.trim()) {
419
+ return `自訂工具「${tool.name}」沒有設定 endpoint,無法執行。收到參數:${JSON.stringify(args)}`
420
+ }
421
+ const url = tool.endpoint.replace(/\{(\w+)\}/g, (_, k) => encodeURIComponent(args?.[k] ?? ''))
422
+ const method = (tool.method || 'GET').toUpperCase()
423
+ let headers = {}
424
+ if (tool.headers?.trim()) {
425
+ try { headers = JSON.parse(tool.headers) } catch { return '自訂工具 headers 不是合法 JSON' }
426
+ }
427
+ const init = { method, signal: ctx.signal, headers }
428
+ if (method !== 'GET' && method !== 'HEAD') {
429
+ init.headers = { 'Content-Type': 'application/json', ...headers }
430
+ init.body = JSON.stringify(args || {})
431
+ }
432
+ const res = await fetch(url, init)
433
+ const text = await res.text()
434
+ return clip(`HTTP ${res.status}\n${text}`)
435
+ }
436
+
437
+ /* ------------------------------ 對外 API ------------------------------ */
438
+
439
+ /** 取得某 Agent 可用的工具清單(內建 + 自訂) */
440
+ export function resolveTools(enabledNames, customTools) {
441
+ const all = [...BUILTIN_TOOLS, ...(customTools || []).map((t) => ({ ...t, custom: true }))]
442
+ const set = new Set(enabledNames || [])
443
+ return all.filter((t) => set.has(t.name))
444
+ }
445
+
446
+ /** 轉成 OpenAI 相容 tools 格式 */
447
+ export function toOpenAITools(list) {
448
+ return (list || []).map((t) => ({
449
+ type: 'function',
450
+ function: {
451
+ name: t.name,
452
+ description: t.description || '',
453
+ parameters: t.parameters || { type: 'object', properties: {} },
454
+ },
455
+ }))
456
+ }
457
+
458
+ /** 執行一個 tool_call,永遠回傳字串,不丟例外 */
459
+ export async function executeToolCall(call, tools, ctx) {
460
+ const name = call?.function?.name
461
+ let args = {}
462
+ try {
463
+ args = call?.function?.arguments ? JSON.parse(call.function.arguments) : {}
464
+ } catch {
465
+ return `工具參數不是合法 JSON:${call?.function?.arguments}`
466
+ }
467
+ const tool = tools.find((t) => t.name === name)
468
+ if (!tool) return `工具「${name}」不存在或未啟用`
469
+ try {
470
+ const out = tool.custom ? await runCustomTool(tool, args, ctx) : await tool.run(args || {}, ctx)
471
+ return clip(out)
472
+ } catch (e) {
473
+ if (e.name === 'AbortError') return '已中止'
474
+ return `工具「${name}」執行失敗:${e.message}`
475
+ }
476
+ }
477
+
478
+ function weatherText(code) {
479
+ const map = {
480
+ 0: '晴', 1: '大致晴朗', 2: '局部多雲', 3: '陰', 45: '霧', 48: '霧凇',
481
+ 51: '毛毛雨', 53: '毛毛雨', 55: '濃毛毛雨', 61: '小雨', 63: '中雨', 65: '大雨',
482
+ 66: '凍雨', 67: '強凍雨', 71: '小雪', 73: '中雪', 75: '大雪', 77: '雪粒',
483
+ 80: '陣雨', 81: '較強陣雨', 82: '豪大陣雨', 85: '陣雪', 86: '強陣雪',
484
+ 95: '雷雨', 96: '雷雨夾冰雹', 99: '強雷雨夾冰雹',
485
+ }
486
+ return map[code] ?? `天氣代碼 ${code}`
487
+ }
src/store/useStore.js ADDED
@@ -0,0 +1,555 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ------------------------------------------------------------------ *
2
+ * 全域狀態(zustand + localStorage 持久化)
3
+ *
4
+ * 結構以「專案」為主軸:
5
+ * 專案 → 多個對話 + 專案指示(system prompt)+ 專案筆記 + 預設 Agent / 模型
6
+ * ------------------------------------------------------------------ */
7
+ import { create } from 'zustand'
8
+ import { persist, createJSONStorage } from 'zustand/middleware'
9
+ import { BUILTIN_AGENTS } from '../lib/agents'
10
+ import { PROVIDER_PRESETS, makeProvider, uid } from '../lib/providers'
11
+ import { streamChat } from '../lib/llm'
12
+ import { resolveTools, toOpenAITools, executeToolCall } from '../lib/tools'
13
+
14
+ const now = () => new Date().toISOString()
15
+ const controllers = new Map() // convId → AbortController(不持久化)
16
+
17
+ /* 寫入 localStorage 做節流,避免串流時每個 token 都整包序列化 */
18
+ function debouncedStorage(delay = 600) {
19
+ const timers = {}
20
+ const pending = {}
21
+ const flush = (name) => {
22
+ if (pending[name] === undefined) return
23
+ try { localStorage.setItem(name, pending[name]) } catch (e) { console.error('localStorage 寫入失敗(可能超過容量)', e) }
24
+ delete pending[name]
25
+ }
26
+ if (typeof window !== 'undefined') {
27
+ window.addEventListener('beforeunload', () => Object.keys(pending).forEach(flush))
28
+ }
29
+ return {
30
+ getItem: (name) => localStorage.getItem(name),
31
+ setItem: (name, value) => {
32
+ pending[name] = value
33
+ clearTimeout(timers[name])
34
+ timers[name] = setTimeout(() => flush(name), delay)
35
+ },
36
+ removeItem: (name) => localStorage.removeItem(name),
37
+ }
38
+ }
39
+
40
+ function makeProject(name = '我的第一個專案', extra = {}) {
41
+ return {
42
+ id: uid(),
43
+ name,
44
+ description: '',
45
+ instructions: '',
46
+ defaultAgentId: 'assistant',
47
+ defaultProviderId: '',
48
+ defaultModel: '',
49
+ notes: [],
50
+ createdAt: now(),
51
+ ...extra,
52
+ }
53
+ }
54
+
55
+ function initialState() {
56
+ const provider = makeProvider(PROVIDER_PRESETS[0])
57
+ // 沿用舊版(v1)存在 localStorage 的單一設定
58
+ try {
59
+ const old = JSON.parse(localStorage.getItem('agentStudioConfig') || 'null')
60
+ if (old?.supplier) {
61
+ provider.baseUrl = old.supplier
62
+ provider.apiKey = old.apiKey || ''
63
+ if (old.model && !provider.models.includes(old.model)) provider.models.unshift(old.model)
64
+ }
65
+ } catch { /* ignore */ }
66
+ const project = makeProject('我的第一個專案', { defaultProviderId: provider.id, defaultModel: provider.models[0] || '' })
67
+ return {
68
+ settings: {
69
+ theme: localStorage.getItem('theme') || 'dark',
70
+ maxSteps: 10,
71
+ temperature: '',
72
+ tavilyKey: '',
73
+ jinaKey: '',
74
+ },
75
+ providers: [provider],
76
+ agents: BUILTIN_AGENTS.map((a) => ({ ...a, builtin: true })),
77
+ customTools: [],
78
+ projects: [project],
79
+ conversations: {},
80
+ activeProjectId: project.id,
81
+ activeConversationId: null,
82
+ }
83
+ }
84
+
85
+ /* ------------------------------ 送進 API 的訊息 ------------------------------ */
86
+
87
+ function buildSystemPrompt(agent, project) {
88
+ const parts = []
89
+ if (agent?.systemPrompt) parts.push(agent.systemPrompt)
90
+ if (project) {
91
+ parts.push(`\n【目前專案】${project.name}${project.description ? `:${project.description}` : ''}`)
92
+ if (project.instructions?.trim()) parts.push(`【專案指示】\n${project.instructions.trim()}`)
93
+ if (project.notes?.length) {
94
+ const list = project.notes.map((n) => `- ${n.title}:${String(n.content).slice(0, 300)}`).join('\n')
95
+ parts.push(`【專案筆記】(摘要,完整內容可用 read_notes 工具讀取)\n${list.slice(0, 3000)}`)
96
+ }
97
+ }
98
+ parts.push(`【目前時間】${new Date().toString()}`)
99
+ return parts.join('\n')
100
+ }
101
+
102
+ /** 清理歷史:移除錯誤訊息、只保留有對應結果的 tool_calls(避免中止後 API 回 400) */
103
+ function toApiMessages(messages, systemPrompt) {
104
+ const valid = messages.filter((m) => !m.error && !m.info)
105
+ const resultIds = new Set(valid.filter((m) => m.role === 'tool').map((m) => m.tool_call_id))
106
+ const keptCallIds = new Set()
107
+ const out = [{ role: 'system', content: systemPrompt }]
108
+ for (const m of valid) {
109
+ if (m.role === 'user') out.push({ role: 'user', content: m.content })
110
+ else if (m.role === 'assistant') {
111
+ const calls = (m.tool_calls || []).filter((c) => resultIds.has(c.id))
112
+ calls.forEach((c) => keptCallIds.add(c.id))
113
+ if (!calls.length && !m.content) continue
114
+ const msg = { role: 'assistant', content: m.content || (calls.length ? null : '') }
115
+ if (calls.length) {
116
+ msg.tool_calls = calls.map((c) => ({
117
+ id: c.id, type: 'function', function: { name: c.function.name, arguments: c.function.arguments || '{}' },
118
+ }))
119
+ }
120
+ out.push(msg)
121
+ } else if (m.role === 'tool' && keptCallIds.has(m.tool_call_id)) {
122
+ out.push({ role: 'tool', tool_call_id: m.tool_call_id, content: String(m.content ?? '') })
123
+ }
124
+ }
125
+ return out
126
+ }
127
+
128
+ /* ------------------------------ Store ------------------------------ */
129
+
130
+ export const useStore = create(
131
+ persist(
132
+ (set, get) => {
133
+ const patchConv = (convId, fn) =>
134
+ set((s) => {
135
+ const c = s.conversations[convId]
136
+ if (!c) return {}
137
+ return { conversations: { ...s.conversations, [convId]: { ...c, ...fn(c), updatedAt: now() } } }
138
+ })
139
+ const pushMsg = (convId, msg) => patchConv(convId, (c) => ({ messages: [...c.messages, msg] }))
140
+ const patchMsg = (convId, msgId, patch) =>
141
+ patchConv(convId, (c) => ({ messages: c.messages.map((m) => (m.id === msgId ? { ...m, ...patch } : m)) }))
142
+
143
+ return {
144
+ ...initialState(),
145
+ running: {}, // convId → 目前步數(不持久化)
146
+ sidebarOpen: false, // 行動版側邊欄(不持久化)
147
+
148
+ /* ---------- UI ---------- */
149
+ setSidebarOpen: (v) => set({ sidebarOpen: v }),
150
+ updateSettings: (patch) => set((s) => ({ settings: { ...s.settings, ...patch } })),
151
+
152
+ /* ---------- 供應商 ---------- */
153
+ addProvider: (preset) => {
154
+ const p = makeProvider(preset)
155
+ set((s) => ({ providers: [...s.providers, p] }))
156
+ return p.id
157
+ },
158
+ updateProvider: (id, patch) =>
159
+ set((s) => ({ providers: s.providers.map((p) => (p.id === id ? { ...p, ...patch } : p)) })),
160
+ removeProvider: (id) => set((s) => ({ providers: s.providers.filter((p) => p.id !== id) })),
161
+
162
+ /* ---------- Agent ---------- */
163
+ saveAgent: (agent) =>
164
+ set((s) => {
165
+ const exists = s.agents.some((a) => a.id === agent.id)
166
+ return { agents: exists ? s.agents.map((a) => (a.id === agent.id ? { ...a, ...agent } : a)) : [...s.agents, agent] }
167
+ }),
168
+ removeAgent: (id) => set((s) => ({ agents: s.agents.filter((a) => a.id !== id) })),
169
+ resetBuiltinAgents: () =>
170
+ set((s) => ({
171
+ agents: [...BUILTIN_AGENTS.map((a) => ({ ...a, builtin: true })), ...s.agents.filter((a) => !a.builtin)],
172
+ })),
173
+
174
+ /* ---------- 自訂工具 ---------- */
175
+ saveCustomTool: (tool) =>
176
+ set((s) => {
177
+ const exists = s.customTools.some((t) => t.name === tool.name)
178
+ return { customTools: exists ? s.customTools.map((t) => (t.name === tool.name ? tool : t)) : [...s.customTools, tool] }
179
+ }),
180
+ removeCustomTool: (name) => set((s) => ({ customTools: s.customTools.filter((t) => t.name !== name) })),
181
+
182
+ /* ---------- 專案 ---------- */
183
+ createProject: (name) => {
184
+ const s = get()
185
+ const cur = s.projects.find((p) => p.id === s.activeProjectId)
186
+ const p = makeProject(name || '新專案', {
187
+ defaultProviderId: cur?.defaultProviderId || s.providers[0]?.id || '',
188
+ defaultModel: cur?.defaultModel || s.providers[0]?.models?.[0] || '',
189
+ })
190
+ set((st) => ({ projects: [...st.projects, p], activeProjectId: p.id, activeConversationId: null }))
191
+ return p.id
192
+ },
193
+ updateProject: (id, patch) =>
194
+ set((s) => ({ projects: s.projects.map((p) => (p.id === id ? { ...p, ...patch } : p)) })),
195
+ removeProject: (id) =>
196
+ set((s) => {
197
+ const projects = s.projects.filter((p) => p.id !== id)
198
+ const conversations = Object.fromEntries(Object.entries(s.conversations).filter(([, c]) => c.projectId !== id))
199
+ const fallback = projects[0] || makeProject()
200
+ return {
201
+ projects: projects.length ? projects : [fallback],
202
+ conversations,
203
+ activeProjectId: s.activeProjectId === id ? fallback.id : s.activeProjectId,
204
+ activeConversationId: conversations[s.activeConversationId] ? s.activeConversationId : null,
205
+ }
206
+ }),
207
+ selectProject: (id) => {
208
+ const convs = Object.values(get().conversations).filter((c) => c.projectId === id)
209
+ convs.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt))
210
+ set({ activeProjectId: id, activeConversationId: convs[0]?.id || null })
211
+ },
212
+
213
+ /* ---------- 專案筆記 ---------- */
214
+ addNote: (projectId, { title, content }) =>
215
+ set((s) => ({
216
+ projects: s.projects.map((p) =>
217
+ p.id === projectId
218
+ ? { ...p, notes: [...(p.notes || []), { id: uid(), title, content, createdAt: now(), updatedAt: now() }] }
219
+ : p),
220
+ })),
221
+ updateNote: (projectId, noteId, patch) =>
222
+ set((s) => ({
223
+ projects: s.projects.map((p) =>
224
+ p.id === projectId
225
+ ? { ...p, notes: p.notes.map((n) => (n.id === noteId ? { ...n, ...patch, updatedAt: now() } : n)) }
226
+ : p),
227
+ })),
228
+ removeNote: (projectId, noteId) =>
229
+ set((s) => ({
230
+ projects: s.projects.map((p) => (p.id === projectId ? { ...p, notes: p.notes.filter((n) => n.id !== noteId) } : p)),
231
+ })),
232
+
233
+ /* ---------- 對話 ---------- */
234
+ createConversation: () => {
235
+ const s = get()
236
+ const project = s.projects.find((p) => p.id === s.activeProjectId) || s.projects[0]
237
+ const providerId = s.providers.some((p) => p.id === project.defaultProviderId)
238
+ ? project.defaultProviderId
239
+ : s.providers[0]?.id || ''
240
+ const provider = s.providers.find((p) => p.id === providerId)
241
+ const conv = {
242
+ id: uid(),
243
+ projectId: project.id,
244
+ title: '新對話',
245
+ agentId: project.defaultAgentId || 'assistant',
246
+ providerId,
247
+ model: project.defaultModel || provider?.models?.[0] || '',
248
+ messages: [],
249
+ createdAt: now(),
250
+ updatedAt: now(),
251
+ }
252
+ set((st) => ({ conversations: { ...st.conversations, [conv.id]: conv }, activeConversationId: conv.id }))
253
+ return conv.id
254
+ },
255
+ selectConversation: (id) => set({ activeConversationId: id, sidebarOpen: false }),
256
+ updateConversation: (id, patch) => patchConv(id, () => patch),
257
+ removeConversation: (id) => {
258
+ get().stop(id)
259
+ set((s) => {
260
+ const conversations = { ...s.conversations }
261
+ delete conversations[id]
262
+ return { conversations, activeConversationId: s.activeConversationId === id ? null : s.activeConversationId }
263
+ })
264
+ },
265
+ clearConversation: (id) => { if (!get().running[id]) patchConv(id, () => ({ messages: [] })) },
266
+ deleteMessage: (convId, msgId) => patchConv(convId, (c) => ({ messages: c.messages.filter((m) => m.id !== msgId) })),
267
+
268
+ /* ---------- 執行 ---------- */
269
+ stop: (convId) => controllers.get(convId)?.abort(),
270
+
271
+ async send(convId, text) {
272
+ const conv = get().conversations[convId]
273
+ if (!conv || get().running[convId]) return
274
+ const content = text.trim()
275
+ if (!content) return
276
+ if (!conv.messages.some((m) => m.role === 'user')) {
277
+ patchConv(convId, () => ({ title: content.replace(/\s+/g, ' ').slice(0, 30) }))
278
+ }
279
+ pushMsg(convId, { id: uid(), role: 'user', content, createdAt: now() })
280
+ await get().runLoop(convId)
281
+ },
282
+
283
+ async regenerate(convId) {
284
+ const conv = get().conversations[convId]
285
+ if (!conv || get().running[convId]) return
286
+ const lastUser = conv.messages.map((m) => m.role).lastIndexOf('user')
287
+ if (lastUser < 0) return
288
+ patchConv(convId, (c) => ({ messages: c.messages.slice(0, lastUser + 1) }))
289
+ await get().runLoop(convId)
290
+ },
291
+
292
+ async runLoop(convId) {
293
+ const s = get()
294
+ const conv = s.conversations[convId]
295
+ const project = s.projects.find((p) => p.id === conv.projectId)
296
+ const agent = s.agents.find((a) => a.id === conv.agentId) || s.agents[0]
297
+ const provider = s.providers.find((p) => p.id === conv.providerId)
298
+
299
+ const fail = (msg) => pushMsg(convId, { id: uid(), role: 'assistant', content: `⚠️ ${msg}`, error: true, createdAt: now() })
300
+ if (!provider) return fail('這個對話沒有選擇供應商,請在側邊欄「目前對話」選一個')
301
+ if (!provider.baseUrl?.trim()) return fail(`供應商「${provider.name}」沒有設定 API URL`)
302
+ if (!provider.noKey && !provider.apiKey?.trim()) return fail(`供應商「${provider.name}」尚未填 API Key(側邊欄 → 模型)`)
303
+ if (!conv.model?.trim()) return fail('尚未選擇模型')
304
+
305
+ const tools = resolveTools(agent?.tools, s.customTools)
306
+ const apiTools = toOpenAITools(tools)
307
+ const temp = s.settings.temperature === '' ? undefined : Number(s.settings.temperature)
308
+ const maxSteps = Math.max(1, Number(s.settings.maxSteps) || 10)
309
+
310
+ const controller = new AbortController()
311
+ controllers.set(convId, controller)
312
+ set((st) => ({ running: { ...st.running, [convId]: 1 } }))
313
+
314
+ try {
315
+ let finished = false
316
+ for (let step = 1; step <= maxSteps; step++) {
317
+ set((st) => ({ running: { ...st.running, [convId]: step } }))
318
+ const cur = get().conversations[convId]
319
+ if (!cur) return
320
+ const curProject = get().projects.find((p) => p.id === cur.projectId) || project
321
+ const messages = toApiMessages(cur.messages, buildSystemPrompt(agent, curProject))
322
+
323
+ const msgId = uid()
324
+ pushMsg(convId, {
325
+ id: msgId, role: 'assistant', content: '', reasoning: '', tool_calls: [],
326
+ streaming: true, model: conv.model, agentId: agent?.id, createdAt: now(),
327
+ })
328
+
329
+ let result
330
+ try {
331
+ result = await streamChat({
332
+ provider, model: conv.model, messages, tools: apiTools, temperature: temp,
333
+ signal: controller.signal,
334
+ onDelta: (d) => patchMsg(convId, msgId, d),
335
+ })
336
+ } catch (e) {
337
+ const aborted = e.name === 'AbortError'
338
+ const partial = get().conversations[convId]?.messages.find((m) => m.id === msgId)
339
+ if (aborted) {
340
+ patchMsg(convId, msgId, { streaming: false, stopped: true, tool_calls: [] })
341
+ if (!partial?.content) patchMsg(convId, msgId, { content: '⏹ 已停止', info: true })
342
+ } else {
343
+ patchMsg(convId, msgId, {
344
+ streaming: false, error: true, tool_calls: [],
345
+ content: `${partial?.content ? `${partial.content}\n\n` : ''}⚠️ ${e.message}`,
346
+ })
347
+ }
348
+ finished = true
349
+ break
350
+ }
351
+
352
+ patchMsg(convId, msgId, {
353
+ streaming: false,
354
+ content: result.content,
355
+ reasoning: result.reasoning,
356
+ tool_calls: result.tool_calls,
357
+ })
358
+ if (!result.tool_calls.length) {
359
+ if (!result.content && !result.reasoning) {
360
+ patchMsg(convId, msgId, { content: '⚠️ 模型沒有回傳任何內容', error: true })
361
+ }
362
+ finished = true
363
+ break
364
+ }
365
+
366
+ const ctx = {
367
+ settings: get().settings,
368
+ project: get().projects.find((p) => p.id === conv.projectId),
369
+ addNote: get().addNote,
370
+ signal: controller.signal,
371
+ }
372
+ for (const call of result.tool_calls) {
373
+ const toolMsgId = uid()
374
+ pushMsg(convId, {
375
+ id: toolMsgId, role: 'tool', tool_call_id: call.id, name: call.function?.name,
376
+ arguments: call.function?.arguments, content: '', pending: true, createdAt: now(),
377
+ })
378
+ const output = controller.signal.aborted ? '已中止' : await executeToolCall(call, tools, ctx)
379
+ ctx.project = get().projects.find((p) => p.id === conv.projectId)
380
+ patchMsg(convId, toolMsgId, { content: output, pending: false })
381
+ }
382
+ if (controller.signal.aborted) {
383
+ pushMsg(convId, { id: uid(), role: 'assistant', content: '⏹ 已停止', info: true, createdAt: now() })
384
+ finished = true
385
+ break
386
+ }
387
+ }
388
+ if (!finished) {
389
+ pushMsg(convId, {
390
+ id: uid(), role: 'assistant', info: true, createdAt: now(),
391
+ content: `⏸ 已達步數上限(${maxSteps} 步)。可輸入「繼續」讓 Agent 接著做,或在設定調高上限。`,
392
+ })
393
+ }
394
+ } finally {
395
+ controllers.delete(convId)
396
+ set((st) => {
397
+ const running = { ...st.running }
398
+ delete running[convId]
399
+ return { running }
400
+ })
401
+ }
402
+ },
403
+
404
+ /* ---------- 匯入 / 匯出 ---------- */
405
+ exportData(scope = 'all', { includeKeys = true, id } = {}) {
406
+ const s = get()
407
+ const strip = (providers) => providers.map((p) => (includeKeys ? p : { ...p, apiKey: '' }))
408
+ const settings = includeKeys ? s.settings : { ...s.settings, tavilyKey: '', jinaKey: '' }
409
+ const base = { app: 'agent-studio', version: 2, type: scope, exportedAt: now() }
410
+ if (scope === 'settings') {
411
+ return { ...base, data: { settings, providers: strip(s.providers), agents: s.agents, customTools: s.customTools } }
412
+ }
413
+ if (scope === 'project') {
414
+ const project = s.projects.find((p) => p.id === id)
415
+ const conversations = Object.values(s.conversations).filter((c) => c.projectId === id)
416
+ return { ...base, data: { projects: [project], conversations } }
417
+ }
418
+ if (scope === 'conversation') {
419
+ return { ...base, data: { conversations: [s.conversations[id]] } }
420
+ }
421
+ return {
422
+ ...base,
423
+ type: 'all',
424
+ data: {
425
+ settings, providers: strip(s.providers), agents: s.agents, customTools: s.customTools,
426
+ projects: s.projects, conversations: Object.values(s.conversations),
427
+ activeProjectId: s.activeProjectId, activeConversationId: s.activeConversationId,
428
+ },
429
+ }
430
+ },
431
+
432
+ /** mode: 'merge'(合併,同 id 覆蓋)| 'replace'(整個取代)。回傳摘要字串 */
433
+ importData(json, mode = 'merge') {
434
+ let file = json
435
+ // 相容 v1 匯出格式 { messages: [...] }
436
+ if (Array.isArray(file?.messages) && !file.data) {
437
+ file = {
438
+ type: 'conversation',
439
+ data: {
440
+ conversations: [{
441
+ id: uid(), title: `匯入:${file.source || '舊版對話'}`, agentId: 'assistant',
442
+ messages: file.messages.map((m) => ({ ...m, id: uid() })), createdAt: now(), updatedAt: now(),
443
+ }],
444
+ },
445
+ }
446
+ }
447
+ const d = file?.data
448
+ if (!d) throw new Error('檔案格式不正確(找不到 data 欄位)')
449
+ const s = get()
450
+ const summary = []
451
+
452
+ if (mode === 'replace' && file.type === 'all') {
453
+ const projects = d.projects?.length ? d.projects : [makeProject()]
454
+ const conversations = Object.fromEntries((d.conversations || []).map((c) => [c.id, c]))
455
+ set({
456
+ settings: { ...initialState().settings, ...(d.settings || {}) },
457
+ providers: d.providers || [],
458
+ agents: d.agents?.length ? d.agents : BUILTIN_AGENTS.map((a) => ({ ...a, builtin: true })),
459
+ customTools: d.customTools || [],
460
+ projects,
461
+ conversations,
462
+ activeProjectId: projects.some((p) => p.id === d.activeProjectId) ? d.activeProjectId : projects[0].id,
463
+ activeConversationId: conversations[d.activeConversationId] ? d.activeConversationId : null,
464
+ })
465
+ return `已取代全部資料:${projects.length} 個專案、${Object.keys(conversations).length} 個對話`
466
+ }
467
+
468
+ const mergeById = (cur, inc, key = 'id') => {
469
+ const map = new Map(cur.map((x) => [x[key], x]))
470
+ inc.forEach((x) => {
471
+ const prev = map.get(x[key])
472
+ // 匯入的設定沒帶金鑰時保留本機原有金鑰
473
+ if (prev && 'apiKey' in x && !x.apiKey && prev.apiKey) x = { ...x, apiKey: prev.apiKey }
474
+ map.set(x[key], x)
475
+ })
476
+ return [...map.values()]
477
+ }
478
+
479
+ const patch = {}
480
+ if (d.settings) {
481
+ const inc = { ...d.settings }
482
+ if (!inc.tavilyKey) delete inc.tavilyKey
483
+ if (!inc.jinaKey) delete inc.jinaKey
484
+ patch.settings = { ...s.settings, ...inc }
485
+ summary.push('設定')
486
+ }
487
+ if (d.providers) { patch.providers = mergeById(s.providers, d.providers); summary.push(`${d.providers.length} 個供應商`) }
488
+ if (d.agents) { patch.agents = mergeById(s.agents, d.agents); summary.push(`${d.agents.length} 個 Agent`) }
489
+ if (d.customTools) { patch.customTools = mergeById(s.customTools, d.customTools, 'name'); summary.push(`${d.customTools.length} 個自訂工具`) }
490
+
491
+ let projects = patch.projects || s.projects
492
+ if (d.projects) {
493
+ projects = mergeById(projects, d.projects.filter(Boolean))
494
+ patch.projects = projects
495
+ summary.push(`${d.projects.length} 個專案`)
496
+ }
497
+ if (d.conversations) {
498
+ const conversations = { ...s.conversations }
499
+ const projectIds = new Set(projects.map((p) => p.id))
500
+ d.conversations.filter(Boolean).forEach((c) => {
501
+ // 對話所屬專案不存在時,掛到目前專案
502
+ const conv = { ...c, projectId: projectIds.has(c.projectId) ? c.projectId : s.activeProjectId }
503
+ if (!conv.providerId || !(patch.providers || s.providers).some((p) => p.id === conv.providerId)) {
504
+ const prov = (patch.providers || s.providers)[0]
505
+ conv.providerId = prov?.id || ''
506
+ if (!conv.model) conv.model = prov?.models?.[0] || ''
507
+ }
508
+ conversations[conv.id] = conv
509
+ })
510
+ patch.conversations = conversations
511
+ summary.push(`${d.conversations.length} 個對話`)
512
+ if (d.conversations.length === 1 && file.type === 'conversation') {
513
+ const c = conversations[d.conversations[0].id]
514
+ patch.activeProjectId = c.projectId
515
+ patch.activeConversationId = c.id
516
+ }
517
+ }
518
+ set(patch)
519
+ return `已匯入:${summary.join('、') || '(沒有可匯入的內容)'}`
520
+ },
521
+
522
+ resetAll() {
523
+ Object.keys(get().running).forEach((id) => get().stop(id))
524
+ set({ ...initialState(), running: {} })
525
+ },
526
+ }
527
+ },
528
+ {
529
+ name: 'agentStudio.v2',
530
+ storage: createJSONStorage(() => debouncedStorage()),
531
+ partialize: (s) => ({
532
+ settings: s.settings,
533
+ providers: s.providers,
534
+ agents: s.agents,
535
+ customTools: s.customTools,
536
+ projects: s.projects,
537
+ conversations: s.conversations,
538
+ activeProjectId: s.activeProjectId,
539
+ activeConversationId: s.activeConversationId,
540
+ }),
541
+ // 重新整理時若有串流中斷的訊息,把狀態收尾
542
+ onRehydrateStorage: () => (state) => {
543
+ if (!state) return
544
+ Object.values(state.conversations || {}).forEach((c) => {
545
+ c.messages = (c.messages || []).map((m) => (m.streaming || m.pending ? { ...m, streaming: false, pending: false, stopped: true } : m))
546
+ })
547
+ },
548
+ },
549
+ ),
550
+ )
551
+
552
+ /* ---------- 選取器 ---------- */
553
+ export const useActiveProject = () =>
554
+ useStore((s) => s.projects.find((p) => p.id === s.activeProjectId) || s.projects[0])
555
+ export const useActiveConversation = () => useStore((s) => s.conversations[s.activeConversationId] || null)
src/utils/calc.js CHANGED
@@ -1,77 +1,138 @@
1
  /* ------------------------------------------------------------------ *
2
- * 安全四則運算求值。
3
  *
4
- * 模型輸出的 expression 屬於不可信輸入,因此:
5
- * - 先用正則白色清單擋掉任何運算子以外的字元
6
- * - 再用遞迴下降解析器求值
7
- * 全程不用 Function() / eval() / new Function,沒有代碼執行面。
 
 
8
  * ------------------------------------------------------------------ */
9
 
10
- const CALC_RE = /^[\d\s+\-*/().%]+$/
 
 
 
 
 
 
11
 
12
- /** 把表達式轉成計算結果字串;任何異常都轉成錯誤訊息回傳,不丟例外。 */
13
- export function safeCalc(expression) {
14
- if (typeof expression !== 'string' || !expression.trim()) {
15
- return '計算錯誤:表達式為空'
16
- }
17
- if (!CALC_RE.test(expression)) {
18
- return `計算錯誤:只支援數字與 + - * / ( ) . %(收到「${expression}」)`
19
- }
20
- try {
21
- const value = evaluate(expression.replace(/\s+/g, ''))
22
- if (!Number.isFinite(value)) return `計算錯誤:結果無效(${expression})`
23
- // 消掉浮點誤差:0.1 + 0.2 應顯示 0.3
24
- return `計算結果:${Math.round(value * 1e10) / 1e10}`
25
- } catch (e) {
26
- return `計算錯誤:${expression}(${e.message})`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  }
 
28
  }
29
 
30
- /** 遞迴下降解析器:+ - 最外層,* / % 次之,數字/括號最內層。 */
31
- function evaluate(expr) {
32
  let pos = 0
33
- const peek = () => expr[pos]
34
- const take = () => expr[pos++]
 
35
 
36
- function parseExpr() {
37
- let left = parseTerm()
38
- while (peek() === '+' || peek() === '-') {
39
- const op = take()
40
- const right = parseTerm()
41
  left = op === '+' ? left + right : left - right
42
  }
43
  return left
44
  }
45
-
46
- function parseTerm() {
47
- let left = parseFactor()
48
- while (peek() === '*' || peek() === '/' || peek() === '%') {
49
- const op = take()
50
- const right = parseFactor()
51
  left = op === '*' ? left * right : op === '/' ? left / right : left % right
52
  }
53
  return left
54
  }
55
-
56
- function parseFactor() {
57
- if (peek() === '-') { take(); return -parseFactor() }
58
- if (peek() === '+') { take(); return parseFactor() }
59
- if (peek() === '(') {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  take()
61
- const value = parseExpr()
62
- if (peek() !== ')') throw new Error('括號不配對')
 
 
 
 
63
  take()
64
- return value
65
  }
66
- const start = pos
67
- while (pos < expr.length && /[\d.]/.test(expr[pos])) pos++
68
- if (start === pos) throw new Error('預期數字')
69
- const value = Number(expr.slice(start, pos))
70
- if (Number.isNaN(value)) throw new Error('數字格式錯誤')
71
- return value
72
  }
73
 
74
- const result = parseExpr()
75
- if (pos !== expr.length) throw new Error('表達式有多餘字元')
76
  return result
77
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /* ------------------------------------------------------------------ *
2
+ * 安全數學求值(無 eval / Function)。
3
  *
4
+ * 模型輸出的 expression 屬於不可信輸入,因此只用自寫的 tokenizer +
5
+ * 遞迴下降解析器求值。支援:
6
+ * 數字、+ - * / % ^(次方)、括號、逗號
7
+ * 常數:pi, e
8
+ * 函式:sqrt abs round floor ceil exp ln log log10 log2
9
+ * sin cos tan asin acos atan min max pow
10
  * ------------------------------------------------------------------ */
11
 
12
+ const FUNCS = {
13
+ sqrt: Math.sqrt, abs: Math.abs, round: Math.round, floor: Math.floor, ceil: Math.ceil,
14
+ exp: Math.exp, ln: Math.log, log: Math.log10, log10: Math.log10, log2: Math.log2,
15
+ sin: Math.sin, cos: Math.cos, tan: Math.tan, asin: Math.asin, acos: Math.acos, atan: Math.atan,
16
+ min: Math.min, max: Math.max, pow: Math.pow,
17
+ }
18
+ const CONSTS = { pi: Math.PI, e: Math.E }
19
 
20
+ function tokenize(src) {
21
+ const tokens = []
22
+ let i = 0
23
+ while (i < src.length) {
24
+ const c = src[i]
25
+ if (/\s/.test(c)) { i++; continue }
26
+ if (/[\d.]/.test(c)) {
27
+ let j = i
28
+ while (j < src.length && /[\d.]/.test(src[j])) j++
29
+ if (src[j] === 'e' || src[j] === 'E') {
30
+ // 科學記號 1e5 / 1e-3
31
+ let k = j + 1
32
+ if (src[k] === '+' || src[k] === '-') k++
33
+ if (/\d/.test(src[k] || '')) {
34
+ j = k
35
+ while (j < src.length && /\d/.test(src[j])) j++
36
+ }
37
+ }
38
+ const num = Number(src.slice(i, j))
39
+ if (Number.isNaN(num)) throw new Error(`數字格式錯誤:${src.slice(i, j)}`)
40
+ tokens.push({ t: 'num', v: num })
41
+ i = j
42
+ continue
43
+ }
44
+ if (/[a-zA-Z_]/.test(c)) {
45
+ let j = i
46
+ while (j < src.length && /[a-zA-Z_0-9]/.test(src[j])) j++
47
+ tokens.push({ t: 'id', v: src.slice(i, j).toLowerCase() })
48
+ i = j
49
+ continue
50
+ }
51
+ if ('+-*/%^(),'.includes(c)) { tokens.push({ t: 'op', v: c }); i++; continue }
52
+ if (c === '×') { tokens.push({ t: 'op', v: '*' }); i++; continue }
53
+ if (c === '÷') { tokens.push({ t: 'op', v: '/' }); i++; continue }
54
+ throw new Error(`不支援的字元「${c}」`)
55
  }
56
+ return tokens
57
  }
58
 
59
+ function evaluate(src) {
60
+ const tokens = tokenize(src)
61
  let pos = 0
62
+ const peek = () => tokens[pos]
63
+ const isOp = (v) => peek()?.t === 'op' && peek().v === v
64
+ const take = () => tokens[pos++]
65
 
66
+ function expr() {
67
+ let left = term()
68
+ while (isOp('+') || isOp('-')) {
69
+ const op = take().v
70
+ const right = term()
71
  left = op === '+' ? left + right : left - right
72
  }
73
  return left
74
  }
75
+ function term() {
76
+ let left = unary()
77
+ while (isOp('*') || isOp('/') || isOp('%')) {
78
+ const op = take().v
79
+ const right = unary()
 
80
  left = op === '*' ? left * right : op === '/' ? left / right : left % right
81
  }
82
  return left
83
  }
84
+ function unary() {
85
+ if (isOp('-')) { take(); return -unary() }
86
+ if (isOp('+')) { take(); return unary() }
87
+ return power()
88
+ }
89
+ function power() {
90
+ const base = primary()
91
+ if (isOp('^')) { take(); return Math.pow(base, unary()) } // 右結合
92
+ return base
93
+ }
94
+ function primary() {
95
+ const tok = take()
96
+ if (!tok) throw new Error('表達式不完整')
97
+ if (tok.t === 'num') return tok.v
98
+ if (tok.t === 'op' && tok.v === '(') {
99
+ const v = expr()
100
+ if (!isOp(')')) throw new Error('括號不配對')
101
+ take()
102
+ return v
103
+ }
104
+ if (tok.t === 'id') {
105
+ if (tok.v in CONSTS) return CONSTS[tok.v]
106
+ const fn = FUNCS[tok.v]
107
+ if (!fn) throw new Error(`未知函式或常數:${tok.v}`)
108
+ if (!isOp('(')) throw new Error(`${tok.v} 後面需要括號`)
109
  take()
110
+ const args = []
111
+ if (!isOp(')')) {
112
+ args.push(expr())
113
+ while (isOp(',')) { take(); args.push(expr()) }
114
+ }
115
+ if (!isOp(')')) throw new Error('函式括號不配對')
116
  take()
117
+ return fn(...args)
118
  }
119
+ throw new Error(`預期數字,收到「${tok.v}」`)
 
 
 
 
 
120
  }
121
 
122
+ const result = expr()
123
+ if (pos !== tokens.length) throw new Error('表達式有多餘字元')
124
  return result
125
  }
126
+
127
+ /** 回傳計算結果字串;任何異常都轉成錯誤訊息,不丟例外。 */
128
+ export function safeCalc(expression) {
129
+ if (typeof expression !== 'string' || !expression.trim()) return '計算錯誤:表達式為空'
130
+ if (expression.length > 500) return '計算錯誤:表達式過長'
131
+ try {
132
+ const value = evaluate(expression)
133
+ if (!Number.isFinite(value)) return `計算錯誤:結果無效(${expression})`
134
+ return `${expression} = ${Math.round(value * 1e10) / 1e10}`
135
+ } catch (e) {
136
+ return `計算錯誤:${expression}(${e.message})`
137
+ }
138
+ }