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
@@ -43,6 +43,7 @@ export * from './changes/diagnostics.js';
43
43
  export * from './changes/card-query-part.js';
44
44
  export * from './changes/read-card-query.js';
45
45
  export * from './changes/dashboard-change.js';
46
+ export * from './changes/domain-change.js';
46
47
  export { resolveDashboardChanges, type CardSource, type ChangeServices, type ChangeRef, type ChangeResolution, } from './changes/resolve-dashboard-changes.js';
47
48
  export * from './changes/resolve-dashboard-create.js';
48
49
  export * from './text-card-words/index.js';
@@ -1,12 +1,13 @@
1
1
  import { z } from 'zod';
2
- import { AutomationRunCompletedDetails, DashboardOpenedDetails, ExportCompletedDetails, QueryExecutedDetails, TokenIssuedDetails, ToolCalledDetails } from './details.js';
2
+ import { AssistantTurnCompletedDetails, AutomationRunCompletedDetails, DashboardOpenedDetails, ExportCompletedDetails, QueryExecutedDetails, TokenIssuedDetails, ToolCalledDetails } from './details.js';
3
3
  /**
4
4
  * The usage events catalog (usage-events TECH-SPEC §2.1): every event type,
5
5
  * its category, version, producer and details schema, and the vocabulary the
6
6
  * envelope and query tags share. A type lands with its producer: Phase 1 adds
7
- * `token_issued`, Phase 2 the server events, Phase 6 exports and automation runs.
7
+ * `token_issued`, Phase 2 the server events, Phase 6 exports and automation runs,
8
+ * Phase A the built-in assistant's questions.
8
9
  */
9
- export declare const USAGE_EVENT_TYPES: readonly ["token_issued", "dashboard_opened", "query_executed", "tool_called", "export_completed", "automation_run_completed"];
10
+ export declare const USAGE_EVENT_TYPES: readonly ["token_issued", "dashboard_opened", "query_executed", "tool_called", "export_completed", "automation_run_completed", "assistant_turn_completed"];
10
11
  export type UsageEventType = (typeof USAGE_EVENT_TYPES)[number];
11
12
  export declare const USAGE_EVENT_CATEGORIES: readonly ["usage", "runtime", "agent", "delivery"];
12
13
  export type UsageEventCategory = (typeof USAGE_EVENT_CATEGORIES)[number];
@@ -25,6 +26,7 @@ export type UsageEventDetailsByType = {
25
26
  tool_called: ToolCalledDetails;
26
27
  export_completed: ExportCompletedDetails;
27
28
  automation_run_completed: AutomationRunCompletedDetails;
29
+ assistant_turn_completed: AssistantTurnCompletedDetails;
28
30
  };
