@agiflowai/agent-cli 0.2.2 → 0.2.4

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 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
- if (!t.current) {
9
- t.current = !0;
1
+ import { bh as g, bi as G, bj as e, bk as Q, bl as K, bm as k, bn as E, bo as Y, bp as $, bq as X, br as H, bs as J, bt as Z, bu as ee, bv as se } from "./index-qm8Y_t_Z.mjs";
2
+ import { useQueryClient as ne, useQuery as oe, useMutation as C, QueryClientProvider as re, QueryClient as ae } from "@tanstack/react-query";
3
+ import { useDispatch as ie, useSelector as c, shallowEqual as ue, Provider as te } from "react-redux";
4
+ import T, { useRef as B, useEffect as A, useState as b, useCallback as le, useMemo as ce } from "react";
5
+ const me = ({ children: r }) => {
6
+ const { Box: n, Text: s } = g(), a = ie(), u = c((m) => m.daemonStatus.status), i = c((m) => m.daemonStatus.error), l = B(!1);
7
+ return A(() => (a(G()), Q(async () => {
8
+ if (!l.current) {
9
+ l.current = !0;
10
10
  try {
11
- const p = y.get(w.DaemonManager);
12
- p.isRunning() && await p.stop();
11
+ const d = k.get(E.DaemonManager);
12
+ d.isRunning() && await d.stop();
13
13
  } catch {
14
14
  }
15
15
  }
16
16
  }), () => {
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, {
17
+ K();
18
+ }), [a]), u === "starting" ? /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", padding: 1, children: /* @__PURE__ */ e.jsxDEV(s, { 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,18 +23,18 @@ const Z = ({ children: o }) => {
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) : u === "error" ? /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", padding: 1, borderStyle: "round", borderColor: "red", children: [
27
- /* @__PURE__ */ e.jsxDEV(n, { color: "red", bold: !0, children: "Connection Error" }, void 0, !1, {
26
+ }, void 0) : u === "error" ? /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", padding: 1, borderStyle: "round", borderColor: "red", children: [
27
+ /* @__PURE__ */ e.jsxDEV(s, { 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: i }, void 0, !1, {
32
+ /* @__PURE__ */ e.jsxDEV(s, { 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
36
36
  }, void 0),
37
- /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: "Retrying in background..." }, void 0, !1, {
37
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "Retrying in background..." }, void 0, !1, {
38
38
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/DaemonConnectionManager.tsx",
39
39
  lineNumber: 64,
40
40
  columnNumber: 9
@@ -43,612 +43,651 @@ const Z = ({ children: o }) => {
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) : u === "connected" ? /* @__PURE__ */ e.jsxDEV(e.Fragment, { children: o }, void 0, !1, {
46
+ }, void 0) : u === "connected" ? /* @__PURE__ */ e.jsxDEV(e.Fragment, { children: r }, 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
- }, 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
- return;
57
- }
58
- if (d.return) {
59
- const m = a.current.trim();
60
- m && o(m);
61
- return;
62
- }
63
- if (d.escape) {
64
- s?.();
65
- return;
66
- }
67
- if (d.backspace || d.delete) {
68
- const m = a.current.slice(0, -1);
69
- a.current = m, t(m);
70
- return;
71
- }
72
- if (p && !d.ctrl && !d.meta) {
73
- const m = a.current + p;
74
- a.current = m, t(m);
75
- }
76
- }), /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", children: [
77
- /* @__PURE__ */ e.jsxDEV(r, { children: [
78
- /* @__PURE__ */ e.jsxDEV(r, { bold: !0, color: "cyan", children: [
79
- "Token:",
80
- " "
81
- ] }, void 0, !0, {
82
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/TokenInput.tsx",
83
- lineNumber: 52,
84
- columnNumber: 9
85
- }, void 0),
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
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/TokenInput.tsx",
88
- lineNumber: 55,
89
- columnNumber: 78
90
- }, void 0) }, void 0, !1, {
91
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/TokenInput.tsx",
92
- lineNumber: 55,
93
- columnNumber: 9
94
- }, void 0)
95
- ] }, void 0, !0, {
96
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/TokenInput.tsx",
97
- lineNumber: 51,
98
- columnNumber: 7
99
- }, void 0),
100
- /* @__PURE__ */ e.jsxDEV(r, { dimColor: !0, children: [
101
- /* @__PURE__ */ e.jsxDEV(r, { bold: !0, children: "Enter" }, void 0, !1, {
102
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/TokenInput.tsx",
103
- lineNumber: 58,
104
- columnNumber: 9
105
- }, void 0),
106
- " to submit • ",
107
- /* @__PURE__ */ e.jsxDEV(r, { bold: !0, children: "Esc" }, void 0, !1, {
108
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/TokenInput.tsx",
109
- lineNumber: 58,
110
- columnNumber: 45
111
- }, void 0),
112
- " to cancel"
113
- ] }, void 0, !0, {
114
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/TokenInput.tsx",
115
- lineNumber: 57,
116
- columnNumber: 7
117
- }, void 0)
118
- ] }, void 0, !0, {
119
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/TokenInput.tsx",
120
- lineNumber: 50,
121
- columnNumber: 5
122
- }, void 0);
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({
51
+ }, de = ({ children: r }) => {
52
+ const { Box: n, Text: s, Newline: a, Static: u, Link: i, useInput: l } = g(), m = ne(), [d, P] = b(null), [U, q] = b(null), [x, L] = b([]), [N, I] = b(0), [f, p] = b("checking"), [R, w] = b(""), j = B(null), v = k.get(E.DeviceCodeAuthService), M = k.get(E.CredentialsService), { data: D, isLoading: V } = oe({
125
53
  queryKey: ["auth", "check"],
126
54
  queryFn: async () => {
127
- const c = await E.load();
128
- return c && c.apiKey && c.expiresAt && b.isTokenValid(c.expiresAt) ? { authenticated: !0 } : { authenticated: !1 };
55
+ const o = await M.load();
56
+ return o && o.apiKey && o.expiresAt && v.isTokenValid(o.expiresAt) ? { authenticated: !0 } : { authenticated: !1 };
129
57
  },
130
58
  retry: !1
131
- }), N = U({
132
- mutationFn: async () => {
133
- const c = b.getServerUrl(), f = b.getClientId(), h = await fetch(`${c}/api/v1/oauth/device/authorize`, {
134
- method: "POST",
135
- headers: { "Content-Type": "application/json" },
136
- body: JSON.stringify({
137
- client_id: f,
138
- scope: "openid profile email"
139
- })
140
- });
141
- if (!h.ok) {
142
- const A = await h.json();
143
- throw new Error(A.error_description || `Device authorization failed: ${h.status}`);
144
- }
145
- return h.json();
59
+ }), h = C({
60
+ mutationFn: async () => (p("requesting_code"), v.requestDeviceCode("openid profile email")),
61
+ onSuccess: (o) => {
62
+ P(o), p("polling"), S.mutate(o);
146
63
  },
147
- onSuccess: (c) => {
148
- p(c), m(!0);
64
+ onError: (o) => {
65
+ p("error"), w(o instanceof Error ? o.message : "Failed to request device code");
149
66
  }
150
- }), v = U({
151
- mutationFn: async (c) => {
152
- if (!a)
153
- throw new Error("Device code not available");
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
- }), { success: !0 };
67
+ }), S = C({
68
+ mutationFn: async (o) => {
69
+ j.current = new AbortController();
70
+ const t = await v.pollForToken(o.device_code, o.interval || 5, {
71
+ signal: j.current.signal
72
+ }), y = await v.listOrganizations(t.access_token);
73
+ return { accessToken: t.access_token, organizations: y };
161
74
  },
162
- onSuccess: () => {
163
- t.invalidateQueries({ queryKey: ["auth", "check"] });
75
+ onSuccess: (o) => {
76
+ q(o.accessToken), L(o.organizations), o.organizations.length === 0 ? (p("error"), w("You have no organizations. Please create one first.")) : o.organizations.length === 1 ? O.mutate({ accessToken: o.accessToken, organizationId: o.organizations[0].id }) : p("selecting_org");
77
+ },
78
+ onError: (o) => {
79
+ p("error"), w(o instanceof Error ? o.message : "Failed to poll for token");
164
80
  }
165
- });
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, {
81
+ }), O = C({
82
+ mutationFn: async ({ accessToken: o, organizationId: t }) => (p("exchanging"), v.exchangeForAgentApiKey(o, t)),
83
+ onSuccess: async (o) => {
84
+ await M.setApiKey({
85
+ apiKey: o.api_key,
86
+ organizationId: o.organization_id,
87
+ expiresAt: o.expires_at,
88
+ deviceId: o.device_id
89
+ }), p("authenticated"), m.invalidateQueries({ queryKey: ["auth", "check"] });
90
+ },
91
+ onError: (o) => {
92
+ p("error"), w(o instanceof Error ? o.message : "Failed to exchange for agent API key");
93
+ }
94
+ }), W = le(() => {
95
+ U && x[N] && O.mutate({
96
+ accessToken: U,
97
+ organizationId: x[N].id
98
+ });
99
+ }, [U, x, N, O]);
100
+ if (l(
101
+ (o, t) => {
102
+ f === "selecting_org" && (t.upArrow ? I((y) => Math.max(0, y - 1)) : t.downArrow ? I((y) => Math.min(x.length - 1, y + 1)) : t.return && W());
103
+ },
104
+ { isActive: f === "selecting_org" }
105
+ ), A(() => () => {
106
+ j.current?.abort();
107
+ }, []), A(() => {
108
+ D && !D.authenticated && f === "checking" && !V && h.mutate();
109
+ }, [D, f, V, h]), D?.authenticated)
110
+ return /* @__PURE__ */ e.jsxDEV(e.Fragment, { children: r({ isAuthenticated: !0 }) }, void 0, !1, {
170
111
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
171
- lineNumber: 94,
112
+ lineNumber: 168,
172
113
  columnNumber: 12
173
114
  }, void 0);
174
- if (T)
175
- return /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", padding: 1, children: [
176
- /* @__PURE__ */ e.jsxDEV(s, { marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "cyan", children: "🔐 Agiflow Authentication" }, void 0, !1, {
115
+ if (V)
116
+ return /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", padding: 1, children: [
117
+ /* @__PURE__ */ e.jsxDEV(n, { marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "cyan", children: "🔐 Agiflow Authentication" }, void 0, !1, {
177
118
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
178
- lineNumber: 102,
119
+ lineNumber: 176,
179
120
  columnNumber: 11
180
121
  }, void 0) }, void 0, !1, {
181
122
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
182
- lineNumber: 101,
123
+ lineNumber: 175,
183
124
  columnNumber: 9
184
125
  }, void 0),
185
- /* @__PURE__ */ e.jsxDEV(s, { borderStyle: "round", borderColor: "cyan", padding: 1, children: /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", children: /* @__PURE__ */ e.jsxDEV(n, { children: [
186
- /* @__PURE__ */ e.jsxDEV(n, { color: "cyan", children: "◉ " }, void 0, !1, {
126
+ /* @__PURE__ */ e.jsxDEV(n, { borderStyle: "round", borderColor: "cyan", padding: 1, children: /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", children: /* @__PURE__ */ e.jsxDEV(s, { children: [
127
+ /* @__PURE__ */ e.jsxDEV(s, { color: "cyan", children: "◉ " }, void 0, !1, {
187
128
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
188
- lineNumber: 109,
129
+ lineNumber: 183,
189
130
  columnNumber: 15
190
131
  }, void 0),
191
- /* @__PURE__ */ e.jsxDEV(n, { children: "Checking existing credentials..." }, void 0, !1, {
132
+ /* @__PURE__ */ e.jsxDEV(s, { children: "Checking existing credentials..." }, void 0, !1, {
192
133
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
193
- lineNumber: 110,
134
+ lineNumber: 184,
194
135
  columnNumber: 15
195
136
  }, void 0)
196
137
  ] }, void 0, !0, {
197
138
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
198
- lineNumber: 108,
139
+ lineNumber: 182,
199
140
  columnNumber: 13
200
141
  }, void 0) }, void 0, !1, {
201
142
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
202
- lineNumber: 107,
143
+ lineNumber: 181,
203
144
  columnNumber: 11
204
145
  }, void 0) }, void 0, !1, {
205
146
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
206
- lineNumber: 106,
147
+ lineNumber: 180,
207
148
  columnNumber: 9
208
149
  }, void 0)
209
150
  ] }, void 0, !0, {
210
151
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
211
- lineNumber: 100,
152
+ lineNumber: 174,
212
153
  columnNumber: 7
213
154
  }, void 0);
214
- if (N.isPending)
215
- return /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", padding: 1, children: [
216
- /* @__PURE__ */ e.jsxDEV(s, { marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "cyan", children: "🔐 Agiflow Authentication" }, void 0, !1, {
155
+ if (h.isPending)
156
+ return /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", padding: 1, children: [
157
+ /* @__PURE__ */ e.jsxDEV(n, { marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "cyan", children: "🔐 Agiflow Authentication" }, void 0, !1, {
217
158
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
218
- lineNumber: 123,
159
+ lineNumber: 197,
219
160
  columnNumber: 11
220
161
  }, void 0) }, void 0, !1, {
221
162
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
222
- lineNumber: 122,
163
+ lineNumber: 196,
223
164
  columnNumber: 9
224
165
  }, void 0),
225
- /* @__PURE__ */ e.jsxDEV(s, { borderStyle: "round", borderColor: "cyan", padding: 1, children: /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", children: [
226
- /* @__PURE__ */ e.jsxDEV(n, { children: [
227
- /* @__PURE__ */ e.jsxDEV(n, { color: "green", children: "✓ " }, void 0, !1, {
166
+ /* @__PURE__ */ e.jsxDEV(n, { borderStyle: "round", borderColor: "cyan", padding: 1, children: /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", children: [
167
+ /* @__PURE__ */ e.jsxDEV(s, { children: [
168
+ /* @__PURE__ */ e.jsxDEV(s, { color: "green", children: "✓ " }, void 0, !1, {
228
169
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
229
- lineNumber: 130,
170
+ lineNumber: 204,
230
171
  columnNumber: 15
231
172
  }, void 0),
232
- /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: "Checked existing credentials" }, void 0, !1, {
173
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "Checked existing credentials" }, void 0, !1, {
233
174
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
234
- lineNumber: 131,
175
+ lineNumber: 205,
235
176
  columnNumber: 15
236
177
  }, void 0)
237
178
  ] }, void 0, !0, {
238
179
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
239
- lineNumber: 129,
180
+ lineNumber: 203,
240
181
  columnNumber: 13
241
182
  }, void 0),
242
- /* @__PURE__ */ e.jsxDEV(n, { children: [
243
- /* @__PURE__ */ e.jsxDEV(n, { color: "cyan", children: "◉ " }, void 0, !1, {
183
+ /* @__PURE__ */ e.jsxDEV(s, { children: [
184
+ /* @__PURE__ */ e.jsxDEV(s, { color: "cyan", children: "◉ " }, void 0, !1, {
244
185
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
245
- lineNumber: 134,
186
+ lineNumber: 208,
246
187
  columnNumber: 15
247
188
  }, void 0),
248
- /* @__PURE__ */ e.jsxDEV(n, { children: "Requesting device authorization..." }, void 0, !1, {
189
+ /* @__PURE__ */ e.jsxDEV(s, { children: "Requesting device authorization..." }, void 0, !1, {
249
190
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
250
- lineNumber: 135,
191
+ lineNumber: 209,
251
192
  columnNumber: 15
252
193
  }, void 0)
253
194
  ] }, void 0, !0, {
254
195
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
255
- lineNumber: 133,
196
+ lineNumber: 207,
256
197
  columnNumber: 13
257
198
  }, void 0)
258
199
  ] }, void 0, !0, {
259
200
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
260
- lineNumber: 128,
201
+ lineNumber: 202,
261
202
  columnNumber: 11
262
203
  }, void 0) }, void 0, !1, {
263
204
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
264
- lineNumber: 127,
205
+ lineNumber: 201,
265
206
  columnNumber: 9
266
207
  }, void 0)
267
208
  ] }, void 0, !0, {
268
209
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
269
- lineNumber: 121,
210
+ lineNumber: 195,
270
211
  columnNumber: 7
271
212
  }, void 0);
272
- if (a) {
273
- const c = `${a.verification_uri}?code=${encodeURIComponent(a.user_code)}`;
274
- return /* @__PURE__ */ e.jsxDEV(e.Fragment, { children: [
275
- /* @__PURE__ */ e.jsxDEV(u, { items: [1], children: () => /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", padding: 1, children: [
276
- /* @__PURE__ */ e.jsxDEV(s, { marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "cyan", children: "🔐 Agiflow Authentication" }, void 0, !1, {
277
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
278
- lineNumber: 153,
279
- columnNumber: 17
280
- }, void 0) }, void 0, !1, {
281
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
282
- lineNumber: 152,
283
- columnNumber: 15
284
- }, void 0),
285
- /* @__PURE__ */ e.jsxDEV(s, { borderStyle: "round", borderColor: "green", padding: 1, marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", children: [
286
- /* @__PURE__ */ e.jsxDEV(n, { children: [
287
- /* @__PURE__ */ e.jsxDEV(n, { color: "green", children: "✓ " }, void 0, !1, {
288
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
289
- lineNumber: 161,
290
- columnNumber: 21
291
- }, void 0),
292
- /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: "Checked existing credentials" }, void 0, !1, {
293
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
294
- lineNumber: 162,
295
- columnNumber: 21
296
- }, void 0)
297
- ] }, void 0, !0, {
298
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
299
- lineNumber: 160,
300
- columnNumber: 19
301
- }, void 0),
302
- /* @__PURE__ */ e.jsxDEV(n, { children: [
303
- /* @__PURE__ */ e.jsxDEV(n, { color: "green", children: "✓ " }, void 0, !1, {
304
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
305
- lineNumber: 165,
306
- columnNumber: 21
307
- }, void 0),
308
- /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: "Device authorization requested" }, void 0, !1, {
309
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
310
- lineNumber: 166,
311
- columnNumber: 21
312
- }, void 0)
313
- ] }, void 0, !0, {
213
+ if (d) {
214
+ const o = `${d.verification_uri}?code=${encodeURIComponent(d.user_code)}`;
215
+ return /* @__PURE__ */ e.jsxDEV(u, { items: [1], children: () => /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", padding: 1, children: [
216
+ /* @__PURE__ */ e.jsxDEV(n, { marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "cyan", children: "🔐 Agiflow Authentication" }, void 0, !1, {
217
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
218
+ lineNumber: 226,
219
+ columnNumber: 15
220
+ }, void 0) }, void 0, !1, {
221
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
222
+ lineNumber: 225,
223
+ columnNumber: 13
224
+ }, void 0),
225
+ /* @__PURE__ */ e.jsxDEV(n, { borderStyle: "round", borderColor: "green", padding: 1, marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", children: [
226
+ /* @__PURE__ */ e.jsxDEV(s, { children: [
227
+ /* @__PURE__ */ e.jsxDEV(s, { color: "green", children: "✓ " }, void 0, !1, {
314
228
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
315
- lineNumber: 164,
229
+ lineNumber: 234,
316
230
  columnNumber: 19
317
231
  }, void 0),
318
- /* @__PURE__ */ e.jsxDEV(n, { children: [
319
- /* @__PURE__ */ e.jsxDEV(n, { color: "cyan", children: "◉ " }, void 0, !1, {
320
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
321
- lineNumber: 169,
322
- columnNumber: 21
323
- }, void 0),
324
- /* @__PURE__ */ e.jsxDEV(n, { bold: !0, children: "Waiting for browser confirmation" }, void 0, !1, {
325
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
326
- lineNumber: 170,
327
- columnNumber: 21
328
- }, void 0)
329
- ] }, void 0, !0, {
232
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "Checked existing credentials" }, void 0, !1, {
330
233
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
331
- lineNumber: 168,
234
+ lineNumber: 235,
332
235
  columnNumber: 19
333
236
  }, void 0)
334
237
  ] }, void 0, !0, {
335
238
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
336
- lineNumber: 159,
239
+ lineNumber: 233,
337
240
  columnNumber: 17
338
- }, void 0) }, void 0, !1, {
339
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
340
- lineNumber: 158,
341
- columnNumber: 15
342
241
  }, void 0),
343
- /* @__PURE__ */ e.jsxDEV(s, { borderStyle: "double", borderColor: "yellow", padding: 1, marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", children: [
344
- /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "yellow", children: "📋 Authentication Steps:" }, void 0, !1, {
345
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
346
- lineNumber: 177,
347
- columnNumber: 19
348
- }, void 0),
349
- /* @__PURE__ */ e.jsxDEV(r, {}, void 0, !1, {
242
+ /* @__PURE__ */ e.jsxDEV(s, { children: [
243
+ /* @__PURE__ */ e.jsxDEV(s, { color: "green", children: " " }, void 0, !1, {
350
244
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
351
- lineNumber: 180,
245
+ lineNumber: 238,
352
246
  columnNumber: 19
353
247
  }, void 0),
354
- /* @__PURE__ */ e.jsxDEV(n, { children: [
355
- /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "cyan", children: [
356
- "1.",
357
- " "
358
- ] }, void 0, !0, {
359
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
360
- lineNumber: 183,
361
- columnNumber: 21
362
- }, void 0),
363
- /* @__PURE__ */ e.jsxDEV(n, { children: "Open this URL in your browser:" }, void 0, !1, {
364
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
365
- lineNumber: 186,
366
- columnNumber: 21
367
- }, void 0)
368
- ] }, void 0, !0, {
248
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "Device authorization requested" }, void 0, !1, {
369
249
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
370
- lineNumber: 182,
250
+ lineNumber: 239,
371
251
  columnNumber: 19
372
- }, void 0),
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
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
375
- lineNumber: 190,
376
- columnNumber: 23
377
- }, void 0) }, void 0, !1, {
378
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
379
- lineNumber: 189,
380
- columnNumber: 21
381
- }, void 0) }, void 0, !1, {
382
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
383
- lineNumber: 188,
384
- columnNumber: 19
385
- }, void 0),
386
- /* @__PURE__ */ e.jsxDEV(n, { children: [
387
- /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "cyan", children: [
388
- "2.",
389
- " "
390
- ] }, void 0, !0, {
391
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
392
- lineNumber: 197,
393
- columnNumber: 21
394
- }, void 0),
395
- /* @__PURE__ */ e.jsxDEV(n, { children: "Enter this verification code:" }, void 0, !1, {
396
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
397
- lineNumber: 200,
398
- columnNumber: 21
399
- }, void 0)
400
- ] }, void 0, !0, {
252
+ }, void 0)
253
+ ] }, void 0, !0, {
254
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
255
+ lineNumber: 237,
256
+ columnNumber: 17
257
+ }, void 0),
258
+ /* @__PURE__ */ e.jsxDEV(s, { children: [
259
+ /* @__PURE__ */ e.jsxDEV(s, { color: "cyan", children: "◉ " }, void 0, !1, {
401
260
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
402
- lineNumber: 196,
261
+ lineNumber: 242,
403
262
  columnNumber: 19
404
263
  }, 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: a.user_code }, void 0, !1, {
264
+ /* @__PURE__ */ e.jsxDEV(s, { bold: !0, children: "Polling for authorization..." }, void 0, !1, {
406
265
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
407
- lineNumber: 203,
408
- columnNumber: 21
409
- }, void 0) }, void 0, !1, {
410
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
411
- lineNumber: 202,
266
+ lineNumber: 243,
412
267
  columnNumber: 19
413
- }, void 0),
414
- /* @__PURE__ */ e.jsxDEV(n, { children: [
415
- /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "cyan", children: [
416
- "3.",
417
- " "
418
- ] }, void 0, !0, {
419
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
420
- lineNumber: 209,
421
- columnNumber: 21
422
- }, void 0),
423
- /* @__PURE__ */ e.jsxDEV(n, { children: "Sign in and authorize the device" }, void 0, !1, {
424
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
425
- lineNumber: 212,
426
- columnNumber: 21
427
- }, void 0)
268
+ }, void 0)
269
+ ] }, void 0, !0, {
270
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
271
+ lineNumber: 241,
272
+ columnNumber: 17
273
+ }, void 0)
274
+ ] }, void 0, !0, {
275
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
276
+ lineNumber: 232,
277
+ columnNumber: 15
278
+ }, void 0) }, void 0, !1, {
279
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
280
+ lineNumber: 231,
281
+ columnNumber: 13
282
+ }, void 0),
283
+ /* @__PURE__ */ e.jsxDEV(n, { borderStyle: "double", borderColor: "yellow", padding: 1, marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", children: [
284
+ /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "yellow", children: "📋 Authentication Steps:" }, void 0, !1, {
285
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
286
+ lineNumber: 250,
287
+ columnNumber: 17
288
+ }, void 0),
289
+ /* @__PURE__ */ e.jsxDEV(a, {}, void 0, !1, {
290
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
291
+ lineNumber: 253,
292
+ columnNumber: 17
293
+ }, void 0),
294
+ /* @__PURE__ */ e.jsxDEV(s, { children: [
295
+ /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "cyan", children: [
296
+ "1.",
297
+ " "
428
298
  ] }, void 0, !0, {
429
299
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
430
- lineNumber: 208,
300
+ lineNumber: 256,
431
301
  columnNumber: 19
432
302
  }, void 0),
433
- /* @__PURE__ */ e.jsxDEV(r, {}, void 0, !1, {
303
+ /* @__PURE__ */ e.jsxDEV(s, { children: "Open this URL in your browser:" }, void 0, !1, {
434
304
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
435
- lineNumber: 214,
305
+ lineNumber: 259,
436
306
  columnNumber: 19
437
- }, void 0),
438
- /* @__PURE__ */ e.jsxDEV(n, { children: [
439
- /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "cyan", children: [
440
- "4.",
441
- " "
442
- ] }, void 0, !0, {
443
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
444
- lineNumber: 217,
445
- columnNumber: 21
446
- }, void 0),
447
- /* @__PURE__ */ e.jsxDEV(n, { children: "Copy the verification token (JWT) shown after confirmation" }, void 0, !1, {
448
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
449
- lineNumber: 220,
450
- columnNumber: 21
451
- }, void 0)
307
+ }, void 0)
308
+ ] }, void 0, !0, {
309
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
310
+ lineNumber: 255,
311
+ columnNumber: 17
312
+ }, void 0),
313
+ /* @__PURE__ */ e.jsxDEV(n, { paddingLeft: 3, marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(i, { url: o, children: /* @__PURE__ */ e.jsxDEV(s, { color: "blue", bold: !0, children: o }, void 0, !1, {
314
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
315
+ lineNumber: 263,
316
+ columnNumber: 21
317
+ }, void 0) }, void 0, !1, {
318
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
319
+ lineNumber: 262,
320
+ columnNumber: 19
321
+ }, void 0) }, void 0, !1, {
322
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
323
+ lineNumber: 261,
324
+ columnNumber: 17
325
+ }, void 0),
326
+ /* @__PURE__ */ e.jsxDEV(s, { children: [
327
+ /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "cyan", children: [
328
+ "2.",
329
+ " "
452
330
  ] }, void 0, !0, {
453
331
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
454
- lineNumber: 216,
332
+ lineNumber: 270,
455
333
  columnNumber: 19
456
334
  }, void 0),
457
- /* @__PURE__ */ e.jsxDEV(r, {}, void 0, !1, {
335
+ /* @__PURE__ */ e.jsxDEV(s, { children: "Enter this verification code:" }, void 0, !1, {
458
336
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
459
- lineNumber: 222,
460
- columnNumber: 19
461
- }, void 0),
462
- /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: 'The browser will show a long token that starts with "eyJ..."' }, void 0, !1, {
463
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
464
- lineNumber: 224,
337
+ lineNumber: 273,
465
338
  columnNumber: 19
466
339
  }, void 0)
467
340
  ] }, void 0, !0, {
468
341
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
469
- lineNumber: 176,
342
+ lineNumber: 269,
470
343
  columnNumber: 17
344
+ }, void 0),
345
+ /* @__PURE__ */ e.jsxDEV(n, { paddingLeft: 3, marginBottom: 1, borderStyle: "single", borderColor: "green", paddingX: 2, children: /* @__PURE__ */ e.jsxDEV(s, { color: "green", bold: !0, children: d.user_code }, void 0, !1, {
346
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
347
+ lineNumber: 276,
348
+ columnNumber: 19
471
349
  }, void 0) }, void 0, !1, {
472
350
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
473
- lineNumber: 175,
474
- columnNumber: 15
351
+ lineNumber: 275,
352
+ columnNumber: 17
475
353
  }, void 0),
