@agiflowai/agent-cli 0.2.1 → 0.2.2

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/daemon.js CHANGED
@@ -1,21 +1,21 @@
1
- import { bh as g, bi as O, bj as e, bk as C, bl as T, bm as y, bn as w, bo as A, bp as I, bq as B, br as M, bs as P, bt as _, bu as L, bv as F } from "./index-C8KSZpOG.mjs";
2
- import { useQueryClient as R, useQuery as q, useMutation as E, QueryClientProvider as z, QueryClient as K } from "@tanstack/react-query";
3
- import { useDispatch as W, useSelector as N, Provider as $ } from "react-redux";
4
- import { useRef as U, useEffect as V, useState as D, useMemo as G } from "react";
5
- const Q = ({ children: i }) => {
6
- const { Box: s, Text: n } = g(), o = W(), c = N((r) => r.daemonStatus.status), a = N((r) => r.daemonStatus.error), t = U(!1);
7
- return V(() => (o(O()), C(async () => {
1
+ import { bh as g, bi as I, bj as e, bk as B, bl as M, bm as y, bn as w, bo as P, bp as _, bq as F, br as L, bs as R, bt as q, bu as W, bv as z } from "./index-C0rzZTeN.mjs";
2
+ import { useQueryClient as K, useQuery as G, useMutation as U, QueryClientProvider as $, QueryClient as Q } from "@tanstack/react-query";
3
+ import { useDispatch as J, useSelector as l, shallowEqual as Y, Provider as X } from "react-redux";
4
+ import k, { useRef as V, useEffect as j, useState as D, useMemo as H } from "react";
5
+ const Z = ({ children: o }) => {
6
+ const { Box: s, Text: n } = g(), r = J(), u = l((a) => a.daemonStatus.status), i = l((a) => a.daemonStatus.error), t = V(!1);
7
+ return j(() => (r(I()), B(async () => {
8
8
  if (!t.current) {
9
9
  t.current = !0;
10
10
  try {
11
- const m = y.get(w.DaemonManager);
12
- m.isRunning() && await m.stop();
11
+ const p = y.get(w.DaemonManager);
12
+ p.isRunning() && await p.stop();
13
13
  } catch {
14
14
  }
15
15
  }
16
16
  }), () => {
17
- T();
18
- }), [o]), c === "starting" ? /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", padding: 1, children: /* @__PURE__ */ e.jsxDEV(n, { color: "yellow", children: "Connecting to Agiflow..." }, void 0, !1, {
17
+ M();
18
+ }), [r]), u === "starting" ? /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", padding: 1, children: /* @__PURE__ */ e.jsxDEV(n, { color: "yellow", children: "Connecting to Agiflow..." }, void 0, !1, {
19
19
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/DaemonConnectionManager.tsx",
20
20
  lineNumber: 52,
21
21
  columnNumber: 9
@@ -23,13 +23,13 @@ const Q = ({ children: i }) => {
23
23
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/DaemonConnectionManager.tsx",
24
24
  lineNumber: 51,
25
25
  columnNumber: 7
26
- }, void 0) : c === "error" ? /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", padding: 1, borderStyle: "round", borderColor: "red", children: [
26
+ }, void 0) : u === "error" ? /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", padding: 1, borderStyle: "round", borderColor: "red", children: [
27
27
  /* @__PURE__ */ e.jsxDEV(n, { color: "red", bold: !0, children: "Connection Error" }, void 0, !1, {
28
28
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/DaemonConnectionManager.tsx",
29
29
  lineNumber: 60,
30
30
  columnNumber: 9
31
31
  }, void 0),
