react-semaphor 0.1.602 → 0.1.604

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 (211) hide show
  1. package/dist/activity/index.js +1 -73
  2. package/dist/analytics-protocol/index.js +1 -1451
  3. package/dist/appearance/index.js +1 -12
  4. package/dist/appearance-runtime/index.js +1 -5
  5. package/dist/assistant-context/index.js +1 -11
  6. package/dist/assistant-protocol/index.js +1 -152
  7. package/dist/brand-studio/index.js +4 -1594
  8. package/dist/briefings/index.js +1 -70
  9. package/dist/chunks/add-to-dashboard-DeHEBEqG.js +12 -0
  10. package/dist/chunks/analytics-base-schemas-BREc5WGv.js +1 -0
  11. package/dist/chunks/appearance-context-BqBZrijL.js +1 -0
  12. package/dist/chunks/appearance-runtime-provider-DmbCrOOG.js +1 -0
  13. package/dist/chunks/applied-constraints-CinevlKD.js +1 -0
  14. package/dist/chunks/assistant-chat-CjYrwVDa.js +56 -0
  15. package/dist/chunks/attribution-BEFSsbNn.js +1 -0
  16. package/dist/chunks/availability-3AIOf6Z-.js +1 -0
  17. package/dist/chunks/bookmark-impact-C89zBLq3.js +1 -0
  18. package/dist/chunks/bookmark-state-69YYnRql.js +1 -0
  19. package/dist/chunks/brand-DCaZyRt6.js +1 -0
  20. package/dist/chunks/card-filter-builder-CTp6RAz1.js +17 -0
  21. package/dist/chunks/column-bands-DwxbZ6UI.js +1 -0
  22. package/dist/chunks/comparison-window-caption-C312mn3s.js +1 -0
  23. package/dist/chunks/context-ALdccLHw.js +2 -0
  24. package/dist/chunks/conversation-JMK2kyTK.js +1 -0
  25. package/dist/chunks/dashboard-BX28ld6s.js +1 -0
  26. package/dist/chunks/dashboard-briefing-launcher-qo7GH4EO.js +37 -0
  27. package/dist/chunks/dashboard-controls-DhRjB7MA.js +42 -0
  28. package/dist/chunks/dashboard-json-9cHzhSjC.js +1 -0
  29. package/dist/chunks/dates-D-KP8G-z.js +1 -0
  30. package/dist/chunks/edit-DEAK0UZo.js +1 -0
  31. package/dist/chunks/edit-dashboard-visual-Duq_QkB_.js +93 -0
  32. package/dist/chunks/export-file-format-B-wQNHIn.js +4 -0
  33. package/dist/chunks/filter-line-CwQrqORc.js +1 -0
  34. package/dist/chunks/filter-reach-preview-gixPFlZj.js +1 -0
  35. package/dist/chunks/filter-value-text-B3tXakhd.js +1 -0
  36. package/dist/chunks/index-B-VF1ogs.js +1 -0
  37. package/dist/chunks/index-BE1DfxNs.js +1 -0
  38. package/dist/chunks/index-DViPGDFj.js +1 -0
  39. package/dist/chunks/layout-grid-BWtlgw0T.js +6 -0
  40. package/dist/chunks/matrix-analytical-definition-CtFqWyCK.js +1 -0
  41. package/dist/chunks/matrix-member-presentation-Q0MCJ-YK.js +1 -0
  42. package/dist/chunks/matrix-operation-contract-D1RC1bfi.js +1 -0
  43. package/dist/chunks/metric-comparison-DEZYXROZ.js +1 -0
  44. package/dist/chunks/normalize-dashboard-for-dirty-check-ILKfqgL3.js +1 -0
  45. package/dist/chunks/paintbrush-BjS3SbrH.js +6 -0
  46. package/dist/chunks/palette-BzC-CGOc.js +6 -0
  47. package/dist/chunks/pickers-DuBrUht0.js +1 -0
  48. package/dist/chunks/pivot-result-contract-expectations-DTQAgr4n.js +1 -0
  49. package/dist/chunks/pivot-result-identity-DTNCB--h.js +1 -0
  50. package/dist/chunks/raw-temporal-value-DeyEhL0S.js +1 -0
  51. package/dist/chunks/rendered-file-BbvwaU6z.js +1 -0
  52. package/dist/chunks/report-preferences-dialog-B_gUmCzG.js +1 -0
  53. package/dist/chunks/report-runtime-context-BWzIHCKK.js +1 -0
  54. package/dist/chunks/resolve-dashboard-input-context-B-TtRqxu.js +8 -0
  55. package/dist/chunks/resolver-AN9ChBfZ.js +1 -0
  56. package/dist/chunks/save-DdFUZcbi.js +6 -0
  57. package/dist/chunks/saved-dashboard-context-BAJ5tWiq.js +1 -0
  58. package/dist/chunks/schema-MC0cQSAb.js +4 -0
  59. package/dist/chunks/selection-filter-compiler-CCoCD25M.js +1 -0
  60. package/dist/chunks/semaphor-ready-indicator-DzjorP3t.js +999 -0
  61. package/dist/chunks/set-DuJfGkbY.js +1 -0
  62. package/dist/chunks/shelf-drop-preview-context-BlLJ5RsT.js +6 -0
  63. package/dist/chunks/stored-dashboard-Ctcpkllg.js +1 -0
  64. package/dist/chunks/style-sheet-parts-BRGt9O05.js +178 -0
  65. package/dist/chunks/table-export-sheet-rC5pKmXg.js +2 -0
  66. package/dist/chunks/token-types-Bj9iMy0w.js +1 -0
  67. package/dist/chunks/validators-CqV3Yka1.js +1 -0
  68. package/dist/chunks/variable-draft-DJrfUyhv.js +1 -0
  69. package/dist/chunks/visual-choice-DgEFfkE-.js +1 -0
  70. package/dist/dashboard/index.js +1 -7
  71. package/dist/dashboard-authoring/index.js +1 -4491
  72. package/dist/format-utils/index.js +1 -424
  73. package/dist/index.js +1 -554
  74. package/dist/layouts/index.js +1 -7
  75. package/dist/live-channel/index.js +1 -124
  76. package/dist/pdf-export-policy/index.js +1 -92
  77. package/dist/pdf-table-layout/index.js +1 -993
  78. package/dist/report-runtime-context/index.js +1 -9
  79. package/dist/shared/index.js +1 -6
  80. package/dist/style.css +1 -1
  81. package/dist/surfboard/index.js +1 -9
  82. package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -0
  83. package/dist/types/index.js +1 -88
  84. package/dist/types/lib/document/document-edits.d.ts +0 -4
  85. package/dist/types/lib/filter-values/build-card-filter-definition.d.ts +32 -0
  86. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +9 -0
  87. package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
  88. package/dist/types/lib/stores/explorer-actions.d.ts +7 -6
  89. package/dist/types/lib/types/common-types.d.ts +0 -2
  90. package/dist/types/lib/types/explorer-types.d.ts +1 -1
  91. package/dist/types/lib/types/semantic-types.d.ts +6 -10
  92. package/dist/types/lib/utils/field-state-calculator.d.ts +7 -19
  93. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +18 -0
  94. package/dist/types/shared/analytics-protocol/analyze-result-types.d.ts +3 -0
  95. package/dist/types/shared/analytics-protocol/comparison-choices.d.ts +92 -0
  96. package/dist/types/shared/analytics-protocol/comparison-placement.d.ts +30 -0
  97. package/dist/types/shared/analytics-protocol/contracts.d.ts +11 -5
  98. package/dist/types/shared/analytics-protocol/date-window.d.ts +105 -0
  99. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +27 -0
  100. package/dist/types/shared/analytics-protocol/fixtures.d.ts +4 -2
  101. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  102. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +93 -11
  103. package/dist/types/shared/assistant-protocol/context.d.ts +16 -16
  104. package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +1 -1
  105. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +13 -0
  106. package/dist/types/shared/dashboard-authoring/card-data-source/card-base.d.ts +125 -0
  107. package/dist/types/shared/dashboard-authoring/card-data-source/card-field-folders.d.ts +55 -0
  108. package/dist/types/shared/dashboard-authoring/card-data-source/card-joins.d.ts +114 -0
  109. package/dist/types/shared/dashboard-authoring/card-data-source/card-prune.d.ts +12 -0
  110. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-catalog.d.ts +60 -0
  111. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-folders.d.ts +132 -0
  112. package/dist/types/shared/dashboard-authoring/card-data-source/index.d.ts +7 -0
  113. package/dist/types/shared/dashboard-authoring/card-data-source/join-reach.d.ts +42 -0
  114. package/dist/types/shared/dashboard-authoring/card-field-places.d.ts +28 -0
  115. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +8 -0
  116. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  117. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -1
  118. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +0 -3
  119. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +21 -358
  120. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +2 -0
  121. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  122. package/dist/types/shared/dashboard-authoring/dashboard-variable-card.d.ts +2 -4
  123. package/dist/types/shared/dashboard-authoring/field-folders/field-folders.d.ts +115 -0
  124. package/dist/types/shared/dashboard-authoring/field-folders/index.d.ts +1 -0
  125. package/dist/types/shared/dashboard-authoring/filter-reach-decision.d.ts +11 -0
  126. package/dist/types/shared/dashboard-authoring/index.d.ts +6 -1
  127. package/dist/types/shared/dashboard-authoring/kpi-date-context.d.ts +2 -0
  128. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +18 -0
  129. package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +8 -7
  130. package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +11 -1
  131. package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +2 -2
  132. package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +4 -0
  133. package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +18 -1
  134. package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +2 -0
  135. package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +46 -88
  136. package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +33 -8
  137. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +0 -2
  138. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +5 -0
  139. package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +7 -22
  140. package/dist/types/shared/format-utils/comparison-detail.d.ts +34 -0
  141. package/dist/types/shared/format-utils/index.d.ts +1 -0
  142. package/dist/types/shared/format-utils/partial-period.d.ts +4 -2
  143. package/dist/types/shared/temporal/calendar-periods.d.ts +11 -0
  144. package/dist/types/shared/temporal/index.d.ts +2 -0
  145. package/dist/types/shared/temporal/temporal-text.d.ts +33 -0
  146. package/dist/types/shared/temporal/temporal.d.ts +27 -0
  147. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +4 -3
  148. package/dist/usage-events/index.js +1 -285
  149. package/dist/value-format-preferences/index.js +1 -635
  150. package/package.json +6 -2
  151. package/dist/chunks/add-to-dashboard-ClhEIFst.js +0 -291
  152. package/dist/chunks/analytics-base-schemas-DevrgqQb.js +0 -678
  153. package/dist/chunks/appearance-context-BwBp25ZG.js +0 -162
  154. package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +0 -80
  155. package/dist/chunks/applied-constraints-DU-wndZ7.js +0 -47
  156. package/dist/chunks/assistant-chat-BWF3GYip.js +0 -6115
  157. package/dist/chunks/attribution-BvoKvhcj.js +0 -32
  158. package/dist/chunks/availability-Bp5Gfu1I.js +0 -44
  159. package/dist/chunks/bookmark-impact-BF3iRx5a.js +0 -76
  160. package/dist/chunks/bookmark-state-CBSTdW6q.js +0 -1666
  161. package/dist/chunks/brand-BoUV0iHF.js +0 -54
  162. package/dist/chunks/card-filter-builder-B8XHwMY6.js +0 -4069
  163. package/dist/chunks/column-bands-RdM-kjDe.js +0 -47
  164. package/dist/chunks/comparison-window-caption-W83qB4V5.js +0 -741
  165. package/dist/chunks/context-BJoEFgNl.js +0 -369
  166. package/dist/chunks/conversation-sQiWYUOb.js +0 -16
  167. package/dist/chunks/dashboard-DG5EIYYB.js +0 -14
  168. package/dist/chunks/dashboard-briefing-launcher-CBSrhyWZ.js +0 -4875
  169. package/dist/chunks/dashboard-controls-D6ECO4N1.js +0 -2290
  170. package/dist/chunks/dashboard-json-DrJftBSL.js +0 -66
  171. package/dist/chunks/dates-Bz-qM5px.js +0 -164
  172. package/dist/chunks/edit-9df1zOWe.js +0 -226
  173. package/dist/chunks/edit-dashboard-visual-BDYAJIbb.js +0 -18605
  174. package/dist/chunks/export-file-format-C-tJsxsf.js +0 -111
  175. package/dist/chunks/filter-line-BXT6y303.js +0 -703
  176. package/dist/chunks/filter-reach-copy-BukhZmzm.js +0 -5250
  177. package/dist/chunks/filter-value-text-D3-bf3_b.js +0 -153
  178. package/dist/chunks/index-BVKzKl5d.js +0 -90
  179. package/dist/chunks/index-BW0yozjs.js +0 -2795
  180. package/dist/chunks/index-CV_Kzou0.js +0 -595
  181. package/dist/chunks/layout-grid-Ds0diMeY.js +0 -16
  182. package/dist/chunks/matrix-analytical-definition-CgQgVeeI.js +0 -1162
  183. package/dist/chunks/matrix-member-presentation-DSBIIudt.js +0 -258
  184. package/dist/chunks/matrix-operation-contract--DkNCOzd.js +0 -1412
  185. package/dist/chunks/metric-comparison-zMylnIkc.js +0 -541
  186. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +0 -119
  187. package/dist/chunks/paintbrush-CX8pao1j.js +0 -27
  188. package/dist/chunks/palette-CuA0HlzF.js +0 -23
  189. package/dist/chunks/pickers-DkqmtnTL.js +0 -2403
  190. package/dist/chunks/pivot-result-contract-expectations-C8KL7hPx.js +0 -5046
  191. package/dist/chunks/pivot-result-identity-C1AOH1PS.js +0 -77
  192. package/dist/chunks/raw-temporal-value-E416F-0L.js +0 -454
  193. package/dist/chunks/rendered-file-D8xEuVVx.js +0 -108
  194. package/dist/chunks/report-preferences-dialog-CbuVNDGi.js +0 -1637
  195. package/dist/chunks/report-runtime-context-E7USjN7E.js +0 -388
  196. package/dist/chunks/resolve-dashboard-input-context-CULCE_hM.js +0 -25172
  197. package/dist/chunks/resolver-DG_tfEpt.js +0 -156
  198. package/dist/chunks/save-BKHlDONy.js +0 -21
  199. package/dist/chunks/saved-dashboard-context-C1WlOx5z.js +0 -632
  200. package/dist/chunks/schema-C9NPiIru.js +0 -2568
  201. package/dist/chunks/selection-filter-compiler-ifT8JCXS.js +0 -131
  202. package/dist/chunks/semaphor-ready-indicator-CBIRcDWs.js +0 -145326
  203. package/dist/chunks/shelf-drop-preview-context-xR69SMA8.js +0 -2466
  204. package/dist/chunks/stored-dashboard-BuM8vnWf.js +0 -4070
  205. package/dist/chunks/style-sheet-parts-Bt9ZNre8.js +0 -8674
  206. package/dist/chunks/table-export-sheet-DVljtHkG.js +0 -949
  207. package/dist/chunks/token-types-D_xKgyVS.js +0 -8
  208. package/dist/chunks/upload-Dll_M7XQ.js +0 -15
  209. package/dist/chunks/validators-ClWHpYql.js +0 -3686
  210. package/dist/chunks/variable-draft-CDGGl53R.js +0 -242
  211. package/dist/chunks/visual-choice-DDfHfHvY.js +0 -172