476
- /* @__PURE__ */ e.jsxDEV(s, { borderStyle: "round", borderColor: "gray", padding: 1, marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", children: [
477
- /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: [
478
- "⏱️ Expires in: ",
479
- Math.floor(a.expires_in / 60),
480
- " minutes"
354
+ /* @__PURE__ */ e.jsxDEV(s, { children: [
355
+ /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "cyan", children: [
356
+ "3.",
357
+ " "
481
358
  ] }, void 0, !0, {
482
359
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
483
- lineNumber: 230,
360
+ lineNumber: 282,
484
361
  columnNumber: 19
485
362
  }, void 0),
486
- /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: "💡 Tip: The URL includes your verification code for convenience" }, void 0, !1, {
363
+ /* @__PURE__ */ e.jsxDEV(s, { children: "Sign in and approve the device" }, void 0, !1, {
487
364
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
488
- lineNumber: 231,
365
+ lineNumber: 285,
489
366
  columnNumber: 19
490
367
  }, void 0)
491
368
  ] }, void 0, !0, {
492
369
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
493
- lineNumber: 229,
370
+ lineNumber: 281,
494
371
  columnNumber: 17
495
- }, void 0) }, void 0, !1, {
372
+ }, void 0),
373
+ /* @__PURE__ */ e.jsxDEV(a, {}, void 0, !1, {
496
374
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
497
- lineNumber: 228,
498
- columnNumber: 15
375
+ lineNumber: 287,
376
+ columnNumber: 17
377
+ }, void 0),
378
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "The CLI will automatically detect when you approve the device." }, void 0, !1, {
379
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
380
+ lineNumber: 289,
381
+ columnNumber: 17
499
382
  }, void 0)
