@burdenoff/microfe-subscriberbot 2026.706.2 → 2026.710.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/dist/generated/global-operations.d.ts +2 -0
  2. package/dist/generated/global-operations.d.ts.map +1 -0
  3. package/dist/generated/global-types.d.ts +23527 -0
  4. package/dist/generated/global-types.d.ts.map +1 -0
  5. package/dist/generated/wspace-operations.d.ts +2 -0
  6. package/dist/generated/wspace-operations.d.ts.map +1 -0
  7. package/dist/generated/wspace-types.d.ts +57851 -0
  8. package/dist/generated/wspace-types.d.ts.map +1 -0
  9. package/dist/index.d.ts +6 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +2 -1
  12. package/dist/subscriberbot/SubscriberBotRoot.d.ts +5 -0
  13. package/dist/subscriberbot/SubscriberBotRoot.d.ts.map +1 -0
  14. package/dist/subscriberbot/SubscriberBotRoot.js +56 -40
  15. package/dist/subscriberbot/SubscriberBotRoot.js.map +1 -1
  16. package/dist/subscriberbot/SubscriberBotRoutes.d.ts +4 -0
  17. package/dist/subscriberbot/SubscriberBotRoutes.d.ts.map +1 -0
  18. package/dist/subscriberbot/SubscriberBotRoutes.js +14 -6
  19. package/dist/subscriberbot/SubscriberBotRoutes.js.map +1 -1
  20. package/dist/subscriberbot/components/EmptyState.d.ts +18 -0
  21. package/dist/subscriberbot/components/EmptyState.d.ts.map +1 -0
  22. package/dist/subscriberbot/components/MetricsCard.d.ts +16 -0
  23. package/dist/subscriberbot/components/MetricsCard.d.ts.map +1 -0
  24. package/dist/subscriberbot/components/Modal.d.ts +13 -0
  25. package/dist/subscriberbot/components/Modal.d.ts.map +1 -0
  26. package/dist/subscriberbot/components/PageLayout.d.ts +23 -0
  27. package/dist/subscriberbot/components/PageLayout.d.ts.map +1 -0
  28. package/dist/subscriberbot/components/StateViews.d.ts +24 -0
  29. package/dist/subscriberbot/components/StateViews.d.ts.map +1 -0
  30. package/dist/subscriberbot/components/StatusBadge.d.ts +9 -0
  31. package/dist/subscriberbot/components/StatusBadge.d.ts.map +1 -0
  32. package/dist/subscriberbot/components/index.d.ts +13 -0
  33. package/dist/subscriberbot/components/index.d.ts.map +1 -0
  34. package/dist/subscriberbot/components/index.js +7 -0
  35. package/dist/subscriberbot/components/viz.d.ts +58 -0
  36. package/dist/subscriberbot/components/viz.d.ts.map +1 -0
  37. package/dist/subscriberbot/components/viz.js +196 -0
  38. package/dist/subscriberbot/components/viz.js.map +1 -0
  39. package/dist/subscriberbot/config/assistantUsecases.d.ts +13 -0
  40. package/dist/subscriberbot/config/assistantUsecases.d.ts.map +1 -0
  41. package/dist/subscriberbot/context/SubscriberBotContext.d.ts +16 -0
  42. package/dist/subscriberbot/context/SubscriberBotContext.d.ts.map +1 -0
  43. package/dist/subscriberbot/context/index.d.ts +6 -0
  44. package/dist/subscriberbot/context/index.d.ts.map +1 -0
  45. package/dist/subscriberbot/hooks/index.d.ts +7 -0
  46. package/dist/subscriberbot/hooks/index.d.ts.map +1 -0
  47. package/dist/subscriberbot/hooks/useSubscriberBotApi.d.ts +105 -0
  48. package/dist/subscriberbot/hooks/useSubscriberBotApi.d.ts.map +1 -0
  49. package/dist/subscriberbot/hooks/useSubscriberBotApi.js +38 -30
  50. package/dist/subscriberbot/hooks/useSubscriberBotApi.js.map +1 -1
  51. package/dist/subscriberbot/index.d.ts +12 -0
  52. package/dist/subscriberbot/index.d.ts.map +1 -0
  53. package/dist/subscriberbot/index.js +1 -0
  54. package/dist/subscriberbot/pages/AssetVaultPage.d.ts +4 -0
  55. package/dist/subscriberbot/pages/AssetVaultPage.d.ts.map +1 -0
  56. package/dist/subscriberbot/pages/AssetVaultPage.js +182 -0
  57. package/dist/subscriberbot/pages/AssetVaultPage.js.map +1 -0
  58. package/dist/subscriberbot/pages/DashboardPage.d.ts +12 -0
  59. package/dist/subscriberbot/pages/DashboardPage.d.ts.map +1 -0
  60. package/dist/subscriberbot/pages/DashboardPage.js +272 -199
  61. package/dist/subscriberbot/pages/DashboardPage.js.map +1 -1
  62. package/dist/subscriberbot/pages/InboxPage.d.ts +12 -0
  63. package/dist/subscriberbot/pages/InboxPage.d.ts.map +1 -0
  64. package/dist/subscriberbot/pages/InboxPage.js +517 -234
  65. package/dist/subscriberbot/pages/InboxPage.js.map +1 -1
  66. package/dist/subscriberbot/pages/InsightsPage.d.ts +4 -0
  67. package/dist/subscriberbot/pages/InsightsPage.d.ts.map +1 -0
  68. package/dist/subscriberbot/pages/InsightsPage.js +220 -0
  69. package/dist/subscriberbot/pages/InsightsPage.js.map +1 -0
  70. package/dist/subscriberbot/pages/InvoicesPage.d.ts +13 -0
  71. package/dist/subscriberbot/pages/InvoicesPage.d.ts.map +1 -0
  72. package/dist/subscriberbot/pages/InvoicesPage.js +325 -237
  73. package/dist/subscriberbot/pages/InvoicesPage.js.map +1 -1
  74. package/dist/subscriberbot/pages/WorkflowsPage.d.ts +15 -0
  75. package/dist/subscriberbot/pages/WorkflowsPage.d.ts.map +1 -0
  76. package/dist/subscriberbot/pages/WorkflowsPage.js +301 -112
  77. package/dist/subscriberbot/pages/WorkflowsPage.js.map +1 -1
  78. package/dist/subscriberbot/pages/agents/AgentDetailPage.d.ts +11 -0
  79. package/dist/subscriberbot/pages/agents/AgentDetailPage.d.ts.map +1 -0
  80. package/dist/subscriberbot/pages/agents/AgentDetailPage.js +311 -165
  81. package/dist/subscriberbot/pages/agents/AgentDetailPage.js.map +1 -1
  82. package/dist/subscriberbot/pages/agents/AgentNewPage.d.ts +8 -0
  83. package/dist/subscriberbot/pages/agents/AgentNewPage.d.ts.map +1 -0
  84. package/dist/subscriberbot/pages/agents/AgentsListPage.d.ts +11 -0
  85. package/dist/subscriberbot/pages/agents/AgentsListPage.d.ts.map +1 -0
  86. package/dist/subscriberbot/pages/agents/AgentsListPage.js +183 -93
  87. package/dist/subscriberbot/pages/agents/AgentsListPage.js.map +1 -1
  88. package/dist/subscriberbot/pages/providers/ProviderDetailPage.d.ts +10 -0
  89. package/dist/subscriberbot/pages/providers/ProviderDetailPage.d.ts.map +1 -0
  90. package/dist/subscriberbot/pages/providers/ProviderDetailPage.js +426 -293
  91. package/dist/subscriberbot/pages/providers/ProviderDetailPage.js.map +1 -1
  92. package/dist/subscriberbot/pages/providers/ProviderNewPage.d.ts +10 -0
  93. package/dist/subscriberbot/pages/providers/ProviderNewPage.d.ts.map +1 -0
  94. package/dist/subscriberbot/pages/providers/ProviderNewPage.js +217 -153
  95. package/dist/subscriberbot/pages/providers/ProviderNewPage.js.map +1 -1
  96. package/dist/subscriberbot/pages/providers/ProvidersListPage.d.ts +12 -0
  97. package/dist/subscriberbot/pages/providers/ProvidersListPage.d.ts.map +1 -0
  98. package/dist/subscriberbot/pages/providers/ProvidersListPage.js +215 -112
  99. package/dist/subscriberbot/pages/providers/ProvidersListPage.js.map +1 -1
  100. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts +13 -0
  101. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts.map +1 -0
  102. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js +542 -428
  103. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js.map +1 -1
  104. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.d.ts +10 -0
  105. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.d.ts.map +1 -0
  106. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js +242 -192
  107. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js.map +1 -1
  108. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.d.ts +10 -0
  109. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.d.ts.map +1 -0
  110. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js +174 -133
  111. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js.map +1 -1
  112. package/dist/subscriberbot/services/assistantApi.d.ts +66 -0
  113. package/dist/subscriberbot/services/assistantApi.d.ts.map +1 -0
  114. package/dist/subscriberbot/services/assistantApi.js +260 -0
  115. package/dist/subscriberbot/services/assistantApi.js.map +1 -0
  116. package/dist/subscriberbot/services/createSandboxAssistantTransport.d.ts +13 -0
  117. package/dist/subscriberbot/services/createSandboxAssistantTransport.d.ts.map +1 -0
  118. package/dist/subscriberbot/services/createSandboxAssistantTransport.js +120 -0
  119. package/dist/subscriberbot/services/createSandboxAssistantTransport.js.map +1 -0
  120. package/dist/subscriberbot/store/index.d.ts +6 -0
  121. package/dist/subscriberbot/store/index.d.ts.map +1 -0
  122. package/dist/subscriberbot/store/subscriberbotStore.d.ts +60 -0
  123. package/dist/subscriberbot/store/subscriberbotStore.d.ts.map +1 -0
  124. package/dist/subscriberbot/types/assistant.d.ts +57 -0
  125. package/dist/subscriberbot/types/assistant.d.ts.map +1 -0
  126. package/dist/subscriberbot/types/index.d.ts +465 -0
  127. package/dist/subscriberbot/types/index.d.ts.map +1 -0
  128. package/dist/subscriberbot/utils/cn.d.ts +4 -0
  129. package/dist/subscriberbot/utils/cn.d.ts.map +1 -0
  130. package/dist/subscriberbot/utils/formatters.d.ts +53 -0
  131. package/dist/subscriberbot/utils/formatters.d.ts.map +1 -0
  132. package/dist/subscriberbot/utils/index.d.ts +8 -0
  133. package/dist/subscriberbot/utils/index.d.ts.map +1 -0
  134. package/dist/subscriberbot/utils/navigation.d.ts +20 -0
  135. package/dist/subscriberbot/utils/navigation.d.ts.map +1 -0
  136. package/dist/subscriberbot/utils/pageContext.d.ts +21 -0
  137. package/dist/subscriberbot/utils/pageContext.d.ts.map +1 -0
  138. package/dist/subscriberbot/utils/pageContext.js +47 -0
  139. package/dist/subscriberbot/utils/pageContext.js.map +1 -0
  140. package/package.json +5 -1
