@agiflowai/agent-cli 0.2.25 → 0.2.28

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,20 +1,20 @@
1
1
  import { jsx as e, jsxs as i, Fragment as F } from "react/jsx-runtime";
2
- import { bk as f, bl as Y, bm as A, bn as D, bo as $, bp as X, bq as H, br as J, bs as Z, bt as ee, bu as re, bv as ne, bw as oe, bx as ie } from "./index-DTMl_vl1.mjs";
2
+ import { bn as f, bo as Y, bp as S, bq as D, br as $, bs as X, bt as H, bu as J, bv as Z, bw as ee, bx as re, by as ne, bz as oe, bA as ie } from "./index-2jHcytGJ.mjs";
3
3
  import { useQueryClient as U, useQuery as te, useMutation as q, QueryClientProvider as ce, QueryClient as le } from "@tanstack/react-query";
4
4
  import { useDispatch as de, useSelector as h, shallowEqual as ae, Provider as se } from "react-redux";
5
- import P, { useRef as R, useEffect as B, useState as y, useCallback as ue, useMemo as he } from "react";
5
+ import P, { useRef as R, useEffect as z, useState as C, useCallback as ue, useMemo as he } from "react";
6
6
  const ge = ({ children: t }) => {
7
7
  const { Box: n, Text: r } = f(), c = de(), d = U(), l = h((s) => s.daemonStatus.status), u = h((s) => s.daemonStatus.error), g = R(!1);
8
- return B(() => {
8
+ return z(() => {
9
9
  l === "error" && (async () => {
10
- const p = await A.get(D.CredentialsService).load();
10
+ const p = await S.get(D.CredentialsService).load();
11
11
  (!p || !p.apiKey) && d.invalidateQueries({ queryKey: ["auth", "check"] });
12
12
  })();
13
- }, [l, d]), B(() => (c(Y()), $(async () => {
13
+ }, [l, d]), z(() => (c(Y()), $(async () => {
14
14
  if (!g.current) {
15
15
  g.current = !0;
16
16
  try {
17
- const x = A.get(D.DaemonManager);
17
+ const x = S.get(D.DaemonManager);
18
18
  x.isRunning() && await x.stop();
19
19
  } catch {
20
20
  }
@@ -27,7 +27,7 @@ const ge = ({ children: t }) => {
27
27
  /* @__PURE__ */ e(r, { dimColor: !0, children: "Retrying in background..." })
28
28
  ] }) : l === "connected" ? /* @__PURE__ */ e(F, { children: t }) : null;
29
29
  }, me = ({ children: t }) => {
30
- const { Box: n, Text: r, Newline: c, Static: d, Link: l, useInput: u } = f(), g = U(), [s, x] = y(null), [p, Q] = y(null), [v, N] = y([]), [C, O] = y(0), [b, m] = y("checking"), [j, k] = y(""), E = R(null), T = A.get(D.DeviceCodeAuthService), L = A.get(D.CredentialsService), { data: I, isLoading: z } = te({
30
+ const { Box: n, Text: r, Newline: c, Static: d, Link: l, useInput: u } = f(), g = U(), [s, x] = C(null), [p, Q] = C(null), [v, N] = C([]), [y, O] = C(0), [b, m] = C("checking"), [j, k] = C(""), B = R(null), T = S.get(D.DeviceCodeAuthService), L = S.get(D.CredentialsService), { data: I, isLoading: E } = te({
31
31
  queryKey: ["auth", "check"],
32
32
  queryFn: async () => {
33
33
  const o = await L.load();
@@ -44,11 +44,11 @@ const ge = ({ children: t }) => {
44
44
  }
45
45
  }), M = q({
46
46
  mutationFn: async (o) => {
47
- E.current = new AbortController();
47
+ B.current = new AbortController();
48
48
  const a = await T.pollForToken(o.device_code, o.interval || 5, {
49
- signal: E.current.signal
50
- }), S = await T.listOrganizations(a.access_token);
51
- return { accessToken: a.access_token, organizations: S };
49
+ signal: B.current.signal
50
+ }), A = await T.listOrganizations(a.access_token);
51
+ return { accessToken: a.access_token, organizations: A };
52
52
  },
53
53
  onSuccess: (o) => {
54
54
  Q(o.accessToken), N(o.organizations), o.organizations.length === 0 ? (m("error"), k("You have no organizations. Please create one first.")) : o.organizations.length === 1 ? _.mutate({ accessToken: o.accessToken, organizationId: o.organizations[0].id }) : m("selecting_org");
@@ -70,23 +70,23 @@ const ge = ({ children: t }) => {
70
70
  m("error"), k(o instanceof Error ? o.message : "Failed to exchange for agent API key");
71
71
  }
72
72
  }), V = ue(() => {
73
- p && v[C] && _.mutate({
73
+ p && v[y] && _.mutate({
74
74
  accessToken: p,
75
- organizationId: v[C].id
75
+ organizationId: v[y].id
76
76
  });
77
- }, [p, v, C, _]);
77
+ }, [p, v, y, _]);
78
78
  if (u(
79
79
  (o, a) => {
80
- b === "selecting_org" && (a.upArrow ? O((S) => Math.max(0, S - 1)) : a.downArrow ? O((S) => Math.min(v.length - 1, S + 1)) : a.return && V());
80
+ b === "selecting_org" && (a.upArrow ? O((A) => Math.max(0, A - 1)) : a.downArrow ? O((A) => Math.min(v.length - 1, A + 1)) : a.return && V());
81
81
  },
82
82
  { isActive: b === "selecting_org" }
83
- ), B(() => () => {
84
- E.current?.abort();
85
- }, []), B(() => {
86
- I && !I.authenticated && b === "checking" && !z && w.mutate();
87
- }, [I, b, z, w]), I?.authenticated)
83
+ ), z(() => () => {
84
+ B.current?.abort();
85
+ }, []), z(() => {
86
+ I && !I.authenticated && b === "checking" && !E && w.mutate();
87
+ }, [I, b, E, w]), I?.authenticated)
88
88
  return /* @__PURE__ */ e(F, { children: t({ isAuthenticated: !0 }) });
89
- if (z)
89
+ if (E)
90
90
  return /* @__PURE__ */ i(n, { flexDirection: "column", padding: 1, children: [
91
91
  /* @__PURE__ */ e(n, { marginBottom: 1, children: /* @__PURE__ */ e(r, { bold: !0, color: "cyan", children: "🔐 Agiflow Authentication" }) }),
92
92
  /* @__PURE__ */ e(n, { borderStyle: "round", borderColor: "cyan", padding: 1, children: /* @__PURE__ */ e(n, { flexDirection: "column", children: /* @__PURE__ */ i(r, { children: [
@@ -182,8 +182,8 @@ const ge = ({ children: t }) => {
182
182
  /* @__PURE__ */ e(r, { bold: !0, color: "yellow", children: "📋 Select Organization:" }),
183
183
  /* @__PURE__ */ e(c, {}),
184
184
  v.map((o, a) => /* @__PURE__ */ i(r, { children: [
185
- /* @__PURE__ */ e(r, { color: a === C ? "green" : "gray", children: a === C ? "❯ " : " " }),
186
- /* @__PURE__ */ e(r, { bold: a === C, children: o.name }),
185
+ /* @__PURE__ */ e(r, { color: a === y ? "green" : "gray", children: a === y ? "❯ " : " " }),
186
+ /* @__PURE__ */ e(r, { bold: a === y, children: o.name }),
187
187
  /* @__PURE__ */ i(r, { dimColor: !0, children: [
188
188
  " (",
189
189
  o.slug,
@@ -264,7 +264,7 @@ const fe = () => {
264
264
  const { Box: t, Text: n } = f(), r = h((l) => l.agentTabs.tabs.map((u) => u.id), ae), c = h((l) => l.agentTabs.activeTabId), d = he(() => {
265
265
  if (!c) return null;
266
266
  try {
267
- const u = A.get(D.AgentManager).getAgentContainer(c);
267
+ const u = S.get(D.AgentManager).getAgentContainer(c);
268
268
  if (u)
269
269
  return u.get(H.AgentConfigService).getEffectiveWorkingDir();
270
270
  } catch {
@@ -283,7 +283,7 @@ const fe = () => {
283
283
  /* @__PURE__ */ e(re, { children: /* @__PURE__ */ e(fe, {}) }),
284
284
  /* @__PURE__ */ e(ne, {})
285
285
  ] });
286
- }, Ce = () => {
286
+ }, ye = () => {
287
287
  const { Box: t, Text: n } = f();
288
288
  return /* @__PURE__ */ i(t, { flexDirection: "column", borderStyle: "round", borderColor: "green", padding: 1, flexGrow: 1, children: [
289
289
  /* @__PURE__ */ e(n, { bold: !0, color: "green", children: "Welcome to Agent CLI Daemon!" }),
@@ -303,7 +303,7 @@ const fe = () => {
303
303
  ] }) }),
304
304
  /* @__PURE__ */ e(t, { marginTop: 1, children: /* @__PURE__ */ e(n, { dimColor: !0, children: "The Agiflow UI Dashboard can be accessed in your browser." }) })
305
305
  ] });
306
- }, ye = new le({
306
+ }, Ce = new le({
307
307
  defaultOptions: {
308
308
  queries: {
309
309
  retry: !1,
@@ -316,8 +316,8 @@ const fe = () => {
316
316
  }
317
317
  }), xe = () => {
318
318
  const { Box: t } = f(), r = h((c) => c.agentTabs.tabs).length > 0;
319
- return /* @__PURE__ */ e(me, { children: ({ isAuthenticated: c }) => /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(t, { flexGrow: 1, flexDirection: "column", children: c && !r ? /* @__PURE__ */ e(Ce, {}) : /* @__PURE__ */ e(pe, {}) }) }) });
320
- }, ve = () => /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ e(se, { store: ie, children: /* @__PURE__ */ e(ce, { client: ye, children: /* @__PURE__ */ e(xe, {}) }) }) }), ke = async () => {
319
+ return /* @__PURE__ */ e(me, { children: ({ isAuthenticated: c }) => /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(t, { flexGrow: 1, flexDirection: "column", children: c && !r ? /* @__PURE__ */ e(ye, {}) : /* @__PURE__ */ e(pe, {}) }) }) });
320
+ }, ve = () => /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ e(se, { store: ie, children: /* @__PURE__ */ e(ce, { client: Ce, children: /* @__PURE__ */ e(xe, {}) }) }) }), ke = async () => {
321
321
  const { render: t } = await import("ink"), { waitUntilExit: n } = t(/* @__PURE__ */ e(ve, {}), {
322
322
  stdin: process.stdin,
323
323
  stdout: process.stdout,