29
31
  export type UsageEventCatalogEntry<T extends UsageEventType> = {
30
32
  category: UsageEventCategory;
@@ -212,6 +212,8 @@ export declare const queryExecutedDetailsSchema: z.ZodObject<{
212
212
  export_job_id?: string | undefined;
213
213
  }>;
214
214
  export type QueryExecutedDetails = z.infer<typeof queryExecutedDetailsSchema>;
215
+ export declare const TOOL_CALL_ORIGINS: readonly ["assistant", "mcp"];
216
+ export type ToolCallOrigin = (typeof TOOL_CALL_ORIGINS)[number];
215
217
  export declare const toolCalledDetailsSchema: z.ZodObject<{
216
218
  tool: z.ZodString;
217
219
  args_json: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
@@ -223,7 +225,10 @@ export declare const toolCalledDetailsSchema: z.ZodObject<{
223
225
  access_mode: z.ZodOptional<z.ZodString>;
224
226
  scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
225
227
  response_bytes: z.ZodOptional<z.ZodNumber>;
228
+ /** Who called: the built-in assistant or an MCP client (Phase A, AL-D46). */
229
+ origin: z.ZodEnum<["assistant", "mcp"]>;
226
230
  }, "strict", z.ZodTypeAny, {
231
+ origin: "assistant" | "mcp";
227
232
  tool: string;
228
233
  arg_keys: string[];
229
234
  args_json?: string | undefined;
@@ -235,6 +240,7 @@ export declare const toolCalledDetailsSchema: z.ZodObject<{
235
240
  scopes?: string[] | undefined;
236
241
  response_bytes?: number | undefined;
237
242
  }, {
243
+ origin: "assistant" | "mcp";
238
244
  tool: string;
239
245
  arg_keys: string[];
240
246
  args_json?: string | undefined;
@@ -310,3 +316,63 @@ export declare const automationRunCompletedDetailsSchema: z.ZodObject<{
310
316
  scheduled_for?: string | undefined;
311
317
  }>;
312
318
  export type AutomationRunCompletedDetails = z.infer<typeof automationRunCompletedDetailsSchema>;
319
+ /** How a turn that emits ended: the assistant's own words (a running or interrupted turn never emits). */
320
+ export declare const ASSISTANT_TURN_ENDINGS: readonly ["completed", "refused", "stopped", "failed"];
321
+ /** One question to the built-in assistant (Phase A, AL-D45): never the answer, the context or a result. */
322
+ export declare const assistantTurnCompletedDetailsSchema: z.ZodObject<{
323
+ /** Absent only when the request was refused before it could be read (no turn id was sent). */
324
+ turn_id: z.ZodOptional<z.ZodString>;
325
+ conversation_id: z.ZodOptional<z.ZodString>;
326
+ question_text: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
327
+ question_truncated: z.ZodOptional<z.ZodBoolean>;
328
+ turn_outcome: z.ZodEnum<["completed", "refused", "stopped", "failed"]>;
329
+ refusal: z.ZodOptional<z.ZodEnum<["assistant_unavailable", "context_invalid", "context_too_large", "conversation_not_found", "conversation_full", "turn_in_progress", "daily_limit_reached", "budget_exhausted", "not_permitted", "no_data_found", "model_unavailable"]>>;
330
+ context_surface: z.ZodEnum<["dashboard", "editor", "none"]>;
331
+ model: z.ZodString;
332
+ instructions_version: z.ZodString;
333
+ input_tokens: z.ZodNumber;
334
+ cached_input_tokens: z.ZodNumber;
335
+ output_tokens: z.ZodNumber;
336
+ tools: z.ZodArray<z.ZodString, "many">;
337
+ tool_call_count: z.ZodNumber;
338
+ tool_error_count: z.ZodNumber;
339
+ asked_user: z.ZodOptional<z.ZodBoolean>;
340
+ finish_reason: z.ZodOptional<z.ZodString>;
341
+ }, "strict", z.ZodTypeAny, {
342
+ model: string;
343
+ tools: string[];
344
+ turn_outcome: "failed" | "refused" | "completed" | "stopped";
345
+ context_surface: "none" | "dashboard" | "editor";
346
+ instructions_version: string;
347
+ input_tokens: number;
348
+ cached_input_tokens: number;
349
+ output_tokens: number;
350
+ tool_call_count: number;
351
+ tool_error_count: number;
352
+ refusal?: "not_permitted" | "context_too_large" | "assistant_unavailable" | "context_invalid" | "conversation_not_found" | "conversation_full" | "turn_in_progress" | "daily_limit_reached" | "budget_exhausted" | "no_data_found" | "model_unavailable" | undefined;
353
+ turn_id?: string | undefined;
354
+ conversation_id?: string | undefined;
355
+ question_text?: string | undefined;
356
+ question_truncated?: boolean | undefined;
357
+ asked_user?: boolean | undefined;
358
+ finish_reason?: string | undefined;
359
+ }, {
360
+ model: string;
361
+ tools: string[];
362
+ turn_outcome: "failed" | "refused" | "completed" | "stopped";
363
+ context_surface: "none" | "dashboard" | "editor";
364
+ instructions_version: string;
365
+ input_tokens: number;
366
+ cached_input_tokens: number;
367
+ output_tokens: number;
368
+ tool_call_count: number;
369
+ tool_error_count: number;
370
+ refusal?: "not_permitted" | "context_too_large" | "assistant_unavailable" | "context_invalid" | "conversation_not_found" | "conversation_full" | "turn_in_progress" | "daily_limit_reached" | "budget_exhausted" | "no_data_found" | "model_unavailable" | undefined;
371
+ turn_id?: string | undefined;
372
+ conversation_id?: string | undefined;
373
+ question_text?: string | undefined;
374
+ question_truncated?: boolean | undefined;
375
+ asked_user?: boolean | undefined;
376
+ finish_reason?: string | undefined;
377
+ }>;
378
+ export type AssistantTurnCompletedDetails = z.infer<typeof assistantTurnCompletedDetailsSchema>;
@@ -52,7 +52,7 @@ export type UsageEvent<T extends UsageEventType = UsageEventType> = {
52
52
  export declare const USAGE_EVENT_TEXT_MAX_BYTES: number;
53
53
  export declare const usageEventEnvelopeSchema: z.ZodObject<{
54
54
  event_id: z.ZodString;
55
- event_type: z.ZodEnum<["token_issued", "dashboard_opened", "query_executed", "tool_called", "export_completed", "automation_run_completed"]>;
55
+ event_type: z.ZodEnum<["token_issued", "dashboard_opened", "query_executed", "tool_called", "export_completed", "automation_run_completed", "assistant_turn_completed"]>;
56
56
  event_version: z.ZodNumber;
57
57
  category: z.ZodEnum<["usage", "runtime", "agent", "delivery"]>;
58
58
  occurred_at: z.ZodString;
@@ -90,7 +90,7 @@ export declare const usageEventEnvelopeSchema: z.ZodObject<{
90
90
  code: string;
91
91
  message: string;
92
92
  } | null;
93
- surface: "api" | "embed" | "console" | "public_link" | "mcp" | "scheduler" | "pdf_renderer";
93
+ surface: "api" | "embed" | "console" | "mcp" | "public_link" | "scheduler" | "pdf_renderer";
94
94
  category: "usage" | "runtime" | "delivery" | "agent";
95
95
  connection_id: string | null;
96
96
  card_id: string | null;
@@ -101,7 +101,7 @@ export declare const usageEventEnvelopeSchema: z.ZodObject<{
101
101
  dashboard_id: string | null;
102
102
  duration_ms: number | null;
103
103
  event_id: string;
104
- event_type: "token_issued" | "dashboard_opened" | "query_executed" | "tool_called" | "export_completed" | "automation_run_completed";
104
+ event_type: "token_issued" | "dashboard_opened" | "query_executed" | "tool_called" | "export_completed" | "automation_run_completed" | "assistant_turn_completed";
105
105
  event_version: number;
106
106
  occurred_at: string;
107
107
  producer: "scheduler" | "app";
@@ -119,7 +119,7 @@ export declare const usageEventEnvelopeSchema: z.ZodObject<{
119
119
  code: string;
120
120
  message: string;
121
121
  } | null;
122
- surface: "api" | "embed" | "console" | "public_link" | "mcp" | "scheduler" | "pdf_renderer";
122
+ surface: "api" | "embed" | "console" | "mcp" | "public_link" | "scheduler" | "pdf_renderer";
123
123
  category: "usage" | "runtime" | "delivery" | "agent";
124
124
  connection_id: string | null;
125
125
  card_id: string | null;
@@ -130,7 +130,7 @@ export declare const usageEventEnvelopeSchema: z.ZodObject<{
130
130
  dashboard_id: string | null;
131
131
  duration_ms: number | null;
132
132
  event_id: string;
133
- event_type: "token_issued" | "dashboard_opened" | "query_executed" | "tool_called" | "export_completed" | "automation_run_completed";
133
+ event_type: "token_issued" | "dashboard_opened" | "query_executed" | "tool_called" | "export_completed" | "automation_run_completed" | "assistant_turn_completed";
134
134
  event_version: number;
135
135
  occurred_at: string;
136
136
  producer: "scheduler" | "app";
@@ -1,12 +1,13 @@
1
1
  import { z as e } from "zod";
2
- import { Q as h, a as b, b as y } from "../chunks/attribution-BvoKvhcj.js";
3
- import { U as K, c as Z, u as J } from "../chunks/attribution-BvoKvhcj.js";
4
- const i = e.string().min(1).max(128), t = e.string().max(500), p = e.array(e.string().max(500)).max(500), r = e.number().int().nonnegative(), g = e.string().refine((o) => new TextEncoder().encode(o).length <= 16 * 1024), x = e.object({
2
+ import { g as h, l as S } from "../chunks/context-BTLBjQNh.js";
3
+ import { Q as b, a as y, b as x } from "../chunks/attribution-BvoKvhcj.js";
4
+ import { U as te, c as ne, u as ae } from "../chunks/attribution-BvoKvhcj.js";
5
+ const r = e.string().min(1).max(128), t = e.string().max(500), m = e.array(e.string().max(500)).max(500), n = e.number().int().nonnegative(), p = e.string().refine((o) => new TextEncoder().encode(o).length <= 16 * 1024), f = e.object({
5
6
  token_type: e.enum(["dashboard", "project"]),
6
7
  token_purpose: e.enum(["embed", "console"]).optional(),
7
8
  ttl_s: e.number().int().nonnegative().optional(),
8
9
  embed_origin: e.string().max(2048).optional(),
9
- initial_dashboard_id: i.optional(),
10
+ initial_dashboard_id: r.optional(),
10
11
  dashboard_title: t.optional(),
11
12
  project_name: t.optional(),
12
13
  user_verified: e.boolean(),
@@ -16,34 +17,34 @@ const i = e.string().min(1).max(128), t = e.string().max(500), p = e.array(e.str
16
17
  role: e.string().max(128).optional(),
17
18
  user_provisioned: e.boolean().optional(),
18
19
  domain_access_mode: e.enum(["all", "none", "include", "exclude"]).optional(),
19
- domain_ids: e.array(i).max(500).optional(),
20
- rls_policy_names: p.optional(),
21
- cls_policy_names: p.optional(),
20
+ domain_ids: e.array(r).max(500).optional(),
21
+ rls_policy_names: m.optional(),
22
+ cls_policy_names: m.optional(),
22
23
  has_sls: e.boolean().optional(),
23
- security_param_keys: p.optional(),
24
+ security_param_keys: m.optional(),
24
25
  timezone: e.string().max(128).optional(),
25
26
  mcp_scopes: e.array(e.string().max(128)).max(64).optional(),
26
27
  mcp_sql: e.boolean().optional(),
27
28
  mcp_live: e.boolean().optional()
28
- }).strict(), f = e.object({
29
+ }).strict(), E = e.object({
29
30
  requested_version: e.number().int().optional(),
30
31
  served: e.enum(["current", "version"]).optional(),
31
32
  dashboard_title: t.optional(),
32
33
  project_name: t.optional(),
33
- sheet_count: r.optional(),
34
- card_count: r.optional()
35
- }).strict(), E = e.object({
36
- statement: e.enum(h),
34
+ sheet_count: n.optional(),
35
+ card_count: n.optional()
36
+ }).strict(), T = e.object({
37
+ statement: e.enum(b),
37
38
  duration_ms: e.number().nonnegative(),
38
39
  outcome: e.enum(["succeeded", "failed", "cancelled"]),
39
- rows: r.optional()
40
- }).strict(), S = e.object({
41
- data_service_calls: r,
42
- query_run_id: i,
43
- parent_query_run_id: i.optional(),
44
- query_kind: e.enum(y).optional(),
45
- statements: e.array(E).max(64),
46
- trigger: e.enum(b).optional(),
40
+ rows: n.optional()
41
+ }).strict(), v = e.object({
42
+ data_service_calls: n,
43
+ query_run_id: r,
44
+ parent_query_run_id: r.optional(),
45
+ query_kind: e.enum(x).optional(),
46
+ statements: e.array(T).max(64),
47
+ trigger: e.enum(y).optional(),
47
48
  card_title: t.optional(),
48
49
  card_type: e.string().max(128).optional(),
49
50
  dashboard_title: t.optional(),
@@ -53,17 +54,17 @@ const i = e.string().min(1).max(128), t = e.string().max(500), p = e.array(e.str
53
54
  connection_type: e.string().max(128).optional(),
54
55
  dialect: e.string().max(128).optional(),
55
56
  dataset: t.optional(),
56
- rows: r.optional(),
57
+ rows: n.optional(),
57
58
  row_limit_exceeded: e.boolean().optional(),
58
- sql_text: g.optional(),
59
+ sql_text: p.optional(),
59
60
  sql_truncated: e.boolean().optional(),
60
61
  sql_hash: e.string().regex(/^[0-9a-f]{64}$/).optional(),
61
- input_ids_applied: e.array(i).max(500).optional(),
62
+ input_ids_applied: e.array(r).max(500).optional(),
62
63
  page: e.number().int().positive().optional(),
63
- export_job_id: i.optional()
64
- }).strict(), T = e.object({
64
+ export_job_id: r.optional()
65
+ }).strict(), A = ["assistant", "mcp"], q = e.object({
65
66
  tool: e.string().min(1).max(128),
66
- args_json: g.optional(),
67
+ args_json: p.optional(),
67
68
  args_truncated: e.boolean().optional(),
68
69
  arg_keys: e.array(e.string().max(128)).max(200),
69
70
  user_agent: e.string().max(1024).optional(),
@@ -71,45 +72,67 @@ const i = e.string().min(1).max(128), t = e.string().max(500), p = e.array(e.str
71
72
  credential: e.string().max(64).optional(),
72
73
  access_mode: e.string().max(64).optional(),
73
74
  scopes: e.array(e.string().max(128)).max(64).optional(),
74
- response_bytes: r.optional()
75
- }).strict(), v = ["job", "matrix_direct", "rendered"], q = ["csv", "xlsx", "pdf", "png"], A = ["visual", "card", "dashboard"], U = ["create", "acquire", "deadline", "render"], R = e.object({
76
- export_id: i.optional(),
77
- mechanism: e.enum(v),
78
- format: e.enum(q),
79
- scope: e.enum(A).optional(),
80
- rows: r.optional(),
81
- bytes: r.optional(),
82
- chunks: r.optional(),
83
- stage: e.enum(U).optional()
84
- }).strict(), O = ["export", "briefing", "cache_refresh"], j = ["scheduled", "manual", "api"], k = e.object({
85
- run_id: i,
86
- rule_id: i,
75
+ response_bytes: n.optional(),
76
+ /** Who called: the built-in assistant or an MCP client (Phase A, AL-D46). */
77
+ origin: e.enum(A)
78
+ }).strict(), U = ["job", "matrix_direct", "rendered"], R = ["csv", "xlsx", "pdf", "png"], O = ["visual", "card", "dashboard"], k = ["create", "acquire", "deadline", "render"], I = e.object({
79
+ export_id: r.optional(),
80
+ mechanism: e.enum(U),
81
+ format: e.enum(R),
82
+ scope: e.enum(O).optional(),
83
+ rows: n.optional(),
84
+ bytes: n.optional(),
85
+ chunks: n.optional(),
86
+ stage: e.enum(k).optional()
87
+ }).strict(), N = ["export", "briefing", "cache_refresh"], j = ["scheduled", "manual", "api"], D = e.object({
88
+ run_id: r,
89
+ rule_id: r,
87
90
  rule_name: t.optional(),
88
- kind: e.enum(O),
91
+ kind: e.enum(N),
89
92
  trigger_source: e.enum(j).optional(),
90
- attempt: r.optional(),
93
+ attempt: n.optional(),
91
94
  scheduled_for: e.string().datetime({ offset: !0 }).optional()
92
- }).strict(), G = [
95
+ }).strict(), G = ["completed", "refused", "stopped", "failed"], C = e.object({
96
+ /** Absent only when the request was refused before it could be read (no turn id was sent). */
97
+ turn_id: r.optional(),
98
+ conversation_id: r.optional(),
99
+ question_text: p.optional(),
100
+ question_truncated: e.boolean().optional(),
101
+ turn_outcome: e.enum(G),
102
+ refusal: e.enum(S).optional(),
103
+ context_surface: e.enum(h),
104
+ model: e.string().min(1).max(128),
105
+ instructions_version: e.string().min(1).max(128),
106
+ input_tokens: n,
107
+ cached_input_tokens: n,
108
+ output_tokens: n,
109
+ tools: e.array(e.string().min(1).max(128)).max(500),
110
+ tool_call_count: n,
111
+ tool_error_count: n,
112
+ asked_user: e.boolean().optional(),
113
+ finish_reason: e.string().max(64).optional()
114
+ }).strict(), B = [
93
115
  "token_issued",
94
116
  "dashboard_opened",
95
117
  "query_executed",
96
118
  "tool_called",
97
119
  "export_completed",
98
- "automation_run_completed"
99
- ], I = ["usage", "runtime", "agent", "delivery"], D = ["org_user", "tenant_user", "tenant", "api_key", "system", "anonymous"], N = ["console", "embed", "public_link", "mcp", "api", "scheduler", "pdf_renderer"], C = ["succeeded", "failed", "cancelled", "timed_out"], M = ["app", "scheduler"], P = {
120
+ "automation_run_completed",
121
+ "assistant_turn_completed"
122
+ ], M = ["usage", "runtime", "agent", "delivery"], P = ["org_user", "tenant_user", "tenant", "api_key", "system", "anonymous"], w = ["console", "embed", "public_link", "mcp", "api", "scheduler", "pdf_renderer"], L = ["succeeded", "failed", "cancelled", "timed_out"], X = ["app", "scheduler"], Y = {
100
123
  token_issued: {
101
124
  category: "usage",
102
125
  version: 1,
103
126
  emittedBy: "semaphor-app/src/lib/usage-events/token-issued.ts",
104
127
  personalData: !0,
105
- detailsSchema: x
128
+ detailsSchema: f
106
129
  },
107
130
  dashboard_opened: {
108
131
  category: "usage",
109
132
  version: 1,
110
133
  emittedBy: "semaphor-app/src/lib/usage-events/dashboard-opened.ts",
111
134
  personalData: !1,
112
- detailsSchema: f
135
+ detailsSchema: E
113
136
  },
114
137
  query_executed: {
115
138
  category: "runtime",
@@ -117,7 +140,7 @@ const i = e.string().min(1).max(128), t = e.string().max(500), p = e.array(e.str
117
140
  emittedBy: "semaphor-app/src/app/api/v1/query/query-run.ts",
118
141
  // sql_text holds the filter and control values the app compiled in.
119
142
  personalData: !0,
120
- detailsSchema: S
143
+ detailsSchema: v
121
144
  },
122
145
  tool_called: {
123
146
  category: "agent",
@@ -125,14 +148,14 @@ const i = e.string().min(1).max(128), t = e.string().max(500), p = e.array(e.str
125
148
  emittedBy: "semaphor-app/src/lib/mcp/tool-telemetry.ts",
126
149
  // args_json is what the agent sent.
127
150
  personalData: !0,
128
- detailsSchema: T
151
+ detailsSchema: q
129
152
  },
130
153
  export_completed: {
131
154
  category: "delivery",
132
155
  version: 1,
133
156
  emittedBy: "semaphor-app/src/lib/usage-events/export-completed.ts",
134
157
  personalData: !1,
135
- detailsSchema: R
158
+ detailsSchema: I
136
159
  },
137
160
  automation_run_completed: {
138
161
  category: "delivery",
@@ -140,52 +163,60 @@ const i = e.string().min(1).max(128), t = e.string().max(500), p = e.array(e.str
140
163
  emittedBy: "semaphor-app/src/lib/usage-events/automation-run-completed.ts",
141
164
  // rule_name is what its author typed; error.message is the run's own error text.
142
165
  personalData: !0,
143
- detailsSchema: k
166
+ detailsSchema: D
167
+ },
168
+ assistant_turn_completed: {
169
+ category: "agent",
170
+ version: 1,
171
+ emittedBy: "semaphor-app/src/lib/usage-events/assistant-turn-completed.ts",
172
+ // question_text is what the person typed (AL-D45).
173
+ personalData: !0,
174
+ detailsSchema: C
144
175
  }
145
- }, w = 16 * 1024, B = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/, X = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,9})?Z$/, Y = e.string().min(1).max(128), s = Y.nullable(), $ = e.object({
146
- event_id: e.string().regex(B),
147
- event_type: e.enum(G),
176
+ }, $ = 16 * 1024, F = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/, V = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,9})?Z$/, Q = e.string().min(1).max(128), i = Q.nullable(), H = e.object({
177
+ event_id: e.string().regex(F),
178
+ event_type: e.enum(B),
148
179
  event_version: e.number().int().positive(),
149
- category: e.enum(I),
150
- occurred_at: e.string().regex(X),
151
- producer: e.enum(M),
180
+ category: e.enum(M),
181
+ occurred_at: e.string().regex(V),
182
+ producer: e.enum(X),
152
183
  release: e.string().min(1).max(64),
153
- org_id: s,
154
- project_id: s,
155
- tenant_id: s,
156
- actor_type: e.enum(D),
157
- org_user_id: s,
158
- tenant_user_id: s,
159
- surface: e.enum(N),
160
- session_id: s,
161
- operation_id: s,
162
- dashboard_id: s,
163
- sheet_id: s,
164
- card_id: s,
165
- connection_id: s,
166
- domain_id: s,
167
- outcome: e.enum(C).nullable(),
184
+ org_id: i,
185
+ project_id: i,
186
+ tenant_id: i,
187
+ actor_type: e.enum(P),
188
+ org_user_id: i,
189
+ tenant_user_id: i,
190
+ surface: e.enum(w),
191
+ session_id: i,
192
+ operation_id: i,
193
+ dashboard_id: i,
194
+ sheet_id: i,
195
+ card_id: i,
196
+ connection_id: i,
197
+ domain_id: i,
198
+ outcome: e.enum(L).nullable(),
168
199
  duration_ms: e.number().nonnegative().nullable(),
169
200
  error: e.object({
170
201
  code: e.string().min(1).max(128),
171
- message: e.string().refine((o) => new TextEncoder().encode(o).length <= w)
202
+ message: e.string().refine((o) => new TextEncoder().encode(o).length <= $)
172
203
  }).strict().nullable(),
173
204
  details: e.unknown()
174
205
  }).strict();
175
- function F(o) {
176
- const a = $.safeParse(o);
177
- if (!a.success) return { ok: !1, issues: _(a.error.issues) };
178
- const n = a.data, d = n.event_type, c = P[d], l = [];
179
- n.event_version !== c.version && l.push("event_version: not the catalog version"), n.category !== c.category && l.push("category: not the catalog category");
180
- const m = n.outcome === "failed" || n.outcome === "timed_out";
181
- m && n.error === null && l.push("error: required when the outcome is failed or timed_out"), !m && n.error !== null && l.push("error: set only when the outcome is failed or timed_out"), l.push(...V[d](n));
182
- const u = c.detailsSchema.safeParse(n.details);
183
- return u.success || l.push(..._(u.error.issues, "details")), l.length > 0 ? { ok: !1, issues: l } : { ok: !0, event: { ...n, details: u.success ? u.data : n.details } };
206
+ function W(o) {
207
+ const s = H.safeParse(o);
208
+ if (!s.success) return { ok: !1, issues: g(s.error.issues) };
209
+ const a = s.data, d = a.event_type, u = Y[d], l = [];
210
+ a.event_version !== u.version && l.push("event_version: not the catalog version"), a.category !== u.category && l.push("category: not the catalog category");
211
+ const _ = a.outcome === "failed" || a.outcome === "timed_out";
212
+ _ && a.error === null && l.push("error: required when the outcome is failed or timed_out"), !_ && a.error !== null && l.push("error: set only when the outcome is failed or timed_out"), l.push(...z[d](a));
213
+ const c = u.detailsSchema.safeParse(a.details);
214
+ return c.success || l.push(...g(c.error.issues, "details")), l.length > 0 ? { ok: !1, issues: l } : { ok: !0, event: { ...a, details: c.success ? c.data : a.details } };
184
215
  }
185
- const V = {
216
+ const z = {
186
217
  token_issued: (o) => {
187
- const a = [];
188
- return ["org_user", "tenant_user", "tenant", "anonymous"].includes(o.actor_type) || a.push("actor_type: not a token_issued actor"), ["embed", "console", "mcp"].includes(o.surface) || a.push("surface: not a token_issued surface"), o.outcome === null && a.push("outcome: required"), o.outcome === "succeeded" && (o.session_id === null && a.push("session_id: required on success"), o.project_id === null && a.push("project_id: required on success")), a;
218
+ const s = [];
219
+ return ["org_user", "tenant_user", "tenant", "anonymous"].includes(o.actor_type) || s.push("actor_type: not a token_issued actor"), ["embed", "console", "mcp"].includes(o.surface) || s.push("surface: not a token_issued surface"), o.outcome === null && s.push("outcome: required"), o.outcome === "succeeded" && (o.session_id === null && s.push("session_id: required on success"), o.project_id === null && s.push("project_id: required on success")), s;
189
220
  },
190
221
  dashboard_opened: (o) => [
191
222
  ...o.outcome === null ? ["outcome: required"] : [],
@@ -208,39 +239,47 @@ const V = {
208
239
  automation_run_completed: (o) => [
209
240
  ...o.outcome === null ? ["outcome: required"] : [],
210
241
  ...o.duration_ms === null ? ["duration_ms: required"] : []
242
+ ],
243
+ assistant_turn_completed: (o) => [
244
+ ...o.outcome === null ? ["outcome: required"] : [],
245
+ ...o.duration_ms === null ? ["duration_ms: required"] : [],
246
+ ...o.operation_id === null ? ["operation_id: required"] : []
211
247
  ]
212
248
  };
213
- function _(o, a) {
214
- return o.map((n) => `${[a, ...n.path].filter((c) => c !== void 0).join(".") || "(root)"}: ${n.code}`);
249
+ function g(o, s) {
250
+ return o.map((a) => `${[s, ...a.path].filter((u) => u !== void 0).join(".") || "(root)"}: ${a.code}`);
215
251
  }
216
252
  export {
217
- O as AUTOMATION_RUN_KINDS,
253
+ G as ASSISTANT_TURN_ENDINGS,
254
+ N as AUTOMATION_RUN_KINDS,
218
255
  j as AUTOMATION_TRIGGER_SOURCES,
219
- q as EXPORT_FORMATS,
220
- v as EXPORT_MECHANISMS,
221
- A as EXPORT_SCOPES,
222
- U as EXPORT_STAGES,
223
- y as QUERY_KINDS,
224
- h as QUERY_STATEMENTS,
225
- b as QUERY_TRIGGERS,
226
- D as USAGE_ACTOR_TYPES,
227
- K as USAGE_ATTRIBUTION_ID_MAX_LENGTH,
228
- Z as USAGE_ATTRIBUTION_TITLE_MAX_LENGTH,
229
- P as USAGE_EVENT_CATALOG,
230
- I as USAGE_EVENT_CATEGORIES,
231
- w as USAGE_EVENT_TEXT_MAX_BYTES,
232
- G as USAGE_EVENT_TYPES,
233
- C as USAGE_OUTCOMES,
234
- M as USAGE_PRODUCERS,
235
- N as USAGE_SURFACES,
236
- k as automationRunCompletedDetailsSchema,
237
- f as dashboardOpenedDetailsSchema,
238
- R as exportCompletedDetailsSchema,
239
- F as parseUsageEvent,
240
- S as queryExecutedDetailsSchema,
241
- E as queryStatementRecordSchema,
242
- x as tokenIssuedDetailsSchema,
243
- T as toolCalledDetailsSchema,
244
- J as usageAttributionFieldsSchema,
245
- $ as usageEventEnvelopeSchema
256
+ R as EXPORT_FORMATS,
257
+ U as EXPORT_MECHANISMS,
258
+ O as EXPORT_SCOPES,
259
+ k as EXPORT_STAGES,
260
+ x as QUERY_KINDS,
261
+ b as QUERY_STATEMENTS,
262
+ y as QUERY_TRIGGERS,
263
+ A as TOOL_CALL_ORIGINS,
264
+ P as USAGE_ACTOR_TYPES,
265
+ te as USAGE_ATTRIBUTION_ID_MAX_LENGTH,
266
+ ne as USAGE_ATTRIBUTION_TITLE_MAX_LENGTH,
267
+ Y as USAGE_EVENT_CATALOG,
268
+ M as USAGE_EVENT_CATEGORIES,
269
+ $ as USAGE_EVENT_TEXT_MAX_BYTES,
270
+ B as USAGE_EVENT_TYPES,
271
+ L as USAGE_OUTCOMES,
272
+ X as USAGE_PRODUCERS,
273
+ w as USAGE_SURFACES,
274
+ C as assistantTurnCompletedDetailsSchema,
275
+ D as automationRunCompletedDetailsSchema,
276
+ E as dashboardOpenedDetailsSchema,
277
+ I as exportCompletedDetailsSchema,
278
+ W as parseUsageEvent,
279
+ v as queryExecutedDetailsSchema,
280
+ T as queryStatementRecordSchema,
281
+ f as tokenIssuedDetailsSchema,
282
+ q as toolCalledDetailsSchema,
283
+ ae as usageAttributionFieldsSchema,
284
+ H as usageEventEnvelopeSchema
246
285
  };
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.578",
8
+ "version": "0.1.580",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",