@uniformdev/mesh-edgehancer-sdk 20.48.1-alpha.28 → 20.48.1-alpha.33.sha-eb3f272086

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/index.esm.js CHANGED
@@ -1,5 +1,14 @@
1
1
  // ../../lib/ai-sdk/src/InvocationContexts.ts
2
- import * as z from "zod/v3";
2
+ import * as z from "zod";
3
+
4
+ // ../../lib/ai-sdk/src/utils/insightsDateRange.ts
5
+ var INSIGHTS_DATE_RANGES = ["last-7-days", "last-14-days", "last-30-days", "last-3-months"];
6
+
7
+ // ../../lib/ai-sdk/src/InvocationContexts.ts
8
+ var insightsDebugTraceSchema = z.object({
9
+ tools: z.array(z.string()),
10
+ maxChars: z.number().optional()
11
+ });
3
12
  var invocationContextsSchema = z.enum([
4
13
  "composition",
5
14
  "compositionPattern",
@@ -9,14 +18,58 @@ var invocationContextsSchema = z.enum([
9
18
  "general"
10
19
  ]);
11
20
  var invocationContextInfoSchema = z.object({
12
- context: invocationContextsSchema,
13
- id: z.string(),
14
- displayName: z.string().optional(),
15
- icon: z.string().optional()
21
+ /** The invocation context type ('composition', 'entry', 'general', etc.) */
22
+ context: invocationContextsSchema.optional(),
23
+ /** Entity ID being edited */
24
+ entityId: z.string().optional(),
25
+ /** Display name of the entity */
26
+ entityName: z.string().optional(),
27
+ /** Project map path of the entity (e.g., "/", "/about", "/products/shoes"). Only for compositions attached to project map. */
28
+ entityPath: z.string().optional(),
29
+ /** Edition ID if editing a non-default edition */
30
+ editionId: z.string().optional(),
31
+ /** Component node ID selected by the user within the entity's component tree.
32
+ * Only applicable when context is 'composition', 'compositionPattern', or 'componentPattern'. */
33
+ entitySelectedNodeId: z.string().optional(),
34
+ /** Parameter or field ID the user has focused within the selected node.
35
+ * Applicable to all entity types. */
36
+ entitySelectedPropertyId: z.string().optional(),
37
+ /** Current locale */
38
+ locale: z.string().optional(),
39
+ /** Release ID if working within a release context; null means editing base content (not in a release) */
40
+ releaseId: z.string().nullable().optional(),
41
+ /** Display name of the release */
42
+ releaseName: z.string().optional(),
43
+ /** Project display name */
44
+ projectName: z.string().optional(),
45
+ /** User display name */
46
+ userDisplayName: z.string().optional(),
47
+ /** Username (e.g. for creator/author filters in search); prefer identity name from member profile */
48
+ username: z.string().optional(),
49
+ /** Current date (ISO string for reliable parsing). Only updated when >5min apart. */
50
+ currentDate: z.string().optional(),
51
+ /** Current date in user's locale format with timezone */
52
+ currentLocaleDate: z.string().optional(),
53
+ /**
54
+ * The period selected in the insights date filter, if the user has one. Scout answers an
55
+ * analytics question that names no period over this window, so its numbers match the dashboard
56
+ * the user is looking at.
57
+ */
58
+ insightsDateRange: z.enum(INSIGHTS_DATE_RANGES).optional(),
59
+ /**
60
+ * Dev-only request, set from a viewer's own localStorage rather than any product UI: capture full
61
+ * input/output for the named insights analyst tool calls and attach them to `queryInsights`'
62
+ * `trace.calls`, instead of the usual tool-name-only trace. Never surfaced to the user.
63
+ */
64
+ insightsDebugTrace: insightsDebugTraceSchema.optional(),
65
+ /** Agent-readable description of how entity mutations behave in the current context */
66
+ editBehavior: z.string().optional(),
67
+ /** Summary of pending changes applied/discarded since the last turn */
68
+ pendingChangesUpdates: z.string().optional()
16
69
  });
17
70
 
18
71
  // src/afterAIDataResourceEdit.ts
19
- import * as z2 from "zod/v3";
72
+ import * as z2 from "zod";
20
73
  var afterAIDataResourceEditResultSchema = z2.strictObject({
21
74
  newValue: z2.record(z2.string(), z2.string()),
22
75
  success: z2.boolean(),
@@ -54,63 +107,75 @@ var afterAIDataResourceEditContextSchema = z2.strictObject({
54
107
  });
55
108
 
56
109
  // ../../lib/ai-sdk/src/toolDefinitions/editing/createPropertyEdit.ts
57
- import * as z3 from "zod/v3";
110
+ import * as z4 from "zod";
111
+
112
+ // ../../lib/ai-sdk/src/utils/normalizeOptionalAIString.ts
113
+ import * as z3 from "zod";
114
+ var optionalAIStringSchema = z3.string().optional();
115
+
116
+ // ../../lib/ai-sdk/src/toolDefinitions/editing/createPropertyEdit.ts
58
117
  var createPropertyEdit = {
59
- displayName: "Create Property Edit",
118
+ displayName: "Create property edit",
60
119
  description: "Edits a property on a composition, entry, or pattern with AI. This is a callable tool NOT FOR AGENT USE - agents use applyPropertyEdit to broker client-side application of the edit.",
61
- inputSchema: z3.object({
62
- edit: z3.string().describe("Describe the edit to be made to the property"),
63
- currentValue: z3.unknown().describe("Current value of the property (if any exists)").optional(),
64
- projectGuidance: z3.string().describe("Guidance prompt for the project (if any exists)").optional(),
65
- componentGuidance: z3.string().describe("Guidance prompt for the parent component").optional(),
66
- audienceGuidance: z3.string().describe(
120
+ inputSchema: z4.object({
121
+ edit: z4.string().describe(
122
+ "Describe the edit to generate. Pass an empty string when supplying exactValue instead (they are mutually exclusive)."
123
+ ),
124
+ exactValue: z4.string().describe(
125
+ "The exact content to store, in its natural form, with minimal reformatting. Mutually exclusive with edit."
126
+ ).optional(),
127
+ currentValue: z4.unknown().describe("Current value of the property (if any exists)").optional(),
128
+ projectGuidance: z4.string().describe("Guidance prompt for the project (if any exists)").optional(),
129
+ componentGuidance: z4.string().describe("Guidance prompt for the parent component").optional(),
130
+ audienceGuidance: z4.string().describe(
67
131
  "Guidance prompt for the target audience of a personalized variation. Omit for non-variation edits."
68
132
  ).optional(),
69
- propertyDefinition: z3.object({
70
- id: z3.string(),
71
- name: z3.string(),
72
- type: z3.string(),
73
- guidance: z3.string().describe("Guidance prompt from the property definition (if any exists)").optional(),
74
- typeConfig: z3.unknown().optional().describe("Type-specific configuration for the property")
133
+ propertyDefinition: z4.object({
134
+ id: z4.string(),
135
+ name: z4.string(),
136
+ type: z4.string(),
137
+ guidance: z4.string().describe("Guidance prompt from the property definition (if any exists)").optional(),
138
+ typeConfig: z4.unknown().optional().describe("Type-specific configuration for the property")
75
139
  }),
76
- outputLocale: z3.string().optional().describe("The locale to use when writing the edited value"),
77
- documentContext: z3.string().describe("Content of the surrounding document the property is part of").optional()
140
+ outputLocale: optionalAIStringSchema.describe(
141
+ "The locale to use when writing the edited value. Use an empty string for locale-independent values."
142
+ ),
143
+ documentContext: z4.string().describe("Content of the surrounding document the property is part of").optional()
78
144
  }),
79
- outputSchema: z3.object({
80
- newValue: z3.string().describe(
81
- "The new value of the property. When the action is clear or resetOverride, this should be empty."
145
+ outputSchema: z4.object({
146
+ newValue: z4.string().describe(
147
+ "The new value of the property. When the action is clearValue, resetOverride, or nothing, this should be empty."
82
148
  ),
83
- treatNewValueAsJson: z3.boolean().describe("Whether the newValue is a JSON string"),
84
- summary: z3.string().describe(
85
- "A completion message to the user that summarizes the action taken. This should be 1 sentence, in English."
86
- ).optional(),
87
- action: z3.enum(["setValue", "clearValue", "resetOverride"]).describe(
88
- "setValue = update the value, clearValue = remove the value/set to empty, resetOverride = remove a pattern override and inherit the pattern value. Only use resetOverride if the prompt asks for it. If the prompt is specifically talking about asset parameter title/description overrides, use setValue instead."
149
+ treatNewValueAsJson: z4.boolean().describe("Whether the newValue is a JSON string"),
150
+ summary: z4.string().describe(
151
+ 'A completion message to the user that summarizes the action taken. One sentence, in English. Use e.g. "Done." when no detail is needed.'
89
152
  ),
90
- success: z3.boolean().describe("Whether the edit could be completed successfully")
153
+ action: z4.enum(["setValue", "clearValue", "resetOverride", "nothing"]).describe(
154
+ "setValue = update the value, clearValue = remove the value/set to empty, resetOverride = remove a pattern override and inherit the pattern value, nothing = leave the value unchanged (use when instructed to keep existing value, make no changes, or leave unchanged). Only use resetOverride if the prompt asks for it. If the prompt is specifically talking about asset parameter title/description overrides, use setValue instead."
155
+ ),
156
+ success: z4.boolean().describe("Whether the edit could be completed successfully")
91
157
  }),
92
- runsAt: "server",
93
158
  timeout: 100,
94
- callable: true
159
+ toolClass: "edit"
95
160
  };
96
161
 
97
162
  // src/afterAIEdit.ts
98
- import * as z4 from "zod/v3";
99
- var afterAIEditResultSchema = z4.strictObject({
100
- newValue: z4.unknown(),
101
- success: z4.boolean(),
102
- summary: z4.string().optional()
163
+ import * as z5 from "zod";
164
+ var afterAIEditResultSchema = z5.strictObject({
165
+ newValue: z5.unknown().optional(),
166
+ success: z5.boolean(),
167
+ summary: z5.string().optional()
103
168
  });
104
- var afterAIEditContextSchema = z4.strictObject({
169
+ var afterAIEditContextSchema = z5.strictObject({
105
170
  editRequest: createPropertyEdit.inputSchema,
106
171
  invocationContext: invocationContextsSchema,
107
- userId: z4.string(),
108
- currentLocale: z4.string().optional(),
109
- projectId: z4.string(),
110
- newValue: z4.unknown(),
111
- result: z4.object({
112
- success: z4.boolean(),
113
- summary: z4.string().optional()
172
+ userId: z5.string(),
173
+ currentLocale: z5.string().optional(),
174
+ projectId: z5.string(),
175
+ newValue: z5.unknown(),
176
+ result: z5.object({
177
+ success: z5.boolean(),
178
+ summary: z5.string().optional()
114
179
  })
115
180
  });
116
181
 
@@ -174,49 +239,49 @@ var COLLECTION_MAX_LIMIT = 50;
174
239
  var COLLECTION_DEFAULT_OFFSET = 0;
175
240
 
176
241
  // src/createAIDataResourceEdit.ts
177
- import * as z5 from "zod/v3";
178
- var createAIDataResourceEditContextSchema = z5.strictObject({
242
+ import * as z6 from "zod";
243
+ var createAIDataResourceEditContextSchema = z6.strictObject({
179
244
  /**
180
245
  * The the data type of the data resource being edited (merged with its data source)
181
246
  * NOTE: this can contain secrets, API keys, etc. Do not directly expose it to the AI agent!
182
247
  * NOTE: this does not include the current value's variables, if any
183
248
  */
184
- mergedDataType: z5.custom(),
249
+ mergedDataType: z6.custom(),
185
250
  /** Which data source variant is currently active (undefined = published data) */
186
- dataSourceVariant: z5.custom().optional(),
251
+ dataSourceVariant: z6.custom().optional(),
187
252
  /** The edit request details */
188
- editRequest: z5.object({
253
+ editRequest: z6.object({
189
254
  /** The edit instruction from the AI agent */
190
- edit: z5.string(),
255
+ edit: z6.string(),
191
256
  /** Current value of the data resource's variables (if any) */
192
- currentValue: z5.record(z5.string(), z5.string()).optional()
257
+ currentValue: z6.record(z6.string(), z6.string()).optional()
193
258
  }),
194
259
  /** AI invocation context */
195
260
  invocationContext: invocationContextsSchema,
196
261
  /** User ID making the edit */
197
- userId: z5.string(),
262
+ userId: z6.string(),
198
263
  /** Project ID */
199
- projectId: z5.string()
264
+ projectId: z6.string()
200
265
  });
201
- var createAIDataResourceEditResultSchema = z5.strictObject({
202
- outputJsonSchema: z5.record(z5.string(), z5.any()).describe("JSON schema (draft-07) for the edited data resource result"),
203
- instructions: z5.string().describe(
266
+ var createAIDataResourceEditResultSchema = z6.strictObject({
267
+ outputJsonSchema: z6.record(z6.string(), z6.any()).describe("JSON schema (draft-07) for the edited data resource result"),
268
+ instructions: z6.string().describe(
204
269
  "Instructions for the AI editor LLM to follow when editing this data resource (e.g. conventions/rules, allowed values, data format expectations, etc). Describe how to transform or edit the data resource content."
205
270
  )
206
271
  });
207
272
 
208
273
  // src/createAIEdit.ts
209
- import * as z6 from "zod/v3";
210
- var createAIEditContextSchema = z6.strictObject({
274
+ import * as z7 from "zod";
275
+ var createAIEditContextSchema = z7.strictObject({
211
276
  editRequest: createPropertyEdit.inputSchema,
212
277
  invocationContext: invocationContextsSchema,
213
- userId: z6.string(),
214
- currentLocale: z6.string().optional(),
215
- projectId: z6.string()
278
+ userId: z7.string(),
279
+ currentLocale: z7.string().optional(),
280
+ projectId: z7.string()
216
281
  });
217
- var createAIEditResultSchema = z6.strictObject({
218
- outputJsonSchema: z6.record(z6.string(), z6.any()).describe("JSON schema (draft-07) for the edited content result"),
219
- instructions: z6.string().describe(
282
+ var createAIEditResultSchema = z7.strictObject({
283
+ outputJsonSchema: z7.record(z7.string(), z7.any()).describe("JSON schema (draft-07) for the edited content result"),
284
+ instructions: z7.string().describe(
220
285
  "Instructions for the AI editor LLM to follow (e.g. conventions/rules, allowed values, etc). Just describe your value type, do not give guiding instructions. There is no need to worry about clearing or resetting values, that is automatically handled."
221
286
  )
222
287
  });
@@ -260,80 +325,81 @@ function copyKeyValuePairs(source, target) {
260
325
  }
261
326
 
262
327
  // src/preRequest.ts
263
- import * as z8 from "zod/v3";
328
+ import * as z9 from "zod";
264
329
 
265
330
  // src/shared.ts
266
331
  import { assert } from "tsafe";
267
- import * as z7 from "zod/v3";
268
- var parameterDefinitionSchema = z7.object({
269
- key: z7.string(),
270
- value: z7.string(),
271
- omitIfEmpty: z7.boolean().optional()
332
+ import * as z8 from "zod";
333
+ var parameterDefinitionSchema = z8.object({
334
+ key: z8.string(),
335
+ value: z8.string(),
336
+ omitIfEmpty: z8.boolean().optional()
272
337
  });
273
- var resolvingIssueSchema = z7.union([
274
- z7.string(),
275
- z7.object({
276
- message: z7.string(),
277
- subType: z7.enum(["unpublishedData", "configuration"]).optional(),
278
- issueReference: z7.string().optional(),
279
- deepLink: z7.string().optional()
338
+ var resolvingIssueSchema = z8.union([
339
+ z8.string(),
340
+ z8.object({
341
+ message: z8.string(),
342
+ subType: z8.enum(["unpublishedData", "configuration"]).optional(),
343
+ issueReference: z8.string().optional(),
344
+ deepLink: z8.string().optional(),
345
+ statusCode: z8.number().int().optional()
280
346
  })
281
347
  ]);
282
- var variableDefinitionSchema = z7.object({
283
- displayName: z7.string().optional(),
284
- type: z7.string().optional(),
285
- default: z7.string(),
286
- helpText: z7.string().optional(),
287
- order: z7.number().optional(),
288
- source: z7.string().optional()
348
+ var variableDefinitionSchema = z8.object({
349
+ displayName: z8.string().optional(),
350
+ type: z8.string().optional(),
351
+ default: z8.string(),
352
+ helpText: z8.string().optional(),
353
+ order: z8.number().optional(),
354
+ source: z8.string().optional()
289
355
  });
290
- var customEdgehancerDefinitionSchema = z7.object({
291
- preRequest: z7.string().optional(),
292
- request: z7.string().optional(),
293
- createAIDataResourceEdit: z7.string().optional(),
294
- afterAIDataResourceEdit: z7.string().optional()
356
+ var customEdgehancerDefinitionSchema = z8.object({
357
+ preRequest: z8.string().optional(),
358
+ request: z8.string().optional(),
359
+ createAIDataResourceEdit: z8.string().optional(),
360
+ afterAIDataResourceEdit: z8.string().optional()
295
361
  });
296
- var dataSourceVariantSchema = z7.intersection(
297
- z7.object({
298
- headers: z7.array(parameterDefinitionSchema).optional(),
299
- parameters: z7.array(parameterDefinitionSchema).optional(),
300
- variables: z7.record(variableDefinitionSchema).optional()
362
+ var dataSourceVariantSchema = z8.intersection(
363
+ z8.object({
364
+ headers: z8.array(parameterDefinitionSchema).optional(),
365
+ parameters: z8.array(parameterDefinitionSchema).optional(),
366
+ variables: z8.record(z8.string(), variableDefinitionSchema).optional()
301
367
  }),
302
- z7.object({ url: z7.string() })
368
+ z8.object({ url: z8.string() })
303
369
  );
304
- var mergedDataTypeSchema = z7.object({
305
- id: z7.string(),
306
- displayName: z7.string(),
307
- archetype: z7.string().optional(),
308
- allowedOnComponents: z7.array(z7.string()).optional(),
309
- badgeIconUrl: z7.string().optional(),
310
- connectorType: z7.string(),
311
- url: z7.string(),
312
- headers: z7.array(parameterDefinitionSchema).optional(),
313
- parameters: z7.array(parameterDefinitionSchema).optional(),
314
- body: z7.string().optional(),
315
- method: z7.enum(["GET", "POST", "HEAD"]),
316
- variables: z7.record(variableDefinitionSchema).optional(),
317
- custom: z7.record(z7.unknown()).optional(),
318
- customPublic: z7.record(z7.unknown()).optional(),
319
- ttl: z7.number().optional(),
320
- purgeKey: z7.string().optional(),
321
- localeMapping: z7.record(z7.string()).optional(),
370
+ var mergedDataTypeSchema = z8.object({
371
+ id: z8.string(),
372
+ displayName: z8.string(),
373
+ archetype: z8.string().optional(),
374
+ allowedOnComponents: z8.array(z8.string()).optional(),
375
+ badgeIconUrl: z8.string().optional(),
376
+ connectorType: z8.string(),
377
+ url: z8.string(),
378
+ headers: z8.array(parameterDefinitionSchema).optional(),
379
+ parameters: z8.array(parameterDefinitionSchema).optional(),
380
+ body: z8.string().optional(),
381
+ method: z8.enum(["GET", "POST", "HEAD"]),
382
+ variables: z8.record(z8.string(), variableDefinitionSchema).optional(),
383
+ custom: z8.record(z8.string(), z8.unknown()).optional(),
384
+ customPublic: z8.record(z8.string(), z8.unknown()).optional(),
385
+ ttl: z8.number().optional(),
386
+ purgeKey: z8.string().optional(),
387
+ localeMapping: z8.record(z8.string(), z8.string()).optional(),
322
388
  edgehancer: customEdgehancerDefinitionSchema.optional(),
323
- uiBadgeText: z7.string().max(12).optional(),
324
- variants: z7.object({
389
+ uiBadgeText: z8.string().max(12).optional(),
390
+ variants: z8.object({
325
391
  unpublished: dataSourceVariantSchema.optional()
326
392
  }).optional(),
327
- enableUnpublishedMode: z7.boolean().optional()
393
+ enableUnpublishedMode: z8.boolean().optional()
328
394
  });
329
395
  assert();
330
- var dataResourceSchema = z7.union([
331
- z7.string(),
332
- z7.object({}).catchall(z7.unknown()),
333
- z7.number(),
334
- z7.boolean(),
335
- z7.array(z7.unknown()),
336
- z7.undefined()
396
+ var dataResourceSchema = z8.union([
397
+ z8.string(),
398
+ z8.object({}).catchall(z8.unknown()),
399
+ z8.number(),
400
+ z8.boolean(),
401
+ z8.array(z8.unknown()),
402
+ z8.undefined()
337
403
  ]);
338
404
 
339
405
  // src/preRequest.ts
@@ -343,36 +409,35 @@ var edgehancerMergedDataTypeSchema = mergedDataTypeSchema.omit({
343
409
  badgeIconUrl: true,
344
410
  displayName: true,
345
411
  id: true,
346
- purgeKey: true,
347
- variables: true
412
+ purgeKey: true
348
413
  });
349
- var preRequestEdgehancerDataResourceResultSchema = z8.strictObject({
350
- errors: z8.array(resolvingIssueSchema).optional(),
351
- warnings: z8.array(resolvingIssueSchema).optional(),
352
- infos: z8.array(resolvingIssueSchema).optional(),
414
+ var preRequestEdgehancerDataResourceResultSchema = z9.strictObject({
415
+ errors: z9.array(resolvingIssueSchema).optional(),
416
+ warnings: z9.array(resolvingIssueSchema).optional(),
417
+ infos: z9.array(resolvingIssueSchema).optional(),
353
418
  dataResource: edgehancerMergedDataTypeSchema
354
419
  });
355
- var preRequestEdgehancerResultSchema = z8.strictObject({
356
- dataResources: z8.array(preRequestEdgehancerDataResourceResultSchema)
420
+ var preRequestEdgehancerResultSchema = z9.strictObject({
421
+ dataResources: z9.array(preRequestEdgehancerDataResourceResultSchema)
357
422
  });
358
423
 
359
424
  // src/request.ts
360
- import * as z9 from "zod/v3";
361
- var requestEdgehancerDataResourceResolutionResultSchema = z9.strictObject({
362
- errors: z9.array(resolvingIssueSchema).optional().describe(
425
+ import * as z10 from "zod";
426
+ var requestEdgehancerDataResourceResolutionResultSchema = z10.strictObject({
427
+ errors: z10.array(resolvingIssueSchema).optional().describe(
363
428
  "Errors that occurred while running your code to return with the API response, if any. Unhandled exceptions will be captured automatically."
364
429
  ),
365
- warnings: z9.array(resolvingIssueSchema).optional().describe("Warnings that occurred while running your code to return with the API response, if any."),
366
- infos: z9.array(resolvingIssueSchema).optional().describe(
430
+ warnings: z10.array(resolvingIssueSchema).optional().describe("Warnings that occurred while running your code to return with the API response, if any."),
431
+ infos: z10.array(resolvingIssueSchema).optional().describe(
367
432
  "Informational messages that occurred while running your code to return with the API response, if any."
368
433
  ),
369
- surrogateKeys: z9.array(z9.string()).optional().describe(
434
+ surrogateKeys: z10.array(z10.string()).optional().describe(
370
435
  "Extra surrogate keys for the data that was fetched. These act as auxiliary cache keys that can allow granular purging of cached data."
371
436
  ),
372
- result: dataResourceSchema.describe("The result of fetching the data resource")
437
+ result: dataResourceSchema.describe("The result of fetching the data resource").optional()
373
438
  });
374
- var requestEdgehancerResultSchema = z9.strictObject({
375
- results: z9.array(requestEdgehancerDataResourceResolutionResultSchema)
439
+ var requestEdgehancerResultSchema = z10.strictObject({
440
+ results: z10.array(requestEdgehancerDataResourceResolutionResultSchema)
376
441
  });
377
442
  export {
378
443
  COLLECTION_DEFAULT_LIMIT,