@agents-shire/cli-win32-x64 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/drizzle/0000_oval_zodiak.sql +46 -0
  2. package/drizzle/0001_familiar_captain_america.sql +5 -0
  3. package/drizzle/meta/0000_snapshot.json +350 -0
  4. package/drizzle/meta/0001_snapshot.json +385 -0
  5. package/drizzle/meta/_journal.json +20 -0
  6. package/frontend/chunk-0bse45gk.js +2 -0
  7. package/frontend/chunk-0kgchkzc.js +2 -0
  8. package/frontend/chunk-0sevb013.js +2 -0
  9. package/frontend/chunk-1dh4a5cx.js +2 -0
  10. package/frontend/chunk-1s0wttpq.js +2 -0
  11. package/frontend/chunk-22exkank.js +2 -0
  12. package/frontend/chunk-2e1s65yj.js +2 -0
  13. package/frontend/chunk-3nr0jqvn.js +1 -0
  14. package/frontend/chunk-4w7jtd73.js +1 -0
  15. package/frontend/chunk-54cwnag0.js +2 -0
  16. package/frontend/chunk-88e95fy7.js +1 -0
  17. package/frontend/chunk-a192rsyd.js +2 -0
  18. package/frontend/chunk-acmptvxv.js +2 -0
  19. package/frontend/chunk-bhn3xax8.js +30 -0
  20. package/frontend/chunk-crwk8d1a.js +1 -0
  21. package/frontend/chunk-dcv8hszn.js +2 -0
  22. package/frontend/chunk-fhmact7z.js +2 -0
  23. package/frontend/chunk-g1t3cgxq.js +2 -0
  24. package/frontend/chunk-gx71yw3f.js +12 -0
  25. package/frontend/chunk-jt8zx64v.js +2 -0
  26. package/frontend/chunk-k1p6pt0y.js +2 -0
  27. package/frontend/chunk-n7r5yhva.js +2 -0
  28. package/frontend/chunk-qf8bwpw7.js +1 -0
  29. package/frontend/chunk-qsqdrxhf.js +28 -0
  30. package/frontend/chunk-r19vjw47.js +2 -0
  31. package/frontend/chunk-sc5hwhz8.js +42 -0
  32. package/frontend/chunk-sqjb0n8w.js +3 -0
  33. package/frontend/chunk-t3xdmmp4.js +1 -0
  34. package/frontend/chunk-zagd9kjc.js +2 -0
  35. package/frontend/index.html +16 -0
  36. package/frontend/main.js +214 -0
  37. package/package.json +19 -0
  38. package/shire.exe +0 -0