500
383
  ] }, void 0, !0, {
501
384
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
502
- lineNumber: 151,
503
- columnNumber: 13
385
+ lineNumber: 249,
386
+ columnNumber: 15
504
387
  }, void 0) }, void 0, !1, {
505
388
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
506
- lineNumber: 149,
507
- columnNumber: 9
389
+ lineNumber: 248,
390
+ columnNumber: 13
508
391
  }, void 0),
509
- d && /* @__PURE__ */ e.jsxDEV(s, { borderStyle: "round", borderColor: "cyan", padding: 1, children: /* @__PURE__ */ e.jsxDEV(
510
- ee,
511
- {
512
- onSubmit: (f) => v.mutate(f),
513
- onCancel: () => m(!1)
514
- },
515
- void 0,
516
- !1,
517
- {
518
- fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
519
- lineNumber: 240,
520
- columnNumber: 13
521
- },
522
- void 0
523
- ) }, void 0, !1, {
392
+ /* @__PURE__ */ e.jsxDEV(n, { borderStyle: "round", borderColor: "gray", padding: 1, marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", children: [
393
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: [
394
+ "⏱️ Expires in: ",
395
+ Math.floor(d.expires_in / 60),
396
+ " minutes"
397
+ ] }, void 0, !0, {
398
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
399
+ lineNumber: 295,
400
+ columnNumber: 17
401
+ }, void 0),
402
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "💡 Tip: The URL includes your verification code for convenience" }, void 0, !1, {
403
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
404
+ lineNumber: 296,
405
+ columnNumber: 17
406
+ }, void 0)
407
+ ] }, void 0, !0, {
524
408
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
525
- lineNumber: 239,
526
- columnNumber: 11
409
+ lineNumber: 294,
410
+ columnNumber: 15
411
+ }, void 0) }, void 0, !1, {
412
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
413
+ lineNumber: 293,
414
+ columnNumber: 13
527
415
  }, void 0)
