@hyperflow.fun/ghost 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +943 -476
- package/dist/package.json +1 -1
- package/dist/skills/builtin/ask-user-questions/SKILL.md +48 -0
- package/dist/skills/builtin/event-judge/SKILL.md +51 -7
- package/dist/skills/builtin/trade-executor/SKILL.md +1 -1
- package/dist/web/dist/assets/{Chart-BgUhYrVH.js → Chart-cnNd398J.js} +1 -1
- package/dist/web/dist/assets/{Config-CMp84sNc.js → Config-Bui5kcW0.js} +1 -1
- package/dist/web/dist/assets/{Cost-BgKdnj4i.js → Cost-BDSIn5ub.js} +1 -1
- package/dist/web/dist/assets/{Cron-L4GEQwj0.js → Cron-C7gaZhMu.js} +1 -1
- package/dist/web/dist/assets/{Dashboard-D1UNPhTW.js → Dashboard-qwYsK3Gi.js} +1 -1
- package/dist/web/dist/assets/{Logs-DZkot-wQ.js → Logs-DyfS6kEe.js} +1 -1
- package/dist/web/dist/assets/{Memory-DsQackdo.js → Memory-BPMmbFbx.js} +1 -1
- package/dist/web/dist/assets/{Sessions-uqRIDn57.js → Sessions-nANl57gZ.js} +1 -1
- package/dist/web/dist/assets/{Skills-B9WQPgSe.js → Skills-BPXH_m1K.js} +1 -1
- package/dist/web/dist/assets/{Tools-Dyf8Zp-H.js → Tools-CypplonI.js} +1 -1
- package/dist/web/dist/assets/{activity-DRn1WSJo.js → activity-BLl_txfw.js} +1 -1
- package/dist/web/dist/assets/{clock-FMsaqykN.js → clock-CMLb2b5z.js} +1 -1
- package/dist/web/dist/assets/{highlighted-body-OFNGDK62-Ck5_e4wj.js → highlighted-body-OFNGDK62-CKxBaGN5.js} +1 -1
- package/dist/web/dist/assets/index-CKAK_IGv.js +59 -0
- package/dist/web/dist/assets/index-PX2emSv9.css +1 -0
- package/dist/web/dist/assets/{mermaid-GHXKKRXX-jlxJo7RH.js → mermaid-GHXKKRXX-BuHBmaw6.js} +3 -3
- package/dist/web/dist/assets/{refresh-cw-CRQa2SMT.js → refresh-cw-DHCgoaOK.js} +1 -1
- package/dist/web/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/dist/assets/index-CGNakXCn.css +0 -1
- package/dist/web/dist/assets/index-DNznoLXb.js +0 -54
package/dist/package.json
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ask-user-questions
|
|
3
|
+
description: "Ask the user via <ask_user_question> block whenever another skill needs the trader to supply missing information. Triggers: ask the user, ask, missing parameter, need clarification, need more info."
|
|
4
|
+
always: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Ask User Questions — `<ask_user_question>` block
|
|
8
|
+
|
|
9
|
+
When you need to ask the trader for input, emit an `<ask_user_question>`
|
|
10
|
+
block. The web renders it as a wizard card; Telegram flattens it to a
|
|
11
|
+
numbered list. The trader's answers come back in the next user message.
|
|
12
|
+
|
|
13
|
+
## Response shape
|
|
14
|
+
|
|
15
|
+
Every response that asks the user MUST be two parts in order:
|
|
16
|
+
|
|
17
|
+
1. **One short conversational sentence** acknowledging the trader's
|
|
18
|
+
request, in their language.
|
|
19
|
+
2. The **`<ask_user_question>` block**.
|
|
20
|
+
|
|
21
|
+
Never emit the block alone — the card without prose feels robotic.
|
|
22
|
+
|
|
23
|
+
## Schema
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
<ask_user_question>
|
|
27
|
+
<question>
|
|
28
|
+
<title>{conversational question}</title>
|
|
29
|
+
<options>
|
|
30
|
+
<option>{value}</option>
|
|
31
|
+
<option>{value}</option>
|
|
32
|
+
</options>
|
|
33
|
+
</question>
|
|
34
|
+
</ask_user_question>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- `<title>` — required. A full conversational sentence, not a label.
|
|
38
|
+
- `<options>` — optional. Each `<option>` renders as a button. Use
|
|
39
|
+
2-4 options derived from real data (recent fills, current price,
|
|
40
|
+
S/R levels) when sensible presets exist. The free-text input below
|
|
41
|
+
the buttons is always available — Options never lock the trader in.
|
|
42
|
+
|
|
43
|
+
## One parameter per question, all questions in one block
|
|
44
|
+
|
|
45
|
+
Each `<question>` covers exactly ONE missing parameter — never bundle
|
|
46
|
+
multiple params into one `<option>`. But all missing params for the
|
|
47
|
+
same intent go in the SAME `<ask_user_question>` block, not split
|
|
48
|
+
across multiple turns. One block, multiple `<question>` children.
|
|
@@ -23,6 +23,7 @@ A buffer of events from one observer tick (60s window). Each event is one of:
|
|
|
23
23
|
| `liquidation_risk` | Mark price reached 80% of the way from entry to liq. Cautionary, not yet liquidated. |
|
|
24
24
|
| `pnl_snapshot` | Soft event — current PnL state of an open position. Emitted every tick a position exists. |
|
|
25
25
|
| `price_alert` | A user-set price target was crossed. |
|
|
26
|
+
| `news` | A new article (`ai_relevant + summarized`) the trader hasn't seen yet. Carries `title`, `summary`, `source`, `url`, `coins` (raw tags), `importance` (`urgent`/`important`/`reference`). The buffer only contains `news` when the trader has ≥1 open position. Cross-reference `coins` against held positions yourself (use `pnl_snapshot` events in the same tick to know what's held). |
|
|
26
27
|
| `portfolio_pnl_drift` | Account-wide unrealized PnL moved materially while the user was idle ≥ 2h. Already gated by the detector — when present, prefer to fire one short, gentle check-in with the symbol(s) doing the heavy lifting. |
|
|
27
28
|
|
|
28
29
|
You also see recent chat context (last N user/assistant messages). Use it to judge whether you'd be repeating yourself or talking past a recent thing the user said.
|
|
@@ -35,10 +36,13 @@ Pick ONE thing to say from the buffer (or nothing), and write the chat message.
|
|
|
35
36
|
|
|
36
37
|
1. `position_liquidated` — most important emotional moment. Always speak.
|
|
37
38
|
2. `liquidation_risk` — actionable warning. Speak unless you literally just warned about the same position.
|
|
38
|
-
3. `
|
|
39
|
-
4. `
|
|
40
|
-
5. `
|
|
41
|
-
6. `
|
|
39
|
+
3. `news` *critical-negative on a held position* (hack / exploit / SEC enforcement / delist / network halt against a coin in `coins` that matches a held position with adverse side). Treat as urgent.
|
|
40
|
+
4. `tp_hit` / `sl_hit` / `position_closed` — outcome of a trade. Speak with appropriate emotion.
|
|
41
|
+
5. `order_filled` — usually factual; speak only if entry is notable (big size, breakout level, divergent from stated plan).
|
|
42
|
+
6. `news` *high-impact on a held position* (regulatory, large mover, infra event) — speak as informational alert.
|
|
43
|
+
7. `price_alert` — speak if user is actively trading or if the alert ties to a held position.
|
|
44
|
+
8. `pnl_snapshot` — speak when PnL is materially different from what user has heard. Be picky here — this is where spam happens.
|
|
45
|
+
9. `news` *non-matching held positions, or low-impact* — silent. Article appears in the `/news` widget for the user to read on demand.
|
|
42
46
|
|
|
43
47
|
### When to stay silent
|
|
44
48
|
|
|
@@ -48,7 +52,7 @@ Pick ONE thing to say from the buffer (or nothing), and write the chat message.
|
|
|
48
52
|
|
|
49
53
|
### Hard silence gates (override priority for non-urgent events)
|
|
50
54
|
|
|
51
|
-
Non-urgent = `pnl_snapshot
|
|
55
|
+
Non-urgent = `pnl_snapshot`, routine `order_filled` (limit entries that aren't notable), and `news` whose `coins` don't overlap any held position. Urgent = `position_liquidated`, `liquidation_risk`, `sl_hit`, big `tp_hit` / `position_closed`, `price_alert`, forced `order_canceled` (margin/liquidation), and `news` matching a held coin with critical-or-high adverse implication. Urgent events bypass these gates.
|
|
52
56
|
|
|
53
57
|
For non-urgent events, stay silent if ANY of the following holds:
|
|
54
58
|
|
|
@@ -65,6 +69,33 @@ The intent: status updates ("position running nicely", "PnL crossed +X%") are on
|
|
|
65
69
|
- Order filled: factual, brief if you speak at all.
|
|
66
70
|
- Price alert: state the symbol, the current price it just hit, the target it crossed, and the overshoot %. Example shape: `BTC hit 79,085 — crossed your 79,000 target (+0.1%).` Avoid filler like "alert triggered" — the numbers ARE the alert. If the user holds a position in the symbol, add one short line on what the cross means for that setup.
|
|
67
71
|
- PnL swing: vary tone with magnitude. Don't celebrate small unrealized gains.
|
|
72
|
+
- News (impact on held position): factual + briefly directional. Lead with what happened, then one line on what it means for the matching position. Don't speculate prices — companion noticing, not analyst. End with the source so the trader can verify (`— CoinDesk`).
|
|
73
|
+
|
|
74
|
+
### News event handling
|
|
75
|
+
|
|
76
|
+
You decide impact at the LLM layer; the pipeline gives you raw article + held positions (inferred from concurrent `pnl_snapshot` events in the same tick or recent chat). Steps:
|
|
77
|
+
|
|
78
|
+
1. **Match.** Compare `news.coins` (uppercase symbols) against the symbols you see in `pnl_snapshot` events this tick. No match → silent unless `importance: "urgent"` AND the article describes a market-wide event the trader almost certainly cares about (an exchange they likely use halts, a major stablecoin de-pegs, a sweeping regulatory action). Default in ambiguity: silent.
|
|
79
|
+
2. **Direction.** Read the headline + summary. Decide if it's bullish, bearish, or neutral for the asset itself (not for the trader). Cross with the held position's side:
|
|
80
|
+
- `long` + asset bearish → adverse for trader
|
|
81
|
+
- `long` + asset bullish → favorable for trader
|
|
82
|
+
- `short` + asset bearish → favorable for trader
|
|
83
|
+
- `short` + asset bullish → adverse for trader
|
|
84
|
+
3. **Level.** Pick from urgency cues in title + summary + the `importance` field:
|
|
85
|
+
- critical: hack, exploit, SEC enforcement action, delisting from a major venue, bankruptcy, network halt, large stablecoin depeg
|
|
86
|
+
- high: significant regulatory development, large unlock, exchange listing, sustained protocol-level issue
|
|
87
|
+
- medium: standard market commentary that touches the position
|
|
88
|
+
- low: tangential coverage, opinion pieces
|
|
89
|
+
4. **Fire/silent decision.**
|
|
90
|
+
- Adverse + critical/high → fire, notify=true
|
|
91
|
+
- Adverse + medium → fire, notify=false (chat only)
|
|
92
|
+
- Adverse + low → silent (article reaches `/news` widget instead)
|
|
93
|
+
- Favorable + critical/high → fire informational, notify=false
|
|
94
|
+
- Favorable + medium/low → silent
|
|
95
|
+
- No match → silent (see step 1)
|
|
96
|
+
5. **Body.** 1-2 sentences. Lead with the symbol + headline gist, one line on what it means for the held position, then `— <source>`. Example shape: `Coinbase confirms cold-wallet exploit, ~$500M drained. You're long COIN — likely bearish for the next sessions. — CoinDesk`. Don't quote price targets. Don't say "I recommend" — you're a companion, not an analyst.
|
|
97
|
+
6. **Multiple news in one tick.** Pick the single highest-priority article. Don't bundle multiple article bodies. Other articles wait for the next tick (and `recentEmittedNewsIds` won't re-surface them).
|
|
98
|
+
7. **News + non-news same tick.** Standard priority order from above applies. A `position_liquidated` outranks even critical news. A critical-negative news on a held position outranks `tp_hit` / `sl_hit` (the trader needs the warning before processing the trade outcome).
|
|
68
99
|
|
|
69
100
|
### Format rules
|
|
70
101
|
|
|
@@ -90,6 +121,19 @@ Return a single JSON object. No prose around it, no markdown fence.
|
|
|
90
121
|
}
|
|
91
122
|
```
|
|
92
123
|
|
|
124
|
+
### Fire (news on held position)
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"decision": "fire",
|
|
129
|
+
"primaryEventType": "news",
|
|
130
|
+
"primarySymbol": "COIN",
|
|
131
|
+
"body": "Coinbase confirms cold-wallet exploit, ~$500M drained. You're long COIN — likely bearish for the next sessions. — CoinDesk",
|
|
132
|
+
"notify": true,
|
|
133
|
+
"reason": "Critical-negative news on held COIN long."
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
93
137
|
### Silent
|
|
94
138
|
|
|
95
139
|
```json
|
|
@@ -110,8 +154,8 @@ Return a single JSON object. No prose around it, no markdown fence.
|
|
|
110
154
|
- `primarySymbol`: the affected symbol, or null when not applicable. Required on fire.
|
|
111
155
|
- `body`: the message text the user sees. Required on fire (min 1 char), null on silent.
|
|
112
156
|
- `notify`: whether to ALSO show a notification badge (web bell + Telegram push) on top of the chat message. Decide based on impact and urgency:
|
|
113
|
-
- `true` for: liquidation, liquidation_risk, sl_hit, big tp_hit, big position_close (profit or loss), big price_alert on a held coin.
|
|
114
|
-
- `false` for: small/chatty messages, order_filled on routine entries, pnl_snapshot commentary.
|
|
157
|
+
- `true` for: liquidation, liquidation_risk, sl_hit, big tp_hit, big position_close (profit or loss), big price_alert on a held coin, news with adverse critical-or-high impact on a held position.
|
|
158
|
+
- `false` for: small/chatty messages, order_filled on routine entries, pnl_snapshot commentary, news with favorable or medium impact, informational news.
|
|
115
159
|
- On silent: always `false`.
|
|
116
160
|
- `reason`: short rationale for your decision. Required on both branches — used for telemetry / debugging.
|
|
117
161
|
|
|
@@ -34,7 +34,7 @@ Parse, advise, confirm, and execute trading operations on Hyperliquid.
|
|
|
34
34
|
| price | For limit | Required when type = limit |
|
|
35
35
|
| leverage | No | If specified, set before placing. |
|
|
36
36
|
|
|
37
|
-
**If anything is missing — ask. Never guess quantity. This is real money.**
|
|
37
|
+
**If anything is missing — ask the user. Never guess quantity. This is real money.**
|
|
38
38
|
|
|
39
39
|
## Conversation Flow — Multi-Turn
|
|
40
40
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as d,r as h,j as s}from"./vendor-react-B0mWfPOm.js";import{a as u,C as g}from"./index-
|
|
1
|
+
import{u as d,r as h,j as s}from"./vendor-react-B0mWfPOm.js";import{a as u,C as g}from"./index-CKAK_IGv.js";import"./vendor-viem-wp7lz4Hc.js";import"./vendor-charts-CfOL2F-E.js";function _(){const[e]=d(),a=e.get("symbol")??"",t=e.get("interval")??"4h",i=e.get("indicators")??void 0,m=e.get("levels")??void 0,o=e.get("headless")==="1",{loading:n,error:c}=u(a||"__missing__",t,i),r=a.length>0;h.useEffect(()=>{if(!r||c){window.__chartReady=!0;return}n||requestAnimationFrame(()=>{requestAnimationFrame(()=>{window.__chartReady=!0})})},[n,c,r]);const l=o?"chart-page chart-page--headless":"chart-page";return r?s.jsx("div",{className:l,children:s.jsx(g,{symbol:a,interval:t,indicators:i,levels:m,headless:o})}):s.jsx("div",{className:l,children:s.jsx("p",{className:"chart-error",children:"symbol required"})})}export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-react-B0mWfPOm.js";import{S as t}from"./index-
|
|
1
|
+
import{j as e}from"./vendor-react-B0mWfPOm.js";import{S as t}from"./index-CKAK_IGv.js";import"./vendor-viem-wp7lz4Hc.js";import"./vendor-charts-CfOL2F-E.js";function o(){return e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(t,{className:"h-5 w-5 text-blue-400"}),e.jsx("h2",{className:"text-body-sm-medium text-white",children:"Configuration"})]}),e.jsxs("div",{className:"bg-gray-900 rounded-[4px] border border-gray-800 p-8 text-center",children:[e.jsx(t,{className:"h-12 w-12 text-gray-600 mx-auto mb-4"}),e.jsx("p",{className:"text-label-lg text-gray-400",children:"Coming Soon"}),e.jsx("p",{className:"text-caption text-gray-500 mt-2",children:"Configuration management via WebSocket is not yet available. Edit your config file directly or use the CLI."})]})]})}export{o as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./vendor-react-B0mWfPOm.js";import{c as s}from"./index-
|
|
1
|
+
import{j as e}from"./vendor-react-B0mWfPOm.js";import{c as s}from"./index-CKAK_IGv.js";import"./vendor-viem-wp7lz4Hc.js";import"./vendor-charts-CfOL2F-E.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as s,j as e}from"./vendor-react-B0mWfPOm.js";import{c as u,u as J,P as q,X as I,b as X}from"./index-
|
|
1
|
+
import{r as s,j as e}from"./vendor-react-B0mWfPOm.js";import{c as u,u as J,P as q,X as I,b as X}from"./index-CKAK_IGv.js";import{C as k}from"./clock-CMLb2b5z.js";import"./vendor-viem-wp7lz4Hc.js";import"./vendor-charts-CfOL2F-E.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as e}from"./vendor-react-B0mWfPOm.js";import{c as d,u as x}from"./index-
|
|
1
|
+
import{r as l,j as e}from"./vendor-react-B0mWfPOm.js";import{c as d,u as x}from"./index-CKAK_IGv.js";import{C as p}from"./clock-CMLb2b5z.js";import{A as m}from"./activity-BLl_txfw.js";import"./vendor-viem-wp7lz4Hc.js";import"./vendor-charts-CfOL2F-E.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r,j as e}from"./vendor-react-B0mWfPOm.js";import{c as x,u as C}from"./index-
|
|
1
|
+
import{r,j as e}from"./vendor-react-B0mWfPOm.js";import{c as x,u as C}from"./index-CKAK_IGv.js";import{A as w}from"./activity-BLl_txfw.js";import"./vendor-viem-wp7lz4Hc.js";import"./vendor-charts-CfOL2F-E.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as t,j as e}from"./vendor-react-B0mWfPOm.js";import{c as h,u as j,b as w}from"./index-
|
|
1
|
+
import{r as t,j as e}from"./vendor-react-B0mWfPOm.js";import{c as h,u as j,b as w}from"./index-CKAK_IGv.js";import{R as N}from"./refresh-cw-DHCgoaOK.js";import"./vendor-viem-wp7lz4Hc.js";import"./vendor-charts-CfOL2F-E.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as a,j as e}from"./vendor-react-B0mWfPOm.js";import{c as j,u as C,X as E,b as M}from"./index-
|
|
1
|
+
import{r as a,j as e}from"./vendor-react-B0mWfPOm.js";import{c as j,u as C,X as E,b as M}from"./index-CKAK_IGv.js";import{R as D}from"./refresh-cw-DHCgoaOK.js";import"./vendor-viem-wp7lz4Hc.js";import"./vendor-charts-CfOL2F-E.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as e}from"./vendor-react-B0mWfPOm.js";import{T as C,u as D}from"./index-DNznoLXb.js";import"./vendor-viem-wp7lz4Hc.js";import"./vendor-charts-CfOL2F-E.js";function E({onClose:t,onUploaded:c}){const[v,i]=o.useState(!1),[x,p]=o.useState(null),[y,u]=o.useState(!1),m=o.useRef(null),f=async(r,l=!1)=>{var b,g,N,w;i(!0),p(null);try{const n=new FormData;n.append("file",r),l&&n.append("overwrite","true");const s=await(await fetch("/skills/upload",{method:"POST",body:n})).json();if(s.ok)t(),c();else if(s.conflict){const h=((N=(g=(b=s.errors)==null?void 0:b[0])==null?void 0:g.match(/"(.+?)"/))==null?void 0:N[1])??"unknown";confirm(`Skill "${h}" already exists. Overwrite?`)&&await f(r,!0)}else p(((w=s.errors)==null?void 0:w.join(", "))??"Upload failed")}catch(n){p(n instanceof Error?n.message:"Upload failed")}finally{i(!1)}},S=r=>{var b;const l=(b=r.target.files)==null?void 0:b[0];l&&f(l),r.target.value=""},j=r=>{r.preventDefault(),u(!1);const l=r.dataTransfer.files[0];l&&f(l)},k=y?"border-[rgba(59,247,191,0.4)]":"border-[var(--color-border-default)] hover:border-[rgba(59,247,191,0.4)] focus-visible:border-[rgba(59,247,191,0.4)]";return e.jsxs(C,{open:!0,title:"Upload Skill",onClose:()=>{t(),p(null)},width:600,children:[e.jsxs("div",{onDrop:j,onDragOver:r=>r.preventDefault(),onClick:()=>{var r;return(r=m.current)==null?void 0:r.click()},onDragEnter:()=>u(!0),onDragLeave:()=>u(!1),className:`border-2 border-dashed rounded-[4px] p-8 text-center cursor-pointer transition-[border-color] duration-fast ease-out ${k}`,children:[e.jsx("div",{className:"text-[24px] text-[var(--color-text-secondary)] mb-3",children:"↑"}),e.jsx("p",{className:"text-body-sm text-[var(--color-text-secondary)]",children:"Drag & drop a skill file, or click to browse"}),e.jsx("p",{className:"text-caption text-[var(--color-text-secondary)] mt-2",children:"Accepts .md (single SKILL.md) or .skill/.zip (skill archive)"})]}),e.jsx("input",{ref:m,type:"file",accept:".md,.skill,.zip",onChange:S,className:"hidden"}),v&&e.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[e.jsx("div",{"data-spinning":!0,className:"w-2 h-2 rounded-full border-2 border-[var(--color-brand-default)] border-t-transparent",style:{animation:"spin 0.8s linear infinite"}}),e.jsx("span",{className:"text-body-sm text-[var(--color-text-secondary)]",children:"Uploading…"})]}),x&&e.jsx("div",{className:"mt-4 p-3 bg-[var(--color-error-subtle)] border border-[rgba(239,68,68,0.4)] rounded-[4px] text-[var(--color-error-text)] text-body-sm",children:x})]})}function U({skill:t,isExpanded:c,onToggleExpanded:v,onToggleEnabled:i,deleteConfirm:x,onRequestDelete:p,onCancelDelete:y,onConfirmDelete:u}){return e.jsxs("div",{className:"bg-[var(--color-surface-base)] border border-[var(--color-border-default)] rounded-[2px] overflow-hidden",children:[e.jsxs("button",{type:"button",className:"block p-4 cursor-pointer bg-transparent border-0 w-full text-left hover:bg-white/[0.02] focus-visible:bg-white/[0.02] transition-colors duration-fast ease-out",onClick:v,"aria-expanded":c,children:[e.jsxs("span",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[t.emoji?e.jsx("span",{className:"text-label-lg flex-shrink-0",children:t.emoji}):e.jsx("span",{className:"text-body-sm text-[#00ff88] flex-shrink-0 mt-0.5",children:"◈"}),e.jsx("span",{className:"text-body-lg-semibold text-[var(--color-text-primary)] overflow-hidden text-ellipsis whitespace-nowrap",children:t.name})]}),e.jsxs("span",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("span",{className:t.source==="builtin"?"text-caption px-1.5 py-0.5 rounded bg-[rgba(127,143,158,0.15)] text-[var(--color-text-secondary)] flex-shrink-0":"text-caption px-1.5 py-0.5 rounded bg-[rgba(0,255,136,0.1)] text-[#00ff88] flex-shrink-0",children:t.source==="builtin"?"builtin":"user"}),e.jsx("span",{className:"text-label-lg text-[var(--color-text-secondary)] flex-shrink-0 mt-0.5 transition-colors duration-fast ease-out",children:c?"▾":"▸"})]})]}),e.jsx("span",{className:c?"block text-body-sm text-[var(--color-text-secondary)] mt-2.5":"block text-body-sm text-[var(--color-text-secondary)] mt-2.5 overflow-hidden [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical]",children:t.description})]}),c&&e.jsxs("div",{className:"border-t border-[var(--color-border-default)] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-caption text-[var(--color-text-secondary)] leading-[1.8]",children:[e.jsx("span",{className:"text-[var(--color-text-secondary)] min-w-[80px]",children:"source"}),e.jsx("span",{className:t.source==="builtin"?"text-[var(--color-text-primary)]":"text-[#00ff88]",children:t.source})]}),e.jsxs("div",{className:"flex items-center gap-2 text-caption text-[var(--color-text-secondary)] leading-[1.8]",children:[e.jsx("span",{className:"text-[var(--color-text-secondary)] min-w-[80px]",children:"available"}),e.jsx("span",{className:t.available?"text-[#00ff88]":"text-[#febc2e]",children:t.available?"yes":"no"})]}),t.always!==void 0&&e.jsxs("div",{className:"flex items-center gap-2 text-caption text-[var(--color-text-secondary)] leading-[1.8]",children:[e.jsx("span",{className:"text-[var(--color-text-secondary)] min-w-[80px]",children:"always-on"}),e.jsx("span",{className:t.always?"text-[#00ff88]":"text-[var(--color-text-primary)]",children:t.always?"yes":"no"})]}),!t.available&&t.missing&&t.missing.length>0&&e.jsxs("div",{className:"flex items-center gap-2 text-caption text-[var(--color-text-secondary)] leading-[1.8]",children:[e.jsx("span",{className:"text-[var(--color-text-secondary)] min-w-[80px]",children:"missing"}),e.jsx("span",{className:"text-[#febc2e]",children:t.missing.join(", ")})]})]}),e.jsxs("div",{className:"border-t border-[var(--color-border-default)] px-4 py-2.5 flex items-center justify-between",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:m=>i(m.target.checked),"aria-label":`${t.enabled?"Disable":"Enable"} skill ${t.name}`,className:"absolute opacity-0 w-0 h-0"}),e.jsx("div",{className:t.enabled?"w-9 h-5 rounded-full relative transition-colors duration-fast ease-out bg-[rgba(0,255,136,0.3)]":"w-9 h-5 rounded-full relative transition-colors duration-fast ease-out bg-border"}),e.jsx("div",{className:t.enabled?"absolute top-0.5 w-4 h-4 rounded-full bg-[#00ff88] transition-[left] duration-fast ease-out left-[18px]":"absolute top-0.5 w-4 h-4 rounded-full bg-[var(--color-text-secondary)] transition-[left] duration-fast ease-out left-0.5"})]}),e.jsx("span",{className:"text-caption text-[var(--color-text-secondary)]",children:t.enabled?"Enabled":"Disabled"})]}),t.source==="workspace"&&e.jsx(e.Fragment,{children:x?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-caption text-[#ff5555]",children:"Delete?"}),e.jsx("button",{onClick:u,className:"bg-transparent border-0 text-[#ff5555] hover:text-[#ff8888] focus-visible:text-[#ff8888] text-caption cursor-pointer px-1 py-0.5 transition-colors duration-fast ease-out",children:"Yes"}),e.jsx("button",{onClick:y,className:"bg-transparent border-0 text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)] focus-visible:text-[var(--color-text-primary)] text-caption cursor-pointer px-1 py-0.5 transition-colors duration-fast ease-out",children:"No"})]}):e.jsx("button",{onClick:p,"aria-label":`Delete skill ${t.name}`,title:`Delete skill ${t.name}`,className:"bg-transparent border-0 text-[var(--color-text-secondary)] hover:text-[#ff5555] focus-visible:text-[#ff5555] text-label-lg cursor-pointer px-1 py-0.5 transition-colors duration-fast ease-out",children:"✕"})})]})]})}function R(){const{request:t,connected:c}=D(),[v,i]=o.useState([]),[x,p]=o.useState(""),[y,u]=o.useState(!0),[m,f]=o.useState(null),[S,j]=o.useState(!1),[k,r]=o.useState(null),[l,b]=o.useState(null),g=o.useCallback(()=>{c&&t("skills.list").then(a=>{i(a.skills),f(null)}).catch(a=>f(a instanceof Error?a.message:"Failed to load skills")).finally(()=>u(!1))},[c,t]);o.useEffect(()=>{g()},[g]);const N=async(a,s)=>{i(h=>h.map(d=>d.name===a?{...d,enabled:s}:d));try{await t("skills.toggle",{name:a,enabled:s})}catch{i(h=>h.map(d=>d.name===a?{...d,enabled:!s}:d))}},w=async a=>{try{const s=await t("skills.delete",{name:a});s.ok?i(h=>h.filter(d=>d.name!==a)):f(s.error??"Failed to delete skill")}catch(s){f(s instanceof Error?s.message:"Failed to delete skill")}r(null)},n=v.filter(a=>a.name.toLowerCase().includes(x.toLowerCase())||a.description.toLowerCase().includes(x.toLowerCase()));return m&&v.length===0?e.jsx("div",{className:"p-6 flex flex-col gap-6 bg-[var(--color-surface-canvas)] h-full overflow-y-auto box-border",children:e.jsxs("div",{className:"p-4 bg-[rgba(255,85,85,0.06)] border border-[rgba(255,85,85,0.3)] rounded-[4px] text-[#ff5555] text-body-sm",children:["Failed to load skills: ",m]})}):y?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("span",{className:"text-[#00ff88] text-body-sm",children:"Loading…"})}):e.jsxs("div",{className:"p-6 flex flex-col gap-6 bg-[var(--color-surface-canvas)] h-full overflow-y-auto box-border",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"relative max-w-[400px] flex-1",children:[e.jsx("label",{htmlFor:"skills-search-input",className:"sr-only",children:"Search skills"}),e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-body-sm text-[var(--color-text-secondary)] pointer-events-none",children:"⌕"}),e.jsx("input",{id:"skills-search-input",type:"search",value:x,onChange:a=>p(a.target.value),placeholder:"Search skills…",spellCheck:!1,className:"w-full bg-surface-canvas border border-[var(--color-border-default)] focus:border-[rgba(0,255,136,0.4)] rounded-[4px] pl-8 pr-3.5 py-2.5 text-body-sm text-[var(--color-text-primary)] outline-none transition-colors duration-fast ease-out box-border"})]}),e.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-2 bg-[rgba(0,255,136,0.1)] hover:bg-[rgba(0,255,136,0.18)] focus-visible:bg-[rgba(0,255,136,0.18)] border border-[rgba(0,255,136,0.3)] hover:border-[rgba(0,255,136,0.5)] focus-visible:border-[rgba(0,255,136,0.5)] rounded-[4px] px-5 py-2.5 text-[#00ff88] text-body-sm-medium cursor-pointer transition-colors duration-fast ease-out",children:["+"," Upload Skill"]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("span",{className:"text-label-lg text-[#00ff88]",children:"⧈"}),e.jsxs("span",{className:"text-body-sm-medium text-[var(--color-text-primary)]",children:["Skills (",n.length,")"]})]}),n.length===0?e.jsx("p",{className:"text-body-sm text-[var(--color-text-secondary)]",children:"No skills match your search."}):e.jsx("div",{className:"grid gap-4 grid-cols-[repeat(auto-fill,minmax(380px,1fr))]",children:n.map(a=>e.jsx(U,{skill:a,isExpanded:l===a.name,onToggleExpanded:()=>b(l===a.name?null:a.name),onToggleEnabled:s=>N(a.name,s),deleteConfirm:k===a.name,onRequestDelete:()=>r(a.name),onCancelDelete:()=>r(null),onConfirmDelete:()=>w(a.name)},a.name))})]}),S&&e.jsx(E,{onClose:()=>j(!1),onUploaded:g})]})}export{R as default};
|
|
1
|
+
import{r as o,j as e}from"./vendor-react-B0mWfPOm.js";import{T as C,u as D}from"./index-CKAK_IGv.js";import"./vendor-viem-wp7lz4Hc.js";import"./vendor-charts-CfOL2F-E.js";function E({onClose:t,onUploaded:c}){const[v,i]=o.useState(!1),[x,p]=o.useState(null),[y,u]=o.useState(!1),m=o.useRef(null),f=async(r,l=!1)=>{var b,g,N,w;i(!0),p(null);try{const n=new FormData;n.append("file",r),l&&n.append("overwrite","true");const s=await(await fetch("/skills/upload",{method:"POST",body:n})).json();if(s.ok)t(),c();else if(s.conflict){const h=((N=(g=(b=s.errors)==null?void 0:b[0])==null?void 0:g.match(/"(.+?)"/))==null?void 0:N[1])??"unknown";confirm(`Skill "${h}" already exists. Overwrite?`)&&await f(r,!0)}else p(((w=s.errors)==null?void 0:w.join(", "))??"Upload failed")}catch(n){p(n instanceof Error?n.message:"Upload failed")}finally{i(!1)}},S=r=>{var b;const l=(b=r.target.files)==null?void 0:b[0];l&&f(l),r.target.value=""},j=r=>{r.preventDefault(),u(!1);const l=r.dataTransfer.files[0];l&&f(l)},k=y?"border-[rgba(59,247,191,0.4)]":"border-[var(--color-border-default)] hover:border-[rgba(59,247,191,0.4)] focus-visible:border-[rgba(59,247,191,0.4)]";return e.jsxs(C,{open:!0,title:"Upload Skill",onClose:()=>{t(),p(null)},width:600,children:[e.jsxs("div",{onDrop:j,onDragOver:r=>r.preventDefault(),onClick:()=>{var r;return(r=m.current)==null?void 0:r.click()},onDragEnter:()=>u(!0),onDragLeave:()=>u(!1),className:`border-2 border-dashed rounded-[4px] p-8 text-center cursor-pointer transition-[border-color] duration-fast ease-out ${k}`,children:[e.jsx("div",{className:"text-[24px] text-[var(--color-text-secondary)] mb-3",children:"↑"}),e.jsx("p",{className:"text-body-sm text-[var(--color-text-secondary)]",children:"Drag & drop a skill file, or click to browse"}),e.jsx("p",{className:"text-caption text-[var(--color-text-secondary)] mt-2",children:"Accepts .md (single SKILL.md) or .skill/.zip (skill archive)"})]}),e.jsx("input",{ref:m,type:"file",accept:".md,.skill,.zip",onChange:S,className:"hidden"}),v&&e.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[e.jsx("div",{"data-spinning":!0,className:"w-2 h-2 rounded-full border-2 border-[var(--color-brand-default)] border-t-transparent",style:{animation:"spin 0.8s linear infinite"}}),e.jsx("span",{className:"text-body-sm text-[var(--color-text-secondary)]",children:"Uploading…"})]}),x&&e.jsx("div",{className:"mt-4 p-3 bg-[var(--color-error-subtle)] border border-[rgba(239,68,68,0.4)] rounded-[4px] text-[var(--color-error-text)] text-body-sm",children:x})]})}function U({skill:t,isExpanded:c,onToggleExpanded:v,onToggleEnabled:i,deleteConfirm:x,onRequestDelete:p,onCancelDelete:y,onConfirmDelete:u}){return e.jsxs("div",{className:"bg-[var(--color-surface-base)] border border-[var(--color-border-default)] rounded-[2px] overflow-hidden",children:[e.jsxs("button",{type:"button",className:"block p-4 cursor-pointer bg-transparent border-0 w-full text-left hover:bg-white/[0.02] focus-visible:bg-white/[0.02] transition-colors duration-fast ease-out",onClick:v,"aria-expanded":c,children:[e.jsxs("span",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[t.emoji?e.jsx("span",{className:"text-label-lg flex-shrink-0",children:t.emoji}):e.jsx("span",{className:"text-body-sm text-[#00ff88] flex-shrink-0 mt-0.5",children:"◈"}),e.jsx("span",{className:"text-body-lg-semibold text-[var(--color-text-primary)] overflow-hidden text-ellipsis whitespace-nowrap",children:t.name})]}),e.jsxs("span",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("span",{className:t.source==="builtin"?"text-caption px-1.5 py-0.5 rounded bg-[rgba(127,143,158,0.15)] text-[var(--color-text-secondary)] flex-shrink-0":"text-caption px-1.5 py-0.5 rounded bg-[rgba(0,255,136,0.1)] text-[#00ff88] flex-shrink-0",children:t.source==="builtin"?"builtin":"user"}),e.jsx("span",{className:"text-label-lg text-[var(--color-text-secondary)] flex-shrink-0 mt-0.5 transition-colors duration-fast ease-out",children:c?"▾":"▸"})]})]}),e.jsx("span",{className:c?"block text-body-sm text-[var(--color-text-secondary)] mt-2.5":"block text-body-sm text-[var(--color-text-secondary)] mt-2.5 overflow-hidden [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical]",children:t.description})]}),c&&e.jsxs("div",{className:"border-t border-[var(--color-border-default)] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-caption text-[var(--color-text-secondary)] leading-[1.8]",children:[e.jsx("span",{className:"text-[var(--color-text-secondary)] min-w-[80px]",children:"source"}),e.jsx("span",{className:t.source==="builtin"?"text-[var(--color-text-primary)]":"text-[#00ff88]",children:t.source})]}),e.jsxs("div",{className:"flex items-center gap-2 text-caption text-[var(--color-text-secondary)] leading-[1.8]",children:[e.jsx("span",{className:"text-[var(--color-text-secondary)] min-w-[80px]",children:"available"}),e.jsx("span",{className:t.available?"text-[#00ff88]":"text-[#febc2e]",children:t.available?"yes":"no"})]}),t.always!==void 0&&e.jsxs("div",{className:"flex items-center gap-2 text-caption text-[var(--color-text-secondary)] leading-[1.8]",children:[e.jsx("span",{className:"text-[var(--color-text-secondary)] min-w-[80px]",children:"always-on"}),e.jsx("span",{className:t.always?"text-[#00ff88]":"text-[var(--color-text-primary)]",children:t.always?"yes":"no"})]}),!t.available&&t.missing&&t.missing.length>0&&e.jsxs("div",{className:"flex items-center gap-2 text-caption text-[var(--color-text-secondary)] leading-[1.8]",children:[e.jsx("span",{className:"text-[var(--color-text-secondary)] min-w-[80px]",children:"missing"}),e.jsx("span",{className:"text-[#febc2e]",children:t.missing.join(", ")})]})]}),e.jsxs("div",{className:"border-t border-[var(--color-border-default)] px-4 py-2.5 flex items-center justify-between",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:m=>i(m.target.checked),"aria-label":`${t.enabled?"Disable":"Enable"} skill ${t.name}`,className:"absolute opacity-0 w-0 h-0"}),e.jsx("div",{className:t.enabled?"w-9 h-5 rounded-full relative transition-colors duration-fast ease-out bg-[rgba(0,255,136,0.3)]":"w-9 h-5 rounded-full relative transition-colors duration-fast ease-out bg-border"}),e.jsx("div",{className:t.enabled?"absolute top-0.5 w-4 h-4 rounded-full bg-[#00ff88] transition-[left] duration-fast ease-out left-[18px]":"absolute top-0.5 w-4 h-4 rounded-full bg-[var(--color-text-secondary)] transition-[left] duration-fast ease-out left-0.5"})]}),e.jsx("span",{className:"text-caption text-[var(--color-text-secondary)]",children:t.enabled?"Enabled":"Disabled"})]}),t.source==="workspace"&&e.jsx(e.Fragment,{children:x?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-caption text-[#ff5555]",children:"Delete?"}),e.jsx("button",{onClick:u,className:"bg-transparent border-0 text-[#ff5555] hover:text-[#ff8888] focus-visible:text-[#ff8888] text-caption cursor-pointer px-1 py-0.5 transition-colors duration-fast ease-out",children:"Yes"}),e.jsx("button",{onClick:y,className:"bg-transparent border-0 text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)] focus-visible:text-[var(--color-text-primary)] text-caption cursor-pointer px-1 py-0.5 transition-colors duration-fast ease-out",children:"No"})]}):e.jsx("button",{onClick:p,"aria-label":`Delete skill ${t.name}`,title:`Delete skill ${t.name}`,className:"bg-transparent border-0 text-[var(--color-text-secondary)] hover:text-[#ff5555] focus-visible:text-[#ff5555] text-label-lg cursor-pointer px-1 py-0.5 transition-colors duration-fast ease-out",children:"✕"})})]})]})}function R(){const{request:t,connected:c}=D(),[v,i]=o.useState([]),[x,p]=o.useState(""),[y,u]=o.useState(!0),[m,f]=o.useState(null),[S,j]=o.useState(!1),[k,r]=o.useState(null),[l,b]=o.useState(null),g=o.useCallback(()=>{c&&t("skills.list").then(a=>{i(a.skills),f(null)}).catch(a=>f(a instanceof Error?a.message:"Failed to load skills")).finally(()=>u(!1))},[c,t]);o.useEffect(()=>{g()},[g]);const N=async(a,s)=>{i(h=>h.map(d=>d.name===a?{...d,enabled:s}:d));try{await t("skills.toggle",{name:a,enabled:s})}catch{i(h=>h.map(d=>d.name===a?{...d,enabled:!s}:d))}},w=async a=>{try{const s=await t("skills.delete",{name:a});s.ok?i(h=>h.filter(d=>d.name!==a)):f(s.error??"Failed to delete skill")}catch(s){f(s instanceof Error?s.message:"Failed to delete skill")}r(null)},n=v.filter(a=>a.name.toLowerCase().includes(x.toLowerCase())||a.description.toLowerCase().includes(x.toLowerCase()));return m&&v.length===0?e.jsx("div",{className:"p-6 flex flex-col gap-6 bg-[var(--color-surface-canvas)] h-full overflow-y-auto box-border",children:e.jsxs("div",{className:"p-4 bg-[rgba(255,85,85,0.06)] border border-[rgba(255,85,85,0.3)] rounded-[4px] text-[#ff5555] text-body-sm",children:["Failed to load skills: ",m]})}):y?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("span",{className:"text-[#00ff88] text-body-sm",children:"Loading…"})}):e.jsxs("div",{className:"p-6 flex flex-col gap-6 bg-[var(--color-surface-canvas)] h-full overflow-y-auto box-border",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"relative max-w-[400px] flex-1",children:[e.jsx("label",{htmlFor:"skills-search-input",className:"sr-only",children:"Search skills"}),e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-body-sm text-[var(--color-text-secondary)] pointer-events-none",children:"⌕"}),e.jsx("input",{id:"skills-search-input",type:"search",value:x,onChange:a=>p(a.target.value),placeholder:"Search skills…",spellCheck:!1,className:"w-full bg-surface-canvas border border-[var(--color-border-default)] focus:border-[rgba(0,255,136,0.4)] rounded-[4px] pl-8 pr-3.5 py-2.5 text-body-sm text-[var(--color-text-primary)] outline-none transition-colors duration-fast ease-out box-border"})]}),e.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-2 bg-[rgba(0,255,136,0.1)] hover:bg-[rgba(0,255,136,0.18)] focus-visible:bg-[rgba(0,255,136,0.18)] border border-[rgba(0,255,136,0.3)] hover:border-[rgba(0,255,136,0.5)] focus-visible:border-[rgba(0,255,136,0.5)] rounded-[4px] px-5 py-2.5 text-[#00ff88] text-body-sm-medium cursor-pointer transition-colors duration-fast ease-out",children:["+"," Upload Skill"]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("span",{className:"text-label-lg text-[#00ff88]",children:"⧈"}),e.jsxs("span",{className:"text-body-sm-medium text-[var(--color-text-primary)]",children:["Skills (",n.length,")"]})]}),n.length===0?e.jsx("p",{className:"text-body-sm text-[var(--color-text-secondary)]",children:"No skills match your search."}):e.jsx("div",{className:"grid gap-4 grid-cols-[repeat(auto-fill,minmax(380px,1fr))]",children:n.map(a=>e.jsx(U,{skill:a,isExpanded:l===a.name,onToggleExpanded:()=>b(l===a.name?null:a.name),onToggleEnabled:s=>N(a.name,s),deleteConfirm:k===a.name,onRequestDelete:()=>r(a.name),onCancelDelete:()=>r(null),onConfirmDelete:()=>w(a.name)},a.name))})]}),S&&e.jsx(E,{onClose:()=>j(!1),onUploaded:g})]})}export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as e}from"./vendor-react-B0mWfPOm.js";import{u as h}from"./index-
|
|
1
|
+
import{r as a,j as e}from"./vendor-react-B0mWfPOm.js";import{u as h}from"./index-CKAK_IGv.js";import"./vendor-viem-wp7lz4Hc.js";import"./vendor-charts-CfOL2F-E.js";function N(){const{request:l,connected:n}=h(),[i,d]=a.useState([]),[r,x]=a.useState(""),[m,p]=a.useState(null),[u,f]=a.useState(!0),[c,b]=a.useState(null);a.useEffect(()=>{n&&l("tools.list").then(t=>d(t.tools)).catch(t=>b(t instanceof Error?t.message:"Failed to load tools")).finally(()=>f(!1))},[n,l]);const o=i.filter(t=>t.name.toLowerCase().includes(r.toLowerCase())||t.description.toLowerCase().includes(r.toLowerCase()));return c?e.jsx("div",{className:"p-6 flex flex-col gap-6 bg-[var(--color-surface-canvas)] h-full overflow-y-auto box-border",children:e.jsxs("div",{className:"p-4 bg-[rgba(255,85,85,0.06)] border border-[rgba(255,85,85,0.3)] rounded-[4px] text-[#ff5555] text-body-sm",children:["Failed to load tools: ",c]})}):u?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("span",{className:"text-[#00ff88] text-body-sm",children:"Loading…"})}):e.jsxs("div",{className:"p-6 flex flex-col gap-6 bg-[var(--color-surface-canvas)] h-full overflow-y-auto box-border",children:[e.jsxs("div",{className:"relative max-w-[400px] flex-1",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-body-sm text-[#3a4a5a] pointer-events-none",children:"⌕"}),e.jsx("input",{type:"text",value:r,onChange:t=>x(t.target.value),placeholder:"Search tools…",className:"w-full bg-surface-canvas border border-[var(--color-border-default)] focus:border-[rgba(0,255,136,0.4)] rounded-[4px] pl-8 pr-3.5 py-2.5 text-body-sm text-[var(--color-text-primary)] outline-none transition-colors duration-fast ease-out box-border"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("span",{className:"text-label-lg text-[#00ff88]",children:"⚒"}),e.jsxs("span",{className:"text-body-sm-medium text-[var(--color-text-primary)]",children:["Agent Tools (",o.length,")"]})]}),o.length===0?e.jsx("p",{className:"text-body-sm text-[#3a4a5a]",children:"No tools match your search."}):e.jsx("div",{className:"grid gap-4 grid-cols-[repeat(auto-fill,minmax(380px,1fr))]",children:o.map(t=>{const s=m===t.name;return e.jsxs("div",{className:"bg-[var(--color-surface-base)] border border-[var(--color-border-default)] rounded-[2px] overflow-hidden",children:[e.jsxs("button",{type:"button",className:"block p-4 cursor-pointer bg-transparent border-0 w-full text-left hover:bg-white/[0.02] focus-visible:bg-white/[0.02] transition-colors duration-fast ease-out",onClick:()=>p(s?null:t.name),"aria-expanded":s,children:[e.jsxs("span",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-body-sm text-[#00ff88] flex-shrink-0 mt-0.5",children:"◈"}),e.jsx("span",{className:"text-body-lg-semibold text-[var(--color-text-primary)] overflow-hidden text-ellipsis whitespace-nowrap",children:t.name})]}),e.jsx("span",{className:"text-label-lg text-[#3a4a5a] flex-shrink-0 mt-0.5 transition-colors duration-fast ease-out",children:s?"▾":"▸"})]}),e.jsx("span",{className:s?"block text-body-sm text-[var(--color-text-secondary)] mt-2.5":"block text-body-sm text-[var(--color-text-secondary)] mt-2.5 overflow-hidden [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical]",children:t.description})]}),s&&t.parameters!=null&&e.jsxs("div",{className:"border-t border-[var(--color-border-default)] p-4",children:[e.jsx("p",{className:"text-caption text-[#3a4a5a] tracking-[0.5px] uppercase mb-2",children:"Parameter Schema"}),e.jsx("pre",{className:"text-caption text-[var(--color-text-primary)] bg-surface-canvas rounded-[4px] p-3 overflow-x-auto max-h-64 overflow-y-auto m-0 border border-[var(--color-border-default)]",children:JSON.stringify(t.parameters,null,2)})]})]},t.name)})})]})]})}export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as c,L as x,A as d}from"./mermaid-GHXKKRXX-
|
|
1
|
+
import{R as c,L as x,A as d}from"./mermaid-GHXKKRXX-BuHBmaw6.js";import{r as s,j as f}from"./vendor-react-B0mWfPOm.js";import"./vendor-viem-wp7lz4Hc.js";import"./index-CKAK_IGv.js";import"./vendor-charts-CfOL2F-E.js";var b=({code:i,language:e,raw:t,className:m,startLine:u,lineNumbers:n,...g})=>{let{shikiTheme:o}=s.useContext(c),r=x(),[h,a]=s.useState(t);return s.useEffect(()=>{if(!r){a(t);return}let l=r.highlight({code:i,language:e,themes:o},p=>{a(p)});l&&a(l)},[i,e,o,r,t]),f.jsx(d,{className:m,language:e,lineNumbers:n,result:h,startLine:u,...g})};export{b as HighlightedCodeBlockBody};
|