@@ -1,22 +1,25 @@
1
1
  import { useSubscriberBot as e } from "../../context/SubscriberBotContext.js";
2
2
  import { PageLayout as t } from "../../components/PageLayout.js";
3
- import { formatEnumLabel as n, formatRelativeTime as r } from "../../utils/formatters.js";
4
- import { StatusBadge as i } from "../../components/StatusBadge.js";
5
- import { EmptyState as a } from "../../components/EmptyState.js";
6
- import { ErrorView as o, LoadingView as s, Section as c } from "../../components/StateViews.js";
7
- import { useAgent as l, useCreatePolicy as u, useSetAgentStatus as d } from "../../hooks/useSubscriberBotApi.js";
8
- import { Modal as f } from "../../components/Modal.js";
9
- import { useState as p } from "react";
10
- import { ArrowLeft as m, Bot as h, Plus as g, ShieldCheck as _ } from "lucide-react";
11
- import { useParams as v } from "react-router-dom";
12
- import { jsx as y, jsxs as b } from "react/jsx-runtime";
13
- import { GlassCard as x } from "@burdenoff/fe-libs/ui";
3
+ import { MetricsCard as n } from "../../components/MetricsCard.js";
4
+ import { formatEnumLabel as r, formatRelativeTime as i } from "../../utils/formatters.js";
5
+ import { StatusBadge as a } from "../../components/StatusBadge.js";
6
+ import { EmptyState as o } from "../../components/EmptyState.js";
7
+ import { Modal as s } from "../../components/Modal.js";
8
+ import { ErrorView as c, LoadingView as l, Section as u } from "../../components/StateViews.js";
9
+ import { Timeline as d } from "../../components/viz.js";
10
+ import "../../components/index.js";
11
+ import { useAgent as f, useCreatePolicy as p, useSetAgentStatus as m } from "../../hooks/useSubscriberBotApi.js";
12
+ import { useState as h } from "react";
13
+ import { ArrowLeft as g, ArrowLeftRight as _, Bot as v, Building2 as y, Clock as b, ConciergeBell as x, DollarSign as S, Handshake as C, History as w, ListChecks as T, Mail as E, Plus as D, RefreshCw as O, Search as k, ShieldCheck as A, Zap as j } from "lucide-react";
14
+ import { useParams as M } from "react-router-dom";
15
+ import { jsx as N, jsxs as P } from "react/jsx-runtime";
16
+ import { GlassCard as F } from "@burdenoff/fe-libs/ui";
14
17
  //#region src/subscriberbot/pages/agents/AgentDetailPage.tsx