@@ -0,0 +1,34 @@
1
+ import { DashboardDateComparisonOwner, ResolvedMetricComparisonRequest, StoredMetricComparisonSpec } from '../analytics-protocol/metric-comparison.js';
2
+ import { ComparisonWindowShape } from '../analytics-protocol/comparison-choices.js';
3
+ /**
4
+ * A comparison in words (compare-with CW-D12, CW-INV-3), the one owner of
5
+ * comparison wording: the menu, the toolbar chip, the editor, the tile's
6
+ * tooltip, the assistant's context and the MCP outline all read it. It words
7
+ * what is requested, named for the window when its shape is known ("Previous
8
+ * 7 days", "Same day last week"); the dates exist only once the server has
9
+ * placed them (they arrive on a result), so none are invented here. Pure,
10
+ * React-free.
11
+ */
12
+ export type ComparisonWords = {
13
+ /** For a menu, a chip or a control: "Previous 7 days", "Same days last year, matching weekdays". */
14
+ label: string;
15
+ /** Inside a sentence: "the previous 7 days", "the same days last year, matching weekdays", "a target of 500". */
16
+ sentence: string;
17
+ };
18
+ /** A window's size in words, for a note about it: "a day", "a month", "7 days", "3 months", "24 hours". */
19
+ export declare function describeWindowSize(shape: ComparisonWindowShape): string;
20
+ /**
21
+ * Why a step back cannot fit the window it compares, and the steps that do
22
+ * (compare-with CW-D16): the MCP's refusal of a Date filter's default and its
23
+ * warning on a measure or a variable read the same words.
24
+ */
25
+ export declare function describeComparisonOverlap(spec: StoredMetricComparisonSpec, shape: ComparisonWindowShape): {
26
+ message: string;
27
+ fix: string;
28
+ };
29
+ /** A comparison's words, named for the window when its shape is known (CW-D12). */
30
+ export declare function describeComparison(stored: StoredMetricComparisonSpec, shape?: ComparisonWindowShape): ComparisonWords;
31
+ /** Whose date the dashboard date comparison follows. */
32
+ export declare function describeDashboardDateComparisonOwner(owner: DashboardDateComparisonOwner | undefined): string;
33
+ /** One measure's requested comparison, with where it comes from. */
34
+ export declare function describeMeasureComparison(measure: string, request: ResolvedMetricComparisonRequest): string;
@@ -41,6 +41,7 @@ export * from './attachment-filter-line.js';
41
41
  export { describeFilterValueInFullDetail, type FullDetailFilterValue, } from './filter-value-text.js';
