@sisense/sdk-ai-core 0.15.1 → 0.60.1

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 (169) hide show
  1. package/dist/__vite-browser-external-l0sNRNKZ.js +1 -0
  2. package/dist/constants.d.ts +36 -0
  3. package/dist/engines/atomic-handle-args.d.ts +45 -0
  4. package/dist/engines/atomic-tool-requirements.d.ts +38 -0
  5. package/dist/engines/author-pulse/actions/create.d.ts +9 -0
  6. package/dist/engines/author-pulse/actions/define.d.ts +9 -0
  7. package/dist/engines/author-pulse/actions/load-existing.d.ts +9 -0
  8. package/dist/engines/author-pulse/actions/redefine.d.ts +9 -0
  9. package/dist/engines/author-pulse/actions/set-receive-notifications.d.ts +8 -0
  10. package/dist/engines/author-pulse/actions/update-spec.d.ts +11 -0
  11. package/dist/engines/author-pulse/actions/update-workflow.d.ts +9 -0
  12. package/dist/engines/author-pulse/atomic-adapter.d.ts +10 -0
  13. package/dist/engines/author-pulse/atomic-tools.d.ts +362 -0
  14. package/dist/engines/author-pulse/author-pulse-engine.d.ts +21 -0
  15. package/dist/engines/author-pulse/index.d.ts +9 -0
  16. package/dist/engines/author-pulse/shared/adjustment-error.d.ts +15 -0
  17. package/dist/engines/author-pulse/shared/assemble-create-workflow-payload.d.ts +36 -0
  18. package/dist/engines/author-pulse/shared/assert-agentic-workflow.d.ts +12 -0
  19. package/dist/engines/author-pulse/shared/compile-query-from-prompt.d.ts +95 -0
  20. package/dist/engines/author-pulse/shared/decision-spec-validation.d.ts +84 -0
  21. package/dist/engines/author-pulse/shared/notification-urls.d.ts +52 -0
  22. package/dist/engines/author-pulse/shared/pulse-knowledge.d.ts +36 -0
  23. package/dist/engines/author-pulse/shared/pulse-signature.d.ts +39 -0
  24. package/dist/engines/author-pulse/shared/resolve-frequency.d.ts +18 -0
  25. package/dist/engines/author-pulse/shared/staging.d.ts +65 -0
  26. package/dist/engines/author-pulse/shared/workflow-ownership.d.ts +14 -0
  27. package/dist/engines/author-pulse/types.d.ts +1385 -0
  28. package/dist/engines/build-chart/atomic-adapter.d.ts +20 -0
  29. package/dist/engines/build-chart/atomic-tools.d.ts +214 -0
  30. package/dist/engines/build-chart/build-chart-engine.d.ts +1 -1
  31. package/dist/engines/build-chart/chart-tool-name.d.ts +3 -0
  32. package/dist/engines/build-chart/create-chart/assemble-chart-widget.d.ts +1 -1
  33. package/dist/engines/build-chart/create-chart/chart-json-axes-mapping.d.ts +1 -1
  34. package/dist/engines/build-chart/create-chart/create-chart.d.ts +1 -1
  35. package/dist/engines/build-chart/create-chart/derive-chart-title.d.ts +7 -0
  36. package/dist/engines/build-chart/create-chart/generate-chart-recommendations.d.ts +2 -2
  37. package/dist/engines/build-chart/create-chart/resolve-chart-query.d.ts +4 -0
  38. package/dist/engines/build-chart/shared/normalize-cartesian-axes-mapping.d.ts +1 -1
  39. package/dist/engines/build-chart/shared/sync-chart-state-measure-flags.d.ts +3 -0
  40. package/dist/engines/build-chart/types.d.ts +49 -19
  41. package/dist/engines/build-chart/update-chart/apply-prior-chart-style.d.ts +8 -5
  42. package/dist/engines/build-chart/update-chart/chart-options-schemas.d.ts +18 -18
  43. package/dist/engines/build-chart/update-chart/schemas.d.ts +2 -2
  44. package/dist/engines/build-chart/update-chart/update-chart-data-options.d.ts +7 -2
  45. package/dist/engines/build-chart/update-chart/update-chart-query.d.ts +1 -1
  46. package/dist/engines/build-chart/update-chart/update-chart-style-options.d.ts +7 -2
  47. package/dist/engines/build-chart/update-chart/update-chart-title.d.ts +1 -1
  48. package/dist/engines/build-chart/update-chart/update-chart-type.d.ts +7 -2
  49. package/dist/engines/build-csv-model/build-csv-model-engine.d.ts +1 -1
  50. package/dist/engines/build-csv-model/types.d.ts +1 -1
  51. package/dist/engines/build-dashboard/add-dashboard-narration.d.ts +50 -0
  52. package/dist/engines/build-dashboard/add-dashboard-widgets.d.ts +1 -1
  53. package/dist/engines/build-dashboard/atomic-adapter.d.ts +21 -0
  54. package/dist/engines/build-dashboard/atomic-tools.d.ts +231 -0
  55. package/dist/engines/build-dashboard/build-dashboard-engine.d.ts +1 -1
  56. package/dist/engines/build-dashboard/build-dashboard-service.d.ts +2 -1
  57. package/dist/engines/build-dashboard/create-dashboard.d.ts +3 -4
  58. package/dist/engines/build-dashboard/dashboard-filters/manipulate-dashboard-filters.d.ts +2 -1
  59. package/dist/engines/build-dashboard/dashboard-filters/translate-filters.d.ts +17 -1
  60. package/dist/engines/build-dashboard/index.d.ts +2 -0
  61. package/dist/engines/build-dashboard/layout/place-widget.d.ts +53 -0
  62. package/dist/engines/build-dashboard/load-existing-fusion-dashboard.d.ts +1 -1
  63. package/dist/engines/build-dashboard/remove-dashboard-widgets.d.ts +4 -0
  64. package/dist/engines/build-dashboard/resolve-chart-widgets.d.ts +16 -0
  65. package/dist/engines/build-dashboard/types.d.ts +180 -18
  66. package/dist/engines/build-data-model/build-data-model-engine.d.ts +1 -1
  67. package/dist/engines/build-data-model/types.d.ts +1 -1
  68. package/dist/engines/build-query/build-query-engine.d.ts +33 -5
  69. package/dist/engines/build-query/index.d.ts +1 -1
  70. package/dist/engines/build-query/types.d.ts +216 -3
  71. package/dist/engines/build-status/build-status-engine.d.ts +8 -0
  72. package/dist/engines/build-status/builds-client.d.ts +44 -0
  73. package/dist/engines/build-status/index.d.ts +2 -0
  74. package/dist/engines/build-status/types.d.ts +177 -0
  75. package/dist/engines/datamodel-graph/data-model-map-text.d.ts +28 -0
  76. package/dist/engines/datamodel-graph/datamodel-graph-engine.d.ts +31 -0
  77. package/dist/engines/datamodel-graph/index.d.ts +4 -0
  78. package/dist/engines/datamodel-graph/summaries.d.ts +97 -0
  79. package/dist/engines/datamodel-graph/test-fixtures.d.ts +42 -0
  80. package/dist/engines/datamodel-graph/types.d.ts +190 -0
  81. package/dist/engines/evaluate-pulse/evaluate-pulse-engine.d.ts +10 -0
  82. package/dist/engines/evaluate-pulse/index.d.ts +2 -0
  83. package/dist/engines/evaluate-pulse/types.d.ts +85 -0
  84. package/dist/engines/get-dashboard-narration/get-dashboard-narration-engine.d.ts +23 -0
  85. package/dist/engines/get-dashboard-narration/index.d.ts +2 -0
  86. package/dist/engines/get-dashboard-narration/types.d.ts +64 -0
  87. package/dist/engines/get-dashboards/get-dashboards-engine.d.ts +1 -1
  88. package/dist/engines/get-dashboards/types.d.ts +16 -4
  89. package/dist/engines/get-data-preview/get-data-preview-engine.d.ts +18 -0
  90. package/dist/engines/get-data-preview/index.d.ts +2 -0
  91. package/dist/engines/get-data-preview/types.d.ts +35 -0
  92. package/dist/engines/get-data-source-fields/get-data-source-fields-engine.d.ts +12 -6
  93. package/dist/engines/get-data-source-fields/index.d.ts +1 -0
  94. package/dist/engines/get-data-source-fields/model-relations.d.ts +38 -0
  95. package/dist/engines/get-data-source-fields/types.d.ts +53 -3
  96. package/dist/engines/get-data-sources/get-data-sources-engine.d.ts +1 -1
  97. package/dist/engines/get-data-sources/types.d.ts +2 -2
  98. package/dist/engines/index.d.ts +17 -0
  99. package/dist/engines/inspect-pulse/atomic-adapter.d.ts +8 -0
  100. package/dist/engines/inspect-pulse/atomic-tools.d.ts +60 -0
  101. package/dist/engines/inspect-pulse/index.d.ts +4 -0
  102. package/dist/engines/inspect-pulse/inspect-pulse-engine.d.ts +7 -0
  103. package/dist/engines/inspect-pulse/types.d.ts +209 -0
  104. package/dist/engines/manage-perspectives/manage-perspectives-engine.d.ts +5 -1
  105. package/dist/engines/manage-perspectives/types.d.ts +13 -8
  106. package/dist/engines/pulse-tool-words.d.ts +62 -0
  107. package/dist/engines/recommend-queries/recommend-queries-engine.d.ts +1 -1
  108. package/dist/engines/recommend-queries/types.d.ts +1 -1
  109. package/dist/engines/shared/existing-answer-cascade.d.ts +52 -0
  110. package/dist/engines/shared/get-filters-json-for-llm-summary.d.ts +2 -2
  111. package/dist/engines/shared/nlq-query-helpers.d.ts +2 -2
  112. package/dist/engines/shared/project-dashboard-json.d.ts +151 -0
  113. package/dist/engines/shared/project-widget-json.d.ts +67 -0
  114. package/dist/engines/shared/projection-helpers.d.ts +19 -0
  115. package/dist/engines/shared/redact-data-models-closed-to-ai.d.ts +55 -0
  116. package/dist/engines/shared/redact-hidden-columns-from-ai.d.ts +55 -0
  117. package/dist/index.d.ts +21 -0
  118. package/dist/index.js +56879 -27530
  119. package/dist/services/ai-access/ai-access-service.d.ts +68 -0
  120. package/dist/services/dashboards/dashboards-service.d.ts +9 -3
  121. package/dist/services/dashboards/fusion-dashboards-service.d.ts +34 -4
  122. package/dist/services/data-sources/data-sources-service.d.ts +149 -5
  123. package/dist/services/data-sources/find-data-source-by-title.d.ts +8 -0
  124. package/dist/services/datamodel-graph/datamodel-graph-service.d.ts +457 -0
  125. package/dist/services/existing-answer/existing-answer-query-service.d.ts +31 -0
  126. package/dist/services/formulas/formulas-service.d.ts +19 -0
  127. package/dist/services/hide-from-ai/hide-from-ai.d.ts +31 -0
  128. package/dist/services/knowledge-graph/knowledge-graph-service.d.ts +96 -0
  129. package/dist/services/llm/llm-consumption-service.d.ts +7 -2
  130. package/dist/services/llm/llm-models-service.d.ts +10 -2
  131. package/dist/services/llm/llm-settings-service.d.ts +73 -0
  132. package/dist/services/nlq/nlq-preview-dataset.d.ts +34 -0
  133. package/dist/services/nlq/nlq-service.d.ts +138 -3
  134. package/dist/services/pulse/evaluate-pulse-client.d.ts +78 -0
  135. package/dist/services/pulse/pulse-alerts-service.d.ts +264 -0
  136. package/dist/services/pulse/pulse-events-service.d.ts +217 -0
  137. package/dist/services/semantic-search/semantic-search-service.d.ts +43 -0
  138. package/dist/services/tool-store/tool-store-service.d.ts +32 -0
  139. package/dist/services/users-groups-service.d.ts +37 -0
  140. package/dist/skills/index.d.ts +127 -0
  141. package/dist/tool-availability/controlled-tools.d.ts +56 -0
  142. package/dist/tool-availability/index.d.ts +4 -0
  143. package/dist/tool-availability/offer-tools.d.ts +44 -0
  144. package/dist/tool-availability/resolve-tool-availability.d.ts +68 -0
  145. package/dist/tool-availability/withdrawn-text.d.ts +33 -0
  146. package/dist/tool-catalog/catalog.d.ts +387 -0
  147. package/dist/tool-catalog/index.d.ts +3 -0
  148. package/dist/tool-catalog/manifest.d.ts +5 -0
  149. package/dist/tool-catalog/prototype-lookup.d.ts +10 -0
  150. package/dist/tool-catalog/types.d.ts +67 -0
  151. package/dist/tools.manifest.json +826 -0
  152. package/dist/utils/chat-stream-errors.d.ts +42 -0
  153. package/dist/utils/create-custom-fetch.d.ts +19 -1
  154. package/dist/utils/create-stream-completion.d.ts +84 -6
  155. package/dist/utils/create-structured-completion.d.ts +29 -2
  156. package/dist/utils/create-tools-completion.d.ts +9 -0
  157. package/dist/utils/deferred-tools.d.ts +45 -0
  158. package/dist/utils/dev-debug.d.ts +5 -0
  159. package/dist/utils/generate-suggestions.d.ts +32 -0
  160. package/dist/utils/http-client.d.ts +3 -1
  161. package/dist/utils/llm-call-observer.d.ts +83 -0
  162. package/dist/utils/llm-client.d.ts +11 -1
  163. package/dist/utils/llm-model-override.d.ts +41 -0
  164. package/dist/utils/quoted-text.d.ts +6 -0
  165. package/dist/utils/server-error-body.d.ts +23 -0
  166. package/dist/utils/text-tokens.d.ts +35 -0
  167. package/dist/utils/user-action-tracking.d.ts +48 -5
  168. package/dist/utils/zod-utils.d.ts +9 -1
  169. package/package.json +28 -18
