@declarion/react 0.244.0 → 0.246.0

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.
@@ -52,7 +52,7 @@ function j() {
52
52
  e = !1, window.removeEventListener("pageshow", t);
53
53
  };
54
54
  }, [B, G]);
55
- let { setupStatus: J, isSetupPending: Y, ssoProviders: X } = h();
55
+ let { setupStatus: J, isSetupPending: Y, ssoProviders: X } = h(), Z = !!X && X.length > 0;
56
56
  if (b(() => {
57
57
  J?.needs_setup && r("/signup", { replace: !0 });
58
58
  }, [J, r]), b(() => {
@@ -68,7 +68,7 @@ function j() {
68
68
  ]), b(() => {
69
69
  K && e.error(q(K, "Sign-in failed."), void 0, { id: O });
70
70
  }, [q, K]), Y || J?.needs_setup) return /* @__PURE__ */ C(n, {});
71
- function Z(t) {
71
+ function Q(t) {
72
72
  t.preventDefault(), H || a({
73
73
  email: I,
74
74
  password: R,
@@ -78,7 +78,7 @@ function j() {
78
78
  } });
79
79
  }
80
80
  return /* @__PURE__ */ C(t, { children: /* @__PURE__ */ w("form", {
81
- onSubmit: Z,
81
+ onSubmit: Q,
82
82
  children: [
83
83
  /* @__PURE__ */ C("div", {
84
84
  style: {
@@ -105,9 +105,9 @@ function j() {
105
105
  fontSize: 13,
106
106
  color: "var(--text-3)"
107
107
  },
108
- children: F("auth.signin.subtitle", "Use your corporate SSO or email & password.")
108
+ children: Z ? F("auth.signin.subtitle", "Use your corporate SSO or email & password.") : F("auth.signin.subtitle_password", "Use your email and password.")
109
109
  }),
110
- X && X.length > 0 && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("div", {
110
+ Z && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("div", {
111
111
  style: {
112
112
  display: "flex",
113
113
  flexDirection: "column",
@@ -34,6 +34,7 @@ var _ = 150, v = {
34
34
  int: 90,
35
35
  float: 100,
36
36
  decimal: 130,
37
+ timestamp: 180,
37
38
  enum: 130,
38
39
  uuid: 110,
39
40
  text: 240
@@ -396,7 +396,7 @@ function Z(e) {
396
396
  return e?.entities.profile?.params_scope ?? "profile";
397
397
  }
398
398
  function Q() {
399
- let e = I(), { data: t } = k(), n = F().data?.find((e) => e.code === R);
399
+ let e = I(), { data: t } = k(), n = F().data?.params.find((e) => e.code === R);
400
400
  if (n?.scopes?.includes(Z(t))) return null;
401
401
  let r = typeof n?.value == "string" ? n.value : e.language, i = t?.languages?.find((e) => e.code === r);
402
402
  return /* @__PURE__ */ G(p, {
@@ -4,35 +4,35 @@ import { Btn as n } from "../../primitives/Btn.js";
4
4
  import { Spinner as r } from "../../primitives/Spinner.js";
5
5
  import { Select as i, TextInput as a } from "../../primitives/Fields.js";
6
6
  import { BoolToggle as o } from "../../primitives/BoolToggle.js";
7
- import { useAllParams as s, useCarrierParamOverrides as c } from "../../../hooks/useParams.js";
8
- import { useAuthStore as ee } from "../../../stores/auth.js";
9
- import { EditParamDialog as l, ErrorLine as u, ResetParamControl as d, ValuePreview as te, paramSourceName as f, paramTenantEditable as p, useParamRefLabels as m } from "../../params/param-editors.js";
10
- import { useResponsiveMode as h } from "../../../hooks/useResponsiveMode.js";
11
- import { PageHeader as g } from "../../chrome/PageHeader.js";
12
- import { PageShell as ne } from "../../chrome/PageShell.js";
7
+ import { useAllParams as s, useCarrierParamOverrides as ee } from "../../../hooks/useParams.js";
8
+ import { useAuthStore as te } from "../../../stores/auth.js";
9
+ import { EditParamDialog as c, ErrorLine as l, ResetParamControl as u, ValuePreview as ne, paramSourceName as d, paramTenantEditable as f, useParamRefLabels as p } from "../../params/param-editors.js";
10
+ import { useResponsiveMode as m } from "../../../hooks/useResponsiveMode.js";
11
+ import { PageHeader as h } from "../../chrome/PageHeader.js";
12
+ import { PageShell as g } from "../../chrome/PageShell.js";
13
13
  import { dataTableCellStyle as _, dataTableHeadCellStyle as v, dataTableStyle as y } from "../../primitives/dataTableStyles.js";
14
14
  import { useText as b } from "../../../hooks/useText.js";
15
15
  import { useSchema as x } from "../../../hooks/useSchema.js";
16
16
  import { useMemo as S, useState as C } from "react";
17
17
  import { jsx as w, jsxs as T } from "react/jsx-runtime";
18
18
  // src/components/pages/tenant-params/TenantParamsPage.impl.tsx
19
- var E = "my_tenant", D = [
19
+ var E = "my_tenant", re = [
20
20
  "yaml",
21
21
  "env",
22
22
  "tenant"
23
- ], O = [
23
+ ], D = [
24
24
  "29%",
25
25
  "12%",
26
26
  "11%",
27
27
  "21%",
28
28
  "9%",
29
29
  "18%"
30
- ], k = {
30
+ ], O = {
31
31
  ..._,
32
32
  overflow: "hidden",
33
33
  textOverflow: "ellipsis",
34
34
  whiteSpace: "nowrap"
35
- }, re = {
35
+ }, k = {
36
36
  ..._,
37
37
  whiteSpace: "nowrap",
38
38
  textAlign: "right"
@@ -41,12 +41,12 @@ function A(e) {
41
41
  return e === "tenant" ? "violet" : e === "env" ? "amber" : "slate";
42
42
  }
43
43
  function j(e) {
44
- let t = b(), n = b("errors"), d = ee((e) => e.activeTenant?.id) ?? "", { isPhone: p } = h(), A = s("tenant"), [j, P] = C(""), [F, I] = C(""), [L, R] = C(""), [z, B] = C(!1), [V, H] = C(null), { overrideByCode: U, missingParams: W, isLoading: G, retry: K, error: q, clearError: J, save: Y, reset: ie } = c({
44
+ let t = b(), n = b("errors"), u = te((e) => e.activeTenant?.id) ?? "", { isPhone: f } = m(), A = s("tenant"), [j, P] = C(""), [F, I] = C(""), [L, R] = C(""), [z, B] = C(!1), [V, H] = C(null), { overrideByCode: U, missingParams: W, isLoading: G, retry: K, error: q, clearError: J, save: Y, reset: ie } = ee({
45
45
  carrierEntityCode: E,
46
- rowId: d
46
+ rowId: u
47
47
  }), ae = async (e, t) => {
48
48
  await Y(e, t) && H((t) => t === e ? null : t);
49
- }, X = S(() => A.data ?? [], [A.data]), { data: Z } = x(), Q = S(() => {
49
+ }, X = S(() => A.data?.params ?? [], [A.data]), { data: Z } = x(), Q = S(() => {
50
50
  let e = new Map((Z?.enums?.parameter_category?.values ?? []).map((e) => [e.code, t(e.name) || e.code]));
51
51
  return (t) => t ? e.get(t) ?? t : "";
52
52
  }, [Z, t]), oe = S(() => Array.from(new Set(X.map((e) => e.category).filter(Boolean))).map((e) => ({
@@ -67,7 +67,7 @@ function j(e) {
67
67
  L,
68
68
  z,
69
69
  U
70
- ]), ce = A.isLoading || G, le = m(X), $ = se.map((e) => {
70
+ ]), ce = A.isLoading || G, le = p(X, A.data?.refs), $ = se.map((e) => {
71
71
  let t = U.get(e.code);
72
72
  return {
73
73
  param: e,
@@ -75,7 +75,7 @@ function j(e) {
75
75
  param: e,
76
76
  override: t
77
77
  }),
78
- value: /* @__PURE__ */ w(te, {
78
+ value: /* @__PURE__ */ w(ne, {
79
79
  type: e.type,
80
80
  value: e.value,
81
81
  values: e.values,
@@ -93,11 +93,11 @@ function j(e) {
93
93
  })
94
94
  };
95
95
  });
96
- return /* @__PURE__ */ T(ne, {
97
- header: /* @__PURE__ */ w(g, { description: t("params.tenant.subtitle", "Tenant configuration. Editing a value stores a tenant override; Reset restores the platform default.") }),
96
+ return /* @__PURE__ */ T(g, {
97
+ header: /* @__PURE__ */ w(h, { description: t("params.tenant.subtitle", "Tenant configuration. Editing a value stores a tenant override; Reset restores the platform default.") }),
98
98
  children: [
99
- q && /* @__PURE__ */ w(u, { text: q }),
100
- W && /* @__PURE__ */ w(u, {
99
+ q && /* @__PURE__ */ w(l, { text: q }),
100
+ W && /* @__PURE__ */ w(l, {
101
101
  text: n("param.overrides_unreadable", "The current parameter overrides could not be read."),
102
102
  onRetry: K
103
103
  }),
@@ -139,9 +139,9 @@ function j(e) {
139
139
  options: [{
140
140
  value: "",
141
141
  label: t("params.filter.all_sources", "All sources")
142
- }, ...D.map((e) => ({
142
+ }, ...re.map((e) => ({
143
143
  value: e,
144
- label: f(t, e)
144
+ label: d(t, e)
145
145
  }))],
146
146
  onChange: R
147
147
  })
@@ -174,7 +174,7 @@ function j(e) {
174
174
  fontSize: 12.5
175
175
  },
176
176
  children: t("params.empty", "No parameters match.")
177
- }) : p ? /* @__PURE__ */ w("div", {
177
+ }) : f ? /* @__PURE__ */ w("div", {
178
178
  "data-testid": "tenant-params-cards",
179
179
  style: {
180
180
  display: "flex",
@@ -258,7 +258,7 @@ function j(e) {
258
258
  tableLayout: "fixed"
259
259
  },
260
260
  children: [
261
- /* @__PURE__ */ w("colgroup", { children: O.map((e, t) => /* @__PURE__ */ w("col", { style: { width: e } }, t)) }),
261
+ /* @__PURE__ */ w("colgroup", { children: D.map((e, t) => /* @__PURE__ */ w("col", { style: { width: e } }, t)) }),
262
262
  /* @__PURE__ */ w("thead", { children: /* @__PURE__ */ T("tr", { children: [
263
263
  /* @__PURE__ */ w("th", {
264
264
  style: v,
@@ -304,25 +304,25 @@ function j(e) {
304
304
  })]
305
305
  }),
306
306
  /* @__PURE__ */ w("td", {
307
- style: k,
307
+ style: O,
308
308
  title: Q(e.category) || void 0,
309
309
  children: Q(e.category) || "—"
310
310
  }),
311
311
  /* @__PURE__ */ w("td", {
312
- style: k,
312
+ style: O,
313
313
  title: e.type,
314
314
  children: e.type
315
315
  }),
316
316
  /* @__PURE__ */ w("td", {
317
- style: k,
317
+ style: O,
318
318
  children: r
319
319
  }),
320
320
  /* @__PURE__ */ w("td", {
321
- style: k,
321
+ style: O,
322
322
  children: n
323
323
  }),
324
324
  /* @__PURE__ */ w("td", {
325
- style: re,
325
+ style: k,
326
326
  children: i
327
327
  })
328
328
  ]
@@ -330,7 +330,7 @@ function j(e) {
330
330
  ]
331
331
  })
332
332
  }),
333
- V && /* @__PURE__ */ w(l, {
333
+ V && /* @__PURE__ */ w(c, {
334
334
  param: V,
335
335
  current: U.get(V.code)?.value ?? V.value,
336
336
  error: q,
@@ -348,7 +348,7 @@ function M({ param: e, override: n }) {
348
348
  "data-testid": `tenant-param-not-applied-${e.code}`,
349
349
  title: r("params.tenant.not_applied_hint", "This tenant is set to {value}, and it no longer satisfies the parameter's declaration. Source of the value in effect: {source}. Reset to remove it, or edit it to a value the declaration accepts.", {
350
350
  value: JSON.stringify(n.value),
351
- source: f(r, e.source)
351
+ source: d(r, e.source)
352
352
  }),
353
353
  children: /* @__PURE__ */ w(t, {
354
354
  tone: "amber",
@@ -359,12 +359,12 @@ function M({ param: e, override: n }) {
359
359
  }) : /* @__PURE__ */ w(t, {
360
360
  tone: A(e.source),
361
361
  size: "xs",
362
- children: f(r, e.source)
362
+ children: d(r, e.source)
363
363
  });
364
364
  }
365
365
  function N({ param: t, stored: r, onEdit: i, onReset: a }) {
366
366
  let o = b();
367
- return p(t) ? /* @__PURE__ */ T("span", {
367
+ return f(t) ? /* @__PURE__ */ T("span", {
368
368
  style: {
369
369
  display: "inline-flex",
370
370
  flexWrap: "wrap",
@@ -376,7 +376,7 @@ function N({ param: t, stored: r, onEdit: i, onReset: a }) {
376
376
  icon: /* @__PURE__ */ w(e.edit, { size: 12 }),
377
377
  onClick: i,
378
378
  children: o("params.edit", "Edit")
379
- }), r && /* @__PURE__ */ w(d, {
379
+ }), r && /* @__PURE__ */ w(u, {
380
380
  param: t,
381
381
  description: o("params.reset_confirm.tenant_description", "The value this tenant set is removed, and the platform default applies again."),
382
382
  onReset: a
@@ -16,7 +16,7 @@ function y(e, t) {
16
16
  return e ? e.filter((e) => e.scopes?.includes(t)) : [];
17
17
  }
18
18
  function b({ carrierEntityCode: b, carrierScope: x, rowId: S, title: C, icon: w, writeOneByOne: T }) {
19
- let E = p(), D = p("errors"), O = a(), k = m(() => y(O.data, x), [O.data, x]), [A, j] = h(null), { overrideByCode: M, missingParams: N, isLoading: P, retry: F, error: I, clearError: L, save: R, reset: z } = o({
19
+ let E = p(), D = p("errors"), O = a(), k = m(() => y(O.data?.params, x), [O.data, x]), [A, j] = h(null), { overrideByCode: M, missingParams: N, isLoading: P, retry: F, error: I, clearError: L, save: R, reset: z } = o({
20
20
  carrierEntityCode: b,
21
21
  rowId: S,
22
22
  enabled: k.length > 0,
@@ -31,7 +31,7 @@ function b({ carrierEntityCode: b, carrierScope: x, rowId: S, title: C, icon: w,
31
31
  k,
32
32
  B,
33
33
  M
34
- ]), H = f(V), U = async (e, t) => {
34
+ ]), H = f(V, O.data?.refs), U = async (e, t) => {
35
35
  await R(e, t) && j((t) => t === e ? null : t);
36
36
  };
37
37
  return k.length === 0 ? null : /* @__PURE__ */ _(e, {
@@ -62,12 +62,12 @@ function x({ text: e, onRetry: n }) {
62
62
  ]
63
63
  });
64
64
  }
65
- function S(e) {
66
- let t = d(), { data: n } = c(), r = e.flatMap((e) => e.ref?.entity && e.value != null && e.value !== "" ? [{
65
+ function S(e, t) {
66
+ let n = d(), { data: r } = c(), i = e.flatMap((e) => e.ref?.entity && e.value != null && e.value !== "" ? [{
67
67
  ref: e.ref,
68
68
  value: e.value
69
- }] : []), { refs: i } = s(r, void 0, n?.entities);
70
- return (e) => e.ref?.entity ? o(t, i, e.ref, e.value, n?.entities) : void 0;
69
+ }] : []), { refs: a } = s(i, t, r?.entities);
70
+ return (e) => e.ref?.entity ? o(n, a, e.ref, e.value, r?.entities) : void 0;
71
71
  }
72
72
  function C({ type: e, value: t, values: n, structure: r, label: i, maxWidth: a = 180 }) {
73
73
  let o = d(), { data: s } = c(), l = (e) => {
@@ -2,27 +2,27 @@ import { approveInvocation as e, cancelConversation as t, cancelInvocation as n,
2
2
  import { AGENT_FRAME_EVENT as u, AGENT_MESSAGE_CHANGED_EVENT as d, agentBus as f } from "../api/events.js";
3
3
  import { useAuthStore as p } from "../stores/auth.js";
4
4
  import { ApiError as m } from "../types/api.js";
5
- import { coerceDisplayString as re } from "../lib/display-value.js";
6
- import { useCallback as h, useEffect as g, useMemo as ie, useRef as _, useState as v } from "react";
5
+ import { coerceDisplayString as h } from "../lib/display-value.js";
6
+ import { useCallback as g, useEffect as _, useMemo as re, useRef as v, useState as y } from "react";
7
7
  // src/hooks/useAgentConversation.ts
8
- var y = { streaming: !1 }, b = "declarion.agents.conversation_id";
9
- function x(e) {
10
- if (e) return `${b}:${e}`;
8
+ var b = { streaming: !1 }, x = "declarion.agents.conversation_id";
9
+ function S(e, t) {
10
+ if (e) return t ? `${x}:${e}:${t}` : `${x}:${e}`;
11
11
  }
12
- function ae(e) {
12
+ function ie(e, t) {
13
13
  if (typeof window > "u") return;
14
- let t = x(e);
15
- if (t) try {
16
- return window.localStorage.getItem(t) || void 0;
14
+ let n = S(e, t);
15
+ if (n) try {
16
+ return window.localStorage.getItem(n) || void 0;
17
17
  } catch {
18
18
  return;
19
19
  }
20
20
  }
21
- function S(e, t) {
21
+ function ae(e, t, n) {
22
22
  if (typeof window > "u") return;
23
- let n = x(e);
24
- if (n) try {
25
- t ? window.localStorage.setItem(n, t) : window.localStorage.removeItem(n);
23
+ let r = S(e, t);
24
+ if (r) try {
25
+ n ? window.localStorage.setItem(r, n) : window.localStorage.removeItem(r);
26
26
  } catch {}
27
27
  }
28
28
  function C(e) {
@@ -54,19 +54,19 @@ function E(e, t) {
54
54
  }) : r.push(i)));
55
55
  return n ? r : e;
56
56
  }
57
- function D(e) {
57
+ function oe(e) {
58
58
  let t = e;
59
59
  for (let n of e) n.role === "assistant" && n.streaming && (t = E(t, n.id));
60
60
  return t;
61
61
  }
62
- function O(e, t, n, r) {
62
+ function D(e, t, n, r) {
63
63
  let i = !1, a = e.map((e) => e.id === n ? (i = !0, r(e)) : e);
64
64
  return i ? a : [...e, r(w(n, t))];
65
65
  }
66
- function oe(e, t, n, r) {
66
+ function O(e, t, n, r) {
67
67
  if (!r) return e;
68
68
  let i = e.find((e) => e.id === n);
69
- return i && !i.streaming ? e : O(T(e, n), t, n, (e) => {
69
+ return i && !i.streaming ? e : D(T(e, n), t, n, (e) => {
70
70
  let t = [...e.content], n = t[t.length - 1];
71
71
  return n?.type === "text" ? t[t.length - 1] = {
72
72
  ...n,
@@ -83,7 +83,7 @@ function oe(e, t, n, r) {
83
83
  }
84
84
  function se(e, t, n, r, i, a) {
85
85
  let o = e.find((e) => e.id === n);
86
- return o && !o.streaming ? e : O(T(e, n), t, n, (e) => r && e.content.some((e) => e.type === "tool_use" && e.id === r) ? e.streaming ? e : {
86
+ return o && !o.streaming ? e : D(T(e, n), t, n, (e) => r && e.content.some((e) => e.type === "tool_use" && e.id === r) ? e.streaming ? e : {
87
87
  ...e,
88
88
  streaming: !0
89
89
  } : {
@@ -141,60 +141,60 @@ function k(e) {
141
141
  let t = e.payload?.message_id;
142
142
  return typeof t == "string" && t ? t : void 0;
143
143
  }
144
- function A(m) {
145
- let b = p.getState().activeTenant?.id, [x, w] = v(m ?? ae(b)), A = h((e) => {
146
- S(b, e), w(e);
147
- }, [b]), [j, M] = v([]), [ue, N] = v(y), [de, P] = v([]), [F, I] = v([]), [L, R] = v([]), [z, B] = v(1), [V, H] = v(!1), [fe, U] = v();
148
- g(() => {
149
- if (!x) {
144
+ function A(m, x) {
145
+ let S = p.getState().activeTenant?.id, [w, A] = y(m ?? ie(S, x)), j = g((e) => {
146
+ ae(S, x, e), A(e);
147
+ }, [S, x]), [M, N] = y([]), [ue, P] = y(b), [de, F] = y([]), [I, L] = y([]), [R, z] = y([]), [B, V] = y(1), [fe, H] = y(!1), [pe, U] = y();
148
+ _(() => {
149
+ if (!w) {
150
150
  U(void 0);
151
151
  return;
152
152
  }
153
153
  let e = !1;
154
- return o(x).then((t) => {
154
+ return o(w).then((t) => {
155
155
  e || U(t);
156
156
  }, () => {
157
157
  e || U(void 0);
158
158
  }), () => {
159
159
  e = !0;
160
160
  };
161
- }, [x]);
162
- let [pe, me] = v([]), [W, G] = v(), K = _(/* @__PURE__ */ new Set()), q = _(0), J = _(null), he = (e) => (J.current?.fingerprint !== e && (J.current = {
161
+ }, [w]);
162
+ let [me, he] = y([]), [W, G] = y(), K = v(/* @__PURE__ */ new Set()), q = v(0), J = v(null), ge = (e) => (J.current?.fingerprint !== e && (J.current = {
163
163
  key: crypto.randomUUID(),
164
164
  fingerprint: e
165
165
  }), J.current.key);
166
- g(() => {
167
- if (!x) {
168
- M([]), N(y), P([]), I([]);
166
+ _(() => {
167
+ if (!w) {
168
+ N([]), P(b), F([]), L([]);
169
169
  return;
170
170
  }
171
- if (K.current.has(x)) {
172
- K.current.delete(x);
171
+ if (K.current.has(w)) {
172
+ K.current.delete(w);
173
173
  return;
174
174
  }
175
175
  let e = !1, t = ++q.current;
176
176
  return Promise.all([
177
- l(x),
178
- c(x),
179
- s(x)
177
+ l(w),
178
+ c(w),
179
+ s(w)
180
180
  ]).then(([n, r, i]) => {
181
181
  if (e || t !== q.current) return;
182
182
  let a = n.map((e) => e.streaming ? {
183
183
  ...e,
184
184
  streaming: !1
185
185
  } : e);
186
- M(a), P(r), I(i);
186
+ N(a), F(r), L(i);
187
187
  }, (t) => {
188
- e || t?.status === 404 && (A(void 0), M([]));
188
+ e || t?.status === 404 && (j(void 0), N([]));
189
189
  }), () => {
190
190
  e = !0;
191
191
  };
192
- }, [x, A]);
193
- let Y = _(x);
194
- g(() => {
195
- Y.current = x;
196
- }, [x]);
197
- let X = _(!1), Z = _(null), Q = h((e) => {
192
+ }, [w, j]);
193
+ let Y = v(w);
194
+ _(() => {
195
+ Y.current = w;
196
+ }, [w]);
197
+ let X = v(!1), Z = v(null), Q = g((e) => {
198
198
  if (X.current) {
199
199
  Z.current = e;
200
200
  return;
@@ -206,14 +206,14 @@ function A(m) {
206
206
  c(e),
207
207
  s(e)
208
208
  ]).then(([n, r, i]) => {
209
- e === Y.current && t === q.current && (M((e) => le(n, e)), P(r), I(i));
209
+ e === Y.current && t === q.current && (N((e) => le(n, e)), F(r), L(i));
210
210
  }, () => {}).finally(() => {
211
211
  X.current = !1;
212
212
  let e = Z.current;
213
213
  Z.current = null, e && Q(e);
214
214
  });
215
215
  }, []);
216
- g(() => {
216
+ _(() => {
217
217
  let e = (e) => {
218
218
  let { convId: n, kind: r, turnId: i, payload: a } = e.detail;
219
219
  n === Y.current && t(n, {
@@ -226,24 +226,24 @@ function A(m) {
226
226
  let t = (e, t) => {
227
227
  switch (t.kind) {
228
228
  case "turn.started":
229
- N((e) => ({
229
+ P((e) => ({
230
230
  ...e,
231
231
  streaming: !0
232
- })), M((e) => T(e));
232
+ })), N((e) => T(e));
233
233
  break;
234
234
  case "assistant.message.created": {
235
235
  let n = typeof t.payload?.message_id == "string" ? t.payload.message_id : "";
236
236
  if (!n) break;
237
- M((t) => O(T(t, n), e, n, (e) => ({
237
+ N((t) => D(T(t, n), e, n, (e) => ({
238
238
  ...e,
239
239
  streaming: !0
240
240
  })));
241
241
  break;
242
242
  }
243
243
  case "text.delta": {
244
- let n = re(t.payload?.text), r = k(t);
244
+ let n = h(t.payload?.text), r = k(t);
245
245
  if (!r || !n) break;
246
- M((t) => oe(t, e, r, n));
246
+ N((t) => O(t, e, r, n));
247
247
  break;
248
248
  }
249
249
  case "elicit.pending":
@@ -255,7 +255,7 @@ function A(m) {
255
255
  case "tool.proposed": {
256
256
  let n = k(t), r = typeof t.payload?.tool == "string" ? t.payload.tool : "", i = t.payload?.params ?? {}, a = typeof t.payload?.tool_use_id == "string" ? t.payload.tool_use_id : "";
257
257
  if (!n || !r) break;
258
- M((t) => se(t, e, n, a, r, i));
258
+ N((t) => se(t, e, n, a, r, i));
259
259
  break;
260
260
  }
261
261
  case "tool.result":
@@ -264,12 +264,12 @@ function A(m) {
264
264
  Q(e);
265
265
  break;
266
266
  case "turn.finished": {
267
- N(y);
267
+ P(b);
268
268
  let e = k(t);
269
- e && M((t) => E(t, e));
269
+ e && N((t) => E(t, e));
270
270
  break;
271
271
  }
272
- case "error": M((e) => D(e)), N((e) => ({
272
+ case "error": N((e) => oe(e)), P((e) => ({
273
273
  ...e,
274
274
  streaming: !1
275
275
  }));
@@ -282,10 +282,10 @@ function A(m) {
282
282
  f.removeEventListener(u, e), f.removeEventListener(d, n);
283
283
  };
284
284
  }, [Q]);
285
- let $ = h(async (e, t, n = []) => {
286
- let i = n.map((e) => e.id), a = x;
287
- a || (a = (await r({ agent_id: W })).id, K.current.add(a), Y.current = a, A(a));
288
- let o, s = (n) => ne(e, n, t, i, he(JSON.stringify([
285
+ let $ = g(async (e, t, n = []) => {
286
+ let i = n.map((e) => e.id), a = w;
287
+ a || (a = (await r({ agent_id: W })).id, K.current.add(a), Y.current = a, j(a));
288
+ let o, s = (n) => ne(e, n, t, i, ge(JSON.stringify([
289
289
  n,
290
290
  e,
291
291
  t ?? null,
@@ -295,9 +295,9 @@ function A(m) {
295
295
  o = await s(a);
296
296
  } catch (e) {
297
297
  if (!C(e)) throw e;
298
- a = (await r({ agent_id: W })).id, K.current.add(a), Y.current = a, A(a), o = await s(a);
298
+ a = (await r({ agent_id: W })).id, K.current.add(a), Y.current = a, j(a), o = await s(a);
299
299
  }
300
- J.current = null, M((t) => {
300
+ J.current = null, N((t) => {
301
301
  if (t.some((e) => e.id === o.id)) return t;
302
302
  let r = e ? [{
303
303
  type: "text",
@@ -310,59 +310,59 @@ function A(m) {
310
310
  }];
311
311
  });
312
312
  }, [
313
- x,
314
- A,
313
+ w,
314
+ j,
315
315
  W
316
- ]), ge = h(async (t, n) => {
317
- await e(t, n), x && Q(x);
318
- }, [x, Q]), _e = h(async (e, t) => {
319
- await ee(e, t), x && Q(x);
320
- }, [x, Q]), ve = h(async (e, t) => {
321
- x && (await te(x, e, t), Q(x));
322
- }, [x, Q]), ye = h(async (e) => {
323
- x && (await n(e), Q(x));
324
- }, [x, Q]), be = h(async () => {
325
- x && await t(x);
326
- }, [x]), xe = h(async () => {
316
+ ]), _e = g(async (t, n) => {
317
+ await e(t, n), w && Q(w);
318
+ }, [w, Q]), ve = g(async (e, t) => {
319
+ await ee(e, t), w && Q(w);
320
+ }, [w, Q]), ye = g(async (e, t) => {
321
+ w && (await te(w, e, t), Q(w));
322
+ }, [w, Q]), be = g(async (e) => {
323
+ w && (await n(e), Q(w));
324
+ }, [w, Q]), xe = g(async () => {
325
+ w && await t(w);
326
+ }, [w]), Se = g(async () => {
327
327
  let e = await a();
328
- R(e), B(1), H(e.length === 50);
329
- }, []), Se = h(async () => {
330
- let e = await a(z + 1);
331
- R((t) => [...t, ...e.filter((e) => !t.some((t) => t.id === e.id))]), B(z + 1), H(e.length === 50);
332
- }, [z]), Ce = h(() => {
333
- A(void 0), M([]), N(y);
334
- }, [A]);
335
- return g(() => {
328
+ z(e), V(1), H(e.length === 50);
329
+ }, []), Ce = g(async () => {
330
+ let e = await a(B + 1);
331
+ z((t) => [...t, ...e.filter((e) => !t.some((t) => t.id === e.id))]), V(B + 1), H(e.length === 50);
332
+ }, [B]), we = g(() => {
333
+ j(void 0), N([]), P(b);
334
+ }, [j]);
335
+ return _(() => {
336
336
  let e = !0;
337
337
  return i().then((t) => {
338
- e && (me(t), G((e) => e ?? t.find((e) => e.is_default)?.id));
338
+ e && (he(t), G((e) => e ?? t.find((e) => x ? e.code === x : e.is_default)?.id));
339
339
  }).catch((e) => {
340
340
  console.warn("agents.list_available failed; the agent picker is unavailable", e);
341
341
  }), () => {
342
342
  e = !1;
343
343
  };
344
- }, []), {
345
- conversationId: x,
346
- messages: ie(() => ce(j, F), [j, F]),
344
+ }, [x]), {
345
+ conversationId: w,
346
+ messages: re(() => ce(M, I), [M, I]),
347
347
  turn: ue,
348
348
  turns: de,
349
- invocations: F,
350
- conversations: L,
351
- openedConversation: fe,
352
- moreConversations: V,
353
- showMoreConversations: Se,
349
+ invocations: I,
350
+ conversations: R,
351
+ openedConversation: pe,
352
+ moreConversations: fe,
353
+ showMoreConversations: Ce,
354
354
  send: $,
355
- approve: ge,
356
- reject: _e,
357
- submitInput: ve,
358
- cancelInput: ye,
359
- cancel: be,
360
- refreshConversations: xe,
361
- startNew: Ce,
362
- agents: pe,
355
+ approve: _e,
356
+ reject: ve,
357
+ submitInput: ye,
358
+ cancelInput: be,
359
+ cancel: xe,
360
+ refreshConversations: Se,
361
+ startNew: we,
362
+ agents: me,
363
363
  selectedAgentId: W,
364
364
  selectAgent: G,
365
- setConversationId: A
365
+ setConversationId: j
366
366
  };
367
367
  }
368
368
  export { A as useAgentConversation };
@@ -2191,6 +2191,7 @@ interface AgentChatPanelProps {
2191
2191
  * this it opened the panel and threw the question away. */
2192
2192
  askOnOpen?: string;
2193
2193
  docked?: boolean;
2194
+ agentCode?: string;
2194
2195
  }
2195
2196
  export declare function AgentChatPanel(props: AgentChatPanelProps): import("react").JSX.Element | null;
2196
2197
  type JSONSchemaProp = {
@@ -2239,7 +2240,9 @@ export declare function AgentConversationDrawer({ open, onClose, conversations,
2239
2240
  interface AgentTurnState {
2240
2241
  streaming: boolean;
2241
2242
  }
2242
- export declare function useAgentConversation(initialConversationId?: string): {
2243
+ /** agentCode names the agent a screen's own panel talks to: it is preselected instead of the tenant's default, and the
2244
+ * panel remembers its conversation apart from the general one. */
2245
+ export declare function useAgentConversation(initialConversationId?: string, agentCode?: string): {
2243
2246
  conversationId: string | undefined;
2244
2247
  messages: AgentMessage[];
2245
2248
  turn: AgentTurnState;