528
416
  ] }, void 0, !0, {
529
417
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
530
- lineNumber: 148,
418
+ lineNumber: 224,
419
+ columnNumber: 11
420
+ }, void 0) }, void 0, !1, {
421
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
422
+ lineNumber: 222,
531
423
  columnNumber: 7
532
424
  }, void 0);
533
425
  }
534
- if (v.isPending)
535
- return /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", padding: 1, children: [
536
- /* @__PURE__ */ e.jsxDEV(s, { marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "cyan", children: "🔐 Agiflow Authentication" }, void 0, !1, {
426
+ if (f === "selecting_org")
427
+ return /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", padding: 1, children: [
428
+ /* @__PURE__ */ e.jsxDEV(n, { marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "cyan", children: "🔐 Agiflow Authentication" }, void 0, !1, {
537
429
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
538
- lineNumber: 255,
430
+ lineNumber: 310,
539
431
  columnNumber: 11
540
432
  }, void 0) }, void 0, !1, {
541
433
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
542
- lineNumber: 254,
434
+ lineNumber: 309,
543
435
  columnNumber: 9
544
436
  }, void 0),
545
- /* @__PURE__ */ e.jsxDEV(s, { borderStyle: "round", borderColor: "cyan", padding: 1, children: /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", children: /* @__PURE__ */ e.jsxDEV(n, { children: [
546
- /* @__PURE__ */ e.jsxDEV(n, { color: "cyan", children: "◉ " }, void 0, !1, {
437
+ /* @__PURE__ */ e.jsxDEV(n, { borderStyle: "round", borderColor: "green", padding: 1, marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", children: [
438
+ /* @__PURE__ */ e.jsxDEV(s, { children: [
439
+ /* @__PURE__ */ e.jsxDEV(s, { color: "green", children: "✓ " }, void 0, !1, {
440
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
441
+ lineNumber: 318,
442
+ columnNumber: 15
443
+ }, void 0),
444
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "Device authorized successfully" }, void 0, !1, {
445
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
446
+ lineNumber: 319,
447
+ columnNumber: 15
448
+ }, void 0)
449
+ ] }, void 0, !0, {
547
450
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
548
- lineNumber: 262,
549
- columnNumber: 15
451
+ lineNumber: 317,
452
+ columnNumber: 13
550
453
  }, void 0),
551
- /* @__PURE__ */ e.jsxDEV(n, { children: "Verifying token..." }, void 0, !1, {
454
+ /* @__PURE__ */ e.jsxDEV(s, { children: [
455
+ /* @__PURE__ */ e.jsxDEV(s, { color: "cyan", children: "◉ " }, void 0, !1, {
456
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
457
+ lineNumber: 322,
458
+ columnNumber: 15
459
+ }, void 0),
460
+ /* @__PURE__ */ e.jsxDEV(s, { bold: !0, children: "Select an organization" }, void 0, !1, {
461
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
462
+ lineNumber: 323,
463
+ columnNumber: 15
464
+ }, void 0)
465
+ ] }, void 0, !0, {
552
466
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
553
- lineNumber: 263,
467
+ lineNumber: 321,
468
+ columnNumber: 13
469
+ }, void 0)
470
+ ] }, void 0, !0, {
471
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
472
+ lineNumber: 316,
473
+ columnNumber: 11
474
+ }, void 0) }, void 0, !1, {
475
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
476
+ lineNumber: 315,
477
+ columnNumber: 9
478
+ }, void 0),
479
+ /* @__PURE__ */ e.jsxDEV(n, { borderStyle: "double", borderColor: "yellow", padding: 1, marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", children: [
480
+ /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "yellow", children: "📋 Select Organization:" }, void 0, !1, {
481
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
482
+ lineNumber: 330,
483
+ columnNumber: 13
484
+ }, void 0),
485
+ /* @__PURE__ */ e.jsxDEV(a, {}, void 0, !1, {
486
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
487
+ lineNumber: 333,
488
+ columnNumber: 13
489
+ }, void 0),
490
+ x.map((o, t) => /* @__PURE__ */ e.jsxDEV(s, { children: [
491
+ /* @__PURE__ */ e.jsxDEV(s, { color: t === N ? "green" : "gray", children: t === N ? "❯ " : " " }, void 0, !1, {
492
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
493
+ lineNumber: 336,
494
+ columnNumber: 17
495
+ }, void 0),
496
+ /* @__PURE__ */ e.jsxDEV(s, { bold: t === N, children: o.name }, void 0, !1, {
497
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
498
+ lineNumber: 339,
499
+ columnNumber: 17
500
+ }, void 0),
501
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: [
502
+ " (",
503
+ o.slug,
504
+ ")"
505
+ ] }, void 0, !0, {
506
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
507
+ lineNumber: 340,
508
+ columnNumber: 17
509
+ }, void 0)
510
+ ] }, o.id, !0, {
511
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
512
+ lineNumber: 335,
554
513
  columnNumber: 15
514
+ }, void 0)),
515
+ /* @__PURE__ */ e.jsxDEV(a, {}, void 0, !1, {
516
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
517
+ lineNumber: 343,
518
+ columnNumber: 13
519
+ }, void 0),
520
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "Use ↑/↓ arrows to navigate, Enter to select" }, void 0, !1, {
521
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
522
+ lineNumber: 344,
523
+ columnNumber: 13
555
524
  }, void 0)