@@ -0,0 +1,1385 @@
1
+ import { z } from 'zod';
2
+ import { HttpClient } from '@sisense/sdk-rest-client';
3
+ import { JaqlQueryPayload } from '@sisense/sdk-query-client';
4
+ import { ExecuteQueryParams } from '@sisense/sdk-ui';
5
+ import { QueryJSON } from '@sisense/sdk-ui/analytics-composer';
6
+ import { EvaluatePulseResult, EvaluatePulseStep } from '../evaluate-pulse';
7
+ import { PulseKnowledge } from './shared/pulse-knowledge';
8
+ import { VisiblePulseAlertAction } from './shared/notification-urls';
9
+ import { PulseToolWords } from '../pulse-tool-words';
10
+ import { QueryResult } from '../build-query/types';
11
+ /**
12
+ * Redefinition classification for one query, comparing its previously-compiled query's `queryJSON`
13
+ * against a freshly re-authored one's for the same query name (deep-equal on the plain JSON
14
+ * translation, not `@sisense/sdk-ui`'s `haveQueryParamsChanged` on the live CSDK objects — MR !1027
15
+ * review; see `redefine.ts`'s own comment) — binary, not the three-way `unchanged`/`parametric`/
16
+ * `structural` split this had before (SNS-133319). Any detected change (including a literal-only tweak, e.g. a rank-limit
17
+ * count 10 -> 20) is `'changed'` and bumps `queryVersion`; only a byte-for-byte-equivalent
18
+ * redefine is `'unchanged'`. A version bump routes the next eval into the workflow's own safe
19
+ * `hasPriorData: false` path — the same treatment a brand-new workflow gets — rather than risk a
20
+ * misleading diff signal (e.g. a widened top-N surfacing newly-in-scope rows as a false "entered"
21
+ * burst).
22
+ */
23
+ export type QueryChangeClassification = 'unchanged' | 'changed';
24
+ /**
25
+ * A trend/forecast series longer than one evaluation reads: each cycle evaluates its newest
26
+ * `evaluated` of `points` (SNS-134141). Tell the user; nothing needs rebuilding.
27
+ */
28
+ export interface EvaluationWindow {
29
+ points: number;
30
+ evaluated: number;
31
+ }
32
+ /**
33
+ * Canonical tool description for authorPulse — reusable by any host (sdk-assistant, MCP server, custom integrations).
34
+ * Hosts may append host-specific notes but should not duplicate or contradict this text.
35
+ */
36
+ export declare const authorPulseToolDescription = "Assembles compiled queries (from buildQuery \u2014 this tool never runs NLQ) into a new/existing agentic Pulse workflow, and updates its spec or recipients/notifications.\n\nCall loadSkill('authorPulse') before the first call in a conversation \u2014 it has the trigger classification, decisionSpec cookbook, and authoring/update rules.\n\nEvery query stages under a workflowId \u2014 remember it and each query's name for later calls on the same workflow.\n\naction.type values:\n- \"define\": stage one NEW query (sourceId, queryId, name, transforms?). Omit workflowId to start a new workflow; reuse it to add another query. Stages only.\n- \"redefine\": re-stage one EXISTING staged query with a new queryId (workflowId, sourceId, queryId, name, transforms?) and classify the change. Stages only.\n- \"load-existing\": load an already-persisted workflow (workflowId = its real _id) into staging for redefine/update-spec. Call first for a workflow not yet touched this conversation.\n- \"create\": assemble staged queries into a brand-new workflow (workflowId, name, skill, decisionSpec). No named measure -> decline in chat.\n- \"update-spec\": change skill/decisionSpec/crossQueryTransforms (workflowId) from staging. A query's own transforms only change via define/redefine, never here.\n- \"update-workflow\": change name/enabled/frequency/recipients/notification channels (workflowId) on the live workflow.\n- \"set-receive-notifications\": mute/unmute the workflow for the caller only (workflowId, receive). Any recipient can use it.\n\nCRITICAL \u2014 \"create\" immediately creates a real Pulse workflow and runs its first evaluation, synchronously, with no undo (updates persist immediately too). Always confirm first, even when the request already stated the full workflow \u2014 show the compiled queries/transforms plus the plain-language rule, then wait for an explicit yes. Report results via each result's own message field. Use inspectPulse for follow-ups.";
37
+ declare const queryTransformInputFieldFor: (w: PulseToolWords) => z.ZodDiscriminatedUnion<[z.ZodObject<{
38
+ type: z.ZodLiteral<"diff">;
39
+ baseline: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
40
+ lastFired: "lastFired";
41
+ previousPeriod: "previousPeriod";
42
+ sameTimeLastWeek: "sameTimeLastWeek";
43
+ previousCycle: "previousCycle";
44
+ }>, z.ZodObject<{
45
+ cyclesAgo: z.ZodNumber;
46
+ }, z.core.$strip>]>>;
47
+ }, z.core.$strip>, z.ZodObject<{
48
+ type: z.ZodLiteral<"topNCheck">;
49
+ rankField: z.ZodString;
50
+ topN: z.ZodOptional<z.ZodNumber>;
51
+ }, z.core.$strip>, z.ZodObject<{
52
+ type: z.ZodLiteral<"anomalyCheck">;
53
+ method: z.ZodOptional<z.ZodEnum<{
54
+ zscore: "zscore";
55
+ }>>;
56
+ window: z.ZodOptional<z.ZodNumber>;
57
+ threshold: z.ZodOptional<z.ZodNumber>;
58
+ }, z.core.$strip>, z.ZodObject<{
59
+ window: z.ZodOptional<z.ZodNumber>;
60
+ ignoreAnomalies: z.ZodOptional<z.ZodBoolean>;
61
+ modelType: z.ZodOptional<z.ZodEnum<{
62
+ logarithmic: "logarithmic";
63
+ advancedSmoothing: "advancedSmoothing";
64
+ linear: "linear";
65
+ localEstimates: "localEstimates";
66
+ }>>;
67
+ type: z.ZodLiteral<"trendCheck">;
68
+ }, z.core.$strip>, z.ZodObject<{
69
+ confidenceInterval: z.ZodOptional<z.ZodNumber>;
70
+ endDate: z.ZodOptional<z.ZodString>;
71
+ forecastHorizon: z.ZodOptional<z.ZodNumber>;
72
+ lowerBound: z.ZodOptional<z.ZodNumber>;
73
+ modelType: z.ZodOptional<z.ZodEnum<{
74
+ auto: "auto";
75
+ autoArima: "autoArima";
76
+ holtWinters: "holtWinters";
77
+ prophet: "prophet";
78
+ }>>;
79
+ roundToInt: z.ZodOptional<z.ZodBoolean>;
80
+ startDate: z.ZodOptional<z.ZodString>;
81
+ upperBound: z.ZodOptional<z.ZodNumber>;
82
+ type: z.ZodLiteral<"forecastCheck">;
83
+ }, z.core.$strip>], "type">;
84
+ /**
85
+ * The transform types whose agent-declared input is NOT their final form — `compileQueryFromPrompt`
86
+ * resolves a real field name (`valueField`, and for trend/forecast `dateField` too) from the
87
+ * ACTUAL compiled query, rather than trusting an agent-typed string that only has to look right
88
+ * (SNS-133294: this happened live, twice, for `anomalyCheck.valueField` before it moved here).
89
+ * `trendCheck`/`forecastCheck` additionally tag the query's own measure with formula options
90
+ * before compiling; `anomalyCheck` doesn't change what the query compiles to, it's just read
91
+ * post-compile. Every other type's declaration already IS its final form.
92
+ *
93
+ * The single place that distinction lives — it drives both the `QueryTransform` type below and
94
+ * `splitTransformsForCompile`'s runtime split. Adding a future compile-resolved type means adding
95
+ * it here and to the input union; staging, persistence, and carry-forward all need no change.
96
+ */
97
+ export declare const COMPILE_RESOLVED_TRANSFORM_TYPES: readonly ["trendCheck", "forecastCheck", "anomalyCheck"];
98
+ declare const intervalFrequencyField: z.ZodObject<{
99
+ periodMode: z.ZodEnum<{
100
+ minutes: "minutes";
101
+ hours: "hours";
102
+ days: "days";
103
+ }>;
104
+ periodValue: z.ZodNumber;
105
+ }, z.core.$strip>;
106
+ /** One cadence shape for `create` and `update-workflow` — interval (legacy) or calendar (cron). */
107
+ declare const frequencyObjectField: z.ZodDiscriminatedUnion<[z.ZodObject<{
108
+ periodMode: z.ZodEnum<{
109
+ minutes: "minutes";
110
+ hours: "hours";
111
+ days: "days";
112
+ }>;
113
+ periodValue: z.ZodNumber;
114
+ }, z.core.$strip>, z.ZodObject<{
115
+ periodMode: z.ZodLiteral<"cron">;
116
+ cron: z.ZodString;
117
+ timeZone: z.ZodOptional<z.ZodString>;
118
+ }, z.core.$strip>], "periodMode">;
119
+ /**
120
+ * The `authorPulse` action variants, with field descriptions in `w`'s words: the composite union
121
+ * below uses the action names, the atomic tools (`atomic-tools.ts`) the tool names. One definition, so
122
+ * the two can differ only in prose.
123
+ */
124
+ export declare const authorPulseActionVariants: (w: PulseToolWords) => readonly [z.ZodObject<{
125
+ type: z.ZodLiteral<"define">;
126
+ workflowId: z.ZodOptional<z.ZodString>;
127
+ sourceId: z.ZodString;
128
+ queryId: z.ZodString;
129
+ name: z.ZodString;
130
+ purpose: z.ZodOptional<z.ZodString>;
131
+ transforms: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
132
+ type: z.ZodLiteral<"diff">;
133
+ baseline: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
134
+ lastFired: "lastFired";
135
+ previousPeriod: "previousPeriod";
136
+ sameTimeLastWeek: "sameTimeLastWeek";
137
+ previousCycle: "previousCycle";
138
+ }>, z.ZodObject<{
139
+ cyclesAgo: z.ZodNumber;
140
+ }, z.core.$strip>]>>;
141
+ }, z.core.$strip>, z.ZodObject<{
142
+ type: z.ZodLiteral<"topNCheck">;
143
+ rankField: z.ZodString;
144
+ topN: z.ZodOptional<z.ZodNumber>;
145
+ }, z.core.$strip>, z.ZodObject<{
146
+ type: z.ZodLiteral<"anomalyCheck">;
147
+ method: z.ZodOptional<z.ZodEnum<{
148
+ zscore: "zscore";
149
+ }>>;
150
+ window: z.ZodOptional<z.ZodNumber>;
151
+ threshold: z.ZodOptional<z.ZodNumber>;
152
+ }, z.core.$strip>, z.ZodObject<{
153
+ window: z.ZodOptional<z.ZodNumber>;
154
+ ignoreAnomalies: z.ZodOptional<z.ZodBoolean>;
155
+ modelType: z.ZodOptional<z.ZodEnum<{
156
+ logarithmic: "logarithmic";
157
+ advancedSmoothing: "advancedSmoothing";
158
+ linear: "linear";
159
+ localEstimates: "localEstimates";
160
+ }>>;
161
+ type: z.ZodLiteral<"trendCheck">;
162
+ }, z.core.$strip>, z.ZodObject<{
163
+ confidenceInterval: z.ZodOptional<z.ZodNumber>;
164
+ endDate: z.ZodOptional<z.ZodString>;
165
+ forecastHorizon: z.ZodOptional<z.ZodNumber>;
166
+ lowerBound: z.ZodOptional<z.ZodNumber>;
167
+ modelType: z.ZodOptional<z.ZodEnum<{
168
+ auto: "auto";
169
+ autoArima: "autoArima";
170
+ holtWinters: "holtWinters";
171
+ prophet: "prophet";
172
+ }>>;
173
+ roundToInt: z.ZodOptional<z.ZodBoolean>;
174
+ startDate: z.ZodOptional<z.ZodString>;
175
+ upperBound: z.ZodOptional<z.ZodNumber>;
176
+ type: z.ZodLiteral<"forecastCheck">;
177
+ }, z.core.$strip>], "type">>>;
178
+ }, z.core.$strip>, z.ZodObject<{
179
+ type: z.ZodLiteral<"redefine">;
180
+ workflowId: z.ZodString;
181
+ sourceId: z.ZodString;
182
+ queryId: z.ZodString;
183
+ name: z.ZodString;
184
+ purpose: z.ZodOptional<z.ZodString>;
185
+ transforms: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
186
+ type: z.ZodLiteral<"diff">;
187
+ baseline: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
188
+ lastFired: "lastFired";
189
+ previousPeriod: "previousPeriod";
190
+ sameTimeLastWeek: "sameTimeLastWeek";
191
+ previousCycle: "previousCycle";
192
+ }>, z.ZodObject<{
193
+ cyclesAgo: z.ZodNumber;
194
+ }, z.core.$strip>]>>;
195
+ }, z.core.$strip>, z.ZodObject<{
196
+ type: z.ZodLiteral<"topNCheck">;
197
+ rankField: z.ZodString;
198
+ topN: z.ZodOptional<z.ZodNumber>;
199
+ }, z.core.$strip>, z.ZodObject<{
200
+ type: z.ZodLiteral<"anomalyCheck">;
201
+ method: z.ZodOptional<z.ZodEnum<{
202
+ zscore: "zscore";
203
+ }>>;
204
+ window: z.ZodOptional<z.ZodNumber>;
205
+ threshold: z.ZodOptional<z.ZodNumber>;
206
+ }, z.core.$strip>, z.ZodObject<{
207
+ window: z.ZodOptional<z.ZodNumber>;
208
+ ignoreAnomalies: z.ZodOptional<z.ZodBoolean>;
209
+ modelType: z.ZodOptional<z.ZodEnum<{
210
+ logarithmic: "logarithmic";
211
+ advancedSmoothing: "advancedSmoothing";
212
+ linear: "linear";
213
+ localEstimates: "localEstimates";
214
+ }>>;
215
+ type: z.ZodLiteral<"trendCheck">;
216
+ }, z.core.$strip>, z.ZodObject<{
217
+ confidenceInterval: z.ZodOptional<z.ZodNumber>;
218
+ endDate: z.ZodOptional<z.ZodString>;
219
+ forecastHorizon: z.ZodOptional<z.ZodNumber>;
220
+ lowerBound: z.ZodOptional<z.ZodNumber>;
221
+ modelType: z.ZodOptional<z.ZodEnum<{
222
+ auto: "auto";
223
+ autoArima: "autoArima";
224
+ holtWinters: "holtWinters";
225
+ prophet: "prophet";
226
+ }>>;
227
+ roundToInt: z.ZodOptional<z.ZodBoolean>;
228
+ startDate: z.ZodOptional<z.ZodString>;
229
+ upperBound: z.ZodOptional<z.ZodNumber>;
230
+ type: z.ZodLiteral<"forecastCheck">;
231
+ }, z.core.$strip>], "type">>>;
232
+ }, z.core.$strip>, z.ZodObject<{
233
+ type: z.ZodLiteral<"load-existing">;
234
+ workflowId: z.ZodString;
235
+ }, z.core.$strip>, z.ZodObject<{
236
+ type: z.ZodLiteral<"create">;
237
+ workflowId: z.ZodString;
238
+ removedQueryNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
239
+ name: z.ZodString;
240
+ skill: z.ZodString;
241
+ frequency: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
242
+ periodMode: z.ZodEnum<{
243
+ minutes: "minutes";
244
+ hours: "hours";
245
+ days: "days";
246
+ }>;
247
+ periodValue: z.ZodNumber;
248
+ }, z.core.$strip>, z.ZodObject<{
249
+ periodMode: z.ZodLiteral<"cron">;
250
+ cron: z.ZodString;
251
+ timeZone: z.ZodOptional<z.ZodString>;
252
+ }, z.core.$strip>], "periodMode">>;
253
+ decisionSpec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
254
+ crossQueryTransforms: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
255
+ type: z.ZodLiteral<"arithmetic">;
256
+ name: z.ZodString;
257
+ op: z.ZodEnum<{
258
+ diff: "diff";
259
+ ratio: "ratio";
260
+ pctDiff: "pctDiff";
261
+ }>;
262
+ left: z.ZodString;
263
+ right: z.ZodString;
264
+ }, z.core.$strip>, z.ZodObject<{
265
+ type: z.ZodLiteral<"rankCompare">;
266
+ name: z.ZodString;
267
+ left: z.ZodString;
268
+ right: z.ZodString;
269
+ keyField: z.ZodString;
270
+ rightKeyField: z.ZodOptional<z.ZodString>;
271
+ topN: z.ZodOptional<z.ZodNumber>;
272
+ }, z.core.$strip>, z.ZodObject<{
273
+ type: z.ZodLiteral<"valueCompare">;
274
+ name: z.ZodString;
275
+ left: z.ZodString;
276
+ right: z.ZodString;
277
+ keyField: z.ZodString;
278
+ rightKeyField: z.ZodOptional<z.ZodString>;
279
+ valueField: z.ZodString;
280
+ rightValueField: z.ZodOptional<z.ZodString>;
281
+ op: z.ZodEnum<{
282
+ diff: "diff";
283
+ ratio: "ratio";
284
+ pctDiff: "pctDiff";
285
+ }>;
286
+ breachWhen: z.ZodObject<{
287
+ operator: z.ZodEnum<{
288
+ lessThan: "lessThan";
289
+ lessThanInclusive: "lessThanInclusive";
290
+ greaterThan: "greaterThan";
291
+ greaterThanInclusive: "greaterThanInclusive";
292
+ }>;
293
+ value: z.ZodNumber;
294
+ }, z.core.$strip>;
295
+ }, z.core.$strip>], "type">>>;
296
+ evaluateNow: z.ZodOptional<z.ZodBoolean>;
297
+ }, z.core.$strip>, z.ZodObject<{
298
+ type: z.ZodLiteral<"update-spec">;
299
+ workflowId: z.ZodString;
300
+ removedQueryNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
301
+ skill: z.ZodOptional<z.ZodString>;
302
+ decisionSpec: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
303
+ crossQueryTransforms: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
304
+ type: z.ZodLiteral<"arithmetic">;
305
+ name: z.ZodString;
306
+ op: z.ZodEnum<{
307
+ diff: "diff";
308
+ ratio: "ratio";
309
+ pctDiff: "pctDiff";
310
+ }>;
311
+ left: z.ZodString;
312
+ right: z.ZodString;
313
+ }, z.core.$strip>, z.ZodObject<{
314
+ type: z.ZodLiteral<"rankCompare">;
315
+ name: z.ZodString;
316
+ left: z.ZodString;
317
+ right: z.ZodString;
318
+ keyField: z.ZodString;
319
+ rightKeyField: z.ZodOptional<z.ZodString>;
320
+ topN: z.ZodOptional<z.ZodNumber>;
321
+ }, z.core.$strip>, z.ZodObject<{
322
+ type: z.ZodLiteral<"valueCompare">;
323
+ name: z.ZodString;
324
+ left: z.ZodString;
325
+ right: z.ZodString;
326
+ keyField: z.ZodString;
327
+ rightKeyField: z.ZodOptional<z.ZodString>;
328
+ valueField: z.ZodString;
329
+ rightValueField: z.ZodOptional<z.ZodString>;
330
+ op: z.ZodEnum<{
331
+ diff: "diff";
332
+ ratio: "ratio";
333
+ pctDiff: "pctDiff";
334
+ }>;
335
+ breachWhen: z.ZodObject<{
336
+ operator: z.ZodEnum<{
337
+ lessThan: "lessThan";
338
+ lessThanInclusive: "lessThanInclusive";
339
+ greaterThan: "greaterThan";
340
+ greaterThanInclusive: "greaterThanInclusive";
341
+ }>;
342
+ value: z.ZodNumber;
343
+ }, z.core.$strip>;
344
+ }, z.core.$strip>], "type">>>;
345
+ }, z.core.$strip>, z.ZodObject<{
346
+ type: z.ZodLiteral<"update-workflow">;
347
+ workflowId: z.ZodString;
348
+ name: z.ZodOptional<z.ZodString>;
349
+ message: z.ZodOptional<z.ZodString>;
350
+ enabled: z.ZodOptional<z.ZodBoolean>;
351
+ frequency: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
352
+ periodMode: z.ZodEnum<{
353
+ minutes: "minutes";
354
+ hours: "hours";
355
+ days: "days";
356
+ }>;
357
+ periodValue: z.ZodNumber;
358
+ }, z.core.$strip>, z.ZodObject<{
359
+ periodMode: z.ZodLiteral<"cron">;
360
+ cron: z.ZodString;
361
+ timeZone: z.ZodOptional<z.ZodString>;
362
+ }, z.core.$strip>], "periodMode">>;
363
+ addRecipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
364
+ type: z.ZodEnum<{
365
+ user: "user";
366
+ group: "group";
367
+ adgroup: "adgroup";
368
+ }>;
369
+ id: z.ZodOptional<z.ZodString>;
370
+ email: z.ZodOptional<z.ZodString>;
371
+ name: z.ZodOptional<z.ZodString>;
372
+ }, z.core.$strip>>>;
373
+ removeRecipientIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
374
+ disabledUserIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
375
+ notifications: z.ZodOptional<z.ZodObject<{
376
+ email: z.ZodOptional<z.ZodBoolean>;
377
+ mobile: z.ZodOptional<z.ZodBoolean>;
378
+ feed: z.ZodOptional<z.ZodBoolean>;
379
+ slack: z.ZodOptional<z.ZodObject<{
380
+ active: z.ZodBoolean;
381
+ url: z.ZodOptional<z.ZodString>;
382
+ channels: z.ZodOptional<z.ZodString>;
383
+ }, z.core.$strip>>;
384
+ zapier: z.ZodOptional<z.ZodObject<{
385
+ active: z.ZodBoolean;
386
+ url: z.ZodOptional<z.ZodString>;
387
+ }, z.core.$strip>>;
388
+ webhooks: z.ZodOptional<z.ZodArray<z.ZodObject<{
389
+ name: z.ZodString;
390
+ url: z.ZodOptional<z.ZodString>;
391
+ active: z.ZodBoolean;
392
+ }, z.core.$strip>>>;
393
+ }, z.core.$strip>>;
394
+ }, z.core.$strip>, z.ZodObject<{
395
+ type: z.ZodLiteral<"set-receive-notifications">;
396
+ workflowId: z.ZodString;
397
+ receive: z.ZodBoolean;
398
+ }, z.core.$strip>];
399
+ /** JSON-Schema-safe union — validated again at execution time in the engine. */
400
+ export declare const authorPulseActionSchema: z.ZodDiscriminatedUnion<readonly [z.ZodObject<{
401
+ type: z.ZodLiteral<"define">;
402
+ workflowId: z.ZodOptional<z.ZodString>;
403
+ sourceId: z.ZodString;
404
+ queryId: z.ZodString;
405
+ name: z.ZodString;
406
+ purpose: z.ZodOptional<z.ZodString>;
407
+ transforms: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
408
+ type: z.ZodLiteral<"diff">;
409
+ baseline: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
410
+ lastFired: "lastFired";
411
+ previousPeriod: "previousPeriod";
412
+ sameTimeLastWeek: "sameTimeLastWeek";
413
+ previousCycle: "previousCycle";
414
+ }>, z.ZodObject<{
415
+ cyclesAgo: z.ZodNumber;
416
+ }, z.core.$strip>]>>;
417
+ }, z.core.$strip>, z.ZodObject<{
418
+ type: z.ZodLiteral<"topNCheck">;
419
+ rankField: z.ZodString;
420
+ topN: z.ZodOptional<z.ZodNumber>;
421
+ }, z.core.$strip>, z.ZodObject<{
422
+ type: z.ZodLiteral<"anomalyCheck">;
423
+ method: z.ZodOptional<z.ZodEnum<{
424
+ zscore: "zscore";
425
+ }>>;
426
+ window: z.ZodOptional<z.ZodNumber>;
427
+ threshold: z.ZodOptional<z.ZodNumber>;
428
+ }, z.core.$strip>, z.ZodObject<{
429
+ window: z.ZodOptional<z.ZodNumber>;
430
+ ignoreAnomalies: z.ZodOptional<z.ZodBoolean>;
431
+ modelType: z.ZodOptional<z.ZodEnum<{
432
+ logarithmic: "logarithmic";
433
+ advancedSmoothing: "advancedSmoothing";
434
+ linear: "linear";
435
+ localEstimates: "localEstimates";
436
+ }>>;
437
+ type: z.ZodLiteral<"trendCheck">;
438
+ }, z.core.$strip>, z.ZodObject<{
439
+ confidenceInterval: z.ZodOptional<z.ZodNumber>;
440
+ endDate: z.ZodOptional<z.ZodString>;
441
+ forecastHorizon: z.ZodOptional<z.ZodNumber>;
442
+ lowerBound: z.ZodOptional<z.ZodNumber>;
443
+ modelType: z.ZodOptional<z.ZodEnum<{
444
+ auto: "auto";
445
+ autoArima: "autoArima";
446
+ holtWinters: "holtWinters";
447
+ prophet: "prophet";
448
+ }>>;
449
+ roundToInt: z.ZodOptional<z.ZodBoolean>;
450
+ startDate: z.ZodOptional<z.ZodString>;
451
+ upperBound: z.ZodOptional<z.ZodNumber>;
452
+ type: z.ZodLiteral<"forecastCheck">;
453
+ }, z.core.$strip>], "type">>>;
454
+ }, z.core.$strip>, z.ZodObject<{
455
+ type: z.ZodLiteral<"redefine">;
456
+ workflowId: z.ZodString;
457
+ sourceId: z.ZodString;
458
+ queryId: z.ZodString;
459
+ name: z.ZodString;
460
+ purpose: z.ZodOptional<z.ZodString>;
461
+ transforms: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
462
+ type: z.ZodLiteral<"diff">;
463
+ baseline: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
464
+ lastFired: "lastFired";
465
+ previousPeriod: "previousPeriod";
466
+ sameTimeLastWeek: "sameTimeLastWeek";
467
+ previousCycle: "previousCycle";
468
+ }>, z.ZodObject<{
469
+ cyclesAgo: z.ZodNumber;
470
+ }, z.core.$strip>]>>;
471
+ }, z.core.$strip>, z.ZodObject<{
472
+ type: z.ZodLiteral<"topNCheck">;
473
+ rankField: z.ZodString;
474
+ topN: z.ZodOptional<z.ZodNumber>;
475
+ }, z.core.$strip>, z.ZodObject<{
476
+ type: z.ZodLiteral<"anomalyCheck">;
477
+ method: z.ZodOptional<z.ZodEnum<{
478
+ zscore: "zscore";
479
+ }>>;
480
+ window: z.ZodOptional<z.ZodNumber>;
481
+ threshold: z.ZodOptional<z.ZodNumber>;
482
+ }, z.core.$strip>, z.ZodObject<{
483
+ window: z.ZodOptional<z.ZodNumber>;
484
+ ignoreAnomalies: z.ZodOptional<z.ZodBoolean>;
485
+ modelType: z.ZodOptional<z.ZodEnum<{
486
+ logarithmic: "logarithmic";
487
+ advancedSmoothing: "advancedSmoothing";
488
+ linear: "linear";
489
+ localEstimates: "localEstimates";
490
+ }>>;
491
+ type: z.ZodLiteral<"trendCheck">;
492
+ }, z.core.$strip>, z.ZodObject<{
493
+ confidenceInterval: z.ZodOptional<z.ZodNumber>;
494
+ endDate: z.ZodOptional<z.ZodString>;
495
+ forecastHorizon: z.ZodOptional<z.ZodNumber>;
496
+ lowerBound: z.ZodOptional<z.ZodNumber>;
497
+ modelType: z.ZodOptional<z.ZodEnum<{
498
+ auto: "auto";
499
+ autoArima: "autoArima";
500
+ holtWinters: "holtWinters";
501
+ prophet: "prophet";
502
+ }>>;
503
+ roundToInt: z.ZodOptional<z.ZodBoolean>;
504
+ startDate: z.ZodOptional<z.ZodString>;
505
+ upperBound: z.ZodOptional<z.ZodNumber>;
506
+ type: z.ZodLiteral<"forecastCheck">;
507
+ }, z.core.$strip>], "type">>>;
508
+ }, z.core.$strip>, z.ZodObject<{
509
+ type: z.ZodLiteral<"load-existing">;
510
+ workflowId: z.ZodString;
511
+ }, z.core.$strip>, z.ZodObject<{
512
+ type: z.ZodLiteral<"create">;
513
+ workflowId: z.ZodString;
514
+ removedQueryNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
515
+ name: z.ZodString;
516
+ skill: z.ZodString;
517
+ frequency: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
518
+ periodMode: z.ZodEnum<{
519
+ minutes: "minutes";
520
+ hours: "hours";
521
+ days: "days";
522
+ }>;
523
+ periodValue: z.ZodNumber;
524
+ }, z.core.$strip>, z.ZodObject<{
525
+ periodMode: z.ZodLiteral<"cron">;
526
+ cron: z.ZodString;
527
+ timeZone: z.ZodOptional<z.ZodString>;
528
+ }, z.core.$strip>], "periodMode">>;
529
+ decisionSpec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
530
+ crossQueryTransforms: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
531
+ type: z.ZodLiteral<"arithmetic">;
532
+ name: z.ZodString;
533
+ op: z.ZodEnum<{
534
+ diff: "diff";
535
+ ratio: "ratio";
536
+ pctDiff: "pctDiff";
537
+ }>;
538
+ left: z.ZodString;
539
+ right: z.ZodString;
540
+ }, z.core.$strip>, z.ZodObject<{
541
+ type: z.ZodLiteral<"rankCompare">;
542
+ name: z.ZodString;
543
+ left: z.ZodString;
544
+ right: z.ZodString;
545
+ keyField: z.ZodString;
546
+ rightKeyField: z.ZodOptional<z.ZodString>;
547
+ topN: z.ZodOptional<z.ZodNumber>;
548
+ }, z.core.$strip>, z.ZodObject<{
549
+ type: z.ZodLiteral<"valueCompare">;
550
+ name: z.ZodString;
551
+ left: z.ZodString;
552
+ right: z.ZodString;
553
+ keyField: z.ZodString;
554
+ rightKeyField: z.ZodOptional<z.ZodString>;
555
+ valueField: z.ZodString;
556
+ rightValueField: z.ZodOptional<z.ZodString>;
557
+ op: z.ZodEnum<{
558
+ diff: "diff";
559
+ ratio: "ratio";
560
+ pctDiff: "pctDiff";
561
+ }>;
562
+ breachWhen: z.ZodObject<{
563
+ operator: z.ZodEnum<{
564
+ lessThan: "lessThan";
565
+ lessThanInclusive: "lessThanInclusive";
566
+ greaterThan: "greaterThan";
567
+ greaterThanInclusive: "greaterThanInclusive";
568
+ }>;
569
+ value: z.ZodNumber;
570
+ }, z.core.$strip>;
571
+ }, z.core.$strip>], "type">>>;
572
+ evaluateNow: z.ZodOptional<z.ZodBoolean>;
573
+ }, z.core.$strip>, z.ZodObject<{
574
+ type: z.ZodLiteral<"update-spec">;
575
+ workflowId: z.ZodString;
576
+ removedQueryNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
577
+ skill: z.ZodOptional<z.ZodString>;
578
+ decisionSpec: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
579
+ crossQueryTransforms: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
580
+ type: z.ZodLiteral<"arithmetic">;
581
+ name: z.ZodString;
582
+ op: z.ZodEnum<{
583
+ diff: "diff";
584
+ ratio: "ratio";
585
+ pctDiff: "pctDiff";
586
+ }>;
587
+ left: z.ZodString;
588
+ right: z.ZodString;
589
+ }, z.core.$strip>, z.ZodObject<{
590
+ type: z.ZodLiteral<"rankCompare">;
591
+ name: z.ZodString;
592
+ left: z.ZodString;
593
+ right: z.ZodString;
594
+ keyField: z.ZodString;
595
+ rightKeyField: z.ZodOptional<z.ZodString>;
596
+ topN: z.ZodOptional<z.ZodNumber>;
597
+ }, z.core.$strip>, z.ZodObject<{
598
+ type: z.ZodLiteral<"valueCompare">;
599
+ name: z.ZodString;
600
+ left: z.ZodString;
601
+ right: z.ZodString;
602
+ keyField: z.ZodString;
603
+ rightKeyField: z.ZodOptional<z.ZodString>;
604
+ valueField: z.ZodString;
605
+ rightValueField: z.ZodOptional<z.ZodString>;
606
+ op: z.ZodEnum<{
607
+ diff: "diff";
608
+ ratio: "ratio";
609
+ pctDiff: "pctDiff";
610
+ }>;
611
+ breachWhen: z.ZodObject<{
612
+ operator: z.ZodEnum<{
613
+ lessThan: "lessThan";
614
+ lessThanInclusive: "lessThanInclusive";
615
+ greaterThan: "greaterThan";
616
+ greaterThanInclusive: "greaterThanInclusive";
617
+ }>;
618
+ value: z.ZodNumber;
619
+ }, z.core.$strip>;
620
+ }, z.core.$strip>], "type">>>;
621
+ }, z.core.$strip>, z.ZodObject<{
622
+ type: z.ZodLiteral<"update-workflow">;
623
+ workflowId: z.ZodString;
624
+ name: z.ZodOptional<z.ZodString>;
625
+ message: z.ZodOptional<z.ZodString>;
626
+ enabled: z.ZodOptional<z.ZodBoolean>;
627
+ frequency: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
628
+ periodMode: z.ZodEnum<{
629
+ minutes: "minutes";
630
+ hours: "hours";
631
+ days: "days";
632
+ }>;
633
+ periodValue: z.ZodNumber;
634
+ }, z.core.$strip>, z.ZodObject<{
635
+ periodMode: z.ZodLiteral<"cron">;
636
+ cron: z.ZodString;
637
+ timeZone: z.ZodOptional<z.ZodString>;
638
+ }, z.core.$strip>], "periodMode">>;
639
+ addRecipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
640
+ type: z.ZodEnum<{
641
+ user: "user";
642
+ group: "group";
643
+ adgroup: "adgroup";
644
+ }>;
645
+ id: z.ZodOptional<z.ZodString>;
646
+ email: z.ZodOptional<z.ZodString>;
647
+ name: z.ZodOptional<z.ZodString>;
648
+ }, z.core.$strip>>>;
649
+ removeRecipientIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
650
+ disabledUserIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
651
+ notifications: z.ZodOptional<z.ZodObject<{
652
+ email: z.ZodOptional<z.ZodBoolean>;
653
+ mobile: z.ZodOptional<z.ZodBoolean>;
654
+ feed: z.ZodOptional<z.ZodBoolean>;
655
+ slack: z.ZodOptional<z.ZodObject<{
656
+ active: z.ZodBoolean;
657
+ url: z.ZodOptional<z.ZodString>;
658
+ channels: z.ZodOptional<z.ZodString>;
659
+ }, z.core.$strip>>;
660
+ zapier: z.ZodOptional<z.ZodObject<{
661
+ active: z.ZodBoolean;
662
+ url: z.ZodOptional<z.ZodString>;
663
+ }, z.core.$strip>>;
664
+ webhooks: z.ZodOptional<z.ZodArray<z.ZodObject<{
665
+ name: z.ZodString;
666
+ url: z.ZodOptional<z.ZodString>;
667
+ active: z.ZodBoolean;
668
+ }, z.core.$strip>>>;
669
+ }, z.core.$strip>>;
670
+ }, z.core.$strip>, z.ZodObject<{
671
+ type: z.ZodLiteral<"set-receive-notifications">;
672
+ workflowId: z.ZodString;
673
+ receive: z.ZodBoolean;
674
+ }, z.core.$strip>], "type">;
675
+ export type AuthorPulseAction = z.infer<typeof authorPulseActionSchema>;
676
+ export declare const authorPulseSchema: z.ZodObject<{
677
+ action: z.ZodDiscriminatedUnion<readonly [z.ZodObject<{
678
+ type: z.ZodLiteral<"define">;
679
+ workflowId: z.ZodOptional<z.ZodString>;
680
+ sourceId: z.ZodString;
681
+ queryId: z.ZodString;
682
+ name: z.ZodString;
683
+ purpose: z.ZodOptional<z.ZodString>;
684
+ transforms: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
685
+ type: z.ZodLiteral<"diff">;
686
+ baseline: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
687
+ lastFired: "lastFired";
688
+ previousPeriod: "previousPeriod";
689
+ sameTimeLastWeek: "sameTimeLastWeek";
690
+ previousCycle: "previousCycle";
691
+ }>, z.ZodObject<{
692
+ cyclesAgo: z.ZodNumber;
693
+ }, z.core.$strip>]>>;
694
+ }, z.core.$strip>, z.ZodObject<{
695
+ type: z.ZodLiteral<"topNCheck">;
696
+ rankField: z.ZodString;
697
+ topN: z.ZodOptional<z.ZodNumber>;
698
+ }, z.core.$strip>, z.ZodObject<{
699
+ type: z.ZodLiteral<"anomalyCheck">;
700
+ method: z.ZodOptional<z.ZodEnum<{
701
+ zscore: "zscore";
702
+ }>>;
703
+ window: z.ZodOptional<z.ZodNumber>;
704
+ threshold: z.ZodOptional<z.ZodNumber>;
705
+ }, z.core.$strip>, z.ZodObject<{
706
+ window: z.ZodOptional<z.ZodNumber>;
707
+ ignoreAnomalies: z.ZodOptional<z.ZodBoolean>;
708
+ modelType: z.ZodOptional<z.ZodEnum<{
709
+ logarithmic: "logarithmic";
710
+ advancedSmoothing: "advancedSmoothing";
711
+ linear: "linear";
712
+ localEstimates: "localEstimates";
713
+ }>>;
714
+ type: z.ZodLiteral<"trendCheck">;
715
+ }, z.core.$strip>, z.ZodObject<{
716
+ confidenceInterval: z.ZodOptional<z.ZodNumber>;
717
+ endDate: z.ZodOptional<z.ZodString>;
718
+ forecastHorizon: z.ZodOptional<z.ZodNumber>;
719
+ lowerBound: z.ZodOptional<z.ZodNumber>;
720
+ modelType: z.ZodOptional<z.ZodEnum<{
721
+ auto: "auto";
722
+ autoArima: "autoArima";
723
+ holtWinters: "holtWinters";
724
+ prophet: "prophet";
725
+ }>>;
726
+ roundToInt: z.ZodOptional<z.ZodBoolean>;
727
+ startDate: z.ZodOptional<z.ZodString>;
728
+ upperBound: z.ZodOptional<z.ZodNumber>;
729
+ type: z.ZodLiteral<"forecastCheck">;
730
+ }, z.core.$strip>], "type">>>;
731
+ }, z.core.$strip>, z.ZodObject<{
732
+ type: z.ZodLiteral<"redefine">;
733
+ workflowId: z.ZodString;
734
+ sourceId: z.ZodString;
735
+ queryId: z.ZodString;
736
+ name: z.ZodString;
737
+ purpose: z.ZodOptional<z.ZodString>;
738
+ transforms: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
739
+ type: z.ZodLiteral<"diff">;
740
+ baseline: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
741
+ lastFired: "lastFired";
742
+ previousPeriod: "previousPeriod";
743
+ sameTimeLastWeek: "sameTimeLastWeek";
744
+ previousCycle: "previousCycle";
745
+ }>, z.ZodObject<{
746
+ cyclesAgo: z.ZodNumber;
747
+ }, z.core.$strip>]>>;
748
+ }, z.core.$strip>, z.ZodObject<{
749
+ type: z.ZodLiteral<"topNCheck">;
750
+ rankField: z.ZodString;
751
+ topN: z.ZodOptional<z.ZodNumber>;
752
+ }, z.core.$strip>, z.ZodObject<{
753
+ type: z.ZodLiteral<"anomalyCheck">;
754
+ method: z.ZodOptional<z.ZodEnum<{
755
+ zscore: "zscore";
756
+ }>>;
757
+ window: z.ZodOptional<z.ZodNumber>;
758
+ threshold: z.ZodOptional<z.ZodNumber>;
759
+ }, z.core.$strip>, z.ZodObject<{
760
+ window: z.ZodOptional<z.ZodNumber>;
761
+ ignoreAnomalies: z.ZodOptional<z.ZodBoolean>;
762
+ modelType: z.ZodOptional<z.ZodEnum<{
763
+ logarithmic: "logarithmic";
764
+ advancedSmoothing: "advancedSmoothing";
765
+ linear: "linear";
766
+ localEstimates: "localEstimates";
767
+ }>>;
768
+ type: z.ZodLiteral<"trendCheck">;
769
+ }, z.core.$strip>, z.ZodObject<{
770
+ confidenceInterval: z.ZodOptional<z.ZodNumber>;
771
+ endDate: z.ZodOptional<z.ZodString>;
772
+ forecastHorizon: z.ZodOptional<z.ZodNumber>;
773
+ lowerBound: z.ZodOptional<z.ZodNumber>;
774
+ modelType: z.ZodOptional<z.ZodEnum<{
775
+ auto: "auto";
776
+ autoArima: "autoArima";
777
+ holtWinters: "holtWinters";
778
+ prophet: "prophet";
779
+ }>>;
780
+ roundToInt: z.ZodOptional<z.ZodBoolean>;
781
+ startDate: z.ZodOptional<z.ZodString>;
782
+ upperBound: z.ZodOptional<z.ZodNumber>;
783
+ type: z.ZodLiteral<"forecastCheck">;
784
+ }, z.core.$strip>], "type">>>;
785
+ }, z.core.$strip>, z.ZodObject<{
786
+ type: z.ZodLiteral<"load-existing">;
787
+ workflowId: z.ZodString;
788
+ }, z.core.$strip>, z.ZodObject<{
789
+ type: z.ZodLiteral<"create">;
790
+ workflowId: z.ZodString;
791
+ removedQueryNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
792
+ name: z.ZodString;
793
+ skill: z.ZodString;
794
+ frequency: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
795
+ periodMode: z.ZodEnum<{
796
+ minutes: "minutes";
797
+ hours: "hours";
798
+ days: "days";
799
+ }>;
800
+ periodValue: z.ZodNumber;
801
+ }, z.core.$strip>, z.ZodObject<{
802
+ periodMode: z.ZodLiteral<"cron">;
803
+ cron: z.ZodString;
804
+ timeZone: z.ZodOptional<z.ZodString>;
805
+ }, z.core.$strip>], "periodMode">>;
806
+ decisionSpec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
807
+ crossQueryTransforms: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
808
+ type: z.ZodLiteral<"arithmetic">;
809
+ name: z.ZodString;
810
+ op: z.ZodEnum<{
811
+ diff: "diff";
812
+ ratio: "ratio";
813
+ pctDiff: "pctDiff";
814
+ }>;
815
+ left: z.ZodString;
816
+ right: z.ZodString;
817
+ }, z.core.$strip>, z.ZodObject<{
818
+ type: z.ZodLiteral<"rankCompare">;
819
+ name: z.ZodString;
820
+ left: z.ZodString;
821
+ right: z.ZodString;
822
+ keyField: z.ZodString;
823
+ rightKeyField: z.ZodOptional<z.ZodString>;
824
+ topN: z.ZodOptional<z.ZodNumber>;
825
+ }, z.core.$strip>, z.ZodObject<{
826
+ type: z.ZodLiteral<"valueCompare">;
827
+ name: z.ZodString;
828
+ left: z.ZodString;
829
+ right: z.ZodString;
830
+ keyField: z.ZodString;
831
+ rightKeyField: z.ZodOptional<z.ZodString>;
832
+ valueField: z.ZodString;
833
+ rightValueField: z.ZodOptional<z.ZodString>;
834
+ op: z.ZodEnum<{
835
+ diff: "diff";
836
+ ratio: "ratio";
837
+ pctDiff: "pctDiff";
838
+ }>;
839
+ breachWhen: z.ZodObject<{
840
+ operator: z.ZodEnum<{
841
+ lessThan: "lessThan";
842
+ lessThanInclusive: "lessThanInclusive";
843
+ greaterThan: "greaterThan";
844
+ greaterThanInclusive: "greaterThanInclusive";
845
+ }>;
846
+ value: z.ZodNumber;
847
+ }, z.core.$strip>;
848
+ }, z.core.$strip>], "type">>>;
849
+ evaluateNow: z.ZodOptional<z.ZodBoolean>;
850
+ }, z.core.$strip>, z.ZodObject<{
851
+ type: z.ZodLiteral<"update-spec">;
852
+ workflowId: z.ZodString;
853
+ removedQueryNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
854
+ skill: z.ZodOptional<z.ZodString>;
855
+ decisionSpec: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
856
+ crossQueryTransforms: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
857
+ type: z.ZodLiteral<"arithmetic">;
858
+ name: z.ZodString;
859
+ op: z.ZodEnum<{
860
+ diff: "diff";
861
+ ratio: "ratio";
862
+ pctDiff: "pctDiff";
863
+ }>;
864
+ left: z.ZodString;
865
+ right: z.ZodString;
866
+ }, z.core.$strip>, z.ZodObject<{
867
+ type: z.ZodLiteral<"rankCompare">;
868
+ name: z.ZodString;
869
+ left: z.ZodString;
870
+ right: z.ZodString;
871
+ keyField: z.ZodString;
872
+ rightKeyField: z.ZodOptional<z.ZodString>;
873
+ topN: z.ZodOptional<z.ZodNumber>;
874
+ }, z.core.$strip>, z.ZodObject<{
875
+ type: z.ZodLiteral<"valueCompare">;
876
+ name: z.ZodString;
877
+ left: z.ZodString;
878
+ right: z.ZodString;
879
+ keyField: z.ZodString;
880
+ rightKeyField: z.ZodOptional<z.ZodString>;
881
+ valueField: z.ZodString;
882
+ rightValueField: z.ZodOptional<z.ZodString>;
883
+ op: z.ZodEnum<{
884
+ diff: "diff";
885
+ ratio: "ratio";
886
+ pctDiff: "pctDiff";
887
+ }>;
888
+ breachWhen: z.ZodObject<{
889
+ operator: z.ZodEnum<{
890
+ lessThan: "lessThan";
891
+ lessThanInclusive: "lessThanInclusive";
892
+ greaterThan: "greaterThan";
893
+ greaterThanInclusive: "greaterThanInclusive";
894
+ }>;
895
+ value: z.ZodNumber;
896
+ }, z.core.$strip>;
897
+ }, z.core.$strip>], "type">>>;
898
+ }, z.core.$strip>, z.ZodObject<{
899
+ type: z.ZodLiteral<"update-workflow">;
900
+ workflowId: z.ZodString;
901
+ name: z.ZodOptional<z.ZodString>;
902
+ message: z.ZodOptional<z.ZodString>;
903
+ enabled: z.ZodOptional<z.ZodBoolean>;
904
+ frequency: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
905
+ periodMode: z.ZodEnum<{
906
+ minutes: "minutes";
907
+ hours: "hours";
908
+ days: "days";
909
+ }>;
910
+ periodValue: z.ZodNumber;
911
+ }, z.core.$strip>, z.ZodObject<{
912
+ periodMode: z.ZodLiteral<"cron">;
913
+ cron: z.ZodString;
914
+ timeZone: z.ZodOptional<z.ZodString>;
915
+ }, z.core.$strip>], "periodMode">>;
916
+ addRecipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
917
+ type: z.ZodEnum<{
918
+ user: "user";
919
+ group: "group";
920
+ adgroup: "adgroup";
921
+ }>;
922
+ id: z.ZodOptional<z.ZodString>;
923
+ email: z.ZodOptional<z.ZodString>;
924
+ name: z.ZodOptional<z.ZodString>;
925
+ }, z.core.$strip>>>;
926
+ removeRecipientIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
927
+ disabledUserIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
928
+ notifications: z.ZodOptional<z.ZodObject<{
929
+ email: z.ZodOptional<z.ZodBoolean>;
930
+ mobile: z.ZodOptional<z.ZodBoolean>;
931
+ feed: z.ZodOptional<z.ZodBoolean>;
932
+ slack: z.ZodOptional<z.ZodObject<{
933
+ active: z.ZodBoolean;
934
+ url: z.ZodOptional<z.ZodString>;
935
+ channels: z.ZodOptional<z.ZodString>;
936
+ }, z.core.$strip>>;
937
+ zapier: z.ZodOptional<z.ZodObject<{
938
+ active: z.ZodBoolean;
939
+ url: z.ZodOptional<z.ZodString>;
940
+ }, z.core.$strip>>;
941
+ webhooks: z.ZodOptional<z.ZodArray<z.ZodObject<{
942
+ name: z.ZodString;
943
+ url: z.ZodOptional<z.ZodString>;
944
+ active: z.ZodBoolean;
945
+ }, z.core.$strip>>>;
946
+ }, z.core.$strip>>;
947
+ }, z.core.$strip>, z.ZodObject<{
948
+ type: z.ZodLiteral<"set-receive-notifications">;
949
+ workflowId: z.ZodString;
950
+ receive: z.ZodBoolean;
951
+ }, z.core.$strip>], "type">;
952
+ }, z.core.$strip>;
953
+ /** Which prior evaluation a `diff` transform compares against. See `queryTransformField`. */
954
+ export type DiffBaseline = 'previousCycle' | 'previousPeriod' | 'sameTimeLastWeek' | 'lastFired' | {
955
+ cyclesAgo: number;
956
+ };
957
+ /**
958
+ * Adds the fields `compileQueryFromPrompt` resolves, to exactly the types that need resolving.
959
+ * `anomalyCheck` resolves `valueField` only — unlike `trendCheck`/`forecastCheck`, it needs no
960
+ * `dateField` (it isn't a series check; see the Anomaly pattern's own skill doc) and needs no
961
+ * pre-compile query tagging either, just a post-compile read of the query's sole measure.
962
+ */
963
+ type WithResolvedFields<T> = T extends {
964
+ type: 'trendCheck' | 'forecastCheck';
965
+ } ? T & {
966
+ valueField: string;
967
+ dateField: string;
968
+ } : T extends {
969
+ type: 'anomalyCheck';
970
+ } ? T & {
971
+ valueField: string;
972
+ } : T;
973
+ /**
974
+ * A transform in its final, persisted form: the agent's own declaration, plus — for a
975
+ * compile-resolved type — the `valueField`/`dateField` the engine resolved from the compiled query.
976
+ *
977
+ * Derived from `QueryTransformInput` rather than hand-written alongside it, so the two can't drift:
978
+ * there is one transform vocabulary, and resolution is a transformation of it. That also means a
979
+ * trend/forecast entry keeps its formula options (`modelType`, `forecastHorizon`, …) here, which is
980
+ * what lets `redefine` carry it forward by simply stripping the resolved fields — no separate
981
+ * declaration to store, and no per-type special case.
982
+ */
983
+ export type QueryTransform = WithResolvedFields<QueryTransformInput>;
984
+ /**
985
+ * The agent-facing shape of `define`/`redefine`'s `transforms` field — see `transformsField`'s own
986
+ * `.describe()`. Identical to `QueryTransform` for diff/topNCheck (the agent's
987
+ * declaration already IS the final form); `trendCheck`/`forecastCheck`/`anomalyCheck` differ —
988
+ * trend/forecast carry formula config (`trendFormulaOptions`/`forecastFormulaOptions`) instead of
989
+ * a resolved `valueField`/`dateField`, and `anomalyCheck` simply omits `valueField`, all three
990
+ * resolved only by `compileQueryFromPrompt`.
991
+ */
992
+ export type QueryTransformInput = z.infer<ReturnType<typeof queryTransformInputFieldFor>>;
993
+ /**
994
+ * A cross-query transform declared on the workflow (`context.crossQueryTransforms`) — the
995
+ * replacement for the retired scalar-only `derived` field. See `crossQueryTransformField`'s own
996
+ * `.describe()`s, and the authorPulse skill, for the two-layer (facts vs. rows) rule.
997
+ */
998
+ export type CrossQueryTransform = {
999
+ type: 'arithmetic';
1000
+ name: string;
1001
+ op: 'diff' | 'ratio' | 'pctDiff';
1002
+ left: string;
1003
+ right: string;
1004
+ } | {
1005
+ type: 'rankCompare';
1006
+ name: string;
1007
+ left: string;
1008
+ right: string;
1009
+ keyField: string;
1010
+ rightKeyField?: string;
1011
+ topN?: number;
1012
+ } | {
1013
+ type: 'valueCompare';
1014
+ name: string;
1015
+ left: string;
1016
+ right: string;
1017
+ keyField: string;
1018
+ rightKeyField?: string;
1019
+ valueField: string;
1020
+ rightValueField?: string;
1021
+ op: 'diff' | 'ratio' | 'pctDiff';
1022
+ breachWhen: {
1023
+ operator: 'lessThan' | 'lessThanInclusive' | 'greaterThan' | 'greaterThanInclusive';
1024
+ value: number;
1025
+ };
1026
+ };
1027
+ /**
1028
+ * One entry of an `agentic` workflow's `context.queries[]` — mirrors the shape vnext's workflow API
1029
+ * accepts/returns for a query. Hand-rolled (no shared type package exists across
1030
+ * vnext/sisense-client for this domain), same convention `PulseAlertDto` uses elsewhere in
1031
+ * this package. This is the PERSISTENCE shape only — `jaql`/`csdkJSON` are derived from a
1032
+ * `StagedAgenticQuery`'s live `compiledQuery` right before a `create`/`update-spec` write (see
1033
+ * `toAgenticQuery` in the engine); nothing upstream of that ever constructs one of these by hand,
1034
+ * and the agent never sees one — see `StagedAgenticQuery`/`StagedQuerySummary` for what it does see.
1035
+ */
1036
+ export interface AgenticQuery {
1037
+ name: string;
1038
+ purpose?: string;
1039
+ jaql: JaqlQueryPayload;
1040
+ /** A `CustomSuperJSONResult` envelope of the live compiled query (`@sisense/sdk-ui/analytics-composer`'s `CustomSuperJSON.serialize()`), NOT bare `QueryJSON` — round-trips back to live CSDK objects with no external schema needed. `stageQueryFromPersisted` rebuilds the live object from it. Never read by evaluation logic — kept only so the authoring UI can rebuild its "Query compiled" preview when an workflow is reopened. */
1041
+ csdkJSON?: Record<string, unknown>;
1042
+ /** Deterministic transforms ai-integration runs on this query's fresh result before judgment. Omitted or empty runs none — every transform, including `diff`, must be declared. */
1043
+ transforms?: QueryTransform[];
1044
+ }
1045
+ /**
1046
+ * One party on an workflow (a recipient) — mirrors `pulse-alerts-service.ts#PulseAlertParty`.
1047
+ * Redeclared locally rather than imported, since `pulse-alerts-service.ts` imports `AgenticQuery`/
1048
+ * `CrossQueryTransform` from THIS file — importing back would be circular.
1049
+ */
1050
+ export interface AgenticParty {
1051
+ type: 'group' | 'user' | 'adgroup';
1052
+ id?: string;
1053
+ }
1054
+ /**
1055
+ * The live compiled CSDK query object (`ExecuteQueryParams` — real `Attribute`/`Measure`/`Filter`
1056
+ * instances), with its own `QueryJSON` translation attached as a convenience — computed once per
1057
+ * session at compile time (`compileQueryFromPrompt`), and re-derived fresh (not trusted from
1058
+ * storage) whenever a persisted query is staged back in (`stageQueryFromPersisted`). Deliberately
1059
+ * NOT part of what gets persisted — `toAgenticQuery` strips `queryJSON` before writing `csdkJSON`:
1060
+ * `translateQueryToJSON` needs no external schema (CSDK objects self-describe via
1061
+ * `.expression`/`.type`), so recomputing it is cheap, and storing a second copy of the same
1062
+ * structure inside `csdkJSON` would only inflate the persisted document and let a stale/buggy
1063
+ * snapshot outlive whatever produced it, instead of self-healing on the next read.
1064
+ */
1065
+ export type CompiledQueryWithJSON = ExecuteQueryParams & {
1066
+ queryJSON: QueryJSON;
1067
+ };
1068
+ /**
1069
+ * One query inside a `StagedAgenticWorkflow` — never serialized to JSON directly; a host's own
1070
+ * `saveAgenticWorkflow` implementation (e.g. `CustomSuperJSON.serialize()`) decides how to persist it.
1071
+ *
1072
+ * Exactly one of `compiledQuery`/`persistedFallback` is meaningful at a time — never both absent:
1073
+ * - `compiledQuery` — set once this query has been compiled THIS session (`define`, or `redefine`
1074
+ * re-compiling it). The live object every derivation (jaql, `csdkJSON`, agent-facing `queryJSON`)
1075
+ * comes from.
1076
+ * - `persistedFallback` — set by `load-existing` for every query, verbatim from the real workflow.
1077
+ * Read only when `compiledQuery` is absent — i.e. this query hasn't been redefined this session,
1078
+ * so there is nothing to re-derive; its original `jaql`/`csdkJSON` carry through unchanged. A query
1079
+ * whose `csdkJSON` couldn't be rebuilt into a live object (`stageQueryFromPersisted`) still
1080
+ * carries through a re-save this way, unchanged.
1081
+ */
1082
+ export interface StagedAgenticQuery {
1083
+ name: string;
1084
+ purpose?: string;
1085
+ compiledQuery?: CompiledQueryWithJSON;
1086
+ persistedFallback?: {
1087
+ jaql: JaqlQueryPayload;
1088
+ csdkJSON?: Record<string, unknown>;
1089
+ };
1090
+ /**
1091
+ * This query's complete transform set, each entry carrying BOTH its declaration and, for a
1092
+ * compile-resolved type, what that declaration resolved to — so a `redefine` that omits
1093
+ * `transforms` reconstructs every type the same way, by stripping the resolved fields
1094
+ * (`carryForwardTransforms`). No sibling field holds the declaration separately.
1095
+ */
1096
+ transforms?: QueryTransform[];
1097
+ }
1098
+ /**
1099
+ * An workflow-in-progress, staged host-side (not in the agent's own context) under its own
1100
+ * `workflowId` — either a brand-new workflow not yet `create`d, or an existing one loaded via
1101
+ * `load-existing`. Retrieved/saved via `AuthorPulseContext.retrieveAgenticWorkflow`/
1102
+ * `saveAgenticWorkflow`, mirroring `BuildDashboardContext.retrieveDashboard`/`saveDashboard` exactly
1103
+ * — the engine only ever works with live objects here; a host's own callback implementation
1104
+ * decides the actual storage format (see that context field's own doc).
1105
+ */
1106
+ export interface StagedAgenticWorkflow {
1107
+ workflowId: string;
1108
+ /**
1109
+ * `'draft'` — minted by `define` with no `workflowId`, never yet `create`d. `'persisted'` — has a
1110
+ * real backing workflow, either just `create`d (re-staged under the real `_id`) or `load-existing`d.
1111
+ * Lets `requireStagedWorkflow` reject `create` on an already-persisted id (MR !1027 finding #2a/2b)
1112
+ * and `update-spec` on a still-draft id (finding #2c), and lets `define` reject a same-name
1113
+ * collision on a persisted workflow instead of silently overwriting it (finding #5). A
1114
+ * `StagedAgenticWorkflow` saved under the pre-this-field shape reads back as `kind: undefined` —
1115
+ * treated as neither draft nor persisted, so both `expectedKind` checks reject it; this only
1116
+ * affects a session already in flight exactly when this field was introduced, and self-heals on
1117
+ * its next `define`/`load-existing`.
1118
+ */
1119
+ kind: 'draft' | 'persisted';
1120
+ /**
1121
+ * Set ONLY on the stale draft key `create` leaves behind, pointing at the real `workflowId` it
1122
+ * re-staged under — `requireStagedWorkflow` follows this transparently. Always exactly one hop:
1123
+ * `create` is the only thing that ever sets it, and `create` itself is rejected (via
1124
+ * `kind`/`expectedKind`) on an id that's already `kind: 'persisted'`, so a persisted workflow's own
1125
+ * entry can never carry a `redirectTo` of its own. Exists so a stale `define`/`redefine` call
1126
+ * still made against the old draft id after `create` lands on the SAME real entry (MR !1027
1127
+ * finding #2d) instead of silently diverging from it — every action that resolves through this
1128
+ * must then save (and return) under the RESOLVED `workflowId`, not the id it was called with, or
1129
+ * this redirect is defeated on the very next write.
1130
+ */
1131
+ redirectTo?: string;
1132
+ /** Bumped by `redefine` when a change is classified `changed` (i.e. any detected change at all — see `QueryChangeClassification`); read as-is by `update-spec`'s `queryVersion` at persist time. Starts at 1 and is otherwise unused by `create` (a fresh workflow has no prior version to compare against). */
1133
+ queryVersion: number;
1134
+ /** `queryVersion` as of the last successful `create`/`update-spec` — absent on a pure draft never persisted. Lets `update-spec` tell whether a preceding `redefine` actually changed the query set since the last persist, for its own change-reporting message (MR !1027 finding #8) — `redefine`'s version bump alone doesn't distinguish "changed since we last checked" from "changed, but already persisted." */
1135
+ persistedQueryVersion?: number;
1136
+ sourceId: string;
1137
+ queries: StagedAgenticQuery[];
1138
+ /**
1139
+ * The workflow-level context fields `update-spec` merges its own partial patch against (omit a
1140
+ * field on that action to keep whatever's here). Populated by `load-existing` from the real
1141
+ * persisted workflow; absent on a brand-new draft staged via `define`, since `create` always
1142
+ * requires the agent to supply `skill`/`decisionSpec` fresh rather than merge against
1143
+ * anything — there is no "current" value yet for a not-yet-created workflow.
1144
+ */
1145
+ skill?: string;
1146
+ decisionSpec?: Record<string, unknown>;
1147
+ crossQueryTransforms?: CrossQueryTransform[];
1148
+ }
1149
+ /**
1150
+ * Agent-facing summary of one staged query — `queryJSON`, never `jaql`/`csdkJSON`. Used by every
1151
+ * action that surfaces staged query state (`define`, `redefine`, `load-existing`, `created`,
1152
+ * `updatedSpec`, and `inspectPulse`'s `get-workflow`/`list-workflows` — see `toStagedQuerySummary`).
1153
+ * `queryJSON` is absent only when the persisted `csdkJSON` couldn't be rebuilt into a live query
1154
+ * (missing, or `CustomSuperJSON.deserialize()` failed — see `stageQueryFromPersisted`'s catch);
1155
+ * `queryJSONUnavailableReason` is then `'corrupted'`. The query still carries through via
1156
+ * `persistedFallback`.
1157
+ */
1158
+ export interface StagedQuerySummary {
1159
+ name: string;
1160
+ purpose?: string;
1161
+ queryJSON?: QueryJSON;
1162
+ queryJSONUnavailableReason?: 'corrupted';
1163
+ transforms?: QueryTransform[];
1164
+ }
1165
+ /**
1166
+ * Author Pulse workflow context interface — completely decoupled from any UI or storage technology
1167
+ * (see `authorPulseEngine`'s own docstring); every host (sdk-assistant, MCP server, custom
1168
+ * integration) supplies its own `retrieveAgenticWorkflow`/`saveAgenticWorkflow` backed by whatever store
1169
+ * it already has (sdk-assistant: `CustomSuperJSON.serialize()` into its session-scoped
1170
+ * `toolCallResults`, mirroring how it already stages `buildChart`/`buildDashboard` state).
1171
+ */
1172
+ export interface AuthorPulseContext {
1173
+ /**
1174
+ * Tool call ID
1175
+ */
1176
+ toolCallId: string;
1177
+ httpClient?: HttpClient;
1178
+ /**
1179
+ * The knowledge layer's Pulse layer is on (SNS-131459): `define`/`redefine` read the data model
1180
+ * graph for watched formulas and company ranges and report them as `pulseKnowledge`. Omitted
1181
+ * means no graph reads and today's result.
1182
+ */
1183
+ pulseKnowledgeEnabled?: boolean;
1184
+ /**
1185
+ * The calling user's id, when the host knows it. Owner-only actions fail early with a clear
1186
+ * message for a non-owner instead of vnext's bare 404; omitted → no pre-check (vnext still
1187
+ * enforces ownership).
1188
+ */
1189
+ currentUserId?: string;
1190
+ /** User's IANA time zone for a cron frequency that omits one; leave undefined and the engine asks rather than guessing. */
1191
+ defaultTimeZone?: string;
1192
+ /**
1193
+ * The tool this call came in as, for request attribution (`x-tool-name`) on `create`'s first
1194
+ * evaluation. Omitted means `authorPulse`; the atomic adapter sets its own tool's name.
1195
+ */
1196
+ toolName?: string;
1197
+ /** Fires once, right after `create` persists the workflow — before its chained first evaluation runs. */
1198
+ onWorkflowCreated?: (workflowId: string) => void;
1199
+ /** Fires once per nested judgment step of `create`'s chained first evaluation, DURING the run. */
1200
+ onEvalStep?: (step: EvaluatePulseStep) => void;
1201
+ /**
1202
+ * Fires once per `define`/`redefine` call, right after the query compiles, carrying the LIVE
1203
+ * preview (`AgenticQueryPreview` — real CSDK class instances, not JSON). This is the ONLY way a
1204
+ * host gets this data: `AuthorPulseResult` never carries it, since that type is returned
1205
+ * verbatim to the LLM (see its own doc). A host stores/renders it however it likes — e.g.
1206
+ * sdk-assistant keys it by this call's own `toolCallId`, separate from `retrieveAgenticWorkflow`'s
1207
+ * `workflowId`-keyed staging (which is mutated by later calls on the same workflow and would corrupt
1208
+ * an earlier call's own preview). Never read back by the engine itself.
1209
+ */
1210
+ onQueryPreview?: (preview: AgenticQueryPreview) => void;
1211
+ /**
1212
+ * Retrieve a staged workflow draft by its staging id — `null` if nothing is staged under it
1213
+ * (an unrecognized/expired id, or an existing workflow that hasn't been `load-existing`d yet
1214
+ * this conversation). `define`/`redefine`/`create`/`update-spec` all read from this, never
1215
+ * from the live persisted workflow directly (only `load-existing`/`update-workflow` do that, via
1216
+ * `getAlertById`) — see `authorPulseToolDescription`.
1217
+ */
1218
+ retrieveAgenticWorkflow?: (workflowId: string) => StagedAgenticWorkflow | null;
1219
+ /** Save/replace a staged workflow draft under its own `workflowId`. */
1220
+ saveAgenticWorkflow?: (workflowId: string, workflow: StagedAgenticWorkflow) => void;
1221
+ /**
1222
+ * Resolve a query staged by a prior `buildQuery` call, by its `queryId` — the exact same lookup
1223
+ * `BuildChartContext.retrieveQuery` uses (same underlying store on every host: sdk-assistant's
1224
+ * Zustand-backed `toolCallResults`, mcp-service's Mongo-backed session state). `define`/`redefine`
1225
+ * require a `queryId`; `authorPulse` never runs NLQ itself (SNS-133117) — mirrors buildChart's
1226
+ * own `queryId`-only `create`/`rebind-query` actions, which likewise expose no free-text prompt
1227
+ * alternative to the model.
1228
+ */
1229
+ retrieveQuery?: (queryId: string) => QueryResult | null;
1230
+ }
1231
+ /**
1232
+ * A just-compiled query's structural definition (measures/dimensions/filters, in the same
1233
+ * shape `@sisense/sdk-ui`'s `QueryDefinition` component and CSDK's `useExecuteQuery` expect).
1234
+ *
1235
+ * NEVER part of `AuthorPulseResult` — `queryDescription` carries real CSDK class instances
1236
+ * (`Attribute`/`Measure`/`Filter`), not JSON, and `AuthorPulseResult` is returned straight to
1237
+ * the LLM (see that type's own doc). Delivered instead via `AuthorPulseContext.onQueryPreview`,
1238
+ * once per `define`/`redefine` call — mirrors `buildDashboard`'s own split (`DashboardSummary`,
1239
+ * model-facing and plain, vs. the live `DashboardProps` a host stores/renders separately, never
1240
+ * returned to the model). A host renders this however it likes (e.g. sdk-assistant stores it under
1241
+ * its own per-toolCallId key and derives the trend/forecast chart styling from `queryDescription`
1242
+ * on demand via the exported `buildTrendForecastChartValue`, rather than storing that too).
1243
+ * Deliberately does NOT also carry the NLQ backend's own `dataset` sample anymore (MR !1027
1244
+ * cleanup finding) — nothing reads it since the renderer moved to a single live-executing
1245
+ * `ChartWidget` for every case (Gap 4); forwarding it only inflated every preview write.
1246
+ */
1247
+ export interface AgenticQueryPreview {
1248
+ /** Measures/dimensions/filters CSDK compiled this query into — feed directly to `@sisense/sdk-ui`'s `QueryDefinition` for a structured pill display. */
1249
+ queryDescription: ExecuteQueryParams;
1250
+ }
1251
+ /** One persisted query's live definition, named — see `InspectPulseContext.onQueryDefinitions`. */
1252
+ export interface AgenticQueryDefinition extends AgenticQueryPreview {
1253
+ name: string;
1254
+ }
1255
+ /**
1256
+ * Result from authorPulseEngine — exactly one field is populated, matching which
1257
+ * action.type was executed. `defined`/`redefined`/`loadedExisting` are staged proposals,
1258
+ * nothing persisted; `created`/`updatedSpec`/`updatedWorkflow` have already been written by the time
1259
+ * this returns. This whole type is returned verbatim to the LLM as the tool call's result (and
1260
+ * replayed into the model's own context on every later turn) — every field, at every nesting
1261
+ * level, MUST be plain JSON. None of these carry `jaql`, a raw `csdkJSON` envelope, or a live CSDK
1262
+ * class instance — see `StagedQuerySummary`/`AgenticQueryPreview`'s own docs.
1263
+ */
1264
+ export interface AuthorPulseResult {
1265
+ /**
1266
+ * Set instead of every other field when the action was not applied because the model must
1267
+ * adjust it first (an `AuthorPulseAdjustmentError`) — `message` says what to change.
1268
+ */
1269
+ needsAdjustment?: {
1270
+ message: string;
1271
+ };
1272
+ defined?: StagedQuerySummary & {
1273
+ /** This workflow's staging id — freshly minted if `action.workflowId` was omitted, otherwise the same one passed in. */
1274
+ workflowId: string;
1275
+ evaluationWindow?: EvaluationWindow;
1276
+ /** Pulse layer only: watched formulas and matching company ranges (an offer, never staged). */
1277
+ pulseKnowledge?: PulseKnowledge;
1278
+ };
1279
+ redefined?: StagedQuerySummary & {
1280
+ workflowId: string;
1281
+ classification: QueryChangeClassification;
1282
+ evaluationWindow?: EvaluationWindow;
1283
+ /** True when the workflow isn't created yet — it has no evaluation history for a change to reset. */
1284
+ draft?: boolean;
1285
+ /** Pulse layer only: watched formulas and matching company ranges (an offer, never staged). */
1286
+ pulseKnowledge?: PulseKnowledge;
1287
+ };
1288
+ /** Result of `load-existing` — every query on the workflow, staged and ready for `redefine`/`update-spec` on this same `workflowId`. */
1289
+ loadedExisting?: {
1290
+ workflowId: string;
1291
+ sourceId: string;
1292
+ queries: StagedQuerySummary[];
1293
+ /** Machine-facing reminder. Model-only: hosts render `queries`, never this. */
1294
+ message: string;
1295
+ };
1296
+ created?: {
1297
+ name: string;
1298
+ sourceId: string;
1299
+ skill: string;
1300
+ queries: StagedQuerySummary[];
1301
+ /** Echoes the persisted workflow's top-level `scheduler`. Absent for a cube workflow, which evaluates on every build instead; for a cron schedule, `timeZone` is the one actually saved. */
1302
+ frequency?: WorkflowFrequency;
1303
+ /** Calendar schedule only: ISO instant of the first upcoming check, as the scheduler computed it. */
1304
+ nextCheck?: string;
1305
+ /** `nextCheck` already spelled out in English in the schedule's zone (weekday, date, time) — use those, translated when replying in another language; never work out a weekday or date from `nextCheck` yourself. */
1306
+ nextCheckText?: string;
1307
+ /** Always `'conditional'` — `decisionSpec` is required on `create`, so there is no other value a fresh workflow can be created with. */
1308
+ evalMode: 'conditional';
1309
+ decisionSpec: Record<string, unknown>;
1310
+ crossQueryTransforms?: CrossQueryTransform[];
1311
+ /** The persisted workflow's `_id`. Always present in the engine's own return value (set as
1312
+ * soon as `createAlert` resolves) — optional here only because a host's own UI-only
1313
+ * optimistic seed (rendered before the engine call even starts) doesn't have it yet. */
1314
+ workflowId?: string;
1315
+ /** The chained first evaluation's full result, once it completes. */
1316
+ firstEval?: EvaluatePulseResult;
1317
+ /** True if the chained first-evaluation call itself failed — the workflow stays created either way. */
1318
+ firstEvalFailed?: boolean;
1319
+ /** True when `evaluateNow: false` skipped the first evaluation; the first check is the next scheduled one. */
1320
+ firstEvalSkipped?: boolean;
1321
+ /** In-flight steps of the chained first evaluation, streamed via `context.onEvalStep` before `firstEval` is final. */
1322
+ liveSteps?: EvaluatePulseStep[];
1323
+ /** Machine-facing reminder for the orchestrating LLM's own next turn — summarizes what actually happened. */
1324
+ message: string;
1325
+ };
1326
+ updatedSpec?: {
1327
+ workflowId: string;
1328
+ queries: StagedQuerySummary[];
1329
+ /** Read directly from the staged draft's own `queryVersion` (bumped by any `redefine` classified `changed` since it was staged) — never echoes back a caller-supplied value. */
1330
+ queryVersion: number;
1331
+ skill: string;
1332
+ evalMode: 'conditional';
1333
+ decisionSpec?: Record<string, unknown>;
1334
+ crossQueryTransforms?: CrossQueryTransform[];
1335
+ /** What this update changed, as stable keys a host can label in its own language. */
1336
+ changes: UpdatedSpecChange[];
1337
+ /** Machine-facing reminder summarizing what actually changed. Model-only: hosts render `changes`, never this. */
1338
+ message: string;
1339
+ };
1340
+ updatedWorkflow?: {
1341
+ workflowId: string;
1342
+ name: string;
1343
+ enabled: boolean;
1344
+ /** The full resolved parties list after add/remove was applied. */
1345
+ parties: AgenticParty[];
1346
+ disabledUsers?: string[];
1347
+ /** The channels after the update, without webhook URLs (SNS-136699). */
1348
+ action: VisiblePulseAlertAction;
1349
+ /** The cadence this update saved; absent when the update left the schedule alone. For a cron schedule, `timeZone` is the one actually saved. */
1350
+ frequency?: WorkflowFrequency;
1351
+ /** Calendar schedule only, when this update set one: ISO instant of the first upcoming check. */
1352
+ nextCheck?: string;
1353
+ /** `nextCheck` already spelled out in English in the schedule's zone — use its weekday, date and time, translated when replying in another language; never work out a weekday or date from `nextCheck` yourself. */
1354
+ nextCheckText?: string;
1355
+ /** What this update changed, as stable keys a host can label in its own language. */
1356
+ changes: UpdatedWorkflowChange[];
1357
+ /** Machine-facing reminder summarizing what actually changed. Model-only: hosts render `changes`, never this. */
1358
+ message: string;
1359
+ };
1360
+ receiveNotificationsUpdated?: {
1361
+ workflowId: string;
1362
+ name: string;
1363
+ /** The calling user's new setting — the workflow's other recipients are unaffected. */
1364
+ receiveNotifications: boolean;
1365
+ /** Machine-facing reminder summarizing what actually changed. */
1366
+ message: string;
1367
+ };
1368
+ }
1369
+ /** One thing an `update-spec` changed — see `AuthorPulseResult.updatedSpec.changes`. */
1370
+ export type UpdatedSpecChange = 'queries' | 'skill' | 'decisionSpec' | 'crossQueryTransforms';
1371
+ /** One thing an `update-workflow` changed — see `AuthorPulseResult.updatedWorkflow.changes`. */
1372
+ export type UpdatedWorkflowChange = 'name' | 'message' | 'enabled' | 'disabled' | 'schedule' | 'recipientsAdded' | 'recipientsRemoved' | 'mutedRecipients' | 'notificationChannels';
1373
+ /** An interval cadence as the model supplies it. */
1374
+ export type IntervalWorkflowFrequency = z.infer<typeof intervalFrequencyField>;
1375
+ /** A calendar cadence with its zone resolved — what gets persisted and echoed back. */
1376
+ export interface CronWorkflowFrequency {
1377
+ periodMode: 'cron';
1378
+ cron: string;
1379
+ timeZone: string;
1380
+ }
1381
+ /** How often a live workflow evaluates — echoed on `created.frequency`. */
1382
+ export type WorkflowFrequency = IntervalWorkflowFrequency | CronWorkflowFrequency;
1383
+ /** The `frequency` field exactly as the model supplies it (cron `timeZone` still optional). */
1384
+ export type WorkflowFrequencyInput = z.infer<typeof frequencyObjectField>;
1385
+ export {};