@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
@@ -1,9 +1,11 @@
1
- import { z } from 'zod/v4';
1
+ import { z } from 'zod';
2
2
  import { HttpClient } from '@sisense/sdk-rest-client';
3
3
  export declare const listDataModelsParamsSchema: z.ZodObject<{}, z.core.$strip>;
4
4
  export interface DataModelSummary {
5
5
  oid: string;
6
6
  title: string;
7
+ /** Label of the model's default perspective (PR-762), fetched in its own request; absent when unset or when that request failed. */
8
+ displayName?: string;
7
9
  type: string;
8
10
  lastBuildTime: string | null;
9
11
  }
@@ -128,7 +130,7 @@ export declare const updatePerspectiveParamsSchema: z.ZodObject<{
128
130
  perspectiveOid: z.ZodString;
129
131
  name: z.ZodOptional<z.ZodString>;
130
132
  description: z.ZodOptional<z.ZodString>;
131
- tables: z.ZodOptional<z.ZodArray<z.ZodObject<{
133
+ addTables: z.ZodOptional<z.ZodArray<z.ZodObject<{
132
134
  oid: z.ZodString;
133
135
  diffType: z.ZodEnum<{
134
136
  include: "include";
@@ -139,8 +141,11 @@ export declare const updatePerspectiveParamsSchema: z.ZodObject<{
139
141
  enabled: z.ZodBoolean;
140
142
  }, z.core.$strip>>;
141
143
  }, z.core.$strip>>>;
142
- relations: z.ZodOptional<z.ZodArray<z.ZodObject<{
143
- oid: z.ZodString;
144
+ removeTables: z.ZodOptional<z.ZodArray<z.ZodString>>;
145
+ setColumns: z.ZodOptional<z.ZodArray<z.ZodObject<{
146
+ tableOid: z.ZodString;
147
+ columnOid: z.ZodString;
148
+ enabled: z.ZodBoolean;
144
149
  }, z.core.$strip>>>;
145
150
  }, z.core.$strip>;
146
151
  export interface UpdatePerspectiveResult {
@@ -213,7 +218,7 @@ export declare const listDataModelsToolDescription = "Lists all Sisense data mod
213
218
  /**
214
219
  * Canonical tool description for getModelSchema — reusable by any host.
215
220
  */
216
- export declare const getModelSchemaToolDescription = "Fetches the full schema of a Sisense data model: all tables with their OIDs and columns (with OIDs and types), plus all relation OIDs.\n\nIMPORTANT: The datamodelOid parameter MUST be a UUID \u2014 use the `oid` field from a `getDataSources` / `listDataModels` result, or a `perspectiveOid` from `listPerspectives`, in the current conversation. Never use an OID from memory, context, or examples. Legacy datasource string IDs (e.g. \"localhost_aSampleECommerce\") are NOT valid here.\n\nPERSPECTIVES: if you pass a perspective's OID, the schema is resolved to that perspective \u2014 tables/columns are filtered to what the perspective exposes and `perspectiveOid` is set on the result. Use getPerspective for the perspective's diagram.\n\nThis is the canonical \"show / explore / view / open the data model\" DIAGRAM action (including drafts for inspection). When the user picks a model or uses those verbs about a specific model by name, use the model's oid from the latest getDataSources result. Do not ask \"schema or build?\" for a simple show-model request.\n\nFor a plain \"list / show the fields, tables, or columns\" request (a field list rather than the diagram), use getDataSourceFields \u2014 the interactive field browser \u2014 not this tool.\n\nThis is step 2 of the perspective workflow. After this returns, propose 2-4 concrete perspective ideas (each with: name, tables included, columns hidden, intended audience) and ASK the user which one to create. STOP and wait \u2014 do NOT call createPerspective in the same turn.\n\nPerspective workflow pacing: prefer one major conversational step per assistant reply where possible \u2014 list what exists, inspect and discuss the schema with the user, agree on a design, then call createPerspective in a later focused turn once choices are clear (rather than jumping from first discovery straight to creation in one reply when the user has not confirmed direction).";
221
+ export declare const getModelSchemaToolDescription = "Fetches the full schema of a Sisense data model: all tables with their OIDs and columns (with OIDs and types), plus all relation OIDs.\n\nIMPORTANT: The datamodelOid parameter MUST be a UUID from the current conversation, never a title. Use the `oid` field from a `getDataSources` / `listDataModels` result, or a `perspectiveOid` from `listPerspectives`. Never use an OID from memory, context, or examples. Legacy datasource string IDs (e.g. \"localhost_aSampleECommerce\") are NOT valid here.\n\nPERSPECTIVES: if you pass a perspective's OID, the schema is resolved to that perspective \u2014 tables/columns are filtered to what the perspective exposes and `perspectiveOid` is set on the result. Use getPerspective for the perspective's diagram.\n\nThis is the canonical \"show / explore / view / open the data model\" DIAGRAM action (including drafts for inspection). When the user picks a model or uses those verbs about a specific model by name, use the model's oid from the latest getDataSources result. Do not ask \"schema or build?\" for a simple show-model request.\n\nFor a plain \"list / show the fields, tables, or columns\" request (a field list rather than the diagram), use getDataSourceFields \u2014 the interactive field browser \u2014 not this tool.\n\nThis is step 2 of the perspective workflow. After this returns, propose 2-4 concrete perspective ideas (each with: name, tables included, columns hidden, intended audience) and ASK the user which one to create. STOP and wait \u2014 do NOT call createPerspective in the same turn.\n\nPerspective workflow pacing: prefer one major conversational step per assistant reply where possible \u2014 list what exists, inspect and discuss the schema with the user, agree on a design, then call createPerspective in a later focused turn once choices are clear (rather than jumping from first discovery straight to creation in one reply when the user has not confirmed direction).";
217
222
  /**
218
223
  * Canonical tool description for addRelation — reusable by any host.
219
224
  */
@@ -225,11 +230,11 @@ export declare const removeRelationToolDescription = "Removes a join relationshi
225
230
  /**
226
231
  * Canonical tool description for createPerspective — reusable by any host.
227
232
  */
228
- export declare const createPerspectiveToolDescription = "Creates a new perspective (filtered sub-model) on a Sisense data model. This is step 3 \u2014 the final step \u2014 of the perspective workflow.\n\nPRECONDITION (HARD RULE): the data model MUST have been built at least once. Perspectives CANNOT be created on a draft / never-built model \u2014 the create will fail. If the target model is a draft (a getDataSources entry with status:'draft', or a model with no successful build), do NOT call this tool. Instead tell the user the model must be built first and offer to run triggerBuild; only create the perspective after a successful build.\n\nFor a new perspective, work in stages: first discover models and wait for the user to pick one, then fetch schema and wait for design agreement, then call this tool in its own turn with OIDs from that schema \u2014 never skip discovery or schema in the same turn as create.\n\nCall getModelSchema first (step 2) to get exact table OIDs, column OIDs, and relation OIDs. Use ONLY OIDs from that schema response \u2014 never invent or guess OIDs.\n\nAfter the user picks a perspective option (or describes a custom one), call this tool IMMEDIATELY in the same turn. Do not ask further confirmation. The host typically opens an interactive diagram of the perspective \u2014 reply with a one-line confirmation; do not narrate the diagram in detail.\n\ndiffType rules:\n- \"include\": allowlist \u2014 only columns listed with enabled:true are visible. Use when exposing a small subset.\n- \"exclude\": denylist \u2014 all columns visible except those listed with enabled:false. Use when hiding a few sensitive columns.\n\ncolumnsDiff must never be empty \u2014 for \"include\" list every visible column with enabled:true; for \"exclude\" list at least one hidden column with enabled:false.\n\nInclude a relation OID only when both connected tables are in the perspective's tables list.";
233
+ export declare const createPerspectiveToolDescription = "Creates a new perspective (filtered sub-model) on a Sisense data model. This is step 3 \u2014 the final step \u2014 of the perspective workflow.\n\nPRECONDITION (HARD RULE): the data model MUST have been built at least once. Perspectives CANNOT be created on a draft / never-built model \u2014 the create will fail. If the target model is a draft (status 'draft' in the data source list, or a model with no successful build), do NOT call this tool. Instead tell the user the model must be built first and offer to run triggerBuild; only create the perspective after a successful build.\n\nFor a new perspective, work in stages: first discover models and wait for the user to pick one, then fetch schema and wait for design agreement, then call this tool in its own turn with OIDs from that schema \u2014 never skip discovery or schema in the same turn as create.\n\nCall getModelSchema first (step 2) to get exact table OIDs, column OIDs, and relation OIDs. Use ONLY OIDs from that schema response \u2014 never invent or guess OIDs.\n\nAfter the user picks a perspective option (or describes a custom one), call this tool IMMEDIATELY in the same turn. Do not ask further confirmation. The host typically opens an interactive diagram of the perspective \u2014 reply with a one-line confirmation; do not narrate the diagram in detail.\n\ndiffType rules:\n- \"include\": allowlist \u2014 only columns listed with enabled:true are visible. Use when exposing a small subset.\n- \"exclude\": denylist \u2014 all columns visible except those listed with enabled:false. Use when hiding a few sensitive columns.\n\ncolumnsDiff must never be empty \u2014 for \"include\" list every visible column with enabled:true; for \"exclude\" list at least one hidden column with enabled:false.\n\nInclude a relation OID only when both connected tables are in the perspective's tables list.";
229
234
  /**
230
235
  * Canonical tool description for updatePerspective — reusable by any host.
231
236
  */
232
- export declare const updatePerspectiveToolDescription = "Updates an existing Sisense PERSPECTIVE (a saved filtered sub-model / view). This tool does NOT modify the underlying data model \u2014 it only changes which tables/columns/relations a specific perspective exposes.\n\nDO NOT call this tool when the user asks to add, remove, or modify RELATIONS on the data model itself \u2014 that operates on the model, not on a perspective. (To add a relation, use addRelation. To remove a relation, use removeRelation.)\n\nSend only the fields you want to change:\n- To rename a perspective: pass only name.\n- To update column visibility within the perspective: pass the full tables array (it replaces the existing one).\n- To expose another existing table in the perspective: include all existing tables plus the new one in the tables array.\n\nAfter a successful update, call getPerspective with the same perspectiveOid in the next turn so the user sees the refreshed diagram.";
237
+ export declare const updatePerspectiveToolDescription = "Updates an existing Sisense PERSPECTIVE (a saved filtered sub-model / view). This tool does NOT modify the underlying data model \u2014 it only changes which tables/columns/relations a specific perspective exposes.\n\nDO NOT call this tool when the user asks to add, remove, or modify RELATIONS on the data model itself \u2014 that operates on the model, not on a perspective. (To add a relation, use addRelation. To remove a relation, use removeRelation.)\n\nSend only the changes \u2014 the server applies them to the stored perspective, and everything you do not name stays as it is:\n- To rename a perspective: pass only name.\n- To show or hide columns of a table already in the perspective: pass setColumns, one entry per column.\n- To expose another model table: pass it in addTables with its diffType and columnsDiff.\n- To stop exposing a table: pass its oid in removeTables.\n\nUse table and column OIDs from getPerspective or getModelSchema in this conversation. Tables and columns of the default perspective cannot change \u2014 only its name and description.\n\nAfter a successful update, call getPerspective with the same perspectiveOid in the next turn so the user sees the refreshed diagram.";
233
238
  /**
234
239
  * Canonical tool description for getPerspective — reusable by any host.
235
240
  */
@@ -241,4 +246,4 @@ export declare const triggerBuildToolDescription = "Triggers a full build of a S
241
246
  /**
242
247
  * Canonical tool description for listPerspectives — reusable by any host.
243
248
  */
244
- export declare const listPerspectivesToolDescription = "Lists the perspectives of ONE data model. Use whenever the user asks to:\n- \"see / list / show me the perspectives\" of a model\n- \"what perspectives exist on this model\"\n- review existing perspectives before deciding to create / update / delete one\n\ndatamodelOid is REQUIRED \u2014 perspectives are always scoped to a single model and there is no list-everything mode (an instance can have hundreds across all models). If the user hasn't picked a model yet, do NOT call this tool: first ask them which data model (use getDataSources / listDataModels to show options), then call this with that model's oid. Set includeDefault:false to hide the auto-generated Default perspective.\n\nAfter the result, present a short numbered/bulleted summary (name, table count, default vs custom) and ask which one they want to inspect \u2014 then call getPerspective to render its diagram.";
249
+ export declare const listPerspectivesToolDescription = "Lists the perspectives of ONE data model. Use whenever the user asks to:\n- \"see / list / show me the perspectives\" of a model\n- \"what perspectives exist on this model\"\n- review existing perspectives before deciding to create / update / delete one\n\ndatamodelOid is REQUIRED \u2014 perspectives are always scoped to a single model and there is no list-everything mode (an instance can have hundreds across all models). If the user hasn't picked a model yet, do NOT call this tool: first ask them which data model, then call this with that model's oid. To show the options, use getDataSources / listDataModels. Set includeDefault:false to hide the auto-generated Default perspective.\n\nAfter the result, present a short numbered/bulleted summary (name, table count, default vs custom) and ask which one they want to inspect \u2014 then call getPerspective to render its diagram.";
@@ -0,0 +1,62 @@
1
+ /**
2
+ * How the Pulse field descriptions name the operations and tools they point to (SNS-136028).
3
+ *
4
+ * The composite `authorPulse`/`inspectPulse` tools name their own actions ("define", "create");
5
+ * the atomic tools name the tool for each operation (`definePulseQuery`, `createPulse`). Both
6
+ * build their schemas from the same field factories with one of these word sets, so a description
7
+ * never sends the model to a tool it was not given. When the assistants move to the atomic tools,
8
+ * the composite set goes away.
9
+ */
10
+ export interface PulseToolWords {
11
+ define: string;
12
+ redefine: string;
13
+ loadExisting: string;
14
+ create: string;
15
+ listWorkflows: string;
16
+ getWorkflow: string;
17
+ listNotifications: string;
18
+ listEvals: string;
19
+ /** What does not run NLQ itself: the composite tool by name, or "this tool". */
20
+ authorTool: string;
21
+ /** Where the authoring guidance lives. */
22
+ authoringSkill: string;
23
+ /** Where the crossQueryTransforms worked examples live. */
24
+ crossQueryExamples: string;
25
+ /** Where the id of an existing workflow comes from. */
26
+ inspectTool: string;
27
+ /** What resumes a paused workflow. */
28
+ updateWorkflow: string;
29
+ /**
30
+ * Publish a free-form object as `additionalProperties: true` rather than `{}`, which some MCP
31
+ * clients refuse. Off for the composite, so the assistants' schema stays as it was.
32
+ */
33
+ portableFreeForm: boolean;
34
+ }
35
+ /** The atomic Pulse tool names; public once published, so change them only on purpose. */
36
+ export declare const PULSE_TOOL_NAME: {
37
+ readonly definePulseQuery: "definePulseQuery";
38
+ readonly redefinePulseQuery: "redefinePulseQuery";
39
+ readonly loadPulse: "loadPulse";
40
+ readonly createPulse: "createPulse";
41
+ readonly updatePulseDefinition: "updatePulseDefinition";
42
+ readonly updatePulseSettings: "updatePulseSettings";
43
+ readonly setPulseNotifications: "setPulseNotifications";
44
+ readonly listPulses: "listPulses";
45
+ readonly getPulse: "getPulse";
46
+ readonly listPulseNotifications: "listPulseNotifications";
47
+ readonly listPulseEvals: "listPulseEvals";
48
+ readonly getPulseEval: "getPulseEval";
49
+ readonly getPulseEvalResults: "getPulseEvalResults";
50
+ };
51
+ export declare const COMPOSITE_PULSE_WORDS: PulseToolWords;
52
+ export declare const ATOMIC_PULSE_WORDS: PulseToolWords;
53
+ /**
54
+ * A Pulse engine message in the atomic tools' words: each quoted composite action name (`"redefine"`)
55
+ * becomes the tool's name (`redefinePulseQuery`). Only quoted names are mapped, so "create" as an
56
+ * English word stays as it is. A stage-1 shim (SNS-136028): once the assistants use the atomic tools,
57
+ * the engine messages name the tools themselves and this goes away.
58
+ */
59
+ export declare function inPulseToolWords(message: string, tools: readonly {
60
+ name: string;
61
+ actionType: string;
62
+ }[]): string;
@@ -1,4 +1,4 @@
1
- import { z } from 'zod/v4';
1
+ import { z } from 'zod';
2
2
  import { ChartType } from '@sisense/sdk-ui';
3
3
  import { recommendQueriesSchema, RecommendQueriesContext, RecommendQueriesResult, OnIntermediateResultsCallback } from './types';
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { z } from 'zod/v4';
1
+ import { z } from 'zod';
2
2
  import { WidgetProps, ChartType } from '@sisense/sdk-ui';
3
3
  import { HttpClient } from '@sisense/sdk-rest-client';
4
4
  import { LanguageModel } from 'ai';
@@ -0,0 +1,52 @@
1
+ import { HttpClient } from '@sisense/sdk-rest-client';
2
+ import { ExistingAnswerMatch } from '../build-query/types';
3
+ /**
4
+ * Looks up KG similar-question matches and returns the best verified one, if any clears
5
+ * {@link KG_SIMILARITY_SCORE_THRESHOLD}. `verifiedWidget.verified` alone is not sufficient — it
6
+ * only proves *some past* question resolved onto a real widget (or cleared the feedback-based
7
+ * verification threshold, which carries no widget at all — `widgets` can legitimately be empty),
8
+ * not that *this* question is the same intent; the similarity threshold supplies that bar (KG's
9
+ * own lookup has no built-in cutoff). Never throws — a failure, timeout, or 403 (feature not yet
10
+ * available) resolves to `null`, meaning "no match, continue the cascade."
11
+ */
12
+ export declare function findKgMatch(questionText: string, dataSourceTitle: string, httpClient?: HttpClient, threshold?: number, toolName?: string): Promise<ExistingAnswerMatch | null>;
13
+ /**
14
+ * Fraction of the question's content words that appear in `title` — the lexical half of
15
+ * {@link bestWidgetSearchResult}'s accept decision.
16
+ *
17
+ * Normalized by the question, which does make the bar tighten as phrasing gets longer while a
18
+ * 2-4 word widget title cannot follow. Normalizing by `min(question, title)` instead was measured
19
+ * and rejected: it makes a short title trivially easy to clear and re-admits a real false positive
20
+ * ("average discount per brand" covers half of `Total Brands`). Conversational padding is absorbed
21
+ * by {@link COVERAGE_STOP_WORDS} instead, which is why it carries "can you show me ... please".
22
+ * A verbose question that adds *content* words the title lacks still abstains, and falls through
23
+ * to generation — the safe direction.
24
+ * @param questionText - the user's own words
25
+ * @param title - the candidate widget's title
26
+ * @returns the plain fraction — 0 when nothing overlaps or either side has no content words, 1
27
+ * when the title carries every question word. The accept decision additionally requires
28
+ * {@link hasEnoughAgreement}; this function stays a pure score so selection can rank with it.
29
+ */
30
+ export declare function questionTermCoverage(questionText: string, title: string | undefined): number;
31
+ /**
32
+ * Looks up widget semantic-search matches and returns the one worth serving, if any — see
33
+ * {@link bestWidgetSearchResult} for the accept and select rules, which are more than a threshold
34
+ * on the top hit. Deliberately scores `cosineSimilarity`, NOT the response's `similarity` field —
35
+ * `similarity` is rank-normalized by position (a fuzzy/lexical-only hit can still read ~1 there),
36
+ * not a real quality signal. Never throws — see {@link findKgMatch}.
37
+ */
38
+ export declare function findWidgetMatch(questionText: string, dataSourceTitle: string, httpClient?: HttpClient, toolName?: string): Promise<ExistingAnswerMatch | null>;
39
+ /**
40
+ * Combines a KG match and a widget-search match into a single decision. Prefer the KG match when
41
+ * both are usable — it's verified against the exact JAQL fields the question resolves to, a
42
+ * stronger signal than widget-search's title/description text similarity. The two confidence
43
+ * scores are never blended: they come from different embedding spaces and aren't comparable.
44
+ */
45
+ export declare function decideExistingAnswer(kgMatch: ExistingAnswerMatch | null, widgetMatch: ExistingAnswerMatch | null): ExistingAnswerMatch | null;
46
+ /**
47
+ * Runs the full existing-answer cascade: KG similar-question search and widget semantic search in
48
+ * parallel (independent, both cheap relative to NLQ generation), then decides between them. Callers
49
+ * should only invoke this for new questions (`priorQueryId` unset) — revisions should skip straight
50
+ * to NLQ generation. Never throws.
51
+ */
52
+ export declare function findExistingAnswer(questionText: string, dataSourceTitle: string, httpClient?: HttpClient, kgThreshold?: number, toolName?: string): Promise<ExistingAnswerMatch | null>;
@@ -3,9 +3,9 @@ import { Filter, FilterRelations, FunctionCall } from '@sisense/sdk-data';
3
3
  * Compact filter list for LLM-facing chart/dashboard summaries.
4
4
  * Translates CSDK {@link Filter} instances via {@link translateQueryToJSON}.
5
5
  */
6
- export declare function getFiltersJsonForLlmSummary(csdkFilters: Filter[] | FilterRelations | readonly Filter[] | undefined | null): unknown[];
6
+ export declare function getFiltersJSONForLlmSummary(csdkFilters: Filter[] | FilterRelations | readonly Filter[] | undefined | null): unknown[];
7
7
  /**
8
- * Same as {@link getFiltersJsonForLlmSummary}, narrowed to compose-tree
8
+ * Same as {@link getFiltersJSONForLlmSummary}, narrowed to compose-tree
9
9
  * {@link FunctionCall} nodes for typed LLM payloads (unknown entries are dropped).
10
10
  */
11
11
  export declare function getFunctionCallFiltersForLlmSummary(csdkFilters: Filter[] | FilterRelations | readonly Filter[] | undefined | null): FunctionCall[];
@@ -1,4 +1,4 @@
1
- import { QueryExecutionResult, QueryState } from '../../services/nlq/nlq-service';
1
+ import { ColumnValuesResolvedEntry, QueryExecutionResult, QueryState } from '../../services/nlq/nlq-service';
2
2
  import { HttpClient } from '@sisense/sdk-rest-client';
3
3
  /**
4
4
  * Layer-2 NLQ fallback when wire `chartState` is disabled (`isNlqDeltaEnabled === false`):
@@ -11,4 +11,4 @@ export declare function augmentNlqTextWithPriorState(userText: string, priorStat
11
11
  truncated: boolean;
12
12
  };
13
13
  /** Call NLQ V3 smartQuery API; maps wire `chartState` to domain `queryState`. */
14
- export declare function executeNlqV3Query(dataSourceTitle: string, queryPrompt: string, httpClient?: HttpClient, commonFilters?: unknown, priorQueryState?: QueryState, isNlqDeltaEnabled?: boolean): Promise<QueryExecutionResult | null>;
14
+ export declare function executeNlqV3Query(dataSourceTitle: string, queryPrompt: string, httpClient?: HttpClient, commonFilters?: unknown, priorQueryState?: QueryState, isNlqDeltaEnabled?: boolean, userQuery?: string, queryId?: string, priorQueryId?: string, columnValuesResolved?: ColumnValuesResolvedEntry[], toolName?: string, subjectAreaId?: string, userQuestion?: string): Promise<QueryExecutionResult | null>;
@@ -0,0 +1,151 @@
1
+ import { DashboardProps, WidgetProps } from '@sisense/sdk-ui';
2
+ import { DashboardJSON } from '@sisense/sdk-ui/analytics-composer';
3
+ /**
4
+ * `'full'` when every widget on the dashboard is inside `dashboard.widgets`
5
+ * **whole**; `'partial'` when any is missing — it failed to translate or was
6
+ * dropped to fit the ceiling — or is present with fields stripped to fit, or
7
+ * when a dashboard filter could not be translated.
8
+ *
9
+ * Degradation counts as `'partial'` deliberately: a custom widget that kept its
10
+ * identity and lost its plugin configuration is not a widget the model can hand
11
+ * back, and a document that called that `'full'` would be inviting exactly the
12
+ * round-trip this projection exists to protect.
13
+ */
14
+ export type DashboardProjectionDetail = 'full' | 'partial';
15
+ /**
16
+ * Widget kind as it appears on a row.
17
+ *
18
+ * Taken from `WidgetProps`, not `WidgetJSON`: `filter` is a `WidgetProps` kind
19
+ * with no JSON counterpart, so it is precisely the kind that ends up in
20
+ * `unavailableWidgets` and could not be named by the narrower type.
21
+ */
22
+ export type ProjectedWidgetType = WidgetProps['widgetType'];
23
+ /** A widget the translator rejected; the document omits it. */
24
+ export interface UnavailableWidget {
25
+ id: string;
26
+ widgetType: ProjectedWidgetType;
27
+ chartType?: string;
28
+ title?: string;
29
+ /** First `NlqTranslationError.message` — already written for an LLM reader. */
30
+ reason: string;
31
+ }
32
+ /** A dashboard filter the translator rejected; the document omits it. */
33
+ export interface UnavailableFilter {
34
+ /**
35
+ * The filter's title; a cascading filter joins its levels with ` → `, a
36
+ * filter-relations expression lists its filters with their operators.
37
+ */
38
+ title: string;
39
+ /** First `NlqTranslationError.message` — already written for an LLM reader. */
40
+ reason: string;
41
+ }
42
+ /** A widget dropped to fit `ceilingBytes`; the document omits it. */
43
+ export interface OmittedWidget {
44
+ id: string;
45
+ widgetType: ProjectedWidgetType;
46
+ chartType?: string;
47
+ title?: string;
48
+ bytes: number;
49
+ }
50
+ /** Fields `stripCustomWidgetBlobs` can remove from a `custom` widget. */
51
+ export type DegradedWidgetField = 'dataOptions' | 'customOptions';
52
+ /**
53
+ * A widget still in the document, but with fields stripped to fit
54
+ * `ceilingBytes`.
55
+ *
56
+ * The widget is present under `dashboard.widgets` and looks round-trippable; it
57
+ * is not. Writing it back would ship a custom widget whose plugin configuration
58
+ * this read silently discarded, so the row exists to make the loss addressable:
59
+ * the model can name the widget, say what is gone, and re-read it rather than
60
+ * assume the field was never there.
61
+ */
62
+ export interface DegradedWidget {
63
+ id: string;
64
+ widgetType: ProjectedWidgetType;
65
+ chartType?: string;
66
+ title?: string;
67
+ /** Keys removed from the widget — do not write this widget back. */
68
+ droppedFields: DegradedWidgetField[];
69
+ /** Bytes the strip freed, measured with the caller's `measureBytes`. */
70
+ bytesFreed: number;
71
+ }
72
+ /**
73
+ * The dashboard as the model reads it: the **verbatim** `translateDashboardToJSON`
74
+ * output under `dashboard`, plus the few facts that document cannot carry.
75
+ *
76
+ * `dashboard` is byte-compatible with the `dashboardState` `buildDashboard`
77
+ * writes and with what `translateDashboardFromJSON` accepts, so a future
78
+ * `updateDashboard` can take the model's edited document back whole — style and
79
+ * layout included. That is why the failure and omission rows live **outside**
80
+ * it: anything added inside would make it something other than a `DashboardJSON`.
81
+ */
82
+ export interface DashboardJSONProjection {
83
+ /** Widget datasources ∪ dashboard default, sorted — the datasource ladder reads it. */
84
+ dataSourceTitles: string[];
85
+ /** Total widgets on the dashboard, including unavailable and omitted ones. */
86
+ widgetCount: number;
87
+ /**
88
+ * `'full'` iff every widget is in `dashboard.widgets`, none was stripped,
89
+ * none went unlisted, and every dashboard filter and the shell itself
90
+ * translated — `dashboard.widgets.length === widgetCount`,
91
+ * `unavailableWidgets`, `degradedWidgets` and `unavailableFilters` empty,
92
+ * `unlistedWidgetCount` absent.
93
+ */
94
+ detail: DashboardProjectionDetail;
95
+ /** Verbatim `translateDashboardToJSON` output, or its per-widget-composed equal. */
96
+ dashboard: DashboardJSON;
97
+ unavailableWidgets?: UnavailableWidget[];
98
+ omittedWidgets?: OmittedWidget[];
99
+ /** Widgets present in the document but stripped of fields to fit the ceiling. */
100
+ degradedWidgets?: DegradedWidget[];
101
+ /**
102
+ * Rows the ceiling dropped from `unavailableWidgets` / `omittedWidgets`
103
+ * themselves — widgets the document can neither carry nor name.
104
+ *
105
+ * Reachable only once every widget is already gone and the rows that named
106
+ * them still do not fit; see `dropRowsToFit`. The count is what is left to
107
+ * say: the model cannot ask about a widget it cannot name, but it can read
108
+ * "N more are missing" and stop taking the arrays for the whole story.
109
+ */
110
+ unlistedWidgetCount?: number;
111
+ /** Dashboard filters the translator rejected; never dropped to fit the ceiling. */
112
+ unavailableFilters?: UnavailableFilter[];
113
+ }
114
+ export interface ProjectDashboardJSONOptions {
115
+ /** Serialized-byte ceiling for the whole envelope. Default 60 KiB. */
116
+ ceilingBytes?: number;
117
+ /** How bytes are counted. Default: UTF-8 length of `JSON.stringify(value)`. */
118
+ measureBytes?: (value: unknown) => number;
119
+ }
120
+ /**
121
+ * Default ceiling, sized against the ledger's 64 KiB per-body cap.
122
+ *
123
+ * It has to sit **below** that cap rather than at it: a body over the ledger's
124
+ * budget is truncated by slicing its serialized text, which hands the model
125
+ * broken JSON. Dropping whole widgets and saying so is the degradation this
126
+ * projection wants; a syntax error is not.
127
+ */
128
+ export declare const DEFAULT_DASHBOARD_JSON_CEILING_BYTES: number;
129
+ /**
130
+ * Widget datasources ∪ the dashboard default, sorted and de-duplicated. Exported for the
131
+ * assistant's routing preference (SNS-131459), which needs the titles without paying for a
132
+ * whole projection.
133
+ */
134
+ export declare function collectDataSourceTitles(dashboard: Pick<DashboardProps, 'widgets' | 'defaultDataSource'>): string[];
135
+ /**
136
+ * Projects a dashboard to the document the model reads, under a byte ceiling.
137
+ *
138
+ * Degrades rather than fails: a widget the translator rejects is named in
139
+ * `unavailableWidgets`, a dashboard filter it rejects in `unavailableFilters`,
140
+ * a widget stripped of its opaque blob to fit is named in
141
+ * `degradedWidgets`, a widget too large to fit at all is named in
142
+ * `omittedWidgets`, and — when even those rows do not fit — a widget the document
143
+ * can no longer name is counted in `unlistedWidgetCount`. Every one of those makes
144
+ * the read succeed with `detail: 'partial'`. Throws only on a programming error —
145
+ * the shape of `dashboard` being wrong, not its content.
146
+ *
147
+ * Does not mutate `dashboard`: translation can strip per-measure presentation
148
+ * flags from live `dataOptions` in place (see `sync-chart-state-measure-flags`),
149
+ * so they are snapshotted before and restored after, whatever happens in between.
150
+ */
151
+ export declare function projectDashboardJSON(dashboard: DashboardProps, options?: ProjectDashboardJSONOptions): DashboardJSONProjection;
@@ -0,0 +1,67 @@
1
+ import { WidgetProps } from '@sisense/sdk-ui';
2
+ import { WidgetJSON } from '@sisense/sdk-ui/analytics-composer';
3
+ import { DegradedWidgetField, ProjectedWidgetType } from './project-dashboard-json';
4
+ /** `'full'` iff `widget` is present and nothing was stripped. */
5
+ export type WidgetProjectionDetail = 'full' | 'partial';
6
+ export interface ProjectWidgetJSONOptions {
7
+ /** Serialized-byte ceiling for the whole envelope. Default 32 KiB. */
8
+ ceilingBytes?: number;
9
+ /** How bytes are counted. Default: UTF-8 length of `JSON.stringify(value)`. */
10
+ measureBytes?: (value: unknown) => number;
11
+ }
12
+ /**
13
+ * Default ceiling: half the ledger's 64 KiB stored-body cap.
14
+ *
15
+ * A single widget past that is a plugin blob, and the strip below is the only
16
+ * degradation that can shrink one — there is no "drop the other widgets" move
17
+ * here the way there is for a dashboard. Sitting at half the cap leaves room for
18
+ * whatever envelope a consumer wraps this projection in.
19
+ */
20
+ export declare const DEFAULT_WIDGET_JSON_CEILING_BYTES: number;
21
+ /**
22
+ * One widget as the model reads it: the **verbatim** `translateWidgetToJSON`
23
+ * output under `widget`, plus the identity facts that document may not carry.
24
+ *
25
+ * Deliberately the single-widget mirror of `projectDashboardJSON`, down to the
26
+ * translator call: `projectWidgetJSON(w).widget` deep-equals the entry with the
27
+ * same id in `projectDashboardJSON(d).dashboard.widgets`, because the dashboard
28
+ * projection translates each widget with the same function and no normalization.
29
+ * That equality is what lets a consumer tell "the widget on screen still matches
30
+ * its dashboard copy" from "the user has edited it" by comparing bytes — see
31
+ * sdk-assistant's `composeAmbientContexts`.
32
+ *
33
+ * Identity lives **outside** `widget` for the same reason the dashboard's rows
34
+ * do: anything added inside would make it something other than a `WidgetJSON`,
35
+ * and a future `updateWidget` has to be able to take the model's edited document
36
+ * back whole.
37
+ */
38
+ export interface WidgetJSONProjection {
39
+ widgetId: string;
40
+ widgetType: ProjectedWidgetType;
41
+ chartType?: string;
42
+ title?: string;
43
+ /** Widget data source title, when the widget declares one. */
44
+ dataSourceTitle?: string;
45
+ detail: WidgetProjectionDetail;
46
+ /** Verbatim `translateWidgetToJSON` output; absent when unavailable. */
47
+ widget?: WidgetJSON;
48
+ /** Translator message, or the ceiling notice, when `widget` is absent. */
49
+ unavailableReason?: string;
50
+ /** Present when a custom widget's opaque blob was stripped to fit. */
51
+ degraded?: {
52
+ droppedFields: DegradedWidgetField[];
53
+ bytesFreed: number;
54
+ };
55
+ }
56
+ /**
57
+ * Projects one widget to the document the model reads, under a byte ceiling.
58
+ *
59
+ * Degrades rather than fails: a widget the translator rejects reports
60
+ * `unavailableReason` and keeps its identity, a custom widget over the ceiling
61
+ * loses its opaque plugin blob into `degraded` first and its document last. Both
62
+ * make the read succeed with `detail: 'partial'`. Throws only on a programming
63
+ * error — a widget with no `id`, which `translateWidgetToJSON` requires.
64
+ *
65
+ * Does not mutate `widget`: see {@link translateWithMeasureFlagGuard}.
66
+ */
67
+ export declare function projectWidgetJSON(widget: WidgetProps, options?: ProjectWidgetJSONOptions): WidgetJSONProjection;
@@ -0,0 +1,19 @@
1
+ import { WidgetProps } from '@sisense/sdk-ui';
2
+ import { WidgetJSON } from '@sisense/sdk-ui/analytics-composer';
3
+ /** UTF-8 length of the plain serialization — overridden by sdk-assistant. */
4
+ export declare function defaultMeasureBytes(value: unknown): number;
5
+ export declare const truncateReason: (message: string) => string;
6
+ /** Chart type when the widget is a chart; pivot/text/custom carry none. */
7
+ export declare function chartTypeOf(widget: WidgetProps | WidgetJSON): string | undefined;
8
+ /** Title when the widget has one — text widgets do not. */
9
+ export declare function titleOf(widget: WidgetProps | WidgetJSON): string | undefined;
10
+ /** The id/type/title triple every widget row — and every projection — identifies a widget by. */
11
+ export declare function identifyWidgetJSON(widget: WidgetProps | WidgetJSON): {
12
+ title?: string | undefined;
13
+ chartType?: string | undefined;
14
+ id: string;
15
+ widgetType: "filter" | "custom" | "text" | "chart" | "pivot" | "narrative";
16
+ };
17
+ export declare function isCustomWidgetJSON(widget: WidgetJSON): widget is Extract<WidgetJSON, {
18
+ widgetType: 'custom';
19
+ }>;
@@ -0,0 +1,55 @@
1
+ import { DashboardProps } from '@sisense/sdk-ui';
2
+ import { HttpClient } from '@sisense/sdk-rest-client';
3
+ import { DataModelRef } from '../../services/ai-access/ai-access-service';
4
+ import { DashboardJSONProjection, UnavailableWidget } from './project-dashboard-json';
5
+ import { WidgetJSONProjection } from './project-widget-json';
6
+ /**
7
+ * Written for the model, which reads it on the widget's `unavailableWidgets` row or as the
8
+ * widget's `unavailableReason`.
9
+ */
10
+ export declare const DATA_MODEL_CLOSED_TO_AI_REASON: string;
11
+ /** A dashboard with what the model may not see taken out, and what was taken. */
12
+ export interface DashboardAiRedaction {
13
+ dashboard: DashboardProps;
14
+ closedWidgets: UnavailableWidget[];
15
+ closedFilterCount: number;
16
+ /** Filters withheld because they use a column hidden from AI (SNS-136150). */
17
+ hiddenColumnFilterCount?: number;
18
+ /** Filters withheld because their data model's fields could not be checked (fail closed). */
19
+ unverifiedFilterCount?: number;
20
+ }
21
+ /**
22
+ * A data source's lookup reference: its title, and its fullname when it carries one
23
+ * (`DataSourceInfo` / `JaqlDataSource` objects do; a bare title string does not).
24
+ */
25
+ export declare function dataModelRefOf(dataSource: unknown): DataModelRef | undefined;
26
+ /** Every data model a dashboard reads — widgets, filter tiles and the default — by reference. */
27
+ export declare function dashboardDataModelRefs(dashboard: Pick<DashboardProps, 'widgets' | 'filters' | 'defaultDataSource'>): DataModelRef[];
28
+ /**
29
+ * Removes every widget and filter tile on a data model the current assistant surface may not use
30
+ * (SNS-132917), before the dashboard is projected for the model. Widgets on other models stay, so
31
+ * a dashboard mixing open and closed models is still answerable for the open part. Models are
32
+ * looked up by fullname where the dashboard carries one, so a closed ElastiCube is not mistaken
33
+ * for its open Live twin.
34
+ */
35
+ export declare function redactDashboardClosedToAi(dashboard: DashboardProps, httpClient?: HttpClient): Promise<DashboardAiRedaction>;
36
+ /** Names the withheld widgets and filters on the projection of a redacted dashboard. */
37
+ export declare function withClosedToAiRows(projection: DashboardJSONProjection, redaction: DashboardAiRedaction): DashboardJSONProjection;
38
+ /**
39
+ * Withholds a widget projection whose data model the current assistant surface may not use,
40
+ * keeping only the identity the user sees, so the model can name the widget it cannot read.
41
+ */
42
+ export declare function redactWidgetProjectionClosedToAi(projection: WidgetJSONProjection, options?: {
43
+ /** The widget's own data source, so its fullname can be used; else its projected title. */
44
+ dataSource?: unknown;
45
+ /** The dashboard's default data source, for a widget that names none of its own. */
46
+ defaultDataSource?: unknown;
47
+ defaultDataSourceTitle?: string;
48
+ /**
49
+ * The widget as stored, which names its columns as `[Table.Column]`. Pass it whenever the
50
+ * caller has it: the projection translates the columns into compose code (`DM.Table.Column`),
51
+ * which the hidden-column check cannot read.
52
+ */
53
+ source?: unknown;
54
+ httpClient?: HttpClient;
55
+ }): Promise<WidgetJSONProjection>;
@@ -0,0 +1,55 @@
1
+ import { HttpClient } from '@sisense/sdk-rest-client';
2
+ /**
3
+ * Written for the model, which reads it on the widget's `unavailableWidgets` row or as the
4
+ * widget's `unavailableReason`.
5
+ */
6
+ export declare const HIDDEN_COLUMN_REASON: string;
7
+ /**
8
+ * Written for the model when the field list could not be read, so nothing could be checked. A
9
+ * different message from {@link HIDDEN_COLUMN_REASON}: nothing is known to be hidden, and the
10
+ * model must not tell the user that access is restricted.
11
+ */
12
+ export declare const COLUMNS_UNVERIFIED_REASON: string;
13
+ /** What the lookups found out about the columns a set of items names. */
14
+ export interface HiddenColumnLookup {
15
+ /** Hidden columns, as keys for {@link columnAccessOf}. */
16
+ hidden: Set<string>;
17
+ /** Data models whose field list could not be read, so their columns could not be checked. */
18
+ unverifiedModels: Set<string>;
19
+ }
20
+ /**
21
+ * A column named in a widget or filter, as `[Table.Column]`. `dataModel` is the title of the
22
+ * nearest enclosing `dataSource`, when the item names one, so a widget whose attribute or filter
23
+ * sits on another data model is judged against that model.
24
+ */
25
+ export interface ColumnRef {
26
+ table: string;
27
+ column: string;
28
+ dataModel?: string;
29
+ }
30
+ /** Every column reference in an arbitrary value: `[Table.Column]` strings and `{ table, column }` pairs. */
31
+ export declare function columnRefsIn(value: unknown): ColumnRef[];
32
+ /** Drops every remembered lookup; for tests. */
33
+ export declare function resetHiddenColumnCache(): void;
34
+ /**
35
+ * Which of `refs` name a column the model may not see. Each ref is judged on its own data model
36
+ * (`ref.dataModel`, else `dataModelTitle`); the keys returned are for {@link usesHiddenColumn}.
37
+ *
38
+ * Two signals, because the server generations differ (SNS-135153): with `availableFor=genai` a
39
+ * current server leaves hidden columns out of the field list, so a hidden column is one that is
40
+ * absent; an older one ignores the argument and still returns it, tagged `hide_from_ai`. Both
41
+ * lookups are not equal when they fail: an unreadable field list marks the model unverified (fail
42
+ * closed, like the AI-access check), while a failed tag read adds nothing, since the absence
43
+ * signal still covers a current server.
44
+ */
45
+ export declare function findHiddenColumnRefs(dataModelTitle: string, refs: ColumnRef[], httpClient?: HttpClient): Promise<HiddenColumnLookup>;
46
+ /**
47
+ * How a value stands against the lookup, for the same `dataModelTitle`: `hidden` when it names a
48
+ * column hidden from AI, `unverified` when it names a column of a data model whose field list could
49
+ * not be read (fail closed), otherwise undefined. Hidden wins, since it is known.
50
+ */
51
+ export declare function columnAccessOf(value: unknown, lookup: HiddenColumnLookup, dataModelTitle: string): 'hidden' | 'unverified' | undefined;
52
+ /** The reason the model reads for a withheld item. */
53
+ export declare function reasonForColumnAccess(access: 'hidden' | 'unverified'): string;
54
+ /** Looks up the hidden columns each data model contributes, one request set per model. */
55
+ export declare function findHiddenColumnsByModel(itemsByModel: Map<string, unknown[]>, httpClient?: HttpClient): Promise<Map<string, HiddenColumnLookup>>;