@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.
- package/dist/__vite-browser-external-l0sNRNKZ.js +1 -0
- package/dist/constants.d.ts +36 -0
- package/dist/engines/atomic-handle-args.d.ts +45 -0
- package/dist/engines/atomic-tool-requirements.d.ts +38 -0
- package/dist/engines/author-pulse/actions/create.d.ts +9 -0
- package/dist/engines/author-pulse/actions/define.d.ts +9 -0
- package/dist/engines/author-pulse/actions/load-existing.d.ts +9 -0
- package/dist/engines/author-pulse/actions/redefine.d.ts +9 -0
- package/dist/engines/author-pulse/actions/set-receive-notifications.d.ts +8 -0
- package/dist/engines/author-pulse/actions/update-spec.d.ts +11 -0
- package/dist/engines/author-pulse/actions/update-workflow.d.ts +9 -0
- package/dist/engines/author-pulse/atomic-adapter.d.ts +10 -0
- package/dist/engines/author-pulse/atomic-tools.d.ts +362 -0
- package/dist/engines/author-pulse/author-pulse-engine.d.ts +21 -0
- package/dist/engines/author-pulse/index.d.ts +9 -0
- package/dist/engines/author-pulse/shared/adjustment-error.d.ts +15 -0
- package/dist/engines/author-pulse/shared/assemble-create-workflow-payload.d.ts +36 -0
- package/dist/engines/author-pulse/shared/assert-agentic-workflow.d.ts +12 -0
- package/dist/engines/author-pulse/shared/compile-query-from-prompt.d.ts +95 -0
- package/dist/engines/author-pulse/shared/decision-spec-validation.d.ts +84 -0
- package/dist/engines/author-pulse/shared/notification-urls.d.ts +52 -0
- package/dist/engines/author-pulse/shared/pulse-knowledge.d.ts +36 -0
- package/dist/engines/author-pulse/shared/pulse-signature.d.ts +39 -0
- package/dist/engines/author-pulse/shared/resolve-frequency.d.ts +18 -0
- package/dist/engines/author-pulse/shared/staging.d.ts +65 -0
- package/dist/engines/author-pulse/shared/workflow-ownership.d.ts +14 -0
- package/dist/engines/author-pulse/types.d.ts +1385 -0
- package/dist/engines/build-chart/atomic-adapter.d.ts +20 -0
- package/dist/engines/build-chart/atomic-tools.d.ts +214 -0
- package/dist/engines/build-chart/build-chart-engine.d.ts +1 -1
- package/dist/engines/build-chart/chart-tool-name.d.ts +3 -0
- package/dist/engines/build-chart/create-chart/assemble-chart-widget.d.ts +1 -1
- package/dist/engines/build-chart/create-chart/chart-json-axes-mapping.d.ts +1 -1
- package/dist/engines/build-chart/create-chart/create-chart.d.ts +1 -1
- package/dist/engines/build-chart/create-chart/derive-chart-title.d.ts +7 -0
- package/dist/engines/build-chart/create-chart/generate-chart-recommendations.d.ts +2 -2
- package/dist/engines/build-chart/create-chart/resolve-chart-query.d.ts +4 -0
- package/dist/engines/build-chart/shared/normalize-cartesian-axes-mapping.d.ts +1 -1
- package/dist/engines/build-chart/shared/sync-chart-state-measure-flags.d.ts +3 -0
- package/dist/engines/build-chart/types.d.ts +49 -19
- package/dist/engines/build-chart/update-chart/apply-prior-chart-style.d.ts +8 -5
- package/dist/engines/build-chart/update-chart/chart-options-schemas.d.ts +18 -18
- package/dist/engines/build-chart/update-chart/schemas.d.ts +2 -2
- package/dist/engines/build-chart/update-chart/update-chart-data-options.d.ts +7 -2
- package/dist/engines/build-chart/update-chart/update-chart-query.d.ts +1 -1
- package/dist/engines/build-chart/update-chart/update-chart-style-options.d.ts +7 -2
- package/dist/engines/build-chart/update-chart/update-chart-title.d.ts +1 -1
- package/dist/engines/build-chart/update-chart/update-chart-type.d.ts +7 -2
- package/dist/engines/build-csv-model/build-csv-model-engine.d.ts +1 -1
- package/dist/engines/build-csv-model/types.d.ts +1 -1
- package/dist/engines/build-dashboard/add-dashboard-narration.d.ts +50 -0
- package/dist/engines/build-dashboard/add-dashboard-widgets.d.ts +1 -1
- package/dist/engines/build-dashboard/atomic-adapter.d.ts +21 -0
- package/dist/engines/build-dashboard/atomic-tools.d.ts +231 -0
- package/dist/engines/build-dashboard/build-dashboard-engine.d.ts +1 -1
- package/dist/engines/build-dashboard/build-dashboard-service.d.ts +2 -1
- package/dist/engines/build-dashboard/create-dashboard.d.ts +3 -4
- package/dist/engines/build-dashboard/dashboard-filters/manipulate-dashboard-filters.d.ts +2 -1
- package/dist/engines/build-dashboard/dashboard-filters/translate-filters.d.ts +17 -1
- package/dist/engines/build-dashboard/index.d.ts +2 -0
- package/dist/engines/build-dashboard/layout/place-widget.d.ts +53 -0
- package/dist/engines/build-dashboard/load-existing-fusion-dashboard.d.ts +1 -1
- package/dist/engines/build-dashboard/remove-dashboard-widgets.d.ts +4 -0
- package/dist/engines/build-dashboard/resolve-chart-widgets.d.ts +16 -0
- package/dist/engines/build-dashboard/types.d.ts +180 -18
- package/dist/engines/build-data-model/build-data-model-engine.d.ts +1 -1
- package/dist/engines/build-data-model/types.d.ts +1 -1
- package/dist/engines/build-query/build-query-engine.d.ts +33 -5
- package/dist/engines/build-query/index.d.ts +1 -1
- package/dist/engines/build-query/types.d.ts +216 -3
- package/dist/engines/build-status/build-status-engine.d.ts +8 -0
- package/dist/engines/build-status/builds-client.d.ts +44 -0
- package/dist/engines/build-status/index.d.ts +2 -0
- package/dist/engines/build-status/types.d.ts +177 -0
- package/dist/engines/datamodel-graph/data-model-map-text.d.ts +28 -0
- package/dist/engines/datamodel-graph/datamodel-graph-engine.d.ts +31 -0
- package/dist/engines/datamodel-graph/index.d.ts +4 -0
- package/dist/engines/datamodel-graph/summaries.d.ts +97 -0
- package/dist/engines/datamodel-graph/test-fixtures.d.ts +42 -0
- package/dist/engines/datamodel-graph/types.d.ts +190 -0
- package/dist/engines/evaluate-pulse/evaluate-pulse-engine.d.ts +10 -0
- package/dist/engines/evaluate-pulse/index.d.ts +2 -0
- package/dist/engines/evaluate-pulse/types.d.ts +85 -0
- package/dist/engines/get-dashboard-narration/get-dashboard-narration-engine.d.ts +23 -0
- package/dist/engines/get-dashboard-narration/index.d.ts +2 -0
- package/dist/engines/get-dashboard-narration/types.d.ts +64 -0
- package/dist/engines/get-dashboards/get-dashboards-engine.d.ts +1 -1
- package/dist/engines/get-dashboards/types.d.ts +16 -4
- package/dist/engines/get-data-preview/get-data-preview-engine.d.ts +18 -0
- package/dist/engines/get-data-preview/index.d.ts +2 -0
- package/dist/engines/get-data-preview/types.d.ts +35 -0
- package/dist/engines/get-data-source-fields/get-data-source-fields-engine.d.ts +12 -6
- package/dist/engines/get-data-source-fields/index.d.ts +1 -0
- package/dist/engines/get-data-source-fields/model-relations.d.ts +38 -0
- package/dist/engines/get-data-source-fields/types.d.ts +53 -3
- package/dist/engines/get-data-sources/get-data-sources-engine.d.ts +1 -1
- package/dist/engines/get-data-sources/types.d.ts +2 -2
- package/dist/engines/index.d.ts +17 -0
- package/dist/engines/inspect-pulse/atomic-adapter.d.ts +8 -0
- package/dist/engines/inspect-pulse/atomic-tools.d.ts +60 -0
- package/dist/engines/inspect-pulse/index.d.ts +4 -0
- package/dist/engines/inspect-pulse/inspect-pulse-engine.d.ts +7 -0
- package/dist/engines/inspect-pulse/types.d.ts +209 -0
- package/dist/engines/manage-perspectives/manage-perspectives-engine.d.ts +5 -1
- package/dist/engines/manage-perspectives/types.d.ts +13 -8
- package/dist/engines/pulse-tool-words.d.ts +62 -0
- package/dist/engines/recommend-queries/recommend-queries-engine.d.ts +1 -1
- package/dist/engines/recommend-queries/types.d.ts +1 -1
- package/dist/engines/shared/existing-answer-cascade.d.ts +52 -0
- package/dist/engines/shared/get-filters-json-for-llm-summary.d.ts +2 -2
- package/dist/engines/shared/nlq-query-helpers.d.ts +2 -2
- package/dist/engines/shared/project-dashboard-json.d.ts +151 -0
- package/dist/engines/shared/project-widget-json.d.ts +67 -0
- package/dist/engines/shared/projection-helpers.d.ts +19 -0
- package/dist/engines/shared/redact-data-models-closed-to-ai.d.ts +55 -0
- package/dist/engines/shared/redact-hidden-columns-from-ai.d.ts +55 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +56879 -27530
- package/dist/services/ai-access/ai-access-service.d.ts +68 -0
- package/dist/services/dashboards/dashboards-service.d.ts +9 -3
- package/dist/services/dashboards/fusion-dashboards-service.d.ts +34 -4
- package/dist/services/data-sources/data-sources-service.d.ts +149 -5
- package/dist/services/data-sources/find-data-source-by-title.d.ts +8 -0
- package/dist/services/datamodel-graph/datamodel-graph-service.d.ts +457 -0
- package/dist/services/existing-answer/existing-answer-query-service.d.ts +31 -0
- package/dist/services/formulas/formulas-service.d.ts +19 -0
- package/dist/services/hide-from-ai/hide-from-ai.d.ts +31 -0
- package/dist/services/knowledge-graph/knowledge-graph-service.d.ts +96 -0
- package/dist/services/llm/llm-consumption-service.d.ts +7 -2
- package/dist/services/llm/llm-models-service.d.ts +10 -2
- package/dist/services/llm/llm-settings-service.d.ts +73 -0
- package/dist/services/nlq/nlq-preview-dataset.d.ts +34 -0
- package/dist/services/nlq/nlq-service.d.ts +138 -3
- package/dist/services/pulse/evaluate-pulse-client.d.ts +78 -0
- package/dist/services/pulse/pulse-alerts-service.d.ts +264 -0
- package/dist/services/pulse/pulse-events-service.d.ts +217 -0
- package/dist/services/semantic-search/semantic-search-service.d.ts +43 -0
- package/dist/services/tool-store/tool-store-service.d.ts +32 -0
- package/dist/services/users-groups-service.d.ts +37 -0
- package/dist/skills/index.d.ts +127 -0
- package/dist/tool-availability/controlled-tools.d.ts +56 -0
- package/dist/tool-availability/index.d.ts +4 -0
- package/dist/tool-availability/offer-tools.d.ts +44 -0
- package/dist/tool-availability/resolve-tool-availability.d.ts +68 -0
- package/dist/tool-availability/withdrawn-text.d.ts +33 -0
- package/dist/tool-catalog/catalog.d.ts +387 -0
- package/dist/tool-catalog/index.d.ts +3 -0
- package/dist/tool-catalog/manifest.d.ts +5 -0
- package/dist/tool-catalog/prototype-lookup.d.ts +10 -0
- package/dist/tool-catalog/types.d.ts +67 -0
- package/dist/tools.manifest.json +826 -0
- package/dist/utils/chat-stream-errors.d.ts +42 -0
- package/dist/utils/create-custom-fetch.d.ts +19 -1
- package/dist/utils/create-stream-completion.d.ts +84 -6
- package/dist/utils/create-structured-completion.d.ts +29 -2
- package/dist/utils/create-tools-completion.d.ts +9 -0
- package/dist/utils/deferred-tools.d.ts +45 -0
- package/dist/utils/dev-debug.d.ts +5 -0
- package/dist/utils/generate-suggestions.d.ts +32 -0
- package/dist/utils/http-client.d.ts +3 -1
- package/dist/utils/llm-call-observer.d.ts +83 -0
- package/dist/utils/llm-client.d.ts +11 -1
- package/dist/utils/llm-model-override.d.ts +41 -0
- package/dist/utils/quoted-text.d.ts +6 -0
- package/dist/utils/server-error-body.d.ts +23 -0
- package/dist/utils/text-tokens.d.ts +35 -0
- package/dist/utils/user-action-tracking.d.ts +48 -5
- package/dist/utils/zod-utils.d.ts +9 -1
- package/package.json +28 -18
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HttpClient } from '@sisense/sdk-rest-client';
|
|
3
|
+
import { ColumnValuesResult } from '../../services/nlq/nlq-service';
|
|
4
|
+
/**
|
|
5
|
+
* Canonical tool description for getDataPreview — reusable by any host (sdk-assistant, MCP server,
|
|
6
|
+
* custom integrations). Hosts may append host-specific notes but should not duplicate or
|
|
7
|
+
* contradict this text.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getDataPreviewToolDescription = "Returns every distinct value stored in one text column, so a query filters on real values instead of guessed ones. Gives `values` plus `complete`.\n\nWHEN TO CALL \u2014 after getDataSourceFields (take table and column names from that listing; a guessed name fails) and BEFORE buildQuery, whenever the query will FILTER a text column holding a fixed set of labels (category, type, status, tier, band, segment, region\u2026). The column decides, not the user's phrasing:\n- \"high-income households\", \"premium tier\", \"still in process\" \u2014 a concept in a banded or coded column. The stored spelling is the data's, not yours; with no bucket of its own, name the bucket containing it.\n- \"except refunds\", \"only wholesale accounts\" \u2014 the user NAMES members. Their word is a description: Account Type may hold \"WHSL - Wholesale Account\" where they said \"wholesale\", and a filter on their word matches nothing while the total looks correct. Leaving a set out also needs `complete: true`.\n- \"everything else\", \"unset\", \"blank\" \u2014 claims about encoding. Read the column and name the real values.\n\nThe filter uses whatever spellings are in `queryPrompt`; forwarding the user's wording IS the guess this tool prevents. The listing gives names, not types, so `Brand`, `Country`, `City` read both ways \u2014 err toward reading: a needless read costs one call, a skipped one silently matches nothing.\n\nDO NOT CALL only when:\n- The user gave an explicit TEXT-MATCHING PREDICATE \u2014 contains, starts with, ends with (\"name contains 'Logistics'\"). Pass it into `queryPrompt` unchanged. Quotation marks are not a predicate: \"status is 'in progress'\" still needs the read.\n- The column is an identifier, a name, free text, a date or a measure \u2014 or no text column is filtered.\n- To browse data. One column per call.\n\nIF THE CALL FAILS on a name: the names were not the ones getDataSourceFields lists (a Status column may live in a Tickets table). Call getDataSourceFields if you have not, then retry with the exact names. If the error says not to retry (no AI access to the model), follow it instead. Never answer a failed read by building the query without one.\n\nRESULT:\n- `complete: true` with values: every distinct value, safe to build exclusions from.\n- `complete: false`: too many to enumerate, none returned. Do not guess; write the prompt in the user's own words.\n- `complete: true` with no values: not proof the column is empty. Do not invent values.";
|
|
10
|
+
/**
|
|
11
|
+
* Schema for getDataPreviewEngine parameters
|
|
12
|
+
*/
|
|
13
|
+
export declare const getDataPreviewSchema: z.ZodObject<{
|
|
14
|
+
dataSourceTitle: z.ZodString;
|
|
15
|
+
table: z.ZodString;
|
|
16
|
+
column: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type GetDataPreviewParams = z.infer<typeof getDataPreviewSchema>;
|
|
19
|
+
/**
|
|
20
|
+
* Context interface for getDataPreviewEngine
|
|
21
|
+
*/
|
|
22
|
+
export interface GetDataPreviewContext {
|
|
23
|
+
/** Tool call ID */
|
|
24
|
+
toolCallId?: string;
|
|
25
|
+
httpClient?: HttpClient;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Result from getDataPreviewEngine.
|
|
29
|
+
*
|
|
30
|
+
* Mirrors the service response as-is: the value list and the completeness verdict. Nothing is
|
|
31
|
+
* recomputed here — the server owns the limit and the verdict. The response also carries `mode` and
|
|
32
|
+
* `term`, which this caller never sets: the narrowing modes exist for the NLQ-side caller, which has
|
|
33
|
+
* statistics and the filter under construction to choose them with.
|
|
34
|
+
*/
|
|
35
|
+
export type DataPreviewResult = ColumnValuesResult;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { z } from 'zod
|
|
1
|
+
import { z } from 'zod';
|
|
2
2
|
import { MeasureItemJSON } from '@sisense/sdk-ui/analytics-composer';
|
|
3
|
-
import { DataSourceFieldWithDescription } from '../../services/data-sources/data-sources-service';
|
|
3
|
+
import { DataSourceFieldWithDescription, DataSourceAiFields } from '../../services/data-sources/data-sources-service';
|
|
4
4
|
import { DataSourceField } from '@sisense/sdk-data';
|
|
5
|
-
import { getDataSourceFieldsSchema, GetDataSourceFieldsContext, DataSourceFieldsResult } from './types';
|
|
5
|
+
import { getDataSourceFieldsSchema, GetDataSourceFieldsContext, DataSourceFieldsResult, DataSourceRelation } from './types';
|
|
6
6
|
/**
|
|
7
7
|
* Fetches fields for a data source (decoupled from UI/store).
|
|
8
8
|
* @param params - The parameters containing the data source title
|
|
@@ -16,13 +16,19 @@ export declare function getDataSourceFieldsEngine(params: z.infer<typeof getData
|
|
|
16
16
|
* @param formulas - Shared formulas in JSON format (array of { function, args })
|
|
17
17
|
* @returns YAML block with heading and list of { name, description }, or empty string if none
|
|
18
18
|
*/
|
|
19
|
-
export declare function buildCompactSharedFormulas(formulas: MeasureItemJSON[]): string;
|
|
19
|
+
export declare function buildCompactSharedFormulas(formulas: MeasureItemJSON[], aiContextByTitle?: Record<string, string>): string;
|
|
20
20
|
/**
|
|
21
|
-
* Builds the compact schema string returned to the LLM (intro + tables/columns + optional shared
|
|
21
|
+
* Builds the compact schema string returned to the LLM (intro + tables/columns + optional shared
|
|
22
|
+
* formulas + optional relationships).
|
|
22
23
|
* Reduces token use by returning a single string instead of a JSON object.
|
|
23
24
|
* @param dataSourceTitle - The title of the data source
|
|
24
25
|
* @param fields - The full list of fields from the data source
|
|
25
26
|
* @param formulas - Optional shared formulas in NLQ JSON format (for the chat agent)
|
|
27
|
+
* @param aiFields - Optional designer AI context at model/table/column level
|
|
28
|
+
* @param formulaAiContextByTitle - Optional designer AI context for shared formulas
|
|
29
|
+
* @param relations - Optional join graph from the engine result (`DataSourceFieldsResult.relations`)
|
|
30
|
+
* @param label - Optional name the user sees (`DataSourceFieldsResult.displayTitle`). Rendered
|
|
31
|
+
* as a display-only annotation after the identity title when it differs; never replaces it.
|
|
26
32
|
* @returns A compact schema string with table and column names, and shared formulas when provided
|
|
27
33
|
*/
|
|
28
|
-
export declare function getDataSourceFieldsSummary(dataSourceTitle: string, fields: DataSourceFieldWithDescription[] | DataSourceField[], formulas?: MeasureItemJSON[]): string;
|
|
34
|
+
export declare function getDataSourceFieldsSummary(dataSourceTitle: string, fields: DataSourceFieldWithDescription[] | DataSourceField[], formulas?: MeasureItemJSON[], aiFields?: DataSourceAiFields, formulaAiContextByTitle?: Record<string, string>, relations?: DataSourceRelation[], label?: string): string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { HttpClient } from '@sisense/sdk-rest-client';
|
|
2
|
+
import { ModelSchemaResult } from '../manage-perspectives/types';
|
|
3
|
+
import { DataSourceAiFields } from '../../services/data-sources/data-sources-service';
|
|
4
|
+
import { DataSourceRelation } from './types';
|
|
5
|
+
/** Map a schema's OID-keyed relations onto `Table.Column` endpoint pairs. */
|
|
6
|
+
export declare function toDataSourceRelations(schema: ModelSchemaResult): DataSourceRelation[];
|
|
7
|
+
/**
|
|
8
|
+
* Drop every join that names a `hide_from_ai` table or column (SNS-131767).
|
|
9
|
+
*
|
|
10
|
+
* A model-graphql server older than SNS-135153 ignores `availableFor` and returns every join, so a
|
|
11
|
+
* hidden entity that has been stripped from `fields` and `aiFields` would otherwise reappear here —
|
|
12
|
+
* and this block goes straight to the LLM. On newer servers the joins are already gone. A join is
|
|
13
|
+
* dropped whole rather than trimmed: an endpoint is only meaningful next to the one it joins to,
|
|
14
|
+
* and a "Patients.ID = " fragment still discloses that something was removed. Fail-open on absent
|
|
15
|
+
* tags, matching the rest of the engine: no tags, nothing hidden.
|
|
16
|
+
*/
|
|
17
|
+
export declare function withoutHiddenEntities(relations: DataSourceRelation[], aiFields?: DataSourceAiFields | null): DataSourceRelation[];
|
|
18
|
+
export interface LoadModelRelationsOptions {
|
|
19
|
+
/** Title the fields were listed for — used to resolve the oid when the host did not supply one. */
|
|
20
|
+
dataSourceTitle: string;
|
|
21
|
+
/** Host-supplied `datamodelOid`, when known. Skips the title → oid lookup. */
|
|
22
|
+
datamodelOid?: string;
|
|
23
|
+
/**
|
|
24
|
+
* A perspective's oid, when the field list was filtered to one. `getModelSchemaEngine` accepts it
|
|
25
|
+
* in place of a model oid and returns the perspective-filtered graph, so the relations then
|
|
26
|
+
* describe exactly the tables the caller can see.
|
|
27
|
+
*/
|
|
28
|
+
perspectiveOid?: string;
|
|
29
|
+
httpClient?: HttpClient;
|
|
30
|
+
toolCallId: string;
|
|
31
|
+
}
|
|
32
|
+
/** Relations for one model, or an empty array when they cannot be determined. */
|
|
33
|
+
export declare function loadModelRelations(options: LoadModelRelationsOptions): Promise<DataSourceRelation[]>;
|
|
34
|
+
/**
|
|
35
|
+
* The relationships block appended to the field summary. Empty string when there is nothing to say,
|
|
36
|
+
* so the caller can concatenate unconditionally.
|
|
37
|
+
*/
|
|
38
|
+
export declare function renderRelationsBlock(relations?: DataSourceRelation[]): string;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { z } from 'zod
|
|
1
|
+
import { z } from 'zod';
|
|
2
2
|
import { DataSourceField } from '@sisense/sdk-data';
|
|
3
3
|
import { HttpClient } from '@sisense/sdk-rest-client';
|
|
4
|
-
import { DataSourceFieldWithDescription } from '../../services/data-sources/data-sources-service';
|
|
4
|
+
import { DataSourceFieldWithDescription, DisplayNameConfig, DataSourceAiFields } from '../../services/data-sources/data-sources-service';
|
|
5
5
|
import { MeasureItemJSON } from '@sisense/sdk-ui/analytics-composer';
|
|
6
6
|
/**
|
|
7
7
|
* Canonical tool description for getDataSourceFields — reusable by any host (sdk-assistant, MCP server, custom integrations).
|
|
8
8
|
* Hosts may append host-specific notes but should not duplicate or contradict this text.
|
|
9
9
|
*/
|
|
10
|
-
export declare const getDataSourceFieldsToolDescription = "Lists the fields of a data source \u2014 its tables, columns, and user-created formulas \u2014 in an interactive, searchable field browser. THIS is the tool to use whenever the user asks to \"list / show / see the fields, tables, or columns\" of a data source or data model. Pass the data source / model title from getDataSources or listDataModels.\n\nUse this for the FIELD/COLUMN/TABLE LIST. Use getModelSchema (or getPerspective) only for the visual model/perspective DIAGRAM (\"show me the model / perspective\", \"open the diagram\") \u2014 not for a plain field list. Do not answer a \"list the fields/columns/tables\" request as plain text; always call this tool so the field browser renders.\n\nPERSPECTIVES: a perspective is not its own data source. To list a perspective's fields, set `dataSourceTitle` to the perspective's PARENT model title and pass `perspectiveOid` \u2014 the parent model's fields are then filtered to exactly what the perspective exposes.";
|
|
10
|
+
export declare const getDataSourceFieldsToolDescription = "Lists the fields of a data source \u2014 its tables, columns, and user-created formulas \u2014 in an interactive, searchable field browser. THIS is the tool to use whenever the user asks to \"list / show / see the fields, tables, or columns\" of a data source or data model. Pass the data source / model title from getDataSources or listDataModels.\n\nNAMING: when the summary's first line reads `<title> (label: \"<label>\")`, the label is the name the user sees \u2014 use it when you mention the data source in your replies. The title is the identity: pass it (never the label) as `dataSourceTitle` and in every other tool argument and query.\n\nUse this for the FIELD/COLUMN/TABLE LIST. Use getModelSchema (or getPerspective) only for the visual model/perspective DIAGRAM (\"show me the model / perspective\", \"open the diagram\") \u2014 not for a plain field list. Do not answer a \"list the fields/columns/tables\" request as plain text; always call this tool so the field browser renders.\n\nPERSPECTIVES: a perspective is not its own data source. To list a perspective's fields, set `dataSourceTitle` to the perspective's PARENT model title and pass `perspectiveOid` \u2014 the parent model's fields are then filtered to exactly what the perspective exposes.\n\nNAMES, NOT VALUES: the listing says which columns exist, not what strings they hold. A column called Category, Status or Income Band gives no hint of its stored spellings. Before filtering a query on such a column, read its values with getDataPreview.\n\nDESIGNER AI CONTEXT: results may include designer-authored \"Context:\"/\"context:\" entries at the model, table, column, or shared-formula level. Treat any such context as authoritative instructions from the data-model designer \u2014 which table/column to use for a kind of question, which columns to always include, when to use a particular shared formula, and occasionally a stored value a user term refers to \u2014 and honor it when choosing fields, selecting shared formulas, and building queries. Context that spells a value out is the one case where that value need not be read first.\n\nRELATIONSHIPS: the result also lists how the tables join, as `Table.Column = Table.Column`. Use it to answer \"how do these tables relate / can I combine X with Y\" and to pick fields that are actually joinable \u2014 never infer joins from matching field names. Joins are applied automatically when a query spans tables; you do not pass them to any tool. Set `includeRelations` to false to omit them on a wide model where you only need the field list.";
|
|
11
11
|
/**
|
|
12
12
|
* Schema for getDataSourceFields engine parameters
|
|
13
13
|
*/
|
|
14
14
|
export declare const getDataSourceFieldsSchema: z.ZodObject<{
|
|
15
15
|
dataSourceTitle: z.ZodString;
|
|
16
16
|
perspectiveOid: z.ZodOptional<z.ZodString>;
|
|
17
|
+
includeRelations: z.ZodOptional<z.ZodBoolean>;
|
|
17
18
|
}, z.core.$strip>;
|
|
18
19
|
/**
|
|
19
20
|
* Context interface for getDataSourceFieldsEngine
|
|
@@ -24,13 +25,62 @@ export interface GetDataSourceFieldsContext {
|
|
|
24
25
|
*/
|
|
25
26
|
toolCallId: string;
|
|
26
27
|
httpClient?: HttpClient;
|
|
28
|
+
/**
|
|
29
|
+
* From host AppSettings (e.g. useAppSettings). Omit → fields/search (viewer-safe).
|
|
30
|
+
*/
|
|
31
|
+
displayNameConfig?: DisplayNameConfig;
|
|
32
|
+
/**
|
|
33
|
+
* Elasticube `datamodelOid` for `dataSourceTitle`, when the host already knows it (e.g. from a
|
|
34
|
+
* memoized getDataSources result). Saves the title → oid lookup on the relations path. Omit and
|
|
35
|
+
* the engine resolves it itself. Host-supplied, deliberately NOT part of the LLM-facing schema —
|
|
36
|
+
* models routinely confuse datamodelOid / datasetOid / tableOid.
|
|
37
|
+
*/
|
|
38
|
+
datamodelOid?: string;
|
|
39
|
+
}
|
|
40
|
+
/** One end of a join: a table and column, resolved to names (never the OIDs ECM returns). */
|
|
41
|
+
export interface DataSourceRelationEndpoint {
|
|
42
|
+
table: string;
|
|
43
|
+
column: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* One join between tables, with every endpoint already resolved to names.
|
|
47
|
+
*
|
|
48
|
+
* `endpoints` always holds at least two — a one-sided join says nothing, and an endpoint that cannot
|
|
49
|
+
* be named is dropped rather than rendered as the raw UUID it arrives as. Kept split rather than
|
|
50
|
+
* pre-joined into `Table.Column` so consumers never have to parse a name that may itself contain a
|
|
51
|
+
* dot; `renderRelationsBlock` does the formatting.
|
|
52
|
+
*/
|
|
53
|
+
export interface DataSourceRelation {
|
|
54
|
+
endpoints: DataSourceRelationEndpoint[];
|
|
27
55
|
}
|
|
28
56
|
/**
|
|
29
57
|
* Result from getDataSourceFieldsEngine (raw data for UI and for building the LLM summary).
|
|
30
58
|
*/
|
|
31
59
|
export interface DataSourceFieldsResult {
|
|
60
|
+
/**
|
|
61
|
+
* Identity title, exactly as requested. Everything that RESOLVES a data source uses
|
|
62
|
+
* this — it leads the LLM summary, so the title the model passes back to another
|
|
63
|
+
* tool is always this one.
|
|
64
|
+
*/
|
|
32
65
|
dataSourceTitle: string;
|
|
66
|
+
/**
|
|
67
|
+
* Label for the card header: the perspective's name, or the model's renameable
|
|
68
|
+
* display name (PR-762 / FR-032), falling back to `dataSourceTitle`. LABEL ONLY —
|
|
69
|
+
* never a tool argument. It reaches the LLM solely as the summary's display-only
|
|
70
|
+
* `label` (SNS-134148), so the model names the source the way the card does.
|
|
71
|
+
*/
|
|
72
|
+
displayTitle: string;
|
|
33
73
|
fields: DataSourceFieldWithDescription[] | DataSourceField[];
|
|
34
74
|
/** Shared formulas as JSON */
|
|
35
75
|
formulas?: MeasureItemJSON[];
|
|
76
|
+
/** Designer AI context (aiContext) at model/table/column level, when available */
|
|
77
|
+
aiFields?: DataSourceAiFields;
|
|
78
|
+
/** Designer AI context for shared formulas, keyed by formula title, when available */
|
|
79
|
+
formulaAiContextByTitle?: Record<string, string>;
|
|
80
|
+
/**
|
|
81
|
+
* How the tables join, when the model exposes joins and the schema could be read. Absent — never
|
|
82
|
+
* an empty array — when relations were not requested, the model has none, or the lookup failed:
|
|
83
|
+
* "could not tell" is a different claim from "there are no joins".
|
|
84
|
+
*/
|
|
85
|
+
relations?: DataSourceRelation[];
|
|
36
86
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { z } from 'zod
|
|
1
|
+
import { z } from 'zod';
|
|
2
2
|
import { HttpClient } from '@sisense/sdk-rest-client';
|
|
3
3
|
import { DataSourceWithStatus } from '../../services/data-sources/data-sources-service';
|
|
4
4
|
/**
|
|
5
5
|
* Canonical tool description for getDataSources — reusable by any host (sdk-assistant, MCP server, custom integrations).
|
|
6
6
|
* Hosts may append host-specific notes but should not duplicate or contradict this text.
|
|
7
7
|
*/
|
|
8
|
-
export declare const getDataSourcesToolDescription = "Get the available data sources / data models. \"Data sources\" and \"data models\" are the SAME entity \u2014 this is the only discovery tool for both.\n\nBefore promising
|
|
8
|
+
export declare const getDataSourcesToolDescription = "Get the available data sources / data models. \"Data sources\" and \"data models\" are the SAME entity \u2014 this is the only discovery tool for both.\n\nBefore promising that queries, charts, dashboards or recommendations will work on a source, check here (or a fresh result in this conversation) whether it exists and is ready or still a draft.\n\nReturns:\n- dataSourceTitles: every source the user has access to (ready + draft)\n- draftDataSourceTitles: the DRAFT subset (models never successfully built)\n- dataSources: array of { title, oid, status, live, label? }, where:\n * title is the IDENTITY of the source \u2014 pass it (never label) wherever a tool argument names a data source, e.g. dataSourceTitle.\n * label is present only when the model was renamed: the on-screen name. Use it when you mention the source to the user; NEVER pass it to any tool.\n * oid is the ELASTICUBE DATAMODEL UUID \u2014 pass this as datamodelOid to getModelSchema, addRelation, createPerspective, updatePerspective, listPerspectives, triggerBuild. NEVER pass the title as datamodelOid.\n * status is 'ready' (built/queryable) or 'draft' (not built yet)\n * live is true for live/external connections (Snowflake, BigQuery\u2026) \u2014 NOT elasticubes (\"cube\"). A live source managed as a data model has an oid and works with the schema/perspective tools; one without an oid does not. Read it from THIS result each time; never recall it from an earlier turn.\n\nWorkflow rules for drafts:\n- DRAFTS CANNOT BE QUERIED: no query, chart, recommendation or dashboard on a draft.\n- Drafts CAN be inspected (getModelSchema), have relations edited (addRelation), and have perspectives listed/created (listPerspectives, createPerspective).\n- \"Show me / view / explore [draft model name]\" \u2192 call getModelSchema with that entry's oid IMMEDIATELY. Do not ask the user \"schema or build?\" \u2014 just render the diagram. Only block on QUERY actions.\n- If the user asks to query/chart/analyze a draft, tell them it must be built first and offer to call triggerBuild.\n\nWhen listing sources to the user, name each by its label when it has one, and mark drafts explicitly (e.g. \"Sales DB (draft \u2014 not built yet)\").\n\nModels an administrator closed to AI are left out. A named model that is not listed may exist: say you do not have access to it \u2014 never that it does not exist \u2014 and do not offer to rebuild or re-upload it.";
|
|
9
9
|
/**
|
|
10
10
|
* Schema for getDataSources engine parameters
|
|
11
11
|
*/
|
package/dist/engines/index.d.ts
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
export { buildChartEngine } from './build-chart/build-chart-engine';
|
|
2
2
|
export { generateChart } from './build-chart/create-chart/generate-chart';
|
|
3
3
|
export * from './build-chart/types';
|
|
4
|
+
export * from './build-chart/atomic-tools';
|
|
5
|
+
export * from './build-chart/atomic-adapter';
|
|
4
6
|
export * from './build-query';
|
|
5
7
|
export * from './build-chart/build-chart-service';
|
|
6
8
|
export { dataOptionsEditingSchemas, chartDataOptionsSchemas, } from './build-chart/update-chart/chart-options-schemas';
|
|
7
9
|
export * from './get-data-sources';
|
|
8
10
|
export * from './get-data-source-fields';
|
|
11
|
+
export * from './datamodel-graph';
|
|
12
|
+
export * from './get-data-preview';
|
|
9
13
|
export * from './get-dashboards';
|
|
10
14
|
export * from './build-dashboard';
|
|
15
|
+
export * from './build-dashboard/atomic-tools';
|
|
16
|
+
export * from './build-dashboard/atomic-adapter';
|
|
17
|
+
export * from './atomic-tool-requirements';
|
|
18
|
+
export * from './pulse-tool-words';
|
|
19
|
+
export * from './get-dashboard-narration';
|
|
11
20
|
export * from './recommend-queries';
|
|
12
21
|
export * from './build-data-model';
|
|
13
22
|
export * from './manage-perspectives';
|
|
14
23
|
export * from './build-csv-model';
|
|
24
|
+
export * from './build-status';
|
|
25
|
+
export * from './inspect-pulse';
|
|
26
|
+
export * from './author-pulse';
|
|
27
|
+
export * from './evaluate-pulse';
|
|
28
|
+
export * from './shared/project-dashboard-json';
|
|
29
|
+
export * from './shared/project-widget-json';
|
|
30
|
+
export * from './shared/redact-data-models-closed-to-ai';
|
|
31
|
+
export * from './shared/redact-hidden-columns-from-ai';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AtomicInspectPulseToolName } from './atomic-tools';
|
|
2
|
+
import { InspectPulseContext, InspectPulseResult } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Adapter from an atomic Pulse read tool to the composite `inspectPulse` engine (SNS-136028), like
|
|
5
|
+
* `atomicAuthorPulseAdapter`. Read results carry no message of their own; a thrown error's message
|
|
6
|
+
* names the atomic tools.
|
|
7
|
+
*/
|
|
8
|
+
export declare function atomicInspectPulseAdapter(toolName: AtomicInspectPulseToolName, args: unknown, context: InspectPulseContext): Promise<InspectPulseResult>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The inspectPulse operations as one tool each (SNS-136028), built the same way as
|
|
3
|
+
* `../author-pulse/atomic-tools.ts`: each input schema is the composite's variant without its `type`,
|
|
4
|
+
* with descriptions that name these tools. All of them only read, so none carries `writes`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const listPulsesToolDescription = "Lists the agentic Pulse workflows the user can see (their own and ones shared with them), one compact row each: enabled (false = paused), receiveNotifications (false = the user muted it), isOwner (only the owner can edit). Optional searchByName filters by name. Returns only enabled workflows unless includeDisabled is true; pass it when looking for a paused one (e.g. to resume it). Always quote counts from the result's counts field, never count rows yourself; when counts.hiddenDisabled > 0, say those paused workflows exist. Read-only; classic KPI, build and upgrade workflows are filtered out.";
|
|
7
|
+
export declare const getPulseToolDescription = "Reads one Pulse's full definition: queries, skill, decisionSpec, frequency, nextCheckTime (when it's next checked; absent when paused, cube-triggered or live alerting is off) with nextCheckText, evalMode, and its last-evaluated status (lastEvaluatedAt/lastEvalFired/lastEvalNarrative, set after every cycle in the user's data scope; lastEvalStatus 'error' means that check failed or didn't run, and it then has no narrative). State the next check from nextCheckText's weekday, date and time (translated when replying in another language), never by working out a weekday from nextCheckTime. Read-only.";
|
|
8
|
+
export declare const listPulseNotificationsToolDescription = "Lists recent fired Pulse notifications. Omit workflowId for an overview across all agentic workflows in one call: each notification already includes its workflow name, so never call this once per workflow after listPulses. Pass workflowId only when the user named one Pulse. Every check it returns belongs to the user's own data scope (the users who see the same rows under data security); users with different data security get their own checks and notifications from the same Pulse. Read-only.";
|
|
9
|
+
export declare const listPulseEvalsToolDescription = "Lists one Pulse's evaluation history (fired or not, errored or not), newest first, each with its narrative, trigger ('build'/'schedule'/'onDemand'/'create') and per-query signals. This is the audit trail. If the answer already exists in a record (\"did it fire\", \"why did it fire\", \"what happened last night\"), read it here; evaluatePulse only runs a brand-new check, when the user explicitly asks for one. Every check it returns belongs to the user's own data scope (the users who see the same rows under data security); users with different data security get their own checks and notifications from the same Pulse. Read-only.";
|
|
10
|
+
export declare const getPulseEvalToolDescription = "Reads one evaluation cycle in full, by its evalId (e.g. from listPulseEvals or a notification's evalId). Works for any retained cycle, not only the recent window listPulseEvals returns (quiet cycles are kept 90 days, fired ones two years). If the answer already exists in a record (\"did it fire\", \"why did it fire\", \"what happened last night\"), read it here; evaluatePulse only runs a brand-new check, when the user explicitly asks for one. Read-only.";
|
|
11
|
+
export declare const getPulseEvalResultsToolDescription = "Reads the raw per-query rows and transform outputs behind one cycle (the columns and rows each query returned, capped at 20 rows per query, with the true row count). Call it only as a drill-down after getPulseEval or listPulseEvals, when the narrative and signals are not enough and a claim needs checking against the real data. Returns an empty list in three cases: the cycle failed or was skipped (status 'error'), so it ran no queries; the cycle aged out (quiet cycles are kept 90 days, fired ones two years); or the cycle belongs to another data scope (e.g. a notification sent under the user's earlier data security). A notification's cycle always fired, so for one under two years old an empty list means another scope: say that cycle isn't in the user's history, not that it aged out. Never imply nothing happened. Read-only.";
|
|
12
|
+
/** In the order the composite tool's actions are documented. */
|
|
13
|
+
export declare const ATOMIC_INSPECT_PULSE_TOOLS: readonly [{
|
|
14
|
+
readonly name: "listPulses";
|
|
15
|
+
readonly actionType: "list-workflows";
|
|
16
|
+
readonly description: "Lists the agentic Pulse workflows the user can see (their own and ones shared with them), one compact row each: enabled (false = paused), receiveNotifications (false = the user muted it), isOwner (only the owner can edit). Optional searchByName filters by name. Returns only enabled workflows unless includeDisabled is true; pass it when looking for a paused one (e.g. to resume it). Always quote counts from the result's counts field, never count rows yourself; when counts.hiddenDisabled > 0, say those paused workflows exist. Read-only; classic KPI, build and upgrade workflows are filtered out.";
|
|
17
|
+
readonly inputSchema: import('zod').ZodObject<{
|
|
18
|
+
searchByName: import('zod').ZodOptional<import('zod').ZodString>;
|
|
19
|
+
includeDisabled: import('zod').ZodOptional<import('zod').ZodBoolean>;
|
|
20
|
+
}, import('zod/v4/core').$strip>;
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "getPulse";
|
|
23
|
+
readonly actionType: "get-workflow";
|
|
24
|
+
readonly description: "Reads one Pulse's full definition: queries, skill, decisionSpec, frequency, nextCheckTime (when it's next checked; absent when paused, cube-triggered or live alerting is off) with nextCheckText, evalMode, and its last-evaluated status (lastEvaluatedAt/lastEvalFired/lastEvalNarrative, set after every cycle in the user's data scope; lastEvalStatus 'error' means that check failed or didn't run, and it then has no narrative). State the next check from nextCheckText's weekday, date and time (translated when replying in another language), never by working out a weekday from nextCheckTime. Read-only.";
|
|
25
|
+
readonly inputSchema: import('zod').ZodObject<{
|
|
26
|
+
workflowId: import('zod').ZodString;
|
|
27
|
+
}, import('zod/v4/core').$strip>;
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "listPulseNotifications";
|
|
30
|
+
readonly actionType: "list-notifications";
|
|
31
|
+
readonly description: "Lists recent fired Pulse notifications. Omit workflowId for an overview across all agentic workflows in one call: each notification already includes its workflow name, so never call this once per workflow after listPulses. Pass workflowId only when the user named one Pulse. Every check it returns belongs to the user's own data scope (the users who see the same rows under data security); users with different data security get their own checks and notifications from the same Pulse. Read-only.";
|
|
32
|
+
readonly inputSchema: import('zod').ZodObject<{
|
|
33
|
+
workflowId: import('zod').ZodOptional<import('zod').ZodString>;
|
|
34
|
+
}, import('zod/v4/core').$strip>;
|
|
35
|
+
}, {
|
|
36
|
+
readonly name: "listPulseEvals";
|
|
37
|
+
readonly actionType: "list-evals";
|
|
38
|
+
readonly description: "Lists one Pulse's evaluation history (fired or not, errored or not), newest first, each with its narrative, trigger ('build'/'schedule'/'onDemand'/'create') and per-query signals. This is the audit trail. If the answer already exists in a record (\"did it fire\", \"why did it fire\", \"what happened last night\"), read it here; evaluatePulse only runs a brand-new check, when the user explicitly asks for one. Every check it returns belongs to the user's own data scope (the users who see the same rows under data security); users with different data security get their own checks and notifications from the same Pulse. Read-only.";
|
|
39
|
+
readonly inputSchema: import('zod').ZodObject<{
|
|
40
|
+
limit: import('zod').ZodOptional<import('zod').ZodNumber>;
|
|
41
|
+
workflowId: import('zod').ZodString;
|
|
42
|
+
}, import('zod/v4/core').$strip>;
|
|
43
|
+
}, {
|
|
44
|
+
readonly name: "getPulseEval";
|
|
45
|
+
readonly actionType: "get-eval";
|
|
46
|
+
readonly description: "Reads one evaluation cycle in full, by its evalId (e.g. from listPulseEvals or a notification's evalId). Works for any retained cycle, not only the recent window listPulseEvals returns (quiet cycles are kept 90 days, fired ones two years). If the answer already exists in a record (\"did it fire\", \"why did it fire\", \"what happened last night\"), read it here; evaluatePulse only runs a brand-new check, when the user explicitly asks for one. Read-only.";
|
|
47
|
+
readonly inputSchema: import('zod').ZodObject<{
|
|
48
|
+
workflowId: import('zod').ZodString;
|
|
49
|
+
evalId: import('zod').ZodString;
|
|
50
|
+
}, import('zod/v4/core').$strip>;
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "getPulseEvalResults";
|
|
53
|
+
readonly actionType: "get-eval-results";
|
|
54
|
+
readonly description: "Reads the raw per-query rows and transform outputs behind one cycle (the columns and rows each query returned, capped at 20 rows per query, with the true row count). Call it only as a drill-down after getPulseEval or listPulseEvals, when the narrative and signals are not enough and a claim needs checking against the real data. Returns an empty list in three cases: the cycle failed or was skipped (status 'error'), so it ran no queries; the cycle aged out (quiet cycles are kept 90 days, fired ones two years); or the cycle belongs to another data scope (e.g. a notification sent under the user's earlier data security). A notification's cycle always fired, so for one under two years old an empty list means another scope: say that cycle isn't in the user's history, not that it aged out. Never imply nothing happened. Read-only.";
|
|
55
|
+
readonly inputSchema: import('zod').ZodObject<{
|
|
56
|
+
workflowId: import('zod').ZodString;
|
|
57
|
+
evalId: import('zod').ZodString;
|
|
58
|
+
}, import('zod/v4/core').$strip>;
|
|
59
|
+
}];
|
|
60
|
+
export type AtomicInspectPulseToolName = (typeof ATOMIC_INSPECT_PULSE_TOOLS)[number]['name'];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { InspectPulseContext, InspectPulseResult, inspectPulseSchema } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Standalone inspect Pulse workflow engine - completely decoupled from any UI or store.
|
|
5
|
+
* Read-only: never evaluates, creates, or changes a workflow.
|
|
6
|
+
*/
|
|
7
|
+
export declare function inspectPulseEngine(params: z.infer<typeof inspectPulseSchema>, context: InspectPulseContext): Promise<InspectPulseResult>;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AgenticEvalQueryRecord, AgenticEvalRecord, AgenticEvalResultRecord, PulseAlertDto, PulseEventDto, PulseReadClient } from '../../services/pulse/pulse-events-service';
|
|
3
|
+
import { PulseAlertCronScheduler, PulseAlertIntervalScheduler } from '../../services/pulse/pulse-alerts-service';
|
|
4
|
+
import { AgenticQueryDefinition, StagedQuerySummary } from '../author-pulse/types';
|
|
5
|
+
import { VisiblePulseAlertAction } from '../author-pulse/shared/notification-urls';
|
|
6
|
+
import { PulseToolWords } from '../pulse-tool-words';
|
|
7
|
+
/**
|
|
8
|
+
* `PulseAlertDto` with `context.queries[]` translated to agent-safe `StagedQuerySummary`s — no
|
|
9
|
+
* raw `jaql`, no raw `csdkJSON` envelope. `getAlertById`/`getActiveAlerts` return the real
|
|
10
|
+
* `PulseAlertDto` (full `AgenticQuery[]`, including `jaql`); `list-workflows`/`get-workflow` translate
|
|
11
|
+
* through this shape before it ever reaches a caller — see `toVisibleWorkflow` in the engine.
|
|
12
|
+
*/
|
|
13
|
+
export type VisibleAgenticWorkflowDto = Omit<PulseAlertDto, 'context' | 'action'> & {
|
|
14
|
+
/** Without webhook URLs (SNS-136699) — see `redactNotificationUrls`. */
|
|
15
|
+
action?: VisiblePulseAlertAction;
|
|
16
|
+
context?: Omit<NonNullable<PulseAlertDto['context']>, 'queries'> & {
|
|
17
|
+
queries?: StagedQuerySummary[];
|
|
18
|
+
};
|
|
19
|
+
/** See {@link AgenticWorkflowListItem.isOwner}. */
|
|
20
|
+
isOwner?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* See {@link AgenticWorkflowListItem.receiveNotifications}. vnext only computes it on the list
|
|
23
|
+
* endpoint, so `get-workflow` derives it from `disabledUsers` and the caller's id.
|
|
24
|
+
*/
|
|
25
|
+
receiveNotifications?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* vnext's `nextCheckTime` spelled out in English — weekday, date, 24h time and zone (the
|
|
28
|
+
* schedule's for a calendar schedule, `InspectPulseContext.defaultTimeZone` for an interval).
|
|
29
|
+
* Given only the ISO instant, the model names the wrong weekday (SNS-134939).
|
|
30
|
+
*/
|
|
31
|
+
nextCheckText?: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* One `list-workflows` row — just what the model needs to name, count and route a workflow, not
|
|
35
|
+
* the full document (~1.8 KB each, which made a 60-workflow listing too big to count reliably).
|
|
36
|
+
* `get-workflow` still returns the full definition.
|
|
37
|
+
*/
|
|
38
|
+
export interface AgenticWorkflowListItem {
|
|
39
|
+
_id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
message?: string;
|
|
42
|
+
/** false = paused: it doesn't evaluate for anyone. Only the owner can change it. */
|
|
43
|
+
enabled: boolean;
|
|
44
|
+
/** Whether the calling user gets this workflow's notifications (false = they muted it for themselves). */
|
|
45
|
+
receiveNotifications?: boolean;
|
|
46
|
+
/** Whether the calling user owns it — only the owner can edit it. Absent when the host didn't supply the caller's id. */
|
|
47
|
+
isOwner?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Check cadence for a live-source workflow — an interval (`periodMode` + `periodValue`) or a
|
|
50
|
+
* calendar schedule (`periodMode: 'cron'` + `cron` + `timeZone`); absent for a cube-triggered
|
|
51
|
+
* one, which runs on every build.
|
|
52
|
+
*/
|
|
53
|
+
frequency?: Pick<PulseAlertIntervalScheduler, 'periodMode' | 'periodValue'> | Pick<PulseAlertCronScheduler, 'periodMode' | 'cron' | 'timeZone'>;
|
|
54
|
+
context?: Pick<NonNullable<PulseAlertDto['context']>, 'evalMode' | 'lastEvaluatedAt' | 'lastEvalFired' | 'lastEvalStatus'>;
|
|
55
|
+
}
|
|
56
|
+
/** Counts for a `list-workflows` result, computed in the engine so the model quotes them instead of counting rows. */
|
|
57
|
+
export interface AgenticWorkflowCounts {
|
|
58
|
+
/** Rows in `workflows`. */
|
|
59
|
+
returned: number;
|
|
60
|
+
enabled: number;
|
|
61
|
+
disabled: number;
|
|
62
|
+
/** Disabled (paused) workflows left out because `includeDisabled` wasn't set — present only on such calls. */
|
|
63
|
+
hiddenDisabled?: number;
|
|
64
|
+
}
|
|
65
|
+
/** Per-query rows are capped in the engine (not the renderer) so the model and the UI see the same truncated shape — a cycle can hold N queries × up to several hundred rows each (ai-integration's own persisted-row cap, independent of this client-side one), and most callers only need `get-eval`'s narrative + summary. */
|
|
66
|
+
export declare const MAX_EVAL_RESULT_ROWS_PER_QUERY = 20;
|
|
67
|
+
/** One `get-eval-results` row: `AgenticEvalResultRecord` with `result.rows` capped at `MAX_EVAL_RESULT_ROWS_PER_QUERY` and the true `rowCount` carried alongside, so the model can say "showing 20 of 87" instead of silently implying it saw everything. */
|
|
68
|
+
export interface TruncatedAgenticEvalResultRecord extends AgenticEvalResultRecord {
|
|
69
|
+
rowCount: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* One `AgenticEvalRecord.queries[]` entry with `result.rows` stripped and a `rowCount` carried
|
|
73
|
+
* alongside instead — `list-evals`/`get-eval` return records shaped like this rather than the raw
|
|
74
|
+
* `AgenticEvalRecord`, so a busy workflow's audit-trail read doesn't flood the model with every raw
|
|
75
|
+
* row every query returned that cycle (up to ai-integration's persisted-row cap, PER query, PER
|
|
76
|
+
* cycle). The real rows are still reachable via `get-eval-results`, capped separately at
|
|
77
|
+
* `MAX_EVAL_RESULT_ROWS_PER_QUERY`.
|
|
78
|
+
*/
|
|
79
|
+
export interface SummarizedAgenticEvalQuery extends Omit<AgenticEvalQueryRecord, 'result'> {
|
|
80
|
+
rowCount: number;
|
|
81
|
+
}
|
|
82
|
+
/** `AgenticEvalRecord` with `queries[]` replaced by `SummarizedAgenticEvalQuery[]` — see that type's own doc. */
|
|
83
|
+
export interface SummarizedAgenticEvalRecord extends Omit<AgenticEvalRecord, 'queries'> {
|
|
84
|
+
queries: SummarizedAgenticEvalQuery[];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Canonical tool description for inspectPulse — reusable by any host (sdk-assistant, MCP server, custom integrations).
|
|
88
|
+
* Hosts may append host-specific notes but should not duplicate or contradict this text.
|
|
89
|
+
*/
|
|
90
|
+
export declare const inspectPulseToolDescription = "Reads Sisense Pulse `agentic` workflows (a governed query + transformation + condition package) and everything already recorded about them \u2014 the workflow's own definition, its fired notifications, and its full evaluation audit trail (every check that ran, whether it fired, why, and the per-query signals behind it) \u2014 via a required structured `action` param. Read-only: this tool never evaluates, creates, or changes anything. Every check and last-evaluated status it returns belongs to the user's own data scope (the users who see the same rows under data security); users with different data security get their own checks and notifications from the same workflow. A notification sent under the user's earlier data security, or before per-scope evaluation on a model with data security, may point at a cycle outside the user's history. Scoped to `agentic` workflows only \u2014 classic KPI/build/upgrade workflows are a different product surface and are filtered out. Alerting/notification is an optional layer a workflow can carry, not what defines it.\n\nROUTING \u2014 read this before choosing between this tool and evaluatePulse: if the answer already exists in a record, use THIS tool. \"did it fire\", \"check if it fired\", \"any events\", \"any notifications\", \"what happened last night\", \"why did it fire\", \"has this ever fired\" are all INSPECT questions. evaluatePulse only runs a BRAND-NEW check right now \u2014 call it only when the user explicitly asks for a fresh check, never to answer a question about a cycle that already ran (e.g. right after a build or schedule already triggered one).\n\nCall loadSkill('inspectPulse') before the first call in a conversation \u2014 it has the full question-to-action table and guidance on citing recorded data instead of estimating it.\n\naction.type values:\n- \"list-workflows\": list the agentic workflows the user can see (their own and ones shared with them), one compact row each: enabled (false = paused), receiveNotifications (false = the user muted it), isOwner (only the owner can edit). Optional searchByName filters by name. Only returns enabled workflows unless includeDisabled is set \u2014 pass includeDisabled: true when looking for a paused workflow (e.g. to resume it). ALWAYS quote counts from the result's counts field, never count rows yourself; when counts.hiddenDisabled > 0, say those paused workflows exist.\n- \"get-workflow\": one workflow's full definition \u2014 queries, skill, decisionSpec, frequency, nextCheckTime (when it's next checked; absent when paused, cube-triggered or live alerting is off) with nextCheckText \u2014 state the next check from nextCheckText's weekday, date and time (translated when replying in another language), never by working out a weekday from nextCheckTime \u2014 evalMode, and its last-evaluated status (lastEvaluatedAt/lastEvalFired/lastEvalNarrative, set after every cycle in the user's data scope; lastEvalStatus 'error' means that check failed or didn't run, and it then has no narrative). Requires workflowId.\n- \"list-notifications\": recent fired notifications. Omit workflowId for an overview across all agentic workflows in one call \u2014 each notification already includes its expanded workflow name; do NOT call this once per workflow after list-workflows. Optional workflowId scopes to one workflow only when the user named it.\n- \"list-evals\": one workflow's full evaluation history (fired or not, errored or not), newest first, each with narrative, trigger ('build'/'schedule'/'onDemand'/'create'), and per-query signals. Requires workflowId. This is the audit trail \u2014 read it instead of running a new evaluation to answer a past-tense question.\n- \"get-eval\": one specific evaluation cycle in full, by its evalId (e.g. from a prior list-evals result or a notification's evalId). Requires workflowId and evalId. Works for any retained cycle, not just the recent window list-evals returns (quiet cycles are kept 90 days, fired ones two years).\n- \"get-eval-results\": the raw per-query rows and transform outputs behind one cycle (columns/rows actually returned by each query, capped at 20 rows per query with the true row count included). Requires workflowId and evalId. Call this ONLY as a drill-down AFTER get-eval or list-evals, when the narrative/signals summary isn't enough and a claim needs to be verified against the real data \u2014 most \"why did it fire?\" questions are already answered by get-eval alone. Returns an empty list in three cases: the cycle failed or was skipped (status 'error'), so it ran no queries; the cycle aged out (quiet cycles are kept 90 days, fired ones two years); or the cycle belongs to another data scope (e.g. a notification sent under the user's earlier data security). A notification's cycle always fired, so for one under two years old an empty list means another scope: say that cycle isn't in the user's history, not that it aged out. Never imply nothing happened.\n\nPairing: for an overview (\"show workflows and their notifications\"), call list-workflows at most once and list-notifications at most once with no workflowId \u2014 never loop list-notifications per workflow id.";
|
|
91
|
+
/**
|
|
92
|
+
* The `inspectPulse` action variants, with field descriptions in `w`'s words: the composite union
|
|
93
|
+
* below uses the action names, the atomic tools (`atomic-tools.ts`) the tool names.
|
|
94
|
+
*/
|
|
95
|
+
export declare const inspectPulseActionVariants: (w: PulseToolWords) => readonly [z.ZodObject<{
|
|
96
|
+
type: z.ZodLiteral<"list-workflows">;
|
|
97
|
+
searchByName: z.ZodOptional<z.ZodString>;
|
|
98
|
+
includeDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
99
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
100
|
+
type: z.ZodLiteral<"get-workflow">;
|
|
101
|
+
workflowId: z.ZodString;
|
|
102
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
103
|
+
type: z.ZodLiteral<"list-notifications">;
|
|
104
|
+
workflowId: z.ZodOptional<z.ZodString>;
|
|
105
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
106
|
+
type: z.ZodLiteral<"list-evals">;
|
|
107
|
+
workflowId: z.ZodString;
|
|
108
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
110
|
+
type: z.ZodLiteral<"get-eval">;
|
|
111
|
+
workflowId: z.ZodString;
|
|
112
|
+
evalId: z.ZodString;
|
|
113
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
114
|
+
type: z.ZodLiteral<"get-eval-results">;
|
|
115
|
+
workflowId: z.ZodString;
|
|
116
|
+
evalId: z.ZodString;
|
|
117
|
+
}, z.core.$strip>];
|
|
118
|
+
/** JSON-Schema-safe union — validated again at execution time in the engine. */
|
|
119
|
+
export declare const inspectPulseActionSchema: z.ZodDiscriminatedUnion<readonly [z.ZodObject<{
|
|
120
|
+
type: z.ZodLiteral<"list-workflows">;
|
|
121
|
+
searchByName: z.ZodOptional<z.ZodString>;
|
|
122
|
+
includeDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
123
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
124
|
+
type: z.ZodLiteral<"get-workflow">;
|
|
125
|
+
workflowId: z.ZodString;
|
|
126
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
127
|
+
type: z.ZodLiteral<"list-notifications">;
|
|
128
|
+
workflowId: z.ZodOptional<z.ZodString>;
|
|
129
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
130
|
+
type: z.ZodLiteral<"list-evals">;
|
|
131
|
+
workflowId: z.ZodString;
|
|
132
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
134
|
+
type: z.ZodLiteral<"get-eval">;
|
|
135
|
+
workflowId: z.ZodString;
|
|
136
|
+
evalId: z.ZodString;
|
|
137
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
138
|
+
type: z.ZodLiteral<"get-eval-results">;
|
|
139
|
+
workflowId: z.ZodString;
|
|
140
|
+
evalId: z.ZodString;
|
|
141
|
+
}, z.core.$strip>], "type">;
|
|
142
|
+
export type InspectPulseAction = z.infer<typeof inspectPulseActionSchema>;
|
|
143
|
+
export declare const inspectPulseSchema: z.ZodObject<{
|
|
144
|
+
action: z.ZodDiscriminatedUnion<readonly [z.ZodObject<{
|
|
145
|
+
type: z.ZodLiteral<"list-workflows">;
|
|
146
|
+
searchByName: z.ZodOptional<z.ZodString>;
|
|
147
|
+
includeDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
148
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
149
|
+
type: z.ZodLiteral<"get-workflow">;
|
|
150
|
+
workflowId: z.ZodString;
|
|
151
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
152
|
+
type: z.ZodLiteral<"list-notifications">;
|
|
153
|
+
workflowId: z.ZodOptional<z.ZodString>;
|
|
154
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
155
|
+
type: z.ZodLiteral<"list-evals">;
|
|
156
|
+
workflowId: z.ZodString;
|
|
157
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
159
|
+
type: z.ZodLiteral<"get-eval">;
|
|
160
|
+
workflowId: z.ZodString;
|
|
161
|
+
evalId: z.ZodString;
|
|
162
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
163
|
+
type: z.ZodLiteral<"get-eval-results">;
|
|
164
|
+
workflowId: z.ZodString;
|
|
165
|
+
evalId: z.ZodString;
|
|
166
|
+
}, z.core.$strip>], "type">;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
/**
|
|
169
|
+
* Inspect Pulse workflow context interface
|
|
170
|
+
*/
|
|
171
|
+
export interface InspectPulseContext {
|
|
172
|
+
/**
|
|
173
|
+
* Tool call ID
|
|
174
|
+
*/
|
|
175
|
+
toolCallId: string;
|
|
176
|
+
httpClient?: PulseReadClient;
|
|
177
|
+
/** The calling user's id, when the host knows it — drives `isOwner`. */
|
|
178
|
+
currentUserId?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Fires on `get-workflow` with the live definition of each query that could be rebuilt from its
|
|
181
|
+
* stored `csdkJSON` (real CSDK class instances), so a host can show it as `QueryDefinition`
|
|
182
|
+
* pills. Never part of the result the model sees, and nothing here executes a query.
|
|
183
|
+
*/
|
|
184
|
+
onQueryDefinitions?: (definitions: AgenticQueryDefinition[]) => void;
|
|
185
|
+
/** User's IANA time zone — `nextCheckText` for an interval schedule (which has none of its own) is written in it; UTC when absent. */
|
|
186
|
+
defaultTimeZone?: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Result from inspectPulseEngine — exactly one field is populated,
|
|
190
|
+
* matching which action.type was executed.
|
|
191
|
+
*/
|
|
192
|
+
export interface InspectPulseResult {
|
|
193
|
+
workflows?: AgenticWorkflowListItem[];
|
|
194
|
+
/** Populated alongside `workflows`. */
|
|
195
|
+
counts?: AgenticWorkflowCounts;
|
|
196
|
+
workflow?: VisibleAgenticWorkflowDto;
|
|
197
|
+
notifications?: PulseEventDto[];
|
|
198
|
+
evals?: SummarizedAgenticEvalRecord[];
|
|
199
|
+
eval?: SummarizedAgenticEvalRecord;
|
|
200
|
+
evalResults?: TruncatedAgenticEvalResultRecord[];
|
|
201
|
+
/**
|
|
202
|
+
* The workflow `evals`/`eval`/`evalResults` belongs to — populated on `list-evals`/`get-eval`/
|
|
203
|
+
* `get-eval-results` so the UI can label which workflow's history it's showing (multiple
|
|
204
|
+
* workflows' histories can appear in the same conversation with no other visual distinction
|
|
205
|
+
* otherwise). Free — `assertAgenticWorkflow` already fetches the full workflow doc to validate
|
|
206
|
+
* `workflowId`.
|
|
207
|
+
*/
|
|
208
|
+
workflowName?: string;
|
|
209
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from 'zod
|
|
1
|
+
import { z } from 'zod';
|
|
2
2
|
import { listDataModelsParamsSchema, getModelSchemaParamsSchema, addRelationParamsSchema, removeRelationParamsSchema, createPerspectiveParamsSchema, updatePerspectiveParamsSchema, getPerspectiveParamsSchema, triggerBuildParamsSchema, listPerspectivesParamsSchema, ListDataModelsResult, ModelSchemaResult, AddRelationResult, RemoveRelationResult, CreatePerspectiveResult, UpdatePerspectiveResult, GetPerspectiveResult, TriggerBuildResult, ListPerspectivesResult, PerspectiveEngineContext } from './types';
|
|
3
3
|
export declare function listDataModelsEngine(_params: z.infer<typeof listDataModelsParamsSchema>, context: PerspectiveEngineContext): Promise<ListDataModelsResult>;
|
|
4
4
|
export declare function getModelSchemaEngine(params: z.infer<typeof getModelSchemaParamsSchema>, context: PerspectiveEngineContext): Promise<ModelSchemaResult>;
|
|
@@ -6,6 +6,10 @@ export declare function addRelationEngine(params: z.infer<typeof addRelationPara
|
|
|
6
6
|
export declare function removeRelationEngine(params: z.infer<typeof removeRelationParamsSchema>, context: PerspectiveEngineContext): Promise<RemoveRelationResult>;
|
|
7
7
|
export declare function createPerspectiveEngine(params: z.infer<typeof createPerspectiveParamsSchema>, context: PerspectiveEngineContext): Promise<CreatePerspectiveResult>;
|
|
8
8
|
export declare function updatePerspectiveEngine(params: z.infer<typeof updatePerspectiveParamsSchema>, context: PerspectiveEngineContext): Promise<UpdatePerspectiveResult>;
|
|
9
|
+
/** The oid is not a perspective (the server answered 404 or 400), as opposed to a refused or failed read. */
|
|
10
|
+
export declare class PerspectiveNotFoundError extends Error {
|
|
11
|
+
constructor(perspectiveOid: string);
|
|
12
|
+
}
|
|
9
13
|
export declare function getPerspectiveEngine(params: z.infer<typeof getPerspectiveParamsSchema>, context: PerspectiveEngineContext): Promise<GetPerspectiveResult>;
|
|
10
14
|
export declare function listPerspectivesEngine(params: z.infer<typeof listPerspectivesParamsSchema>, context: PerspectiveEngineContext): Promise<ListPerspectivesResult>;
|
|
11
15
|
export declare function triggerBuildEngine(params: z.infer<typeof triggerBuildParamsSchema>, context: PerspectiveEngineContext): Promise<TriggerBuildResult>;
|