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.
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +75 -70
- package/dist/briefings/index.js +1 -1
- package/dist/chunks/add-to-dashboard-DhP8wVtM.js +291 -0
- package/dist/chunks/{assistant-chat-B_tmsxEK.js → assistant-chat-CUwGURJj.js} +2261 -2184
- package/dist/chunks/{bookmark-impact-DUWw3wlA.js → bookmark-impact-BNyR-yDX.js} +1 -1
- package/dist/chunks/{card-filter-builder-CwnMUZU2.js → card-filter-builder-k9yqDSw8.js} +168 -180
- package/dist/chunks/{comparison-window-caption-PtcDWvkN.js → comparison-window-caption-DdLqMgiG.js} +180 -183
- package/dist/chunks/{context-R31TSL5V.js → context-BTLBjQNh.js} +99 -83
- package/dist/chunks/{dashboard-BcIIBCTP.js → dashboard-DvcAk8uJ.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-BBpECqg2.js → dashboard-briefing-launcher-DBgS97ZH.js} +155 -155
- package/dist/chunks/{dashboard-controls-CONzvjmO.js → dashboard-controls-BiZ1rlNC.js} +7 -7
- package/dist/chunks/{dashboard-json-BF2chEVd.js → dashboard-json-B25xzYcJ.js} +1 -1
- package/dist/chunks/{dates-DlYMDaF2.js → dates-3Pah03_l.js} +5 -5
- package/dist/chunks/{edit-dashboard-visual-Bf-RcbuD.js → edit-dashboard-visual-DYuO3mEU.js} +9 -10
- package/dist/chunks/{filter-reach-copy-BTAXnbwQ.js → filter-reach-copy-CzLt96tq.js} +125 -125
- package/dist/chunks/{index-8BxDk8EP.js → index-BMZq6JT6.js} +2 -2
- package/dist/chunks/{report-preferences-dialog-RN4g9PEN.js → report-preferences-dialog-DpAetrdY.js} +7 -7
- package/dist/chunks/{resolve-dashboard-input-context-DBFuNhZo.js → resolve-dashboard-input-context-CNxtkCzj.js} +6266 -6191
- package/dist/chunks/{saved-dashboard-context-AChHk4tw.js → saved-dashboard-context-Bnt0H7mi.js} +3 -3
- package/dist/chunks/{semaphor-ready-indicator-DtivanBy.js → semaphor-ready-indicator-Dwmvmf0S.js} +15010 -14990
- package/dist/chunks/{shelf-drop-preview-context-BTjYxbHC.js → shelf-drop-preview-context-CiveteBS.js} +2 -2
- package/dist/chunks/{stored-dashboard-rpLzf4mk.js → stored-dashboard-D3gu-D7A.js} +67 -67
- package/dist/chunks/{table-export-sheet-CP8zSOhj.js → table-export-sheet-BNGSJA2N.js} +1 -1
- package/dist/chunks/{variable-draft-DPSMDwqt.js → variable-draft-C3_RL2gI.js} +2 -2
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.js +357 -350
- package/dist/format-utils/index.js +4 -4
- package/dist/index.js +12 -12
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/shared/assistant-protocol/answer-text.d.ts +5 -1
- package/dist/types/shared/assistant-protocol/context.d.ts +2 -1
- package/dist/types/shared/assistant-protocol/model-change.d.ts +23 -3
- package/dist/types/shared/assistant-protocol/parts.d.ts +12 -2
- package/dist/types/shared/dashboard-authoring/changes/aggregates.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +9 -58
- package/dist/types/shared/dashboard-authoring/changes/domain-change.d.ts +1738 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
- package/dist/types/shared/usage-events/catalog.d.ts +5 -3
- package/dist/types/shared/usage-events/details.d.ts +66 -0
- package/dist/types/shared/usage-events/envelope.d.ts +5 -5
- package/dist/usage-events/index.js +154 -115
- package/package.json +1 -1
- 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-
|
|
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
|
|
3
|
-
import { a as
|
|
4
|
-
import { e as
|
|
5
|
-
import { t as C } from "../chunks/add-to-dashboard-
|
|
6
|
-
import { A as
|
|
7
|
-
import { p as
|
|
8
|
-
import { A as
|
|
9
|
-
const
|
|
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
|
-
],
|
|
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:
|
|
20
|
-
addedSources: e.array(
|
|
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(
|
|
28
|
+
reason: e.enum(_),
|
|
29
29
|
message: e.string().max(s.textChars).optional()
|
|
30
30
|
}).strict().optional(),
|
|
31
|
-
taggedFields: e.array(
|
|
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(),
|
|
36
|
-
function
|
|
37
|
-
var
|
|
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 >
|
|
40
|
-
return d(`body: ${n} bytes exceeds ${
|
|
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 =
|
|
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:
|
|
79
|
-
...
|
|
80
|
-
...
|
|
81
|
-
],
|
|
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 !==
|
|
84
|
-
...
|
|
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
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
112
|
-
z as
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
x as
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
};
|
package/dist/briefings/index.js
CHANGED
|
@@ -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-
|
|
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
|
+
};
|