skedyul 1.5.2 → 1.5.12
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/cli/index.js +18 -7
- package/dist/config/queue-config.d.ts +4 -0
- package/dist/config/types/channel.d.ts +16 -0
- package/dist/dedicated/server.js +16 -6
- package/dist/esm/index.mjs +1358 -1090
- package/dist/estimation/index.d.ts +2 -0
- package/dist/estimation/index.js +151 -0
- package/dist/estimation/index.mjs +116 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +1377 -1090
- package/dist/ratelimit/context.d.ts +4 -2
- package/dist/schemas.d.ts +143 -0
- package/dist/server/utils/schema.d.ts +3 -3
- package/dist/server.js +16 -6
- package/dist/serverless/server.mjs +16 -6
- package/dist/tools/sms/gsm7.d.ts +11 -0
- package/dist/types/estimation.d.ts +95 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/tool.d.ts +27 -2
- package/package.json +9 -3
package/dist/esm/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { z as
|
|
4
|
+
import { z as z16 } from "zod/v4";
|
|
5
5
|
|
|
6
6
|
// src/types/invocation.ts
|
|
7
7
|
function createToolCallContext(params) {
|
|
@@ -56,12 +56,118 @@ function isCronContext(ctx) {
|
|
|
56
56
|
return ctx.trigger === "cron";
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
// src/types/
|
|
59
|
+
// src/types/estimation.ts
|
|
60
60
|
import { z } from "zod/v4";
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
var MoneyMinorRangeSchema = z.object({
|
|
62
|
+
currency: z.string().min(3).max(3),
|
|
63
|
+
minorUnitsLow: z.number().int().nonnegative(),
|
|
64
|
+
minorUnitsHigh: z.number().int().nonnegative(),
|
|
65
|
+
minorUnitsExpected: z.number().int().nonnegative().optional()
|
|
66
|
+
});
|
|
67
|
+
var EstimationSkippedBreakdownSchema = z.object({
|
|
68
|
+
missingAddress: z.number().int().nonnegative(),
|
|
69
|
+
optOut: z.number().int().nonnegative(),
|
|
70
|
+
emptyMessage: z.number().int().nonnegative(),
|
|
71
|
+
unavailable: z.number().int().nonnegative()
|
|
72
|
+
});
|
|
73
|
+
var EstimationSchema = z.object({
|
|
74
|
+
deliverableCount: z.number().int().nonnegative(),
|
|
75
|
+
skippedCount: z.number().int().nonnegative().optional(),
|
|
76
|
+
skippedBreakdown: EstimationSkippedBreakdownSchema.optional(),
|
|
77
|
+
cost: MoneyMinorRangeSchema.optional()
|
|
78
|
+
});
|
|
79
|
+
function createMoneyMinorRange(params) {
|
|
80
|
+
return {
|
|
81
|
+
currency: params.currency,
|
|
82
|
+
minorUnitsLow: params.minorUnitsLow,
|
|
83
|
+
minorUnitsHigh: params.minorUnitsHigh,
|
|
84
|
+
...params.minorUnitsExpected !== void 0 ? { minorUnitsExpected: params.minorUnitsExpected } : {}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function createEstimation(params) {
|
|
88
|
+
return {
|
|
89
|
+
deliverableCount: params.deliverableCount,
|
|
90
|
+
...params.skippedCount !== void 0 ? { skippedCount: params.skippedCount } : {},
|
|
91
|
+
...params.skippedBreakdown ? { skippedBreakdown: params.skippedBreakdown } : {},
|
|
92
|
+
...params.cost ? { cost: params.cost } : {}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function computeSkewedExpectedMinorUnits(range) {
|
|
96
|
+
if (range.minorUnitsExpected !== void 0) {
|
|
97
|
+
return range.minorUnitsExpected;
|
|
98
|
+
}
|
|
99
|
+
if (range.minorUnitsLow === range.minorUnitsHigh) {
|
|
100
|
+
return range.minorUnitsLow;
|
|
101
|
+
}
|
|
102
|
+
return Math.round(0.8 * range.minorUnitsLow + 0.2 * range.minorUnitsHigh);
|
|
103
|
+
}
|
|
104
|
+
function formatMoneyMinorRange(range, locale) {
|
|
105
|
+
const formatter = new Intl.NumberFormat(locale, {
|
|
106
|
+
style: "currency",
|
|
107
|
+
currency: range.currency
|
|
108
|
+
});
|
|
109
|
+
const low = formatter.format(range.minorUnitsLow / 100);
|
|
110
|
+
const high = formatter.format(range.minorUnitsHigh / 100);
|
|
111
|
+
if (range.minorUnitsLow === range.minorUnitsHigh) {
|
|
112
|
+
return low;
|
|
113
|
+
}
|
|
114
|
+
return `${low} \u2013 ${high}`;
|
|
115
|
+
}
|
|
116
|
+
function formatMoneyMinorEstimate(range, options) {
|
|
117
|
+
const formatter = new Intl.NumberFormat(options?.locale, {
|
|
118
|
+
style: "currency",
|
|
119
|
+
currency: range.currency
|
|
120
|
+
});
|
|
121
|
+
const maxSpreadRatio = options?.maxSpreadRatio ?? 4;
|
|
122
|
+
const spreadRatio = range.minorUnitsLow > 0 ? range.minorUnitsHigh / range.minorUnitsLow : 1;
|
|
123
|
+
if (spreadRatio > maxSpreadRatio) {
|
|
124
|
+
return formatMoneyMinorRange(range, options?.locale);
|
|
125
|
+
}
|
|
126
|
+
const expectedMinorUnits = options?.expectedMinorUnits ?? computeSkewedExpectedMinorUnits(range);
|
|
127
|
+
const expected = formatter.format(expectedMinorUnits / 100);
|
|
128
|
+
if (range.minorUnitsLow === range.minorUnitsHigh) {
|
|
129
|
+
return expected;
|
|
130
|
+
}
|
|
131
|
+
return `~${expected}`;
|
|
132
|
+
}
|
|
133
|
+
function parseEstimationFromBilling(billing) {
|
|
134
|
+
if (!billing || typeof billing !== "object") {
|
|
135
|
+
return void 0;
|
|
136
|
+
}
|
|
137
|
+
const record2 = billing;
|
|
138
|
+
const nested = record2.estimation;
|
|
139
|
+
if (nested && typeof nested === "object") {
|
|
140
|
+
const parsed = EstimationSchema.safeParse(nested);
|
|
141
|
+
if (parsed.success) {
|
|
142
|
+
return parsed.data;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const currency = typeof record2.currency === "string" && record2.currency.trim() !== "" ? record2.currency : void 0;
|
|
146
|
+
const minorUnitsLow = typeof record2.minorUnitsLow === "number" ? record2.minorUnitsLow : typeof record2.costCentsLow === "number" ? record2.costCentsLow : void 0;
|
|
147
|
+
const minorUnitsHigh = typeof record2.minorUnitsHigh === "number" ? record2.minorUnitsHigh : typeof record2.costCentsHigh === "number" ? record2.costCentsHigh : void 0;
|
|
148
|
+
const minorUnitsExpected = typeof record2.minorUnitsExpected === "number" ? record2.minorUnitsExpected : typeof record2.costCentsExpected === "number" ? record2.costCentsExpected : void 0;
|
|
149
|
+
const deliverableCount = typeof record2.deliverableCount === "number" ? record2.deliverableCount : void 0;
|
|
150
|
+
if (deliverableCount === void 0 || minorUnitsLow === void 0 || minorUnitsHigh === void 0 || !currency) {
|
|
151
|
+
return void 0;
|
|
152
|
+
}
|
|
153
|
+
return createEstimation({
|
|
154
|
+
deliverableCount,
|
|
155
|
+
skippedCount: typeof record2.skippedCount === "number" ? record2.skippedCount : void 0,
|
|
156
|
+
cost: createMoneyMinorRange({
|
|
157
|
+
currency,
|
|
158
|
+
minorUnitsLow,
|
|
159
|
+
minorUnitsHigh,
|
|
160
|
+
...minorUnitsExpected !== void 0 ? { minorUnitsExpected } : {}
|
|
161
|
+
})
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// src/types/tool.ts
|
|
166
|
+
import { z as z2 } from "zod/v4";
|
|
167
|
+
var ToolResponseMetaSchema = z2.object({
|
|
168
|
+
success: z2.boolean(),
|
|
169
|
+
message: z2.string(),
|
|
170
|
+
toolName: z2.string()
|
|
65
171
|
});
|
|
66
172
|
|
|
67
173
|
// src/types/tool-response.ts
|
|
@@ -202,11 +308,11 @@ function isRuntimeWebhookContext(ctx) {
|
|
|
202
308
|
}
|
|
203
309
|
|
|
204
310
|
// src/schemas.ts
|
|
205
|
-
import { z as
|
|
311
|
+
import { z as z8 } from "zod/v4";
|
|
206
312
|
|
|
207
313
|
// src/schemas/crm-schema.ts
|
|
208
|
-
import { z as
|
|
209
|
-
var CRMFieldTypeSchema =
|
|
314
|
+
import { z as z3 } from "zod/v4";
|
|
315
|
+
var CRMFieldTypeSchema = z3.enum([
|
|
210
316
|
"string",
|
|
211
317
|
"long_string",
|
|
212
318
|
"number",
|
|
@@ -218,125 +324,125 @@ var CRMFieldTypeSchema = z2.enum([
|
|
|
218
324
|
"image",
|
|
219
325
|
"object"
|
|
220
326
|
]);
|
|
221
|
-
var CRMFieldRequirementSchema =
|
|
327
|
+
var CRMFieldRequirementSchema = z3.enum([
|
|
222
328
|
"optional",
|
|
223
329
|
"on_create",
|
|
224
330
|
"required"
|
|
225
331
|
]);
|
|
226
|
-
var CRMFieldOptionSchema =
|
|
227
|
-
label:
|
|
228
|
-
value:
|
|
229
|
-
color:
|
|
230
|
-
});
|
|
231
|
-
var CRMFieldDefinitionObjectSchema =
|
|
232
|
-
options:
|
|
233
|
-
limitChoices:
|
|
234
|
-
minLength:
|
|
235
|
-
maxLength:
|
|
236
|
-
min:
|
|
237
|
-
max:
|
|
238
|
-
pattern:
|
|
239
|
-
});
|
|
240
|
-
var CRMFieldDefinitionSchema =
|
|
241
|
-
|
|
332
|
+
var CRMFieldOptionSchema = z3.object({
|
|
333
|
+
label: z3.string(),
|
|
334
|
+
value: z3.string(),
|
|
335
|
+
color: z3.string().optional()
|
|
336
|
+
});
|
|
337
|
+
var CRMFieldDefinitionObjectSchema = z3.object({
|
|
338
|
+
options: z3.array(CRMFieldOptionSchema).optional(),
|
|
339
|
+
limitChoices: z3.number().optional(),
|
|
340
|
+
minLength: z3.number().optional(),
|
|
341
|
+
maxLength: z3.number().optional(),
|
|
342
|
+
min: z3.number().optional(),
|
|
343
|
+
max: z3.number().optional(),
|
|
344
|
+
pattern: z3.string().optional()
|
|
345
|
+
});
|
|
346
|
+
var CRMFieldDefinitionSchema = z3.union([
|
|
347
|
+
z3.string(),
|
|
242
348
|
CRMFieldDefinitionObjectSchema
|
|
243
349
|
]);
|
|
244
|
-
var CRMFieldAppearanceSchemaZ =
|
|
245
|
-
leftIcon:
|
|
246
|
-
rightIcon:
|
|
247
|
-
placeholder:
|
|
248
|
-
helpText:
|
|
249
|
-
});
|
|
250
|
-
var CRMFieldSchemaZ =
|
|
251
|
-
handle:
|
|
252
|
-
label:
|
|
350
|
+
var CRMFieldAppearanceSchemaZ = z3.object({
|
|
351
|
+
leftIcon: z3.string().optional(),
|
|
352
|
+
rightIcon: z3.string().optional(),
|
|
353
|
+
placeholder: z3.string().optional(),
|
|
354
|
+
helpText: z3.string().optional()
|
|
355
|
+
});
|
|
356
|
+
var CRMFieldSchemaZ = z3.object({
|
|
357
|
+
handle: z3.string().regex(/^[a-z][a-z0-9_]*$/, "Handle must be lowercase alphanumeric with underscores, starting with a letter"),
|
|
358
|
+
label: z3.string().min(1, "Label is required"),
|
|
253
359
|
type: CRMFieldTypeSchema,
|
|
254
360
|
/** Field description - explains what the field is for (metadata, not UI) */
|
|
255
|
-
description:
|
|
361
|
+
description: z3.string().optional(),
|
|
256
362
|
/** Field appearance - UI presentation settings */
|
|
257
363
|
appearance: CRMFieldAppearanceSchemaZ.optional(),
|
|
258
364
|
requirement: CRMFieldRequirementSchema.optional(),
|
|
259
|
-
unique:
|
|
260
|
-
list:
|
|
261
|
-
default:
|
|
365
|
+
unique: z3.boolean().optional(),
|
|
366
|
+
list: z3.boolean().optional(),
|
|
367
|
+
default: z3.unknown().optional(),
|
|
262
368
|
definition: CRMFieldDefinitionSchema.optional()
|
|
263
369
|
});
|
|
264
|
-
var CRMModelSchemaZ =
|
|
265
|
-
handle:
|
|
266
|
-
name:
|
|
267
|
-
namePlural:
|
|
268
|
-
labelTemplate:
|
|
269
|
-
description:
|
|
270
|
-
icon:
|
|
271
|
-
fields:
|
|
272
|
-
});
|
|
273
|
-
var CRMCardinalitySchema =
|
|
274
|
-
var CRMOnDeleteSchema =
|
|
275
|
-
var CRMRelationshipLinkSchema =
|
|
276
|
-
model:
|
|
277
|
-
field:
|
|
278
|
-
label:
|
|
279
|
-
});
|
|
280
|
-
var CRMRelationshipSchemaZ =
|
|
370
|
+
var CRMModelSchemaZ = z3.object({
|
|
371
|
+
handle: z3.string().regex(/^[a-z][a-z0-9_]*$/, "Handle must be lowercase alphanumeric with underscores, starting with a letter"),
|
|
372
|
+
name: z3.string().min(1, "Name is required"),
|
|
373
|
+
namePlural: z3.string().optional(),
|
|
374
|
+
labelTemplate: z3.string().optional(),
|
|
375
|
+
description: z3.string().optional(),
|
|
376
|
+
icon: z3.string().optional(),
|
|
377
|
+
fields: z3.array(CRMFieldSchemaZ)
|
|
378
|
+
});
|
|
379
|
+
var CRMCardinalitySchema = z3.enum(["one_to_one", "one_to_many"]);
|
|
380
|
+
var CRMOnDeleteSchema = z3.enum(["none", "cascade", "restrict"]);
|
|
381
|
+
var CRMRelationshipLinkSchema = z3.object({
|
|
382
|
+
model: z3.string(),
|
|
383
|
+
field: z3.string(),
|
|
384
|
+
label: z3.string()
|
|
385
|
+
});
|
|
386
|
+
var CRMRelationshipSchemaZ = z3.object({
|
|
281
387
|
source: CRMRelationshipLinkSchema,
|
|
282
388
|
target: CRMRelationshipLinkSchema,
|
|
283
389
|
cardinality: CRMCardinalitySchema,
|
|
284
390
|
onDelete: CRMOnDeleteSchema.optional()
|
|
285
391
|
});
|
|
286
|
-
var CRMBlockTypeSchema =
|
|
392
|
+
var CRMBlockTypeSchema = z3.enum([
|
|
287
393
|
"spreadsheet",
|
|
288
394
|
"form",
|
|
289
395
|
"card",
|
|
290
396
|
"metric",
|
|
291
397
|
"kanban"
|
|
292
398
|
]);
|
|
293
|
-
var CRMBlockSchemaZ =
|
|
399
|
+
var CRMBlockSchemaZ = z3.object({
|
|
294
400
|
type: CRMBlockTypeSchema,
|
|
295
|
-
title:
|
|
296
|
-
config:
|
|
297
|
-
default:
|
|
401
|
+
title: z3.string().optional(),
|
|
402
|
+
config: z3.unknown().optional(),
|
|
403
|
+
default: z3.boolean().optional()
|
|
298
404
|
});
|
|
299
|
-
var CRMPageTypeSchema =
|
|
300
|
-
var CRMPageSchemaZ =
|
|
301
|
-
path:
|
|
405
|
+
var CRMPageTypeSchema = z3.enum(["list", "instance"]);
|
|
406
|
+
var CRMPageSchemaZ = z3.object({
|
|
407
|
+
path: z3.string(),
|
|
302
408
|
type: CRMPageTypeSchema,
|
|
303
|
-
title:
|
|
304
|
-
icon:
|
|
305
|
-
modelHandle:
|
|
306
|
-
parentPath:
|
|
307
|
-
baseQuery:
|
|
308
|
-
blocks:
|
|
309
|
-
});
|
|
310
|
-
var CRMNavigationNodeBaseSchemaZ =
|
|
311
|
-
label:
|
|
312
|
-
icon:
|
|
313
|
-
path:
|
|
314
|
-
kind:
|
|
315
|
-
sortIndex:
|
|
316
|
-
});
|
|
317
|
-
var CRMNavigationItemSchemaZ =
|
|
409
|
+
title: z3.string(),
|
|
410
|
+
icon: z3.string().optional(),
|
|
411
|
+
modelHandle: z3.string(),
|
|
412
|
+
parentPath: z3.string().optional(),
|
|
413
|
+
baseQuery: z3.unknown().optional(),
|
|
414
|
+
blocks: z3.array(CRMBlockSchemaZ).optional()
|
|
415
|
+
});
|
|
416
|
+
var CRMNavigationNodeBaseSchemaZ = z3.object({
|
|
417
|
+
label: z3.string(),
|
|
418
|
+
icon: z3.string().optional(),
|
|
419
|
+
path: z3.string().optional(),
|
|
420
|
+
kind: z3.enum(["section", "group"]).optional(),
|
|
421
|
+
sortIndex: z3.number().optional()
|
|
422
|
+
});
|
|
423
|
+
var CRMNavigationItemSchemaZ = z3.lazy(
|
|
318
424
|
() => CRMNavigationNodeBaseSchemaZ.extend({
|
|
319
|
-
children:
|
|
425
|
+
children: z3.array(CRMNavigationItemSchemaZ).optional()
|
|
320
426
|
})
|
|
321
427
|
);
|
|
322
|
-
var CRMNavigationSchemaZ =
|
|
323
|
-
sidebar:
|
|
428
|
+
var CRMNavigationSchemaZ = z3.object({
|
|
429
|
+
sidebar: z3.array(CRMNavigationItemSchemaZ).optional()
|
|
324
430
|
});
|
|
325
|
-
var CRMSchemaZ =
|
|
431
|
+
var CRMSchemaZ = z3.object({
|
|
326
432
|
/** Schema format version for future compatibility */
|
|
327
|
-
$schema:
|
|
433
|
+
$schema: z3.literal("https://skedyul.com/schemas/crm/v1").optional(),
|
|
328
434
|
/** Schema name for identification */
|
|
329
|
-
name:
|
|
435
|
+
name: z3.string().min(1, "Name is required"),
|
|
330
436
|
/** Optional description */
|
|
331
|
-
description:
|
|
437
|
+
description: z3.string().optional(),
|
|
332
438
|
/** Schema version (semver) */
|
|
333
|
-
version:
|
|
439
|
+
version: z3.string().optional(),
|
|
334
440
|
/** Model definitions */
|
|
335
|
-
models:
|
|
441
|
+
models: z3.array(CRMModelSchemaZ),
|
|
336
442
|
/** Relationship definitions */
|
|
337
|
-
relationships:
|
|
443
|
+
relationships: z3.array(CRMRelationshipSchemaZ).optional(),
|
|
338
444
|
/** Page definitions */
|
|
339
|
-
pages:
|
|
445
|
+
pages: z3.array(CRMPageSchemaZ).optional(),
|
|
340
446
|
/** Navigation definitions */
|
|
341
447
|
navigation: CRMNavigationSchemaZ.optional()
|
|
342
448
|
});
|
|
@@ -363,11 +469,11 @@ function safeParseCRMSchema(data) {
|
|
|
363
469
|
}
|
|
364
470
|
|
|
365
471
|
// src/schemas/agent-schema-v3.ts
|
|
366
|
-
import { z as
|
|
472
|
+
import { z as z7 } from "zod/v4";
|
|
367
473
|
|
|
368
474
|
// src/events/types.ts
|
|
369
|
-
import { z as
|
|
370
|
-
var ThreadEventTypeSchema =
|
|
475
|
+
import { z as z4 } from "zod/v4";
|
|
476
|
+
var ThreadEventTypeSchema = z4.enum([
|
|
371
477
|
// Message events
|
|
372
478
|
"thread.message.received",
|
|
373
479
|
"thread.message.sent",
|
|
@@ -389,73 +495,73 @@ var ThreadEventTypeSchema = z3.enum([
|
|
|
389
495
|
// Signal events
|
|
390
496
|
"thread.signal.created"
|
|
391
497
|
]);
|
|
392
|
-
var CustomEventTypeSchema =
|
|
498
|
+
var CustomEventTypeSchema = z4.string().regex(/^custom\.[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$/, {
|
|
393
499
|
message: "Custom event type must match pattern: custom.{namespace}.{event}"
|
|
394
500
|
});
|
|
395
|
-
var EventTypeSchema =
|
|
396
|
-
var ParticipantKindSchema =
|
|
397
|
-
var BaseEventPayloadSchema =
|
|
398
|
-
threadId:
|
|
399
|
-
workplaceId:
|
|
400
|
-
timestamp:
|
|
501
|
+
var EventTypeSchema = z4.union([ThreadEventTypeSchema, CustomEventTypeSchema]);
|
|
502
|
+
var ParticipantKindSchema = z4.enum(["CONTACT", "MEMBER", "AGENT", "WORKFLOW"]);
|
|
503
|
+
var BaseEventPayloadSchema = z4.object({
|
|
504
|
+
threadId: z4.string(),
|
|
505
|
+
workplaceId: z4.string(),
|
|
506
|
+
timestamp: z4.string().datetime().optional()
|
|
401
507
|
});
|
|
402
508
|
var MessageEventPayloadSchema = BaseEventPayloadSchema.extend({
|
|
403
|
-
message:
|
|
404
|
-
id:
|
|
405
|
-
content:
|
|
406
|
-
senderId:
|
|
509
|
+
message: z4.object({
|
|
510
|
+
id: z4.string(),
|
|
511
|
+
content: z4.string(),
|
|
512
|
+
senderId: z4.string().optional()
|
|
407
513
|
}),
|
|
408
|
-
participant:
|
|
409
|
-
id:
|
|
514
|
+
participant: z4.object({
|
|
515
|
+
id: z4.string(),
|
|
410
516
|
kind: ParticipantKindSchema,
|
|
411
|
-
displayName:
|
|
517
|
+
displayName: z4.string().optional()
|
|
412
518
|
}).optional(),
|
|
413
|
-
isFirstMessage:
|
|
414
|
-
messageCount:
|
|
519
|
+
isFirstMessage: z4.boolean().optional(),
|
|
520
|
+
messageCount: z4.number().optional()
|
|
415
521
|
});
|
|
416
522
|
var ParticipantEventPayloadSchema = BaseEventPayloadSchema.extend({
|
|
417
|
-
participant:
|
|
418
|
-
id:
|
|
523
|
+
participant: z4.object({
|
|
524
|
+
id: z4.string(),
|
|
419
525
|
kind: ParticipantKindSchema,
|
|
420
|
-
displayName:
|
|
421
|
-
contactId:
|
|
422
|
-
memberId:
|
|
423
|
-
agentId:
|
|
424
|
-
workflowId:
|
|
526
|
+
displayName: z4.string().optional(),
|
|
527
|
+
contactId: z4.string().optional(),
|
|
528
|
+
memberId: z4.string().optional(),
|
|
529
|
+
agentId: z4.string().optional(),
|
|
530
|
+
workflowId: z4.string().optional()
|
|
425
531
|
})
|
|
426
532
|
});
|
|
427
533
|
var ContextChangedPayloadSchema = BaseEventPayloadSchema.extend({
|
|
428
|
-
context:
|
|
429
|
-
handle:
|
|
430
|
-
model:
|
|
431
|
-
instanceId:
|
|
534
|
+
context: z4.object({
|
|
535
|
+
handle: z4.string(),
|
|
536
|
+
model: z4.string(),
|
|
537
|
+
instanceId: z4.string()
|
|
432
538
|
}),
|
|
433
|
-
change:
|
|
434
|
-
field:
|
|
435
|
-
oldValue:
|
|
436
|
-
newValue:
|
|
539
|
+
change: z4.object({
|
|
540
|
+
field: z4.string().optional(),
|
|
541
|
+
oldValue: z4.unknown().optional(),
|
|
542
|
+
newValue: z4.unknown().optional()
|
|
437
543
|
}).optional()
|
|
438
544
|
});
|
|
439
545
|
var StatusChangedPayloadSchema = BaseEventPayloadSchema.extend({
|
|
440
|
-
oldStatus:
|
|
441
|
-
newStatus:
|
|
546
|
+
oldStatus: z4.string(),
|
|
547
|
+
newStatus: z4.string()
|
|
442
548
|
});
|
|
443
549
|
var ScheduledEventPayloadSchema = BaseEventPayloadSchema.extend({
|
|
444
|
-
scheduledEventId:
|
|
445
|
-
reason:
|
|
446
|
-
context:
|
|
550
|
+
scheduledEventId: z4.string(),
|
|
551
|
+
reason: z4.string().optional(),
|
|
552
|
+
context: z4.record(z4.string(), z4.unknown()).optional()
|
|
447
553
|
});
|
|
448
554
|
var AgentWorkflowEventPayloadSchema = BaseEventPayloadSchema.extend({
|
|
449
|
-
agentId:
|
|
450
|
-
workflowId:
|
|
451
|
-
workflowRunId:
|
|
452
|
-
outputs:
|
|
453
|
-
error:
|
|
555
|
+
agentId: z4.string().optional(),
|
|
556
|
+
workflowId: z4.string().optional(),
|
|
557
|
+
workflowRunId: z4.string().optional(),
|
|
558
|
+
outputs: z4.record(z4.string(), z4.unknown()).optional(),
|
|
559
|
+
error: z4.string().optional()
|
|
454
560
|
});
|
|
455
561
|
var CustomEventPayloadSchema = BaseEventPayloadSchema.extend({
|
|
456
|
-
data:
|
|
562
|
+
data: z4.record(z4.string(), z4.unknown()).optional()
|
|
457
563
|
});
|
|
458
|
-
var ThreadEventPayloadSchema =
|
|
564
|
+
var ThreadEventPayloadSchema = z4.union([
|
|
459
565
|
MessageEventPayloadSchema,
|
|
460
566
|
ParticipantEventPayloadSchema,
|
|
461
567
|
ContextChangedPayloadSchema,
|
|
@@ -464,164 +570,164 @@ var ThreadEventPayloadSchema = z3.union([
|
|
|
464
570
|
AgentWorkflowEventPayloadSchema,
|
|
465
571
|
CustomEventPayloadSchema
|
|
466
572
|
]);
|
|
467
|
-
var ThreadEventSchema =
|
|
468
|
-
id:
|
|
469
|
-
threadId:
|
|
573
|
+
var ThreadEventSchema = z4.object({
|
|
574
|
+
id: z4.string(),
|
|
575
|
+
threadId: z4.string(),
|
|
470
576
|
type: EventTypeSchema,
|
|
471
577
|
payload: ThreadEventPayloadSchema,
|
|
472
|
-
emittedBy:
|
|
473
|
-
createdAt:
|
|
578
|
+
emittedBy: z4.string().optional(),
|
|
579
|
+
createdAt: z4.string().datetime()
|
|
474
580
|
});
|
|
475
|
-
var CreateThreadEventInputSchema =
|
|
476
|
-
threadId:
|
|
581
|
+
var CreateThreadEventInputSchema = z4.object({
|
|
582
|
+
threadId: z4.string(),
|
|
477
583
|
type: EventTypeSchema,
|
|
478
|
-
payload:
|
|
479
|
-
emittedBy:
|
|
584
|
+
payload: z4.record(z4.string(), z4.unknown()),
|
|
585
|
+
emittedBy: z4.string().optional()
|
|
480
586
|
});
|
|
481
|
-
var EventSubscriptionSchema =
|
|
482
|
-
subscribes:
|
|
483
|
-
condition:
|
|
484
|
-
cancels:
|
|
485
|
-
cancelCondition:
|
|
587
|
+
var EventSubscriptionSchema = z4.object({
|
|
588
|
+
subscribes: z4.array(EventTypeSchema),
|
|
589
|
+
condition: z4.string().optional(),
|
|
590
|
+
cancels: z4.array(EventTypeSchema).optional(),
|
|
591
|
+
cancelCondition: z4.string().optional()
|
|
486
592
|
});
|
|
487
|
-
var EventWaitSchema =
|
|
593
|
+
var EventWaitSchema = z4.object({
|
|
488
594
|
event: EventTypeSchema,
|
|
489
|
-
timeout:
|
|
490
|
-
onTimeout:
|
|
595
|
+
timeout: z4.string().optional(),
|
|
596
|
+
onTimeout: z4.string().optional()
|
|
491
597
|
});
|
|
492
|
-
var EventsConfigSchema =
|
|
493
|
-
subscribes:
|
|
494
|
-
condition:
|
|
495
|
-
emits:
|
|
496
|
-
waits:
|
|
497
|
-
cancels:
|
|
498
|
-
cancelCondition:
|
|
598
|
+
var EventsConfigSchema = z4.object({
|
|
599
|
+
subscribes: z4.array(EventTypeSchema).optional(),
|
|
600
|
+
condition: z4.string().optional(),
|
|
601
|
+
emits: z4.array(EventTypeSchema).optional(),
|
|
602
|
+
waits: z4.array(EventWaitSchema).optional(),
|
|
603
|
+
cancels: z4.array(EventTypeSchema).optional(),
|
|
604
|
+
cancelCondition: z4.string().optional()
|
|
499
605
|
});
|
|
500
606
|
|
|
501
607
|
// src/skills/types.ts
|
|
502
|
-
import { z as
|
|
608
|
+
import { z as z5 } from "zod/v4";
|
|
503
609
|
var SKILL_SCHEMA_VERSION = "https://skedyul.com/schemas/skill/v1";
|
|
504
610
|
var SKILL_SCHEMA_VERSION_V2 = "https://skedyul.com/schemas/skill/v2";
|
|
505
|
-
var SkillSourceSchema =
|
|
506
|
-
var SkillToolRequirementSchema =
|
|
507
|
-
requires:
|
|
508
|
-
provides:
|
|
509
|
-
});
|
|
510
|
-
var SkillToolSandboxSchema =
|
|
511
|
-
mock:
|
|
512
|
-
});
|
|
513
|
-
var ToolConstraintsSchema =
|
|
514
|
-
maxCallsPerRun:
|
|
515
|
-
idempotent:
|
|
516
|
-
restricted:
|
|
517
|
-
tags:
|
|
518
|
-
});
|
|
519
|
-
var SkillToolDefinitionSchema =
|
|
520
|
-
tool:
|
|
521
|
-
description:
|
|
522
|
-
overrides:
|
|
611
|
+
var SkillSourceSchema = z5.enum(["BUILTIN", "S3", "APP", "EXTERNAL"]);
|
|
612
|
+
var SkillToolRequirementSchema = z5.object({
|
|
613
|
+
requires: z5.array(z5.string()).optional(),
|
|
614
|
+
provides: z5.array(z5.string()).optional()
|
|
615
|
+
});
|
|
616
|
+
var SkillToolSandboxSchema = z5.object({
|
|
617
|
+
mock: z5.unknown().optional()
|
|
618
|
+
});
|
|
619
|
+
var ToolConstraintsSchema = z5.object({
|
|
620
|
+
maxCallsPerRun: z5.number().optional(),
|
|
621
|
+
idempotent: z5.boolean().optional(),
|
|
622
|
+
restricted: z5.boolean().optional(),
|
|
623
|
+
tags: z5.array(z5.string()).optional()
|
|
624
|
+
});
|
|
625
|
+
var SkillToolDefinitionSchema = z5.object({
|
|
626
|
+
tool: z5.string(),
|
|
627
|
+
description: z5.string().optional(),
|
|
628
|
+
overrides: z5.record(z5.string(), z5.unknown()).optional(),
|
|
523
629
|
sandbox: SkillToolSandboxSchema.optional(),
|
|
524
|
-
requiresApproval:
|
|
630
|
+
requiresApproval: z5.boolean().optional(),
|
|
525
631
|
constraints: ToolConstraintsSchema.optional()
|
|
526
632
|
});
|
|
527
|
-
var SkillToolsSchema =
|
|
633
|
+
var SkillToolsSchema = z5.union([
|
|
528
634
|
SkillToolRequirementSchema,
|
|
529
|
-
|
|
635
|
+
z5.array(SkillToolDefinitionSchema)
|
|
530
636
|
]);
|
|
531
|
-
var SkillExampleSchema =
|
|
532
|
-
context:
|
|
533
|
-
input:
|
|
534
|
-
reasoning:
|
|
535
|
-
output:
|
|
536
|
-
tool_call:
|
|
637
|
+
var SkillExampleSchema = z5.object({
|
|
638
|
+
context: z5.string().optional(),
|
|
639
|
+
input: z5.string(),
|
|
640
|
+
reasoning: z5.string().optional(),
|
|
641
|
+
output: z5.string(),
|
|
642
|
+
tool_call: z5.string().optional()
|
|
537
643
|
});
|
|
538
|
-
var CRMModelFieldRequirementsSchema =
|
|
539
|
-
required:
|
|
540
|
-
recommended:
|
|
644
|
+
var CRMModelFieldRequirementsSchema = z5.object({
|
|
645
|
+
required: z5.array(z5.string()).optional(),
|
|
646
|
+
recommended: z5.array(z5.string()).optional()
|
|
541
647
|
});
|
|
542
|
-
var CRMContextSchema =
|
|
543
|
-
models:
|
|
648
|
+
var CRMContextSchema = z5.object({
|
|
649
|
+
models: z5.record(z5.string(), CRMModelFieldRequirementsSchema)
|
|
544
650
|
});
|
|
545
|
-
var SkillYAMLSchema =
|
|
651
|
+
var SkillYAMLSchema = z5.object({
|
|
546
652
|
// Schema version
|
|
547
|
-
$schema:
|
|
653
|
+
$schema: z5.string().optional(),
|
|
548
654
|
// Identity
|
|
549
|
-
handle:
|
|
550
|
-
name:
|
|
551
|
-
version:
|
|
552
|
-
description:
|
|
655
|
+
handle: z5.string(),
|
|
656
|
+
name: z5.string(),
|
|
657
|
+
version: z5.string().optional(),
|
|
658
|
+
description: z5.string().optional(),
|
|
553
659
|
// Instructions injected into agent system prompt
|
|
554
|
-
instructions:
|
|
660
|
+
instructions: z5.string(),
|
|
555
661
|
// Tool configuration - supports both v1 and v2 formats
|
|
556
662
|
tools: SkillToolsSchema.optional(),
|
|
557
663
|
// CRM context - specifies which models/fields to include in schema
|
|
558
664
|
crmContext: CRMContextSchema.optional(),
|
|
559
665
|
// Few-shot examples
|
|
560
|
-
examples:
|
|
561
|
-
});
|
|
562
|
-
var SkillYAMLV2Schema =
|
|
563
|
-
$schema:
|
|
564
|
-
handle:
|
|
565
|
-
name:
|
|
566
|
-
version:
|
|
567
|
-
description:
|
|
568
|
-
instructions:
|
|
569
|
-
tools:
|
|
666
|
+
examples: z5.array(SkillExampleSchema).optional()
|
|
667
|
+
});
|
|
668
|
+
var SkillYAMLV2Schema = z5.object({
|
|
669
|
+
$schema: z5.literal(SKILL_SCHEMA_VERSION_V2).optional(),
|
|
670
|
+
handle: z5.string(),
|
|
671
|
+
name: z5.string(),
|
|
672
|
+
version: z5.string().optional(),
|
|
673
|
+
description: z5.string().optional(),
|
|
674
|
+
instructions: z5.string(),
|
|
675
|
+
tools: z5.array(SkillToolDefinitionSchema).optional(),
|
|
570
676
|
crmContext: CRMContextSchema.optional(),
|
|
571
|
-
examples:
|
|
677
|
+
examples: z5.array(SkillExampleSchema).optional()
|
|
572
678
|
});
|
|
573
|
-
var SkillVersionWeightSchema =
|
|
574
|
-
version:
|
|
575
|
-
weight:
|
|
679
|
+
var SkillVersionWeightSchema = z5.object({
|
|
680
|
+
version: z5.number(),
|
|
681
|
+
weight: z5.number()
|
|
576
682
|
});
|
|
577
|
-
var SkillRefSchema =
|
|
578
|
-
|
|
683
|
+
var SkillRefSchema = z5.union([
|
|
684
|
+
z5.string(),
|
|
579
685
|
// Just handle - uses latest published version
|
|
580
|
-
|
|
581
|
-
skill:
|
|
582
|
-
description:
|
|
686
|
+
z5.object({
|
|
687
|
+
skill: z5.string(),
|
|
688
|
+
description: z5.string().optional(),
|
|
583
689
|
// For AI SDK Agent Skills discovery
|
|
584
690
|
/** Auto-inject this skill's instructions and tools on every agent turn */
|
|
585
|
-
alwaysLoad:
|
|
691
|
+
alwaysLoad: z5.boolean().optional(),
|
|
586
692
|
// Version selection (pick one):
|
|
587
|
-
version:
|
|
693
|
+
version: z5.number().optional(),
|
|
588
694
|
// Pin to specific version number
|
|
589
|
-
versions:
|
|
695
|
+
versions: z5.array(SkillVersionWeightSchema).optional(),
|
|
590
696
|
// A/B testing weights
|
|
591
697
|
// Legacy support:
|
|
592
|
-
instructions:
|
|
698
|
+
instructions: z5.string().optional(),
|
|
593
699
|
// Inline instructions (deprecated)
|
|
594
|
-
enabled:
|
|
700
|
+
enabled: z5.boolean().optional()
|
|
595
701
|
})
|
|
596
702
|
]);
|
|
597
|
-
var SkillMetadataSchema =
|
|
598
|
-
id:
|
|
599
|
-
handle:
|
|
600
|
-
name:
|
|
601
|
-
version:
|
|
602
|
-
description:
|
|
703
|
+
var SkillMetadataSchema = z5.object({
|
|
704
|
+
id: z5.string(),
|
|
705
|
+
handle: z5.string(),
|
|
706
|
+
name: z5.string(),
|
|
707
|
+
version: z5.string().optional(),
|
|
708
|
+
description: z5.string().optional(),
|
|
603
709
|
source: SkillSourceSchema,
|
|
604
|
-
s3Key:
|
|
605
|
-
appVersionId:
|
|
606
|
-
workplaceId:
|
|
607
|
-
createdAt:
|
|
608
|
-
updatedAt:
|
|
609
|
-
});
|
|
610
|
-
var ResolvedSkillSchema =
|
|
611
|
-
handle:
|
|
612
|
-
name:
|
|
613
|
-
instructions:
|
|
614
|
-
description:
|
|
615
|
-
tools:
|
|
616
|
-
examples:
|
|
617
|
-
});
|
|
618
|
-
var LoadedSkillSchema =
|
|
619
|
-
handle:
|
|
620
|
-
name:
|
|
621
|
-
instructions:
|
|
622
|
-
description:
|
|
623
|
-
tools:
|
|
624
|
-
examples:
|
|
710
|
+
s3Key: z5.string().optional(),
|
|
711
|
+
appVersionId: z5.string().optional(),
|
|
712
|
+
workplaceId: z5.string().optional(),
|
|
713
|
+
createdAt: z5.string().datetime().optional(),
|
|
714
|
+
updatedAt: z5.string().datetime().optional()
|
|
715
|
+
});
|
|
716
|
+
var ResolvedSkillSchema = z5.object({
|
|
717
|
+
handle: z5.string(),
|
|
718
|
+
name: z5.string(),
|
|
719
|
+
instructions: z5.string().optional(),
|
|
720
|
+
description: z5.string().optional(),
|
|
721
|
+
tools: z5.array(z5.string()).optional(),
|
|
722
|
+
examples: z5.array(SkillExampleSchema).optional()
|
|
723
|
+
});
|
|
724
|
+
var LoadedSkillSchema = z5.object({
|
|
725
|
+
handle: z5.string(),
|
|
726
|
+
name: z5.string(),
|
|
727
|
+
instructions: z5.string().optional(),
|
|
728
|
+
description: z5.string().optional(),
|
|
729
|
+
tools: z5.array(SkillToolDefinitionSchema).optional(),
|
|
730
|
+
examples: z5.array(SkillExampleSchema).optional()
|
|
625
731
|
});
|
|
626
732
|
function isV2SkillTools(tools) {
|
|
627
733
|
if (!tools) return false;
|
|
@@ -677,182 +783,182 @@ ${sections.join("\n\n---\n\n")}`;
|
|
|
677
783
|
}
|
|
678
784
|
|
|
679
785
|
// src/context/types.ts
|
|
680
|
-
import { z as
|
|
681
|
-
var CRMContextSchema2 =
|
|
682
|
-
model:
|
|
683
|
-
instanceId:
|
|
684
|
-
data:
|
|
786
|
+
import { z as z6 } from "zod/v4";
|
|
787
|
+
var CRMContextSchema2 = z6.object({
|
|
788
|
+
model: z6.string(),
|
|
789
|
+
instanceId: z6.string(),
|
|
790
|
+
data: z6.record(z6.string(), z6.unknown())
|
|
685
791
|
});
|
|
686
|
-
var SenderContextSchema =
|
|
792
|
+
var SenderContextSchema = z6.object({
|
|
687
793
|
kind: ParticipantKindSchema,
|
|
688
|
-
displayName:
|
|
689
|
-
email:
|
|
690
|
-
role:
|
|
691
|
-
permissions:
|
|
794
|
+
displayName: z6.string().optional(),
|
|
795
|
+
email: z6.string().optional(),
|
|
796
|
+
role: z6.string().optional(),
|
|
797
|
+
permissions: z6.array(z6.string()).optional(),
|
|
692
798
|
crm: CRMContextSchema2.optional()
|
|
693
799
|
});
|
|
694
|
-
var ThreadContextItemSchema =
|
|
695
|
-
handle:
|
|
696
|
-
model:
|
|
697
|
-
instanceId:
|
|
698
|
-
data:
|
|
699
|
-
});
|
|
700
|
-
var ThreadInfoSchema =
|
|
701
|
-
id:
|
|
702
|
-
title:
|
|
703
|
-
status:
|
|
704
|
-
kind:
|
|
705
|
-
});
|
|
706
|
-
var SubscriptionSchema =
|
|
707
|
-
identifierValue:
|
|
708
|
-
channelHandle:
|
|
709
|
-
});
|
|
710
|
-
var AssociationSchema =
|
|
711
|
-
id:
|
|
712
|
-
data:
|
|
713
|
-
});
|
|
714
|
-
var ContactSchema =
|
|
715
|
-
id:
|
|
716
|
-
name:
|
|
800
|
+
var ThreadContextItemSchema = z6.object({
|
|
801
|
+
handle: z6.string(),
|
|
802
|
+
model: z6.string(),
|
|
803
|
+
instanceId: z6.string(),
|
|
804
|
+
data: z6.record(z6.string(), z6.unknown()).optional()
|
|
805
|
+
});
|
|
806
|
+
var ThreadInfoSchema = z6.object({
|
|
807
|
+
id: z6.string(),
|
|
808
|
+
title: z6.string().optional(),
|
|
809
|
+
status: z6.string().optional(),
|
|
810
|
+
kind: z6.string().optional()
|
|
811
|
+
});
|
|
812
|
+
var SubscriptionSchema = z6.object({
|
|
813
|
+
identifierValue: z6.string(),
|
|
814
|
+
channelHandle: z6.string().optional()
|
|
815
|
+
});
|
|
816
|
+
var AssociationSchema = z6.object({
|
|
817
|
+
id: z6.string().optional(),
|
|
818
|
+
data: z6.record(z6.string(), z6.unknown())
|
|
819
|
+
});
|
|
820
|
+
var ContactSchema = z6.object({
|
|
821
|
+
id: z6.string().optional(),
|
|
822
|
+
name: z6.string().optional(),
|
|
717
823
|
subscription: SubscriptionSchema.optional(),
|
|
718
|
-
associations:
|
|
824
|
+
associations: z6.record(z6.string(), AssociationSchema).optional()
|
|
719
825
|
});
|
|
720
|
-
var AgentSenderContextSchema =
|
|
721
|
-
kind:
|
|
722
|
-
displayName:
|
|
723
|
-
role:
|
|
724
|
-
permissions:
|
|
826
|
+
var AgentSenderContextSchema = z6.object({
|
|
827
|
+
kind: z6.enum(["contact", "member"]),
|
|
828
|
+
displayName: z6.string().optional(),
|
|
829
|
+
role: z6.string().optional(),
|
|
830
|
+
permissions: z6.array(z6.string()).optional(),
|
|
725
831
|
contact: ContactSchema.optional()
|
|
726
832
|
});
|
|
727
|
-
var AgentThreadContextSchema =
|
|
728
|
-
handle:
|
|
729
|
-
model:
|
|
730
|
-
data:
|
|
833
|
+
var AgentThreadContextSchema = z6.object({
|
|
834
|
+
handle: z6.string(),
|
|
835
|
+
model: z6.string(),
|
|
836
|
+
data: z6.record(z6.string(), z6.unknown())
|
|
731
837
|
});
|
|
732
|
-
var AgentContextSchema =
|
|
838
|
+
var AgentContextSchema = z6.object({
|
|
733
839
|
sender: AgentSenderContextSchema,
|
|
734
|
-
contexts:
|
|
840
|
+
contexts: z6.array(AgentThreadContextSchema).optional()
|
|
735
841
|
});
|
|
736
|
-
var ContextIssueSeveritySchema =
|
|
737
|
-
var ContextIssueTypeSchema =
|
|
842
|
+
var ContextIssueSeveritySchema = z6.enum(["ERROR", "WARNING"]);
|
|
843
|
+
var ContextIssueTypeSchema = z6.enum([
|
|
738
844
|
"MISSING_ROUTING_PARTICIPANT",
|
|
739
845
|
"MISSING_ASSOCIATION",
|
|
740
846
|
"MISSING_REQUIRED_FIELD",
|
|
741
847
|
"MISSING_RECOMMENDED_FIELD"
|
|
742
848
|
]);
|
|
743
|
-
var ContextIssueSchema =
|
|
849
|
+
var ContextIssueSchema = z6.object({
|
|
744
850
|
type: ContextIssueTypeSchema,
|
|
745
851
|
severity: ContextIssueSeveritySchema,
|
|
746
|
-
model:
|
|
747
|
-
field:
|
|
748
|
-
message:
|
|
749
|
-
suggestion:
|
|
852
|
+
model: z6.string().optional(),
|
|
853
|
+
field: z6.string().optional(),
|
|
854
|
+
message: z6.string(),
|
|
855
|
+
suggestion: z6.string().optional()
|
|
750
856
|
});
|
|
751
|
-
var ContextValidationResultSchema =
|
|
752
|
-
valid:
|
|
753
|
-
degraded:
|
|
754
|
-
issues:
|
|
857
|
+
var ContextValidationResultSchema = z6.object({
|
|
858
|
+
valid: z6.boolean(),
|
|
859
|
+
degraded: z6.boolean(),
|
|
860
|
+
issues: z6.array(ContextIssueSchema)
|
|
755
861
|
});
|
|
756
862
|
var MockSenderContextSchema = AgentSenderContextSchema;
|
|
757
863
|
var MockThreadContextSchema = AgentThreadContextSchema;
|
|
758
864
|
var MockContextSchema = AgentContextSchema;
|
|
759
|
-
var SandboxConfigSchema =
|
|
760
|
-
enabled:
|
|
865
|
+
var SandboxConfigSchema = z6.object({
|
|
866
|
+
enabled: z6.boolean().optional(),
|
|
761
867
|
/** @deprecated Use 'context' instead of 'mockContext' */
|
|
762
868
|
mockContext: AgentContextSchema.optional(),
|
|
763
869
|
context: AgentContextSchema.optional()
|
|
764
870
|
});
|
|
765
871
|
|
|
766
872
|
// src/schemas/agent-schema-v3.ts
|
|
767
|
-
var PersonaVoiceFormatV3Schema =
|
|
768
|
-
maxChars:
|
|
769
|
-
noEmojis:
|
|
770
|
-
noHyphens:
|
|
771
|
-
noBulletPoints:
|
|
772
|
-
maxQuestionsPerMessage:
|
|
773
|
-
noSignOffs:
|
|
774
|
-
});
|
|
775
|
-
var PersonaVoiceV3Schema =
|
|
776
|
-
style:
|
|
873
|
+
var PersonaVoiceFormatV3Schema = z7.object({
|
|
874
|
+
maxChars: z7.number().optional(),
|
|
875
|
+
noEmojis: z7.boolean().optional(),
|
|
876
|
+
noHyphens: z7.boolean().optional(),
|
|
877
|
+
noBulletPoints: z7.boolean().optional(),
|
|
878
|
+
maxQuestionsPerMessage: z7.number().optional(),
|
|
879
|
+
noSignOffs: z7.boolean().optional()
|
|
880
|
+
});
|
|
881
|
+
var PersonaVoiceV3Schema = z7.object({
|
|
882
|
+
style: z7.string(),
|
|
777
883
|
format: PersonaVoiceFormatV3Schema.optional()
|
|
778
884
|
});
|
|
779
|
-
var PersonaV3Schema =
|
|
780
|
-
name:
|
|
885
|
+
var PersonaV3Schema = z7.object({
|
|
886
|
+
name: z7.string(),
|
|
781
887
|
voice: PersonaVoiceV3Schema
|
|
782
888
|
});
|
|
783
|
-
var ToolApprovalConfigSchema =
|
|
784
|
-
required:
|
|
785
|
-
requiredIf:
|
|
889
|
+
var ToolApprovalConfigSchema = z7.object({
|
|
890
|
+
required: z7.boolean().optional(),
|
|
891
|
+
requiredIf: z7.array(z7.string()).optional()
|
|
786
892
|
});
|
|
787
|
-
var ToolSandboxConfigSchema =
|
|
788
|
-
mock:
|
|
893
|
+
var ToolSandboxConfigSchema = z7.object({
|
|
894
|
+
mock: z7.unknown().optional()
|
|
789
895
|
});
|
|
790
|
-
var ToolRefV3Schema =
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
tool:
|
|
794
|
-
description:
|
|
896
|
+
var ToolRefV3Schema = z7.union([
|
|
897
|
+
z7.string(),
|
|
898
|
+
z7.object({
|
|
899
|
+
tool: z7.string(),
|
|
900
|
+
description: z7.string().optional(),
|
|
795
901
|
approval: ToolApprovalConfigSchema.optional(),
|
|
796
902
|
sandbox: ToolSandboxConfigSchema.optional(),
|
|
797
|
-
overrides:
|
|
903
|
+
overrides: z7.record(z7.string(), z7.unknown()).optional()
|
|
798
904
|
})
|
|
799
905
|
]);
|
|
800
|
-
var AgentToolRefSchema =
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
tool:
|
|
804
|
-
description:
|
|
906
|
+
var AgentToolRefSchema = z7.union([
|
|
907
|
+
z7.string(),
|
|
908
|
+
z7.object({
|
|
909
|
+
tool: z7.string(),
|
|
910
|
+
description: z7.string().optional()
|
|
805
911
|
})
|
|
806
912
|
]);
|
|
807
|
-
var WorkingMemoryConfigSchema =
|
|
808
|
-
strategy:
|
|
809
|
-
maxTokens:
|
|
810
|
-
summarizeAt:
|
|
913
|
+
var WorkingMemoryConfigSchema = z7.object({
|
|
914
|
+
strategy: z7.enum(["full", "rolling_summary", "sliding_window"]).optional(),
|
|
915
|
+
maxTokens: z7.number().optional(),
|
|
916
|
+
summarizeAt: z7.number().optional()
|
|
811
917
|
});
|
|
812
|
-
var ExternalMemoryConfigSchema =
|
|
813
|
-
enabled:
|
|
814
|
-
ttl:
|
|
918
|
+
var ExternalMemoryConfigSchema = z7.object({
|
|
919
|
+
enabled: z7.boolean().optional(),
|
|
920
|
+
ttl: z7.string().optional()
|
|
815
921
|
});
|
|
816
|
-
var SemanticMemoryConfigSchema =
|
|
817
|
-
enabled:
|
|
818
|
-
topK:
|
|
819
|
-
scope:
|
|
922
|
+
var SemanticMemoryConfigSchema = z7.object({
|
|
923
|
+
enabled: z7.boolean().optional(),
|
|
924
|
+
topK: z7.number().optional(),
|
|
925
|
+
scope: z7.enum(["thread", "instance", "workspace"]).optional()
|
|
820
926
|
});
|
|
821
|
-
var MemoryConfigV3Schema =
|
|
927
|
+
var MemoryConfigV3Schema = z7.object({
|
|
822
928
|
working: WorkingMemoryConfigSchema.optional(),
|
|
823
|
-
persistent:
|
|
824
|
-
namespace:
|
|
929
|
+
persistent: z7.object({
|
|
930
|
+
namespace: z7.string().optional()
|
|
825
931
|
}).optional(),
|
|
826
932
|
external: ExternalMemoryConfigSchema.optional(),
|
|
827
933
|
semantic: SemanticMemoryConfigSchema.optional()
|
|
828
934
|
});
|
|
829
|
-
var RequiresApprovalPolicySchema =
|
|
830
|
-
requiresApproval:
|
|
935
|
+
var RequiresApprovalPolicySchema = z7.object({
|
|
936
|
+
requiresApproval: z7.boolean().optional()
|
|
831
937
|
});
|
|
832
|
-
var PoliciesConfigV3Schema =
|
|
833
|
-
messages:
|
|
938
|
+
var PoliciesConfigV3Schema = z7.object({
|
|
939
|
+
messages: z7.object({
|
|
834
940
|
send: RequiresApprovalPolicySchema.optional(),
|
|
835
941
|
schedule: RequiresApprovalPolicySchema.optional()
|
|
836
942
|
}).optional(),
|
|
837
|
-
tools:
|
|
838
|
-
externalRequiresApproval:
|
|
839
|
-
systemRequiresApproval:
|
|
943
|
+
tools: z7.object({
|
|
944
|
+
externalRequiresApproval: z7.boolean().optional(),
|
|
945
|
+
systemRequiresApproval: z7.boolean().optional()
|
|
840
946
|
}).optional()
|
|
841
947
|
});
|
|
842
|
-
var RuntimeConfigV3Schema =
|
|
948
|
+
var RuntimeConfigV3Schema = z7.object({
|
|
843
949
|
/** LLM model identifier for reasoning (e.g., "google/gemini-3.1-flash-lite") */
|
|
844
|
-
model:
|
|
950
|
+
model: z7.string().optional(),
|
|
845
951
|
/** LLM model for persona transformation (e.g., "openai/gpt-5-nano") */
|
|
846
|
-
personaModel:
|
|
952
|
+
personaModel: z7.string().optional()
|
|
847
953
|
});
|
|
848
|
-
var TimeWindowTimeStampSchema =
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
hour:
|
|
852
|
-
minute:
|
|
954
|
+
var TimeWindowTimeStampSchema = z7.union([
|
|
955
|
+
z7.number().describe("Hour of day (0-23)"),
|
|
956
|
+
z7.object({
|
|
957
|
+
hour: z7.number(),
|
|
958
|
+
minute: z7.number().optional().default(0)
|
|
853
959
|
})
|
|
854
960
|
]);
|
|
855
|
-
var TimeWindowDayOfWeekSchema =
|
|
961
|
+
var TimeWindowDayOfWeekSchema = z7.enum([
|
|
856
962
|
"monday",
|
|
857
963
|
"tuesday",
|
|
858
964
|
"wednesday",
|
|
@@ -861,47 +967,47 @@ var TimeWindowDayOfWeekSchema = z6.enum([
|
|
|
861
967
|
"saturday",
|
|
862
968
|
"sunday"
|
|
863
969
|
]);
|
|
864
|
-
var TimeWindowSlotAgentSchema =
|
|
970
|
+
var TimeWindowSlotAgentSchema = z7.object({
|
|
865
971
|
startTime: TimeWindowTimeStampSchema,
|
|
866
972
|
endTime: TimeWindowTimeStampSchema,
|
|
867
|
-
days:
|
|
973
|
+
days: z7.array(TimeWindowDayOfWeekSchema)
|
|
868
974
|
});
|
|
869
|
-
var ResponseModeSchema =
|
|
975
|
+
var ResponseModeSchema = z7.enum([
|
|
870
976
|
"immediate",
|
|
871
977
|
"ack_and_schedule",
|
|
872
978
|
"schedule_only"
|
|
873
979
|
]);
|
|
874
|
-
var TimeWindowBehaviorSchema =
|
|
980
|
+
var TimeWindowBehaviorSchema = z7.object({
|
|
875
981
|
/** How to handle responses in this window */
|
|
876
982
|
responseMode: ResponseModeSchema,
|
|
877
983
|
/** Prompt injection for this time context */
|
|
878
|
-
prompt:
|
|
984
|
+
prompt: z7.string().optional().describe("Prompt injection for this time context"),
|
|
879
985
|
/** Window to schedule responses for (when responseMode is ack_and_schedule or schedule_only) */
|
|
880
|
-
scheduleFor:
|
|
986
|
+
scheduleFor: z7.string().optional().describe("Window name to schedule responses for")
|
|
881
987
|
});
|
|
882
|
-
var TimeWindowPolicySchema =
|
|
988
|
+
var TimeWindowPolicySchema = z7.object({
|
|
883
989
|
/** IANA timezone for the window (e.g., "Australia/Sydney") */
|
|
884
|
-
timezone:
|
|
990
|
+
timezone: z7.string().describe('IANA timezone, e.g., "Australia/Sydney"'),
|
|
885
991
|
/** Time slots when this window is active */
|
|
886
|
-
windows:
|
|
992
|
+
windows: z7.array(TimeWindowSlotAgentSchema),
|
|
887
993
|
/** Behavior for this window (optional - defaults to immediate response) */
|
|
888
994
|
behavior: TimeWindowBehaviorSchema.optional()
|
|
889
995
|
});
|
|
890
|
-
var TimeWindowPoliciesSchema =
|
|
996
|
+
var TimeWindowPoliciesSchema = z7.record(z7.string(), TimeWindowPolicySchema);
|
|
891
997
|
var TimeWindowDefaultSchema = TimeWindowBehaviorSchema.describe(
|
|
892
998
|
"Fallback behavior when no time window matches"
|
|
893
999
|
);
|
|
894
|
-
var ResponsesBehaviorConfigSchema =
|
|
1000
|
+
var ResponsesBehaviorConfigSchema = z7.object({
|
|
895
1001
|
/**
|
|
896
1002
|
* Maximum immediate messages per agent run (acks, progress updates).
|
|
897
1003
|
* @default 1
|
|
898
1004
|
*/
|
|
899
|
-
maxImmediate:
|
|
1005
|
+
maxImmediate: z7.number().optional(),
|
|
900
1006
|
/**
|
|
901
1007
|
* Maximum scheduled messages per agent run (follow-ups via sendAt).
|
|
902
1008
|
* @default 2
|
|
903
1009
|
*/
|
|
904
|
-
maxScheduled:
|
|
1010
|
+
maxScheduled: z7.number().optional(),
|
|
905
1011
|
/**
|
|
906
1012
|
* Maximum intermediate messages per agent run.
|
|
907
1013
|
* Intermediate = progress updates, acknowledgments before task completion.
|
|
@@ -909,74 +1015,74 @@ var ResponsesBehaviorConfigSchema = z6.object({
|
|
|
909
1015
|
* @deprecated Use maxImmediate instead
|
|
910
1016
|
* @default 2
|
|
911
1017
|
*/
|
|
912
|
-
maxIntermediate:
|
|
1018
|
+
maxIntermediate: z7.number().optional(),
|
|
913
1019
|
/**
|
|
914
1020
|
* Whether a final message is required before the run completes.
|
|
915
1021
|
* If true and no final message is sent, the run fails.
|
|
916
1022
|
* @default true
|
|
917
1023
|
*/
|
|
918
|
-
requireFinal:
|
|
1024
|
+
requireFinal: z7.boolean().optional(),
|
|
919
1025
|
/**
|
|
920
1026
|
* Whether the agent can schedule messages for future delivery.
|
|
921
1027
|
* Scheduled messages typically require approval.
|
|
922
1028
|
* @default false
|
|
923
1029
|
*/
|
|
924
|
-
allowSchedule:
|
|
1030
|
+
allowSchedule: z7.boolean().optional(),
|
|
925
1031
|
/**
|
|
926
1032
|
* Message splitting configuration.
|
|
927
1033
|
* Controls whether and how the agent splits responses into multiple messages.
|
|
928
1034
|
*/
|
|
929
|
-
messageSplitting:
|
|
1035
|
+
messageSplitting: z7.object({
|
|
930
1036
|
/**
|
|
931
1037
|
* Whether to allow natural message splitting.
|
|
932
1038
|
* When true, the agent may split responses into multiple messages
|
|
933
1039
|
* when it improves conversational flow.
|
|
934
1040
|
*/
|
|
935
|
-
enabled:
|
|
1041
|
+
enabled: z7.boolean(),
|
|
936
1042
|
/**
|
|
937
1043
|
* Custom prompt to override the default message splitting guidance.
|
|
938
1044
|
* If not provided, uses sensible defaults for when to split vs. keep together.
|
|
939
1045
|
*/
|
|
940
|
-
prompt:
|
|
1046
|
+
prompt: z7.string().optional()
|
|
941
1047
|
}).optional()
|
|
942
1048
|
});
|
|
943
|
-
var SchedulingDelaySchema =
|
|
1049
|
+
var SchedulingDelaySchema = z7.object({
|
|
944
1050
|
/** Time unit amount */
|
|
945
|
-
amount:
|
|
1051
|
+
amount: z7.number(),
|
|
946
1052
|
/** Time unit (e.g., "week", "weeks", "day", "days", "month", "months") */
|
|
947
|
-
unit:
|
|
1053
|
+
unit: z7.string(),
|
|
948
1054
|
/** Optional time window to constrain the delay */
|
|
949
|
-
timeWindow:
|
|
1055
|
+
timeWindow: z7.string().optional()
|
|
950
1056
|
});
|
|
951
|
-
var SchedulingPatternSchema =
|
|
1057
|
+
var SchedulingPatternSchema = z7.object({
|
|
952
1058
|
/** Trigger name for this pattern */
|
|
953
|
-
trigger:
|
|
1059
|
+
trigger: z7.string(),
|
|
954
1060
|
/** Human-readable description of when this pattern applies */
|
|
955
|
-
description:
|
|
1061
|
+
description: z7.string().optional(),
|
|
956
1062
|
/** Example user phrases that match this pattern */
|
|
957
|
-
examples:
|
|
1063
|
+
examples: z7.array(z7.string()).optional(),
|
|
958
1064
|
/** Default delay for this pattern */
|
|
959
1065
|
defaultDelay: SchedulingDelaySchema.optional()
|
|
960
1066
|
});
|
|
961
|
-
var SchedulingBehaviorConfigSchema =
|
|
1067
|
+
var SchedulingBehaviorConfigSchema = z7.object({
|
|
962
1068
|
/**
|
|
963
1069
|
* Patterns that trigger scheduling suggestions.
|
|
964
1070
|
* The agent uses these to know when to add sendAt to messages.
|
|
965
1071
|
*/
|
|
966
|
-
patterns:
|
|
1072
|
+
patterns: z7.array(SchedulingPatternSchema).optional(),
|
|
967
1073
|
/**
|
|
968
1074
|
* Default settings for scheduled messages.
|
|
969
1075
|
*/
|
|
970
|
-
defaults:
|
|
1076
|
+
defaults: z7.object({
|
|
971
1077
|
/** Cancel scheduled message if user replies before send time (default: true) */
|
|
972
|
-
cancelOnActivity:
|
|
1078
|
+
cancelOnActivity: z7.boolean().optional(),
|
|
973
1079
|
/** Whether scheduled messages require approval (default: true) */
|
|
974
|
-
requiresApproval:
|
|
1080
|
+
requiresApproval: z7.boolean().optional(),
|
|
975
1081
|
/** Default time window policy to constrain all scheduled messages */
|
|
976
|
-
timeWindow:
|
|
1082
|
+
timeWindow: z7.string().optional().describe("Time window policy name for scheduled messages")
|
|
977
1083
|
}).optional()
|
|
978
1084
|
});
|
|
979
|
-
var BehaviorConfigV3Schema =
|
|
1085
|
+
var BehaviorConfigV3Schema = z7.object({
|
|
980
1086
|
/**
|
|
981
1087
|
* Response behavior - controls message sending via tool calls.
|
|
982
1088
|
* When configured, agents must explicitly call system:message:send
|
|
@@ -989,32 +1095,32 @@ var BehaviorConfigV3Schema = z6.object({
|
|
|
989
1095
|
*/
|
|
990
1096
|
scheduling: SchedulingBehaviorConfigSchema.optional()
|
|
991
1097
|
});
|
|
992
|
-
var PromptsConfigV3Schema =
|
|
1098
|
+
var PromptsConfigV3Schema = z7.object({
|
|
993
1099
|
/** Main system prompt with workflow instructions */
|
|
994
|
-
system:
|
|
1100
|
+
system: z7.string().optional(),
|
|
995
1101
|
/** Injected during second pass when skills were loaded but tools not used */
|
|
996
|
-
recovery:
|
|
1102
|
+
recovery: z7.string().optional(),
|
|
997
1103
|
/** Injected during follow-up passes when context needs updating */
|
|
998
|
-
followUp:
|
|
1104
|
+
followUp: z7.string().optional(),
|
|
999
1105
|
/** Thread list title generation (system + user template with {{var}} placeholders) */
|
|
1000
|
-
titleEnrichment:
|
|
1001
|
-
system:
|
|
1002
|
-
user:
|
|
1106
|
+
titleEnrichment: z7.object({
|
|
1107
|
+
system: z7.string().optional(),
|
|
1108
|
+
user: z7.string().optional()
|
|
1003
1109
|
}).optional()
|
|
1004
1110
|
});
|
|
1005
|
-
var AgentYAMLV3Schema =
|
|
1006
|
-
$schema:
|
|
1007
|
-
handle:
|
|
1008
|
-
name:
|
|
1009
|
-
version:
|
|
1010
|
-
description:
|
|
1111
|
+
var AgentYAMLV3Schema = z7.object({
|
|
1112
|
+
$schema: z7.string().optional(),
|
|
1113
|
+
handle: z7.string(),
|
|
1114
|
+
name: z7.string(),
|
|
1115
|
+
version: z7.string().optional(),
|
|
1116
|
+
description: z7.string().optional(),
|
|
1011
1117
|
// Persona - Who the agent is
|
|
1012
1118
|
persona: PersonaV3Schema.optional(),
|
|
1013
1119
|
// Skills - What the agent knows how to do (skills own their tools)
|
|
1014
|
-
skills:
|
|
1120
|
+
skills: z7.array(SkillRefSchema).optional(),
|
|
1015
1121
|
// Tools - Always-available tools before any skill loads
|
|
1016
1122
|
// Examples: system:settings:business_information:get
|
|
1017
|
-
tools:
|
|
1123
|
+
tools: z7.array(AgentToolRefSchema).optional(),
|
|
1018
1124
|
/**
|
|
1019
1125
|
* Events - When the agent activates
|
|
1020
1126
|
* @deprecated Not yet implemented - this is a planned feature for event-driven agents.
|
|
@@ -1047,21 +1153,21 @@ var AgentYAMLV3Schema = z6.object({
|
|
|
1047
1153
|
});
|
|
1048
1154
|
|
|
1049
1155
|
// src/schemas.ts
|
|
1050
|
-
var EnvVisibilitySchema =
|
|
1051
|
-
var EnvVariableDefinitionSchema =
|
|
1052
|
-
label:
|
|
1053
|
-
required:
|
|
1156
|
+
var EnvVisibilitySchema = z8.enum(["visible", "encrypted"]);
|
|
1157
|
+
var EnvVariableDefinitionSchema = z8.object({
|
|
1158
|
+
label: z8.string(),
|
|
1159
|
+
required: z8.boolean().optional(),
|
|
1054
1160
|
visibility: EnvVisibilitySchema.optional(),
|
|
1055
|
-
default:
|
|
1056
|
-
description:
|
|
1057
|
-
placeholder:
|
|
1058
|
-
});
|
|
1059
|
-
var EnvSchemaSchema =
|
|
1060
|
-
var ComputeLayerTypeSchema =
|
|
1061
|
-
var FieldOwnerSchema =
|
|
1062
|
-
var PrimitiveSchema =
|
|
1063
|
-
var PrimitiveOrArraySchema =
|
|
1064
|
-
var FilterOperatorSchema =
|
|
1161
|
+
default: z8.string().optional(),
|
|
1162
|
+
description: z8.string().optional(),
|
|
1163
|
+
placeholder: z8.string().optional()
|
|
1164
|
+
});
|
|
1165
|
+
var EnvSchemaSchema = z8.record(z8.string(), EnvVariableDefinitionSchema);
|
|
1166
|
+
var ComputeLayerTypeSchema = z8.enum(["serverless", "dedicated"]);
|
|
1167
|
+
var FieldOwnerSchema = z8.enum(["APP", "SHARED"]);
|
|
1168
|
+
var PrimitiveSchema = z8.union([z8.string(), z8.number(), z8.boolean()]);
|
|
1169
|
+
var PrimitiveOrArraySchema = z8.union([PrimitiveSchema, z8.array(PrimitiveSchema)]);
|
|
1170
|
+
var FilterOperatorSchema = z8.enum([
|
|
1065
1171
|
"eq",
|
|
1066
1172
|
"neq",
|
|
1067
1173
|
"gt",
|
|
@@ -1079,7 +1185,7 @@ var FilterOperatorSchema = z7.enum([
|
|
|
1079
1185
|
"isEmpty",
|
|
1080
1186
|
"isNotEmpty"
|
|
1081
1187
|
]);
|
|
1082
|
-
var FilterConditionSchema =
|
|
1188
|
+
var FilterConditionSchema = z8.object({
|
|
1083
1189
|
eq: PrimitiveOrArraySchema,
|
|
1084
1190
|
neq: PrimitiveOrArraySchema,
|
|
1085
1191
|
gt: PrimitiveOrArraySchema,
|
|
@@ -1097,27 +1203,27 @@ var FilterConditionSchema = z7.object({
|
|
|
1097
1203
|
isEmpty: PrimitiveOrArraySchema,
|
|
1098
1204
|
isNotEmpty: PrimitiveOrArraySchema
|
|
1099
1205
|
}).partial();
|
|
1100
|
-
var StructuredFilterSchema =
|
|
1101
|
-
|
|
1206
|
+
var StructuredFilterSchema = z8.record(
|
|
1207
|
+
z8.string(),
|
|
1102
1208
|
FilterConditionSchema
|
|
1103
1209
|
);
|
|
1104
|
-
var ModelDependencySchema =
|
|
1105
|
-
model:
|
|
1106
|
-
fields:
|
|
1210
|
+
var ModelDependencySchema = z8.object({
|
|
1211
|
+
model: z8.string(),
|
|
1212
|
+
fields: z8.array(z8.string()).optional(),
|
|
1107
1213
|
where: StructuredFilterSchema.optional()
|
|
1108
1214
|
});
|
|
1109
|
-
var ChannelDependencySchema =
|
|
1110
|
-
channel:
|
|
1215
|
+
var ChannelDependencySchema = z8.object({
|
|
1216
|
+
channel: z8.string()
|
|
1111
1217
|
});
|
|
1112
|
-
var WorkflowDependencySchema =
|
|
1113
|
-
workflow:
|
|
1218
|
+
var WorkflowDependencySchema = z8.object({
|
|
1219
|
+
workflow: z8.string()
|
|
1114
1220
|
});
|
|
1115
|
-
var ResourceDependencySchema =
|
|
1221
|
+
var ResourceDependencySchema = z8.union([
|
|
1116
1222
|
ModelDependencySchema,
|
|
1117
1223
|
ChannelDependencySchema,
|
|
1118
1224
|
WorkflowDependencySchema
|
|
1119
1225
|
]);
|
|
1120
|
-
var FieldDataTypeSchema =
|
|
1226
|
+
var FieldDataTypeSchema = z8.enum([
|
|
1121
1227
|
"LONG_STRING",
|
|
1122
1228
|
"STRING",
|
|
1123
1229
|
"NUMBER",
|
|
@@ -1130,74 +1236,74 @@ var FieldDataTypeSchema = z7.enum([
|
|
|
1130
1236
|
"RELATION",
|
|
1131
1237
|
"OBJECT"
|
|
1132
1238
|
]);
|
|
1133
|
-
var FieldOptionSchema =
|
|
1134
|
-
label:
|
|
1135
|
-
value:
|
|
1136
|
-
color:
|
|
1137
|
-
});
|
|
1138
|
-
var InlineFieldDefinitionSchema =
|
|
1139
|
-
limitChoices:
|
|
1140
|
-
options:
|
|
1141
|
-
minLength:
|
|
1142
|
-
maxLength:
|
|
1143
|
-
min:
|
|
1144
|
-
max:
|
|
1145
|
-
relatedModel:
|
|
1146
|
-
pattern:
|
|
1147
|
-
});
|
|
1148
|
-
var AppFieldVisibilitySchema =
|
|
1149
|
-
data:
|
|
1150
|
-
list:
|
|
1151
|
-
filters:
|
|
1152
|
-
});
|
|
1153
|
-
var FieldRequirementTypeSchema =
|
|
1154
|
-
var ModelFieldDefinitionSchema =
|
|
1155
|
-
handle:
|
|
1156
|
-
label:
|
|
1239
|
+
var FieldOptionSchema = z8.object({
|
|
1240
|
+
label: z8.string(),
|
|
1241
|
+
value: z8.string(),
|
|
1242
|
+
color: z8.string().optional()
|
|
1243
|
+
});
|
|
1244
|
+
var InlineFieldDefinitionSchema = z8.object({
|
|
1245
|
+
limitChoices: z8.number().optional(),
|
|
1246
|
+
options: z8.array(FieldOptionSchema).optional(),
|
|
1247
|
+
minLength: z8.number().optional(),
|
|
1248
|
+
maxLength: z8.number().optional(),
|
|
1249
|
+
min: z8.number().optional(),
|
|
1250
|
+
max: z8.number().optional(),
|
|
1251
|
+
relatedModel: z8.string().optional(),
|
|
1252
|
+
pattern: z8.string().optional()
|
|
1253
|
+
});
|
|
1254
|
+
var AppFieldVisibilitySchema = z8.object({
|
|
1255
|
+
data: z8.boolean().optional(),
|
|
1256
|
+
list: z8.boolean().optional(),
|
|
1257
|
+
filters: z8.boolean().optional()
|
|
1258
|
+
});
|
|
1259
|
+
var FieldRequirementTypeSchema = z8.enum(["optional", "on_create", "required"]);
|
|
1260
|
+
var ModelFieldDefinitionSchema = z8.object({
|
|
1261
|
+
handle: z8.string(),
|
|
1262
|
+
label: z8.string(),
|
|
1157
1263
|
type: FieldDataTypeSchema.optional(),
|
|
1158
|
-
definition:
|
|
1264
|
+
definition: z8.union([InlineFieldDefinitionSchema, z8.string()]).optional(),
|
|
1159
1265
|
/** Field requirement type: 'optional', 'on_create', or 'required' */
|
|
1160
1266
|
requirement: FieldRequirementTypeSchema.optional(),
|
|
1161
1267
|
/** @deprecated Use `requirement` instead */
|
|
1162
|
-
required:
|
|
1163
|
-
unique:
|
|
1164
|
-
system:
|
|
1165
|
-
isList:
|
|
1166
|
-
defaultValue:
|
|
1167
|
-
description:
|
|
1268
|
+
required: z8.boolean().optional(),
|
|
1269
|
+
unique: z8.boolean().optional(),
|
|
1270
|
+
system: z8.boolean().optional(),
|
|
1271
|
+
isList: z8.boolean().optional(),
|
|
1272
|
+
defaultValue: z8.object({ value: z8.unknown() }).optional(),
|
|
1273
|
+
description: z8.string().optional(),
|
|
1168
1274
|
visibility: AppFieldVisibilitySchema.optional(),
|
|
1169
1275
|
owner: FieldOwnerSchema.optional()
|
|
1170
1276
|
});
|
|
1171
|
-
var ModelDefinitionSchema =
|
|
1172
|
-
handle:
|
|
1173
|
-
name:
|
|
1174
|
-
namePlural:
|
|
1175
|
-
labelTemplate:
|
|
1176
|
-
description:
|
|
1177
|
-
fields:
|
|
1178
|
-
requires:
|
|
1179
|
-
addDefaultPages:
|
|
1180
|
-
addNavigation:
|
|
1277
|
+
var ModelDefinitionSchema = z8.object({
|
|
1278
|
+
handle: z8.string(),
|
|
1279
|
+
name: z8.string(),
|
|
1280
|
+
namePlural: z8.string().optional(),
|
|
1281
|
+
labelTemplate: z8.string().optional(),
|
|
1282
|
+
description: z8.string().optional(),
|
|
1283
|
+
fields: z8.array(ModelFieldDefinitionSchema),
|
|
1284
|
+
requires: z8.array(ResourceDependencySchema).optional(),
|
|
1285
|
+
addDefaultPages: z8.boolean().optional(),
|
|
1286
|
+
addNavigation: z8.boolean().optional(),
|
|
1181
1287
|
/** Root path for developer resource UI (e.g., '/access_requests'). Links internal model to a provision.pages entry. */
|
|
1182
|
-
page:
|
|
1288
|
+
page: z8.string().optional()
|
|
1183
1289
|
});
|
|
1184
|
-
var RelationshipCardinalitySchema =
|
|
1290
|
+
var RelationshipCardinalitySchema = z8.enum([
|
|
1185
1291
|
"ONE_TO_ONE",
|
|
1186
1292
|
"ONE_TO_MANY"
|
|
1187
1293
|
]);
|
|
1188
|
-
var OnDeleteBehaviorSchema =
|
|
1189
|
-
var RelationshipLinkSchema =
|
|
1190
|
-
model:
|
|
1191
|
-
field:
|
|
1192
|
-
label:
|
|
1294
|
+
var OnDeleteBehaviorSchema = z8.enum(["NONE", "CASCADE", "RESTRICT"]);
|
|
1295
|
+
var RelationshipLinkSchema = z8.object({
|
|
1296
|
+
model: z8.string(),
|
|
1297
|
+
field: z8.string(),
|
|
1298
|
+
label: z8.string()
|
|
1193
1299
|
});
|
|
1194
|
-
var RelationshipDefinitionSchema =
|
|
1300
|
+
var RelationshipDefinitionSchema = z8.object({
|
|
1195
1301
|
source: RelationshipLinkSchema,
|
|
1196
1302
|
target: RelationshipLinkSchema,
|
|
1197
1303
|
cardinality: RelationshipCardinalitySchema,
|
|
1198
1304
|
onDelete: OnDeleteBehaviorSchema.default("NONE")
|
|
1199
1305
|
});
|
|
1200
|
-
var ChannelCapabilityTypeSchema =
|
|
1306
|
+
var ChannelCapabilityTypeSchema = z8.enum([
|
|
1201
1307
|
"messaging",
|
|
1202
1308
|
// Text-based: SMS, WhatsApp, Messenger, DMs
|
|
1203
1309
|
"voice",
|
|
@@ -1205,323 +1311,329 @@ var ChannelCapabilityTypeSchema = z7.enum([
|
|
|
1205
1311
|
"video"
|
|
1206
1312
|
// Video calls (future)
|
|
1207
1313
|
]);
|
|
1208
|
-
var
|
|
1209
|
-
|
|
1314
|
+
var ChannelBatchCapabilitySchema = z8.object({
|
|
1315
|
+
send: z8.string(),
|
|
1316
|
+
get_status: z8.string()
|
|
1317
|
+
});
|
|
1318
|
+
var ChannelCapabilitySchema = z8.object({
|
|
1319
|
+
label: z8.string(),
|
|
1210
1320
|
// Display name: "SMS", "WhatsApp Messages"
|
|
1211
|
-
icon:
|
|
1321
|
+
icon: z8.string().optional(),
|
|
1212
1322
|
// Lucide icon name
|
|
1213
|
-
receive:
|
|
1323
|
+
receive: z8.string().optional(),
|
|
1214
1324
|
// Inbound webhook handler
|
|
1215
|
-
send:
|
|
1325
|
+
send: z8.string().optional(),
|
|
1216
1326
|
// Outbound tool handle
|
|
1327
|
+
send_batch: z8.union([z8.string(), ChannelBatchCapabilitySchema]).optional()
|
|
1328
|
+
// Batch outbound tool handle, or { send, get_status }
|
|
1217
1329
|
});
|
|
1218
|
-
var ChannelFieldDefinitionSchema =
|
|
1219
|
-
handle:
|
|
1220
|
-
label:
|
|
1330
|
+
var ChannelFieldDefinitionSchema = z8.object({
|
|
1331
|
+
handle: z8.string(),
|
|
1332
|
+
label: z8.string(),
|
|
1221
1333
|
/** Field definition reference or inline definition */
|
|
1222
|
-
definition:
|
|
1334
|
+
definition: z8.union([InlineFieldDefinitionSchema, z8.string()]).optional(),
|
|
1223
1335
|
/** Marks this field as the identifier field for the channel */
|
|
1224
|
-
identifier:
|
|
1336
|
+
identifier: z8.boolean().optional(),
|
|
1225
1337
|
/** Whether this field is required */
|
|
1226
|
-
required:
|
|
1338
|
+
required: z8.boolean().optional(),
|
|
1227
1339
|
/** Default value when creating a new field */
|
|
1228
|
-
defaultValue:
|
|
1340
|
+
defaultValue: z8.object({ value: z8.unknown() }).passthrough().optional(),
|
|
1229
1341
|
/** Visibility settings for the field */
|
|
1230
|
-
visibility:
|
|
1231
|
-
data:
|
|
1232
|
-
list:
|
|
1233
|
-
filters:
|
|
1342
|
+
visibility: z8.object({
|
|
1343
|
+
data: z8.boolean().optional(),
|
|
1344
|
+
list: z8.boolean().optional(),
|
|
1345
|
+
filters: z8.boolean().optional()
|
|
1234
1346
|
}).passthrough().optional(),
|
|
1235
1347
|
/** Permission settings for the field */
|
|
1236
|
-
permissions:
|
|
1237
|
-
read:
|
|
1238
|
-
write:
|
|
1348
|
+
permissions: z8.object({
|
|
1349
|
+
read: z8.boolean().optional(),
|
|
1350
|
+
write: z8.boolean().optional()
|
|
1239
1351
|
}).passthrough().optional()
|
|
1240
1352
|
}).passthrough();
|
|
1241
|
-
var ChannelDefinitionSchema =
|
|
1242
|
-
handle:
|
|
1243
|
-
label:
|
|
1244
|
-
icon:
|
|
1353
|
+
var ChannelDefinitionSchema = z8.object({
|
|
1354
|
+
handle: z8.string(),
|
|
1355
|
+
label: z8.string(),
|
|
1356
|
+
icon: z8.string().optional(),
|
|
1245
1357
|
/** Array of field definitions for this channel. One field must have identifier: true. */
|
|
1246
|
-
fields:
|
|
1358
|
+
fields: z8.array(ChannelFieldDefinitionSchema),
|
|
1247
1359
|
// Capabilities keyed by standard type (messaging, voice, video) - all optional
|
|
1248
|
-
capabilities:
|
|
1360
|
+
capabilities: z8.object({
|
|
1249
1361
|
messaging: ChannelCapabilitySchema.optional(),
|
|
1250
1362
|
voice: ChannelCapabilitySchema.optional(),
|
|
1251
1363
|
video: ChannelCapabilitySchema.optional()
|
|
1252
1364
|
})
|
|
1253
1365
|
});
|
|
1254
|
-
var WorkflowActionInputSchema =
|
|
1255
|
-
key:
|
|
1256
|
-
label:
|
|
1257
|
-
fieldRef:
|
|
1258
|
-
fieldHandle:
|
|
1259
|
-
entityHandle:
|
|
1366
|
+
var WorkflowActionInputSchema = z8.object({
|
|
1367
|
+
key: z8.string(),
|
|
1368
|
+
label: z8.string(),
|
|
1369
|
+
fieldRef: z8.object({
|
|
1370
|
+
fieldHandle: z8.string(),
|
|
1371
|
+
entityHandle: z8.string()
|
|
1260
1372
|
}).optional(),
|
|
1261
|
-
template:
|
|
1262
|
-
});
|
|
1263
|
-
var WorkflowActionSchema =
|
|
1264
|
-
label:
|
|
1265
|
-
handle:
|
|
1266
|
-
batch:
|
|
1267
|
-
entityHandle:
|
|
1268
|
-
inputs:
|
|
1269
|
-
});
|
|
1270
|
-
var WorkflowDefinitionSchema =
|
|
1271
|
-
path:
|
|
1272
|
-
label:
|
|
1273
|
-
handle:
|
|
1274
|
-
requires:
|
|
1275
|
-
actions:
|
|
1276
|
-
});
|
|
1277
|
-
var PageTypeSchema =
|
|
1278
|
-
var PageBlockTypeSchema =
|
|
1279
|
-
var PageFieldTypeSchema =
|
|
1280
|
-
var PageFieldSourceSchema =
|
|
1281
|
-
model:
|
|
1282
|
-
field:
|
|
1283
|
-
});
|
|
1284
|
-
var PageFormHeaderSchema =
|
|
1285
|
-
title:
|
|
1286
|
-
description:
|
|
1287
|
-
});
|
|
1288
|
-
var PageActionDefinitionSchema =
|
|
1289
|
-
handle:
|
|
1290
|
-
label:
|
|
1291
|
-
handler:
|
|
1292
|
-
href:
|
|
1293
|
-
icon:
|
|
1294
|
-
variant:
|
|
1295
|
-
isDisabled:
|
|
1296
|
-
isHidden:
|
|
1373
|
+
template: z8.string().optional()
|
|
1374
|
+
});
|
|
1375
|
+
var WorkflowActionSchema = z8.object({
|
|
1376
|
+
label: z8.string(),
|
|
1377
|
+
handle: z8.string(),
|
|
1378
|
+
batch: z8.boolean().optional(),
|
|
1379
|
+
entityHandle: z8.string().optional(),
|
|
1380
|
+
inputs: z8.array(WorkflowActionInputSchema).optional()
|
|
1381
|
+
});
|
|
1382
|
+
var WorkflowDefinitionSchema = z8.object({
|
|
1383
|
+
path: z8.string(),
|
|
1384
|
+
label: z8.string().optional(),
|
|
1385
|
+
handle: z8.string().optional(),
|
|
1386
|
+
requires: z8.array(ResourceDependencySchema).optional(),
|
|
1387
|
+
actions: z8.array(WorkflowActionSchema)
|
|
1388
|
+
});
|
|
1389
|
+
var PageTypeSchema = z8.enum(["INSTANCE", "LIST"]);
|
|
1390
|
+
var PageBlockTypeSchema = z8.enum(["form", "spreadsheet", "kanban", "calendar", "link", "list", "card"]);
|
|
1391
|
+
var PageFieldTypeSchema = z8.enum(["STRING", "FILE", "NUMBER", "DATE", "BOOLEAN", "SELECT", "FORM", "RELATIONSHIP"]);
|
|
1392
|
+
var PageFieldSourceSchema = z8.object({
|
|
1393
|
+
model: z8.string(),
|
|
1394
|
+
field: z8.string()
|
|
1395
|
+
});
|
|
1396
|
+
var PageFormHeaderSchema = z8.object({
|
|
1397
|
+
title: z8.string(),
|
|
1398
|
+
description: z8.string().optional()
|
|
1399
|
+
});
|
|
1400
|
+
var PageActionDefinitionSchema = z8.object({
|
|
1401
|
+
handle: z8.string(),
|
|
1402
|
+
label: z8.string(),
|
|
1403
|
+
handler: z8.string().optional(),
|
|
1404
|
+
href: z8.string().optional(),
|
|
1405
|
+
icon: z8.string().optional(),
|
|
1406
|
+
variant: z8.enum(["primary", "secondary", "destructive", "outline"]).optional(),
|
|
1407
|
+
isDisabled: z8.union([z8.boolean(), z8.string()]).optional(),
|
|
1408
|
+
isHidden: z8.union([z8.boolean(), z8.string()]).optional()
|
|
1297
1409
|
}).refine((data) => Boolean(data.handler || data.href), {
|
|
1298
1410
|
message: "Page action requires handler or href"
|
|
1299
1411
|
});
|
|
1300
|
-
var FormV2StylePropsSchema =
|
|
1301
|
-
id:
|
|
1302
|
-
row:
|
|
1303
|
-
col:
|
|
1304
|
-
className:
|
|
1305
|
-
hidden:
|
|
1306
|
-
});
|
|
1307
|
-
var FieldSettingButtonPropsSchema =
|
|
1308
|
-
label:
|
|
1309
|
-
variant:
|
|
1310
|
-
size:
|
|
1311
|
-
isLoading:
|
|
1412
|
+
var FormV2StylePropsSchema = z8.object({
|
|
1413
|
+
id: z8.string(),
|
|
1414
|
+
row: z8.number(),
|
|
1415
|
+
col: z8.number(),
|
|
1416
|
+
className: z8.string().optional(),
|
|
1417
|
+
hidden: z8.boolean().optional()
|
|
1418
|
+
});
|
|
1419
|
+
var FieldSettingButtonPropsSchema = z8.object({
|
|
1420
|
+
label: z8.string(),
|
|
1421
|
+
variant: z8.enum(["default", "destructive", "outline", "secondary", "ghost", "link"]).optional(),
|
|
1422
|
+
size: z8.enum(["default", "sm", "lg", "icon"]).optional(),
|
|
1423
|
+
isLoading: z8.boolean().optional(),
|
|
1312
1424
|
/** Can be boolean or Liquid template string that resolves to boolean */
|
|
1313
|
-
isDisabled:
|
|
1314
|
-
leftIcon:
|
|
1425
|
+
isDisabled: z8.union([z8.boolean(), z8.string()]).optional(),
|
|
1426
|
+
leftIcon: z8.string().optional()
|
|
1315
1427
|
});
|
|
1316
|
-
var RelationshipExtensionSchema =
|
|
1317
|
-
model:
|
|
1428
|
+
var RelationshipExtensionSchema = z8.object({
|
|
1429
|
+
model: z8.string()
|
|
1318
1430
|
});
|
|
1319
|
-
var FormLayoutColumnDefinitionSchema =
|
|
1320
|
-
field:
|
|
1321
|
-
colSpan:
|
|
1322
|
-
dataType:
|
|
1323
|
-
subQuery:
|
|
1431
|
+
var FormLayoutColumnDefinitionSchema = z8.object({
|
|
1432
|
+
field: z8.string(),
|
|
1433
|
+
colSpan: z8.number(),
|
|
1434
|
+
dataType: z8.string().optional(),
|
|
1435
|
+
subQuery: z8.unknown().optional()
|
|
1324
1436
|
});
|
|
1325
|
-
var FormLayoutRowDefinitionSchema =
|
|
1326
|
-
columns:
|
|
1437
|
+
var FormLayoutRowDefinitionSchema = z8.object({
|
|
1438
|
+
columns: z8.array(FormLayoutColumnDefinitionSchema)
|
|
1327
1439
|
});
|
|
1328
|
-
var FormLayoutConfigDefinitionSchema =
|
|
1329
|
-
type:
|
|
1330
|
-
rows:
|
|
1440
|
+
var FormLayoutConfigDefinitionSchema = z8.object({
|
|
1441
|
+
type: z8.literal("form"),
|
|
1442
|
+
rows: z8.array(FormLayoutRowDefinitionSchema)
|
|
1331
1443
|
});
|
|
1332
1444
|
var InputComponentDefinitionSchema = FormV2StylePropsSchema.extend({
|
|
1333
|
-
component:
|
|
1334
|
-
props:
|
|
1335
|
-
label:
|
|
1336
|
-
placeholder:
|
|
1337
|
-
helpText:
|
|
1338
|
-
type:
|
|
1339
|
-
required:
|
|
1340
|
-
disabled:
|
|
1341
|
-
value:
|
|
1445
|
+
component: z8.literal("Input"),
|
|
1446
|
+
props: z8.object({
|
|
1447
|
+
label: z8.string().optional(),
|
|
1448
|
+
placeholder: z8.string().optional(),
|
|
1449
|
+
helpText: z8.string().optional(),
|
|
1450
|
+
type: z8.enum(["text", "number", "email", "password", "tel", "url", "hidden"]).optional(),
|
|
1451
|
+
required: z8.boolean().optional(),
|
|
1452
|
+
disabled: z8.boolean().optional(),
|
|
1453
|
+
value: z8.union([z8.string(), z8.number()]).optional()
|
|
1342
1454
|
})
|
|
1343
1455
|
});
|
|
1344
1456
|
var TextareaComponentDefinitionSchema = FormV2StylePropsSchema.extend({
|
|
1345
|
-
component:
|
|
1346
|
-
props:
|
|
1347
|
-
label:
|
|
1348
|
-
placeholder:
|
|
1349
|
-
helpText:
|
|
1350
|
-
required:
|
|
1351
|
-
disabled:
|
|
1352
|
-
value:
|
|
1457
|
+
component: z8.literal("Textarea"),
|
|
1458
|
+
props: z8.object({
|
|
1459
|
+
label: z8.string().optional(),
|
|
1460
|
+
placeholder: z8.string().optional(),
|
|
1461
|
+
helpText: z8.string().optional(),
|
|
1462
|
+
required: z8.boolean().optional(),
|
|
1463
|
+
disabled: z8.boolean().optional(),
|
|
1464
|
+
value: z8.string().optional()
|
|
1353
1465
|
})
|
|
1354
1466
|
});
|
|
1355
1467
|
var SelectComponentDefinitionSchema = FormV2StylePropsSchema.extend({
|
|
1356
|
-
component:
|
|
1357
|
-
props:
|
|
1358
|
-
label:
|
|
1359
|
-
placeholder:
|
|
1360
|
-
helpText:
|
|
1468
|
+
component: z8.literal("Select"),
|
|
1469
|
+
props: z8.object({
|
|
1470
|
+
label: z8.string().optional(),
|
|
1471
|
+
placeholder: z8.string().optional(),
|
|
1472
|
+
helpText: z8.string().optional(),
|
|
1361
1473
|
/** Static items array (will be populated by iterable if using dynamic items) */
|
|
1362
|
-
items:
|
|
1363
|
-
value:
|
|
1364
|
-
isDisabled:
|
|
1365
|
-
required:
|
|
1474
|
+
items: z8.union([z8.array(z8.object({ value: z8.string(), label: z8.string() })), z8.string()]).optional(),
|
|
1475
|
+
value: z8.string().optional(),
|
|
1476
|
+
isDisabled: z8.boolean().optional(),
|
|
1477
|
+
required: z8.boolean().optional()
|
|
1366
1478
|
}),
|
|
1367
1479
|
relationship: RelationshipExtensionSchema.optional(),
|
|
1368
1480
|
/** For dynamic items using iterable pattern (e.g., 'system.models') */
|
|
1369
|
-
iterable:
|
|
1481
|
+
iterable: z8.string().optional(),
|
|
1370
1482
|
/** Template for each item in the iterable */
|
|
1371
|
-
itemTemplate:
|
|
1372
|
-
value:
|
|
1373
|
-
label:
|
|
1483
|
+
itemTemplate: z8.object({
|
|
1484
|
+
value: z8.string(),
|
|
1485
|
+
label: z8.string()
|
|
1374
1486
|
}).optional()
|
|
1375
1487
|
});
|
|
1376
1488
|
var ComboboxComponentDefinitionSchema = FormV2StylePropsSchema.extend({
|
|
1377
|
-
component:
|
|
1378
|
-
props:
|
|
1379
|
-
label:
|
|
1380
|
-
placeholder:
|
|
1381
|
-
helpText:
|
|
1382
|
-
items:
|
|
1383
|
-
value:
|
|
1489
|
+
component: z8.literal("Combobox"),
|
|
1490
|
+
props: z8.object({
|
|
1491
|
+
label: z8.string().optional(),
|
|
1492
|
+
placeholder: z8.string().optional(),
|
|
1493
|
+
helpText: z8.string().optional(),
|
|
1494
|
+
items: z8.array(z8.object({ value: z8.string(), label: z8.string() })).optional(),
|
|
1495
|
+
value: z8.string().optional()
|
|
1384
1496
|
}),
|
|
1385
1497
|
relationship: RelationshipExtensionSchema.optional()
|
|
1386
1498
|
});
|
|
1387
1499
|
var CheckboxComponentDefinitionSchema = FormV2StylePropsSchema.extend({
|
|
1388
|
-
component:
|
|
1389
|
-
props:
|
|
1390
|
-
label:
|
|
1391
|
-
helpText:
|
|
1392
|
-
checked:
|
|
1393
|
-
disabled:
|
|
1500
|
+
component: z8.literal("Checkbox"),
|
|
1501
|
+
props: z8.object({
|
|
1502
|
+
label: z8.string().optional(),
|
|
1503
|
+
helpText: z8.string().optional(),
|
|
1504
|
+
checked: z8.boolean().optional(),
|
|
1505
|
+
disabled: z8.boolean().optional()
|
|
1394
1506
|
})
|
|
1395
1507
|
});
|
|
1396
1508
|
var DatePickerComponentDefinitionSchema = FormV2StylePropsSchema.extend({
|
|
1397
|
-
component:
|
|
1398
|
-
props:
|
|
1399
|
-
label:
|
|
1400
|
-
helpText:
|
|
1401
|
-
value:
|
|
1402
|
-
disabled:
|
|
1509
|
+
component: z8.literal("DatePicker"),
|
|
1510
|
+
props: z8.object({
|
|
1511
|
+
label: z8.string().optional(),
|
|
1512
|
+
helpText: z8.string().optional(),
|
|
1513
|
+
value: z8.union([z8.string(), z8.date()]).optional(),
|
|
1514
|
+
disabled: z8.boolean().optional()
|
|
1403
1515
|
})
|
|
1404
1516
|
});
|
|
1405
1517
|
var TimePickerComponentDefinitionSchema = FormV2StylePropsSchema.extend({
|
|
1406
|
-
component:
|
|
1407
|
-
props:
|
|
1408
|
-
label:
|
|
1409
|
-
helpText:
|
|
1410
|
-
value:
|
|
1411
|
-
disabled:
|
|
1518
|
+
component: z8.literal("TimePicker"),
|
|
1519
|
+
props: z8.object({
|
|
1520
|
+
label: z8.string().optional(),
|
|
1521
|
+
helpText: z8.string().optional(),
|
|
1522
|
+
value: z8.string().optional(),
|
|
1523
|
+
disabled: z8.boolean().optional()
|
|
1412
1524
|
})
|
|
1413
1525
|
});
|
|
1414
1526
|
var ImageSettingComponentDefinitionSchema = FormV2StylePropsSchema.extend({
|
|
1415
|
-
component:
|
|
1416
|
-
props:
|
|
1417
|
-
label:
|
|
1418
|
-
description:
|
|
1419
|
-
helpText:
|
|
1420
|
-
accept:
|
|
1527
|
+
component: z8.literal("ImageSetting"),
|
|
1528
|
+
props: z8.object({
|
|
1529
|
+
label: z8.string().optional(),
|
|
1530
|
+
description: z8.string().optional(),
|
|
1531
|
+
helpText: z8.string().optional(),
|
|
1532
|
+
accept: z8.string().optional()
|
|
1421
1533
|
})
|
|
1422
1534
|
});
|
|
1423
1535
|
var FileSettingComponentDefinitionSchema = FormV2StylePropsSchema.extend({
|
|
1424
|
-
component:
|
|
1425
|
-
props:
|
|
1426
|
-
label:
|
|
1427
|
-
description:
|
|
1428
|
-
helpText:
|
|
1429
|
-
accept:
|
|
1430
|
-
required:
|
|
1431
|
-
button:
|
|
1432
|
-
label:
|
|
1433
|
-
variant:
|
|
1434
|
-
size:
|
|
1536
|
+
component: z8.literal("FileSetting"),
|
|
1537
|
+
props: z8.object({
|
|
1538
|
+
label: z8.string().optional(),
|
|
1539
|
+
description: z8.string().optional(),
|
|
1540
|
+
helpText: z8.string().optional(),
|
|
1541
|
+
accept: z8.string().optional(),
|
|
1542
|
+
required: z8.boolean().optional(),
|
|
1543
|
+
button: z8.object({
|
|
1544
|
+
label: z8.string().optional(),
|
|
1545
|
+
variant: z8.enum(["default", "outline", "ghost", "link"]).optional(),
|
|
1546
|
+
size: z8.enum(["sm", "md", "lg"]).optional()
|
|
1435
1547
|
}).optional()
|
|
1436
1548
|
})
|
|
1437
1549
|
});
|
|
1438
|
-
var ListItemTemplateSchema =
|
|
1439
|
-
component:
|
|
1440
|
-
span:
|
|
1441
|
-
mdSpan:
|
|
1442
|
-
lgSpan:
|
|
1443
|
-
props:
|
|
1550
|
+
var ListItemTemplateSchema = z8.object({
|
|
1551
|
+
component: z8.string(),
|
|
1552
|
+
span: z8.number().optional(),
|
|
1553
|
+
mdSpan: z8.number().optional(),
|
|
1554
|
+
lgSpan: z8.number().optional(),
|
|
1555
|
+
props: z8.record(z8.string(), z8.unknown())
|
|
1444
1556
|
});
|
|
1445
1557
|
var ListComponentDefinitionSchema = FormV2StylePropsSchema.extend({
|
|
1446
|
-
component:
|
|
1447
|
-
props:
|
|
1448
|
-
title:
|
|
1449
|
-
items:
|
|
1450
|
-
id:
|
|
1451
|
-
label:
|
|
1452
|
-
description:
|
|
1558
|
+
component: z8.literal("List"),
|
|
1559
|
+
props: z8.object({
|
|
1560
|
+
title: z8.string().optional(),
|
|
1561
|
+
items: z8.array(z8.object({
|
|
1562
|
+
id: z8.string(),
|
|
1563
|
+
label: z8.string(),
|
|
1564
|
+
description: z8.string().optional()
|
|
1453
1565
|
})).optional(),
|
|
1454
|
-
emptyMessage:
|
|
1566
|
+
emptyMessage: z8.string().optional()
|
|
1455
1567
|
}),
|
|
1456
|
-
model:
|
|
1457
|
-
labelField:
|
|
1458
|
-
descriptionField:
|
|
1459
|
-
icon:
|
|
1568
|
+
model: z8.string().optional(),
|
|
1569
|
+
labelField: z8.string().optional(),
|
|
1570
|
+
descriptionField: z8.string().optional(),
|
|
1571
|
+
icon: z8.string().optional(),
|
|
1460
1572
|
/** Context variable name to iterate over (e.g., 'phone_numbers') */
|
|
1461
|
-
iterable:
|
|
1573
|
+
iterable: z8.string().optional(),
|
|
1462
1574
|
/** Template for each item - use {{ item.xyz }} for field values */
|
|
1463
1575
|
itemTemplate: ListItemTemplateSchema.optional()
|
|
1464
1576
|
});
|
|
1465
1577
|
var EmptyFormComponentDefinitionSchema = FormV2StylePropsSchema.extend({
|
|
1466
|
-
component:
|
|
1467
|
-
props:
|
|
1468
|
-
title:
|
|
1469
|
-
description:
|
|
1470
|
-
icon:
|
|
1578
|
+
component: z8.literal("EmptyForm"),
|
|
1579
|
+
props: z8.object({
|
|
1580
|
+
title: z8.string().optional(),
|
|
1581
|
+
description: z8.string().optional(),
|
|
1582
|
+
icon: z8.string().optional()
|
|
1471
1583
|
})
|
|
1472
1584
|
});
|
|
1473
1585
|
var AlertComponentDefinitionSchema = FormV2StylePropsSchema.extend({
|
|
1474
|
-
component:
|
|
1475
|
-
props:
|
|
1476
|
-
title:
|
|
1477
|
-
description:
|
|
1478
|
-
icon:
|
|
1479
|
-
variant:
|
|
1586
|
+
component: z8.literal("Alert"),
|
|
1587
|
+
props: z8.object({
|
|
1588
|
+
title: z8.string(),
|
|
1589
|
+
description: z8.string(),
|
|
1590
|
+
icon: z8.string().optional(),
|
|
1591
|
+
variant: z8.enum(["default", "destructive"]).optional()
|
|
1480
1592
|
})
|
|
1481
1593
|
});
|
|
1482
1594
|
var EventWiringPanelComponentDefinitionSchema = FormV2StylePropsSchema.extend({
|
|
1483
|
-
component:
|
|
1484
|
-
props:
|
|
1485
|
-
eventTypes:
|
|
1486
|
-
|
|
1487
|
-
type:
|
|
1488
|
-
label:
|
|
1489
|
-
glofoxType:
|
|
1490
|
-
description:
|
|
1491
|
-
icon:
|
|
1595
|
+
component: z8.literal("EventWiringPanel"),
|
|
1596
|
+
props: z8.object({
|
|
1597
|
+
eventTypes: z8.array(
|
|
1598
|
+
z8.object({
|
|
1599
|
+
type: z8.string(),
|
|
1600
|
+
label: z8.string(),
|
|
1601
|
+
glofoxType: z8.string().optional(),
|
|
1602
|
+
description: z8.string().optional(),
|
|
1603
|
+
icon: z8.string().optional()
|
|
1492
1604
|
})
|
|
1493
1605
|
),
|
|
1494
|
-
recommendedWorkflowHandle:
|
|
1606
|
+
recommendedWorkflowHandle: z8.string().optional()
|
|
1495
1607
|
})
|
|
1496
1608
|
});
|
|
1497
|
-
var ModalFormDefinitionSchema =
|
|
1609
|
+
var ModalFormDefinitionSchema = z8.object({
|
|
1498
1610
|
header: PageFormHeaderSchema,
|
|
1499
|
-
handler:
|
|
1611
|
+
handler: z8.string(),
|
|
1500
1612
|
/** Named dialog template to use instead of inline fields */
|
|
1501
|
-
template:
|
|
1613
|
+
template: z8.string().optional(),
|
|
1502
1614
|
/** Template-specific params to pass to the dialog */
|
|
1503
|
-
templateParams:
|
|
1615
|
+
templateParams: z8.record(z8.string(), z8.unknown()).optional(),
|
|
1504
1616
|
/** Inline field definitions (used when template is not specified) */
|
|
1505
|
-
fields:
|
|
1617
|
+
fields: z8.lazy(() => z8.array(FormV2ComponentDefinitionSchema)).optional(),
|
|
1506
1618
|
layout: FormLayoutConfigDefinitionSchema.optional(),
|
|
1507
|
-
actions:
|
|
1619
|
+
actions: z8.array(PageActionDefinitionSchema).optional()
|
|
1508
1620
|
});
|
|
1509
1621
|
var FieldSettingComponentDefinitionSchema = FormV2StylePropsSchema.extend({
|
|
1510
|
-
component:
|
|
1511
|
-
props:
|
|
1512
|
-
label:
|
|
1513
|
-
description:
|
|
1514
|
-
helpText:
|
|
1515
|
-
mode:
|
|
1622
|
+
component: z8.literal("FieldSetting"),
|
|
1623
|
+
props: z8.object({
|
|
1624
|
+
label: z8.string(),
|
|
1625
|
+
description: z8.string().optional(),
|
|
1626
|
+
helpText: z8.string().optional(),
|
|
1627
|
+
mode: z8.enum(["field", "setting"]).optional(),
|
|
1516
1628
|
/** Status indicator - can be literal or Liquid template */
|
|
1517
|
-
status:
|
|
1629
|
+
status: z8.string().optional(),
|
|
1518
1630
|
/** Text to display alongside status badge - can be Liquid template */
|
|
1519
|
-
statusText:
|
|
1631
|
+
statusText: z8.string().optional(),
|
|
1520
1632
|
button: FieldSettingButtonPropsSchema
|
|
1521
1633
|
}),
|
|
1522
1634
|
modalForm: ModalFormDefinitionSchema.optional()
|
|
1523
1635
|
});
|
|
1524
|
-
var FormV2ComponentDefinitionSchema =
|
|
1636
|
+
var FormV2ComponentDefinitionSchema = z8.discriminatedUnion("component", [
|
|
1525
1637
|
InputComponentDefinitionSchema,
|
|
1526
1638
|
TextareaComponentDefinitionSchema,
|
|
1527
1639
|
SelectComponentDefinitionSchema,
|
|
@@ -1537,82 +1649,82 @@ var FormV2ComponentDefinitionSchema = z7.discriminatedUnion("component", [
|
|
|
1537
1649
|
AlertComponentDefinitionSchema,
|
|
1538
1650
|
EventWiringPanelComponentDefinitionSchema
|
|
1539
1651
|
]);
|
|
1540
|
-
var FormV2PropsDefinitionSchema =
|
|
1541
|
-
formVersion:
|
|
1542
|
-
id:
|
|
1543
|
-
fields:
|
|
1652
|
+
var FormV2PropsDefinitionSchema = z8.object({
|
|
1653
|
+
formVersion: z8.literal("v2"),
|
|
1654
|
+
id: z8.string().optional(),
|
|
1655
|
+
fields: z8.array(FormV2ComponentDefinitionSchema),
|
|
1544
1656
|
layout: FormLayoutConfigDefinitionSchema,
|
|
1545
1657
|
/** Optional actions that trigger MCP tool calls */
|
|
1546
|
-
actions:
|
|
1658
|
+
actions: z8.array(PageActionDefinitionSchema).optional()
|
|
1547
1659
|
});
|
|
1548
|
-
var CardBlockHeaderSchema =
|
|
1549
|
-
title:
|
|
1550
|
-
description:
|
|
1551
|
-
descriptionHref:
|
|
1660
|
+
var CardBlockHeaderSchema = z8.object({
|
|
1661
|
+
title: z8.string(),
|
|
1662
|
+
description: z8.string().optional(),
|
|
1663
|
+
descriptionHref: z8.string().optional()
|
|
1552
1664
|
});
|
|
1553
|
-
var CardBlockDefinitionSchema =
|
|
1554
|
-
type:
|
|
1555
|
-
restructurable:
|
|
1665
|
+
var CardBlockDefinitionSchema = z8.object({
|
|
1666
|
+
type: z8.literal("card"),
|
|
1667
|
+
restructurable: z8.boolean().optional(),
|
|
1556
1668
|
header: CardBlockHeaderSchema.optional(),
|
|
1557
1669
|
form: FormV2PropsDefinitionSchema,
|
|
1558
|
-
actions:
|
|
1559
|
-
secondaryActions:
|
|
1560
|
-
primaryActions:
|
|
1670
|
+
actions: z8.array(PageActionDefinitionSchema).optional(),
|
|
1671
|
+
secondaryActions: z8.array(PageActionDefinitionSchema).optional(),
|
|
1672
|
+
primaryActions: z8.array(PageActionDefinitionSchema).optional()
|
|
1561
1673
|
});
|
|
1562
|
-
var PageFieldDefinitionBaseSchema =
|
|
1563
|
-
handle:
|
|
1674
|
+
var PageFieldDefinitionBaseSchema = z8.object({
|
|
1675
|
+
handle: z8.string(),
|
|
1564
1676
|
type: PageFieldTypeSchema,
|
|
1565
|
-
label:
|
|
1566
|
-
description:
|
|
1567
|
-
required:
|
|
1568
|
-
handler:
|
|
1677
|
+
label: z8.string(),
|
|
1678
|
+
description: z8.string().optional(),
|
|
1679
|
+
required: z8.boolean().optional(),
|
|
1680
|
+
handler: z8.string().optional(),
|
|
1569
1681
|
source: PageFieldSourceSchema.optional(),
|
|
1570
|
-
options:
|
|
1571
|
-
accept:
|
|
1572
|
-
model:
|
|
1682
|
+
options: z8.array(z8.object({ value: z8.string(), label: z8.string() })).optional(),
|
|
1683
|
+
accept: z8.string().optional(),
|
|
1684
|
+
model: z8.string().optional()
|
|
1573
1685
|
});
|
|
1574
1686
|
var PageFieldDefinitionSchema = PageFieldDefinitionBaseSchema.extend({
|
|
1575
1687
|
header: PageFormHeaderSchema.optional(),
|
|
1576
|
-
fields:
|
|
1577
|
-
actions:
|
|
1578
|
-
});
|
|
1579
|
-
var LegacyFormBlockDefinitionSchema =
|
|
1580
|
-
type:
|
|
1581
|
-
title:
|
|
1582
|
-
fields:
|
|
1583
|
-
readonly:
|
|
1584
|
-
});
|
|
1585
|
-
var ListBlockDefinitionSchema =
|
|
1586
|
-
type:
|
|
1587
|
-
title:
|
|
1588
|
-
model:
|
|
1589
|
-
labelField:
|
|
1590
|
-
descriptionField:
|
|
1591
|
-
icon:
|
|
1592
|
-
emptyMessage:
|
|
1593
|
-
});
|
|
1594
|
-
var ModelMapperBlockDefinitionSchema =
|
|
1595
|
-
type:
|
|
1688
|
+
fields: z8.lazy(() => z8.array(PageFieldDefinitionSchema)).optional(),
|
|
1689
|
+
actions: z8.lazy(() => z8.array(PageActionDefinitionSchema)).optional()
|
|
1690
|
+
});
|
|
1691
|
+
var LegacyFormBlockDefinitionSchema = z8.object({
|
|
1692
|
+
type: z8.enum(["form", "spreadsheet", "kanban", "calendar", "link"]),
|
|
1693
|
+
title: z8.string().optional(),
|
|
1694
|
+
fields: z8.array(PageFieldDefinitionSchema).optional(),
|
|
1695
|
+
readonly: z8.boolean().optional()
|
|
1696
|
+
});
|
|
1697
|
+
var ListBlockDefinitionSchema = z8.object({
|
|
1698
|
+
type: z8.literal("list"),
|
|
1699
|
+
title: z8.string().optional(),
|
|
1700
|
+
model: z8.string(),
|
|
1701
|
+
labelField: z8.string().optional(),
|
|
1702
|
+
descriptionField: z8.string().optional(),
|
|
1703
|
+
icon: z8.string().optional(),
|
|
1704
|
+
emptyMessage: z8.string().optional()
|
|
1705
|
+
});
|
|
1706
|
+
var ModelMapperBlockDefinitionSchema = z8.object({
|
|
1707
|
+
type: z8.literal("model_mapper"),
|
|
1596
1708
|
/** The SHARED model handle from install config (e.g., "client", "patient") */
|
|
1597
|
-
model:
|
|
1709
|
+
model: z8.string()
|
|
1598
1710
|
});
|
|
1599
|
-
var PageBlockDefinitionSchema =
|
|
1711
|
+
var PageBlockDefinitionSchema = z8.union([
|
|
1600
1712
|
CardBlockDefinitionSchema,
|
|
1601
1713
|
LegacyFormBlockDefinitionSchema,
|
|
1602
1714
|
ListBlockDefinitionSchema,
|
|
1603
1715
|
ModelMapperBlockDefinitionSchema
|
|
1604
1716
|
]);
|
|
1605
|
-
var PageContextModeSchema =
|
|
1606
|
-
var PageContextFiltersSchema =
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1717
|
+
var PageContextModeSchema = z8.enum(["first", "many", "count", "all"]).transform((val) => val === "all" ? "many" : val);
|
|
1718
|
+
var PageContextFiltersSchema = z8.record(
|
|
1719
|
+
z8.string(),
|
|
1720
|
+
z8.record(
|
|
1721
|
+
z8.string(),
|
|
1722
|
+
z8.union([PrimitiveSchema, z8.array(PrimitiveSchema), z8.string()])
|
|
1611
1723
|
)
|
|
1612
1724
|
);
|
|
1613
|
-
var PageContextItemDefinitionSchema =
|
|
1725
|
+
var PageContextItemDefinitionSchema = z8.object({
|
|
1614
1726
|
/** Model handle to fetch data from */
|
|
1615
|
-
model:
|
|
1727
|
+
model: z8.string(),
|
|
1616
1728
|
/** Fetch mode: 'first' returns single object, 'many' returns array, 'count' returns number */
|
|
1617
1729
|
mode: PageContextModeSchema,
|
|
1618
1730
|
/**
|
|
@@ -1622,69 +1734,69 @@ var PageContextItemDefinitionSchema = z7.object({
|
|
|
1622
1734
|
*/
|
|
1623
1735
|
filters: PageContextFiltersSchema.optional(),
|
|
1624
1736
|
/** Optional limit for 'many' mode */
|
|
1625
|
-
limit:
|
|
1737
|
+
limit: z8.number().optional()
|
|
1626
1738
|
});
|
|
1627
|
-
var PageContextToolItemDefinitionSchema =
|
|
1739
|
+
var PageContextToolItemDefinitionSchema = z8.object({
|
|
1628
1740
|
/** Tool name to invoke for fetching context data */
|
|
1629
|
-
tool:
|
|
1741
|
+
tool: z8.string()
|
|
1630
1742
|
});
|
|
1631
|
-
var PageContextDefinitionSchema =
|
|
1632
|
-
|
|
1633
|
-
|
|
1743
|
+
var PageContextDefinitionSchema = z8.record(
|
|
1744
|
+
z8.string(),
|
|
1745
|
+
z8.union([PageContextItemDefinitionSchema, PageContextToolItemDefinitionSchema])
|
|
1634
1746
|
);
|
|
1635
|
-
var PageInstanceFilterSchema =
|
|
1636
|
-
model:
|
|
1637
|
-
where:
|
|
1747
|
+
var PageInstanceFilterSchema = z8.object({
|
|
1748
|
+
model: z8.string(),
|
|
1749
|
+
where: z8.record(z8.string(), z8.unknown()).optional()
|
|
1638
1750
|
});
|
|
1639
|
-
var NavigationItemSchema =
|
|
1751
|
+
var NavigationItemSchema = z8.object({
|
|
1640
1752
|
/** Display label (supports Liquid templates) */
|
|
1641
|
-
label:
|
|
1753
|
+
label: z8.string(),
|
|
1642
1754
|
/** URL href (supports Liquid templates with path_params and context) */
|
|
1643
|
-
href:
|
|
1755
|
+
href: z8.string(),
|
|
1644
1756
|
/** Optional icon name */
|
|
1645
|
-
icon:
|
|
1757
|
+
icon: z8.string().optional(),
|
|
1646
1758
|
/** When true, item is omitted from rendered navigation (supports Liquid templates) */
|
|
1647
|
-
hidden:
|
|
1759
|
+
hidden: z8.union([z8.boolean(), z8.string()]).optional()
|
|
1648
1760
|
});
|
|
1649
|
-
var NavigationSectionSchema =
|
|
1761
|
+
var NavigationSectionSchema = z8.object({
|
|
1650
1762
|
/** Section title (supports Liquid templates) */
|
|
1651
|
-
title:
|
|
1763
|
+
title: z8.string().optional(),
|
|
1652
1764
|
/** Navigation items in this section */
|
|
1653
|
-
items:
|
|
1765
|
+
items: z8.array(NavigationItemSchema)
|
|
1654
1766
|
});
|
|
1655
|
-
var NavigationSidebarSchema =
|
|
1767
|
+
var NavigationSidebarSchema = z8.object({
|
|
1656
1768
|
/** Sections to display in the sidebar */
|
|
1657
|
-
sections:
|
|
1769
|
+
sections: z8.array(NavigationSectionSchema)
|
|
1658
1770
|
});
|
|
1659
|
-
var BreadcrumbItemSchema =
|
|
1771
|
+
var BreadcrumbItemSchema = z8.object({
|
|
1660
1772
|
/** Display label (supports Liquid templates) */
|
|
1661
|
-
label:
|
|
1773
|
+
label: z8.string(),
|
|
1662
1774
|
/** Optional href - if not provided, item is not clickable */
|
|
1663
|
-
href:
|
|
1775
|
+
href: z8.string().optional()
|
|
1664
1776
|
});
|
|
1665
|
-
var NavigationBreadcrumbSchema =
|
|
1777
|
+
var NavigationBreadcrumbSchema = z8.object({
|
|
1666
1778
|
/** Breadcrumb items from left to right */
|
|
1667
|
-
items:
|
|
1779
|
+
items: z8.array(BreadcrumbItemSchema)
|
|
1668
1780
|
});
|
|
1669
|
-
var NavigationConfigSchema =
|
|
1781
|
+
var NavigationConfigSchema = z8.object({
|
|
1670
1782
|
/** Sidebar navigation */
|
|
1671
1783
|
sidebar: NavigationSidebarSchema.optional(),
|
|
1672
1784
|
/** Breadcrumb navigation */
|
|
1673
1785
|
breadcrumb: NavigationBreadcrumbSchema.optional()
|
|
1674
1786
|
});
|
|
1675
|
-
var PageAudienceSchema =
|
|
1676
|
-
var PageDefinitionSchema =
|
|
1787
|
+
var PageAudienceSchema = z8.enum(["install", "developer", "both"]);
|
|
1788
|
+
var PageDefinitionSchema = z8.object({
|
|
1677
1789
|
/** Unique identifier within the app (snake_case) */
|
|
1678
|
-
handle:
|
|
1790
|
+
handle: z8.string().optional(),
|
|
1679
1791
|
/** Human-readable display name */
|
|
1680
|
-
label:
|
|
1792
|
+
label: z8.string(),
|
|
1681
1793
|
/** Optional description for documentation/UI */
|
|
1682
|
-
description:
|
|
1794
|
+
description: z8.string().optional(),
|
|
1683
1795
|
type: PageTypeSchema,
|
|
1684
1796
|
/** URL path for this page (e.g., '/phone-numbers' or '/phone-numbers/[id]' for dynamic segments) */
|
|
1685
|
-
path:
|
|
1797
|
+
path: z8.string(),
|
|
1686
1798
|
/** When true, this page is the default landing page for the app installation */
|
|
1687
|
-
default:
|
|
1799
|
+
default: z8.boolean().optional(),
|
|
1688
1800
|
/**
|
|
1689
1801
|
* Page audience:
|
|
1690
1802
|
* - 'install': Visible only to app installers (default)
|
|
@@ -1698,115 +1810,171 @@ var PageDefinitionSchema = z7.object({
|
|
|
1698
1810
|
* - string: Liquid template that evaluates to true/false
|
|
1699
1811
|
* - NavigationConfigSchema: full navigation override for this page (replaces base navigation)
|
|
1700
1812
|
*/
|
|
1701
|
-
navigation:
|
|
1702
|
-
blocks:
|
|
1703
|
-
actions:
|
|
1813
|
+
navigation: z8.union([z8.boolean(), z8.string(), NavigationConfigSchema]).optional().default(true),
|
|
1814
|
+
blocks: z8.array(PageBlockDefinitionSchema),
|
|
1815
|
+
actions: z8.array(PageActionDefinitionSchema).optional(),
|
|
1704
1816
|
/** Context data to load for Liquid templates. appInstallationId filtering is automatic. */
|
|
1705
1817
|
context: PageContextDefinitionSchema.optional(),
|
|
1706
1818
|
/** @deprecated Use context instead */
|
|
1707
1819
|
filter: PageInstanceFilterSchema.optional()
|
|
1708
1820
|
});
|
|
1709
|
-
var WebhookHttpMethodSchema =
|
|
1710
|
-
var WebhookTypeSchema =
|
|
1711
|
-
var WebhookHandlerDefinitionSchema =
|
|
1712
|
-
description:
|
|
1713
|
-
methods:
|
|
1821
|
+
var WebhookHttpMethodSchema = z8.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]);
|
|
1822
|
+
var WebhookTypeSchema = z8.enum(["WEBHOOK", "CALLBACK"]);
|
|
1823
|
+
var WebhookHandlerDefinitionSchema = z8.object({
|
|
1824
|
+
description: z8.string().optional(),
|
|
1825
|
+
methods: z8.array(WebhookHttpMethodSchema).optional(),
|
|
1714
1826
|
/** Invocation type: WEBHOOK (fire-and-forget) or CALLBACK (waits for response). Defaults to WEBHOOK. */
|
|
1715
1827
|
type: WebhookTypeSchema.optional(),
|
|
1716
|
-
handler:
|
|
1828
|
+
handler: z8.unknown()
|
|
1717
1829
|
});
|
|
1718
|
-
var WebhooksSchema =
|
|
1719
|
-
var AgentDefinitionSchema =
|
|
1830
|
+
var WebhooksSchema = z8.record(z8.string(), WebhookHandlerDefinitionSchema);
|
|
1831
|
+
var AgentDefinitionSchema = z8.object({
|
|
1720
1832
|
/** Unique identifier within the app (used for upserts) */
|
|
1721
|
-
handle:
|
|
1833
|
+
handle: z8.string().regex(/^[a-z0-9_-]+$/, "Handle must be lowercase alphanumeric with dashes/underscores"),
|
|
1722
1834
|
/** Display name */
|
|
1723
|
-
name:
|
|
1835
|
+
name: z8.string().min(1),
|
|
1724
1836
|
/** Description of what the agent does */
|
|
1725
|
-
description:
|
|
1837
|
+
description: z8.string(),
|
|
1726
1838
|
/** System prompt (static, no templating) */
|
|
1727
|
-
system:
|
|
1839
|
+
system: z8.string(),
|
|
1728
1840
|
/** Tool names to bind (can be empty for orchestrator agents) */
|
|
1729
|
-
tools:
|
|
1841
|
+
tools: z8.array(z8.string()),
|
|
1730
1842
|
/** Optional LLM model override */
|
|
1731
|
-
llmModelId:
|
|
1843
|
+
llmModelId: z8.string().optional(),
|
|
1732
1844
|
/** Parent agent that can call this agent ('composer' or another agent handle) */
|
|
1733
|
-
parentAgent:
|
|
1845
|
+
parentAgent: z8.string().optional()
|
|
1734
1846
|
});
|
|
1735
|
-
var InstallConfigSchema =
|
|
1847
|
+
var InstallConfigSchema = z8.object({
|
|
1736
1848
|
env: EnvSchemaSchema.optional(),
|
|
1737
1849
|
/** SHARED model definitions (mapped to user's existing data during installation) */
|
|
1738
|
-
models:
|
|
1850
|
+
models: z8.array(ModelDefinitionSchema).optional(),
|
|
1739
1851
|
/** Relationship definitions between SHARED models */
|
|
1740
|
-
relationships:
|
|
1852
|
+
relationships: z8.array(RelationshipDefinitionSchema).optional()
|
|
1741
1853
|
});
|
|
1742
|
-
var ProvisionConfigSchema =
|
|
1854
|
+
var ProvisionConfigSchema = z8.object({
|
|
1743
1855
|
env: EnvSchemaSchema.optional(),
|
|
1744
1856
|
/** INTERNAL model definitions (app-owned, not visible to users) */
|
|
1745
|
-
models:
|
|
1857
|
+
models: z8.array(ModelDefinitionSchema).optional(),
|
|
1746
1858
|
/** Relationship definitions between INTERNAL models */
|
|
1747
|
-
relationships:
|
|
1748
|
-
channels:
|
|
1749
|
-
workflows:
|
|
1859
|
+
relationships: z8.array(RelationshipDefinitionSchema).optional(),
|
|
1860
|
+
channels: z8.array(ChannelDefinitionSchema).optional(),
|
|
1861
|
+
workflows: z8.array(WorkflowDefinitionSchema).optional(),
|
|
1750
1862
|
/** Base navigation configuration for all pages (can be overridden per page) */
|
|
1751
1863
|
navigation: NavigationConfigSchema.optional(),
|
|
1752
|
-
pages:
|
|
1864
|
+
pages: z8.array(PageDefinitionSchema).optional()
|
|
1753
1865
|
});
|
|
1754
|
-
var SkedyulConfigSchema =
|
|
1755
|
-
name:
|
|
1756
|
-
version:
|
|
1757
|
-
description:
|
|
1866
|
+
var SkedyulConfigSchema = z8.object({
|
|
1867
|
+
name: z8.string(),
|
|
1868
|
+
version: z8.string().optional(),
|
|
1869
|
+
description: z8.string().optional(),
|
|
1758
1870
|
computeLayer: ComputeLayerTypeSchema.optional(),
|
|
1759
|
-
tools:
|
|
1760
|
-
webhooks:
|
|
1761
|
-
provision:
|
|
1762
|
-
agents:
|
|
1871
|
+
tools: z8.unknown().optional(),
|
|
1872
|
+
webhooks: z8.unknown().optional(),
|
|
1873
|
+
provision: z8.union([ProvisionConfigSchema, z8.unknown()]).optional(),
|
|
1874
|
+
agents: z8.array(AgentDefinitionSchema).optional()
|
|
1763
1875
|
});
|
|
1764
1876
|
function safeParseConfig(data) {
|
|
1765
1877
|
const result = SkedyulConfigSchema.safeParse(data);
|
|
1766
1878
|
return result.success ? result.data : null;
|
|
1767
1879
|
}
|
|
1768
|
-
var MessageSendChannelSchema =
|
|
1769
|
-
id:
|
|
1770
|
-
handle:
|
|
1771
|
-
identifierValue:
|
|
1772
|
-
});
|
|
1773
|
-
var MessageSendSubscriptionSchema =
|
|
1774
|
-
id:
|
|
1775
|
-
identifierValue:
|
|
1776
|
-
});
|
|
1777
|
-
var MessageSendContactSchema =
|
|
1778
|
-
id:
|
|
1779
|
-
name:
|
|
1780
|
-
});
|
|
1781
|
-
var MessageSendRecipientSchema =
|
|
1782
|
-
address:
|
|
1783
|
-
name:
|
|
1784
|
-
participantId:
|
|
1785
|
-
contactId:
|
|
1786
|
-
});
|
|
1787
|
-
var MessageSendAttachmentSchema =
|
|
1788
|
-
filename:
|
|
1789
|
-
url:
|
|
1790
|
-
mimeType:
|
|
1791
|
-
size:
|
|
1792
|
-
});
|
|
1793
|
-
var MessageSendMessageSchema =
|
|
1794
|
-
id:
|
|
1795
|
-
content:
|
|
1796
|
-
contentRaw:
|
|
1797
|
-
title:
|
|
1798
|
-
attachments:
|
|
1799
|
-
});
|
|
1800
|
-
var MessageSendInputSchema =
|
|
1880
|
+
var MessageSendChannelSchema = z8.object({
|
|
1881
|
+
id: z8.string(),
|
|
1882
|
+
handle: z8.string(),
|
|
1883
|
+
identifierValue: z8.string()
|
|
1884
|
+
});
|
|
1885
|
+
var MessageSendSubscriptionSchema = z8.object({
|
|
1886
|
+
id: z8.string(),
|
|
1887
|
+
identifierValue: z8.string()
|
|
1888
|
+
});
|
|
1889
|
+
var MessageSendContactSchema = z8.object({
|
|
1890
|
+
id: z8.string(),
|
|
1891
|
+
name: z8.string().optional()
|
|
1892
|
+
});
|
|
1893
|
+
var MessageSendRecipientSchema = z8.object({
|
|
1894
|
+
address: z8.string(),
|
|
1895
|
+
name: z8.string().optional(),
|
|
1896
|
+
participantId: z8.string().optional(),
|
|
1897
|
+
contactId: z8.string().optional()
|
|
1898
|
+
});
|
|
1899
|
+
var MessageSendAttachmentSchema = z8.object({
|
|
1900
|
+
filename: z8.string(),
|
|
1901
|
+
url: z8.string(),
|
|
1902
|
+
mimeType: z8.string(),
|
|
1903
|
+
size: z8.number()
|
|
1904
|
+
});
|
|
1905
|
+
var MessageSendMessageSchema = z8.object({
|
|
1906
|
+
id: z8.string(),
|
|
1907
|
+
content: z8.string(),
|
|
1908
|
+
contentRaw: z8.string().optional(),
|
|
1909
|
+
title: z8.string().optional(),
|
|
1910
|
+
attachments: z8.array(MessageSendAttachmentSchema).optional()
|
|
1911
|
+
});
|
|
1912
|
+
var MessageSendInputSchema = z8.object({
|
|
1801
1913
|
channel: MessageSendChannelSchema,
|
|
1802
1914
|
subscription: MessageSendSubscriptionSchema.optional(),
|
|
1803
1915
|
contact: MessageSendContactSchema.optional(),
|
|
1804
1916
|
recipient: MessageSendRecipientSchema.optional(),
|
|
1805
1917
|
message: MessageSendMessageSchema
|
|
1806
1918
|
});
|
|
1807
|
-
var MessageSendOutputSchema =
|
|
1808
|
-
status:
|
|
1809
|
-
remoteId:
|
|
1919
|
+
var MessageSendOutputSchema = z8.object({
|
|
1920
|
+
status: z8.enum(["sent", "queued", "failed"]),
|
|
1921
|
+
remoteId: z8.string().optional()
|
|
1922
|
+
});
|
|
1923
|
+
var MessageBulkRecipientSchema = z8.object({
|
|
1924
|
+
address: z8.string(),
|
|
1925
|
+
renderedBody: z8.string(),
|
|
1926
|
+
instanceId: z8.string().optional(),
|
|
1927
|
+
threadId: z8.string().optional(),
|
|
1928
|
+
messageId: z8.string().optional(),
|
|
1929
|
+
contactId: z8.string().optional()
|
|
1930
|
+
});
|
|
1931
|
+
var MessageBulkSendInputSchema = z8.object({
|
|
1932
|
+
channel: MessageSendChannelSchema,
|
|
1933
|
+
recipients: z8.array(MessageBulkRecipientSchema).min(1).max(1e4),
|
|
1934
|
+
schedule: z8.object({ at: z8.string() }).optional()
|
|
1935
|
+
});
|
|
1936
|
+
var MessageBulkSendOutputSchema = z8.object({
|
|
1937
|
+
status: z8.enum(["accepted", "failed"]),
|
|
1938
|
+
operationId: z8.string().optional(),
|
|
1939
|
+
acceptedCount: z8.number().int().nonnegative(),
|
|
1940
|
+
rejectedCount: z8.number().int().nonnegative().optional()
|
|
1941
|
+
});
|
|
1942
|
+
var MessageBulkStatusMessageSchema = z8.object({
|
|
1943
|
+
address: z8.string(),
|
|
1944
|
+
status: z8.string(),
|
|
1945
|
+
messageId: z8.string().optional(),
|
|
1946
|
+
errorCode: z8.union([z8.string(), z8.number()]).optional(),
|
|
1947
|
+
errorMessage: z8.string().optional()
|
|
1948
|
+
});
|
|
1949
|
+
var MessageBulkStatusStatsSchema = z8.object({
|
|
1950
|
+
total: z8.number().int().nonnegative().optional(),
|
|
1951
|
+
recipients: z8.number().int().nonnegative().optional(),
|
|
1952
|
+
attempts: z8.number().int().nonnegative().optional(),
|
|
1953
|
+
unaddressable: z8.number().int().nonnegative().optional(),
|
|
1954
|
+
queued: z8.number().int().nonnegative().optional(),
|
|
1955
|
+
sent: z8.number().int().nonnegative().optional(),
|
|
1956
|
+
scheduled: z8.number().int().nonnegative().optional(),
|
|
1957
|
+
delivered: z8.number().int().nonnegative().optional(),
|
|
1958
|
+
read: z8.number().int().nonnegative().optional(),
|
|
1959
|
+
undelivered: z8.number().int().nonnegative().optional(),
|
|
1960
|
+
failed: z8.number().int().nonnegative().optional(),
|
|
1961
|
+
canceled: z8.number().int().nonnegative().optional()
|
|
1962
|
+
});
|
|
1963
|
+
var MessageBulkStatusInputSchema = z8.object({
|
|
1964
|
+
channel: MessageSendChannelSchema,
|
|
1965
|
+
operationId: z8.string().min(1)
|
|
1966
|
+
});
|
|
1967
|
+
var MessageBulkStatusOutputSchema = z8.object({
|
|
1968
|
+
operationId: z8.string(),
|
|
1969
|
+
status: z8.string(),
|
|
1970
|
+
complete: z8.boolean(),
|
|
1971
|
+
/**
|
|
1972
|
+
* When true, the provider skipped real delivery (e.g. MOCK_OUTBOUND_MESSAGES).
|
|
1973
|
+
* Core should mark all recipients in the operation as sent without per-message rows.
|
|
1974
|
+
*/
|
|
1975
|
+
mock: z8.boolean().optional(),
|
|
1976
|
+
stats: MessageBulkStatusStatsSchema.optional(),
|
|
1977
|
+
messages: z8.array(MessageBulkStatusMessageSchema)
|
|
1810
1978
|
});
|
|
1811
1979
|
function isModelDependency(dep) {
|
|
1812
1980
|
return "model" in dep;
|
|
@@ -1820,7 +1988,7 @@ function isWorkflowDependency(dep) {
|
|
|
1820
1988
|
|
|
1821
1989
|
// src/server/index.ts
|
|
1822
1990
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
1823
|
-
import * as
|
|
1991
|
+
import * as z11 from "zod";
|
|
1824
1992
|
|
|
1825
1993
|
// src/core/service.ts
|
|
1826
1994
|
var CoreApiService = class {
|
|
@@ -1929,17 +2097,20 @@ function getQueueConfigWithRetry(queueName) {
|
|
|
1929
2097
|
}
|
|
1930
2098
|
|
|
1931
2099
|
// src/server/utils/schema.ts
|
|
1932
|
-
import * as
|
|
2100
|
+
import * as z9 from "zod";
|
|
1933
2101
|
function normalizeBilling(billing) {
|
|
1934
|
-
if (!billing || typeof billing
|
|
2102
|
+
if (!billing || typeof billing !== "object") {
|
|
1935
2103
|
return { credits: 0 };
|
|
1936
2104
|
}
|
|
2105
|
+
if (typeof billing.credits !== "number") {
|
|
2106
|
+
return { ...billing, credits: 0 };
|
|
2107
|
+
}
|
|
1937
2108
|
return billing;
|
|
1938
2109
|
}
|
|
1939
2110
|
function toJsonSchema(schema) {
|
|
1940
2111
|
if (!schema) return void 0;
|
|
1941
2112
|
try {
|
|
1942
|
-
return
|
|
2113
|
+
return z9.toJSONSchema(schema, {
|
|
1943
2114
|
unrepresentable: "any"
|
|
1944
2115
|
// Handle z.date(), z.bigint() etc gracefully
|
|
1945
2116
|
});
|
|
@@ -1950,12 +2121,12 @@ function toJsonSchema(schema) {
|
|
|
1950
2121
|
}
|
|
1951
2122
|
function isToolSchemaWithJson(schema) {
|
|
1952
2123
|
return Boolean(
|
|
1953
|
-
schema && typeof schema === "object" && "zod" in schema && schema.zod instanceof
|
|
2124
|
+
schema && typeof schema === "object" && "zod" in schema && schema.zod instanceof z9.ZodType
|
|
1954
2125
|
);
|
|
1955
2126
|
}
|
|
1956
2127
|
function getZodSchema(schema) {
|
|
1957
2128
|
if (!schema) return void 0;
|
|
1958
|
-
if (schema instanceof
|
|
2129
|
+
if (schema instanceof z9.ZodType) {
|
|
1959
2130
|
return schema;
|
|
1960
2131
|
}
|
|
1961
2132
|
if (isToolSchemaWithJson(schema)) {
|
|
@@ -2102,7 +2273,7 @@ function buildToolCallErrorOutput(result) {
|
|
|
2102
2273
|
|
|
2103
2274
|
// src/core/client.ts
|
|
2104
2275
|
import { AsyncLocalStorage } from "async_hooks";
|
|
2105
|
-
import { z as
|
|
2276
|
+
import { z as z10 } from "zod/v4";
|
|
2106
2277
|
var requestConfigStorage = new AsyncLocalStorage();
|
|
2107
2278
|
var globalConfig = {
|
|
2108
2279
|
baseUrl: process.env.SKEDYUL_API_URL ?? process.env.SKEDYUL_NODE_URL ?? "",
|
|
@@ -3082,7 +3253,7 @@ var resource = {
|
|
|
3082
3253
|
}
|
|
3083
3254
|
};
|
|
3084
3255
|
function zodSchemaToJsonSchema(schema) {
|
|
3085
|
-
return
|
|
3256
|
+
return z10.toJSONSchema(schema);
|
|
3086
3257
|
}
|
|
3087
3258
|
var ai = {
|
|
3088
3259
|
/**
|
|
@@ -3308,10 +3479,27 @@ function getActiveQueuedOperation() {
|
|
|
3308
3479
|
function getActiveQueuedOperationStack() {
|
|
3309
3480
|
return activeOperationStackStorage.getStore() ?? [];
|
|
3310
3481
|
}
|
|
3311
|
-
function
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3482
|
+
function getActiveMutexQueueNames() {
|
|
3483
|
+
const names = /* @__PURE__ */ new Set();
|
|
3484
|
+
for (const operation of getActiveQueuedOperationStack()) {
|
|
3485
|
+
if (operation.lease === null) {
|
|
3486
|
+
continue;
|
|
3487
|
+
}
|
|
3488
|
+
const config = getQueueConfigWithRetry(operation.resolved.name);
|
|
3489
|
+
if (config?.mutex === true) {
|
|
3490
|
+
names.add(operation.resolved.name);
|
|
3491
|
+
}
|
|
3492
|
+
}
|
|
3493
|
+
return [...names];
|
|
3494
|
+
}
|
|
3495
|
+
function shouldSkipNestedAcquire(queueName) {
|
|
3496
|
+
for (const mutexQueueName of getActiveMutexQueueNames()) {
|
|
3497
|
+
const config = getQueueConfigWithRetry(mutexQueueName);
|
|
3498
|
+
if (config?.suppressesQueues?.includes(queueName)) {
|
|
3499
|
+
return true;
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
return false;
|
|
3315
3503
|
}
|
|
3316
3504
|
function setActiveQueuedOperationLease(lease) {
|
|
3317
3505
|
const op = activeOperationStorage.getStore();
|
|
@@ -3548,6 +3736,7 @@ function buildToolMetadata(registry) {
|
|
|
3548
3736
|
const timeout = typeof rawTimeout === "number" && rawTimeout > 0 ? rawTimeout : 1e4;
|
|
3549
3737
|
const retries = typeof rawRetries === "number" && rawRetries >= 1 ? rawRetries : 1;
|
|
3550
3738
|
const queueTouchPoints = tool.queueTouchPoints ?? toolConfig.queueTouchPoints;
|
|
3739
|
+
const rateLimitHandoff = tool.rateLimitHandoff ?? toolConfig.rateLimitHandoff;
|
|
3551
3740
|
return {
|
|
3552
3741
|
name: tool.name,
|
|
3553
3742
|
displayName: tool.label || tool.name,
|
|
@@ -3558,11 +3747,13 @@ function buildToolMetadata(registry) {
|
|
|
3558
3747
|
timeout,
|
|
3559
3748
|
retries,
|
|
3560
3749
|
queueTouchPoints,
|
|
3750
|
+
rateLimitHandoff,
|
|
3561
3751
|
config: {
|
|
3562
3752
|
timeout,
|
|
3563
3753
|
retries,
|
|
3564
3754
|
completionHints: toolConfig.completionHints,
|
|
3565
|
-
queueTouchPoints
|
|
3755
|
+
queueTouchPoints,
|
|
3756
|
+
rateLimitHandoff
|
|
3566
3757
|
}
|
|
3567
3758
|
};
|
|
3568
3759
|
});
|
|
@@ -3604,7 +3795,8 @@ function createCallToolHandler(registry, state, onMaxRequests) {
|
|
|
3604
3795
|
}
|
|
3605
3796
|
const fn = tool.handler;
|
|
3606
3797
|
const args = toolArgsInput ?? {};
|
|
3607
|
-
const
|
|
3798
|
+
const rawContextForMode = args.context ?? {};
|
|
3799
|
+
const estimateMode = args.estimate === true || rawContextForMode.mode === "estimate";
|
|
3608
3800
|
if (!estimateMode) {
|
|
3609
3801
|
state.incrementRequestCount();
|
|
3610
3802
|
if (state.shouldShutdown()) {
|
|
@@ -4091,7 +4283,8 @@ function serializeConfig(config) {
|
|
|
4091
4283
|
// Read timeout/retries from top-level first, then fallback to config
|
|
4092
4284
|
timeout: tool.timeout ?? tool.config?.timeout,
|
|
4093
4285
|
retries: tool.retries ?? tool.config?.retries,
|
|
4094
|
-
queueTouchPoints: tool.queueTouchPoints ?? tool.config?.queueTouchPoints
|
|
4286
|
+
queueTouchPoints: tool.queueTouchPoints ?? tool.config?.queueTouchPoints,
|
|
4287
|
+
rateLimitHandoff: tool.rateLimitHandoff ?? tool.config?.rateLimitHandoff
|
|
4095
4288
|
})) : [],
|
|
4096
4289
|
webhooks: webhookRegistry ? Object.values(webhookRegistry).map((w) => ({
|
|
4097
4290
|
name: w.name,
|
|
@@ -4786,11 +4979,12 @@ async function handleMcpRoute(req, ctx) {
|
|
|
4786
4979
|
async function handleMcpToolsCall(params, id, ctx) {
|
|
4787
4980
|
const toolName = params?.name;
|
|
4788
4981
|
const rawArgs = params?.arguments ?? {};
|
|
4789
|
-
const hasSkedyulFormat = "inputs" in rawArgs || "env" in rawArgs || "context" in rawArgs || "invocation" in rawArgs;
|
|
4982
|
+
const hasSkedyulFormat = "inputs" in rawArgs || "env" in rawArgs || "context" in rawArgs || "invocation" in rawArgs || "estimate" in rawArgs;
|
|
4790
4983
|
const toolInputs = hasSkedyulFormat ? rawArgs.inputs ?? {} : rawArgs;
|
|
4791
4984
|
const toolContext = hasSkedyulFormat ? rawArgs.context : void 0;
|
|
4792
4985
|
const toolEnv = hasSkedyulFormat ? rawArgs.env : void 0;
|
|
4793
4986
|
const toolInvocation = hasSkedyulFormat ? rawArgs.invocation : void 0;
|
|
4987
|
+
const estimate = hasSkedyulFormat && rawArgs.estimate === true;
|
|
4794
4988
|
const found = findToolInRegistry(ctx.registry, toolName);
|
|
4795
4989
|
if (!found) {
|
|
4796
4990
|
return {
|
|
@@ -4815,7 +5009,8 @@ async function handleMcpToolsCall(params, id, ctx) {
|
|
|
4815
5009
|
inputs: validatedInputs,
|
|
4816
5010
|
context: toolContext,
|
|
4817
5011
|
env: toolEnv,
|
|
4818
|
-
invocation: toolInvocation
|
|
5012
|
+
invocation: toolInvocation,
|
|
5013
|
+
estimate
|
|
4819
5014
|
});
|
|
4820
5015
|
let result;
|
|
4821
5016
|
const isFailure2 = isToolCallFailure(toolResult);
|
|
@@ -5273,12 +5468,12 @@ function createSkedyulServer(config) {
|
|
|
5273
5468
|
const toolDisplayName = tool.label || toolName;
|
|
5274
5469
|
const inputZodSchema = getZodSchema(tool.inputSchema);
|
|
5275
5470
|
const outputZodSchema = getZodSchema(tool.outputSchema);
|
|
5276
|
-
const wrappedInputSchema =
|
|
5277
|
-
inputs: inputZodSchema ??
|
|
5278
|
-
context:
|
|
5279
|
-
env:
|
|
5280
|
-
invocation:
|
|
5281
|
-
estimate:
|
|
5471
|
+
const wrappedInputSchema = z11.object({
|
|
5472
|
+
inputs: inputZodSchema ?? z11.record(z11.string(), z11.unknown()).optional(),
|
|
5473
|
+
context: z11.record(z11.string(), z11.unknown()).optional(),
|
|
5474
|
+
env: z11.record(z11.string(), z11.string()).optional(),
|
|
5475
|
+
invocation: z11.record(z11.string(), z11.unknown()).optional(),
|
|
5476
|
+
estimate: z11.boolean().optional()
|
|
5282
5477
|
}).passthrough();
|
|
5283
5478
|
mcpServer.registerTool(
|
|
5284
5479
|
toolName,
|
|
@@ -5987,7 +6182,7 @@ async function executeWithRetries(operation, maxRetries) {
|
|
|
5987
6182
|
operation.resolved.queueKey,
|
|
5988
6183
|
rateLimitCtx
|
|
5989
6184
|
);
|
|
5990
|
-
if (operation.resolved.name
|
|
6185
|
+
if (shouldSkipNestedAcquire(operation.resolved.name)) {
|
|
5991
6186
|
return operation.fn();
|
|
5992
6187
|
}
|
|
5993
6188
|
if (preAcquired) {
|
|
@@ -6091,86 +6286,86 @@ async function queuedFetchResponse(queueInput, url, init) {
|
|
|
6091
6286
|
}
|
|
6092
6287
|
|
|
6093
6288
|
// src/triggers/types.ts
|
|
6094
|
-
import { z as
|
|
6095
|
-
var CRMDataSchema =
|
|
6096
|
-
model:
|
|
6097
|
-
instanceId:
|
|
6098
|
-
data:
|
|
6289
|
+
import { z as z12 } from "zod/v4";
|
|
6290
|
+
var CRMDataSchema = z12.object({
|
|
6291
|
+
model: z12.string(),
|
|
6292
|
+
instanceId: z12.string(),
|
|
6293
|
+
data: z12.record(z12.string(), z12.unknown())
|
|
6099
6294
|
});
|
|
6100
|
-
var SenderContextSchema2 =
|
|
6295
|
+
var SenderContextSchema2 = z12.object({
|
|
6101
6296
|
kind: ParticipantKindSchema,
|
|
6102
|
-
displayName:
|
|
6297
|
+
displayName: z12.string().optional(),
|
|
6103
6298
|
crm: CRMDataSchema.optional()
|
|
6104
6299
|
});
|
|
6105
|
-
var ThreadContextItemSchema2 =
|
|
6106
|
-
handle:
|
|
6107
|
-
model:
|
|
6108
|
-
instanceId:
|
|
6109
|
-
data:
|
|
6300
|
+
var ThreadContextItemSchema2 = z12.object({
|
|
6301
|
+
handle: z12.string(),
|
|
6302
|
+
model: z12.string(),
|
|
6303
|
+
instanceId: z12.string(),
|
|
6304
|
+
data: z12.record(z12.string(), z12.unknown()).optional()
|
|
6110
6305
|
});
|
|
6111
|
-
var ParticipantContextSchema =
|
|
6112
|
-
id:
|
|
6306
|
+
var ParticipantContextSchema = z12.object({
|
|
6307
|
+
id: z12.string(),
|
|
6113
6308
|
kind: ParticipantKindSchema,
|
|
6114
|
-
displayName:
|
|
6115
|
-
contactId:
|
|
6116
|
-
memberId:
|
|
6117
|
-
agentId:
|
|
6118
|
-
workflowId:
|
|
6309
|
+
displayName: z12.string().optional(),
|
|
6310
|
+
contactId: z12.string().optional(),
|
|
6311
|
+
memberId: z12.string().optional(),
|
|
6312
|
+
agentId: z12.string().optional(),
|
|
6313
|
+
workflowId: z12.string().optional()
|
|
6119
6314
|
});
|
|
6120
|
-
var TriggerContextSchema =
|
|
6315
|
+
var TriggerContextSchema = z12.object({
|
|
6121
6316
|
// The event that triggered this
|
|
6122
|
-
event:
|
|
6317
|
+
event: z12.object({
|
|
6123
6318
|
type: EventTypeSchema,
|
|
6124
|
-
payload:
|
|
6319
|
+
payload: z12.record(z12.string(), z12.unknown()),
|
|
6125
6320
|
participant: ParticipantContextSchema.optional()
|
|
6126
6321
|
}),
|
|
6127
6322
|
// Thread information
|
|
6128
|
-
thread:
|
|
6129
|
-
id:
|
|
6130
|
-
title:
|
|
6131
|
-
status:
|
|
6323
|
+
thread: z12.object({
|
|
6324
|
+
id: z12.string(),
|
|
6325
|
+
title: z12.string().optional(),
|
|
6326
|
+
status: z12.string().optional(),
|
|
6132
6327
|
sender: SenderContextSchema2.optional(),
|
|
6133
|
-
context:
|
|
6134
|
-
participants:
|
|
6328
|
+
context: z12.record(z12.string(), CRMDataSchema).optional(),
|
|
6329
|
+
participants: z12.array(ParticipantContextSchema).optional()
|
|
6135
6330
|
}),
|
|
6136
6331
|
// Workplace info
|
|
6137
|
-
workplace:
|
|
6138
|
-
id:
|
|
6139
|
-
name:
|
|
6140
|
-
settings:
|
|
6332
|
+
workplace: z12.object({
|
|
6333
|
+
id: z12.string(),
|
|
6334
|
+
name: z12.string().optional(),
|
|
6335
|
+
settings: z12.record(z12.string(), z12.unknown()).optional()
|
|
6141
6336
|
})
|
|
6142
6337
|
});
|
|
6143
|
-
var InputMappingSchema =
|
|
6144
|
-
var EventConditionsSchema =
|
|
6145
|
-
var TriggerConfigSchema =
|
|
6146
|
-
id:
|
|
6147
|
-
workflowId:
|
|
6148
|
-
workflowVersionId:
|
|
6149
|
-
workplaceId:
|
|
6150
|
-
handle:
|
|
6338
|
+
var InputMappingSchema = z12.record(z12.string(), z12.string());
|
|
6339
|
+
var EventConditionsSchema = z12.record(z12.string(), z12.string());
|
|
6340
|
+
var TriggerConfigSchema = z12.object({
|
|
6341
|
+
id: z12.string(),
|
|
6342
|
+
workflowId: z12.string(),
|
|
6343
|
+
workflowVersionId: z12.string().optional(),
|
|
6344
|
+
workplaceId: z12.string(),
|
|
6345
|
+
handle: z12.string(),
|
|
6151
6346
|
// Input mappings: how to resolve workflow inputs from thread context
|
|
6152
6347
|
inputMappings: InputMappingSchema.optional(),
|
|
6153
6348
|
// Event conditions: additional workplace-specific conditions
|
|
6154
6349
|
eventConditions: EventConditionsSchema.optional(),
|
|
6155
6350
|
// Workplace-specific config overrides
|
|
6156
|
-
config:
|
|
6351
|
+
config: z12.record(z12.string(), z12.unknown()).optional(),
|
|
6157
6352
|
// Trigger type and status
|
|
6158
|
-
type:
|
|
6159
|
-
isEnabled:
|
|
6353
|
+
type: z12.string().optional(),
|
|
6354
|
+
isEnabled: z12.boolean().optional()
|
|
6160
6355
|
});
|
|
6161
|
-
var ResolvedTriggerSchema =
|
|
6356
|
+
var ResolvedTriggerSchema = z12.object({
|
|
6162
6357
|
trigger: TriggerConfigSchema,
|
|
6163
|
-
workflow:
|
|
6164
|
-
id:
|
|
6165
|
-
handle:
|
|
6166
|
-
name:
|
|
6167
|
-
inputs:
|
|
6168
|
-
events:
|
|
6169
|
-
subscribes:
|
|
6170
|
-
condition:
|
|
6358
|
+
workflow: z12.object({
|
|
6359
|
+
id: z12.string(),
|
|
6360
|
+
handle: z12.string(),
|
|
6361
|
+
name: z12.string().optional(),
|
|
6362
|
+
inputs: z12.record(z12.string(), z12.unknown()).optional(),
|
|
6363
|
+
events: z12.object({
|
|
6364
|
+
subscribes: z12.array(EventTypeSchema).optional(),
|
|
6365
|
+
condition: z12.string().optional()
|
|
6171
6366
|
}).optional()
|
|
6172
6367
|
}),
|
|
6173
|
-
inputs:
|
|
6368
|
+
inputs: z12.record(z12.string(), z12.unknown()),
|
|
6174
6369
|
context: TriggerContextSchema
|
|
6175
6370
|
});
|
|
6176
6371
|
var TriggerResolutionError = class extends Error {
|
|
@@ -6181,13 +6376,13 @@ var TriggerResolutionError = class extends Error {
|
|
|
6181
6376
|
this.name = "TriggerResolutionError";
|
|
6182
6377
|
}
|
|
6183
6378
|
};
|
|
6184
|
-
var WorkflowInputDefinitionSchema =
|
|
6185
|
-
type:
|
|
6186
|
-
required:
|
|
6187
|
-
description:
|
|
6188
|
-
default:
|
|
6379
|
+
var WorkflowInputDefinitionSchema = z12.object({
|
|
6380
|
+
type: z12.string(),
|
|
6381
|
+
required: z12.boolean().optional(),
|
|
6382
|
+
description: z12.string().optional(),
|
|
6383
|
+
default: z12.unknown().optional()
|
|
6189
6384
|
});
|
|
6190
|
-
var WorkflowInputSchemaSchema =
|
|
6385
|
+
var WorkflowInputSchemaSchema = z12.record(z12.string(), WorkflowInputDefinitionSchema);
|
|
6191
6386
|
|
|
6192
6387
|
// src/triggers/resolver.ts
|
|
6193
6388
|
function evaluateTemplate(template, context) {
|
|
@@ -6269,67 +6464,67 @@ function matchesTrigger(trigger, eventType, context) {
|
|
|
6269
6464
|
}
|
|
6270
6465
|
|
|
6271
6466
|
// src/workflows/types.ts
|
|
6272
|
-
import { z as
|
|
6467
|
+
import { z as z13 } from "zod/v4";
|
|
6273
6468
|
var WORKFLOW_SCHEMA_VERSION = "https://skedyul.com/schemas/workflow/v1";
|
|
6274
|
-
var WorkflowInputSchema =
|
|
6275
|
-
type:
|
|
6276
|
-
required:
|
|
6277
|
-
description:
|
|
6278
|
-
default:
|
|
6279
|
-
});
|
|
6280
|
-
var WorkflowStepInputSchema =
|
|
6281
|
-
var WorkflowStepSchema =
|
|
6469
|
+
var WorkflowInputSchema = z13.object({
|
|
6470
|
+
type: z13.string(),
|
|
6471
|
+
required: z13.boolean().optional().default(false),
|
|
6472
|
+
description: z13.string().optional(),
|
|
6473
|
+
default: z13.unknown().optional()
|
|
6474
|
+
});
|
|
6475
|
+
var WorkflowStepInputSchema = z13.union([z13.string(), z13.number(), z13.boolean(), z13.record(z13.string(), z13.unknown())]);
|
|
6476
|
+
var WorkflowStepSchema = z13.object({
|
|
6282
6477
|
// Service and command
|
|
6283
|
-
service:
|
|
6284
|
-
cmd:
|
|
6478
|
+
service: z13.string(),
|
|
6479
|
+
cmd: z13.string(),
|
|
6285
6480
|
// Dependencies
|
|
6286
|
-
needs:
|
|
6481
|
+
needs: z13.array(z13.string()).optional(),
|
|
6287
6482
|
// Inputs (Liquid templates supported)
|
|
6288
|
-
inputs:
|
|
6483
|
+
inputs: z13.record(z13.string(), WorkflowStepInputSchema).optional(),
|
|
6289
6484
|
// Conditional execution
|
|
6290
|
-
condition:
|
|
6485
|
+
condition: z13.string().optional(),
|
|
6291
6486
|
// Retry configuration
|
|
6292
|
-
retry:
|
|
6293
|
-
attempts:
|
|
6294
|
-
backoff:
|
|
6487
|
+
retry: z13.object({
|
|
6488
|
+
attempts: z13.number().optional(),
|
|
6489
|
+
backoff: z13.enum(["linear", "exponential"]).optional()
|
|
6295
6490
|
}).optional(),
|
|
6296
6491
|
// Timeout
|
|
6297
|
-
timeout:
|
|
6298
|
-
});
|
|
6299
|
-
var WorkflowRuntimeSchema =
|
|
6300
|
-
durable:
|
|
6301
|
-
timeout:
|
|
6302
|
-
retry:
|
|
6303
|
-
attempts:
|
|
6304
|
-
backoff:
|
|
6492
|
+
timeout: z13.string().optional()
|
|
6493
|
+
});
|
|
6494
|
+
var WorkflowRuntimeSchema = z13.object({
|
|
6495
|
+
durable: z13.boolean().optional().default(true),
|
|
6496
|
+
timeout: z13.string().optional(),
|
|
6497
|
+
retry: z13.object({
|
|
6498
|
+
attempts: z13.number().optional(),
|
|
6499
|
+
backoff: z13.enum(["linear", "exponential"]).optional()
|
|
6305
6500
|
}).optional()
|
|
6306
6501
|
});
|
|
6307
|
-
var WorkflowYAMLSchema =
|
|
6502
|
+
var WorkflowYAMLSchema = z13.object({
|
|
6308
6503
|
// Schema version
|
|
6309
|
-
$schema:
|
|
6504
|
+
$schema: z13.string().optional(),
|
|
6310
6505
|
// Identity
|
|
6311
|
-
handle:
|
|
6312
|
-
name:
|
|
6313
|
-
version:
|
|
6314
|
-
description:
|
|
6506
|
+
handle: z13.string(),
|
|
6507
|
+
name: z13.string(),
|
|
6508
|
+
version: z13.string().optional(),
|
|
6509
|
+
description: z13.string().optional(),
|
|
6315
6510
|
// Inputs this workflow needs (portable, declared in YAML)
|
|
6316
|
-
inputs:
|
|
6511
|
+
inputs: z13.record(z13.string(), WorkflowInputSchema).optional(),
|
|
6317
6512
|
// Event subscriptions and conditions
|
|
6318
6513
|
events: EventsConfigSchema.optional(),
|
|
6319
6514
|
// Deterministic steps
|
|
6320
|
-
steps:
|
|
6515
|
+
steps: z13.record(z13.string(), WorkflowStepSchema),
|
|
6321
6516
|
// Runtime configuration
|
|
6322
6517
|
runtime: WorkflowRuntimeSchema.optional()
|
|
6323
6518
|
});
|
|
6324
|
-
var WorkflowMetadataSchema =
|
|
6325
|
-
handle:
|
|
6326
|
-
name:
|
|
6327
|
-
version:
|
|
6328
|
-
description:
|
|
6329
|
-
inputs:
|
|
6519
|
+
var WorkflowMetadataSchema = z13.object({
|
|
6520
|
+
handle: z13.string(),
|
|
6521
|
+
name: z13.string(),
|
|
6522
|
+
version: z13.string().optional(),
|
|
6523
|
+
description: z13.string().optional(),
|
|
6524
|
+
inputs: z13.record(z13.string(), WorkflowInputDefinitionSchema).optional(),
|
|
6330
6525
|
events: EventsConfigSchema.optional()
|
|
6331
6526
|
});
|
|
6332
|
-
var WorkflowExecutionStatusSchema =
|
|
6527
|
+
var WorkflowExecutionStatusSchema = z13.enum([
|
|
6333
6528
|
"PENDING",
|
|
6334
6529
|
"RUNNING",
|
|
6335
6530
|
"COMPLETED",
|
|
@@ -6337,14 +6532,14 @@ var WorkflowExecutionStatusSchema = z12.enum([
|
|
|
6337
6532
|
"CANCELLED",
|
|
6338
6533
|
"WAITING"
|
|
6339
6534
|
]);
|
|
6340
|
-
var WorkflowExecutionResultSchema =
|
|
6535
|
+
var WorkflowExecutionResultSchema = z13.object({
|
|
6341
6536
|
status: WorkflowExecutionStatusSchema,
|
|
6342
|
-
outputs:
|
|
6343
|
-
error:
|
|
6344
|
-
startedAt:
|
|
6345
|
-
completedAt:
|
|
6346
|
-
cancelledAt:
|
|
6347
|
-
cancelReason:
|
|
6537
|
+
outputs: z13.record(z13.string(), z13.unknown()).optional(),
|
|
6538
|
+
error: z13.string().optional(),
|
|
6539
|
+
startedAt: z13.string().datetime().optional(),
|
|
6540
|
+
completedAt: z13.string().datetime().optional(),
|
|
6541
|
+
cancelledAt: z13.string().datetime().optional(),
|
|
6542
|
+
cancelReason: z13.string().optional()
|
|
6348
6543
|
});
|
|
6349
6544
|
function defineWorkflowYAML(workflow) {
|
|
6350
6545
|
return WorkflowYAMLSchema.parse(workflow);
|
|
@@ -6422,8 +6617,8 @@ function getAssociationByModel(context, model) {
|
|
|
6422
6617
|
}
|
|
6423
6618
|
|
|
6424
6619
|
// src/memory/types.ts
|
|
6425
|
-
import { z as
|
|
6426
|
-
var MemoryEntryTypeSchema =
|
|
6620
|
+
import { z as z14 } from "zod/v4";
|
|
6621
|
+
var MemoryEntryTypeSchema = z14.enum([
|
|
6427
6622
|
"WORKING",
|
|
6428
6623
|
// Current conversation context
|
|
6429
6624
|
"OBSERVATION",
|
|
@@ -6433,80 +6628,80 @@ var MemoryEntryTypeSchema = z13.enum([
|
|
|
6433
6628
|
"SEMANTIC"
|
|
6434
6629
|
// Semantic memory for retrieval
|
|
6435
6630
|
]);
|
|
6436
|
-
var MemoryEntrySchema =
|
|
6437
|
-
id:
|
|
6631
|
+
var MemoryEntrySchema = z14.object({
|
|
6632
|
+
id: z14.string(),
|
|
6438
6633
|
type: MemoryEntryTypeSchema,
|
|
6439
|
-
key:
|
|
6440
|
-
value:
|
|
6441
|
-
metadata:
|
|
6442
|
-
expiresAt:
|
|
6443
|
-
createdAt:
|
|
6444
|
-
updatedAt:
|
|
6445
|
-
});
|
|
6446
|
-
var WorkingMemoryConfigSchema2 =
|
|
6447
|
-
strategy:
|
|
6448
|
-
maxTokens:
|
|
6449
|
-
summarizeAt:
|
|
6450
|
-
ttl:
|
|
6451
|
-
});
|
|
6452
|
-
var SemanticMemoryConfigSchema2 =
|
|
6453
|
-
enabled:
|
|
6454
|
-
topK:
|
|
6455
|
-
scope:
|
|
6456
|
-
minScore:
|
|
6457
|
-
});
|
|
6458
|
-
var ExternalMemoryConfigSchema2 =
|
|
6459
|
-
namespace:
|
|
6460
|
-
ttl:
|
|
6461
|
-
});
|
|
6462
|
-
var MemoryConfigSchema =
|
|
6634
|
+
key: z14.string(),
|
|
6635
|
+
value: z14.unknown(),
|
|
6636
|
+
metadata: z14.record(z14.string(), z14.unknown()).optional(),
|
|
6637
|
+
expiresAt: z14.string().datetime().optional(),
|
|
6638
|
+
createdAt: z14.string().datetime(),
|
|
6639
|
+
updatedAt: z14.string().datetime()
|
|
6640
|
+
});
|
|
6641
|
+
var WorkingMemoryConfigSchema2 = z14.object({
|
|
6642
|
+
strategy: z14.enum(["full", "rolling_summary", "sliding_window"]).default("rolling_summary"),
|
|
6643
|
+
maxTokens: z14.number().default(8e3),
|
|
6644
|
+
summarizeAt: z14.number().optional(),
|
|
6645
|
+
ttl: z14.string().optional()
|
|
6646
|
+
});
|
|
6647
|
+
var SemanticMemoryConfigSchema2 = z14.object({
|
|
6648
|
+
enabled: z14.boolean().default(false),
|
|
6649
|
+
topK: z14.number().default(5),
|
|
6650
|
+
scope: z14.enum(["thread", "instance", "workspace"]).default("thread"),
|
|
6651
|
+
minScore: z14.number().default(0.7)
|
|
6652
|
+
});
|
|
6653
|
+
var ExternalMemoryConfigSchema2 = z14.object({
|
|
6654
|
+
namespace: z14.string(),
|
|
6655
|
+
ttl: z14.string().optional()
|
|
6656
|
+
});
|
|
6657
|
+
var MemoryConfigSchema = z14.object({
|
|
6463
6658
|
working: WorkingMemoryConfigSchema2.optional(),
|
|
6464
6659
|
semantic: SemanticMemoryConfigSchema2.optional(),
|
|
6465
6660
|
external: ExternalMemoryConfigSchema2.optional(),
|
|
6466
|
-
persistent:
|
|
6467
|
-
namespace:
|
|
6661
|
+
persistent: z14.object({
|
|
6662
|
+
namespace: z14.string()
|
|
6468
6663
|
}).optional()
|
|
6469
6664
|
});
|
|
6470
|
-
var MemoryScopeSchema =
|
|
6471
|
-
threadId:
|
|
6472
|
-
participantId:
|
|
6473
|
-
agentId:
|
|
6474
|
-
workplaceId:
|
|
6475
|
-
namespace:
|
|
6476
|
-
});
|
|
6477
|
-
var MemoryQueryOptionsSchema =
|
|
6478
|
-
types:
|
|
6479
|
-
keys:
|
|
6480
|
-
limit:
|
|
6481
|
-
includeExpired:
|
|
6482
|
-
});
|
|
6483
|
-
var ConversationSummarySchema =
|
|
6484
|
-
summary:
|
|
6485
|
-
keyPoints:
|
|
6486
|
-
entities:
|
|
6487
|
-
name:
|
|
6488
|
-
type:
|
|
6489
|
-
relevance:
|
|
6665
|
+
var MemoryScopeSchema = z14.object({
|
|
6666
|
+
threadId: z14.string().optional(),
|
|
6667
|
+
participantId: z14.string().optional(),
|
|
6668
|
+
agentId: z14.string().optional(),
|
|
6669
|
+
workplaceId: z14.string().optional(),
|
|
6670
|
+
namespace: z14.string().optional()
|
|
6671
|
+
});
|
|
6672
|
+
var MemoryQueryOptionsSchema = z14.object({
|
|
6673
|
+
types: z14.array(MemoryEntryTypeSchema).optional(),
|
|
6674
|
+
keys: z14.array(z14.string()).optional(),
|
|
6675
|
+
limit: z14.number().default(100),
|
|
6676
|
+
includeExpired: z14.boolean().default(false)
|
|
6677
|
+
});
|
|
6678
|
+
var ConversationSummarySchema = z14.object({
|
|
6679
|
+
summary: z14.string(),
|
|
6680
|
+
keyPoints: z14.array(z14.string()),
|
|
6681
|
+
entities: z14.array(z14.object({
|
|
6682
|
+
name: z14.string(),
|
|
6683
|
+
type: z14.string(),
|
|
6684
|
+
relevance: z14.number()
|
|
6490
6685
|
})),
|
|
6491
|
-
lastMessageId:
|
|
6492
|
-
messageCount:
|
|
6493
|
-
tokenCount:
|
|
6494
|
-
createdAt:
|
|
6495
|
-
});
|
|
6496
|
-
var AgentObservationSchema =
|
|
6497
|
-
observation:
|
|
6498
|
-
confidence:
|
|
6499
|
-
source:
|
|
6500
|
-
context:
|
|
6501
|
-
createdAt:
|
|
6502
|
-
});
|
|
6503
|
-
var ExternalDataCacheSchema =
|
|
6504
|
-
source:
|
|
6505
|
-
endpoint:
|
|
6506
|
-
data:
|
|
6507
|
-
fetchedAt:
|
|
6508
|
-
expiresAt:
|
|
6509
|
-
metadata:
|
|
6686
|
+
lastMessageId: z14.string().optional(),
|
|
6687
|
+
messageCount: z14.number(),
|
|
6688
|
+
tokenCount: z14.number(),
|
|
6689
|
+
createdAt: z14.string().datetime()
|
|
6690
|
+
});
|
|
6691
|
+
var AgentObservationSchema = z14.object({
|
|
6692
|
+
observation: z14.string(),
|
|
6693
|
+
confidence: z14.number().min(0).max(1),
|
|
6694
|
+
source: z14.enum(["inference", "explicit", "tool_result"]),
|
|
6695
|
+
context: z14.record(z14.string(), z14.unknown()).optional(),
|
|
6696
|
+
createdAt: z14.string().datetime()
|
|
6697
|
+
});
|
|
6698
|
+
var ExternalDataCacheSchema = z14.object({
|
|
6699
|
+
source: z14.string(),
|
|
6700
|
+
endpoint: z14.string().optional(),
|
|
6701
|
+
data: z14.unknown(),
|
|
6702
|
+
fetchedAt: z14.string().datetime(),
|
|
6703
|
+
expiresAt: z14.string().datetime().optional(),
|
|
6704
|
+
metadata: z14.record(z14.string(), z14.unknown()).optional()
|
|
6510
6705
|
});
|
|
6511
6706
|
|
|
6512
6707
|
// src/memory/service.ts
|
|
@@ -7097,16 +7292,16 @@ function estimateTokens(agent, skills) {
|
|
|
7097
7292
|
}
|
|
7098
7293
|
|
|
7099
7294
|
// src/scheduling/types.ts
|
|
7100
|
-
import { z as
|
|
7101
|
-
var TimeStampSchema =
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
hour:
|
|
7105
|
-
minute:
|
|
7106
|
-
second:
|
|
7295
|
+
import { z as z15 } from "zod/v4";
|
|
7296
|
+
var TimeStampSchema = z15.union([
|
|
7297
|
+
z15.number().describe("Hour of day (0-23)"),
|
|
7298
|
+
z15.object({
|
|
7299
|
+
hour: z15.number(),
|
|
7300
|
+
minute: z15.number().optional().default(0),
|
|
7301
|
+
second: z15.number().optional().default(0)
|
|
7107
7302
|
})
|
|
7108
7303
|
]);
|
|
7109
|
-
var DayOfWeekSchema =
|
|
7304
|
+
var DayOfWeekSchema = z15.enum([
|
|
7110
7305
|
"monday",
|
|
7111
7306
|
"tuesday",
|
|
7112
7307
|
"wednesday",
|
|
@@ -7115,13 +7310,13 @@ var DayOfWeekSchema = z14.enum([
|
|
|
7115
7310
|
"saturday",
|
|
7116
7311
|
"sunday"
|
|
7117
7312
|
]);
|
|
7118
|
-
var TimeWindowSlotSchema =
|
|
7313
|
+
var TimeWindowSlotSchema = z15.object({
|
|
7119
7314
|
startTime: TimeStampSchema,
|
|
7120
7315
|
endTime: TimeStampSchema,
|
|
7121
|
-
days:
|
|
7122
|
-
timezone:
|
|
7316
|
+
days: z15.array(DayOfWeekSchema),
|
|
7317
|
+
timezone: z15.string().optional()
|
|
7123
7318
|
});
|
|
7124
|
-
var WaitUnitSchema =
|
|
7319
|
+
var WaitUnitSchema = z15.enum([
|
|
7125
7320
|
"second",
|
|
7126
7321
|
"seconds",
|
|
7127
7322
|
"minute",
|
|
@@ -7137,17 +7332,17 @@ var WaitUnitSchema = z14.enum([
|
|
|
7137
7332
|
"year",
|
|
7138
7333
|
"years"
|
|
7139
7334
|
]);
|
|
7140
|
-
var WaitInputRelativeSchema =
|
|
7141
|
-
mode:
|
|
7142
|
-
amount:
|
|
7335
|
+
var WaitInputRelativeSchema = z15.object({
|
|
7336
|
+
mode: z15.literal("relative"),
|
|
7337
|
+
amount: z15.number(),
|
|
7143
7338
|
unit: WaitUnitSchema,
|
|
7144
|
-
windows:
|
|
7339
|
+
windows: z15.array(TimeWindowSlotSchema).optional()
|
|
7145
7340
|
});
|
|
7146
|
-
var WaitInputAbsoluteSchema =
|
|
7147
|
-
mode:
|
|
7148
|
-
scheduleAt:
|
|
7341
|
+
var WaitInputAbsoluteSchema = z15.object({
|
|
7342
|
+
mode: z15.literal("absolute"),
|
|
7343
|
+
scheduleAt: z15.union([z15.string(), z15.number()])
|
|
7149
7344
|
});
|
|
7150
|
-
var WaitInputSchema =
|
|
7345
|
+
var WaitInputSchema = z15.union([
|
|
7151
7346
|
WaitInputRelativeSchema,
|
|
7152
7347
|
WaitInputAbsoluteSchema
|
|
7153
7348
|
]);
|
|
@@ -7457,8 +7652,62 @@ function isTimeInPolicy(date, policy) {
|
|
|
7457
7652
|
return false;
|
|
7458
7653
|
}
|
|
7459
7654
|
|
|
7655
|
+
// src/tools/sms/gsm7.ts
|
|
7656
|
+
var GSM7_BASIC = `@\xA3$\xA5\xE8\xE9\xF9\xEC\xF2\xC7
|
|
7657
|
+
\xD8\xF8\r\xC5\xE5\u0394_\u03A6\u0393\u039B\u03A9\u03A0\u03A8\u03A3\u0398\u039E\xC6\xE6\xDF\xC9 !"#\xA4%&'()*+,-./0123456789:;<=>?\xA1ABCDEFGHIJKLMNOPQRSTUVWXYZ\xC4\xD6\xD1\xDC\xA7\xBFabcdefghijklmnopqrstuvwxyz\xE4\xF6\xF1\xFC\xE0`;
|
|
7658
|
+
var GSM7_EXTENDED = "^{}\\[~]|\u20AC";
|
|
7659
|
+
var GSM7_BASIC_SET = new Set(GSM7_BASIC.split(""));
|
|
7660
|
+
var GSM7_EXTENDED_SET = new Set(GSM7_EXTENDED.split(""));
|
|
7661
|
+
function toGsm7(value) {
|
|
7662
|
+
if (value === null || value === void 0) {
|
|
7663
|
+
return "";
|
|
7664
|
+
}
|
|
7665
|
+
const str = String(value);
|
|
7666
|
+
let result = "";
|
|
7667
|
+
for (const char of str) {
|
|
7668
|
+
if (GSM7_BASIC_SET.has(char) || GSM7_EXTENDED_SET.has(char)) {
|
|
7669
|
+
result += char;
|
|
7670
|
+
}
|
|
7671
|
+
}
|
|
7672
|
+
return result;
|
|
7673
|
+
}
|
|
7674
|
+
function isGsm7Character(char) {
|
|
7675
|
+
return GSM7_BASIC_SET.has(char) || GSM7_EXTENDED_SET.has(char);
|
|
7676
|
+
}
|
|
7677
|
+
function countGsm7Septets(text) {
|
|
7678
|
+
let septets = 0;
|
|
7679
|
+
for (const char of text) {
|
|
7680
|
+
septets += GSM7_EXTENDED_SET.has(char) ? 2 : 1;
|
|
7681
|
+
}
|
|
7682
|
+
return septets;
|
|
7683
|
+
}
|
|
7684
|
+
function estimateSmsSegments(text) {
|
|
7685
|
+
const normalized = text ?? "";
|
|
7686
|
+
const characters = [...normalized].length;
|
|
7687
|
+
if (characters === 0) {
|
|
7688
|
+
return { encoding: "GSM-7", characters: 0, septets: 0, segments: 0 };
|
|
7689
|
+
}
|
|
7690
|
+
const isGsm7 = [...normalized].every(isGsm7Character);
|
|
7691
|
+
if (isGsm7) {
|
|
7692
|
+
const septets = countGsm7Septets(normalized);
|
|
7693
|
+
const segments2 = septets <= 160 ? 1 : Math.ceil(septets / 153);
|
|
7694
|
+
return {
|
|
7695
|
+
encoding: "GSM-7",
|
|
7696
|
+
characters,
|
|
7697
|
+
septets,
|
|
7698
|
+
segments: segments2
|
|
7699
|
+
};
|
|
7700
|
+
}
|
|
7701
|
+
const segments = characters <= 70 ? 1 : Math.ceil(characters / 67);
|
|
7702
|
+
return {
|
|
7703
|
+
encoding: "UCS-2",
|
|
7704
|
+
characters,
|
|
7705
|
+
segments
|
|
7706
|
+
};
|
|
7707
|
+
}
|
|
7708
|
+
|
|
7460
7709
|
// src/index.ts
|
|
7461
|
-
var src_default = { z:
|
|
7710
|
+
var src_default = { z: z16 };
|
|
7462
7711
|
export {
|
|
7463
7712
|
AgentContextSchema,
|
|
7464
7713
|
AgentDefinitionSchema,
|
|
@@ -7488,6 +7737,7 @@ export {
|
|
|
7488
7737
|
CRMSchemaZ,
|
|
7489
7738
|
CardBlockDefinitionSchema,
|
|
7490
7739
|
CardBlockHeaderSchema,
|
|
7740
|
+
ChannelBatchCapabilitySchema,
|
|
7491
7741
|
ChannelCapabilitySchema,
|
|
7492
7742
|
ChannelCapabilityTypeSchema,
|
|
7493
7743
|
ChannelDefinitionSchema,
|
|
@@ -7514,6 +7764,8 @@ export {
|
|
|
7514
7764
|
EnvSchemaSchema,
|
|
7515
7765
|
EnvVariableDefinitionSchema,
|
|
7516
7766
|
EnvVisibilitySchema,
|
|
7767
|
+
EstimationSchema,
|
|
7768
|
+
EstimationSkippedBreakdownSchema,
|
|
7517
7769
|
EventConditionsSchema,
|
|
7518
7770
|
EventSubscriptionSchema,
|
|
7519
7771
|
EventTypeSchema,
|
|
@@ -7555,6 +7807,13 @@ export {
|
|
|
7555
7807
|
MemoryQueryOptionsSchema,
|
|
7556
7808
|
MemoryScopeSchema,
|
|
7557
7809
|
MemoryService,
|
|
7810
|
+
MessageBulkRecipientSchema,
|
|
7811
|
+
MessageBulkSendInputSchema,
|
|
7812
|
+
MessageBulkSendOutputSchema,
|
|
7813
|
+
MessageBulkStatusInputSchema,
|
|
7814
|
+
MessageBulkStatusMessageSchema,
|
|
7815
|
+
MessageBulkStatusOutputSchema,
|
|
7816
|
+
MessageBulkStatusStatsSchema,
|
|
7558
7817
|
MessageEventPayloadSchema,
|
|
7559
7818
|
MessageSendAttachmentSchema,
|
|
7560
7819
|
MessageSendChannelSchema,
|
|
@@ -7573,6 +7832,7 @@ export {
|
|
|
7573
7832
|
ModelDependencySchema,
|
|
7574
7833
|
ModelFieldDefinitionSchema,
|
|
7575
7834
|
ModelMapperBlockDefinitionSchema,
|
|
7835
|
+
MoneyMinorRangeSchema,
|
|
7576
7836
|
NavigationBreadcrumbSchema,
|
|
7577
7837
|
NavigationConfigSchema,
|
|
7578
7838
|
NavigationItemSchema,
|
|
@@ -7676,15 +7936,18 @@ export {
|
|
|
7676
7936
|
communicationChannel,
|
|
7677
7937
|
compileAgent,
|
|
7678
7938
|
compileWorkflow,
|
|
7939
|
+
computeSkewedExpectedMinorUnits,
|
|
7679
7940
|
configure,
|
|
7680
7941
|
createAuthError,
|
|
7681
7942
|
createConflictError,
|
|
7682
7943
|
createContextLogger,
|
|
7683
7944
|
createErrorResponse,
|
|
7945
|
+
createEstimation,
|
|
7684
7946
|
createExternalError,
|
|
7685
7947
|
createInMemoryService,
|
|
7686
7948
|
createInstanceClient,
|
|
7687
7949
|
createListResponse,
|
|
7950
|
+
createMoneyMinorRange,
|
|
7688
7951
|
createNotFoundError,
|
|
7689
7952
|
createPermissionError,
|
|
7690
7953
|
createQueueHandle,
|
|
@@ -7710,11 +7973,14 @@ export {
|
|
|
7710
7973
|
defineSkill,
|
|
7711
7974
|
defineWorkflow,
|
|
7712
7975
|
defineWorkflowYAML,
|
|
7976
|
+
estimateSmsSegments,
|
|
7713
7977
|
evaluateCondition,
|
|
7714
7978
|
evaluateTemplate,
|
|
7715
7979
|
event,
|
|
7716
7980
|
file,
|
|
7717
7981
|
formatContextForPrompt,
|
|
7982
|
+
formatMoneyMinorEstimate,
|
|
7983
|
+
formatMoneyMinorRange,
|
|
7718
7984
|
formatSkillInstructions,
|
|
7719
7985
|
getAllEnvKeys,
|
|
7720
7986
|
getAssociationByModel,
|
|
@@ -7740,6 +8006,7 @@ export {
|
|
|
7740
8006
|
isWorkflowDependency,
|
|
7741
8007
|
matchesTrigger,
|
|
7742
8008
|
parseCRMSchema,
|
|
8009
|
+
parseEstimationFromBilling,
|
|
7743
8010
|
queuedFetch,
|
|
7744
8011
|
queuedFetchResponse,
|
|
7745
8012
|
registerQueueConfig,
|
|
@@ -7753,11 +8020,12 @@ export {
|
|
|
7753
8020
|
safeParseCRMSchema,
|
|
7754
8021
|
safeParseConfig,
|
|
7755
8022
|
server,
|
|
8023
|
+
toGsm7,
|
|
7756
8024
|
token,
|
|
7757
8025
|
validateCRMSchema,
|
|
7758
8026
|
validateSkillYAML,
|
|
7759
8027
|
validateWorkflowYAML,
|
|
7760
8028
|
webhook,
|
|
7761
8029
|
workplace,
|
|
7762
|
-
|
|
8030
|
+
z16 as z
|
|
7763
8031
|
};
|