556
525
  ] }, void 0, !0, {
557
526
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
558
- lineNumber: 261,
559
- columnNumber: 13
527
+ lineNumber: 329,
528
+ columnNumber: 11
560
529
  }, void 0) }, void 0, !1, {
561
530
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
562
- lineNumber: 260,
531
+ lineNumber: 328,
532
+ columnNumber: 9
533
+ }, void 0)
534
+ ] }, void 0, !0, {
535
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
536
+ lineNumber: 308,
537
+ columnNumber: 7
538
+ }, void 0);
539
+ if (f === "exchanging")
540
+ return /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", padding: 1, children: [
541
+ /* @__PURE__ */ e.jsxDEV(n, { marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "cyan", children: "🔐 Agiflow Authentication" }, void 0, !1, {
542
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
543
+ lineNumber: 356,
563
544
  columnNumber: 11
564
545
  }, void 0) }, void 0, !1, {
565
546
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
566
- lineNumber: 259,
547
+ lineNumber: 355,
548
+ columnNumber: 9
549
+ }, void 0),
550
+ /* @__PURE__ */ e.jsxDEV(n, { borderStyle: "round", borderColor: "cyan", padding: 1, children: /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", children: [
551
+ /* @__PURE__ */ e.jsxDEV(s, { children: [
552
+ /* @__PURE__ */ e.jsxDEV(s, { color: "green", children: "✓ " }, void 0, !1, {
553
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
554
+ lineNumber: 363,
555
+ columnNumber: 15
556
+ }, void 0),
557
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "Device authorized" }, void 0, !1, {
558
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
559
+ lineNumber: 364,
560
+ columnNumber: 15
561
+ }, void 0)
562
+ ] }, void 0, !0, {
563
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
564
+ lineNumber: 362,
565
+ columnNumber: 13
566
+ }, void 0),
567
+ /* @__PURE__ */ e.jsxDEV(s, { children: [
568
+ /* @__PURE__ */ e.jsxDEV(s, { color: "green", children: "✓ " }, void 0, !1, {
569
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
570
+ lineNumber: 367,
571
+ columnNumber: 15
572
+ }, void 0),
573
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "Organization selected" }, void 0, !1, {
574
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
575
+ lineNumber: 368,
576
+ columnNumber: 15
577
+ }, void 0)
578
+ ] }, void 0, !0, {
579
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
580
+ lineNumber: 366,
581
+ columnNumber: 13
582
+ }, void 0),
583
+ /* @__PURE__ */ e.jsxDEV(s, { children: [
584
+ /* @__PURE__ */ e.jsxDEV(s, { color: "cyan", children: "◉ " }, void 0, !1, {
585
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
586
+ lineNumber: 371,
587
+ columnNumber: 15
588
+ }, void 0),
589
+ /* @__PURE__ */ e.jsxDEV(s, { children: "Creating agent credentials..." }, void 0, !1, {
590
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
591
+ lineNumber: 372,
592
+ columnNumber: 15
593
+ }, void 0)
594
+ ] }, void 0, !0, {
595
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
596
+ lineNumber: 370,
597
+ columnNumber: 13
598
+ }, void 0)
599
+ ] }, void 0, !0, {
600
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
601
+ lineNumber: 361,
602
+ columnNumber: 11
603
+ }, void 0) }, void 0, !1, {
604
+ fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
605
+ lineNumber: 360,
567
606
  columnNumber: 9
568
607
  }, void 0)
