@sisense/sdk-ai-core 0.9.0 → 0.10.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/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/engines/build-chart/build-chart-engine.d.ts +3 -4
- package/dist/engines/build-chart/build-chart-engine.d.ts.map +1 -1
- package/dist/engines/build-chart/build-chart-service.d.ts +3 -3
- package/dist/engines/build-chart/build-chart-service.d.ts.map +1 -1
- package/dist/engines/build-chart/create-chart/create-chart.d.ts +8 -4
- package/dist/engines/build-chart/create-chart/create-chart.d.ts.map +1 -1
- package/dist/engines/build-chart/create-chart/generate-chart-table.d.ts +21 -2
- package/dist/engines/build-chart/create-chart/generate-chart-table.d.ts.map +1 -1
- package/dist/engines/build-chart/dataset-from-saved-chart-widget.d.ts +11 -0
- package/dist/engines/build-chart/dataset-from-saved-chart-widget.d.ts.map +1 -0
- package/dist/engines/build-chart/types.d.ts +55 -39
- package/dist/engines/build-chart/types.d.ts.map +1 -1
- package/dist/engines/build-chart/update-chart/apply-prior-chart-style.d.ts +10 -0
- package/dist/engines/build-chart/update-chart/apply-prior-chart-style.d.ts.map +1 -0
- package/dist/engines/build-chart/update-chart/chart-options-schemas.d.ts +2609 -890
- package/dist/engines/build-chart/update-chart/chart-options-schemas.d.ts.map +1 -1
- package/dist/engines/build-chart/update-chart/schemas.d.ts +9 -9
- package/dist/engines/build-chart/update-chart/update-chart-data-options.d.ts.map +1 -1
- package/dist/engines/build-chart/update-chart/update-chart-query.d.ts +8 -0
- package/dist/engines/build-chart/update-chart/update-chart-query.d.ts.map +1 -0
- package/dist/engines/build-chart/update-chart/update-chart-style-options.d.ts.map +1 -1
- package/dist/engines/build-chart/update-chart/update-chart-title.d.ts.map +1 -1
- package/dist/engines/build-chart/update-chart/update-chart-type.d.ts.map +1 -1
- package/dist/engines/build-csv-model/build-csv-model-engine.d.ts.map +1 -1
- package/dist/engines/build-csv-model/rest-build.d.ts.map +1 -1
- package/dist/engines/build-csv-model/types.d.ts +10 -0
- package/dist/engines/build-csv-model/types.d.ts.map +1 -1
- package/dist/engines/build-dashboard/add-dashboard-filters.d.ts.map +1 -1
- package/dist/engines/build-dashboard/add-dashboard-widgets.d.ts.map +1 -1
- package/dist/engines/build-dashboard/build-dashboard-engine.d.ts +2 -5
- package/dist/engines/build-dashboard/build-dashboard-engine.d.ts.map +1 -1
- package/dist/engines/build-dashboard/build-dashboard-service.d.ts.map +1 -1
- package/dist/engines/build-dashboard/create-chart-widget.d.ts.map +1 -1
- package/dist/engines/build-dashboard/create-dashboard.d.ts.map +1 -1
- package/dist/engines/build-dashboard/load-existing-fusion-dashboard.d.ts.map +1 -1
- package/dist/engines/build-dashboard/types.d.ts +34 -6
- package/dist/engines/build-dashboard/types.d.ts.map +1 -1
- package/dist/engines/build-dashboard/update-chart-widget.d.ts.map +1 -1
- package/dist/engines/build-dashboard/update-dashboard.d.ts.map +1 -1
- package/dist/engines/build-data-model/build-data-model-engine.d.ts.map +1 -1
- package/dist/engines/build-query/build-query-engine.d.ts.map +1 -1
- package/dist/engines/build-query/types.d.ts +28 -9
- package/dist/engines/build-query/types.d.ts.map +1 -1
- package/dist/engines/get-dashboards/get-dashboards-engine.d.ts.map +1 -1
- package/dist/engines/get-dashboards/types.d.ts +5 -0
- package/dist/engines/get-dashboards/types.d.ts.map +1 -1
- package/dist/engines/get-data-source-fields/get-data-source-fields-engine.d.ts.map +1 -1
- package/dist/engines/get-data-source-fields/types.d.ts +5 -0
- package/dist/engines/get-data-source-fields/types.d.ts.map +1 -1
- package/dist/engines/get-data-sources/get-data-sources-engine.d.ts.map +1 -1
- package/dist/engines/get-data-sources/types.d.ts +5 -0
- package/dist/engines/get-data-sources/types.d.ts.map +1 -1
- package/dist/engines/manage-perspectives/manage-perspectives-engine.d.ts.map +1 -1
- package/dist/engines/manage-perspectives/types.d.ts +37 -0
- package/dist/engines/manage-perspectives/types.d.ts.map +1 -1
- package/dist/engines/recommend-queries/recommend-queries-engine.d.ts.map +1 -1
- package/dist/engines/recommend-queries/types.d.ts +5 -0
- package/dist/engines/recommend-queries/types.d.ts.map +1 -1
- package/dist/engines/shared/get-filters-json-for-llm-summary.d.ts +12 -0
- package/dist/engines/shared/get-filters-json-for-llm-summary.d.ts.map +1 -0
- package/dist/engines/shared/nlq-query-helpers.d.ts +13 -3
- package/dist/engines/shared/nlq-query-helpers.d.ts.map +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4878 -3898
- package/dist/index.js.map +1 -1
- package/dist/services/llm/llm-consumption-service.d.ts.map +1 -1
- package/dist/services/nlq/nlq-service.d.ts +33 -3
- package/dist/services/nlq/nlq-service.d.ts.map +1 -1
- package/dist/utils/dev-debug.d.ts +8 -0
- package/dist/utils/dev-debug.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export declare const TOOL_NAME_TRIGGER_BUILD = "triggerBuild";
|
|
|
17
17
|
export declare const TOOL_NAME_LIST_PERSPECTIVES = "listPerspectives";
|
|
18
18
|
export declare const TOOL_NAME_UPLOAD_FILES = "uploadFiles";
|
|
19
19
|
export declare const TOOL_NAME_BUILD_CSV_MODEL = "buildDataModelFromUploads";
|
|
20
|
+
/** Debug label for `engineCall` traces (e.g. `buildChart` → `buildChartEngine`). */
|
|
21
|
+
export declare const toEngineName: (toolName: string) => string;
|
|
20
22
|
export declare const TOOL_CONTEXT_MAX_ASSETS = 10;
|
|
21
23
|
export declare const MAX_DATA_SOURCE_FIELDS_SUMMARY = 200;
|
|
22
24
|
export declare const MAX_DATA_SOURCE_FORMULAS_SUMMARY = 50;
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAClD,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eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AACpD,eAAO,MAAM,yBAAyB,mBAAmB,CAAC;AAC1D,eAAO,MAAM,4BAA4B,sBAAsB,CAAC;AAChE,eAAO,MAAM,4BAA4B,sBAAsB,CAAC;AAChE,eAAO,MAAM,yBAAyB,mBAAmB,CAAC;AAC1D,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AACtD,eAAO,MAAM,2BAA2B,qBAAqB,CAAC;AAC9D,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AACpD,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AAErE,oFAAoF;AACpF,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,WAAwB,CAAC;AAGtE,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAG1C,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAGlD,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAGnD,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAG7C,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AACxD,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAChD,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AACxD,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AACpD,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C,eAAO,MAAM,eAAe,UAM3B,CAAC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { ChartSummary, BuildChartContext, buildChartSchema,
|
|
2
|
-
import { QuerySummary } from '../build-query/types';
|
|
1
|
+
import { ChartSummary, BuildChartContext, buildChartSchema, ChartContextPromptEntry } from './types';
|
|
3
2
|
import { default as z } from 'zod';
|
|
4
3
|
/**
|
|
5
4
|
* Build contextual system prompt for build chart
|
|
6
5
|
*/
|
|
7
|
-
export declare function buildContextualSystemPrompt(
|
|
6
|
+
export declare function buildContextualSystemPrompt(chartsForContext: ChartContextPromptEntry[], priorChartId?: string, outerQueryId?: string): string;
|
|
8
7
|
/**
|
|
9
8
|
* Standalone build chart engine - completely decoupled from any UI or store
|
|
10
9
|
* @param params - The parameters for the build chart
|
|
11
10
|
* @param context - All external dependencies injected
|
|
12
11
|
* @returns The chart summary
|
|
13
12
|
*/
|
|
14
|
-
export declare function buildChartEngine(params: z.infer<typeof buildChartSchema
|
|
13
|
+
export declare function buildChartEngine(params: z.infer<typeof buildChartSchema>, context: BuildChartContext): Promise<ChartSummary>;
|
|
15
14
|
//# sourceMappingURL=build-chart-engine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-chart-engine.d.ts","sourceRoot":"","sources":["../../../src/engines/build-chart/build-chart-engine.ts"],"names":[],"mappings":"AACA,OAAO,EACN,YAAY,
|
|
1
|
+
{"version":3,"file":"build-chart-engine.d.ts","sourceRoot":"","sources":["../../../src/engines/build-chart/build-chart-engine.ts"],"names":[],"mappings":"AACA,OAAO,EACN,YAAY,EAWZ,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,MAAM,SAAS,CAAC;AAwBjB,OAAO,CAAC,MAAM,KAAK,CAAC;AAyIpB;;GAEG;AACH,wBAAgB,2BAA2B,CAC1C,gBAAgB,EAAE,uBAAuB,EAAE,EAC3C,YAAY,CAAC,EAAE,MAAM,EACrB,YAAY,CAAC,EAAE,MAAM,UA8DrB;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,EACxC,OAAO,EAAE,iBAAiB,GACxB,OAAO,CAAC,YAAY,CAAC,CAwHvB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExtendedChartWidgetProps, BaseChartSummary } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Returns the CSDK chart configuration ({@link BaseChartSummary}) for LLM consumption.
|
|
4
|
+
* Returns `undefined` when `chartState` has not yet been computed (e.g. unsupported chart type).
|
|
5
5
|
*/
|
|
6
|
-
export declare const getBaseChartSummary: (widgetProps: ExtendedChartWidgetProps
|
|
6
|
+
export declare const getBaseChartSummary: (widgetProps: ExtendedChartWidgetProps) => BaseChartSummary | undefined;
|
|
7
7
|
//# sourceMappingURL=build-chart-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-chart-service.d.ts","sourceRoot":"","sources":["../../../src/engines/build-chart/build-chart-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC/B,aAAa,wBAAwB,
|
|
1
|
+
{"version":3,"file":"build-chart-service.d.ts","sourceRoot":"","sources":["../../../src/engines/build-chart/build-chart-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC/B,aAAa,wBAAwB,KACnC,gBAAgB,GAAG,SAGrB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuildChartContext, createChartSchema, ExtendedChartWidgetProps, NullableChartType } from '../types';
|
|
2
|
-
import {
|
|
2
|
+
import { QueryState } from '../../../services/nlq/nlq-service';
|
|
3
3
|
import { default as z } from 'zod';
|
|
4
4
|
type GenerateChartParams = {
|
|
5
5
|
dataSourceTitle: string;
|
|
@@ -7,15 +7,19 @@ type GenerateChartParams = {
|
|
|
7
7
|
chartPrompt: string;
|
|
8
8
|
chartType: NullableChartType;
|
|
9
9
|
chartTitle: string;
|
|
10
|
+
/** Skip data fetch — load this exact prior result verbatim when this id is passed (e.g. from a prior buildQuery call). Takes priority over priorQueryState. Requires NLQ V3. */
|
|
10
11
|
queryId?: string | null;
|
|
12
|
+
/** Fetch fresh data, but carry this state forward as incremental context (from updateChartQuery structural revision). Ignored when queryId is set. */
|
|
13
|
+
priorQueryState?: QueryState;
|
|
11
14
|
};
|
|
12
15
|
type GenerateChartOutput = {
|
|
13
16
|
widgetProps: ExtendedChartWidgetProps;
|
|
14
|
-
queryResult?: QueryResult;
|
|
15
17
|
};
|
|
16
|
-
export declare const generateChart: ({ dataSourceTitle, queryPrompt, chartPrompt, chartType, chartTitle, queryId, }: GenerateChartParams, context: BuildChartContext) => Promise<GenerateChartOutput>;
|
|
17
|
-
export declare const createChart: ({ queryPrompt, chartPrompt, chartType, chartTitle, queryId
|
|
18
|
+
export declare const generateChart: ({ dataSourceTitle, queryPrompt, chartPrompt, chartType, chartTitle, queryId, priorQueryState, }: GenerateChartParams, context: BuildChartContext) => Promise<GenerateChartOutput>;
|
|
19
|
+
export declare const createChart: ({ queryPrompt, chartPrompt, chartType, chartTitle, queryId, }: z.infer<typeof createChartSchema>, context: BuildChartContext) => Promise<{
|
|
18
20
|
message: string;
|
|
21
|
+
chartState: import('../../../services/nlq/nlq-service').ChartState;
|
|
22
|
+
dataset: import('../../../services/nlq/nlq-service').Dataset | undefined;
|
|
19
23
|
}>;
|
|
20
24
|
export {};
|
|
21
25
|
//# sourceMappingURL=create-chart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-chart.d.ts","sourceRoot":"","sources":["../../../../src/engines/build-chart/create-chart/create-chart.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-chart.d.ts","sourceRoot":"","sources":["../../../../src/engines/build-chart/create-chart/create-chart.ts"],"names":[],"mappings":"AAMA,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAS7D,OAAO,CAAC,MAAM,KAAK,CAAC;AAQpB,KAAK,mBAAmB,GAAG;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,gLAAgL;IAChL,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,sJAAsJ;IACtJ,eAAe,CAAC,EAAE,UAAU,CAAC;CAC7B,CAAC;AAEF,KAAK,mBAAmB,GAAG;IAC1B,WAAW,EAAE,wBAAwB,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,aAAa,GACzB,iGAQG,mBAAmB,EACtB,SAAS,iBAAiB,KACxB,OAAO,CAAC,mBAAmB,CAkE7B,CAAC;AAEF,eAAO,MAAM,WAAW,GACvB,+DAMG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,EACpC,SAAS,iBAAiB;;;;EA0C1B,CAAC"}
|
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
import { ExtendedChartWidgetProps } from '../types';
|
|
2
2
|
import { HttpClient } from '@sisense/sdk-rest-client';
|
|
3
|
+
import { QueryExecutionResult, QueryState } from '../../../services/nlq/nlq-service';
|
|
3
4
|
import { QueryResult } from '../../build-query/types';
|
|
5
|
+
/** Internal synthetic ids for chart-inline prior NLQ; never part of LLM-facing schemas. */
|
|
6
|
+
export declare const INLINE_PRIOR_NLQ_ID_PREFIX = "__inline_prior_nlq__:";
|
|
7
|
+
/**
|
|
8
|
+
* Minimal {@link QueryResult} for {@link buildQueryEngine}'s `retrieveQuery` —
|
|
9
|
+
* only `nlqResult.queryState` is read when resolving `priorQueryId`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function minimalQueryResultShimFromQueryState(queryState: QueryState, syntheticQueryId: string): QueryResult;
|
|
4
12
|
export type GenerateChartTableResult = {
|
|
5
13
|
widgetProps: ExtendedChartWidgetProps;
|
|
6
|
-
queryResult?: QueryResult;
|
|
7
14
|
};
|
|
8
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Build table-phase chart widget props from an NLQ execution result (translate query JSON → columns).
|
|
17
|
+
*/
|
|
18
|
+
export declare function tableWidgetPropsFromNlqExecution(nlqResult: QueryExecutionResult, chartTitle: string): ExtendedChartWidgetProps;
|
|
19
|
+
/**
|
|
20
|
+
* Load table-phase widget props from a stored build-query result (verbatim reuse; no NLQ round-trip).
|
|
21
|
+
*/
|
|
22
|
+
export declare function loadChartTableFromQueryId(queryId: string, retrieveQuery: (queryId: string) => QueryResult | null, fallbackTitle: string): Promise<GenerateChartTableResult>;
|
|
23
|
+
/**
|
|
24
|
+
* Run NLQ / build-query and materialize a table-phase chart widget (no verbatim `queryId` path).
|
|
25
|
+
* For verbatim reuse of a stored query, use {@link loadChartTableFromQueryId} from the caller.
|
|
26
|
+
*/
|
|
27
|
+
export declare const generateChartTable: (dataSourceTitle: string, queryPrompt: string, isNlqV3Enabled?: boolean, httpClient?: HttpClient, nlqCommonFilters?: unknown, priorQueryState?: QueryState, isNlqDeltaEnabled?: boolean, retrieveQuery?: (queryId: string) => QueryResult | null) => Promise<GenerateChartTableResult>;
|
|
9
28
|
//# sourceMappingURL=generate-chart-table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-chart-table.d.ts","sourceRoot":"","sources":["../../../../src/engines/build-chart/create-chart/generate-chart-table.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"generate-chart-table.d.ts","sourceRoot":"","sources":["../../../../src/engines/build-chart/create-chart/generate-chart-table.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAOpD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,EAEN,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,2FAA2F;AAC3F,eAAO,MAAM,0BAA0B,0BAA0B,CAAC;AAElE;;;GAGG;AACH,wBAAgB,oCAAoC,CACnD,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,MAAM,GACtB,WAAW,CAUb;AAED,MAAM,MAAM,wBAAwB,GAAG;IACtC,WAAW,EAAE,wBAAwB,CAAC;CACtC,CAAC;AAEF;;GAEG;AACH,wBAAgB,gCAAgC,CAC/C,SAAS,EAAE,oBAAoB,EAC/B,UAAU,EAAE,MAAM,GAChB,wBAAwB,CAoC1B;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC9C,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,WAAW,GAAG,IAAI,EACtD,aAAa,EAAE,MAAM,GACnB,OAAO,CAAC,wBAAwB,CAAC,CAYnC;AA8GD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC9B,iBAAiB,MAAM,EACvB,aAAa,MAAM,EACnB,iBAAiB,OAAO,EACxB,aAAa,UAAU,EACvB,mBAAmB,OAAO,EAC1B,kBAAkB,UAAU,EAC5B,oBAAoB,OAAO,EAC3B,gBAAgB,CAAC,OAAO,EAAE,MAAM,KAAK,WAAW,GAAG,IAAI,KACrD,OAAO,CAAC,wBAAwB,CA+BlC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Dataset, QueryState } from '../../services/nlq/nlq-service';
|
|
2
|
+
import { ExtendedChartWidgetProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* These helpers accept `savedChartWidgetProps` as an explicit parameter so TypeScript
|
|
5
|
+
* does not infer `never` on the mutable closure-captured variable inside buildChartEngine.
|
|
6
|
+
* See https://github.com/microsoft/TypeScript/issues — TS 5.x sequentially narrows
|
|
7
|
+
* closed-over `let` variables inside object literals after a ternary branch.
|
|
8
|
+
*/
|
|
9
|
+
export declare function datasetFromSavedChartWidget(naturalResponseEnabled: boolean | undefined, props: ExtendedChartWidgetProps | null): Dataset | undefined;
|
|
10
|
+
export declare function queryStateFromSavedChartWidget(props: ExtendedChartWidgetProps | null): QueryState | undefined;
|
|
11
|
+
//# sourceMappingURL=dataset-from-saved-chart-widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataset-from-saved-chart-widget.d.ts","sourceRoot":"","sources":["../../../src/engines/build-chart/dataset-from-saved-chart-widget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAExD;;;;;GAKG;AAEH,wBAAgB,2BAA2B,CAC1C,sBAAsB,EAAE,OAAO,GAAG,SAAS,EAC3C,KAAK,EAAE,wBAAwB,GAAG,IAAI,GACpC,OAAO,GAAG,SAAS,CASrB;AAED,wBAAgB,8BAA8B,CAC7C,KAAK,EAAE,wBAAwB,GAAG,IAAI,GACpC,UAAU,GAAG,SAAS,CAExB"}
|
|
@@ -3,8 +3,8 @@ import { ChartType, ChartWidgetProps, StyledColumn, StyledMeasureColumn, WithCom
|
|
|
3
3
|
import { HttpClient } from '@sisense/sdk-rest-client';
|
|
4
4
|
import { default as OpenAI } from 'openai';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import { QueryResult
|
|
7
|
-
import { Dataset } from '../../services/nlq/nlq-service';
|
|
6
|
+
import { QueryResult } from '../build-query/types';
|
|
7
|
+
import { ChartState, Dataset, QueryState } from '../../services/nlq/nlq-service';
|
|
8
8
|
export type ArtifactReference = {
|
|
9
9
|
artifactId?: string;
|
|
10
10
|
};
|
|
@@ -13,25 +13,19 @@ export type ExtendedChartWidgetProps = WithCommonWidgetProps<ChartWidgetProps, '
|
|
|
13
13
|
* data columns used to generate chart recommendations
|
|
14
14
|
*/
|
|
15
15
|
dataColumns?: ColumnType[];
|
|
16
|
+
/** Query state used to generate this chart — needed to revise query structure incrementally */
|
|
17
|
+
queryState?: QueryState;
|
|
18
|
+
/** Sample / tabular payload from NLQ when available (same source as standalone buildQuery). */
|
|
19
|
+
dataset?: Dataset;
|
|
20
|
+
/** Optional CSDK chart JSON when a caller persists it alongside NLQ state (distinct from REST `chartState` / {@link QueryState}). */
|
|
21
|
+
chartState?: ChartState;
|
|
16
22
|
};
|
|
17
23
|
export type NullableChartType = ChartType | null | undefined;
|
|
18
24
|
/**
|
|
19
|
-
*
|
|
25
|
+
* Compact CSDK chart configuration for LLM consumption.
|
|
26
|
+
* Alias for {@link ChartState} — the serialized form produced by `translateChartToJSON`.
|
|
20
27
|
*/
|
|
21
|
-
export type BaseChartSummary =
|
|
22
|
-
/** Human-readable title of the chart */
|
|
23
|
-
title?: string;
|
|
24
|
-
/** Name of the data source used for the chart */
|
|
25
|
-
dataSourceTitle: string;
|
|
26
|
-
/** Type of chart (line, bar, pie, etc.) */
|
|
27
|
-
chartType?: ChartType;
|
|
28
|
-
/** Summary of applied filters */
|
|
29
|
-
filters: string;
|
|
30
|
-
/** Summary of data configuration options */
|
|
31
|
-
dataOptions: string;
|
|
32
|
-
/** Summary of styling and visual options */
|
|
33
|
-
styleOptions: string;
|
|
34
|
-
};
|
|
28
|
+
export type BaseChartSummary = ChartState;
|
|
35
29
|
/**
|
|
36
30
|
* Summary of a chart for LLM consumption and asset extraction
|
|
37
31
|
*/
|
|
@@ -42,13 +36,25 @@ export interface ChartSummary {
|
|
|
42
36
|
createdAt: string;
|
|
43
37
|
/** Unique identifier for the chart (typically the tool call ID) */
|
|
44
38
|
chartId: string;
|
|
45
|
-
/**
|
|
46
|
-
|
|
39
|
+
/** Data source the chart was built from */
|
|
40
|
+
dataSourceTitle: string;
|
|
41
|
+
/** Compact CSDK chart configuration (chartType, dataOptions, filters, styleOptions) */
|
|
42
|
+
chartState?: BaseChartSummary;
|
|
43
|
+
/** NLQ state for incremental structural revisions via updateChartQuery */
|
|
44
|
+
queryState?: QueryState;
|
|
47
45
|
/** Whether this chart creation resulted in an error */
|
|
48
46
|
isError?: boolean;
|
|
49
|
-
/** Dataset from
|
|
47
|
+
/** Dataset rows/sample from NLQ when present on the saved chart widget; surfaced on {@link ChartSummary} when `naturalResponseEnabled` */
|
|
50
48
|
dataset?: Dataset;
|
|
51
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Row in the `charts` array of the build-chart system prompt: either a full
|
|
52
|
+
* {@link ChartSummary} from the host or a single targeted entry when revising by id.
|
|
53
|
+
*/
|
|
54
|
+
export type ChartContextPromptEntry = ChartSummary | {
|
|
55
|
+
chartId: string;
|
|
56
|
+
chartState: BaseChartSummary;
|
|
57
|
+
};
|
|
52
58
|
export type ColumnType = StyledColumn | StyledMeasureColumn | Column | MeasureColumn | CalculatedMeasureColumn;
|
|
53
59
|
export interface Column {
|
|
54
60
|
id?: number;
|
|
@@ -462,27 +468,25 @@ export declare const chartRecommendationsSchema: z.ZodObject<{
|
|
|
462
468
|
locationLevel: "auto" | "country" | "state" | "city";
|
|
463
469
|
};
|
|
464
470
|
}>;
|
|
471
|
+
/**
|
|
472
|
+
* Canonical tool description for buildChart — reusable by any host (sdk-assistant, MCP server, custom integrations).
|
|
473
|
+
* Hosts may append host-specific notes but should not duplicate or contradict this text.
|
|
474
|
+
*/
|
|
475
|
+
export declare const buildChartToolDescription = "Creates or revises a chart from a natural language prompt.\n\nThree ways to scope the run (pass `userPrompt` unchanged in all cases):\n\n1. **New chart from scratch:** omit both `priorChartId` and `queryId` and describe the desired chart in `userPrompt`.\n2. **Revise an existing chart:** pass `priorChartId` (the chartId from a prior buildChart result, or the widget id when inside a dashboard). The chart's existing data context and style are preserved across revisions. Do not run other tools (e.g. query tool) when revising an existing chart.\n3. **Verbatim prior query:** pass `queryId` (an id from a prior data query result) to chart to reuse that query result if needed to not waste the prior query work.\n\nDo not pass both `priorChartId` and `queryId` \u2014 if both are set, `priorChartId` takes precedence.\n\nPass the user prompt exactly as received \u2014 do not transform or modify it.";
|
|
465
476
|
export declare const buildChartSchema: z.ZodObject<{
|
|
466
477
|
dataSourceTitle: z.ZodString;
|
|
467
478
|
userPrompt: z.ZodString;
|
|
468
|
-
|
|
469
|
-
dataSourceTitle: string;
|
|
470
|
-
userPrompt: string;
|
|
471
|
-
}, {
|
|
472
|
-
dataSourceTitle: string;
|
|
473
|
-
userPrompt: string;
|
|
474
|
-
}>;
|
|
475
|
-
export declare const buildChartSchemaNaturalConversation: z.ZodObject<{
|
|
476
|
-
dataSourceTitle: z.ZodString;
|
|
477
|
-
userPrompt: z.ZodString;
|
|
479
|
+
priorChartId: z.ZodOptional<z.ZodString>;
|
|
478
480
|
queryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
479
481
|
}, "strip", z.ZodTypeAny, {
|
|
480
482
|
dataSourceTitle: string;
|
|
481
483
|
userPrompt: string;
|
|
484
|
+
priorChartId?: string | undefined;
|
|
482
485
|
queryId?: string | null | undefined;
|
|
483
486
|
}, {
|
|
484
487
|
dataSourceTitle: string;
|
|
485
488
|
userPrompt: string;
|
|
489
|
+
priorChartId?: string | undefined;
|
|
486
490
|
queryId?: string | null | undefined;
|
|
487
491
|
}>;
|
|
488
492
|
export declare const createChartSchema: z.ZodObject<{
|
|
@@ -600,6 +604,16 @@ export declare const updateChartStyleOptionsSchema: z.ZodObject<{
|
|
|
600
604
|
userPrompt: string;
|
|
601
605
|
chartId?: string | undefined;
|
|
602
606
|
}>;
|
|
607
|
+
export declare const updateChartQuerySchema: z.ZodObject<{
|
|
608
|
+
revisionPrompt: z.ZodString;
|
|
609
|
+
chartId: z.ZodString;
|
|
610
|
+
}, "strip", z.ZodTypeAny, {
|
|
611
|
+
chartId: string;
|
|
612
|
+
revisionPrompt: string;
|
|
613
|
+
}, {
|
|
614
|
+
chartId: string;
|
|
615
|
+
revisionPrompt: string;
|
|
616
|
+
}>;
|
|
603
617
|
/**
|
|
604
618
|
* Build chart context interface
|
|
605
619
|
*/
|
|
@@ -614,8 +628,6 @@ export interface BuildChartContext {
|
|
|
614
628
|
dataSourceTitle: string;
|
|
615
629
|
/** Chart summaries to be used as context */
|
|
616
630
|
chartSummaries?: ChartSummary[];
|
|
617
|
-
/** query results to be used as context */
|
|
618
|
-
querySummaries?: QuerySummary[];
|
|
619
631
|
/**
|
|
620
632
|
* Retrieve a chart by its ID
|
|
621
633
|
* @param chartId - The ID of the chart to retrieve
|
|
@@ -636,15 +648,19 @@ export interface BuildChartContext {
|
|
|
636
648
|
retrieveQuery?: (queryId: string) => QueryResult | null;
|
|
637
649
|
/** Whether NLQ V3 is enabled */
|
|
638
650
|
isNlqV3Enabled?: boolean;
|
|
651
|
+
/**
|
|
652
|
+
* When false, incremental NLQ uses Layer-2 text augmentation instead of REST `chartState`.
|
|
653
|
+
* Typically threaded from host config when available.
|
|
654
|
+
*/
|
|
655
|
+
isNlqDeltaEnabled?: boolean;
|
|
639
656
|
httpClient?: HttpClient;
|
|
640
657
|
openAIClient?: OpenAI;
|
|
641
|
-
/**
|
|
642
|
-
|
|
643
|
-
|
|
658
|
+
/**
|
|
659
|
+
* When true, include `dataset` on the returned {@link ChartSummary} when the saved chart
|
|
660
|
+
* widget carries `dataset`.
|
|
661
|
+
*/
|
|
644
662
|
naturalResponseEnabled?: boolean;
|
|
645
|
-
/**
|
|
646
|
-
|
|
647
|
-
/** Translated dashboard filters for NLQ smart-query `commonFilters` when build chart calls buildQueryEngine (no queryId) */
|
|
648
|
-
filters?: unknown;
|
|
663
|
+
/** Common filters (e.g., from dashboard filters) to be applied to the query of the chart. */
|
|
664
|
+
commonFilters?: unknown;
|
|
649
665
|
}
|
|
650
666
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/engines/build-chart/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EACN,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,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E,wBAAwB,KACtC,IAAI,CAAC;IACV;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,WAAW,GAAG,IAAI,CAAC;IACxD,gCAAgC;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,6FAA6F;IAC7F,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ExtendedChartWidgetProps } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Copies chart type, style options, and per-measure visual flags (right-axis, color)
|
|
4
|
+
* from a prior chart onto the newly generated widget props.
|
|
5
|
+
*
|
|
6
|
+
* NOTE: sort / trend / forecast are intentionally NOT copied — they reference column
|
|
7
|
+
* names that may no longer exist after structural changes (add/remove/swap dimensions).
|
|
8
|
+
*/
|
|
9
|
+
export declare function applyPriorChartStyle(widgetProps: ExtendedChartWidgetProps, priorChart: ExtendedChartWidgetProps): void;
|
|
10
|
+
//# sourceMappingURL=apply-prior-chart-style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-prior-chart-style.d.ts","sourceRoot":"","sources":["../../../../src/engines/build-chart/update-chart/apply-prior-chart-style.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AA2CpD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,WAAW,EAAE,wBAAwB,EACrC,UAAU,EAAE,wBAAwB,GAClC,IAAI,CAmBN"}
|