react-semaphor 0.1.578 → 0.1.580

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 (45) hide show
  1. package/dist/assistant-context/index.js +1 -1
  2. package/dist/assistant-protocol/index.js +75 -70
  3. package/dist/briefings/index.js +1 -1
  4. package/dist/chunks/add-to-dashboard-DhP8wVtM.js +291 -0
  5. package/dist/chunks/{assistant-chat-B_tmsxEK.js → assistant-chat-CUwGURJj.js} +2261 -2184
  6. package/dist/chunks/{bookmark-impact-DUWw3wlA.js → bookmark-impact-BNyR-yDX.js} +1 -1
  7. package/dist/chunks/{card-filter-builder-CwnMUZU2.js → card-filter-builder-k9yqDSw8.js} +168 -180
  8. package/dist/chunks/{comparison-window-caption-PtcDWvkN.js → comparison-window-caption-DdLqMgiG.js} +180 -183
  9. package/dist/chunks/{context-R31TSL5V.js → context-BTLBjQNh.js} +99 -83
  10. package/dist/chunks/{dashboard-BcIIBCTP.js → dashboard-DvcAk8uJ.js} +1 -1
  11. package/dist/chunks/{dashboard-briefing-launcher-BBpECqg2.js → dashboard-briefing-launcher-DBgS97ZH.js} +155 -155
  12. package/dist/chunks/{dashboard-controls-CONzvjmO.js → dashboard-controls-BiZ1rlNC.js} +7 -7
  13. package/dist/chunks/{dashboard-json-BF2chEVd.js → dashboard-json-B25xzYcJ.js} +1 -1
  14. package/dist/chunks/{dates-DlYMDaF2.js → dates-3Pah03_l.js} +5 -5
  15. package/dist/chunks/{edit-dashboard-visual-Bf-RcbuD.js → edit-dashboard-visual-DYuO3mEU.js} +9 -10
  16. package/dist/chunks/{filter-reach-copy-BTAXnbwQ.js → filter-reach-copy-CzLt96tq.js} +125 -125
  17. package/dist/chunks/{index-8BxDk8EP.js → index-BMZq6JT6.js} +2 -2
  18. package/dist/chunks/{report-preferences-dialog-RN4g9PEN.js → report-preferences-dialog-DpAetrdY.js} +7 -7
  19. package/dist/chunks/{resolve-dashboard-input-context-DBFuNhZo.js → resolve-dashboard-input-context-CNxtkCzj.js} +6266 -6191
  20. package/dist/chunks/{saved-dashboard-context-AChHk4tw.js → saved-dashboard-context-Bnt0H7mi.js} +3 -3
  21. package/dist/chunks/{semaphor-ready-indicator-DtivanBy.js → semaphor-ready-indicator-Dwmvmf0S.js} +15010 -14990
  22. package/dist/chunks/{shelf-drop-preview-context-BTjYxbHC.js → shelf-drop-preview-context-CiveteBS.js} +2 -2
  23. package/dist/chunks/{stored-dashboard-rpLzf4mk.js → stored-dashboard-D3gu-D7A.js} +67 -67
  24. package/dist/chunks/{table-export-sheet-CP8zSOhj.js → table-export-sheet-BNGSJA2N.js} +1 -1
  25. package/dist/chunks/{variable-draft-DPSMDwqt.js → variable-draft-C3_RL2gI.js} +2 -2
  26. package/dist/dashboard/index.js +1 -1
  27. package/dist/dashboard-authoring/index.js +357 -350
  28. package/dist/format-utils/index.js +4 -4
  29. package/dist/index.js +12 -12
  30. package/dist/style.css +1 -1
  31. package/dist/surfboard/index.js +1 -1
  32. package/dist/types/shared/assistant-protocol/answer-text.d.ts +5 -1
  33. package/dist/types/shared/assistant-protocol/context.d.ts +2 -1
  34. package/dist/types/shared/assistant-protocol/model-change.d.ts +23 -3
  35. package/dist/types/shared/assistant-protocol/parts.d.ts +12 -2
  36. package/dist/types/shared/dashboard-authoring/changes/aggregates.d.ts +2 -0
  37. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +9 -58
  38. package/dist/types/shared/dashboard-authoring/changes/domain-change.d.ts +1738 -0
  39. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  40. package/dist/types/shared/usage-events/catalog.d.ts +5 -3
  41. package/dist/types/shared/usage-events/details.d.ts +66 -0
  42. package/dist/types/shared/usage-events/envelope.d.ts +5 -5
  43. package/dist/usage-events/index.js +154 -115
  44. package/package.json +1 -1
  45. package/dist/chunks/add-to-dashboard-B6Ah8Lub.js +0 -267
