@lightdash/common 2.57.1 → 2.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/ee/AiAgent/chartConfig/web/getWebAiChartConfig.d.ts +28 -28
  3. package/dist/cjs/ee/AiAgent/schemas/index.d.ts +2 -2
  4. package/dist/cjs/ee/AiAgent/schemas/index.d.ts.map +1 -1
  5. package/dist/cjs/ee/AiAgent/schemas/index.js.map +1 -1
  6. package/dist/cjs/ee/AiAgent/schemas/tools/index.d.ts +1 -0
  7. package/dist/cjs/ee/AiAgent/schemas/tools/index.d.ts.map +1 -1
  8. package/dist/cjs/ee/AiAgent/schemas/tools/index.js +1 -0
  9. package/dist/cjs/ee/AiAgent/schemas/tools/index.js.map +1 -1
  10. package/dist/cjs/ee/AiAgent/schemas/tools/toolDefinitions.d.ts +3 -0
  11. package/dist/cjs/ee/AiAgent/schemas/tools/toolDefinitions.d.ts.map +1 -1
  12. package/dist/cjs/ee/AiAgent/schemas/tools/toolDefinitions.js +13 -2
  13. package/dist/cjs/ee/AiAgent/schemas/tools/toolDefinitions.js.map +1 -1
  14. package/dist/cjs/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.d.ts +131 -0
  15. package/dist/cjs/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.d.ts.map +1 -0
  16. package/dist/cjs/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.js +96 -0
  17. package/dist/cjs/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.js.map +1 -0
  18. package/dist/cjs/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.test.d.ts +2 -0
  19. package/dist/cjs/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.test.d.ts.map +1 -0
  20. package/dist/cjs/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.test.js +48 -0
  21. package/dist/cjs/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.test.js.map +1 -0
  22. package/dist/cjs/ee/AiAgent/schemas/tools/toolRunMetricQueryArgs.d.ts +852 -852
  23. package/dist/cjs/ee/AiAgent/schemas/tools/toolSearchFieldValuesArgs.d.ts +575 -575
  24. package/dist/cjs/ee/AiAgent/schemas/visualizations/index.d.ts +4 -4
  25. package/dist/cjs/ee/AiAgent/schemas/visualizations/index.d.ts.map +1 -1
  26. package/dist/cjs/ee/AiAgent/schemas/visualizations/index.js +3 -0
  27. package/dist/cjs/ee/AiAgent/schemas/visualizations/index.js.map +1 -1
  28. package/dist/cjs/ee/AiAgent/utils.d.ts +13 -13
  29. package/dist/cjs/ee/apps/types.d.ts +1 -1
  30. package/dist/cjs/ee/apps/types.d.ts.map +1 -1
  31. package/dist/cjs/ee/apps/types.js +1 -0
  32. package/dist/cjs/ee/apps/types.js.map +1 -1
  33. package/dist/cjs/types/schedulerTaskList.d.ts +4 -0
  34. package/dist/cjs/types/schedulerTaskList.d.ts.map +1 -1
  35. package/dist/cjs/types/schedulerTaskList.js.map +1 -1
  36. package/dist/esm/.tsbuildinfo +1 -1
  37. package/dist/esm/ee/AiAgent/chartConfig/web/getWebAiChartConfig.d.ts +28 -28
  38. package/dist/esm/ee/AiAgent/schemas/index.d.ts +2 -2
  39. package/dist/esm/ee/AiAgent/schemas/index.d.ts.map +1 -1
  40. package/dist/esm/ee/AiAgent/schemas/index.js.map +1 -1
  41. package/dist/esm/ee/AiAgent/schemas/tools/index.d.ts +1 -0
  42. package/dist/esm/ee/AiAgent/schemas/tools/index.d.ts.map +1 -1
  43. package/dist/esm/ee/AiAgent/schemas/tools/index.js +1 -0
  44. package/dist/esm/ee/AiAgent/schemas/tools/index.js.map +1 -1
  45. package/dist/esm/ee/AiAgent/schemas/tools/toolDefinitions.d.ts +3 -0
  46. package/dist/esm/ee/AiAgent/schemas/tools/toolDefinitions.d.ts.map +1 -1
  47. package/dist/esm/ee/AiAgent/schemas/tools/toolDefinitions.js +11 -0
  48. package/dist/esm/ee/AiAgent/schemas/tools/toolDefinitions.js.map +1 -1
  49. package/dist/esm/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.d.ts +131 -0
  50. package/dist/esm/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.d.ts.map +1 -0
  51. package/dist/esm/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.js +89 -0
  52. package/dist/esm/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.js.map +1 -0
  53. package/dist/esm/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.test.d.ts +2 -0
  54. package/dist/esm/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.test.d.ts.map +1 -0
  55. package/dist/esm/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.test.js +46 -0
  56. package/dist/esm/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.test.js.map +1 -0
  57. package/dist/esm/ee/AiAgent/schemas/tools/toolRunMetricQueryArgs.d.ts +852 -852
  58. package/dist/esm/ee/AiAgent/schemas/tools/toolSearchFieldValuesArgs.d.ts +575 -575
  59. package/dist/esm/ee/AiAgent/schemas/visualizations/index.d.ts +4 -4
  60. package/dist/esm/ee/AiAgent/schemas/visualizations/index.d.ts.map +1 -1
  61. package/dist/esm/ee/AiAgent/schemas/visualizations/index.js +3 -0
  62. package/dist/esm/ee/AiAgent/schemas/visualizations/index.js.map +1 -1
  63. package/dist/esm/ee/AiAgent/utils.d.ts +13 -13
  64. package/dist/esm/ee/apps/types.d.ts +1 -1
  65. package/dist/esm/ee/apps/types.d.ts.map +1 -1
  66. package/dist/esm/ee/apps/types.js +1 -0
  67. package/dist/esm/ee/apps/types.js.map +1 -1
  68. package/dist/esm/types/schedulerTaskList.d.ts +4 -0
  69. package/dist/esm/types/schedulerTaskList.d.ts.map +1 -1
  70. package/dist/esm/types/schedulerTaskList.js.map +1 -1
  71. package/dist/types/.tsbuildinfo +1 -1
  72. package/dist/types/ee/AiAgent/chartConfig/web/getWebAiChartConfig.d.ts +28 -28
  73. package/dist/types/ee/AiAgent/schemas/index.d.ts +2 -2
  74. package/dist/types/ee/AiAgent/schemas/index.d.ts.map +1 -1
  75. package/dist/types/ee/AiAgent/schemas/index.js.map +1 -1
  76. package/dist/types/ee/AiAgent/schemas/tools/index.d.ts +1 -0
  77. package/dist/types/ee/AiAgent/schemas/tools/index.d.ts.map +1 -1
  78. package/dist/types/ee/AiAgent/schemas/tools/index.js +1 -0
  79. package/dist/types/ee/AiAgent/schemas/tools/index.js.map +1 -1
  80. package/dist/types/ee/AiAgent/schemas/tools/toolDefinitions.d.ts +3 -0
  81. package/dist/types/ee/AiAgent/schemas/tools/toolDefinitions.d.ts.map +1 -1
  82. package/dist/types/ee/AiAgent/schemas/tools/toolDefinitions.js +11 -0
  83. package/dist/types/ee/AiAgent/schemas/tools/toolDefinitions.js.map +1 -1
  84. package/dist/types/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.d.ts +131 -0
  85. package/dist/types/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.d.ts.map +1 -0
  86. package/dist/types/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.js +89 -0
  87. package/dist/types/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.js.map +1 -0
  88. package/dist/types/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.test.d.ts +2 -0
  89. package/dist/types/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.test.d.ts.map +1 -0
  90. package/dist/types/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.test.js +46 -0
  91. package/dist/types/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.test.js.map +1 -0
  92. package/dist/types/ee/AiAgent/schemas/tools/toolRunMetricQueryArgs.d.ts +852 -852
  93. package/dist/types/ee/AiAgent/schemas/tools/toolSearchFieldValuesArgs.d.ts +575 -575
  94. package/dist/types/ee/AiAgent/schemas/visualizations/index.d.ts +4 -4
  95. package/dist/types/ee/AiAgent/schemas/visualizations/index.d.ts.map +1 -1
  96. package/dist/types/ee/AiAgent/schemas/visualizations/index.js +3 -0
  97. package/dist/types/ee/AiAgent/schemas/visualizations/index.js.map +1 -1
  98. package/dist/types/ee/AiAgent/utils.d.ts +13 -13
  99. package/dist/types/ee/apps/types.d.ts +1 -1
  100. package/dist/types/ee/apps/types.d.ts.map +1 -1
  101. package/dist/types/ee/apps/types.js +1 -0
  102. package/dist/types/ee/apps/types.js.map +1 -1
  103. package/dist/types/types/schedulerTaskList.d.ts +4 -0
  104. package/dist/types/types/schedulerTaskList.d.ts.map +1 -1
  105. package/dist/types/types/schedulerTaskList.js.map +1 -1
  106. package/package.json +1 -1
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getExpiredGenerateDataAppBuildOutcome = exports.getGenerateDataAppBuildOutcome = exports.getDataAppBuilderPath = exports.isToolGenerateDataAppResult = exports.toolGenerateDataAppOutputSchema = exports.toolGenerateDataAppArgsSchema = exports.TOOL_GENERATE_DATA_APP_DESCRIPTION = exports.DATA_APP_BUILD_TEMPLATES = exports.AI_DATA_APP_BUILD_PENDING_GRACE_MS = void 0;
4
+ const zod_1 = require("zod");
5
+ const types_1 = require("../../../apps/types");
6
+ /** Builds run minutes, not seconds: a pending result older than this is stale. */
7
+ exports.AI_DATA_APP_BUILD_PENDING_GRACE_MS = 30 * 60 * 1000;
8
+ exports.DATA_APP_BUILD_TEMPLATES = [
9
+ 'dashboard',
10
+ 'slideshow',
11
+ 'pdf',
12
+ 'custom',
13
+ ];
14
+ exports.TOOL_GENERATE_DATA_APP_DESCRIPTION = [
15
+ "Start building a data app — an interactive application generated from a prompt on top of this project's semantic layer.",
16
+ 'Use it ONLY when the user asks to build, make, or generate a data app (or an app, slide show, or PDF report). Do NOT use it for questions, charts, dashboards, or other saved content.',
17
+ 'The build runs in the background for several minutes, so the call returns as soon as it has started (status: "pending"). Tell the user the build has started and that you will be able to link them to the app afterwards, then end your turn. Never wait, poll, or call this tool again for the same request: one request, one call.',
18
+ 'A later turn sees the outcome on this call\'s result: "success" carries the app name and the builder link (href) to share; "error" carries the failure message.',
19
+ ].join(' ');
20
+ exports.toolGenerateDataAppArgsSchema = zod_1.z.object({
21
+ prompt: zod_1.z
22
+ .string()
23
+ .describe('A self-contained brief for the coding agent that builds the app: what the app shows, for whom, and how it should behave. Fold in what this thread found — for each visualization the app should include, add a line like `[viz name][metric query]` with the explore, metrics, dimensions, filters and sort. The coding agent sees the semantic layer but not this conversation, so include every detail it needs.'),
24
+ template: zod_1.z
25
+ .enum(exports.DATA_APP_BUILD_TEMPLATES)
26
+ .nullable()
27
+ .describe('Starting template: "dashboard" for a dashboard-style app, "slideshow" for a slide show, "pdf" for a PDF report, "custom" (or null) for anything else.'),
28
+ dashboardSlug: zod_1.z
29
+ .string()
30
+ .nullable()
31
+ .describe("Generate from an existing dashboard: its slug (from findContent). The app starts from the dashboard's layout and charts. Null when not generating from a dashboard."),
32
+ chartSlugs: zod_1.z
33
+ .array(zod_1.z.string())
34
+ .nullable()
35
+ .describe('Saved charts (slugs from findContent) whose queries the app should be built on. Null when not building on saved charts.'),
36
+ });
37
+ exports.toolGenerateDataAppOutputSchema = zod_1.z.object({
38
+ result: zod_1.z.string(),
39
+ metadata: zod_1.z.discriminatedUnion('status', [
40
+ zod_1.z.object({
41
+ status: zod_1.z.literal('pending'),
42
+ appUuid: zod_1.z.string(),
43
+ version: zod_1.z.number(),
44
+ }),
45
+ zod_1.z.object({
46
+ status: zod_1.z.literal('success'),
47
+ appUuid: zod_1.z.string(),
48
+ version: zod_1.z.number(),
49
+ name: zod_1.z.string(),
50
+ href: zod_1.z.string(),
51
+ }),
52
+ zod_1.z.object({
53
+ status: zod_1.z.literal('error'),
54
+ message: zod_1.z.string(),
55
+ }),
56
+ ]),
57
+ });
58
+ const isToolGenerateDataAppResult = (result) => result.toolType === 'built-in' &&
59
+ result.toolName === 'generateDataApp' &&
60
+ exports.toolGenerateDataAppOutputSchema.shape.metadata.safeParse(result.metadata)
61
+ .success;
62
+ exports.isToolGenerateDataAppResult = isToolGenerateDataAppResult;
63
+ const getDataAppBuilderPath = (projectUuid, appUuid) => `/projects/${projectUuid}/apps/${appUuid}`;
64
+ exports.getDataAppBuilderPath = getDataAppBuilderPath;
65
+ // Terminal tool result for a version, or null while still building. Shared by
66
+ // the worker patch and the thread-read self-heal.
67
+ const getGenerateDataAppBuildOutcome = ({ siteUrl, projectUuid, appUuid, version, name, status, error, statusMessage, }) => {
68
+ if ((0, types_1.isAppVersionInProgress)(status)) {
69
+ return null;
70
+ }
71
+ if (status === 'ready') {
72
+ // Canonical URL: the thread renders it as a link and the agent shares it.
73
+ const href = `${siteUrl}${(0, exports.getDataAppBuilderPath)(projectUuid, appUuid)}`;
74
+ return {
75
+ result: `The data app "${name}" is ready. Share this link so the user can open it in the builder: ${href}`,
76
+ metadata: { status: 'success', appUuid, version, name, href },
77
+ };
78
+ }
79
+ const message = error === types_1.APP_VERSION_CANCELLED_BY_USER
80
+ ? 'The build was cancelled.'
81
+ : (statusMessage ?? 'The build failed.');
82
+ return {
83
+ result: `The data app build did not finish: ${message}`,
84
+ metadata: { status: 'error', message },
85
+ };
86
+ };
87
+ exports.getGenerateDataAppBuildOutcome = getGenerateDataAppBuildOutcome;
88
+ const getExpiredGenerateDataAppBuildOutcome = () => {
89
+ const message = `The build did not report an outcome within ${exports.AI_DATA_APP_BUILD_PENDING_GRACE_MS / 60000} minutes.`;
90
+ return {
91
+ result: `The data app build did not finish: ${message}`,
92
+ metadata: { status: 'error', message },
93
+ };
94
+ };
95
+ exports.getExpiredGenerateDataAppBuildOutcome = getExpiredGenerateDataAppBuildOutcome;
96
+ //# sourceMappingURL=toolGenerateDataAppArgs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolGenerateDataAppArgs.js","sourceRoot":"","sources":["../../../../../../src/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,+CAI6B;A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AAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE;SAChE,CAAC;IACN,CAAC;IACD,MAAM,OAAO,GACT,KAAK,KAAK,qCAA6B;QACnC,CAAC,CAAC,0BAA0B;QAC5B,CAAC,CAAC,CAAC,aAAa,IAAI,mBAAmB,CAAC,CAAC;IACjD,OAAO;QACH,MAAM,EAAE,sCAAsC,OAAO,EAAE;QACvD,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE;KACzC,CAAC;AACN,CAAC,CAAC;AAtCW,QAAA,8BAA8B,GAA9B,8BAA8B,CAsCzC;AAEK,MAAM,qCAAqC,GAC9C,GAAsC,EAAE;IACpC,MAAM,OAAO,GAAG,8CACZ,QAAA,kCAAkC,GAAG,KACzC,WAAW,CAAC;IACZ,OAAO;QACH,MAAM,EAAE,sCAAsC,OAAO,EAAE;QACvD,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE;KACzC,CAAC;AACN,CAAC,CAAC;AATO,QAAA,qCAAqC,GAArC,qCAAqC,CAS5C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=toolGenerateDataAppArgs.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolGenerateDataAppArgs.test.d.ts","sourceRoot":"","sources":["../../../../../../src/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const types_1 = require("../../../apps/types");
4
+ const toolGenerateDataAppArgs_1 = require("./toolGenerateDataAppArgs");
5
+ const base = {
6
+ siteUrl: 'https://ld.example.com',
7
+ projectUuid: 'proj-1',
8
+ appUuid: 'app-1',
9
+ version: 2,
10
+ name: 'Revenue app',
11
+ error: null,
12
+ statusMessage: null,
13
+ };
14
+ describe('getGenerateDataAppBuildOutcome', () => {
15
+ it('is null while the build is in progress', () => {
16
+ expect((0, toolGenerateDataAppArgs_1.getGenerateDataAppBuildOutcome)({ ...base, status: 'generating' })).toBeNull();
17
+ });
18
+ it('maps ready to success with the builder link', () => {
19
+ expect((0, toolGenerateDataAppArgs_1.getGenerateDataAppBuildOutcome)({ ...base, status: 'ready' })
20
+ ?.metadata).toEqual({
21
+ status: 'success',
22
+ appUuid: 'app-1',
23
+ version: 2,
24
+ name: 'Revenue app',
25
+ href: 'https://ld.example.com/projects/proj-1/apps/app-1',
26
+ });
27
+ });
28
+ it('maps a failure to error with the user-facing message', () => {
29
+ expect((0, toolGenerateDataAppArgs_1.getGenerateDataAppBuildOutcome)({
30
+ ...base,
31
+ status: 'error',
32
+ error: 'stack trace',
33
+ statusMessage: 'Failed to deploy your app. Please try again.',
34
+ })?.metadata).toEqual({
35
+ status: 'error',
36
+ message: 'Failed to deploy your app. Please try again.',
37
+ });
38
+ });
39
+ it('maps a cancellation to error', () => {
40
+ expect((0, toolGenerateDataAppArgs_1.getGenerateDataAppBuildOutcome)({
41
+ ...base,
42
+ status: 'error',
43
+ error: types_1.APP_VERSION_CANCELLED_BY_USER,
44
+ statusMessage: types_1.APP_VERSION_CANCELLED_BY_USER,
45
+ })?.metadata).toEqual({ status: 'error', message: 'The build was cancelled.' });
46
+ });
47
+ });
48
+ //# sourceMappingURL=toolGenerateDataAppArgs.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolGenerateDataAppArgs.test.js","sourceRoot":"","sources":["../../../../../../src/ee/AiAgent/schemas/tools/toolGenerateDataAppArgs.test.ts"],"names":[],"mappings":";;AAAA,+CAAoE;AACpE,uEAA2E;AAE3E,MAAM,IAAI,GAAG;IACT,OAAO,EAAE,wBAAwB;IACjC,WAAW,EAAE,QAAQ;IACrB,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,IAAI;IACX,aAAa,EAAE,IAAI;CACt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