42
42
  export { describeConditionInFullDetail, type FilterClauseText } from './filter-detail.js';
43
43
  export { formatCanonicalComparisonRange } from '../../lib/utils/comparison-window-caption.js';
44
+ export { describeComparison } from './comparison-detail.js';
44
45
  export { PDF_GROUP_CONTINUATION_CLASS } from './grouped-table-presentation.js';
45
46
  export { toStoredValueFormat } from './stored-value-format.js';
46
47
  export { SEMAPHOR_GENERATED_COUNT_METRIC_ID } from '../analytics-protocol/contracts.js';
@@ -4,8 +4,10 @@ import { ResolvedTemporalValueFormatPreferences } from '../value-format-preferen
4
4
  export type DatePeriodPartial = 'running' | 'start' | 'end';
5
5
  /**
6
6
  * A whole period cut to the counted window (KT-D9): it starts no earlier than
7
- * the window and ends no later; `running` when it ends after `now`, else
8
- * `start` or `end` when the window cut it, else whole.
7
+ * the window and ends no later; `running` when `now` falls inside it (it has
8
+ * started and not ended: a period still to come, such as next month's
9
+ * forecast, is not running; ledger EXT-12), else `start` or `end` when the
10
+ * window cut it, else whole.
9
11
  */
10
12
  export declare function cutDatePeriod(period: {
11
13
  start: Date;
@@ -52,6 +52,17 @@ export declare function startOfPeriodWall(wall: WallClockTime, unit: Exclude<Tem
52
52
  * occurrence, so a repeated hour is two periods.
53
53
  */
54
54
  export declare function periodAt(instant: Date, unit: TemporalUnit, calendar: TemporalCalendar, offset?: number): TemporalPeriod;
55
+ /** The calendar units a whole window can be, largest first. */
56
+ export declare const WHOLE_PERIOD_UNITS: readonly ["year", "quarter", "month", "week", "day"];
57
+ export type WholePeriodUnit = (typeof WHOLE_PERIOD_UNITS)[number];
58
+ /**
59
+ * The calendar period a window is exactly, when it is one: a whole year,
60
+ * quarter, month, week or day in this calendar (the largest that fits), else
61
+ * null. The one detector placement steps a range by and the comparison menu
62
+ * names a range by, so a whole February is "Previous month" in the menu and
63
+ * January in the run (compare-with ledger EXT-04).
64
+ */
65
+ export declare function completeCalendarPeriod(start: Date, endExclusive: Date, calendar: TemporalCalendar): WholePeriodUnit | null;
55
66
  /** Where the period containing `instant` starts. */
56
67
  export declare function startOfPeriod(instant: Date, unit: TemporalUnit, calendar: TemporalCalendar): Date;
57
68
  /** The last millisecond of the period containing `instant`. */
@@ -1,4 +1,6 @@
1
+ export * from './temporal.js';
1
2
  export * from './zoned-wall-clock.js';
3
+ export * from './temporal-text.js';
2
4
  export * from './calendar-periods.js';
3
5
  export * from './calendar-day-equality.js';
4
6
  export * from './raw-temporal-equality.js';
@@ -0,0 +1,33 @@
1
+ /** Date and time text as written: the date, then the time and the offset when present. */
2
+ export type TemporalText = {
3
+ year: number;
4
+ /** Absent for a year on its own (`2026`). */
5
+ month?: number;
6
+ /** Absent for a year or a month on its own (`2026-06`). */
7
+ day?: number;
8
+ time?: {
9
+ hour: number;
10
+ /** 1 for `9`, 2 for `09`. */
11
+ hourDigits: 1 | 2;
12
+ minute?: number;
13
+ second?: number;
14
+ /** The digits after the second, as written. */
15
+ fraction: string;
16
+ };
17
+ /** As written: `Z`, `+05`, `+0530` or `+05:30`. */
18
+ offset?: string;
19
+ /** Whitespace stood between the time and the offset (`… 10:00 +05`). */
20
+ spacedOffset?: true;
21
+ /** What follows the date and time, when a reader accepts text after them. */
22
+ rest: string;
23
+ };
24
+ /** The text's date and time fields, or null when it does not start with a four-digit year. */
25
+ export declare function lexTemporalText(text: string): TemporalText | null;
26
+ /** The offset as Temporal reads it (`+05` to `+05:00`, `+0530` to `+05:30`), or `Z`. */
27
+ export declare function normalizedOffset(offset: string): string;
28
+ /** Whether the fields name a real calendar date and wall time (February 29 only in a leap year, hours below 24). */
29
+ export declare function isRealTemporalText(text: TemporalText): boolean;
30
+ /** The milliseconds of a fraction as written (`5` is 500, `123456` is 123). */
31
+ export declare function fractionMilliseconds(fraction: string): number;
32
+ /** Exactly `YYYY-MM-DD`, as written; whether it names a real day is the reader's check (`parseWallDate`). */
33
+ export declare function isCalendarDateText(text: string): boolean;
@@ -0,0 +1,27 @@
1
+ import { Temporal as Polyfill } from 'temporal-polyfill';
2
+ type TemporalNamespace = typeof Polyfill;
3
+ export declare const Temporal: TemporalNamespace;
4
+ export type PlainDate = Polyfill.PlainDate;
5
+ export type PlainDateTime = Polyfill.PlainDateTime;
6
+ export type ZonedDateTime = Polyfill.ZonedDateTime;
7
+ export type Instant = Polyfill.Instant;
8
+ export type Duration = Polyfill.Duration;
9
+ /**
10
+ * How a wall-clock time a clock change skips or repeats names an instant
11
+ * (analytics kernel K7): a repeated hour takes its first occurrence, a skipped
12
+ * hour moves forward by the gap.
13
+ */
14
+ export declare const WALL_CLOCK_DISAMBIGUATION: "compatible";
15
+ /** The instant of a `Date`, as Temporal reads it. */
16
+ export declare function instantOf(date: Date): Instant;
17
+ /** The `Date` of an instant or a zoned time, for the code that still speaks `Date`. */
18
+ export declare function dateOf(value: Instant | ZonedDateTime): Date;
19
+ /** The first instant after an inclusive end (its last millisecond): the end a half-open window takes. */
20
+ export declare function exclusiveEndOf(inclusiveEnd: Date): Date;
21
+ /** The last millisecond before an exclusive end: the inclusive end a resolver hands out. */
22
+ export declare function inclusiveEndOf(exclusiveEnd: Date): Date;
23
+ /** Elapsed time from one instant to another, in milliseconds. */
24
+ export declare function elapsedMilliseconds(from: Date, to: Date): number;
25
+ /** An instant moved by elapsed time (never the calendar: a day across a clock change is not 24 hours of it). */
26
+ export declare function afterElapsed(instant: Date, milliseconds: number): Date;
27
+ export {};
@@ -1,3 +1,4 @@
1
+ import { PlainDateTime } from './temporal.js';
1
2
  export type ZonedWallClock = {
2
3
  year: number;
3
4
  month: number;
@@ -11,14 +12,14 @@ export declare function zonedWallClock(instant: Date, tz: string): ZonedWallCloc
11
12
  export type ZonedWallClockTime = ZonedWallClock & {
12
13
  millisecond?: number;
13
14
  };
15
+ /** The wall clock as a Temporal plain date and time (the calendar's own, no timezone). */
16
+ export declare function plainWallClock(wall: ZonedWallClockTime): PlainDateTime;
14
17
  /** The wall clock as if it were UTC, in milliseconds. */
15
18
  export declare function wallClockMilliseconds(wall: ZonedWallClockTime): number;
16
19
  /**
17
20
  * The instant a wall-clock time names in a timezone (analytics kernel K7). A
18
21
  * repeated hour takes its first occurrence; a skipped hour moves forward by
19
- * the gap, as JavaScript's Temporal API and java.time do by default. The
20
- * offsets a day either side cover any one change, and no offset reaches a
21
- * day, so the answer never depends on the machine.
22
+ * the gap: Temporal's `compatible` rule, as java.time does by default.
22
23
  */
23
24
  export declare function zonedWallClockToInstant(wall: ZonedWallClockTime, tz: string): Date;
24
25
  /**
@@ -1,285 +1 @@
1
- import { z as e } from "zod";
2
- import { g as h, l as S } from "../chunks/context-BJoEFgNl.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({
6
- token_type: e.enum(["dashboard", "project"]),
7
- token_purpose: e.enum(["embed", "console"]).optional(),
8
- ttl_s: e.number().int().nonnegative().optional(),
9
- embed_origin: e.string().max(2048).optional(),
10
- initial_dashboard_id: r.optional(),
11
- dashboard_title: t.optional(),
12
- project_name: t.optional(),
13
- user_verified: e.boolean(),
14
- user_email: t.optional(),
15
- user_display_name: t.optional(),
16
- tenant_name: t.optional(),
17
- role: e.string().max(128).optional(),
18
- user_provisioned: e.boolean().optional(),
19
- domain_access_mode: e.enum(["all", "none", "include", "exclude"]).optional(),
20
- domain_ids: e.array(r).max(500).optional(),
21
- rls_policy_names: m.optional(),
22
- cls_policy_names: m.optional(),
23
- has_sls: e.boolean().optional(),
24
- security_param_keys: m.optional(),
25
- timezone: e.string().max(128).optional(),
26
- mcp_scopes: e.array(e.string().max(128)).max(64).optional(),
27
- mcp_sql: e.boolean().optional(),
28
- mcp_live: e.boolean().optional()
29
- }).strict(), E = e.object({
30
- requested_version: e.number().int().optional(),
31
- served: e.enum(["current", "version"]).optional(),
32
- dashboard_title: t.optional(),
33
- project_name: t.optional(),
34
- sheet_count: n.optional(),
35
- card_count: n.optional()
36
- }).strict(), T = e.object({
37
- statement: e.enum(b),
38
- duration_ms: e.number().nonnegative(),
39
- outcome: e.enum(["succeeded", "failed", "cancelled"]),
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(),
48
- card_title: t.optional(),
49
- card_type: e.string().max(128).optional(),
50
- dashboard_title: t.optional(),
51
- sheet_title: t.optional(),
52
- project_name: t.optional(),
53
- connection_name: t.optional(),
54
- connection_type: e.string().max(128).optional(),
55
- dialect: e.string().max(128).optional(),
56
- dataset: t.optional(),
57
- rows: n.optional(),
58
- row_limit_exceeded: e.boolean().optional(),
59
- sql_text: p.optional(),
60
- sql_truncated: e.boolean().optional(),
61
- sql_hash: e.string().regex(/^[0-9a-f]{64}$/).optional(),
62
- input_ids_applied: e.array(r).max(500).optional(),
63
- page: e.number().int().positive().optional(),
64
- export_job_id: r.optional()
65
- }).strict(), A = ["assistant", "mcp"], q = e.object({
66
- tool: e.string().min(1).max(128),
67
- args_json: p.optional(),
68
- args_truncated: e.boolean().optional(),
69
- arg_keys: e.array(e.string().max(128)).max(200),
70
- user_agent: e.string().max(1024).optional(),
71
- oauth_client: t.optional(),
72
- credential: e.string().max(64).optional(),
73
- access_mode: e.string().max(64).optional(),
74
- scopes: e.array(e.string().max(128)).max(64).optional(),
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,
90
- rule_name: t.optional(),
91
- kind: e.enum(N),
92
- trigger_source: e.enum(j).optional(),
93
- attempt: n.optional(),
94
- scheduled_for: e.string().datetime({ offset: !0 }).optional()
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 = [
115
- "token_issued",
116
- "dashboard_opened",
117
- "query_executed",
118
- "tool_called",
119
- "export_completed",
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 = {
123
- token_issued: {
124
- category: "usage",
125
- version: 1,
126
- emittedBy: "semaphor-app/src/lib/usage-events/token-issued.ts",
127
- personalData: !0,
128
- detailsSchema: f
129
- },
130
- dashboard_opened: {
131
- category: "usage",
132
- version: 1,
133
- emittedBy: "semaphor-app/src/lib/usage-events/dashboard-opened.ts",
134
- personalData: !1,
135
- detailsSchema: E
136
- },
137
- query_executed: {
138
- category: "runtime",
139
- version: 1,
140
- emittedBy: "semaphor-app/src/app/api/v1/query/query-run.ts",
141
- // sql_text holds the filter and control values the app compiled in.
142
- personalData: !0,
143
- detailsSchema: v
144
- },
145
- tool_called: {
146
- category: "agent",
147
- version: 1,
148
- emittedBy: "semaphor-app/src/lib/mcp/tool-telemetry.ts",
149
- // args_json is what the agent sent.
150
- personalData: !0,
151
- detailsSchema: q
152
- },
153
- export_completed: {
154
- category: "delivery",
155
- version: 1,
156
- emittedBy: "semaphor-app/src/lib/usage-events/export-completed.ts",
157
- personalData: !1,
158
- detailsSchema: I
159
- },
160
- automation_run_completed: {
161
- category: "delivery",
162
- version: 1,
163
- emittedBy: "semaphor-app/src/lib/usage-events/automation-run-completed.ts",
164
- // rule_name is what its author typed; error.message is the run's own error text.
165
- personalData: !0,
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
175
- }
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),
179
- event_version: e.number().int().positive(),
180
- category: e.enum(M),
181
- occurred_at: e.string().regex(V),
182
- producer: e.enum(X),
183
- release: e.string().min(1).max(64),
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(),
199
- duration_ms: e.number().nonnegative().nullable(),
200
- error: e.object({
201
- code: e.string().min(1).max(128),
202
- message: e.string().refine((o) => new TextEncoder().encode(o).length <= $)
203
- }).strict().nullable(),
204
- details: e.unknown()
205
- }).strict();
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 } };
215
- }
216
- const z = {
217
- token_issued: (o) => {
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;
220
- },
221
- dashboard_opened: (o) => [
222
- ...o.outcome === null ? ["outcome: required"] : [],
223
- ...o.duration_ms === null ? ["duration_ms: required"] : [],
224
- ...o.dashboard_id === null ? ["dashboard_id: required"] : []
225
- ],
226
- query_executed: (o) => [
227
- ...o.outcome === null ? ["outcome: required"] : [],
228
- ...o.duration_ms === null ? ["duration_ms: required"] : []
229
- ],
230
- tool_called: (o) => [
231
- ...o.outcome === null ? ["outcome: required"] : [],
232
- ...o.duration_ms === null ? ["duration_ms: required"] : [],
233
- ...o.operation_id === null ? ["operation_id: required"] : []
234
- ],
235
- export_completed: (o) => [
236
- ...o.outcome === null ? ["outcome: required"] : [],
237
- ...o.duration_ms === null ? ["duration_ms: required"] : []
238
- ],
239
- automation_run_completed: (o) => [
240
- ...o.outcome === null ? ["outcome: required"] : [],
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"] : []
247
- ]
248
- };
249
- function g(o, s) {
250
- return o.map((a) => `${[s, ...a.path].filter((u) => u !== void 0).join(".") || "(root)"}: ${a.code}`);
251
- }
252
- export {
253
- G as ASSISTANT_TURN_ENDINGS,
254
- N as AUTOMATION_RUN_KINDS,
255
- j as AUTOMATION_TRIGGER_SOURCES,
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
285
- };
1
+ import{z as e}from"zod";import{g as h,l as S}from"../chunks/context-ALdccLHw.js";import{Q as b,a as y,b as x}from"../chunks/attribution-BEFSsbNn.js";import{U as te,c as ne,u as ae}from"../chunks/attribution-BEFSsbNn.js";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({token_type:e.enum(["dashboard","project"]),token_purpose:e.enum(["embed","console"]).optional(),ttl_s:e.number().int().nonnegative().optional(),embed_origin:e.string().max(2048).optional(),initial_dashboard_id:r.optional(),dashboard_title:t.optional(),project_name:t.optional(),user_verified:e.boolean(),user_email:t.optional(),user_display_name:t.optional(),tenant_name:t.optional(),role:e.string().max(128).optional(),user_provisioned:e.boolean().optional(),domain_access_mode:e.enum(["all","none","include","exclude"]).optional(),domain_ids:e.array(r).max(500).optional(),rls_policy_names:m.optional(),cls_policy_names:m.optional(),has_sls:e.boolean().optional(),security_param_keys:m.optional(),timezone:e.string().max(128).optional(),mcp_scopes:e.array(e.string().max(128)).max(64).optional(),mcp_sql:e.boolean().optional(),mcp_live:e.boolean().optional()}).strict(),E=e.object({requested_version:e.number().int().optional(),served:e.enum(["current","version"]).optional(),dashboard_title:t.optional(),project_name:t.optional(),sheet_count:n.optional(),card_count:n.optional()}).strict(),T=e.object({statement:e.enum(b),duration_ms:e.number().nonnegative(),outcome:e.enum(["succeeded","failed","cancelled"]),rows:n.optional()}).strict(),v=e.object({data_service_calls:n,query_run_id:r,parent_query_run_id:r.optional(),query_kind:e.enum(x).optional(),statements:e.array(T).max(64),trigger:e.enum(y).optional(),card_title:t.optional(),card_type:e.string().max(128).optional(),dashboard_title:t.optional(),sheet_title:t.optional(),project_name:t.optional(),connection_name:t.optional(),connection_type:e.string().max(128).optional(),dialect:e.string().max(128).optional(),dataset:t.optional(),rows:n.optional(),row_limit_exceeded:e.boolean().optional(),sql_text:p.optional(),sql_truncated:e.boolean().optional(),sql_hash:e.string().regex(/^[0-9a-f]{64}$/).optional(),input_ids_applied:e.array(r).max(500).optional(),page:e.number().int().positive().optional(),export_job_id:r.optional()}).strict(),A=["assistant","mcp"],q=e.object({tool:e.string().min(1).max(128),args_json:p.optional(),args_truncated:e.boolean().optional(),arg_keys:e.array(e.string().max(128)).max(200),user_agent:e.string().max(1024).optional(),oauth_client:t.optional(),credential:e.string().max(64).optional(),access_mode:e.string().max(64).optional(),scopes:e.array(e.string().max(128)).max(64).optional(),response_bytes:n.optional(),origin:e.enum(A)}).strict(),U=["job","matrix_direct","rendered"],R=["csv","xlsx","pdf","png"],O=["visual","card","dashboard"],k=["create","acquire","deadline","render"],I=e.object({export_id:r.optional(),mechanism:e.enum(U),format:e.enum(R),scope:e.enum(O).optional(),rows:n.optional(),bytes:n.optional(),chunks:n.optional(),stage:e.enum(k).optional()}).strict(),N=["export","briefing","cache_refresh"],j=["scheduled","manual","api"],D=e.object({run_id:r,rule_id:r,rule_name:t.optional(),kind:e.enum(N),trigger_source:e.enum(j).optional(),attempt:n.optional(),scheduled_for:e.string().datetime({offset:!0}).optional()}).strict(),G=["completed","refused","stopped","failed"],C=e.object({turn_id:r.optional(),conversation_id:r.optional(),question_text:p.optional(),question_truncated:e.boolean().optional(),turn_outcome:e.enum(G),refusal:e.enum(S).optional(),context_surface:e.enum(h),model:e.string().min(1).max(128),instructions_version:e.string().min(1).max(128),input_tokens:n,cached_input_tokens:n,output_tokens:n,tools:e.array(e.string().min(1).max(128)).max(500),tool_call_count:n,tool_error_count:n,asked_user:e.boolean().optional(),finish_reason:e.string().max(64).optional()}).strict(),B=["token_issued","dashboard_opened","query_executed","tool_called","export_completed","automation_run_completed","assistant_turn_completed"],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={token_issued:{category:"usage",version:1,emittedBy:"semaphor-app/src/lib/usage-events/token-issued.ts",personalData:!0,detailsSchema:f},dashboard_opened:{category:"usage",version:1,emittedBy:"semaphor-app/src/lib/usage-events/dashboard-opened.ts",personalData:!1,detailsSchema:E},query_executed:{category:"runtime",version:1,emittedBy:"semaphor-app/src/app/api/v1/query/query-run.ts",personalData:!0,detailsSchema:v},tool_called:{category:"agent",version:1,emittedBy:"semaphor-app/src/lib/mcp/tool-telemetry.ts",personalData:!0,detailsSchema:q},export_completed:{category:"delivery",version:1,emittedBy:"semaphor-app/src/lib/usage-events/export-completed.ts",personalData:!1,detailsSchema:I},automation_run_completed:{category:"delivery",version:1,emittedBy:"semaphor-app/src/lib/usage-events/automation-run-completed.ts",personalData:!0,detailsSchema:D},assistant_turn_completed:{category:"agent",version:1,emittedBy:"semaphor-app/src/lib/usage-events/assistant-turn-completed.ts",personalData:!0,detailsSchema:C}},$=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({event_id:e.string().regex(F),event_type:e.enum(B),event_version:e.number().int().positive(),category:e.enum(M),occurred_at:e.string().regex(V),producer:e.enum(X),release:e.string().min(1).max(64),org_id:i,project_id:i,tenant_id:i,actor_type:e.enum(P),org_user_id:i,tenant_user_id:i,surface:e.enum(w),session_id:i,operation_id:i,dashboard_id:i,sheet_id:i,card_id:i,connection_id:i,domain_id:i,outcome:e.enum(L).nullable(),duration_ms:e.number().nonnegative().nullable(),error:e.object({code:e.string().min(1).max(128),message:e.string().refine(o=>new TextEncoder().encode(o).length<=$)}).strict().nullable(),details:e.unknown()}).strict();function W(o){const s=H.safeParse(o);if(!s.success)return{ok:!1,issues:g(s.error.issues)};const a=s.data,d=a.event_type,u=Y[d],l=[];a.event_version!==u.version&&l.push("event_version: not the catalog version"),a.category!==u.category&&l.push("category: not the catalog category");const _=a.outcome==="failed"||a.outcome==="timed_out";_&&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));const c=u.detailsSchema.safeParse(a.details);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}};}const z={token_issued:o=>{const s=[];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;},dashboard_opened:o=>[...(o.outcome===null?["outcome: required"]:[]),...(o.duration_ms===null?["duration_ms: required"]:[]),...(o.dashboard_id===null?["dashboard_id: required"]:[])],query_executed:o=>[...(o.outcome===null?["outcome: required"]:[]),...(o.duration_ms===null?["duration_ms: required"]:[])],tool_called:o=>[...(o.outcome===null?["outcome: required"]:[]),...(o.duration_ms===null?["duration_ms: required"]:[]),...(o.operation_id===null?["operation_id: required"]:[])],export_completed:o=>[...(o.outcome===null?["outcome: required"]:[]),...(o.duration_ms===null?["duration_ms: required"]:[])],automation_run_completed:o=>[...(o.outcome===null?["outcome: required"]:[]),...(o.duration_ms===null?["duration_ms: required"]:[])],assistant_turn_completed:o=>[...(o.outcome===null?["outcome: required"]:[]),...(o.duration_ms===null?["duration_ms: required"]:[]),...(o.operation_id===null?["operation_id: required"]:[])]};function g(o,s){return o.map(a=>`${[s,...a.path].filter(u=>u!==void 0).join(".")||"(root)"}: ${a.code}`);}export{G as ASSISTANT_TURN_ENDINGS,N as AUTOMATION_RUN_KINDS,j as AUTOMATION_TRIGGER_SOURCES,R as EXPORT_FORMATS,U as EXPORT_MECHANISMS,O as EXPORT_SCOPES,k as EXPORT_STAGES,x as QUERY_KINDS,b as QUERY_STATEMENTS,y as QUERY_TRIGGERS,A as TOOL_CALL_ORIGINS,P as USAGE_ACTOR_TYPES,te as USAGE_ATTRIBUTION_ID_MAX_LENGTH,ne as USAGE_ATTRIBUTION_TITLE_MAX_LENGTH,Y as USAGE_EVENT_CATALOG,M as USAGE_EVENT_CATEGORIES,$ as USAGE_EVENT_TEXT_MAX_BYTES,B as USAGE_EVENT_TYPES,L as USAGE_OUTCOMES,X as USAGE_PRODUCERS,w as USAGE_SURFACES,C as assistantTurnCompletedDetailsSchema,D as automationRunCompletedDetailsSchema,E as dashboardOpenedDetailsSchema,I as exportCompletedDetailsSchema,W as parseUsageEvent,v as queryExecutedDetailsSchema,T as queryStatementRecordSchema,f as tokenIssuedDetailsSchema,q as toolCalledDetailsSchema,ae as usageAttributionFieldsSchema,H as usageEventEnvelopeSchema};