569
608
  ] }, void 0, !0, {
570
609
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
571
- lineNumber: 253,
610
+ lineNumber: 354,
572
611
  columnNumber: 7
573
612
  }, void 0);
574
- if (N.isError || v.isError) {
575
- const c = N.error || v.error;
576
- return /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", padding: 1, children: [
577
- /* @__PURE__ */ e.jsxDEV(s, { marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "red", children: "❌ Authentication Error" }, void 0, !1, {
613
+ if (f === "error" || h.isError || S.isError) {
614
+ const o = h.error || S.error, t = R || o?.message || "Unknown error occurred";
615
+ return /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", padding: 1, children: [
616
+ /* @__PURE__ */ e.jsxDEV(n, { marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "red", children: "❌ Authentication Error" }, void 0, !1, {
578
617
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
579
- lineNumber: 277,
618
+ lineNumber: 387,
580
619
  columnNumber: 11
581
620
  }, void 0) }, void 0, !1, {
582
621
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
583
- lineNumber: 276,
622
+ lineNumber: 386,
584
623
  columnNumber: 9
585
624
  }, void 0),
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, {
625
+ /* @__PURE__ */ e.jsxDEV(n, { borderStyle: "round", borderColor: "red", padding: 1, marginBottom: 1, children: /* @__PURE__ */ e.jsxDEV(s, { color: "red", children: t }, void 0, !1, {
587
626
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
588
- lineNumber: 282,
627
+ lineNumber: 392,
589
628
  columnNumber: 11
590
629
  }, void 0) }, void 0, !1, {
591
630
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
592
- lineNumber: 281,
631
+ lineNumber: 391,
593
632
  columnNumber: 9
594
633
  }, void 0),
595
- /* @__PURE__ */ e.jsxDEV(s, { borderStyle: "single", borderColor: "gray", padding: 1, children: /* @__PURE__ */ e.jsxDEV(s, { flexDirection: "column", children: [
596
- /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: "💡 Troubleshooting:" }, void 0, !1, {
634
+ /* @__PURE__ */ e.jsxDEV(n, { borderStyle: "single", borderColor: "gray", padding: 1, children: /* @__PURE__ */ e.jsxDEV(n, { flexDirection: "column", children: [
635
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "💡 Troubleshooting:" }, void 0, !1, {
597
636
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
598
- lineNumber: 286,
637
+ lineNumber: 396,
599
638
  columnNumber: 13
600
639
  }, void 0),
601
- /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: " • Check your internet connection" }, void 0, !1, {
640
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: " • Check your internet connection" }, void 0, !1, {
602
641
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
603
- lineNumber: 287,
642
+ lineNumber: 397,
604
643
  columnNumber: 13
605
644
  }, void 0),
606
- /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: " • Verify the server URL is correct" }, void 0, !1, {
645
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: " • Verify the server URL is correct" }, void 0, !1, {
607
646
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
608
- lineNumber: 288,
647
+ lineNumber: 398,
609
648
  columnNumber: 13
610
649
  }, void 0),
611
- /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: " • Ensure the token is valid and not expired" }, void 0, !1, {
650
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: " • Ensure the token is valid and not expired" }, void 0, !1, {
612
651
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
613
- lineNumber: 289,
652
+ lineNumber: 399,
614
653
  columnNumber: 13
615
654
  }, void 0),
616
- /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: " • Try running the daemon again" }, void 0, !1, {
655
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: " • Try running the daemon again" }, void 0, !1, {
617
656
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
618
- lineNumber: 290,
657
+ lineNumber: 400,
619
658
  columnNumber: 13
620
659
  }, void 0),
621
- /* @__PURE__ */ e.jsxDEV(r, {}, void 0, !1, {
660
+ /* @__PURE__ */ e.jsxDEV(a, {}, void 0, !1, {
622
661
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
623
- lineNumber: 291,
662
+ lineNumber: 401,
624
663
  columnNumber: 13
625
664
  }, void 0),
626
- /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: "⌨️ Press Ctrl+C to exit" }, void 0, !1, {
665
+ /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "⌨️ Press Ctrl+C to exit" }, void 0, !1, {
627
666
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
628
- lineNumber: 292,
667
+ lineNumber: 402,
629
668
  columnNumber: 13
630
669
  }, void 0)
631
670
  ] }, void 0, !0, {
632
671
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
633
- lineNumber: 285,
672
+ lineNumber: 395,
634
673
  columnNumber: 11
635
674
  }, void 0) }, void 0, !1, {
636
675
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
637
- lineNumber: 284,
676
+ lineNumber: 394,
638
677
  columnNumber: 9
639
678
  }, void 0)