@@ -0,0 +1,385 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "ec10d297-b37a-4716-92ac-3ef89d7fb821",
5
+ "prevId": "74bfc29d-6f0f-41b0-b1f0-ab3e64c8fe21",
6
+ "tables": {
7
+ "agents": {
8
+ "name": "agents",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "project_id": {
18
+ "name": "project_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true,
22
+ "autoincrement": false
23
+ },
24
+ "name": {
25
+ "name": "name",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ },
31
+ "session_id": {
32
+ "name": "session_id",
33
+ "type": "text",
34
+ "primaryKey": false,
35
+ "notNull": false,
36
+ "autoincrement": false
37
+ },
38
+ "description": {
39
+ "name": "description",
40
+ "type": "text",
41
+ "primaryKey": false,
42
+ "notNull": false,
43
+ "autoincrement": false
44
+ },
45
+ "harness": {
46
+ "name": "harness",
47
+ "type": "text",
48
+ "primaryKey": false,
49
+ "notNull": false,
50
+ "autoincrement": false
51
+ },
52
+ "model": {
53
+ "name": "model",
54
+ "type": "text",
55
+ "primaryKey": false,
56
+ "notNull": false,
57
+ "autoincrement": false
58
+ },
59
+ "system_prompt": {
60
+ "name": "system_prompt",
61
+ "type": "text",
62
+ "primaryKey": false,
63
+ "notNull": false,
64
+ "autoincrement": false
65
+ },
66
+ "created_at": {
67
+ "name": "created_at",
68
+ "type": "text",
69
+ "primaryKey": false,
70
+ "notNull": true,
71
+ "autoincrement": false,
72
+ "default": "(datetime('now'))"
73
+ },
74
+ "updated_at": {
75
+ "name": "updated_at",
76
+ "type": "text",
77
+ "primaryKey": false,
78
+ "notNull": true,
79
+ "autoincrement": false,
80
+ "default": "(datetime('now'))"
81
+ }
82
+ },
83
+ "indexes": {
84
+ "agents_project_name": {
85
+ "name": "agents_project_name",
86
+ "columns": [
87
+ "project_id",
88
+ "name"
89
+ ],
90
+ "isUnique": true
91
+ }
92
+ },
93
+ "foreignKeys": {
94
+ "agents_project_id_projects_id_fk": {
95
+ "name": "agents_project_id_projects_id_fk",
96
+ "tableFrom": "agents",
97
+ "tableTo": "projects",
98
+ "columnsFrom": [
99
+ "project_id"
100
+ ],
101
+ "columnsTo": [
102
+ "id"
103
+ ],
104
+ "onDelete": "cascade",
105
+ "onUpdate": "no action"
106
+ }
107
+ },
108
+ "compositePrimaryKeys": {},
109
+ "uniqueConstraints": {},
110
+ "checkConstraints": {}
111
+ },
112
+ "messages": {
113
+ "name": "messages",
114
+ "columns": {
115
+ "id": {
116
+ "name": "id",
117
+ "type": "integer",
118
+ "primaryKey": true,
119
+ "notNull": true,
120
+ "autoincrement": true
121
+ },
122
+ "project_id": {
123
+ "name": "project_id",
124
+ "type": "text",
125
+ "primaryKey": false,
126
+ "notNull": true,
127
+ "autoincrement": false
128
+ },
129
+ "agent_id": {
130
+ "name": "agent_id",
131
+ "type": "text",
132
+ "primaryKey": false,
133
+ "notNull": true,
134
+ "autoincrement": false
135
+ },
136
+ "role": {
137
+ "name": "role",
138
+ "type": "text",
139
+ "primaryKey": false,
140
+ "notNull": true,
141
+ "autoincrement": false
142
+ },
143
+ "content": {
144
+ "name": "content",
145
+ "type": "text",
146
+ "primaryKey": false,
147
+ "notNull": true,
148
+ "autoincrement": false
149
+ },
150
+ "created_at": {
151
+ "name": "created_at",
152
+ "type": "text",
153
+ "primaryKey": false,
154
+ "notNull": true,
155
+ "autoincrement": false,
156
+ "default": "(datetime('now'))"
157
+ }
158
+ },
159
+ "indexes": {
160
+ "idx_messages_agent": {
161
+ "name": "idx_messages_agent",
162
+ "columns": [
163
+ "project_id",
164
+ "agent_id",
165
+ "id"
166
+ ],
167
+ "isUnique": false
168
+ }
169
+ },
170
+ "foreignKeys": {
171
+ "messages_project_id_projects_id_fk": {
172
+ "name": "messages_project_id_projects_id_fk",
173
+ "tableFrom": "messages",
174
+ "tableTo": "projects",
175
+ "columnsFrom": [
176
+ "project_id"
177
+ ],
178
+ "columnsTo": [
179
+ "id"
180
+ ],
181
+ "onDelete": "cascade",
182
+ "onUpdate": "no action"
183
+ },
184
+ "messages_agent_id_agents_id_fk": {
185
+ "name": "messages_agent_id_agents_id_fk",
186
+ "tableFrom": "messages",
187
+ "tableTo": "agents",
188
+ "columnsFrom": [
189
+ "agent_id"
190
+ ],
191
+ "columnsTo": [
192
+ "id"
193
+ ],
194
+ "onDelete": "cascade",
195
+ "onUpdate": "no action"
196
+ }
197
+ },
198
+ "compositePrimaryKeys": {},
199
+ "uniqueConstraints": {},
200
+ "checkConstraints": {}
201
+ },
202
+ "projects": {
203
+ "name": "projects",
204
+ "columns": {
205
+ "id": {
206
+ "name": "id",
207
+ "type": "text",
208
+ "primaryKey": true,
209
+ "notNull": true,
210
+ "autoincrement": false
211
+ },
212
+ "name": {
213
+ "name": "name",
214
+ "type": "text",
215
+ "primaryKey": false,
216
+ "notNull": true,
217
+ "autoincrement": false
218
+ },
219
+ "created_at": {
220
+ "name": "created_at",
221
+ "type": "text",
222
+ "primaryKey": false,
223
+ "notNull": true,
224
+ "autoincrement": false,
225
+ "default": "(datetime('now'))"
226
+ },
227
+ "updated_at": {
228
+ "name": "updated_at",
229
+ "type": "text",
230
+ "primaryKey": false,
231
+ "notNull": true,
232
+ "autoincrement": false,
233
+ "default": "(datetime('now'))"
234
+ }
235
+ },
236
+ "indexes": {
237
+ "projects_name_unique": {
238
+ "name": "projects_name_unique",
239
+ "columns": [
240
+ "name"
241
+ ],
242
+ "isUnique": true
243
+ }
244
+ },
245
+ "foreignKeys": {},
246
+ "compositePrimaryKeys": {},
247
+ "uniqueConstraints": {},
248
+ "checkConstraints": {}
249
+ },
250
+ "scheduled_tasks": {
251
+ "name": "scheduled_tasks",
252
+ "columns": {
253
+ "id": {
254
+ "name": "id",
255
+ "type": "text",
256
+ "primaryKey": true,
257
+ "notNull": true,
258
+ "autoincrement": false
259
+ },
260
+ "project_id": {
261
+ "name": "project_id",
262
+ "type": "text",
263
+ "primaryKey": false,
264
+ "notNull": true,
265
+ "autoincrement": false
266
+ },
267
+ "agent_id": {
268
+ "name": "agent_id",
269
+ "type": "text",
270
+ "primaryKey": false,
271
+ "notNull": true,
272
+ "autoincrement": false
273
+ },
274
+ "label": {
275
+ "name": "label",
276
+ "type": "text",
277
+ "primaryKey": false,
278
+ "notNull": true,
279
+ "autoincrement": false
280
+ },
281
+ "message": {
282
+ "name": "message",
283
+ "type": "text",
284
+ "primaryKey": false,
285
+ "notNull": true,
286
+ "autoincrement": false
287
+ },
288
+ "schedule_type": {
289
+ "name": "schedule_type",
290
+ "type": "text",
291
+ "primaryKey": false,
292
+ "notNull": true,
293
+ "autoincrement": false
294
+ },
295
+ "cron_expression": {
296
+ "name": "cron_expression",
297
+ "type": "text",
298
+ "primaryKey": false,
299
+ "notNull": false,
300
+ "autoincrement": false
301
+ },
302
+ "scheduled_at": {
303
+ "name": "scheduled_at",
304
+ "type": "text",
305
+ "primaryKey": false,
306
+ "notNull": false,
307
+ "autoincrement": false
308
+ },
309
+ "enabled": {
310
+ "name": "enabled",
311
+ "type": "integer",
312
+ "primaryKey": false,
313
+ "notNull": true,
314
+ "autoincrement": false,
315
+ "default": true
316
+ },
317
+ "last_run_at": {
318
+ "name": "last_run_at",
319
+ "type": "text",
320
+ "primaryKey": false,
321
+ "notNull": false,
322
+ "autoincrement": false
323
+ },
324
+ "created_at": {
325
+ "name": "created_at",
326
+ "type": "text",
327
+ "primaryKey": false,
328
+ "notNull": true,
329
+ "autoincrement": false,
330
+ "default": "(datetime('now'))"
331
+ },
332
+ "updated_at": {
333
+ "name": "updated_at",
334
+ "type": "text",
335
+ "primaryKey": false,
336
+ "notNull": true,
337
+ "autoincrement": false,
338
+ "default": "(datetime('now'))"
339
+ }
340
+ },
341
+ "indexes": {},
342
+ "foreignKeys": {
343
+ "scheduled_tasks_project_id_projects_id_fk": {
344
+ "name": "scheduled_tasks_project_id_projects_id_fk",
345
+ "tableFrom": "scheduled_tasks",
346
+ "tableTo": "projects",
347
+ "columnsFrom": [
348
+ "project_id"
349
+ ],
350
+ "columnsTo": [
351
+ "id"
352
+ ],
353
+ "onDelete": "cascade",
354
+ "onUpdate": "no action"
355
+ },
356
+ "scheduled_tasks_agent_id_agents_id_fk": {
357
+ "name": "scheduled_tasks_agent_id_agents_id_fk",
358
+ "tableFrom": "scheduled_tasks",
359
+ "tableTo": "agents",
360
+ "columnsFrom": [
361
+ "agent_id"
362
+ ],
363
+ "columnsTo": [
364
+ "id"
365
+ ],
366
+ "onDelete": "cascade",
367
+ "onUpdate": "no action"
368
+ }
369
+ },
370
+ "compositePrimaryKeys": {},
371
+ "uniqueConstraints": {},
372
+ "checkConstraints": {}
373
+ }
374
+ },
375
+ "views": {},
376
+ "enums": {},
377
+ "_meta": {
378
+ "schemas": {},
379
+ "tables": {},
380
+ "columns": {}
381
+ },
382
+ "internal": {
383
+ "indexes": {}
384
+ }
385
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "sqlite",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "6",
8
+ "when": 1774597894755,
9
+ "tag": "0000_oval_zodiak",
10
+ "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "6",
15
+ "when": 1774666926396,
16
+ "tag": "0001_familiar_captain_america",
17
+ "breakpoints": true
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,2 @@
1
+ import{Aa as e,Ea as d,Qa as t,Va as o}from"/chunk-bhn3xax8.js";var r=e(d(),1);var n=e(t(),1),p=r.forwardRef(({className:i,type:l,...s},a)=>{return n.jsxDEV("input",{type:l,className:o("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",i),ref:a,...s},void 0,!1,void 0,this)});p.displayName="Input";
2
+ export{p as ka};
@@ -0,0 +1,2 @@
1
+ import{la as H,na as R,pa as F,qa as _,sa as m,ta as I,ua as l,va as v}from"/chunk-n7r5yhva.js";import{Aa as C,Ea as t,Na as e,Sa as E}from"/chunk-bhn3xax8.js";var z=C(t(),1);var D=C(e(),1),x="rovingFocusGroup.onEntryFocus",qq={bubbles:!1,cancelable:!0},j="RovingFocusGroup",[S,u,zq]=m(j),[Jq,Uq]=R(j,[zq]),[Qq,Wq]=Jq(j),d=z.forwardRef((q,W)=>{return D.jsx(S.Provider,{scope:q.__scopeRovingFocusGroup,children:D.jsx(S.Slot,{scope:q.__scopeRovingFocusGroup,children:D.jsx(Xq,{...q,ref:W})})})});d.displayName=j;var Xq=z.forwardRef((q,W)=>{let{__scopeRovingFocusGroup:Z,orientation:J,loop:k=!1,dir:G,currentTabStopId:h,defaultCurrentTabStopId:O,onCurrentTabStopIdChange:N,onEntryFocus:Y,preventScrollOnEntryFocus:$=!1,...w}=q,A=z.useRef(null),M=E(W,A),U=I(G),[P,Q]=F({prop:h,defaultProp:O??null,onChange:N,caller:j}),[V,g]=z.useState(!1),K=l(Y),B=u(Z),T=z.useRef(!1),[c,f]=z.useState(0);return z.useEffect(()=>{let X=A.current;if(X)return X.addEventListener(x,K),()=>X.removeEventListener(x,K)},[K]),D.jsx(Qq,{scope:Z,orientation:J,dir:U,loop:k,currentTabStopId:P,onItemFocus:z.useCallback((X)=>Q(X),[Q]),onItemShiftTab:z.useCallback(()=>g(!0),[]),onFocusableItemAdd:z.useCallback(()=>f((X)=>X+1),[]),onFocusableItemRemove:z.useCallback(()=>f((X)=>X-1),[]),children:D.jsx(_.div,{tabIndex:V||c===0?-1:0,"data-orientation":J,...w,ref:M,style:{outline:"none",...q.style},onMouseDown:H(q.onMouseDown,()=>{T.current=!0}),onFocus:H(q.onFocus,(X)=>{let s=!T.current;if(X.target===X.currentTarget&&s&&!V){let b=new CustomEvent(x,qq);if(X.currentTarget.dispatchEvent(b),!b.defaultPrevented){let y=B().filter((L)=>L.focusable),r=y.find((L)=>L.active),n=y.find((L)=>L.id===P),o=[r,n,...y].filter(Boolean).map((L)=>L.ref.current);i(o,$)}}T.current=!1}),onBlur:H(q.onBlur,()=>g(!1))})})}),p="RovingFocusGroupItem",a=z.forwardRef((q,W)=>{let{__scopeRovingFocusGroup:Z,focusable:J=!0,active:k=!1,tabStopId:G,children:h,...O}=q,N=v(),Y=G||N,$=Wq(p,Z),w=$.currentTabStopId===Y,A=u(Z),{onFocusableItemAdd:M,onFocusableItemRemove:U,currentTabStopId:P}=$;return z.useEffect(()=>{if(J)return M(),()=>U()},[J,M,U]),D.jsx(S.ItemSlot,{scope:Z,id:Y,focusable:J,active:k,children:D.jsx(_.span,{tabIndex:w?0:-1,"data-orientation":$.orientation,...O,ref:W,onMouseDown:H(q.onMouseDown,(Q)=>{if(!J)Q.preventDefault();else $.onItemFocus(Y)}),onFocus:H(q.onFocus,()=>$.onItemFocus(Y)),onKeyDown:H(q.onKeyDown,(Q)=>{if(Q.key==="Tab"&&Q.shiftKey){$.onItemShiftTab();return}if(Q.target!==Q.currentTarget)return;let V=Kq(Q,$.orientation,$.dir);if(V!==void 0){if(Q.metaKey||Q.ctrlKey||Q.altKey||Q.shiftKey)return;Q.preventDefault();let K=A().filter((B)=>B.focusable).map((B)=>B.ref.current);if(V==="last")K.reverse();else if(V==="prev"||V==="next"){if(V==="prev")K.reverse();let B=K.indexOf(Q.currentTarget);K=$.loop?Vq(K,B+1):K.slice(B+1)}setTimeout(()=>i(K))}}),children:typeof h==="function"?h({isCurrentTabStop:w,hasTabStop:P!=null}):h})})});a.displayName=p;var Zq={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $q(q,W){if(W!=="rtl")return q;return q==="ArrowLeft"?"ArrowRight":q==="ArrowRight"?"ArrowLeft":q}function Kq(q,W,Z){let J=$q(q.key,Z);if(W==="vertical"&&["ArrowLeft","ArrowRight"].includes(J))return;if(W==="horizontal"&&["ArrowUp","ArrowDown"].includes(J))return;return Zq[J]}function i(q,W=!1){let Z=document.activeElement;for(let J of q){if(J===Z)return;if(J.focus({preventScroll:W}),document.activeElement!==Z)return}}function Vq(q,W){return q.map((Z,J)=>q[(W+J)%q.length])}var Pq=d,kq=a;
2
+ export{Uq as u,Pq as v,kq as w};
@@ -0,0 +1,2 @@
1
+ var i=null;function e(t){i=t}function o(t,a){if(i)i(t,a);else window.location.assign(t)}
2
+ export{e as ya,o as za};
@@ -0,0 +1,2 @@
1
+ import{Aa as r,Cb as a,Ea as c,Ia as u,Qa as n}from"/chunk-bhn3xax8.js";var o=r(c(),1);var e=r(n(),1),i=o.createContext(null);function d(){let t=o.useContext(i);if(!t)throw Error("useProjectLayout must be used within a ProjectLayoutProvider");return t}function s({value:t}){return e.jsxDEV(i.Provider,{value:t,children:e.jsxDEV(o.Suspense,{fallback:e.jsxDEV("div",{className:"flex items-center justify-center flex-1",children:e.jsxDEV(a,{size:"lg",className:"text-muted-foreground"},void 0,!1,void 0,this)},void 0,!1,void 0,this),children:e.jsxDEV(u,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}
2
+ export{d as a,s as b};
@@ -0,0 +1,2 @@
1
+ import{Aa as b,Ea as m,Fa as Y,Na as R,Qa as B,Ta as V,Ua as F,Va as G}from"/chunk-bhn3xax8.js";var H=b(m(),1);var k=b(m(),1);var o=b(m(),1),Z=b(Y(),1);var L=b(R(),1),_=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],W=_.reduce((y,a)=>{let l=V(`Primitive.${a}`),f=o.forwardRef((J,K)=>{let{asChild:Q,...T}=J,X=Q?l:a;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return L.jsx(X,{...T,ref:K})});return f.displayName=`Primitive.${a}`,{...y,[a]:f}},{});var q=b(R(),1),$="Label",z=k.forwardRef((y,a)=>{return q.jsx(W.label,{...y,ref:a,onMouseDown:(l)=>{if(l.target.closest("button, input, select, textarea"))return;if(y.onMouseDown?.(l),!l.defaultPrevented&&l.detail>1)l.preventDefault()}})});z.displayName=$;var P=z;var I=b(B(),1),A=F("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),N=H.forwardRef(({className:y,...a},l)=>I.jsxDEV(P,{ref:l,className:G(A(),y),...a},void 0,!1,void 0,this));N.displayName=P.displayName;
2
+ export{N as K};
@@ -0,0 +1,2 @@
1
+ import{Aa as b,Ea as c,Qa as T,Va as o}from"/chunk-bhn3xax8.js";var r=b(c(),1);var l=b(T(),1),m=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("div",{className:"relative w-full overflow-auto",children:l.jsxDEV("table",{ref:a,className:o("w-full caption-bottom text-sm",e),...t},void 0,!1,void 0,this)},void 0,!1,void 0,this));m.displayName="Table";var d=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("thead",{ref:a,className:o("[&_tr]:border-b",e),...t},void 0,!1,void 0,this));d.displayName="TableHeader";var n=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("tbody",{ref:a,className:o("[&_tr:last-child]:border-0",e),...t},void 0,!1,void 0,this));n.displayName="TableBody";var s=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("tfoot",{ref:a,className:o("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t},void 0,!1,void 0,this));s.displayName="TableFooter";var i=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("tr",{ref:a,className:o("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t},void 0,!1,void 0,this));i.displayName="TableRow";var f=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("th",{ref:a,className:o("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t},void 0,!1,void 0,this));f.displayName="TableHead";var R=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("td",{ref:a,className:o("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t},void 0,!1,void 0,this));R.displayName="TableCell";var H=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("caption",{ref:a,className:o("mt-4 text-sm text-muted-foreground",e),...t},void 0,!1,void 0,this));H.displayName="TableCaption";
2
+ export{m as L,d as M,n as N,i as O,f as P,R as Q};
@@ -0,0 +1,2 @@
1
+ import{Aa as r,Qa as o,Xa as i,Ya as n}from"/chunk-bhn3xax8.js";var t=r(o(),1);function s({message:a="Something went wrong",onRetry:e}){return t.jsxDEV("div",{role:"alert",className:"flex flex-col items-center justify-center py-12 gap-3 text-center",children:[t.jsxDEV(n,{className:"h-8 w-8 text-destructive"},void 0,!1,void 0,this),t.jsxDEV("p",{className:"text-sm text-muted-foreground",children:a},void 0,!1,void 0,this),e&&t.jsxDEV(i,{variant:"outline",size:"sm",onClick:e,children:"Try again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
2
+ export{s as R};
@@ -0,0 +1 @@
1
+ import{d as x,h as E}from"/chunk-54cwnag0.js";import{k as T,l as B,m as I,n as y,o as j}from"/chunk-dcv8hszn.js";import"/chunk-0kgchkzc.js";import"/chunk-jt8zx64v.js";import{I as M}from"/chunk-acmptvxv.js";import{R as V}from"/chunk-2e1s65yj.js";import{$ as U,S as D,T as F,U as L,V as S,W as z,X as H,Y as O,Z as $,_ as J,aa as X,ba as Y,ca as W,da as Z}from"/chunk-gx71yw3f.js";import"/chunk-sc5hwhz8.js";import{ka as G}from"/chunk-0bse45gk.js";import"/chunk-n7r5yhva.js";import{xa as d}from"/chunk-zagd9kjc.js";import{za as C}from"/chunk-0sevb013.js";import{Aa as s,Db as R,Ea as ce,Eb as q,Hb as K,Ib as Q,Jb as _,Oa as N,Qa as u,Wa as P,Xa as n,_a as k}from"/chunk-bhn3xax8.js";var a=s(ce(),1);var e=s(u(),1);function de(m){switch(m){case"running":return"default";case"starting":return"secondary";case"error":return"destructive";default:return"secondary"}}var ue=/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/;function h(){let m=N(),{data:p=[],isLoading:te,isError:oe,error:ae,refetch:re}=q(),ne=K(),g=Q(),ie=_();M("projects:lobby",()=>{m.invalidateQueries({queryKey:["projects"]})});let[le,i]=a.useState(!1),[r,v]=a.useState(""),[c,f]=a.useState(null),[w,b]=a.useState(null);a.useEffect(()=>{b(null)},[p]);let l=ue.test(r),A=()=>{if(!l)return;ne.mutate(r),v(""),i(!1)},se=()=>{if(!c)return;g.mutate(c.id),f(null)};if(te)return e.jsxDEV(d,{children:e.jsxDEV(R,{},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(oe)return e.jsxDEV(d,{children:e.jsxDEV(V,{message:ae?.message||"Failed to load projects",onRetry:()=>re()},void 0,!1,void 0,this)},void 0,!1,void 0,this);return e.jsxDEV(d,{children:[e.jsxDEV("div",{className:"space-y-6",children:[e.jsxDEV("div",{className:"flex items-center justify-between",children:[e.jsxDEV("h1",{className:"text-2xl font-bold",children:"Projects"},void 0,!1,void 0,this),e.jsxDEV(n,{onClick:()=>i(!0),children:"+ New Project"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p.length===0?e.jsxDEV("div",{className:"text-center py-16 max-w-md mx-auto",children:[e.jsxDEV("h2",{className:"text-lg font-semibold mb-2",children:"No projects yet"},void 0,!1,void 0,this),e.jsxDEV("p",{className:"text-muted-foreground mb-6",children:"Each project gets its own isolated VM with a team of AI agents that can collaborate on tasks together."},void 0,!1,void 0,this),e.jsxDEV(n,{onClick:()=>i(!0),children:"Create Your First Project"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):e.jsxDEV("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:p.map((t)=>e.jsxDEV(x,{role:"button",tabIndex:0,className:"cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>C(`/projects/${t.name}`),onKeyDown:(o)=>{if(o.key==="Enter"||o.key===" ")o.preventDefault(),C(`/projects/${t.name}`)},children:e.jsxDEV(E,{className:"pt-6",children:e.jsxDEV("div",{className:"flex items-center justify-between",children:[e.jsxDEV("h3",{className:"font-semibold text-lg",children:t.name},void 0,!1,void 0,this),e.jsxDEV("div",{className:"flex items-center gap-2",children:[e.jsxDEV(j,{variant:de(t.status),children:t.status},void 0,!1,void 0,this),e.jsxDEV(T,{children:[e.jsxDEV(B,{asChild:!0,children:e.jsxDEV(n,{variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":`${t.name} actions`,onClick:(o)=>o.stopPropagation(),children:e.jsxDEV(k,{className:"h-4 w-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.jsxDEV(I,{align:"end",children:[t.status==="error"&&e.jsxDEV(y,{disabled:w===t.id,onClick:()=>{b(t.id),ie.mutate(t.id)},children:w===t.id?"Restarting...":"Restart"},void 0,!1,void 0,this),e.jsxDEV(y,{className:"text-destructive focus:text-destructive",onClick:(o)=>{o.stopPropagation(),f(t)},children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},t.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV(J,{open:le,onOpenChange:i,children:e.jsxDEV(U,{children:[e.jsxDEV(X,{children:[e.jsxDEV(W,{children:"New Project"},void 0,!1,void 0,this),e.jsxDEV(Z,{children:"Create a new project with its own isolated VM."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV("div",{className:"py-4 space-y-2",children:[e.jsxDEV(G,{placeholder:"my-project",value:r,onChange:(t)=>v(t.target.value.toLowerCase()),onKeyDown:(t)=>{if(t.key==="Enter")A()},autoFocus:!0,"aria-describedby":r&&!l?"project-name-error":void 0,"aria-invalid":r!==""&&!l},void 0,!1,void 0,this),r&&!l&&e.jsxDEV("p",{id:"project-name-error",className:"text-sm text-destructive",children:"Use lowercase letters, numbers, and hyphens only. Must start and end with a letter or number."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV(Y,{children:[e.jsxDEV(n,{variant:"outline",onClick:()=>i(!1),children:"Cancel"},void 0,!1,void 0,this),e.jsxDEV(n,{onClick:A,disabled:!l,children:"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),e.jsxDEV(D,{open:!!c,onOpenChange:(t)=>!t&&f(null),children:e.jsxDEV(F,{children:[e.jsxDEV(L,{children:[e.jsxDEV(z,{children:"Delete Project"},void 0,!1,void 0,this),e.jsxDEV(H,{children:["Are you sure you want to delete “",c?.name,"”? This will destroy the VM and all its data. This action cannot be undone."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV(S,{children:[e.jsxDEV($,{children:"Cancel"},void 0,!1,void 0,this),e.jsxDEV(O,{className:P({variant:"destructive"}),onClick:se,disabled:g.isPending,children:g.isPending?"Deleting...":"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var ee=s(u(),1);function me(){return ee.jsxDEV(h,{},void 0,!1,void 0,this)}export{me as default};
@@ -0,0 +1 @@
1
+ import{c as Y}from"/chunk-k1p6pt0y.js";import{d as w,h as y}from"/chunk-54cwnag0.js";import{i as b,j as D}from"/chunk-r19vjw47.js";import{k as _,l as $,m as U,n as q,o as d}from"/chunk-dcv8hszn.js";import"/chunk-0kgchkzc.js";import"/chunk-fhmact7z.js";import"/chunk-jt8zx64v.js";import"/chunk-a192rsyd.js";import"/chunk-1s0wttpq.js";import{S as p,T as u,U as A,V as f,W as v,X as N,Y as C,Z as h}from"/chunk-gx71yw3f.js";import"/chunk-sc5hwhz8.js";import"/chunk-0bse45gk.js";import"/chunk-n7r5yhva.js";import{xa as Z}from"/chunk-zagd9kjc.js";import{za as T}from"/chunk-0sevb013.js";import{Aa as l,Cb as I,Db as z,Ea as re,Gb as G,Ha as k,Lb as J,Mb as K,Ob as Q,Pb as W,Qa as m,Qb as X,Wa as O,Xa as o,_a as F,bb as L,sb as H}from"/chunk-bhn3xax8.js";var s=l(re(),1);var e=l(m(),1),le=(i)=>i==="active"||i==="starting"||i==="bootstrapping";function P(){let{agentName:i}=k(),{projectId:a,projectName:j}=G(),{data:E=[]}=J(a),r=E.find((B)=>B.name===i)?.id,{data:M}=K(a,r),n=X(a??""),g=W(a??""),V=Q(a??""),[ee,c]=s.useState(!1),[te,R]=s.useState(!1),[ae,S]=s.useState(!1);if(!a||!r||!M)return e.jsxDEV(z,{},void 0,!1,void 0,this);let t=M,ne=(B,oe)=>{let{id:me,...ie}=oe;V.mutate({id:t.id,...ie}),c(!1)};return e.jsxDEV(Z,{children:[e.jsxDEV("div",{className:"space-y-6",children:[e.jsxDEV("div",{className:"flex items-center justify-between",children:[e.jsxDEV("div",{className:"flex items-center gap-3",children:[e.jsxDEV(o,{variant:"ghost",size:"icon","aria-label":"Back",onClick:()=>T(`/projects/${j}/agents/${t.name}`),children:e.jsxDEV(L,{className:"h-5 w-5"},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.jsxDEV("h1",{className:"text-2xl font-bold",children:t.name},void 0,!1,void 0,this),e.jsxDEV(d,{variant:b(t.status),children:t.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV("div",{className:"flex items-center gap-2",children:[e.jsxDEV(o,{variant:"outline",onClick:()=>c(!0),children:[e.jsxDEV(H,{className:"h-4 w-4 mr-1"},void 0,!1,void 0,this),"Edit"]},void 0,!0,void 0,this),le(t.status)?e.jsxDEV(o,{variant:"outline",onClick:()=>S(!0),children:"Restart Agent"},void 0,!1,void 0,this):e.jsxDEV(o,{onClick:()=>n.mutate(r),disabled:n.isPending,children:[n.isPending&&e.jsxDEV(I,{size:"sm",className:"mr-1"},void 0,!1,void 0,this),"Start Agent"]},void 0,!0,void 0,this),e.jsxDEV(_,{children:[e.jsxDEV($,{asChild:!0,children:e.jsxDEV(o,{variant:"ghost",size:"icon","aria-label":"More actions",children:e.jsxDEV(F,{className:"h-4 w-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.jsxDEV(U,{align:"end",children:e.jsxDEV(q,{className:"text-destructive focus:text-destructive",onClick:()=>R(!0),children:"Delete Agent"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV("div",{className:"space-y-6",children:[e.jsxDEV(w,{children:e.jsxDEV(y,{className:"pt-6",children:e.jsxDEV("dl",{className:"divide-y divide-border",children:[e.jsxDEV("div",{className:"py-3 grid grid-cols-3 gap-4",children:[e.jsxDEV("dt",{className:"text-sm font-medium text-muted-foreground",children:"Name"},void 0,!1,void 0,this),e.jsxDEV("dd",{className:"text-sm col-span-2",children:t.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.description&&e.jsxDEV("div",{className:"py-3 grid grid-cols-3 gap-4",children:[e.jsxDEV("dt",{className:"text-sm font-medium text-muted-foreground",children:"Description"},void 0,!1,void 0,this),e.jsxDEV("dd",{className:"text-sm col-span-2",children:t.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV("div",{className:"py-3 grid grid-cols-3 gap-4",children:[e.jsxDEV("dt",{className:"text-sm font-medium text-muted-foreground",children:"Model"},void 0,!1,void 0,this),e.jsxDEV("dd",{className:"text-sm col-span-2",children:t.model||"Not set"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.harness&&e.jsxDEV("div",{className:"py-3 grid grid-cols-3 gap-4",children:[e.jsxDEV("dt",{className:"text-sm font-medium text-muted-foreground",children:"Harness"},void 0,!1,void 0,this),e.jsxDEV("dd",{className:"text-sm col-span-2",children:e.jsxDEV(d,{variant:"outline",children:D(t.harness)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV("div",{className:"py-3 grid grid-cols-3 gap-4",children:[e.jsxDEV("dt",{className:"text-sm font-medium text-muted-foreground",children:"Status"},void 0,!1,void 0,this),e.jsxDEV("dd",{className:"text-sm col-span-2",children:e.jsxDEV(d,{variant:b(t.status),children:t.status},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.jsxDEV(w,{children:e.jsxDEV(y,{className:"pt-6",children:[e.jsxDEV("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"System Prompt"},void 0,!1,void 0,this),e.jsxDEV("pre",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:t.systemPrompt||"Not set"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV(Y,{open:ee,title:"Edit Agent",agent:t,onSave:ne,onClose:()=>c(!1)},void 0,!1,void 0,this),e.jsxDEV(p,{open:ae,onOpenChange:S,children:e.jsxDEV(u,{children:[e.jsxDEV(A,{children:[e.jsxDEV(v,{children:"Restart Agent"},void 0,!1,void 0,this),e.jsxDEV(N,{children:"This will stop the current runner and restart the agent. The VM will be preserved."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV(f,{children:[e.jsxDEV(h,{children:"Cancel"},void 0,!1,void 0,this),e.jsxDEV(C,{onClick:()=>n.mutate(r),disabled:n.isPending,children:n.isPending?"Restarting...":"Restart"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),e.jsxDEV(p,{open:te,onOpenChange:R,children:e.jsxDEV(u,{children:[e.jsxDEV(A,{children:[e.jsxDEV(v,{children:"Delete Agent"},void 0,!1,void 0,this),e.jsxDEV(N,{children:"This will stop the agent and permanently remove its workspace directory. This cannot be undone."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV(f,{children:[e.jsxDEV(h,{children:"Cancel"},void 0,!1,void 0,this),e.jsxDEV(C,{className:O({variant:"destructive"}),onClick:()=>g.mutate(r),disabled:g.isPending,children:g.isPending?"Deleting...":"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var x=l(m(),1);function de(){return x.jsxDEV(P,{},void 0,!1,void 0,this)}export{de as default};
@@ -0,0 +1,2 @@
1
+ import{Aa as o,Ea as l,Qa as c,Va as r}from"/chunk-bhn3xax8.js";var d=o(l(),1);var i=o(c(),1),n=d.forwardRef(({className:e,...t},a)=>i.jsxDEV("div",{ref:a,className:r("rounded-xl border bg-card text-card-foreground shadow",e),...t},void 0,!1,void 0,this));n.displayName="Card";var m=d.forwardRef(({className:e,...t},a)=>i.jsxDEV("div",{ref:a,className:r("flex flex-col space-y-1.5 p-6",e),...t},void 0,!1,void 0,this));m.displayName="CardHeader";var s=d.forwardRef(({className:e,...t},a)=>i.jsxDEV("div",{ref:a,className:r("font-semibold leading-none tracking-tight",e),...t},void 0,!1,void 0,this));s.displayName="CardTitle";var f=d.forwardRef(({className:e,...t},a)=>i.jsxDEV("div",{ref:a,className:r("text-sm text-muted-foreground",e),...t},void 0,!1,void 0,this));f.displayName="CardDescription";var H=d.forwardRef(({className:e,...t},a)=>i.jsxDEV("div",{ref:a,className:r("p-6 pt-0",e),...t},void 0,!1,void 0,this));H.displayName="CardContent";var T=d.forwardRef(({className:e,...t},a)=>i.jsxDEV("div",{ref:a,className:r("flex items-center p-6 pt-0",e),...t},void 0,!1,void 0,this));T.displayName="CardFooter";
2
+ export{n as d,m as e,s as f,f as g,H as h};
@@ -0,0 +1 @@
1
+ import{a as fN}from"/chunk-1dh4a5cx.js";import{i as JN}from"/chunk-r19vjw47.js";import{k as oN,l as zN,m as UN,n as BN,o as l}from"/chunk-dcv8hszn.js";import{p as S}from"/chunk-qsqdrxhf.js";import"/chunk-0kgchkzc.js";import"/chunk-jt8zx64v.js";import{H as hN}from"/chunk-a192rsyd.js";import{I as qN}from"/chunk-acmptvxv.js";import{R as yN}from"/chunk-2e1s65yj.js";import"/chunk-sc5hwhz8.js";import"/chunk-n7r5yhva.js";import{Aa as X,Ab as $N,Bb as kN,Cb as V,Ea as s,Gb as r,Ha as PN,Lb as uN,Oa as x,Qa as k,Qb as QN,Rb as D,Sb as XN,Tb as _N,Ub as LN,Vb as GN,Xa as Y,Za as bN,gb as KN,hb as WN,jb as e,nb as i,ob as HN,rb as YN,wb as ZN,zb as ON}from"/chunk-bhn3xax8.js";var y=X(s(),1),E=X(s(),1);var $=X(k(),1);function t({agent:W,onMenuToggle:v}){let{projectId:b}=r(),G=GN(b??"");return $.jsxDEV("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border",children:[v&&$.jsxDEV(Y,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Open menu",onClick:v,children:$.jsxDEV(i,{className:"h-5 w-5"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("h2",{className:"text-lg font-semibold",children:W.name},void 0,!1,void 0,this),$.jsxDEV(l,{variant:JN(W.status),children:W.status},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ml-auto",children:$.jsxDEV(oN,{children:[$.jsxDEV(zN,{asChild:!0,children:$.jsxDEV(Y,{variant:"ghost",size:"icon","aria-label":"Agent options",children:$.jsxDEV(bN,{className:"h-4 w-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(UN,{align:"end",children:$.jsxDEV(BN,{onClick:()=>G.mutate(W.id),children:[$.jsxDEV(WN,{className:"h-4 w-4 mr-2"},void 0,!1,void 0,this),"Clear Session"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var o=X(s(),1);var N=X(k(),1),RN=52428800;function CN(W){if(W<1024)return`${W} B`;if(W<1048576)return`${(W/1024).toFixed(1)} KB`;return`${(W/1048576).toFixed(1)} MB`}var lN=o.memo(function({attachments:v,projectName:b,agentId:G}){if(!v.length)return null;return N.jsxDEV("div",{className:"flex flex-wrap gap-2 mt-2",children:v.map((J)=>{let K=`/api/projects/${b}/agents/${G}/attachments/${J.id}/${J.filename}`;return J.content_type.startsWith("image/")?N.jsxDEV("a",{href:K,target:"_blank",rel:"noopener noreferrer",className:"block rounded-md border border-border overflow-hidden hover:opacity-90 transition-opacity",children:N.jsxDEV("img",{src:K,alt:J.filename,loading:"lazy",className:"max-w-48 max-h-32 object-cover"},void 0,!1,void 0,this)},J.id,!1,void 0,this):N.jsxDEV("a",{href:K,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-3 py-2 rounded-md border border-border hover:bg-muted/50 text-sm",children:[N.jsxDEV(e,{className:"h-4 w-4 shrink-0 text-muted-foreground"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"truncate max-w-40",children:J.filename},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:["(",CN(J.size),")"]},void 0,!0,void 0,this),N.jsxDEV(KN,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"},void 0,!1,void 0,this)]},J.id,!0,void 0,this)})},void 0,!1,void 0,this)}),SN=o.memo(function({msg:v}){let[b,G]=o.useState(!1),J=v.input?JSON.stringify(v.input,null,2):"",K=v.output!=null;return N.jsxDEV("div",{className:"max-w-[80%] rounded-lg border border-border text-sm w-fit",children:[N.jsxDEV("button",{type:"button",onClick:()=>G(!b),"aria-expanded":b,className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50 rounded-lg",children:[N.jsxDEV("span",{className:"text-muted-foreground",children:b?"▼":"▶"},void 0,!1,void 0,this),N.jsxDEV(l,{variant:"outline",className:"font-mono text-xs",children:v.tool},void 0,!1,void 0,this),K?N.jsxDEV(l,{variant:v.isError?"destructive":"secondary",className:"text-xs",children:v.isError?"error":"done"},void 0,!1,void 0,this):N.jsxDEV("span",{className:"text-xs text-muted-foreground animate-pulse",children:"running..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b&&N.jsxDEV("div",{className:"border-t border-border px-3 py-2 space-y-2",children:[J&&N.jsxDEV("div",{children:[N.jsxDEV("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Input"},void 0,!1,void 0,this),N.jsxDEV("pre",{className:"whitespace-pre-wrap font-mono text-xs bg-muted/50 rounded p-2 max-h-40 overflow-y-auto",children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K&&N.jsxDEV("div",{children:[N.jsxDEV("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Output"},void 0,!1,void 0,this),N.jsxDEV("pre",{className:"whitespace-pre-wrap font-mono text-xs bg-muted/50 rounded p-2 max-h-40 overflow-y-auto",children:v.output},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}),dN=o.memo(function({msg:v}){let[b,G]=o.useState(!1);return N.jsxDEV("div",{className:"max-w-[80%] rounded-lg border border-border text-sm w-fit",children:[N.jsxDEV("button",{type:"button",onClick:()=>G(!b),"aria-expanded":b,className:"flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-muted/50 rounded-lg italic",children:[N.jsxDEV("span",{className:"text-muted-foreground",children:b?"▼":"▶"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-muted-foreground",children:["Message from ",v.fromAgent]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),b&&N.jsxDEV("div",{className:"border-t border-border px-3 py-2",children:N.jsxDEV(S,{children:v.text??""},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}),mN=o.memo(function({msg:v}){let[b,G]=o.useState(!1);return N.jsxDEV("div",{className:"max-w-[80%] rounded-lg border border-border text-sm w-fit",children:[N.jsxDEV(Y,{variant:"ghost",onClick:()=>G(!b),"aria-expanded":b,className:"flex w-full items-center gap-2 px-3 py-1.5 text-left italic h-auto justify-start",children:[N.jsxDEV("span",{className:"text-muted-foreground",children:b?"▼":"▶"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-muted-foreground",children:"System notification"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b&&N.jsxDEV("div",{className:"border-t border-border px-3 py-2",children:N.jsxDEV(S,{children:v.text??""},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});function IN(W){return W.map((v)=>{let{content:b}=v;return{id:v.id,role:v.role,ts:v.createdAt,text:b.text,tool:b.tool,tool_use_id:b.tool_use_id,input:b.input,output:b.output,isError:b.isError,fromAgent:b.fromAgent,attachments:b.attachments}})}function NN({agent:W,streamingText:v}){let{projectId:b,projectName:G}=r(),J=x(),K=()=>J.setQueryData(["agents",b],(w)=>w?.map((U)=>U.id===W.id?{...U,busy:!0}:U)),{data:_,isLoading:P,fetchNextPage:d,hasNextPage:a,isFetchingNextPage:j}=D(b,W.id),M=XN(b??""),q=_N(b??""),B=QN(b??""),h=o.useMemo(()=>{if(!_)return[];let w=[..._.pages].reverse().flatMap((U)=>U.messages);return IN(w)},[_]),T=a??!1,u=j,[L,m]=o.useState(""),[C,f]=o.useState(""),[H,O]=o.useState([]),F=o.useRef(null),A=o.useRef(null),p=o.useRef(null),I=o.useRef(null),n=o.useRef(0),g=o.useRef(0),c=o.useRef(!1);o.useEffect(()=>{f(""),c.current=!1,n.current=0,g.current=0},[W.id]),o.useEffect(()=>{f(v??"")},[v]),o.useEffect(()=>{let w=n.current,U=I.current;if(U&&h.length>0){if(!c.current)c.current=!0,p.current?.scrollIntoView();else if(h.length>w){let Z=g.current;if(Z>0&&U.scrollHeight>Z&&U.scrollTop<50)U.scrollTop=U.scrollHeight-Z;else p.current?.scrollIntoView({behavior:"smooth"})}}n.current=h.length},[h]),o.useEffect(()=>{if(C&&c.current)p.current?.scrollIntoView()},[C]),o.useEffect(()=>{if(W.busy&&c.current)p.current?.scrollIntoView({behavior:"smooth"})},[W.busy]),o.useEffect(()=>{let w=I.current;if(w)g.current=w.scrollHeight});let MN=o.useCallback(()=>{let w=I.current;if(!w||!T||u)return;if(w.scrollTop===0&&h.length>0)d()},[T,u,d,h.length]),TN=o.useCallback((w)=>{let U=w.target.files;if(!U)return;Array.from(U).forEach((Z)=>{if(Z.size>RN)return;let R=new FileReader;R.onload=()=>{let pN=R.result;O((cN)=>[...cN,{name:Z.name,size:Z.size,base64:pN,content_type:Z.type||"application/octet-stream"}])},R.readAsDataURL(Z)}),w.target.value=""},[]),FN=o.useCallback((w)=>{O((U)=>U.filter((Z,R)=>R!==w))},[]),vN=()=>{let w=L.trim();if(!w&&H.length===0)return;let U=H.length>0?H.map((Z)=>({name:Z.name,content:Z.base64,content_type:Z.content_type})):void 0;if(K(),M.mutate({agentId:W.id,text:w||"",attachments:U}),m(""),O([]),A.current)A.current.style.height="auto"},AN=h.length>0||C.length>0;return N.jsxDEV("div",{className:"flex flex-col h-full",children:[N.jsxDEV("div",{ref:I,onScroll:MN,className:"flex-1 overflow-y-auto p-4 space-y-3",children:[u&&N.jsxDEV("div",{className:"flex justify-center py-2",children:N.jsxDEV("span",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading older messages..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),P&&N.jsxDEV("div",{className:"flex items-center justify-center h-full",children:N.jsxDEV(V,{size:"md",className:"text-muted-foreground"},void 0,!1,void 0,this)},void 0,!1,void 0,this),!P&&!AN&&N.jsxDEV("div",{className:"flex flex-col items-center justify-center h-full gap-4 max-w-sm mx-auto text-center",children:[N.jsxDEV("p",{className:"text-sm text-muted-foreground",children:"Send a message to start working with this agent."},void 0,!1,void 0,this),W.status==="active"&&N.jsxDEV("div",{className:"flex flex-wrap justify-center gap-2",children:["What can you help me with?","What tools do you have?"].map((w)=>N.jsxDEV(Y,{variant:"outline",size:"sm",className:"rounded-full",onClick:()=>{K(),M.mutate({agentId:W.id,text:w})},children:w},w,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),h.map((w,U)=>w.role==="tool_use"?N.jsxDEV(SN,{msg:w},w.id??`msg-${U}`,!1,void 0,this):w.role==="inter_agent"?N.jsxDEV(dN,{msg:w},w.id??`msg-${U}`,!1,void 0,this):w.role==="system"?N.jsxDEV(mN,{msg:w},w.id??`msg-${U}`,!1,void 0,this):N.jsxDEV("div",{className:`flex ${w.role==="user"?"justify-end":"justify-start"}`,children:N.jsxDEV("div",{className:`px-3 py-1.5 rounded-lg text-sm w-fit max-w-[80%] ${w.role==="user"?"bg-primary/10 text-foreground":"bg-muted"}`,children:[w.text?N.jsxDEV(S,{children:w.text},void 0,!1,void 0,this):null,w.attachments&&w.attachments.length>0&&N.jsxDEV(lN,{attachments:w.attachments,projectName:G,agentId:W.id},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},w.id??`msg-${U}`,!1,void 0,this)),C&&N.jsxDEV("div",{className:"flex justify-start",children:N.jsxDEV("div",{className:"px-3 py-1.5 rounded-lg text-sm w-fit max-w-[80%] bg-muted",children:N.jsxDEV(S,{children:C},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.busy&&!C&&N.jsxDEV("div",{className:"flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground",role:"status","aria-live":"polite",children:[N.jsxDEV("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-status-active animate-pulse","aria-hidden":"true"},void 0,!1,void 0,this),"Thinking..."]},void 0,!0,void 0,this),N.jsxDEV("div",{ref:p},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.status==="active"?N.jsxDEV("div",{className:"border-t border-border p-4",children:[N.jsxDEV("input",{ref:F,type:"file",multiple:!0,className:"hidden",onChange:TN},void 0,!1,void 0,this),H.length>0&&N.jsxDEV("div",{className:"flex flex-wrap gap-2 mb-2",children:H.map((w,U)=>N.jsxDEV("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-md border border-border bg-muted/50 text-xs",children:[N.jsxDEV(e,{className:"h-3 w-3 text-muted-foreground"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"truncate max-w-32",children:w.name},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-muted-foreground",children:["(",CN(w.size),")"]},void 0,!0,void 0,this),N.jsxDEV("button",{type:"button",onClick:()=>FN(U),className:"text-muted-foreground hover:text-foreground",children:N.jsxDEV($N,{className:"h-3 w-3"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},`${w.name}-${U}`,!0,void 0,this))},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex gap-2 items-end",children:[N.jsxDEV(Y,{variant:"ghost",size:"icon",className:"shrink-0",onClick:()=>F.current?.click(),"aria-label":"Attach file",children:N.jsxDEV(YN,{className:"h-4 w-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this),N.jsxDEV(hN,{ref:A,value:L,onChange:(w)=>{m(w.target.value),w.target.style.height="auto",w.target.style.height=Math.min(w.target.scrollHeight,150)+"px"},placeholder:"Type a message...",rows:1,className:"min-h-0 resize-none",onKeyDown:(w)=>{if(w.key==="Enter"&&!w.shiftKey)w.preventDefault(),vN()}},void 0,!1,void 0,this),W.busy?N.jsxDEV(Y,{variant:"destructive",size:"icon",onClick:()=>q.mutate(W.id),"aria-label":"Stop",children:N.jsxDEV(ZN,{className:"h-4 w-4 fill-current"},void 0,!1,void 0,this)},void 0,!1,void 0,this):N.jsxDEV(Y,{onClick:vN,disabled:M.isPending,children:"Send"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):W.status==="idle"?N.jsxDEV("div",{className:"border-t border-border p-4",children:N.jsxDEV("div",{className:"flex items-center justify-between gap-3",children:[N.jsxDEV("p",{className:"text-sm text-muted-foreground",children:"Agent is idle. It will restart automatically when the VM wakes up."},void 0,!1,void 0,this),N.jsxDEV(Y,{variant:"outline",size:"sm",onClick:()=>B.mutate(W.id),disabled:B.isPending,children:B.isPending?"Restarting...":"Restart"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var z=X(k(),1);function wN({onNewAgent:W,onBrowseCatalog:v,onMenuToggle:b,hasAgents:G}){return z.jsxDEV("div",{className:"flex flex-col h-full",children:[b&&z.jsxDEV("div",{className:"px-4 py-3 border-b border-border md:hidden",children:z.jsxDEV(Y,{variant:"ghost",size:"icon","aria-label":"Open menu",onClick:b,children:z.jsxDEV(i,{className:"h-5 w-5"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex flex-col items-center justify-center flex-1 p-8 max-w-lg mx-auto",children:[z.jsxDEV("h1",{className:"text-2xl font-bold mb-2",children:"Shire"},void 0,!1,void 0,this),G?z.jsxDEV(z.Fragment,{children:[z.jsxDEV("p",{className:"text-muted-foreground text-center mb-6",children:"Select an agent from the sidebar to start chatting."},void 0,!1,void 0,this),z.jsxDEV(Y,{onClick:W,children:"+ New Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV(z.Fragment,{children:[z.jsxDEV("p",{className:"text-muted-foreground text-center mb-8",children:"Create AI agents that work together. Each agent runs in its own sandbox and can collaborate with others through messaging."},void 0,!1,void 0,this),z.jsxDEV("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4 w-full mb-8",children:[z.jsxDEV("div",{className:"flex flex-col items-center text-center gap-2 p-3",children:[z.jsxDEV("div",{className:"rounded-full bg-primary/10 p-2.5",children:z.jsxDEV(HN,{className:"h-5 w-5 text-primary"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-muted-foreground",children:"Chat with agents directly"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex flex-col items-center text-center gap-2 p-3",children:[z.jsxDEV("div",{className:"rounded-full bg-primary/10 p-2.5",children:z.jsxDEV(ON,{className:"h-5 w-5 text-primary"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-muted-foreground",children:"Agents collaborate autonomously"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex flex-col items-center text-center gap-2 p-3",children:[z.jsxDEV("div",{className:"rounded-full bg-primary/10 p-2.5",children:z.jsxDEV(kN,{className:"h-5 w-5 text-primary"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-muted-foreground",children:"Isolated VMs per project"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex flex-col sm:flex-row gap-3",children:[v&&z.jsxDEV(Y,{variant:"outline",onClick:v,children:"Browse Catalog"},void 0,!1,void 0,this),z.jsxDEV(Y,{onClick:W,children:"+ New Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Q=X(k(),1);function iN(W,v,b,G){W.setQueryData(["agents",v],(J)=>J?.map((K)=>K.id===b?{...K,...G}:K))}function rN(){let{agentName:W}=PN(),{projectId:v,sidebarOpen:b,setSidebarOpen:G,onNewAgent:J,onBrowseCatalog:K}=fN(),_=x(),{data:P=[],isLoading:d,isError:a,error:j,refetch:M}=uN(v),q=W?P.find((O)=>O.name===W):P[0],B=q?.id,{data:h}=D(v,B),T=LN(v??""),[u,L]=E.useState(""),m=E.useCallback((O)=>{switch(O.type){case"text_delta":{let{delta:F}=O.payload;if(F)L((A)=>A+F);break}case"text":case"turn_complete":{if(L(""),B)_.invalidateQueries({queryKey:["messages",v,B]});break}case"tool_use":case"tool_result":case"inter_agent_message":case"attachment":case"error":case"system_message":{if(B)_.invalidateQueries({queryKey:["messages",v,B]});break}}},[v,B,_]);qN(v&&B?`project:${v}:agent:${B}`:null,m);let C=y.useRef(B);if(C.current!==B){if(C.current=B,u!=="")L("")}let f=h?.pages?.[0]?.messages?.at(-1)?.id,H=y.useRef(T);if(y.useEffect(()=>{H.current=T}),y.useEffect(()=>{if(!v||!B||!f)return;H.current.mutate({agentId:B,messageId:f}),iN(_,v,B,{unreadCount:0})},[v,B,f,_]),q)return Q.jsxDEV(Q.Fragment,{children:[Q.jsxDEV(t,{agent:q,onMenuToggle:()=>G(!b)},void 0,!1,void 0,this),Q.jsxDEV("div",{className:"flex-1 min-h-0",children:Q.jsxDEV(NN,{agent:q,streamingText:u},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(d)return Q.jsxDEV("div",{className:"flex items-center justify-center flex-1",children:Q.jsxDEV(V,{size:"lg",className:"text-muted-foreground"},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(a)return Q.jsxDEV("div",{className:"flex items-center justify-center flex-1",children:Q.jsxDEV(yN,{message:j?.message||"Failed to load agents",onRetry:()=>M()},void 0,!1,void 0,this)},void 0,!1,void 0,this);return Q.jsxDEV(wN,{onNewAgent:J,onBrowseCatalog:K,onMenuToggle:()=>G(!b),hasAgents:P.length>0},void 0,!1,void 0,this)}export{rN as default};
@@ -0,0 +1,2 @@
1
+ import{Aa as e,Ea as d,Qa as r,Va as t}from"/chunk-bhn3xax8.js";var a=e(d(),1);var o=e(r(),1),l=a.forwardRef(({className:n,...s},i)=>{return o.jsxDEV("textarea",{className:t("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:i,...s},void 0,!1,void 0,this)});l.displayName="Textarea";
2
+ export{l as H};
@@ -0,0 +1,2 @@
1
+ import{Aa as P,Ea as Q}from"/chunk-bhn3xax8.js";var z=P(Q(),1),F=1000,U=30000;class G{ws=null;handlers=new Map;pendingSubscriptions=new Set;reconnectTimer=null;url;retryMs=F;_connectionState="disconnected";stateListeners=new Set;intentionalClose=!1;constructor(){let j=window.location.protocol==="https:"?"wss:":"ws:";this.url=`${j}//${window.location.host}/ws`}get connectionState(){return this._connectionState}setConnectionState(j){if(this._connectionState===j)return;this._connectionState=j;for(let m of this.stateListeners)m()}onStateChange(j){return this.stateListeners.add(j),()=>{this.stateListeners.delete(j)}}connect(){if(this.ws?.readyState===WebSocket.OPEN)return;this.setConnectionState("connecting"),this.ws=new WebSocket(this.url),this.ws.onopen=()=>{this.retryMs=F,this.setConnectionState("connected");for(let j of this.handlers.keys())this.send({type:"subscribe",topic:j});for(let j of this.pendingSubscriptions)this.send({type:"subscribe",topic:j}),this.pendingSubscriptions.delete(j)},this.ws.onmessage=(j)=>{let m;try{m=JSON.parse(j.data)}catch{return}let q=this.handlers.get(m.topic);if(q)for(let D of q)D(m)},this.ws.onclose=()=>{if(this.intentionalClose){this.intentionalClose=!1;return}this.setConnectionState("disconnected"),this.reconnectTimer=setTimeout(()=>this.connect(),this.retryMs),this.retryMs=Math.min(this.retryMs*2,U)}}subscribe(j,m){let q=this.handlers.get(j);if(!q)if(q=new Set,this.handlers.set(j,q),this.ws?.readyState===WebSocket.OPEN)this.send({type:"subscribe",topic:j});else this.pendingSubscriptions.add(j);return q.add(m),()=>{if(q.delete(m),q.size===0){if(this.handlers.delete(j),this.ws?.readyState===WebSocket.OPEN)this.send({type:"unsubscribe",topic:j})}}}send(j){if(this.ws?.readyState===WebSocket.OPEN)this.ws.send(JSON.stringify(j))}disconnect(){if(this.reconnectTimer)clearTimeout(this.reconnectTimer);this.intentionalClose=!0,this.ws?.close(),this.ws=null,this.setConnectionState("disconnected")}}var B=null;function J(){if(!B)B=new G,B.connect();return B}function Z(j,m){let q=z.useRef(m);z.useEffect(()=>{q.current=m}),z.useEffect(()=>{if(!j)return;return J().subscribe(j,(O)=>{q.current(O)})},[j])}function $(){let j=J();return z.useSyncExternalStore((m)=>j.onStateChange(m),()=>j.connectionState)}
2
+ export{Z as I,$ as J};