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,267 +0,0 @@
1
- import { A as c, h as k, m as f } from "./context-R31TSL5V.js";
2
- function h(e, t) {
3
- return e.role === t.role && e.name === t.name && e.aggregate === t.aggregate && e.granularity === t.granularity;
4
- }
5
- function _(e) {
6
- var o, s;
7
- const t = (o = e.selectedCard) == null ? void 0 : o.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 D(e, t) {
11
- if (t.length === 0) return [];
12
- if (t.length > c.taggedFields)
13
- return [`taggedFields: at most ${c.taggedFields}`];
14
- const o = _(e);
15
- return t.flatMap((s, n) => o.some((a) => h(a, s)) ? t.slice(0, n).some((a) => h(a, s)) ? [`taggedFields.${n}: tagged twice`] : [] : [`taggedFields.${n}: not a field of the card the context asks about`]);
16
- }
17
- function R(e, t) {
18
- return t != null && t.length ? `Fields of the asked-about card the user tagged in this question: ${t.map(k).join("; ")}.
19
-
20
- ${e}` : e;
21
- }
22
- function y(e) {
23
- if (e.kind === "text") return { type: "text", text: e.text };
24
- const { kind: t, ...o } = e;
25
- return {
26
- type: `data-${t}`,
27
- ...e.kind === "stage" ? { id: e.stageId } : {},
28
- data: o
29
- };
30
- }
31
- function j(e, t) {
32
- return e.kind !== "text" ? [y(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 S(e) {
39
- if (e === "failed" || e === "interrupted")
40
- return { kind: "refusal", code: "model_unavailable", message: f.model_unavailable };
41
- if (e === "running")
42
- return { kind: "refusal", code: "turn_in_progress", message: f.turn_in_progress };
43
- }
44
- function b(e, t) {
45
- let o = -1;
46
- e.forEach((n, a) => {
47
- t(n) === "text" && (o = a);
48
- });
49
- let s = -1;
50
- return e.forEach((n, a) => {
51
- a < o && t(n) === "step" && (s = a);
52
- }), new Set(e.filter((n, a) => a < s && t(n) === "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 q(e) {
69
- return Object.hasOwn(p, e) && p[e] === "body";
70
- }
71
- function $(e) {
72
- return e.kind === "text" ? "text" : e.kind === "stage" && !e.change ? "step" : "other";
73
- }
74
- function M(e) {
75
- const t = b(e, $);
76
- return e.flatMap((o) => o.kind === "text" && !t.has(o) ? [o.text] : []).filter((o) => o.trim().length > 0).join(`
77
-
78
- `);
79
- }
80
- const g = {
81
- proposal_not_found: "This suggestion has expired. Ask for a new one.",
82
- proposal_stale: "The data model changed while these were being added. Nothing was added; ask for a new suggestion.",
83
- not_permitted: "You don’t have permission to change the data model.",
84
- apply_in_progress: "They’re still being added.",
85
- apply_outcome_unknown: "It isn’t clear whether they were added. Check the data model before asking again."
86
- }, C = "They couldn’t be added.", m = {
87
- exists: () => "it’s already in the model",
88
- missing_fields: (e) => `a dataset or field it uses is no longer in ${e}`,
89
- type_mismatch: () => "its fields’ types don’t match",
90
- not_supported: () => "the data doesn’t support it"
91
- };
92
- function T(e, t) {
93
- switch (e == null ? void 0 : e.status) {
94
- case "added":
95
- return "added";
96
- case "existing":
97
- return "already in the model";
98
- case "left_out":
99
- return "left out";
100
- case "refused":
101
- return `not added: ${N(e.reasons, t)}`;
102
- default:
103
- return "outcome unknown";
104
- }
105
- }
106
- function N(e, t) {
107
- const o = e.find((s) => Object.hasOwn(m, s));
108
- return o ? m[o](t) : "it no longer fits the model";
109
- }
110
- function A(e) {
111
- return e === "apply_outcome_unknown";
112
- }
113
- function x(e) {
114
- return typeof e == "string" && Object.hasOwn(g, e) ? g[e] : C;
115
- }
116
- const P = {
117
- conversationId: "with tool calls",
118
- addedSources: "left out",
119
- allows: "left out",
120
- turns: "shown"
121
- }, U = {
122
- turnId: "left out",
123
- startedAt: "shown",
124
- // the first turn's, in the header
125
- message: "shown",
126
- taggedFields: "shown",
127
- // before the question, as the assistant reads them
128
- parts: "shown",
129
- outcome: "shown",
130
- // a turn that didn't end with its answer says so
131
- toolCalls: "with tool calls",
132
- model: "with tool calls",
133
- instructionsVersion: "with tool calls"
134
- };
135
- function B(e, t) {
136
- var a;
137
- const o = (a = e.turns[0]) == null ? void 0 : a.startedAt, s = [
138
- `${t.assistantName} conversation${o ? ` · ${o.slice(0, 16).replace("T", " ")} UTC` : ""}`,
139
- ...t.toolCalls ? [`Conversation ${e.conversationId}`] : []
140
- ], n = e.turns.map((r) => {
141
- const d = [`You: ${I(r)}`, "", `${t.assistantName}:`], i = S(r.outcome), l = [...r.parts, ...i ? [i] : []];
142
- return d.push(...v(l)), t.toolCalls && r.toolCalls && d.push(...O(r.toolCalls, r.model, r.instructionsVersion)), d.join(`
143
- `);
144
- });
145
- return [s.join(`
146
- `), ...n].join(`
147
-
148
- `) + `
149
- `;
150
- }
151
- function I(e) {
152
- return [...(e.taggedFields ?? []).map((o) => `@${o.label}`), e.message].join(" ");
153
- }
154
- function v(e) {
155
- const t = b(e, $), o = /* @__PURE__ */ new Set(), s = [];
156
- for (const n of e)
157
- switch (n.kind) {
158
- case "text":
159
- !t.has(n) && n.text.trim() && s.push(n.text.trim());
160
- break;
161
- case "proposal":
162
- s.push("Dashboard changes", ...n.changes.filter((a) => a.sentence).map((a) => `+ ${a.sentence}`));
163
- break;
164
- case "proposal_refused":
165
- s.push("Not added", `! ${n.message}`);
166
- break;
167
- case "model_change":
168
- s.push(...F(n));
169
- break;
170
- case "clarify":
171
- s.push(
172
- n.multiple ? `${n.question} (pick any)` : n.question,
173
- ...n.options.map((a, r) => ` ${r + 1}. ${a.label}`)
174
- );
175
- break;
176
- case "artifact":
177
- s.push(`[Result: ${n.artifact.title}]`);
178
- break;
179
- case "refusal":
180
- s.push(n.message);
181
- break;
182
- case "stage":
183
- o.add(n.stageId);
184
- break;
185
- case "using":
186
- case "trace":
187
- case "conversation":
188
- case "proposal_operations":
189
- break;
190
- default:
191
- return n;
192
- }
193
- return o.size && s.push(`(${o.size} ${o.size === 1 ? "step" : "steps"})`), s;
194
- }
195
- function O(e, t, o) {
196
- const s = ["", "Tool calls:"];
197
- return (t || o) && s.push(` model ${t ?? "unknown"}${o ? ` · instructions ${o}` : ""}`), e.length || s.push(" none"), e.forEach((n, a) => {
198
- var u;
199
- const r = n.durationMs === void 0 ? "" : ` · ${n.durationMs} ms`, d = n.rowCount === void 0 ? "" : ` · ${n.rowCount} ${n.rowCount === 1 ? "row" : "rows"}`, i = n.ok || (u = n.error) == null ? void 0 : u.trim(), l = i && !i.includes(`
200
- `) ? `: ${i}` : "";
201
- s.push(` ${a + 1}. ${E(n.tool)}${r}${d} · ${n.ok ? "ok" : `failed${l}`}`), i && !l && s.push(" error:", ...w(i)), i && !l && s.push(" input:"), s.push(...w(JSON.stringify(n.input ?? {}, null, 2)));
202
- }), s;
203
- }
204
- function w(e) {
205
- return e.split(`
206
- `).map((t) => ` ${t}`);
207
- }
208
- function E(e) {
209
- return e.replace(/^semaphor_/, "");
210
- }
211
- function F(e) {
212
- const t = e.changes.map((s) => s.sentence ?? s.op), o = e.outcome;
213
- return o ? o.status === "dismissed" ? ["Data model change (not added: Not now)", ...t.map((s) => `+ ${s}`)] : o.status === "refused" ? [`Data model change (${A(o.code) ? "unclear whether added" : "not added"}: ${x(o.code)})`, ...t.map((n) => `+ ${n}`)] : [
214
- "Data model change",
215
- ...t.map((s, n) => `+ ${s} (${T(o.links[n], e.domainLabel)})`)
216
- ] : ["Data model change (proposed)", ...t.map((s) => `+ ${s}`)];
217
- }
218
- function z(e) {
219
- if (e.kind === "semantic") return JSON.stringify(["semantic", e.domainId, e.datasetName]);
220
- if (e.kind === "sql") return JSON.stringify(["sql", e.connectionId]);
221
- }
222
- function J(e) {
223
- return e.label ?? (e.kind === "semantic" ? e.datasetName : e.kind === "physical" ? e.tableName : "SQL");
224
- }
225
- function K(e) {
226
- return {
227
- columns: e.columns,
228
- records: e.records,
229
- rowCount: e.rowCount,
230
- governed: e.status.governed,
231
- complete: e.status.complete,
232
- truncated: e.status.truncated
233
- };
234
- }
235
- const V = {
236
- number: "kpi",
237
- line: "line",
238
- bar: "bar",
239
- stackedBar: "stackedBar",
240
- table: "table"
241
- };
242
- export {
243
- p as A,
244
- P as C,
245
- _ as a,
246
- y as b,
247
- j as c,
248
- S as d,
249
- U as e,
250
- B as f,
251
- E as g,
252
- q as h,
253
- $ as i,
254
- M as j,
255
- z as k,
256
- J as l,
257
- V as m,
258
- T as n,
259
- N as o,
260
- A as p,
261
- R as q,
262
- x as r,
263
- h as s,
264
- D as t,
265
- K as v,
266
- b as w
267
- };