640
679
  ] }, void 0, !0, {
641
680
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/guards/OauthSetup.tsx",
642
- lineNumber: 275,
681
+ lineNumber: 385,
643
682
  columnNumber: 7
644
683
  }, void 0);
645
684
  }
646
685
  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: [
686
+ }, pe = process.platform === "darwin", z = T.memo(({ tabId: r }) => {
687
+ const n = c((a) => a.agentTabs.tabs.find((u) => u.id === r)?.unreadCount), s = c((a) => a.agentTabs.activeTabId === r);
688
+ return !n || n <= 0 || s ? null : /* @__PURE__ */ e.jsxDEV(e.Fragment, { children: [
650
689
  " (",
651
- s,
690
+ n,
652
691
  ")"
653
692
  ] }, void 0, !0, {
654
693
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
@@ -656,32 +695,32 @@ const Z = ({ children: o }) => {
656
695
  columnNumber: 10
657
696
  }, void 0);
658
697
  });
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, {
698
+ z.displayName = "UnreadCount";
699
+ const _ = T.memo(({ tabId: r }) => {
700
+ const { Text: n } = g(), s = c(
701
+ (u) => u.agentTabs.tabs.find((i) => i.id === r)?.waitingInput
702
+ ), a = c((u) => u.agentTabs.activeTabId === r);
703
+ return !s || a ? null : /* @__PURE__ */ e.jsxDEV(n, { color: "red", children: "● " }, void 0, !1, {
665
704
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
666
705
  lineNumber: 55,
667
706
  columnNumber: 10
668
707
  }, void 0);
669
708
  });
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, {
709
+ _.displayName = "WaitingInputIndicator";
710
+ const F = T.memo(({ tabId: r, index: n }) => {
711
+ const { Box: s, Text: a } = g(), u = c((m) => m.agentTabs.tabs.find((d) => d.id === r)?.label), i = c((m) => m.agentTabs.activeTabId === r), l = `^F${n + 1}`;
712
+ return /* @__PURE__ */ e.jsxDEV(s, { marginRight: 2, borderStyle: i ? "round" : void 0, children: [
713
+ /* @__PURE__ */ e.jsxDEV(_, { tabId: r }, void 0, !1, {
675
714
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
676
715
  lineNumber: 73,
677
716
  columnNumber: 7
678
717
  }, void 0),
679
- /* @__PURE__ */ e.jsxDEV(r, { color: "#d1d5db", bold: i, dimColor: !i, children: [
718
+ /* @__PURE__ */ e.jsxDEV(a, { color: "#d1d5db", bold: i, dimColor: !i, children: [
680
719
  "[",
681
- t,
720
+ l,
682
721
  "] ",
683
722
  u,
684
- /* @__PURE__ */ e.jsxDEV(S, { tabId: o }, void 0, !1, {
723
+ /* @__PURE__ */ e.jsxDEV(z, { tabId: r }, void 0, !1, {
685
724
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
686
725
  lineNumber: 76,
687
726
  columnNumber: 9
@@ -691,7 +730,7 @@ const C = k.memo(({ tabId: o, index: s }) => {
691
730
  lineNumber: 74,
692
731
  columnNumber: 7
693
732
  }, void 0),
694
- /* @__PURE__ */ e.jsxDEV(_, { tabId: o }, void 0, !1, {
733
+ /* @__PURE__ */ e.jsxDEV($, { tabId: r }, void 0, !1, {
695
734
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
696
735
  lineNumber: 78,
697
736
  columnNumber: 7
@@ -702,20 +741,20 @@ const C = k.memo(({ tabId: o, index: s }) => {
702
741
  columnNumber: 5
703
742
  }, void 0);
704
743
  });
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;
744
+ F.displayName = "TabItem";
745
+ const ge = () => {
746
+ const { Box: r, Text: n } = g(), s = c((i) => i.agentTabs.tabs.map((l) => l.id), ue), a = c((i) => i.agentTabs.activeTabId), u = ce(() => {
747
+ if (!a) return null;
709
748
  try {
710
- const t = y.get(w.AgentManager).getAgentContainer(r);
711
- if (t)
712
- return t.get(P.AgentConfigService).getEffectiveWorkingDir();
749
+ const l = k.get(E.AgentManager).getAgentContainer(a);
750
+ if (l)
751
+ return l.get(Y.AgentConfigService).getEffectiveWorkingDir();
713
752
  } catch {
714
753
  }
715
754
  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, {
755
+ }, [a]);
756
+ return /* @__PURE__ */ e.jsxDEV(r, { flexDirection: "column", marginTop: 1, children: [
757
+ /* @__PURE__ */ e.jsxDEV(r, { alignItems: "center", borderTop: !0, borderTopColor: "#d1d5db", borderDimColor: !0, children: s.map((i, l) => /* @__PURE__ */ e.jsxDEV(F, { tabId: i, index: l }, i, !1, {
719
758
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
720
759
  lineNumber: 114,
721
760
  columnNumber: 11
@@ -724,12 +763,12 @@ const oe = () => {
724
763
  lineNumber: 112,
725
764
  columnNumber: 7
726
765
  }, void 0),
727
- u && /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: u }, void 0, !1, {
766
+ u && /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: u }, void 0, !1, {
728
767
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
729
768
  lineNumber: 117,
730
769
  columnNumber: 28
731
770
  }, void 0),
732
- se && /* @__PURE__ */ e.jsxDEV(s, { dimColor: !0, children: "Press fn + Shift + F[num] to switch tabs" }, void 0, !1, {
771
+ pe && /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: "Press fn + Shift + F[num] to switch tabs" }, void 0, !1, {
733
772
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/components/AgentTabs.tsx",
734
773
  lineNumber: 118,
735
774
  columnNumber: 19
@@ -739,10 +778,10 @@ const oe = () => {
739
778
  lineNumber: 111,
740
779
  columnNumber: 5
741
780
  }, void 0);
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, {
781
+ }, fe = () => {
782
+ const { Box: r } = g(), n = c((s) => s.agentTabs.activeTabId);
783
+ return /* @__PURE__ */ e.jsxDEV(r, { flexDirection: "column", flexGrow: 1, children: [
784
+ /* @__PURE__ */ e.jsxDEV(X, { children: /* @__PURE__ */ e.jsxDEV(H, {}, n, !1, {
746
785
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/screens/Agents/index.tsx",
747
786
  lineNumber: 19,
748
787
  columnNumber: 9
@@ -751,7 +790,7 @@ const oe = () => {
751
790
  lineNumber: 18,
752
791
  columnNumber: 7
753
792
  }, void 0),
754
- /* @__PURE__ */ e.jsxDEV(R, { children: /* @__PURE__ */ e.jsxDEV(oe, {}, void 0, !1, {
793
+ /* @__PURE__ */ e.jsxDEV(J, { children: /* @__PURE__ */ e.jsxDEV(ge, {}, void 0, !1, {
755
794
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/screens/Agents/index.tsx",
756
795
  lineNumber: 22,
757
796
  columnNumber: 9
@@ -760,7 +799,7 @@ const oe = () => {
760
799
  lineNumber: 21,
761
800
  columnNumber: 7
762
801
  }, void 0),
763
- /* @__PURE__ */ e.jsxDEV(q, {}, void 0, !1, {
802
+ /* @__PURE__ */ e.jsxDEV(Z, {}, void 0, !1, {
764
803
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/screens/Agents/index.tsx",
765
804
  lineNumber: 24,
766
805
  columnNumber: 7
@@ -770,15 +809,15 @@ const oe = () => {
770
809
  lineNumber: 17,
771
810
  columnNumber: 5
772
811
  }, void 0);
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: [
776
- /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "green", children: "Welcome to Agent CLI Daemon!" }, void 0, !1, {
812
+ }, Ne = () => {
813
+ const { Box: r, Text: n } = g();
814
+ return /* @__PURE__ */ e.jsxDEV(r, { flexDirection: "column", borderStyle: "round", borderColor: "green", padding: 1, flexGrow: 1, children: [
815
+ /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "green", children: "Welcome to Agent CLI Daemon!" }, void 0, !1, {
777
816
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/screens/Onboarding/index.tsx",
778
817
  lineNumber: 9,
779
818
  columnNumber: 7
780
819
  }, void 0),
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, {
820
+ /* @__PURE__ */ e.jsxDEV(r, { marginTop: 1, children: /* @__PURE__ */ e.jsxDEV(n, { children: "It looks like you don't have any active agent sessions." }, void 0, !1, {
782
821
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/screens/Onboarding/index.tsx",
783
822
  lineNumber: 13,
784
823
  columnNumber: 9
@@ -787,24 +826,24 @@ const oe = () => {
787
826
  lineNumber: 12,
788
827
  columnNumber: 7
789
828
  }, void 0),
790
- /* @__PURE__ */ e.jsxDEV(o, { marginTop: 1, children: /* @__PURE__ */ e.jsxDEV(s, { children: [
829
+ /* @__PURE__ */ e.jsxDEV(r, { marginTop: 1, children: /* @__PURE__ */ e.jsxDEV(n, { children: [
791
830
  "Please use the Agiflow UI Dashboard to start a",
792
831
  " ",
793
- /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "blue", children: "Project Plan" }, void 0, !1, {
832
+ /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "blue", children: "Project Plan" }, void 0, !1, {
794
833
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/screens/Onboarding/index.tsx",
795
834
  lineNumber: 18,
796
835
  columnNumber: 11
797
836
  }, void 0),
798
837
  ",",
799
838
  " ",
800
- /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "blue", children: "Work Unit" }, void 0, !1, {
839
+ /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "blue", children: "Work Unit" }, void 0, !1, {
801
840
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/screens/Onboarding/index.tsx",
802
841
  lineNumber: 22,
803
842
  columnNumber: 11
804
843
  }, void 0),
805
844
  ", or",
806
845
  " ",
807
- /* @__PURE__ */ e.jsxDEV(s, { bold: !0, color: "blue", children: "Task Chat" }, void 0, !1, {
846
+ /* @__PURE__ */ e.jsxDEV(n, { bold: !0, color: "blue", children: "Task Chat" }, void 0, !1, {
808
847
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/screens/Onboarding/index.tsx",
809
848
  lineNumber: 26,
810
849
  columnNumber: 11
@@ -820,7 +859,7 @@ const oe = () => {
820
859
  lineNumber: 15,
821
860
  columnNumber: 7
822
861
  }, void 0),
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, {
862
+ /* @__PURE__ */ e.jsxDEV(r, { marginTop: 1, children: /* @__PURE__ */ e.jsxDEV(n, { dimColor: !0, children: "The Agiflow UI Dashboard can be accessed in your browser." }, void 0, !1, {
824
863
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/screens/Onboarding/index.tsx",
825
864
  lineNumber: 33,
826
865
  columnNumber: 9
@@ -834,7 +873,7 @@ const oe = () => {
834
873
  lineNumber: 8,
835
874
  columnNumber: 5
836
875
  }, void 0);
837
- }, ie = new Q({
876
+ }, be = new ae({
838
877
  defaultOptions: {
839
878
  queries: {
840
879
  retry: !1,
@@ -845,13 +884,13 @@ const oe = () => {
845
884
  // Consider data stale after 30 seconds
846
885
  }
847
886
  }
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, {
887
+ }), xe = () => {
888
+ const { Box: r } = g(), s = c((a) => a.agentTabs.tabs).length > 0;
889
+ return /* @__PURE__ */ e.jsxDEV(de, { children: ({ isAuthenticated: a }) => /* @__PURE__ */ e.jsxDEV(me, { children: /* @__PURE__ */ e.jsxDEV(r, { flexGrow: 1, flexDirection: "column", children: a && !s ? /* @__PURE__ */ e.jsxDEV(Ne, {}, void 0, !1, {
851
890
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/index.tsx",
852
891
  lineNumber: 35,
853
892
  columnNumber: 49
854
- }, void 0) : /* @__PURE__ */ e.jsxDEV(re, {}, void 0, !1, {
893
+ }, void 0) : /* @__PURE__ */ e.jsxDEV(fe, {}, void 0, !1, {
855
894
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/index.tsx",
856
895
  lineNumber: 35,
857
896
  columnNumber: 66
@@ -868,7 +907,7 @@ const oe = () => {
868
907
  lineNumber: 31,
869
908
  columnNumber: 5
870
909
  }, void 0);
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, {
910
+ }, ve = () => /* @__PURE__ */ e.jsxDEV(ee, { children: /* @__PURE__ */ e.jsxDEV(te, { store: se, children: /* @__PURE__ */ e.jsxDEV(re, { client: be, children: /* @__PURE__ */ e.jsxDEV(xe, {}, void 0, !1, {
872
911
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/index.tsx",
873
912
  lineNumber: 48,
874
913
  columnNumber: 11
@@ -884,8 +923,8 @@ const oe = () => {
884
923
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/index.tsx",
885
924
  lineNumber: 45,
886
925
  columnNumber: 5
887
- }, void 0), de = async () => {
888
- const { render: o } = await import("ink"), { waitUntilExit: s } = o(/* @__PURE__ */ e.jsxDEV(te, {}, void 0, !1, {
926
+ }, void 0), ke = async () => {
927
+ const { render: r } = await import("ink"), { waitUntilExit: n } = r(/* @__PURE__ */ e.jsxDEV(ve, {}, void 0, !1, {
889
928
  fileName: "/Users/vuongngo/workspace/monorepo/apps/agent-cli/src/systems/cli/apps/daemon/index.tsx",
890
929
  lineNumber: 59,
891
930
  columnNumber: 36
@@ -894,9 +933,9 @@ const oe = () => {
894
933
  stdout: process.stdout,
895
934
  stderr: process.stderr
896
935
  });
897
- return s();
936
+ return n();
898
937
  };
899
938
  export {
900
- de as startDaemonApp
939
+ ke as startDaemonApp
901
940
  };
902
941
  //# sourceMappingURL=daemon.js.map