15
- var S = [
18
+ var I = [
16
19
  "DISABLED",
17
20
  "SUGGEST_ONLY",
18
21
  "AUTONOMOUS"
19
- ], C = [
22
+ ], L = [
20
23
  "ALERT",
21
24
  "CREATE_TASK",
22
25
  "RENEW",
@@ -24,22 +27,54 @@ var S = [
24
27
  "PAUSE",
25
28
  "UPGRADE",
26
29
  "DOWNGRADE"
27
- ], w = "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", T = "mb-1 block text-xs font-medium text-text-secondary";
28
- function E({ agentId: e, onClose: t }) {
29
- let n = u(), [r, i] = p(""), [a, o] = p("ALERT"), [s, c] = p(""), [l, d] = p(""), [m, h] = p(!0), [g, _] = p(null);
30
- return /* @__PURE__ */ y(f, {
30
+ ], R = {
31
+ DISCOVERY: k,
32
+ RENEWAL: O,
33
+ COST: S,
34
+ NEWSLETTER: E,
35
+ VENDOR: y,
36
+ COMPLIANCE: A,
37
+ NEGOTIATION: C,
38
+ MIGRATION: _,
39
+ CONCIERGE: x
40
+ };
41
+ function z(e) {
42
+ switch (e) {
43
+ case "RENEW":
44
+ case "UPGRADE": return "positive";
45
+ case "CANCEL":
46
+ case "PAUSE":
47
+ case "DOWNGRADE":
48
+ case "ALERT": return "warning";
49
+ default: return "default";
50
+ }
51
+ }
52
+ var B = "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", V = "mb-1 block text-xs font-medium text-text-secondary";
53
+ function H({ enabled: e }) {
54
+ return /* @__PURE__ */ P("span", {
55
+ className: e ? "inline-flex items-center gap-1.5 rounded-full bg-status-success-bg-subtle px-2.5 py-0.5 text-xs font-medium text-status-success-text" : "inline-flex items-center gap-1.5 rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary",
56
+ children: [/* @__PURE__ */ N("span", {
57
+ "aria-hidden": !0,
58
+ className: "size-1.5 rounded-full bg-current",
59
+ style: { opacity: e ? 1 : .6 }
60
+ }), e ? "Enabled" : "Disabled"]
61
+ });
62
+ }
63
+ function U({ agentId: e, onClose: t }) {
64
+ let n = p(), [r, i] = h(""), [a, o] = h("ALERT"), [c, l] = h(""), [u, d] = h(""), [f, m] = h(!0), [g, _] = h(null);
65
+ return /* @__PURE__ */ N(s, {
31
66
  title: "Add policy",
32
67
  onClose: t,
33
68
  maxWidthClassName: "max-w-xl",
34
- children: /* @__PURE__ */ b("form", {
69
+ children: /* @__PURE__ */ P("form", {
35
70
  onSubmit: (i) => {
36
71
  if (i.preventDefault(), _(null), !r.trim()) {
37
72
  _("A policy name is required.");
38
73
  return;
39
74
  }
40
75
  let o;
41
- if (l.trim()) try {
42
- o = JSON.parse(l);
76
+ if (u.trim()) try {
77
+ o = JSON.parse(u);
43
78
  } catch {
44
79
  _("Condition must be valid JSON (e.g. {\"amountOver\": 100}).");
45
80
  return;
@@ -48,8 +83,8 @@ function E({ agentId: e, onClose: t }) {
48
83
  agentId: e,
49
84
  name: r.trim(),
50
85
  action: a,
51
- isEnabled: m,
52
- ...s.trim() ? { description: s.trim() } : {},
86
+ isEnabled: f,
87
+ ...c.trim() ? { description: c.trim() } : {},
53
88
  ...o ? { condition: o } : {}
54
89
  }, {
55
90
  onSuccess: () => t(),
@@ -58,83 +93,83 @@ function E({ agentId: e, onClose: t }) {
58
93
  },
59
94
  className: "space-y-4",
60
95
  children: [
61
- g && /* @__PURE__ */ y("div", {
96
+ g && /* @__PURE__ */ N("div", {
62
97
  className: "rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text",
63
98
  children: g
64
99
  }),
65
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("label", {
100
+ /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ P("label", {
66
101
  htmlFor: "policy-name",
67
- className: T,
68
- children: ["Name ", /* @__PURE__ */ y("span", {
102
+ className: V,
103
+ children: ["Name ", /* @__PURE__ */ N("span", {
69
104
  className: "text-status-error-text",
70
105
  children: "*"
71
106
  })]
72
- }), /* @__PURE__ */ y("input", {
107
+ }), /* @__PURE__ */ N("input", {
73
108
  id: "policy-name",
74
109
  type: "text",
75
110
  value: r,
76
111
  onChange: (e) => i(e.target.value),
77
112
  placeholder: "e.g. Alert on price hike over 20%",
78
- className: w,
113
+ className: B,
79
114
  required: !0
80
115
  })] }),
81
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
116
+ /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
82
117
  htmlFor: "policy-action",
83
- className: T,
118
+ className: V,
84
119
  children: "Action"
85
- }), /* @__PURE__ */ y("select", {
120
+ }), /* @__PURE__ */ N("select", {
86
121
  id: "policy-action",
87
122
  value: a,
88
123
  onChange: (e) => o(e.target.value),
89
- className: w,
90
- children: C.map((e) => /* @__PURE__ */ y("option", {
124
+ className: B,
125
+ children: L.map((e) => /* @__PURE__ */ N("option", {
91
126
  value: e,
92
127
  children: e.replace(/_/g, " ")
93
128
  }, e))
94
129
  })] }),
95
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("label", {
130
+ /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ P("label", {
96
131
  htmlFor: "policy-condition",
97
- className: T,
98
- children: ["Condition ", /* @__PURE__ */ y("span", {
132
+ className: V,
133
+ children: ["Condition ", /* @__PURE__ */ N("span", {
99
134
  className: "text-text-secondary",
100
135
  children: "(optional JSON)"
101
136
  })]
102
- }), /* @__PURE__ */ y("textarea", {
137
+ }), /* @__PURE__ */ N("textarea", {
103
138
  id: "policy-condition",
104
- value: l,
139
+ value: u,
105
140
  onChange: (e) => d(e.target.value),
106
141
  rows: 3,
107
142
  placeholder: "{ \"priceIncreasePct\": 20 }",
108
- className: `${w} font-mono`
143
+ className: `${B} font-mono`
109
144
  })] }),
110
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
145
+ /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
111
146
  htmlFor: "policy-desc",
112
- className: T,
147
+ className: V,
113
148
  children: "Description"
114
- }), /* @__PURE__ */ y("textarea", {
149
+ }), /* @__PURE__ */ N("textarea", {
115
150
  id: "policy-desc",
116
- value: s,
117
- onChange: (e) => c(e.target.value),
151
+ value: c,
152
+ onChange: (e) => l(e.target.value),
118
153
  rows: 2,
119
- className: w
154
+ className: B
120
155
  })] }),
121
- /* @__PURE__ */ b("label", {
156
+ /* @__PURE__ */ P("label", {
122
157
  className: "flex items-center gap-2 text-sm text-text-primary",
123
- children: [/* @__PURE__ */ y("input", {
158
+ children: [/* @__PURE__ */ N("input", {
124
159
  type: "checkbox",
125
- checked: m,
126
- onChange: (e) => h(e.target.checked),
160
+ checked: f,
161
+ onChange: (e) => m(e.target.checked),
127
162
  className: "size-4 rounded border-border-subtle"
128
163
  }), "Enabled"]
129
164
  }),
130
- /* @__PURE__ */ b("div", {
165
+ /* @__PURE__ */ P("div", {
131
166
  className: "flex justify-end gap-3",
132
- children: [/* @__PURE__ */ y("button", {
167
+ children: [/* @__PURE__ */ N("button", {
133
168
  type: "button",
134
169
  onClick: t,
135
170
  className: "rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
136
171
  children: "Cancel"
137
- }), /* @__PURE__ */ y("button", {
172
+ }), /* @__PURE__ */ N("button", {
138
173
  type: "submit",
139
174
  disabled: n.isPending,
140
175
  className: "rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50",
@@ -145,155 +180,266 @@ function E({ agentId: e, onClose: t }) {
145
180
  })
146
181
  });
147
182
  }
148
- function D() {
149
- let { id: u } = v(), { navigateTo: f } = e(), { data: C, isLoading: w, isError: T, refetch: D } = l(u), O = d(), [k, A] = p(null), [j, M] = p(!1);
150
- if (w) return /* @__PURE__ */ y(t, {
183
+ function W({ policy: e }) {
184
+ return /* @__PURE__ */ P(F, {
185
+ treatment: "metric",
186
+ className: "flex flex-col p-4",
187
+ children: [
188
+ /* @__PURE__ */ P("div", {
189
+ className: "flex items-start justify-between gap-2",
190
+ children: [/* @__PURE__ */ N("p", {
191
+ className: "text-sm font-semibold text-text-primary",
192
+ children: e.name
193
+ }), /* @__PURE__ */ N(H, { enabled: e.isEnabled })]
194
+ }),
195
+ /* @__PURE__ */ P("div", {
196
+ className: "mt-2 flex flex-wrap items-center gap-2",
197
+ children: [/* @__PURE__ */ P("span", {
198
+ className: "inline-flex items-center gap-1.5 rounded-md bg-[var(--color-accent-soft)] px-2 py-0.5 text-[11px] font-medium text-text-primary",
199
+ children: [
200
+ /* @__PURE__ */ N(A, {
201
+ className: "h-3 w-3",
202
+ "aria-hidden": !0
203
+ }),
204
+ " ",
205
+ r(e.action)
206
+ ]
207
+ }), /* @__PURE__ */ P("span", {
208
+ className: "inline-flex items-center gap-1 rounded-md bg-bg-sunken px-2 py-0.5 text-[11px] font-medium text-text-secondary tabular-nums",
209
+ children: [
210
+ "Triggered ",
211
+ e.triggerCount,
212
+ "×"
213
+ ]
214
+ })]
215
+ }),
216
+ e.description && /* @__PURE__ */ N("p", {
217
+ className: "mt-2 line-clamp-2 text-xs text-text-secondary",
218
+ children: e.description
219
+ }),
220
+ /* @__PURE__ */ P("p", {
221
+ className: "mt-2 flex items-center gap-1.5 text-xs text-text-secondary",
222
+ children: [/* @__PURE__ */ N(b, {
223
+ className: "h-3.5 w-3.5",
224
+ "aria-hidden": !0
225
+ }), e.lastTriggeredAt ? `Last triggered ${i(e.lastTriggeredAt)}` : "Not yet triggered"]
226
+ })
227
+ ]
228
+ });
229
+ }
230
+ function G() {
231
+ let { id: s } = M(), { navigateTo: p } = e(), { data: _, isLoading: y, isError: x, refetch: S } = f(s), C = m(), [E, O] = h(null), [k, L] = h(!1);
232
+ if (y) return /* @__PURE__ */ N(t, {
151
233
  title: "Agent",
152
- children: /* @__PURE__ */ y(s, { label: "Loading agent…" })
234
+ children: /* @__PURE__ */ N(l, { label: "Loading agent…" })
153
235
  });
154
- if (T) return /* @__PURE__ */ y(t, {
236
+ if (x) return /* @__PURE__ */ N(t, {
155
237
  title: "Agent",
156
- children: /* @__PURE__ */ y(o, {
238
+ children: /* @__PURE__ */ N(c, {
157
239
  message: "Could not load this agent.",
158
- onRetry: () => void D()
240
+ onRetry: () => void S()
159
241
  })
160
242
  });
161
- if (!C) return /* @__PURE__ */ y(t, {
243
+ if (!_) return /* @__PURE__ */ N(t, {
162
244
  title: "Agent",
163
- children: /* @__PURE__ */ y(a, {
245
+ children: /* @__PURE__ */ N(o, {
164
246
  illustration: "empty-data",
165
247
  title: "Agent not found",
166
248
  description: "It may have been removed, or you may not have access to it.",
167
- action: /* @__PURE__ */ y("button", {
249
+ action: /* @__PURE__ */ N("button", {
168
250
  type: "button",
169
- onClick: () => f("/agents"),
251
+ onClick: () => p("/agents"),
170
252
  className: "rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90",
171
253
  children: "Back to agents"
172
254
  })
173
255
  })
174
256
  });
175
- let N = C;
176
- return /* @__PURE__ */ b(t, {
177
- title: N.name,
178
- description: `${n(N.kind)} agent`,
179
- actions: /* @__PURE__ */ b("button", {
257
+ let B = _, V = R[B.kind] ?? v, H = B.policies ?? [], G = H.filter((e) => e.isEnabled).length, K = H.reduce((e, t) => e + (t.triggerCount || 0), 0), q = [];
258
+ B.lastRunAt && q.push({
259
+ ts: new Date(B.lastRunAt).getTime(),
260
+ item: {
261
+ title: "Agent run",
262
+ sub: "Latest autonomous cycle",
263
+ meta: i(B.lastRunAt),
264
+ tone: "positive"
265
+ }
266
+ });
267
+ for (let e of H) e.lastTriggeredAt && q.push({
268
+ ts: new Date(e.lastTriggeredAt).getTime(),
269
+ item: {
270
+ title: e.name,
271
+ sub: `${r(e.action)} · fired ${e.triggerCount}×`,
272
+ meta: i(e.lastTriggeredAt),
273
+ tone: z(e.action)
274
+ }
275
+ });
276
+ q.sort((e, t) => t.ts - e.ts);
277
+ let J = q.map((e) => e.item);
278
+ return /* @__PURE__ */ P(t, {
279
+ title: B.name,
280
+ description: `${r(B.kind)} agent`,
281
+ actions: /* @__PURE__ */ P("button", {
180
282
  type: "button",
181
- onClick: () => f("/agents"),
283
+ onClick: () => p("/agents"),
182
284
  className: "inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
183
- children: [/* @__PURE__ */ y(m, { className: "h-4 w-4" }), " Back"]
285
+ children: [/* @__PURE__ */ N(g, { className: "h-4 w-4" }), " Back"]
184
286
  }),
185
287
  children: [
186
- /* @__PURE__ */ b("div", {
187
- className: "flex flex-wrap items-center gap-3",
188
- children: [
189
- /* @__PURE__ */ y("span", {
190
- className: "flex size-10 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-text-primary",
191
- children: /* @__PURE__ */ y(h, { className: "h-5 w-5" })
192
- }),
193
- /* @__PURE__ */ y(i, { status: N.status }),
194
- /* @__PURE__ */ y("span", {
195
- className: "text-sm text-text-secondary",
196
- children: N.lastRunAt ? `Last run ${r(N.lastRunAt)}` : "Never run"
197
- })
198
- ]
199
- }),
200
- N.description && /* @__PURE__ */ y("p", {
201
- className: "mt-4 max-w-3xl text-sm text-text-secondary",
202
- children: N.description
288
+ /* @__PURE__ */ N(F, {
289
+ treatment: "glass",
290
+ glow: B.status === "AUTONOMOUS",
291
+ className: "p-5",
292
+ children: /* @__PURE__ */ P("div", {
293
+ className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",
294
+ children: [/* @__PURE__ */ P("div", {
295
+ className: "flex items-start gap-4",
296
+ children: [/* @__PURE__ */ N("span", {
297
+ className: "flex size-12 shrink-0 items-center justify-center rounded-xl bg-[var(--color-accent-soft)] text-text-primary",
298
+ children: /* @__PURE__ */ N(V, { className: "h-6 w-6" })
299
+ }), /* @__PURE__ */ P("div", {
300
+ className: "min-w-0",
301
+ children: [
302
+ /* @__PURE__ */ P("div", {
303
+ className: "flex flex-wrap items-center gap-2",
304
+ children: [/* @__PURE__ */ N("p", {
305
+ className: "text-lg font-semibold text-text-primary",
306
+ children: B.name
307
+ }), /* @__PURE__ */ N(a, { status: B.status })]
308
+ }),
309
+ /* @__PURE__ */ P("p", {
310
+ className: "mt-1 flex items-center gap-1.5 text-xs text-text-secondary",
311
+ children: [/* @__PURE__ */ N(b, {
312
+ className: "h-3.5 w-3.5",
313
+ "aria-hidden": !0
314
+ }), B.lastRunAt ? `Last run ${i(B.lastRunAt)}` : "Never run"]
315
+ }),
316
+ B.description && /* @__PURE__ */ N("p", {
317
+ className: "mt-2 max-w-2xl text-sm text-text-secondary",
318
+ children: B.description
319
+ })
320
+ ]
321
+ })]
322
+ }), /* @__PURE__ */ P("div", {
323
+ className: "w-full sm:w-56 sm:shrink-0",
324
+ children: [
325
+ /* @__PURE__ */ N("label", {
326
+ htmlFor: "agent-posture",
327
+ className: "mb-1 block text-xs font-medium text-text-secondary",
328
+ children: "Operating posture"
329
+ }),
330
+ /* @__PURE__ */ N("select", {
331
+ id: "agent-posture",
332
+ value: B.status,
333
+ disabled: C.isPending,
334
+ onChange: (e) => {
335
+ O(null), C.mutate({
336
+ id: B.id,
337
+ status: e.target.value
338
+ }, { onError: (e) => O(e instanceof Error ? e.message : "Could not change posture.") });
339
+ },
340
+ className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] disabled:opacity-50",
341
+ children: I.map((e) => /* @__PURE__ */ N("option", {
342
+ value: e,
343
+ children: r(e)
344
+ }, e))
345
+ }),
346
+ /* @__PURE__ */ N("p", {
347
+ className: "mt-1.5 text-[11px] leading-snug text-text-secondary",
348
+ children: "Disabled never acts · Suggest-only proposes · Autonomous acts within its policies."
349
+ })
350
+ ]
351
+ })]
352
+ })
203
353
  }),
204
- k && /* @__PURE__ */ y("div", {
354
+ E && /* @__PURE__ */ N("div", {
205
355
  className: "mt-4 rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text",
206
- children: k
356
+ children: E
207
357
  }),
208
- /* @__PURE__ */ b("div", {
209
- className: "mt-6 max-w-sm",
358
+ /* @__PURE__ */ P("div", {
359
+ className: "mt-6 grid grid-cols-1 gap-4 sm:grid-cols-3",
210
360
  children: [
211
- /* @__PURE__ */ y("label", {
212
- htmlFor: "agent-posture",
213
- className: "mb-1 block text-xs font-medium text-text-secondary",
214
- children: "Operating posture"
361
+ /* @__PURE__ */ N(n, {
362
+ icon: /* @__PURE__ */ N(T, { className: "h-5 w-5" }),
363
+ value: H.length,
364
+ label: "Policies"
215
365
  }),
216
- /* @__PURE__ */ y("select", {
217
- id: "agent-posture",
218
- value: N.status,
219
- disabled: O.isPending,
220
- onChange: (e) => {
221
- A(null), O.mutate({
222
- id: N.id,
223
- status: e.target.value
224
- }, { onError: (e) => A(e instanceof Error ? e.message : "Could not change posture.") });
225
- },
226
- className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] disabled:opacity-50",
227
- children: S.map((e) => /* @__PURE__ */ y("option", {
228
- value: e,
229
- children: n(e)
230
- }, e))
366
+ /* @__PURE__ */ N(n, {
367
+ icon: /* @__PURE__ */ N(A, { className: "h-5 w-5" }),
368
+ value: G,
369
+ label: "Enabled"
231
370
  }),
232
- /* @__PURE__ */ y("p", {
233
- className: "mt-1.5 text-xs text-text-secondary",
234
- children: "Disabled never acts; Suggest-only proposes; Autonomous acts within its policies."
371
+ /* @__PURE__ */ N(n, {
372
+ icon: /* @__PURE__ */ N(j, { className: "h-5 w-5" }),
373
+ value: K,
374
+ label: "Total triggers"
235
375
  })
236
376
  ]
237
377
  }),
238
- /* @__PURE__ */ y(c, {
239
- title: "Policies",
240
- description: "The autonomous rules that bound this agent",
241
- action: /* @__PURE__ */ b("button", {
242
- type: "button",
243
- onClick: () => M(!0),
244
- className: "inline-flex items-center gap-1.5 rounded-lg border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken",
245
- children: [/* @__PURE__ */ y(g, { className: "h-3.5 w-3.5" }), " Add policy"]
246
- }),
247
- children: !N.policies || N.policies.length === 0 ? /* @__PURE__ */ y(a, {
248
- illustration: "empty-data",
249
- title: "No policies",
250
- description: "Policies define what this agent may do autonomously, and what it must alert on."
251
- }) : /* @__PURE__ */ y("div", {
252
- className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
253
- children: N.policies.map((e) => /* @__PURE__ */ b(x, {
254
- treatment: "metric",
255
- className: "p-4",
256
- children: [
257
- /* @__PURE__ */ b("div", {
258
- className: "flex items-start justify-between gap-2",
259
- children: [/* @__PURE__ */ y("p", {
260
- className: "text-sm font-medium text-text-primary",
261
- children: e.name
262
- }), /* @__PURE__ */ y(i, { status: e.isEnabled ? "ACTIVE" : "DISABLED" })]
263
- }),
264
- /* @__PURE__ */ b("p", {
265
- className: "mt-1 flex items-center gap-1.5 text-xs text-text-secondary",
266
- children: [
267
- /* @__PURE__ */ y(_, { className: "h-3.5 w-3.5" }),
268
- " Action: ",
269
- n(e.action)
270
- ]
271
- }),
272
- e.description && /* @__PURE__ */ y("p", {
273
- className: "mt-2 text-xs text-text-secondary",
274
- children: e.description
275
- }),
276
- /* @__PURE__ */ b("p", {
277
- className: "mt-2 text-xs text-text-secondary",
378
+ /* @__PURE__ */ P("div", {
379
+ className: "mt-8 grid grid-cols-1 gap-6 lg:grid-cols-3",
380
+ children: [/* @__PURE__ */ N("div", {
381
+ className: "lg:col-span-2",
382
+ children: /* @__PURE__ */ N(u, {
383
+ title: "Policies",
384
+ description: "The autonomous rules that bound this agent",
385
+ action: /* @__PURE__ */ P("button", {
386
+ type: "button",
387
+ onClick: () => L(!0),
388
+ className: "inline-flex items-center gap-1.5 rounded-lg border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken",
389
+ children: [/* @__PURE__ */ N(D, { className: "h-3.5 w-3.5" }), " Add policy"]
390
+ }),
391
+ children: H.length === 0 ? /* @__PURE__ */ N(o, {
392
+ illustration: "empty-data",
393
+ title: "No policies",
394
+ description: "Policies define what this agent may do autonomously, and what it must alert on.",
395
+ action: /* @__PURE__ */ N("button", {
396
+ type: "button",
397
+ onClick: () => L(!0),
398
+ className: "rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90",
399
+ children: "Add policy"
400
+ })
401
+ }) : /* @__PURE__ */ N("div", {
402
+ className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
403
+ children: H.map((e) => /* @__PURE__ */ N(W, { policy: e }, e.id))
404
+ })
405
+ })
406
+ }), /* @__PURE__ */ N("div", {
407
+ className: "lg:col-span-1",
408
+ children: /* @__PURE__ */ N(u, {
409
+ title: "Run history",
410
+ description: "Recent agent activity",
411
+ children: /* @__PURE__ */ N(F, {
412
+ treatment: "metric",
413
+ className: "p-5",
414
+ children: J.length === 0 ? /* @__PURE__ */ P("div", {
415
+ className: "flex flex-col items-center justify-center gap-2 py-6 text-center",
278
416
  children: [
279
- "Triggered ",
280
- e.triggerCount,
281
- "×",
282
- e.lastTriggeredAt ? ` · last ${r(e.lastTriggeredAt)}` : ""
417
+ /* @__PURE__ */ N(w, {
418
+ className: "h-8 w-8 text-text-secondary",
419
+ "aria-hidden": !0
420
+ }),
421
+ /* @__PURE__ */ N("p", {
422
+ className: "text-sm font-medium text-text-primary",
423
+ children: "No runs yet"
424
+ }),
425
+ /* @__PURE__ */ N("p", {
426
+ className: "text-xs text-text-secondary",
427
+ children: "Activity appears here once the agent runs or a policy fires."
428
+ })
283
429
  ]
284
- })
285
- ]
286
- }, e.id))
287
- })
430
+ }) : /* @__PURE__ */ N(d, { items: J })
431
+ })
432
+ })
433
+ })]
288
434
  }),
289
- j && /* @__PURE__ */ y(E, {
290
- agentId: N.id,
291
- onClose: () => M(!1)
435
+ k && /* @__PURE__ */ N(U, {
436
+ agentId: B.id,
437
+ onClose: () => L(!1)
292
438
  })
293
439
  ]
294
440
  });
295
441
  }
296
442
  //#endregion
297
- export { D as AgentDetailPage };
443
+ export { G as AgentDetailPage };
298
444
 
299
445
  //# sourceMappingURL=AgentDetailPage.js.map