@@ -1,4 +1,4 @@
1
- import { A as e, a as t, b as r, c as d, d as o, p as i, e as n, f as p } from "../chunks/saved-dashboard-context-AChHk4tw.js";
1
+ import { A as e, a as t, b as r, c as d, d as o, p as i, e as n, f as p } from "../chunks/saved-dashboard-context-Bnt0H7mi.js";
2
2
  export {
3
3
  e as AssistantContextSourceError,
4
4
  t as assistantCardReplayFields,
@@ -1,23 +1,23 @@
1
1
  import { z as e } from "zod";
2
- import { s as p } from "../chunks/analytics-base-schemas-BaIQrEzX.js";
3
- import { a as x, A as s, b as T, c } from "../chunks/context-R31TSL5V.js";
4
- import { e as O, j as q, m as L, d as F, l as $, g as U, k as M, h as j, i as w, f as P, r as V } from "../chunks/context-R31TSL5V.js";
5
- import { t as C } from "../chunks/add-to-dashboard-B6Ah8Lub.js";
6
- import { A as J, m as K, C as W, e as X, k as z, j as G, f as H, n as Q, o as Z, p as ee, r as se, q as ae, s as te, h as oe, l as re, i as ne, d as de, a as ie, c as ce, b as le, g as ue, v as me, w as Se } from "../chunks/add-to-dashboard-B6Ah8Lub.js";
7
- import { p as be, a as Ae, r as fe } from "../chunks/availability-Bp5Gfu1I.js";
8
- import { A as pe, a as xe, D as Te, i as Ce } from "../chunks/conversation-sQiWYUOb.js";
9
- const y = [
2
+ import { s as g } from "../chunks/analytics-base-schemas-BaIQrEzX.js";
3
+ import { a as p, A as s, b as x, c } from "../chunks/context-BTLBjQNh.js";
4
+ import { e as L, k as B, l as q, o as F, g as U, d as M, n as $, h as P, m as j, i as w, j as V, f as Y, r as H } from "../chunks/context-BTLBjQNh.js";
5
+ import { t as C } from "../chunks/add-to-dashboard-DhP8wVtM.js";
6
+ import { A as K, n as W, C as G, e as X, M as z, l as Q, k as Z, f as ee, p as se, r as ae, u as te, x as oe, q as re, s as ne, h as de, m as ie, o as ce, i as le, d as ue, a as Se, j as Ae, c as me, b as he, g as be, v as fe, w as Te } from "../chunks/add-to-dashboard-DhP8wVtM.js";
7
+ import { p as pe, a as xe, r as Ce } from "../chunks/availability-Bp5Gfu1I.js";
8
+ import { A as ye, a as Ie, D as Ee, i as Ne } from "../chunks/conversation-sQiWYUOb.js";
9
+ const _ = [
10
10
  "matrix",
11
11
  "no_query",
12
12
  "document_section",
13
13
  "blocked",
14
14
  "pending"
15
- ], _ = e.object({
15
+ ], y = e.object({
16
16
  turnId: e.string().min(1).max(s.idChars),
17
17
  conversationId: e.string().min(1).max(s.idChars).optional(),
18
18
  message: e.string().min(1).max(s.messageChars),
19
- context: x,
20
- addedSources: e.array(p).max(s.addedSources),
19
+ context: p,
20
+ addedSources: e.array(g).max(s.addedSources),
21
21
  selectedCardRequest: e.object({
22
22
  cardId: e.string().min(1).max(s.idChars),
23
23
  connectionId: e.string().min(1).max(s.idChars),
@@ -25,19 +25,19 @@ const y = [
25
25
  }).strict().optional(),
26
26
  selectedCardUnavailable: e.object({
27
27
  cardId: e.string().min(1).max(s.idChars),
28
- reason: e.enum(y),
28
+ reason: e.enum(_),
29
29
  message: e.string().max(s.textChars).optional()
30
30
  }).strict().optional(),
31
- taggedFields: e.array(T).max(s.taggedFields).optional(),
31
+ taggedFields: e.array(x).max(s.taggedFields).optional(),
32
32
  // The document's own shape is the dashboard's; propose reads it through
33
33
  // the resolver and the save's validation. Here only what routes it.
34
34
  openDashboard: e.object({ id: e.string().min(1).max(s.idChars), sheets: e.array(e.unknown()) }).passthrough().optional()
35
- }).strict(), g = s.requestBytes + s.openDashboardBytes;
36
- function v(r) {
37
- var A;
35
+ }).strict(), T = s.requestBytes + s.openDashboardBytes;
36
+ function k(r) {
37
+ var b;
38
38
  const n = new TextEncoder().encode(r).length;
39
- if (n > g)
40
- return d(`body: ${n} bytes exceeds ${g}`);
39
+ if (n > T)
40
+ return d(`body: ${n} bytes exceeds ${T}`);
41
41
  let a;
42
42
  try {
43
43
  a = JSON.parse(r);
@@ -64,7 +64,7 @@ function v(r) {
64
64
  `context: ${t} bytes exceeds ${s.contextBytes}`
65
65
  );
66
66
  }
67
- const o = _.safeParse(a);
67
+ const o = y.safeParse(a);
68
68
  if (!o.success)
69
69
  return {
70
70
  ok: !1,
@@ -75,17 +75,17 @@ function v(r) {
75
75
  };
76
76
  if (!o.data.message.trim())
77
77
  return { ok: !1, code: "context_invalid", issues: ["message: must not be blank"] };
78
- const { selectedCardRequest: m, selectedCardUnavailable: S } = o.data, h = (A = o.data.context.selectedCard) == null ? void 0 : A.id, i = [
79
- ...m ? [["selectedCardRequest", m.cardId]] : [],
80
- ...S ? [["selectedCardUnavailable", S.cardId]] : []
81
- ], b = [
78
+ const { selectedCardRequest: S, selectedCardUnavailable: A } = o.data, m = (b = o.data.context.selectedCard) == null ? void 0 : b.id, i = [
79
+ ...S ? [["selectedCardRequest", S.cardId]] : [],
80
+ ...A ? [["selectedCardUnavailable", A.cardId]] : []
81
+ ], h = [
82
82
  ...i.length > 1 ? ["selectedCardRequest, selectedCardUnavailable: send one of them, not both"] : [],
83
- ...i.filter(([, t]) => t !== h).map(([t]) => `${t}: not the card the context asks about`),
84
- ...h && i.length === 0 ? ["selectedCardRequest: the asked-about card needs its request or selectedCardUnavailable"] : [],
83
+ ...i.filter(([, t]) => t !== m).map(([t]) => `${t}: not the card the context asks about`),
84
+ ...m && i.length === 0 ? ["selectedCardRequest: the asked-about card needs its request or selectedCardUnavailable"] : [],
85
85
  ...C(o.data.context, o.data.taggedFields ?? []),
86
86
  ...I(o.data.context, o.data.openDashboard)
87
87
  ];
88
- return b.length ? { ok: !1, code: "context_invalid", issues: b } : { ok: !0, value: o.data };
88
+ return h.length ? { ok: !1, code: "context_invalid", issues: h } : { ok: !0, value: o.data };
89
89
  }
90
90
  function I(r, n) {
91
91
  var a;
@@ -95,53 +95,58 @@ function d(r) {
95
95
  return { ok: !1, code: "context_too_large", issues: [r] };
96
96
  }
97
97
  export {
98
- J as ANSWER_PART_PLACEMENT,
99
- K as ASSISTANT_CARD_TYPES,
100
- y as ASSISTANT_CARD_UNAVAILABLE_REASONS,
101
- O as ASSISTANT_CONTEXT_VERSION,
102
- pe as ASSISTANT_LAYOUTS,
98
+ K as ANSWER_PART_PLACEMENT,
99
+ W as ASSISTANT_CARD_TYPES,
100
+ _ as ASSISTANT_CARD_UNAVAILABLE_REASONS,
101
+ L as ASSISTANT_CONTEXT_VERSION,
102
+ ye as ASSISTANT_LAYOUTS,
103
103
  s as ASSISTANT_LIMITS,
104
- xe as ASSISTANT_NAME_MAX_CHARS,
105
- q as ASSISTANT_PARTS_VERSION,
106
- L as ASSISTANT_REFUSAL_MESSAGES,
107
- g as ASSISTANT_TURN_BODY_BYTES,
108
- F as AssistantContextTooLargeError,
109
- W as COPIED_CONVERSATION_FIELDS,
104
+ Ie as ASSISTANT_NAME_MAX_CHARS,
105
+ B as ASSISTANT_PARTS_VERSION,
106
+ q as ASSISTANT_REFUSAL_CODES,
107
+ F as ASSISTANT_REFUSAL_MESSAGES,
108
+ U as ASSISTANT_SURFACES,
109
+ T as ASSISTANT_TURN_BODY_BYTES,
110
+ M as AssistantContextTooLargeError,
111
+ G as COPIED_CONVERSATION_FIELDS,
110
112
  X as COPIED_TURN_FIELDS,
111
- Te as DEFAULT_ASSISTANT_NAME,
112
- z as addableSourceKey,
113
- G as answerTextOf,
114
- T as assistantCardFieldSchema,
115
- x as assistantContextSchema,
113
+ Ee as DEFAULT_ASSISTANT_NAME,
114
+ z as MODEL_CHANGE_STALE_VALUES_SHOWN,
115
+ Q as addableSourceKey,
116
+ Z as answerTextOf,
117
+ x as assistantCardFieldSchema,
118
+ p as assistantContextSchema,
116
119
  c as assistantJsonBytes,
117
120
  $ as assistantRefusalMessage,
118
- U as compareAssistantContexts,
119
- H as conversationText,
120
- M as dailyLimitMessage,
121
- j as describeCardField,
122
- w as describeSource,
123
- P as fitAssistantText,
124
- Ce as isAssistantLayout,
125
- Q as modelChangeLinkOutcomeWords,
126
- Z as modelChangeLinkRefusal,
127
- ee as modelChangeOutcomeUnclear,
128
- se as modelChangeRefusalMessage,
129
- be as parseAssistantTokenConfig,
130
- v as parseAssistantTurnRequest,
131
- ae as questionForModel,
132
- Ae as readAssistantTokenConfig,
133
- V as renderContextForModel,
134
- fe as resolveAssistantAvailability,
135
- te as sameCardField,
136
- oe as showsInAnswerBody,
137
- re as sourceRefLabel,
138
- ne as storedPartKind,
139
- de as storedTurnEnding,
140
- ie as taggableFields,
121
+ P as compareAssistantContexts,
122
+ ee as conversationText,
123
+ j as dailyLimitMessage,
124
+ w as describeCardField,
125
+ V as describeSource,
126
+ Y as fitAssistantText,
127
+ Ne as isAssistantLayout,
128
+ se as modelChangeLinkOutcomeWords,
129
+ ae as modelChangeLinkRefusal,
130
+ te as modelChangeOutcomeUnclear,
131
+ oe as modelChangeRefusalMessage,
132
+ pe as parseAssistantTokenConfig,
133
+ k as parseAssistantTurnRequest,
134
+ re as questionForModel,
135
+ xe as readAssistantTokenConfig,
136
+ H as renderContextForModel,
137
+ Ce as resolveAssistantAvailability,
138
+ ne as sameCardField,
139
+ de as showsInAnswerBody,
140
+ ie as sourceRefLabel,
141
+ ce as staleValuesOf,
142
+ le as storedPartKind,
143
+ ue as storedTurnEnding,
144
+ Se as taggableFields,
141
145
  C as taggedFieldIssues,
142
- ce as toTranscriptChunks,
143
- le as toTranscriptPart,
144
- ue as toolName,
145
- me as visualInputOf,
146
- Se as workingNotesOf
146
+ Ae as textPartKind,
147
+ me as toTranscriptChunks,
148
+ he as toTranscriptPart,
149
+ be as toolName,
150
+ fe as visualInputOf,
151
+ Te as workingNotesOf
147
152
  };
@@ -5,7 +5,7 @@ import "zod";
5
5
  import "../chunks/matrix-operation-contract-DCVinw1o.js";
6
6
  import "../chunks/analytics-base-schemas-BaIQrEzX.js";
7
7
  import "../value-format-preferences/index.js";
8
- import { A as g, J as l, a2 as B, F as m, a4 as E, z as c, B as I, E as T, K as d, C, D as u, M as A, Z as h, i as p, _ as D, $ as _, a5 as b, n as F, l as S, m as R, P as N, k as y, R as M, f as O, e as G, S as v, u as x, q as L, c as U, d as V, I as z, H, h as J, b as P, a as q, a6 as X, g as K, a0 as Q, V as Y, a3 as j, W as k, G as W, a1 as Z, r as $, j as w, X as ee, Y as ie, o as ae, L as re, Q as te, O as se, p as ne, s as oe, t as fe, N as ge, T as le, U as Be } from "../chunks/index-8BxDk8EP.js";
8
+ import { A as g, J as l, a2 as B, F as m, a4 as E, z as c, B as I, E as T, K as d, C, D as u, M as A, Z as h, i as p, _ as D, $ as _, a5 as b, n as F, l as S, m as R, P as N, k as y, R as M, f as O, e as G, S as v, u as x, q as L, c as U, d as V, I as z, H, h as J, b as P, a as q, a6 as X, g as K, a0 as Q, V as Y, a3 as j, W as k, G as W, a1 as Z, r as $, j as w, X as ee, Y as ie, o as ae, L as re, Q as te, O as se, p as ne, s as oe, t as fe, N as ge, T as le, U as Be } from "../chunks/index-BMZq6JT6.js";
9
9
  export {
10
10
  g as BRIEFING_ARTIFACT_FORMATS,
11
11
  l as BRIEFING_ATTACHMENT_FORMATS,
@@ -0,0 +1,291 @@
1
+ import { A as c, i as y, o as h } from "./context-BTLBjQNh.js";
2
+ function f(e, t) {
3
+ return e.role === t.role && e.name === t.name && e.aggregate === t.aggregate && e.granularity === t.granularity;
4
+ }
5
+ function S(e) {
6
+ var n, s;
7
+ const t = (n = e.selectedCard) == null ? void 0 : n.description;
8
+ return (t == null ? void 0 : t.status) !== "described" || t.sql || ((s = e.editing) == null ? void 0 : s.mode) === "sql" ? [] : t.fields;
9
+ }
10
+ function M(e, t) {
11
+ if (t.length === 0) return [];
12
+ if (t.length > c.taggedFields)
13
+ return [`taggedFields: at most ${c.taggedFields}`];
14
+ const n = S(e);
15
+ return t.flatMap((s, a) => n.some((o) => f(o, s)) ? t.slice(0, a).some((o) => f(o, s)) ? [`taggedFields.${a}: tagged twice`] : [] : [`taggedFields.${a}: not a field of the card the context asks about`]);
16
+ }
17
+ function q(e, t) {
18
+ return t != null && t.length ? `Fields of the asked-about card the user tagged in this question: ${t.map(y).join("; ")}.
19
+
20
+ ${e}` : e;
21
+ }
22
+ function C(e) {
23
+ if (e.kind === "text") return { type: "text", text: e.text };
24
+ const { kind: t, ...n } = e;
25
+ return {
26
+ type: `data-${t}`,
27
+ ...e.kind === "stage" ? { id: e.stageId } : {},
28
+ data: n
29
+ };
30
+ }
31
+ function U(e, t) {
32
+ return e.kind !== "text" ? [C(e)] : [
33
+ { type: "text-start", id: t },
34
+ { type: "text-delta", id: t, delta: e.text },
35
+ { type: "text-end", id: t }
36
+ ];
37
+ }
38
+ function T(e) {
39
+ if (e === "failed" || e === "interrupted")
40
+ return { kind: "refusal", code: "model_unavailable", message: h.model_unavailable };
41
+ if (e === "running")
42
+ return { kind: "refusal", code: "turn_in_progress", message: h.turn_in_progress };
43
+ }
44
+ function $(e, t) {
45
+ let n = -1;
46
+ e.forEach((a, o) => {
47
+ t(a) === "text" && (n = o);
48
+ });
49
+ let s = -1;
50
+ return e.forEach((a, o) => {
51
+ o < n && t(a) === "step" && (s = o);
52
+ }), new Set(e.filter((a, o) => o < s && t(a) === "text"));
53
+ }
54
+ const p = {
55
+ conversation: "nowhere",
56
+ text: "body",
57
+ stage: "details",
58
+ using: "details",
59
+ clarify: "body",
60
+ artifact: "body",
61
+ refusal: "body",
62
+ trace: "details",
63
+ proposal: "body",
64
+ proposal_operations: "nowhere",
65
+ proposal_refused: "body",
66
+ model_change: "body"
67
+ };
68
+ function P(e) {
69
+ return Object.hasOwn(p, e) && p[e] === "body";
70
+ }
71
+ function b(e) {
72
+ return e.kind === "text" ? v(e.text) : e.kind === "stage" && !e.change ? "step" : "other";
73
+ }
74
+ function v(e) {
75
+ return e.trim().length > 0 ? "text" : "other";
76
+ }
77
+ function V(e) {
78
+ const t = $(e, b);
79
+ return e.flatMap((n) => n.kind === "text" && !t.has(n) ? [n.text] : []).filter((n) => n.trim().length > 0).join(`
80
+
81
+ `);
82
+ }
83
+ const B = 5;
84
+ function K(e) {
85
+ if (!Array.isArray(e)) return;
86
+ const t = e.filter(
87
+ (n) => !!n && typeof n == "object" && typeof n.what == "string" && typeof n.now == "string"
88
+ );
89
+ return t.length > 0 ? t.map(({ what: n, now: s }) => ({ what: n, now: s })) : void 0;
90
+ }
91
+ const k = {
92
+ proposal_not_found: "This suggestion has expired. Ask for a new one.",
93
+ proposal_stale: "The data model changed while these were being added. Nothing was added; ask for a new suggestion.",
94
+ not_permitted: "You don’t have permission to change the data model.",
95
+ apply_in_progress: "They’re still being added.",
96
+ apply_outcome_unknown: "It isn’t clear whether they were added. Check the data model before asking again."
97
+ }, A = "They couldn’t be added.", N = {
98
+ ...k,
99
+ proposal_stale: "Someone changed these in the data model since they were suggested. Nothing was saved; ask for a new suggestion.",
100
+ apply_in_progress: "They’re still being saved.",
101
+ apply_outcome_unknown: "It isn’t clear whether they were saved. Check the data model before asking again."
102
+ }, E = "They couldn’t be saved.", g = {
103
+ exists: () => "it’s already in the model",
104
+ missing_fields: (e) => `a dataset or field it uses is no longer in ${e}`,
105
+ type_mismatch: () => "its fields’ types don’t match",
106
+ not_supported: () => "the data doesn’t support it"
107
+ };
108
+ function x(e, t) {
109
+ switch (e == null ? void 0 : e.status) {
110
+ case "added":
111
+ return "added";
112
+ case "existing":
113
+ return "already in the model";
114
+ case "left_out":
115
+ return "left out";
116
+ case "refused":
117
+ return `not added: ${O(e.reasons, t)}`;
118
+ default:
119
+ return "outcome unknown";
120
+ }
121
+ }
122
+ function O(e, t) {
123
+ const n = e.find((s) => Object.hasOwn(g, s));
124
+ return n ? g[n](t) : "it no longer fits the model";
125
+ }
126
+ function m(e) {
127
+ return e === "apply_outcome_unknown";
128
+ }
129
+ function w(e, t) {
130
+ const n = t === "edits" ? N : k;
131
+ return typeof e == "string" && Object.hasOwn(n, e) ? n[e] : t === "edits" ? E : A;
132
+ }
133
+ const z = {
134
+ conversationId: "with tool calls",
135
+ addedSources: "left out",
136
+ allows: "left out",
137
+ turns: "shown"
138
+ }, J = {
139
+ turnId: "left out",
140
+ startedAt: "shown",
141
+ // the first turn's, in the header
142
+ message: "shown",
143
+ taggedFields: "shown",
144
+ // before the question, as the assistant reads them
145
+ parts: "shown",
146
+ outcome: "shown",
147
+ // a turn that didn't end with its answer says so
148
+ toolCalls: "with tool calls",
149
+ model: "with tool calls",
150
+ instructionsVersion: "with tool calls"
151
+ };
152
+ function W(e, t) {
153
+ var o;
154
+ const n = (o = e.turns[0]) == null ? void 0 : o.startedAt, s = [
155
+ `${t.assistantName} conversation${n ? ` · ${n.slice(0, 16).replace("T", " ")} UTC` : ""}`,
156
+ ...t.toolCalls ? [`Conversation ${e.conversationId}`] : []
157
+ ], a = e.turns.map((r) => {
158
+ const d = [`You: ${I(r)}`, "", `${t.assistantName}:`], i = T(r.outcome), l = [...r.parts, ...i ? [i] : []];
159
+ return d.push(...L(l)), t.toolCalls && r.toolCalls && d.push(...F(r.toolCalls, r.model, r.instructionsVersion)), d.join(`
160
+ `);
161
+ });
162
+ return [s.join(`
163
+ `), ...a].join(`
164
+
165
+ `) + `
166
+ `;
167
+ }
168
+ function I(e) {
169
+ return [...(e.taggedFields ?? []).map((n) => `@${n.label}`), e.message].join(" ");
170
+ }
171
+ function L(e) {
172
+ const t = $(e, b), n = /* @__PURE__ */ new Set(), s = [];
173
+ for (const a of e)
174
+ switch (a.kind) {
175
+ case "text":
176
+ !t.has(a) && a.text.trim() && s.push(a.text.trim());
177
+ break;
178
+ case "proposal":
179
+ s.push("Dashboard changes", ...a.changes.filter((o) => o.sentence).map((o) => `+ ${o.sentence}`));
180
+ break;
181
+ case "proposal_refused":
182
+ s.push("Not added", `! ${a.message}`);
183
+ break;
184
+ case "model_change":
185
+ s.push(...R(a));
186
+ break;
187
+ case "clarify":
188
+ s.push(
189
+ a.multiple ? `${a.question} (pick any)` : a.question,
190
+ ...a.options.map((o, r) => ` ${r + 1}. ${o.label}`)
191
+ );
192
+ break;
193
+ case "artifact":
194
+ s.push(`[Result: ${a.artifact.title}]`);
195
+ break;
196
+ case "refusal":
197
+ s.push(a.message);
198
+ break;
199
+ case "stage":
200
+ n.add(a.stageId);
201
+ break;
202
+ case "using":
203
+ case "trace":
204
+ case "conversation":
205
+ case "proposal_operations":
206
+ break;
207
+ default:
208
+ return a;
209
+ }
210
+ return n.size && s.push(`(${n.size} ${n.size === 1 ? "step" : "steps"})`), s;
211
+ }
212
+ function F(e, t, n) {
213
+ const s = ["", "Tool calls:"];
214
+ return (t || n) && s.push(` model ${t ?? "unknown"}${n ? ` · instructions ${n}` : ""}`), e.length || s.push(" none"), e.forEach((a, o) => {
215
+ var u;
216
+ const r = a.durationMs === void 0 ? "" : ` · ${a.durationMs} ms`, d = a.rowCount === void 0 ? "" : ` · ${a.rowCount} ${a.rowCount === 1 ? "row" : "rows"}`, i = a.ok || (u = a.error) == null ? void 0 : u.trim(), l = i && !i.includes(`
217
+ `) ? `: ${i}` : "";
218
+ s.push(` ${o + 1}. ${D(a.tool)}${r}${d} · ${a.ok ? "ok" : `failed${l}`}`), i && !l && s.push(" error:", ..._(i)), i && !l && s.push(" input:"), s.push(..._(JSON.stringify(a.input ?? {}, null, 2)));
219
+ }), s;
220
+ }
221
+ function _(e) {
222
+ return e.split(`
223
+ `).map((t) => ` ${t}`);
224
+ }
225
+ function D(e) {
226
+ return e.replace(/^semaphor_/, "");
227
+ }
228
+ function R(e) {
229
+ const t = e.changes.map((s) => s.sentence ?? s.op), n = e.outcome;
230
+ if (e.changeKind === "edits") {
231
+ const s = n ? n.status === "applied" ? "saved" : n.status === "dismissed" ? "not saved: Not now" : `${m(n.code) ? "unclear whether saved" : "not saved"}: ${w(n.code, "edits")}` : "proposed", a = (n == null ? void 0 : n.status) === "refused" ? (n.changed ?? []).map((o) => ` Changed since: ${o.what} is now ${o.now}`) : [];
232
+ return [`Data model change (${s})`, ...t.map((o) => `+ ${o}`), ...a];
233
+ }
234
+ return n ? n.status === "dismissed" ? ["Data model change (not added: Not now)", ...t.map((s) => `+ ${s}`)] : n.status === "refused" ? [`Data model change (${m(n.code) ? "unclear whether added" : "not added"}: ${w(n.code)})`, ...t.map((a) => `+ ${a}`)] : [
235
+ "Data model change",
236
+ ...t.map((s, a) => `+ ${s} (${x(n.links[a], e.domainLabel)})`)
237
+ ] : ["Data model change (proposed)", ...t.map((s) => `+ ${s}`)];
238
+ }
239
+ function Y(e) {
240
+ if (e.kind === "semantic") return JSON.stringify(["semantic", e.domainId, e.datasetName]);
241
+ if (e.kind === "sql") return JSON.stringify(["sql", e.connectionId]);
242
+ }
243
+ function G(e) {
244
+ return e.label ?? (e.kind === "semantic" ? e.datasetName : e.kind === "physical" ? e.tableName : "SQL");
245
+ }
246
+ function H(e) {
247
+ return {
248
+ columns: e.columns,
249
+ records: e.records,
250
+ rowCount: e.rowCount,
251
+ governed: e.status.governed,
252
+ complete: e.status.complete,
253
+ truncated: e.status.truncated
254
+ };
255
+ }
256
+ const Q = {
257
+ number: "kpi",
258
+ line: "line",
259
+ bar: "bar",
260
+ stackedBar: "stackedBar",
261
+ table: "table"
262
+ };
263
+ export {
264
+ p as A,
265
+ z as C,
266
+ B as M,
267
+ S as a,
268
+ C as b,
269
+ U as c,
270
+ T as d,
271
+ J as e,
272
+ W as f,
273
+ D as g,
274
+ P as h,
275
+ b as i,
276
+ v as j,
277
+ V as k,
278
+ Y as l,
279
+ G as m,
280
+ Q as n,
281
+ K as o,
282
+ x as p,
283
+ q,
284
+ O as r,
285
+ f as s,
286
+ M as t,
287
+ m as u,
288
+ H as v,
289
+ $ as w,
290
+ w as x
291
+ };