32
- /* @__PURE__ */ e.jsxDEV(n, { children: a }, void 0, !1, {
32
+ /* @__PURE__ */ e.jsxDEV(n, { children: i }, void 0, !1, {
33
33
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/DaemonConnectionManager.tsx",
34
34
  lineNumber: 63,
35
35
  columnNumber: 9
@@ -43,21 +43,21 @@ const Q = ({ children: i }) => {
43
43
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/DaemonConnectionManager.tsx",
44
44
  lineNumber: 59,
45
45
  columnNumber: 7
46
- }, void 0) : c === "connected" ? /* @__PURE__ */ e.jsxDEV(e.Fragment, { children: i }, void 0, !1, {
46
+ }, void 0) : u === "connected" ? /* @__PURE__ */ e.jsxDEV(e.Fragment, { children: o }, void 0, !1, {
47
47
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/DaemonConnectionManager.tsx",
48
48
  lineNumber: 70,
49
49
  columnNumber: 12
50
50
  }, void 0) : null;
51
- }, J = ({ onSubmit: i, onCancel: s }) => {
52
- const { Box: n, Text: o, useInput: c } = g(), [a, t] = D(""), r = U("");
53
- return c((m, d) => {
54
- if (d.ctrl && m === "c" && r.current.length > 0) {
55
- r.current = "", t("");
51
+ }, ee = ({ onSubmit: o, onCancel: s }) => {
52
+ const { Box: n, Text: r, useInput: u } = g(), [i, t] = D(""), a = V("");
53
+ return u((p, d) => {
54
+ if (d.ctrl && p === "c" && a.current.length > 0) {
55
+ a.current = "", t("");
56
56
  return;
57
57
  }
58
58
  if (d.return) {
59
- const l = r.current.trim();
60
- l && i(l);
59
+ const m = a.current.trim();
60
+ m && o(m);
61
61
  return;
62
62
  }
63
63
  if (d.escape) {
@@ -65,17 +65,17 @@ const Q = ({ children: i }) => {
65
65
  return;
66
66
  }
67
67
  if (d.backspace || d.delete) {
68
- const l = r.current.slice(0, -1);
69
- r.current = l, t(l);
68
+ const m = a.current.slice(0, -1);
69
+ a.current = m, t(m);
70
70
  return;
71
71
  }
72
- if (m && !d.ctrl && !d.meta) {
73
- const l = r.current + m;
74
- r.current = l, t(l);
72
+ if (p && !d.ctrl && !d.meta) {
73
+ const m = a.current + p;
74
+ a.current = m, t(m);
75
75
  }
76
76
  }), /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", children: [
77
- /* @__PURE__ */ e.jsxDEV(o, { children: [
78
- /* @__PURE__ */ e.jsxDEV(o, { bold: !0, color: "cyan", children: [
77
+ /* @__PURE__ */ e.jsxDEV(r, { children: [
78
+ /* @__PURE__ */ e.jsxDEV(r, { bold: !0, color: "cyan", children: [
79
79
  "Token:",
80
80
  " "
81
81
  ] }, void 0, !0, {
@@ -83,7 +83,7 @@ const Q = ({ children: i }) => {
83
83
  lineNumber: 52,
84
84
  columnNumber: 9
85
85
  }, void 0),
86
- /* @__PURE__ */ e.jsxDEV(o, { color: "green", children: a.length > 0 ? `${a.slice(0, 20)}...` : /* @__PURE__ */ e.jsxDEV(o, { dimColor: !0, children: "(paste token)" }, void 0, !1, {
86
+ /* @__PURE__ */ e.jsxDEV(r, { color: "green", children: i.length > 0 ? `${i.slice(0, 20)}...` : /* @__PURE__ */ e.jsxDEV(r, { dimColor: !0, children: "(paste token)" }, void 0, !1, {
87
87
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/TokenInput.tsx",
88
88
  lineNumber: 55,
89
89
  columnNumber: 78
@@ -97,14 +97,14 @@ const Q = ({ children: i }) => {
97
97
  lineNumber: 51,
98
98
  columnNumber: 7
99
99
  }, void 0),
100
- /* @__PURE__ */ e.jsxDEV(o, { dimColor: !0, children: [
101
- /* @__PURE__ */ e.jsxDEV(o, { bold: !0, children: "Enter" }, void 0, !1, {
100
+ /* @__PURE__ */ e.jsxDEV(r, { dimColor: !0, children: [
101
+ /* @__PURE__ */ e.jsxDEV(r, { bold: !0, children: "Enter" }, void 0, !1, {
102
102
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/TokenInput.tsx",
103
103
  lineNumber: 58,
104
104
  columnNumber: 9
105
105
  }, void 0),
106
106
  " to submit • ",
107
- /* @__PURE__ */ e.jsxDEV(o, { bold: !0, children: "Esc" }, void 0, !1, {
107
+ /* @__PURE__ */ e.jsxDEV(r, { bold: !0, children: "Esc" }, void 0, !1, {
108
108
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/TokenInput.tsx",
109
109
  lineNumber: 58,
110
110
  columnNumber: 45
@@ -120,58 +120,58 @@ const Q = ({ children: i }) => {
120
120
  lineNumber: 50,
121
121
  columnNumber: 5
122
122
  }, void 0);
123
- }, Y = ({ children: i }) => {
124
- const { Box: s, Text: n, Newline: o, Static: c, Link: a } = g(), t = R(), [r, m] = D(null), [d, l] = D(!1), b = y.get(w.DeviceCodeAuthService), k = y.get(w.CredentialsService), { data: x, isLoading: j } = q({
123
+ }, ne = ({ children: o }) => {
124
+ const { Box: s, Text: n, Newline: r, Static: u, Link: i } = g(), t = K(), [a, p] = D(null), [d, m] = D(!1), b = y.get(w.DeviceCodeAuthService), E = y.get(w.CredentialsService), { data: x, isLoading: T } = G({
125
125
  queryKey: ["auth", "check"],
126
126
  queryFn: async () => {
127
- const u = await k.load();
128
- return u && u.apiKey && u.expiresAt && b.isTokenValid(u.expiresAt) ? { authenticated: !0 } : { authenticated: !1 };
127
+ const c = await E.load();
128
+ return c && c.apiKey && c.expiresAt && b.isTokenValid(c.expiresAt) ? { authenticated: !0 } : { authenticated: !1 };
129
129
  },
130
130
  retry: !1
131
- }), f = E({
131
+ }), N = U({
132
132
  mutationFn: async () => {
133
- const u = b.getServerUrl(), p = b.getClientId(), h = await fetch(`${u}/api/v1/oauth/device/authorize`, {
133
+ const c = b.getServerUrl(), f = b.getClientId(), h = await fetch(`${c}/api/v1/oauth/device/authorize`, {
134
134
  method: "POST",
135
135
  headers: { "Content-Type": "application/json" },
136
136
  body: JSON.stringify({
137
- client_id: p,
137
+ client_id: f,
138
138
  scope: "openid profile email"
139
139
  })
140
140
  });
141
141
  if (!h.ok) {
142
- const S = await h.json();
143
- throw new Error(S.error_description || `Device authorization failed: ${h.status}`);
142
+ const A = await h.json();
143
+ throw new Error(A.error_description || `Device authorization failed: ${h.status}`);
144
144
  }
145
145
  return h.json();
146
146
  },
147
- onSuccess: (u) => {
148
- m(u), l(!0);
147
+ onSuccess: (c) => {
148
+ p(c), m(!0);
149
149
  }
150
- }), v = E({
151
- mutationFn: async (u) => {
152
- if (!r)
150
+ }), v = U({
151
+ mutationFn: async (c) => {
152
+ if (!a)
153
153
  throw new Error("Device code not available");
154
- const p = await b.exchangeTokenForApiKey(u, r.device_code);
155
- return await k.setApiKey({
156
- apiKey: p.api_key,
157
- organizationId: p.organization_id,
158
- expiresAt: p.expires_at,
159
- deviceId: p.device_id
154
+ const f = await b.exchangeTokenForApiKey(c, a.device_code);
155
+ return await E.setApiKey({
156
+ apiKey: f.api_key,
157
+ organizationId: f.organization_id,
158
+ expiresAt: f.expires_at,
159
+ deviceId: f.device_id
160
160
  }), { success: !0 };
161
161
  },
162
162
  onSuccess: () => {
163
163
  t.invalidateQueries({ queryKey: ["auth", "check"] });
164
164
  }
165
165
  });
166
- if (V(() => {
167
- x && !x.authenticated && !f.isPending && !r && f.mutate();
168
- }, [x, f, r]), x?.authenticated)
169
- return /* @__PURE__ */ e.jsxDEV(e.Fragment, { children: i({ isAuthenticated: !0 }) }, void 0, !1, {
166
+ if (j(() => {
167
+ x && !x.authenticated && !N.isPending && !a && N.mutate();
168
+ }, [x, N, a]), x?.authenticated)
169
+ return /* @__PURE__ */ e.jsxDEV(e.Fragment, { children: o({ isAuthenticated: !0 }) }, void 0, !1, {
170
170
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
171
171
  lineNumber: 94,
172
172
  columnNumber: 12
173
173
  }, void 0);
174
- if (j)
174
+ if (T)
175
175
  return /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", padding: 1, children: [
176
176
  /* @__PURE__ */ e.jsxDEV(s, { marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "cyan", children: "🔐 Agiflow Authentication" }, void 0, !1, {
177
177
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
@@ -211,7 +211,7 @@ const Q = ({ children: i }) => {
211
211
  lineNumber: 100,
212
212
  columnNumber: 7
213
213
  }, void 0);
214
- if (f.isPending)
214
+ if (N.isPending)
215
215
  return /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", padding: 1, children: [
216
216
  /* @__PURE__ */ e.jsxDEV(s, { marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "cyan", children: "🔐 Agiflow Authentication" }, void 0, !1, {
217
217
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
@@ -269,10 +269,10 @@ const Q = ({ children: i }) => {
269
269
  lineNumber: 121,
270
270
  columnNumber: 7
271
271
  }, void 0);
272
- if (r) {
273
- const u = `${r.verification_uri}?code=${encodeURIComponent(r.user_code)}`;
272
+ if (a) {
273
+ const c = `${a.verification_uri}?code=${encodeURIComponent(a.user_code)}`;
274
274
  return /* @__PURE__ */ e.jsxDEV(e.Fragment, { children: [
275
- /* @__PURE__ */ e.jsxDEV(c, { items: [1], children: () => /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", padding: 1, children: [
275
+ /* @__PURE__ */ e.jsxDEV(u, { items: [1], children: () => /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", padding: 1, children: [
276
276
  /* @__PURE__ */ e.jsxDEV(s, { marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "cyan", children: "🔐 Agiflow Authentication" }, void 0, !1, {
277
277
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
278
278
  lineNumber: 153,
@@ -346,7 +346,7 @@ const Q = ({ children: i }) => {
346
346
  lineNumber: 177,
347
347
  columnNumber: 19
348
348
  }, void 0),
349
- /* @__PURE__ */ e.jsxDEV(o, {}, void 0, !1, {
349
+ /* @__PURE__ */ e.jsxDEV(r, {}, void 0, !1, {
350
350
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
351
351
  lineNumber: 180,
352
352
  columnNumber: 19
@@ -370,7 +370,7 @@ const Q = ({ children: i }) => {
370
370
  lineNumber: 182,
371
371
  columnNumber: 19
372
372
  }, void 0),
373
- /* @__PURE__ */ e.jsxDEV(s, { paddingLeft: 3, marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(a, { url: u, children: /* @__PURE__ */ e.jsxDEV(n, { color: "blue", bold: !0, children: u }, void 0, !1, {
373
+ /* @__PURE__ */ e.jsxDEV(s, { paddingLeft: 3, marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(i, { url: c, children: /* @__PURE__ */ e.jsxDEV(n, { color: "blue", bold: !0, children: c }, void 0, !1, {
374
374
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
375
375
  lineNumber: 190,
376
376
  columnNumber: 23
@@ -402,7 +402,7 @@ const Q = ({ children: i }) => {
402
402
  lineNumber: 196,
403
403
  columnNumber: 19
404
404
  }, void 0),
405
- /* @__PURE__ */ e.jsxDEV(s, { paddingLeft: 3, marginBottom: 1, borderStyle: "single", borderColor: "green", paddingX: 2, children: /* @__PURE__ */ e.jsxDEV(n, { color: "green", bold: !0, children: r.user_code }, void 0, !1, {
405
+ /* @__PURE__ */ e.jsxDEV(s, { paddingLeft: 3, marginBottom: 1, borderStyle: "single", borderColor: "green", paddingX: 2, children: /* @__PURE__ */ e.jsxDEV(n, { color: "green", bold: !0, children: a.user_code }, void 0, !1, {
406
406
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
407
407
  lineNumber: 203,
408
408
  columnNumber: 21
@@ -430,7 +430,7 @@ const Q = ({ children: i }) => {
430
430
  lineNumber: 208,
431
431
  columnNumber: 19
432
432
  }, void 0),
433
- /* @__PURE__ */ e.jsxDEV(o, {}, void 0, !1, {
433
+ /* @__PURE__ */ e.jsxDEV(r, {}, void 0, !1, {
434
434
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
435
435
  lineNumber: 214,
436
436
  columnNumber: 19
@@ -454,7 +454,7 @@ const Q = ({ children: i }) => {
454
454
  lineNumber: 216,
455
455
  columnNumber: 19
456
456
  }, void 0),
457
- /* @__PURE__ */ e.jsxDEV(o, {}, void 0, !1, {
457
+ /* @__PURE__ */ e.jsxDEV(r, {}, void 0, !1, {
458
458
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
459
459
  lineNumber: 222,
460
460
  columnNumber: 19
@@ -476,7 +476,7 @@ const Q = ({ children: i }) => {
476
476
  /* @__PURE__ */ e.jsxDEV(s, { borderStyle: "round", borderColor: "gray", padding: 1, marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", children: [
477
477
  /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: [
478
478
  "⏱️ Expires in: ",
479
- Math.floor(r.expires_in / 60),
479
+ Math.floor(a.expires_in / 60),
480
480
  " minutes"
481
481
  ] }, void 0, !0, {
482
482
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
@@ -507,10 +507,10 @@ const Q = ({ children: i }) => {
507
507
  columnNumber: 9
508
508
  }, void 0),
509
509
  d && /* @__PURE__ */ e.jsxDEV(s, { borderStyle: "round", borderColor: "cyan", padding: 1, children: /* @__PURE__ */ e.jsxDEV(
510
- J,
510
+ ee,
511
511
  {
512
- onSubmit: (p) => v.mutate(p),
513
- onCancel: () => l(!1)
512
+ onSubmit: (f) => v.mutate(f),
513
+ onCancel: () => m(!1)
514
514
  },
515
515
  void 0,
516
516
  !1,
@@ -571,8 +571,8 @@ const Q = ({ children: i }) => {
571
571
  lineNumber: 253,
572
572
  columnNumber: 7
573
573
  }, void 0);
574
- if (f.isError || v.isError) {
575
- const u = f.error || v.error;
574
+ if (N.isError || v.isError) {
575
+ const c = N.error || v.error;
576
576
  return /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", padding: 1, children: [
577
577
  /* @__PURE__ */ e.jsxDEV(s, { marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "red", children: "❌ Authentication Error" }, void 0, !1, {
578
578
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
@@ -583,7 +583,7 @@ const Q = ({ children: i }) => {
583
583
  lineNumber: 276,
584
584
  columnNumber: 9
585
585
  }, void 0),
586
- /* @__PURE__ */ e.jsxDEV(s, { borderStyle: "round", borderColor: "red", padding: 1, marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { color: "red", children: u?.message || "Unknown error occurred" }, void 0, !1, {
586
+ /* @__PURE__ */ e.jsxDEV(s, { borderStyle: "round", borderColor: "red", padding: 1, marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { color: "red", children: c?.message || "Unknown error occurred" }, void 0, !1, {
587
587
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
588
588
  lineNumber: 282,
589
589
  columnNumber: 11
@@ -618,7 +618,7 @@ const Q = ({ children: i }) => {
618
618
  lineNumber: 290,
619
619
  columnNumber: 13
620
620
  }, void 0),
621
- /* @__PURE__ */ e.jsxDEV(o, {}, void 0, !1, {
621
+ /* @__PURE__ */ e.jsxDEV(r, {}, void 0, !1, {
622
622
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
623
623
  lineNumber: 291,
624
624
  columnNumber: 13
@@ -644,66 +644,105 @@ const Q = ({ children: i }) => {
644
644
  }, void 0);
645
645
  }
646
646
  return null;
647
- }, X = process.platform === "darwin", H = () => {
648
- const { Box: i, Text: s } = g(), n = N((a) => a.agentTabs.tabs), o = N((a) => a.agentTabs.activeTabId), c = G(() => {
649
- if (!o) return null;
647
+ }, se = process.platform === "darwin", S = k.memo(({ tabId: o }) => {
648
+ const s = l((r) => r.agentTabs.tabs.find((u) => u.id === o)?.unreadCount), n = l((r) => r.agentTabs.activeTabId === o);
649
+ return !s || s <= 0 || n ? null : /* @__PURE__ */ e.jsxDEV(e.Fragment, { children: [
650
+ " (",
651
+ s,
652
+ ")"
653
+ ] }, void 0, !0, {
654
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
655
+ lineNumber: 35,
656
+ columnNumber: 10
657
+ }, void 0);
658
+ });
659
+ S.displayName = "UnreadCount";
660
+ const O = k.memo(({ tabId: o }) => {
661
+ const { Text: s } = g(), n = l(
662
+ (u) => u.agentTabs.tabs.find((i) => i.id === o)?.waitingInput
663
+ ), r = l((u) => u.agentTabs.activeTabId === o);
664
+ return !n || r ? null : /* @__PURE__ */ e.jsxDEV(s, { color: "red", children: "● " }, void 0, !1, {
665
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
666
+ lineNumber: 55,
667
+ columnNumber: 10
668
+ }, void 0);
669
+ });
670
+ O.displayName = "WaitingInputIndicator";
671
+ const C = k.memo(({ tabId: o, index: s }) => {
672
+ const { Box: n, Text: r } = g(), u = l((a) => a.agentTabs.tabs.find((p) => p.id === o)?.label), i = l((a) => a.agentTabs.activeTabId === o), t = `^F${s + 1}`;
673
+ return /* @__PURE__ */ e.jsxDEV(n, { marginRight: 2, borderStyle: i ? "round" : void 0, children: [
674
+ /* @__PURE__ */ e.jsxDEV(O, { tabId: o }, void 0, !1, {
675
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
676
+ lineNumber: 73,
677
+ columnNumber: 7
678
+ }, void 0),
679
+ /* @__PURE__ */ e.jsxDEV(r, { color: "#d1d5db", bold: i, dimColor: !i, children: [
680
+ "[",
681
+ t,
682
+ "] ",
683
+ u,
684
+ /* @__PURE__ */ e.jsxDEV(S, { tabId: o }, void 0, !1, {
685
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
686
+ lineNumber: 76,
687
+ columnNumber: 9
688
+ }, void 0)
689
+ ] }, void 0, !0, {
690
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
691
+ lineNumber: 74,
692
+ columnNumber: 7
693
+ }, void 0),
694
+ /* @__PURE__ */ e.jsxDEV(_, { tabId: o }, void 0, !1, {
695
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
696
+ lineNumber: 78,
697
+ columnNumber: 7
698
+ }, void 0)
699
+ ] }, void 0, !0, {
700
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
701
+ lineNumber: 72,
702
+ columnNumber: 5
703
+ }, void 0);
704
+ });
705
+ C.displayName = "TabItem";
706
+ const oe = () => {
707
+ const { Box: o, Text: s } = g(), n = l((i) => i.agentTabs.tabs.map((t) => t.id), Y), r = l((i) => i.agentTabs.activeTabId), u = H(() => {
708
+ if (!r) return null;
650
709
  try {
651
- const r = y.get(w.AgentManager).getAgentContainer(o);
652
- if (r)
653
- return r.get(A.AgentConfigService).getEffectiveWorkingDir();
710
+ const t = y.get(w.AgentManager).getAgentContainer(r);
711
+ if (t)
712
+ return t.get(P.AgentConfigService).getEffectiveWorkingDir();
654
713
  } catch {
655
714
  }
656
- return n.find((t) => t.id === o)?.request.payload.agentConfig?.workingDirectory || process.cwd();
657
- }, [o, n]);
658
- return /* @__PURE__ */ e.jsxDEV(i, { flexDirection: "column", marginTop: 1, children: [
659
- /* @__PURE__ */ e.jsxDEV(i, { alignItems: "center", borderTop: !0, borderTopColor: "#d1d5db", borderDimColor: !0, children: n.map((a, t) => {
660
- const r = `^F${t + 1}`;
661
- return /* @__PURE__ */ e.jsxDEV(i, { marginRight: 2, borderStyle: o === a.id ? "round" : void 0, children: [
662
- /* @__PURE__ */ e.jsxDEV(s, { color: "#d1d5db", bold: o === a.id, dimColor: o !== a.id, children: [
663
- "[",
664
- r,
665
- "] ",
666
- a.label,
667
- a.unreadCount && a.unreadCount > 0 && a.id !== o ? ` (${a.unreadCount})` : ""
668
- ] }, void 0, !0, {
669
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
670
- lineNumber: 47,
671
- columnNumber: 15
672
- }, void 0),
673
- /* @__PURE__ */ e.jsxDEV(I, { tab: a }, void 0, !1, {
674
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
675
- lineNumber: 51,
676
- columnNumber: 15
677
- }, void 0)
678
- ] }, a.id, !0, {
679
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
680
- lineNumber: 46,
681
- columnNumber: 13
682
- }, void 0);
683
- }) }, void 0, !1, {
715
+ return process.cwd();
716
+ }, [r]);
717
+ return /* @__PURE__ */ e.jsxDEV(o, { flexDirection: "column", marginTop: 1, children: [
718
+ /* @__PURE__ */ e.jsxDEV(o, { alignItems: "center", borderTop: !0, borderTopColor: "#d1d5db", borderDimColor: !0, children: n.map((i, t) => /* @__PURE__ */ e.jsxDEV(C, { tabId: i, index: t }, i, !1, {
684
719
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
685
- lineNumber: 42,
720
+ lineNumber: 114,
721
+ columnNumber: 11
722
+ }, void 0)) }, void 0, !1, {
723
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
724
+ lineNumber: 112,
686
725
  columnNumber: 7
687
726
  }, void 0),
688
- c && /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: c }, void 0, !1, {
727
+ u && /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: u }, void 0, !1, {
689
728
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
690
- lineNumber: 56,
729
+ lineNumber: 117,
691
730
  columnNumber: 28
692
731
  }, void 0),
693
- X && /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "Press fn + Shift + F[num] to switch tabs" }, void 0, !1, {
732
+ se && /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "Press fn + Shift + F[num] to switch tabs" }, void 0, !1, {
694
733
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
695
- lineNumber: 57,
734
+ lineNumber: 118,
696
735
  columnNumber: 19
697
736
  }, void 0)
698
737
  ] }, void 0, !0, {
699
738
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
700
- lineNumber: 41,
739
+ lineNumber: 111,
701
740
  columnNumber: 5
702
741
  }, void 0);
703
- }, Z = () => {
704
- const { Box: i } = g(), s = N((n) => n.agentTabs.activeTabId);
705
- return /* @__PURE__ */ e.jsxDEV(i, { flexDirection: "column", flexGrow: 1, children: [
706
- /* @__PURE__ */ e.jsxDEV(B, { children: /* @__PURE__ */ e.jsxDEV(M, {}, s, !1, {
742
+ }, re = () => {
743
+ const { Box: o } = g(), s = l((n) => n.agentTabs.activeTabId);
744
+ return /* @__PURE__ */ e.jsxDEV(o, { flexDirection: "column", flexGrow: 1, children: [
745
+ /* @__PURE__ */ e.jsxDEV(F, { children: /* @__PURE__ */ e.jsxDEV(L, {}, s, !1, {
707
746
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/screens/Agents/index.tsx",
708
747
  lineNumber: 19,
709
748
  columnNumber: 9
@@ -712,7 +751,7 @@ const Q = ({ children: i }) => {
712
751
  lineNumber: 18,
713
752
  columnNumber: 7
714
753
  }, void 0),
715
- /* @__PURE__ */ e.jsxDEV(P, { children: /* @__PURE__ */ e.jsxDEV(H, {}, void 0, !1, {
754
+ /* @__PURE__ */ e.jsxDEV(R, { children: /* @__PURE__ */ e.jsxDEV(oe, {}, void 0, !1, {
716
755
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/screens/Agents/index.tsx",
717
756
  lineNumber: 22,
718
757
  columnNumber: 9
@@ -721,7 +760,7 @@ const Q = ({ children: i }) => {
721
760
  lineNumber: 21,
722
761
  columnNumber: 7
723
762
  }, void 0),
724
- /* @__PURE__ */ e.jsxDEV(_, {}, void 0, !1, {
763
+ /* @__PURE__ */ e.jsxDEV(q, {}, void 0, !1, {
725
764
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/screens/Agents/index.tsx",
726
765
  lineNumber: 24,
727
766
  columnNumber: 7
@@ -731,15 +770,15 @@ const Q = ({ children: i }) => {
731
770
  lineNumber: 17,
732
771
  columnNumber: 5
733
772
  }, void 0);
734
- }, ee = () => {
735
- const { Box: i, Text: s } = g();
736
- return /* @__PURE__ */ e.jsxDEV(i, { flexDirection: "column", borderStyle: "round", borderColor: "green", padding: 1, flexGrow: 1, children: [
773
+ }, ae = () => {
774
+ const { Box: o, Text: s } = g();
775
+ return /* @__PURE__ */ e.jsxDEV(o, { flexDirection: "column", borderStyle: "round", borderColor: "green", padding: 1, flexGrow: 1, children: [
737
776
  /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "green", children: "Welcome to Agent CLI Daemon!" }, void 0, !1, {
738
777
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/screens/Onboarding/index.tsx",
739
778
  lineNumber: 9,
740
779
  columnNumber: 7
741
780
  }, void 0),
742
- /* @__PURE__ */ e.jsxDEV(i, { marginTop: 1, children: /* @__PURE__ */ e.jsxDEV(s, { children: "It looks like you don't have any active agent sessions." }, void 0, !1, {
781
+ /* @__PURE__ */ e.jsxDEV(o, { marginTop: 1, children: /* @__PURE__ */ e.jsxDEV(s, { children: "It looks like you don't have any active agent sessions." }, void 0, !1, {
743
782
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/screens/Onboarding/index.tsx",
744
783
  lineNumber: 13,
745
784
  columnNumber: 9
@@ -748,7 +787,7 @@ const Q = ({ children: i }) => {
748
787
  lineNumber: 12,
749
788
  columnNumber: 7
750
789
  }, void 0),
751
- /* @__PURE__ */ e.jsxDEV(i, { marginTop: 1, children: /* @__PURE__ */ e.jsxDEV(s, { children: [
790
+ /* @__PURE__ */ e.jsxDEV(o, { marginTop: 1, children: /* @__PURE__ */ e.jsxDEV(s, { children: [
752
791
  "Please use the Agiflow UI Dashboard to start a",
753
792
  " ",
754
793
  /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "blue", children: "Project Plan" }, void 0, !1, {
@@ -781,7 +820,7 @@ const Q = ({ children: i }) => {
781
820
  lineNumber: 15,
782
821
  columnNumber: 7
783
822
  }, void 0),
784
- /* @__PURE__ */ e.jsxDEV(i, { marginTop: 1, children: /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "The Agiflow UI Dashboard can be accessed in your browser." }, void 0, !1, {
823
+ /* @__PURE__ */ e.jsxDEV(o, { marginTop: 1, children: /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "The Agiflow UI Dashboard can be accessed in your browser." }, void 0, !1, {
785
824
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/screens/Onboarding/index.tsx",
786
825
  lineNumber: 33,
787
826
  columnNumber: 9
@@ -795,7 +834,7 @@ const Q = ({ children: i }) => {
795
834
  lineNumber: 8,
796
835
  columnNumber: 5
797
836
  }, void 0);
798
- }, ne = new K({
837
+ }, ie = new Q({
799
838
  defaultOptions: {
800
839
  queries: {
801
840
  retry: !1,
@@ -806,13 +845,13 @@ const Q = ({ children: i }) => {
806
845
  // Consider data stale after 30 seconds
807
846
  }
808
847
  }
809
- }), se = () => {
810
- const { Box: i } = g(), n = N((o) => o.agentTabs.tabs).length > 0;
811
- return /* @__PURE__ */ e.jsxDEV(Y, { children: ({ isAuthenticated: o }) => /* @__PURE__ */ e.jsxDEV(Q, { children: /* @__PURE__ */ e.jsxDEV(i, { flexGrow: 1, flexDirection: "column", children: o && !n ? /* @__PURE__ */ e.jsxDEV(ee, {}, void 0, !1, {
848
+ }), ue = () => {
849
+ const { Box: o } = g(), n = l((r) => r.agentTabs.tabs).length > 0;
850
+ return /* @__PURE__ */ e.jsxDEV(ne, { children: ({ isAuthenticated: r }) => /* @__PURE__ */ e.jsxDEV(Z, { children: /* @__PURE__ */ e.jsxDEV(o, { flexGrow: 1, flexDirection: "column", children: r && !n ? /* @__PURE__ */ e.jsxDEV(ae, {}, void 0, !1, {
812
851
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/index.tsx",
813
852
  lineNumber: 35,
814
853
  columnNumber: 49
815
- }, void 0) : /* @__PURE__ */ e.jsxDEV(Z, {}, void 0, !1, {
854
+ }, void 0) : /* @__PURE__ */ e.jsxDEV(re, {}, void 0, !1, {
816
855
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/index.tsx",
817
856
  lineNumber: 35,
818
857
  columnNumber: 66
@@ -829,7 +868,7 @@ const Q = ({ children: i }) => {
829
868
  lineNumber: 31,
830
869
  columnNumber: 5
831
870
  }, void 0);
832
- }, oe = () => /* @__PURE__ */ e.jsxDEV(L, { children: /* @__PURE__ */ e.jsxDEV($, { store: F, children: /* @__PURE__ */ e.jsxDEV(z, { client: ne, children: /* @__PURE__ */ e.jsxDEV(se, {}, void 0, !1, {
871
+ }, te = () => /* @__PURE__ */ e.jsxDEV(W, { children: /* @__PURE__ */ e.jsxDEV(X, { store: z, children: /* @__PURE__ */ e.jsxDEV($, { client: ie, children: /* @__PURE__ */ e.jsxDEV(ue, {}, void 0, !1, {
833
872
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/index.tsx",
834
873
  lineNumber: 48,
835
874
  columnNumber: 11
@@ -845,8 +884,8 @@ const Q = ({ children: i }) => {
845
884
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/index.tsx",
846
885
  lineNumber: 45,
847
886
  columnNumber: 5
848
- }, void 0), te = async () => {
849
- const { render: i } = await import("ink"), { waitUntilExit: s } = i(/* @__PURE__ */ e.jsxDEV(oe, {}, void 0, !1, {
887
+ }, void 0), de = async () => {
888
+ const { render: o } = await import("ink"), { waitUntilExit: s } = o(/* @__PURE__ */ e.jsxDEV(te, {}, void 0, !1, {
850
889
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/index.tsx",
851
890
  lineNumber: 59,
852
891
  columnNumber: 36
@@ -858,6 +897,6 @@ const Q = ({ children: i }) => {
858
897
  return s();
859
898
  };
860
899
  export {
861
- te as startDaemonApp
900
+ de as startDaemonApp
862
901
  };
863
902
  //# sourceMappingURL=daemon.js.map