syllable-sdk 1.0.14-rc.1 → 1.0.14-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/bin/mcp-server.js +295 -269
  2. package/bin/mcp-server.js.map +26 -26
  3. package/examples/package-lock.json +1 -1
  4. package/jsr.json +1 -1
  5. package/lib/config.d.ts +3 -3
  6. package/lib/config.js +3 -3
  7. package/lib/encodings.d.ts +1 -0
  8. package/lib/encodings.d.ts.map +1 -1
  9. package/lib/encodings.js +9 -0
  10. package/lib/encodings.js.map +1 -1
  11. package/mcp-server/mcp-server.js +1 -1
  12. package/mcp-server/server.js +1 -1
  13. package/models/components/callaction.d.ts +7 -19
  14. package/models/components/callaction.d.ts.map +1 -1
  15. package/models/components/callaction.js +8 -8
  16. package/models/components/callaction.js.map +1 -1
  17. package/models/components/celexpression.d.ts +1 -1
  18. package/models/components/celexpression.d.ts.map +1 -1
  19. package/models/components/celexpression.js +2 -2
  20. package/models/components/celexpression.js.map +1 -1
  21. package/models/components/conditionaltext.d.ts +6 -18
  22. package/models/components/conditionaltext.d.ts.map +1 -1
  23. package/models/components/conditionaltext.js +6 -6
  24. package/models/components/conditionaltext.js.map +1 -1
  25. package/models/components/conditionalvalue.d.ts +12 -36
  26. package/models/components/conditionalvalue.d.ts.map +1 -1
  27. package/models/components/conditionalvalue.js +12 -12
  28. package/models/components/conditionalvalue.js.map +1 -1
  29. package/models/components/context.d.ts +8 -104
  30. package/models/components/context.d.ts.map +1 -1
  31. package/models/components/context.js +48 -48
  32. package/models/components/context.js.map +1 -1
  33. package/models/components/eventtask.d.ts +1 -1
  34. package/models/components/eventtask.d.ts.map +1 -1
  35. package/models/components/eventtask.js +2 -2
  36. package/models/components/eventtask.js.map +1 -1
  37. package/models/components/eventtaskevents.d.ts +4 -44
  38. package/models/components/eventtaskevents.d.ts.map +1 -1
  39. package/models/components/eventtaskevents.js +20 -20
  40. package/models/components/eventtaskevents.js.map +1 -1
  41. package/models/components/expressiontask.d.ts +7 -19
  42. package/models/components/expressiontask.d.ts.map +1 -1
  43. package/models/components/expressiontask.js +8 -8
  44. package/models/components/expressiontask.js.map +1 -1
  45. package/models/components/expressiontaskevents.d.ts +8 -88
  46. package/models/components/expressiontaskevents.d.ts.map +1 -1
  47. package/models/components/expressiontaskevents.js +40 -40
  48. package/models/components/expressiontaskevents.js.map +1 -1
  49. package/models/components/incrementaction.d.ts +7 -19
  50. package/models/components/incrementaction.d.ts.map +1 -1
  51. package/models/components/incrementaction.js +8 -8
  52. package/models/components/incrementaction.js.map +1 -1
  53. package/models/components/loadtoolfromfiletask.d.ts +1 -1
  54. package/models/components/loadtoolfromfiletask.d.ts.map +1 -1
  55. package/models/components/loadtoolfromfiletask.js +2 -2
  56. package/models/components/loadtoolfromfiletask.js.map +1 -1
  57. package/models/components/nextstep.d.ts +6 -18
  58. package/models/components/nextstep.d.ts.map +1 -1
  59. package/models/components/nextstep.js +6 -6
  60. package/models/components/nextstep.js.map +1 -1
  61. package/models/components/saveaction.d.ts +7 -19
  62. package/models/components/saveaction.d.ts.map +1 -1
  63. package/models/components/saveaction.js +8 -8
  64. package/models/components/saveaction.js.map +1 -1
  65. package/models/components/sayaction.d.ts +7 -19
  66. package/models/components/sayaction.d.ts.map +1 -1
  67. package/models/components/sayaction.js +8 -8
  68. package/models/components/sayaction.js.map +1 -1
  69. package/models/components/setvalueaction.d.ts +13 -37
  70. package/models/components/setvalueaction.d.ts.map +1 -1
  71. package/models/components/setvalueaction.js +14 -14
  72. package/models/components/setvalueaction.js.map +1 -1
  73. package/models/components/step.d.ts +1 -1
  74. package/models/components/stepeventactions.d.ts +27 -133
  75. package/models/components/stepeventactions.d.ts.map +1 -1
  76. package/models/components/stepeventactions.js +91 -61
  77. package/models/components/stepeventactions.js.map +1 -1
  78. package/models/components/stepstask.d.ts +1 -1
  79. package/models/components/stepstask.d.ts.map +1 -1
  80. package/models/components/stepstask.js +2 -2
  81. package/models/components/stepstask.js.map +1 -1
  82. package/models/components/toolparametertransformcondition.d.ts +1 -1
  83. package/models/components/toolparametertransformcondition.d.ts.map +1 -1
  84. package/models/components/toolparametertransformcondition.js +2 -2
  85. package/models/components/toolparametertransformcondition.js.map +1 -1
  86. package/models/components/variable.d.ts +6 -18
  87. package/models/components/variable.d.ts.map +1 -1
  88. package/models/components/variable.js +6 -6
  89. package/models/components/variable.js.map +1 -1
  90. package/openapi.json +67 -34
  91. package/package.json +1 -1
  92. package/src/lib/config.ts +3 -3
  93. package/src/lib/encodings.ts +13 -0
  94. package/src/mcp-server/mcp-server.ts +1 -1
  95. package/src/mcp-server/server.ts +1 -1
  96. package/src/models/components/callaction.ts +15 -15
  97. package/src/models/components/celexpression.ts +3 -3
  98. package/src/models/components/conditionaltext.ts +12 -12
  99. package/src/models/components/conditionalvalue.ts +24 -24
  100. package/src/models/components/context.ts +87 -149
  101. package/src/models/components/eventtask.ts +3 -3
  102. package/src/models/components/eventtaskevents.ts +36 -48
  103. package/src/models/components/expressiontask.ts +15 -15
  104. package/src/models/components/expressiontaskevents.ts +72 -96
  105. package/src/models/components/incrementaction.ts +15 -15
  106. package/src/models/components/loadtoolfromfiletask.ts +3 -3
  107. package/src/models/components/nextstep.ts +12 -12
  108. package/src/models/components/saveaction.ts +15 -15
  109. package/src/models/components/sayaction.ts +15 -15
  110. package/src/models/components/setvalueaction.ts +27 -27
  111. package/src/models/components/step.ts +1 -1
  112. package/src/models/components/stepeventactions.ts +182 -145
  113. package/src/models/components/stepstask.ts +3 -3
  114. package/src/models/components/toolparametertransformcondition.ts +3 -3
  115. package/src/models/components/variable.ts +12 -12
  116. package/src/types/unrecognized.ts +9 -1
  117. package/tsconfig.json +1 -2
  118. package/types/unrecognized.d.ts +7 -1
  119. package/types/unrecognized.d.ts.map +1 -1
  120. package/types/unrecognized.js +9 -1
  121. package/types/unrecognized.js.map +1 -1
@@ -38,28 +38,30 @@ import {
38
38
  } from "./setvalueaction.js";
39
39
 
40
40
  export type StepEventActionsStart =
41
- | (CallAction & { action: "call" })
42
- | (IncrementAction & { action: "inc" })
43
- | (SayAction & { action: "say" })
44
- | (SetValueAction & { action: "set" })
45
- | (SaveAction & { action: "save" });
41
+ | CallAction
42
+ | IncrementAction
43
+ | SaveAction
44
+ | SayAction
45
+ | SetValueAction;
46
46
 
47
47
  export type Enter =
48
- | (CallAction & { action: "call" })
49
- | (IncrementAction & { action: "inc" })
50
- | (SayAction & { action: "say" })
51
- | (SetValueAction & { action: "set" })
52
- | (SaveAction & { action: "save" });
48
+ | CallAction
49
+ | IncrementAction
50
+ | SaveAction
51
+ | SayAction
52
+ | SetValueAction;
53
+
54
+ export type Presubmit = IncrementAction | SaveAction | SetValueAction;
53
55
 
54
56
  export type StepEventActionsSubmit =
55
- | (CallAction & { action: "call" })
56
- | (IncrementAction & { action: "inc" })
57
- | (SayAction & { action: "say" })
58
- | (SetValueAction & { action: "set" })
59
- | (SaveAction & { action: "save" });
57
+ | CallAction
58
+ | IncrementAction
59
+ | SaveAction
60
+ | SayAction
61
+ | SetValueAction;
60
62
 
61
63
  /**
62
- * Actions to perform when events occur (enter, submit).
64
+ * Actions to perform when events occur (enter, presubmit, submit).
63
65
  */
64
66
  export type StepEventActions = {
65
67
  /**
@@ -67,11 +69,7 @@ export type StepEventActions = {
67
69
  */
68
70
  start?:
69
71
  | Array<
70
- | (CallAction & { action: "call" })
71
- | (IncrementAction & { action: "inc" })
72
- | (SayAction & { action: "say" })
73
- | (SetValueAction & { action: "set" })
74
- | (SaveAction & { action: "save" })
72
+ CallAction | IncrementAction | SaveAction | SayAction | SetValueAction
75
73
  >
76
74
  | null
77
75
  | undefined;
@@ -80,24 +78,23 @@ export type StepEventActions = {
80
78
  */
81
79
  enter?:
82
80
  | Array<
83
- | (CallAction & { action: "call" })
84
- | (IncrementAction & { action: "inc" })
85
- | (SayAction & { action: "say" })
86
- | (SetValueAction & { action: "set" })
87
- | (SaveAction & { action: "save" })
81
+ CallAction | IncrementAction | SaveAction | SayAction | SetValueAction
88
82
  >
89
83
  | null
90
84
  | undefined;
85
+ /**
86
+ * Actions to execute before validation (data-mutation only: set, inc, save). Use this to set default values for required fields that would otherwise fail validation.
87
+ */
88
+ presubmit?:
89
+ | Array<IncrementAction | SaveAction | SetValueAction>
90
+ | null
91
+ | undefined;
91
92
  /**
92
93
  * Actions to execute when the tool/step is submitted by the LLM.
93
94
  */
94
95
  submit?:
95
96
  | Array<
96
- | (CallAction & { action: "call" })
97
- | (IncrementAction & { action: "inc" })
98
- | (SayAction & { action: "say" })
99
- | (SetValueAction & { action: "set" })
100
- | (SaveAction & { action: "save" })
97
+ CallAction | IncrementAction | SaveAction | SayAction | SetValueAction
101
98
  >
102
99
  | null
103
100
  | undefined;
@@ -109,19 +106,19 @@ export const StepEventActionsStart$inboundSchema: z.ZodType<
109
106
  z.ZodTypeDef,
110
107
  unknown
111
108
  > = z.union([
112
- CallAction$inboundSchema.and(z.object({ action: z.literal("call") })),
113
- IncrementAction$inboundSchema.and(z.object({ action: z.literal("inc") })),
114
- SayAction$inboundSchema.and(z.object({ action: z.literal("say") })),
115
- SetValueAction$inboundSchema.and(z.object({ action: z.literal("set") })),
116
- SaveAction$inboundSchema.and(z.object({ action: z.literal("save") })),
109
+ CallAction$inboundSchema,
110
+ IncrementAction$inboundSchema,
111
+ SaveAction$inboundSchema,
112
+ SayAction$inboundSchema,
113
+ SetValueAction$inboundSchema,
117
114
  ]);
118
115
  /** @internal */
119
116
  export type StepEventActionsStart$Outbound =
120
- | (CallAction$Outbound & { action: "call" })
121
- | (IncrementAction$Outbound & { action: "inc" })
122
- | (SayAction$Outbound & { action: "say" })
123
- | (SetValueAction$Outbound & { action: "set" })
124
- | (SaveAction$Outbound & { action: "save" });
117
+ | CallAction$Outbound
118
+ | IncrementAction$Outbound
119
+ | SaveAction$Outbound
120
+ | SayAction$Outbound
121
+ | SetValueAction$Outbound;
125
122
 
126
123
  /** @internal */
127
124
  export const StepEventActionsStart$outboundSchema: z.ZodType<
@@ -129,11 +126,11 @@ export const StepEventActionsStart$outboundSchema: z.ZodType<
129
126
  z.ZodTypeDef,
130
127
  StepEventActionsStart
131
128
  > = z.union([
132
- CallAction$outboundSchema.and(z.object({ action: z.literal("call") })),
133
- IncrementAction$outboundSchema.and(z.object({ action: z.literal("inc") })),
134
- SayAction$outboundSchema.and(z.object({ action: z.literal("say") })),
135
- SetValueAction$outboundSchema.and(z.object({ action: z.literal("set") })),
136
- SaveAction$outboundSchema.and(z.object({ action: z.literal("save") })),
129
+ CallAction$outboundSchema,
130
+ IncrementAction$outboundSchema,
131
+ SaveAction$outboundSchema,
132
+ SayAction$outboundSchema,
133
+ SetValueAction$outboundSchema,
137
134
  ]);
138
135
 
139
136
  export function stepEventActionsStartToJSON(
@@ -156,19 +153,19 @@ export function stepEventActionsStartFromJSON(
156
153
  /** @internal */
157
154
  export const Enter$inboundSchema: z.ZodType<Enter, z.ZodTypeDef, unknown> = z
158
155
  .union([
159
- CallAction$inboundSchema.and(z.object({ action: z.literal("call") })),
160
- IncrementAction$inboundSchema.and(z.object({ action: z.literal("inc") })),
161
- SayAction$inboundSchema.and(z.object({ action: z.literal("say") })),
162
- SetValueAction$inboundSchema.and(z.object({ action: z.literal("set") })),
163
- SaveAction$inboundSchema.and(z.object({ action: z.literal("save") })),
156
+ CallAction$inboundSchema,
157
+ IncrementAction$inboundSchema,
158
+ SaveAction$inboundSchema,
159
+ SayAction$inboundSchema,
160
+ SetValueAction$inboundSchema,
164
161
  ]);
165
162
  /** @internal */
166
163
  export type Enter$Outbound =
167
- | (CallAction$Outbound & { action: "call" })
168
- | (IncrementAction$Outbound & { action: "inc" })
169
- | (SayAction$Outbound & { action: "say" })
170
- | (SetValueAction$Outbound & { action: "set" })
171
- | (SaveAction$Outbound & { action: "save" });
164
+ | CallAction$Outbound
165
+ | IncrementAction$Outbound
166
+ | SaveAction$Outbound
167
+ | SayAction$Outbound
168
+ | SetValueAction$Outbound;
172
169
 
173
170
  /** @internal */
174
171
  export const Enter$outboundSchema: z.ZodType<
@@ -176,11 +173,11 @@ export const Enter$outboundSchema: z.ZodType<
176
173
  z.ZodTypeDef,
177
174
  Enter
178
175
  > = z.union([
179
- CallAction$outboundSchema.and(z.object({ action: z.literal("call") })),
180
- IncrementAction$outboundSchema.and(z.object({ action: z.literal("inc") })),
181
- SayAction$outboundSchema.and(z.object({ action: z.literal("say") })),
182
- SetValueAction$outboundSchema.and(z.object({ action: z.literal("set") })),
183
- SaveAction$outboundSchema.and(z.object({ action: z.literal("save") })),
176
+ CallAction$outboundSchema,
177
+ IncrementAction$outboundSchema,
178
+ SaveAction$outboundSchema,
179
+ SayAction$outboundSchema,
180
+ SetValueAction$outboundSchema,
184
181
  ]);
185
182
 
186
183
  export function enterToJSON(enter: Enter): string {
@@ -196,25 +193,65 @@ export function enterFromJSON(
196
193
  );
197
194
  }
198
195
 
196
+ /** @internal */
197
+ export const Presubmit$inboundSchema: z.ZodType<
198
+ Presubmit,
199
+ z.ZodTypeDef,
200
+ unknown
201
+ > = z.union([
202
+ IncrementAction$inboundSchema,
203
+ SaveAction$inboundSchema,
204
+ SetValueAction$inboundSchema,
205
+ ]);
206
+ /** @internal */
207
+ export type Presubmit$Outbound =
208
+ | IncrementAction$Outbound
209
+ | SaveAction$Outbound
210
+ | SetValueAction$Outbound;
211
+
212
+ /** @internal */
213
+ export const Presubmit$outboundSchema: z.ZodType<
214
+ Presubmit$Outbound,
215
+ z.ZodTypeDef,
216
+ Presubmit
217
+ > = z.union([
218
+ IncrementAction$outboundSchema,
219
+ SaveAction$outboundSchema,
220
+ SetValueAction$outboundSchema,
221
+ ]);
222
+
223
+ export function presubmitToJSON(presubmit: Presubmit): string {
224
+ return JSON.stringify(Presubmit$outboundSchema.parse(presubmit));
225
+ }
226
+ export function presubmitFromJSON(
227
+ jsonString: string,
228
+ ): SafeParseResult<Presubmit, SDKValidationError> {
229
+ return safeParse(
230
+ jsonString,
231
+ (x) => Presubmit$inboundSchema.parse(JSON.parse(x)),
232
+ `Failed to parse 'Presubmit' from JSON`,
233
+ );
234
+ }
235
+
199
236
  /** @internal */
200
237
  export const StepEventActionsSubmit$inboundSchema: z.ZodType<
201
238
  StepEventActionsSubmit,
202
239
  z.ZodTypeDef,
203
240
  unknown
204
241
  > = z.union([
205
- CallAction$inboundSchema.and(z.object({ action: z.literal("call") })),
206
- IncrementAction$inboundSchema.and(z.object({ action: z.literal("inc") })),
207
- SayAction$inboundSchema.and(z.object({ action: z.literal("say") })),
208
- SetValueAction$inboundSchema.and(z.object({ action: z.literal("set") })),
209
- SaveAction$inboundSchema.and(z.object({ action: z.literal("save") })),
242
+ CallAction$inboundSchema,
243
+ IncrementAction$inboundSchema,
244
+ SaveAction$inboundSchema,
245
+ SayAction$inboundSchema,
246
+ SetValueAction$inboundSchema,
210
247
  ]);
211
248
  /** @internal */
212
249
  export type StepEventActionsSubmit$Outbound =
213
- | (CallAction$Outbound & { action: "call" })
214
- | (IncrementAction$Outbound & { action: "inc" })
215
- | (SayAction$Outbound & { action: "say" })
216
- | (SetValueAction$Outbound & { action: "set" })
217
- | (SaveAction$Outbound & { action: "save" });
250
+ | CallAction$Outbound
251
+ | IncrementAction$Outbound
252
+ | SaveAction$Outbound
253
+ | SayAction$Outbound
254
+ | SetValueAction$Outbound;
218
255
 
219
256
  /** @internal */
220
257
  export const StepEventActionsSubmit$outboundSchema: z.ZodType<
@@ -222,11 +259,11 @@ export const StepEventActionsSubmit$outboundSchema: z.ZodType<
222
259
  z.ZodTypeDef,
223
260
  StepEventActionsSubmit
224
261
  > = z.union([
225
- CallAction$outboundSchema.and(z.object({ action: z.literal("call") })),
226
- IncrementAction$outboundSchema.and(z.object({ action: z.literal("inc") })),
227
- SayAction$outboundSchema.and(z.object({ action: z.literal("say") })),
228
- SetValueAction$outboundSchema.and(z.object({ action: z.literal("set") })),
229
- SaveAction$outboundSchema.and(z.object({ action: z.literal("save") })),
262
+ CallAction$outboundSchema,
263
+ IncrementAction$outboundSchema,
264
+ SaveAction$outboundSchema,
265
+ SayAction$outboundSchema,
266
+ SetValueAction$outboundSchema,
230
267
  ]);
231
268
 
232
269
  export function stepEventActionsSubmitToJSON(
@@ -255,45 +292,42 @@ export const StepEventActions$inboundSchema: z.ZodType<
255
292
  start: z.nullable(
256
293
  z.array(
257
294
  z.union([
258
- CallAction$inboundSchema.and(z.object({ action: z.literal("call") })),
259
- IncrementAction$inboundSchema.and(
260
- z.object({ action: z.literal("inc") }),
261
- ),
262
- SayAction$inboundSchema.and(z.object({ action: z.literal("say") })),
263
- SetValueAction$inboundSchema.and(
264
- z.object({ action: z.literal("set") }),
265
- ),
266
- SaveAction$inboundSchema.and(z.object({ action: z.literal("save") })),
295
+ CallAction$inboundSchema,
296
+ IncrementAction$inboundSchema,
297
+ SaveAction$inboundSchema,
298
+ SayAction$inboundSchema,
299
+ SetValueAction$inboundSchema,
267
300
  ]),
268
301
  ),
269
302
  ).optional(),
270
303
  enter: z.nullable(
271
304
  z.array(
272
305
  z.union([
273
- CallAction$inboundSchema.and(z.object({ action: z.literal("call") })),
274
- IncrementAction$inboundSchema.and(
275
- z.object({ action: z.literal("inc") }),
276
- ),
277
- SayAction$inboundSchema.and(z.object({ action: z.literal("say") })),
278
- SetValueAction$inboundSchema.and(
279
- z.object({ action: z.literal("set") }),
280
- ),
281
- SaveAction$inboundSchema.and(z.object({ action: z.literal("save") })),
306
+ CallAction$inboundSchema,
307
+ IncrementAction$inboundSchema,
308
+ SaveAction$inboundSchema,
309
+ SayAction$inboundSchema,
310
+ SetValueAction$inboundSchema,
311
+ ]),
312
+ ),
313
+ ).optional(),
314
+ presubmit: z.nullable(
315
+ z.array(
316
+ z.union([
317
+ IncrementAction$inboundSchema,
318
+ SaveAction$inboundSchema,
319
+ SetValueAction$inboundSchema,
282
320
  ]),
283
321
  ),
284
322
  ).optional(),
285
323
  submit: z.nullable(
286
324
  z.array(
287
325
  z.union([
288
- CallAction$inboundSchema.and(z.object({ action: z.literal("call") })),
289
- IncrementAction$inboundSchema.and(
290
- z.object({ action: z.literal("inc") }),
291
- ),
292
- SayAction$inboundSchema.and(z.object({ action: z.literal("say") })),
293
- SetValueAction$inboundSchema.and(
294
- z.object({ action: z.literal("set") }),
295
- ),
296
- SaveAction$inboundSchema.and(z.object({ action: z.literal("save") })),
326
+ CallAction$inboundSchema,
327
+ IncrementAction$inboundSchema,
328
+ SaveAction$inboundSchema,
329
+ SayAction$inboundSchema,
330
+ SetValueAction$inboundSchema,
297
331
  ]),
298
332
  ),
299
333
  ).optional(),
@@ -302,31 +336,37 @@ export const StepEventActions$inboundSchema: z.ZodType<
302
336
  export type StepEventActions$Outbound = {
303
337
  start?:
304
338
  | Array<
305
- | (CallAction$Outbound & { action: "call" })
306
- | (IncrementAction$Outbound & { action: "inc" })
307
- | (SayAction$Outbound & { action: "say" })
308
- | (SetValueAction$Outbound & { action: "set" })
309
- | (SaveAction$Outbound & { action: "save" })
339
+ | CallAction$Outbound
340
+ | IncrementAction$Outbound
341
+ | SaveAction$Outbound
342
+ | SayAction$Outbound
343
+ | SetValueAction$Outbound
310
344
  >
311
345
  | null
312
346
  | undefined;
313
347
  enter?:
314
348
  | Array<
315
- | (CallAction$Outbound & { action: "call" })
316
- | (IncrementAction$Outbound & { action: "inc" })
317
- | (SayAction$Outbound & { action: "say" })
318
- | (SetValueAction$Outbound & { action: "set" })
319
- | (SaveAction$Outbound & { action: "save" })
349
+ | CallAction$Outbound
350
+ | IncrementAction$Outbound
351
+ | SaveAction$Outbound
352
+ | SayAction$Outbound
353
+ | SetValueAction$Outbound
354
+ >
355
+ | null
356
+ | undefined;
357
+ presubmit?:
358
+ | Array<
359
+ IncrementAction$Outbound | SaveAction$Outbound | SetValueAction$Outbound
320
360
  >
321
361
  | null
322
362
  | undefined;
323
363
  submit?:
324
364
  | Array<
325
- | (CallAction$Outbound & { action: "call" })
326
- | (IncrementAction$Outbound & { action: "inc" })
327
- | (SayAction$Outbound & { action: "say" })
328
- | (SetValueAction$Outbound & { action: "set" })
329
- | (SaveAction$Outbound & { action: "save" })
365
+ | CallAction$Outbound
366
+ | IncrementAction$Outbound
367
+ | SaveAction$Outbound
368
+ | SayAction$Outbound
369
+ | SetValueAction$Outbound
330
370
  >
331
371
  | null
332
372
  | undefined;
@@ -341,45 +381,42 @@ export const StepEventActions$outboundSchema: z.ZodType<
341
381
  start: z.nullable(
342
382
  z.array(
343
383
  z.union([
344
- CallAction$outboundSchema.and(z.object({ action: z.literal("call") })),
345
- IncrementAction$outboundSchema.and(
346
- z.object({ action: z.literal("inc") }),
347
- ),
348
- SayAction$outboundSchema.and(z.object({ action: z.literal("say") })),
349
- SetValueAction$outboundSchema.and(
350
- z.object({ action: z.literal("set") }),
351
- ),
352
- SaveAction$outboundSchema.and(z.object({ action: z.literal("save") })),
384
+ CallAction$outboundSchema,
385
+ IncrementAction$outboundSchema,
386
+ SaveAction$outboundSchema,
387
+ SayAction$outboundSchema,
388
+ SetValueAction$outboundSchema,
353
389
  ]),
354
390
  ),
355
391
  ).optional(),
356
392
  enter: z.nullable(
357
393
  z.array(
358
394
  z.union([
359
- CallAction$outboundSchema.and(z.object({ action: z.literal("call") })),
360
- IncrementAction$outboundSchema.and(
361
- z.object({ action: z.literal("inc") }),
362
- ),
363
- SayAction$outboundSchema.and(z.object({ action: z.literal("say") })),
364
- SetValueAction$outboundSchema.and(
365
- z.object({ action: z.literal("set") }),
366
- ),
367
- SaveAction$outboundSchema.and(z.object({ action: z.literal("save") })),
395
+ CallAction$outboundSchema,
396
+ IncrementAction$outboundSchema,
397
+ SaveAction$outboundSchema,
398
+ SayAction$outboundSchema,
399
+ SetValueAction$outboundSchema,
400
+ ]),
401
+ ),
402
+ ).optional(),
403
+ presubmit: z.nullable(
404
+ z.array(
405
+ z.union([
406
+ IncrementAction$outboundSchema,
407
+ SaveAction$outboundSchema,
408
+ SetValueAction$outboundSchema,
368
409
  ]),
369
410
  ),
370
411
  ).optional(),
371
412
  submit: z.nullable(
372
413
  z.array(
373
414
  z.union([
374
- CallAction$outboundSchema.and(z.object({ action: z.literal("call") })),
375
- IncrementAction$outboundSchema.and(
376
- z.object({ action: z.literal("inc") }),
377
- ),
378
- SayAction$outboundSchema.and(z.object({ action: z.literal("say") })),
379
- SetValueAction$outboundSchema.and(
380
- z.object({ action: z.literal("set") }),
381
- ),
382
- SaveAction$outboundSchema.and(z.object({ action: z.literal("save") })),
415
+ CallAction$outboundSchema,
416
+ IncrementAction$outboundSchema,
417
+ SaveAction$outboundSchema,
418
+ SayAction$outboundSchema,
419
+ SetValueAction$outboundSchema,
383
420
  ]),
384
421
  ),
385
422
  ).optional(),
@@ -40,7 +40,7 @@ export type StepsTask = {
40
40
  variables?: Array<Variable> | null | undefined;
41
41
  metadata?: ContextTaskMetadata | null | undefined;
42
42
  tool?: ContextToolInfo | null | undefined;
43
- type?: "steps" | undefined;
43
+ type: "steps";
44
44
  version?: "v1alpha" | undefined;
45
45
  steps?: Array<Step> | undefined;
46
46
  };
@@ -56,7 +56,7 @@ export const StepsTask$inboundSchema: z.ZodType<
56
56
  variables: z.nullable(z.array(Variable$inboundSchema)).optional(),
57
57
  metadata: z.nullable(ContextTaskMetadata$inboundSchema).optional(),
58
58
  tool: z.nullable(ContextToolInfo$inboundSchema).optional(),
59
- type: z.literal("steps").default("steps"),
59
+ type: z.literal("steps"),
60
60
  version: z.literal("v1alpha").default("v1alpha"),
61
61
  steps: z.array(Step$inboundSchema).optional(),
62
62
  });
@@ -83,7 +83,7 @@ export const StepsTask$outboundSchema: z.ZodType<
83
83
  variables: z.nullable(z.array(Variable$outboundSchema)).optional(),
84
84
  metadata: z.nullable(ContextTaskMetadata$outboundSchema).optional(),
85
85
  tool: z.nullable(ContextToolInfo$outboundSchema).optional(),
86
- type: z.literal("steps").default("steps" as const),
86
+ type: z.literal("steps"),
87
87
  version: z.literal("v1alpha").default("v1alpha" as const),
88
88
  steps: z.array(Step$outboundSchema).optional(),
89
89
  });
@@ -33,13 +33,13 @@ export const ToolParameterTransformCondition$inboundSchema: z.ZodType<
33
33
  > = z.object({
34
34
  key: z.string(),
35
35
  value: z.string(),
36
- operator: z.nullable(z.literal("eq").default("eq")).optional(),
36
+ operator: z.nullable(z.literal("eq")).optional(),
37
37
  });
38
38
  /** @internal */
39
39
  export type ToolParameterTransformCondition$Outbound = {
40
40
  key: string;
41
41
  value: string;
42
- operator: "eq" | null;
42
+ operator?: "eq" | null | undefined;
43
43
  };
44
44
 
45
45
  /** @internal */
@@ -50,7 +50,7 @@ export const ToolParameterTransformCondition$outboundSchema: z.ZodType<
50
50
  > = z.object({
51
51
  key: z.string(),
52
52
  value: z.string(),
53
- operator: z.nullable(z.literal("eq")),
53
+ operator: z.nullable(z.literal("eq")).optional(),
54
54
  });
55
55
 
56
56
  export function toolParameterTransformConditionToJSON(
@@ -28,7 +28,7 @@ import {
28
28
  } from "./jmespathexpression.js";
29
29
 
30
30
  export type One =
31
- | (CelExpression & { type: "cel" })
31
+ | CelExpression
32
32
  | (JMESPathExpression & { type: "jmespath" })
33
33
  | (JMESPathExpression & { type: "jp" });
34
34
 
@@ -37,7 +37,7 @@ export type One =
37
37
  */
38
38
  export type VariableValueFrom =
39
39
  | CaseExpression
40
- | (CelExpression & { type: "cel" })
40
+ | CelExpression
41
41
  | (JMESPathExpression & { type: "jmespath" })
42
42
  | (JMESPathExpression & { type: "jp" })
43
43
  | string;
@@ -63,7 +63,7 @@ export type Variable = {
63
63
  */
64
64
  valueFrom?:
65
65
  | CaseExpression
66
- | (CelExpression & { type: "cel" })
66
+ | CelExpression
67
67
  | (JMESPathExpression & { type: "jmespath" })
68
68
  | (JMESPathExpression & { type: "jp" })
69
69
  | string
@@ -85,7 +85,7 @@ export type Variable = {
85
85
  /** @internal */
86
86
  export const One$inboundSchema: z.ZodType<One, z.ZodTypeDef, unknown> = z.union(
87
87
  [
88
- CelExpression$inboundSchema.and(z.object({ type: z.literal("cel") })),
88
+ CelExpression$inboundSchema,
89
89
  JMESPathExpression$inboundSchema.and(
90
90
  z.object({ type: z.literal("jmespath") }),
91
91
  ),
@@ -94,14 +94,14 @@ export const One$inboundSchema: z.ZodType<One, z.ZodTypeDef, unknown> = z.union(
94
94
  );
95
95
  /** @internal */
96
96
  export type One$Outbound =
97
- | (CelExpression$Outbound & { type: "cel" })
97
+ | CelExpression$Outbound
98
98
  | (JMESPathExpression$Outbound & { type: "jmespath" })
99
99
  | (JMESPathExpression$Outbound & { type: "jp" });
100
100
 
101
101
  /** @internal */
102
102
  export const One$outboundSchema: z.ZodType<One$Outbound, z.ZodTypeDef, One> = z
103
103
  .union([
104
- CelExpression$outboundSchema.and(z.object({ type: z.literal("cel") })),
104
+ CelExpression$outboundSchema,
105
105
  JMESPathExpression$outboundSchema.and(
106
106
  z.object({ type: z.literal("jmespath") }),
107
107
  ),
@@ -129,7 +129,7 @@ export const VariableValueFrom$inboundSchema: z.ZodType<
129
129
  > = z.union([
130
130
  CaseExpression$inboundSchema,
131
131
  z.union([
132
- CelExpression$inboundSchema.and(z.object({ type: z.literal("cel") })),
132
+ CelExpression$inboundSchema,
133
133
  JMESPathExpression$inboundSchema.and(
134
134
  z.object({ type: z.literal("jmespath") }),
135
135
  ),
@@ -140,7 +140,7 @@ export const VariableValueFrom$inboundSchema: z.ZodType<
140
140
  /** @internal */
141
141
  export type VariableValueFrom$Outbound =
142
142
  | CaseExpression$Outbound
143
- | (CelExpression$Outbound & { type: "cel" })
143
+ | CelExpression$Outbound
144
144
  | (JMESPathExpression$Outbound & { type: "jmespath" })
145
145
  | (JMESPathExpression$Outbound & { type: "jp" })
146
146
  | string;
@@ -153,7 +153,7 @@ export const VariableValueFrom$outboundSchema: z.ZodType<
153
153
  > = z.union([
154
154
  CaseExpression$outboundSchema,
155
155
  z.union([
156
- CelExpression$outboundSchema.and(z.object({ type: z.literal("cel") })),
156
+ CelExpression$outboundSchema,
157
157
  JMESPathExpression$outboundSchema.and(
158
158
  z.object({ type: z.literal("jmespath") }),
159
159
  ),
@@ -197,7 +197,7 @@ export const Variable$inboundSchema: z.ZodType<
197
197
  z.union([
198
198
  CaseExpression$inboundSchema,
199
199
  z.union([
200
- CelExpression$inboundSchema.and(z.object({ type: z.literal("cel") })),
200
+ CelExpression$inboundSchema,
201
201
  JMESPathExpression$inboundSchema.and(
202
202
  z.object({ type: z.literal("jmespath") }),
203
203
  ),
@@ -226,7 +226,7 @@ export type Variable$Outbound = {
226
226
  value?: any | null | undefined;
227
227
  value_from?:
228
228
  | CaseExpression$Outbound
229
- | (CelExpression$Outbound & { type: "cel" })
229
+ | CelExpression$Outbound
230
230
  | (JMESPathExpression$Outbound & { type: "jmespath" })
231
231
  | (JMESPathExpression$Outbound & { type: "jp" })
232
232
  | string
@@ -253,7 +253,7 @@ export const Variable$outboundSchema: z.ZodType<
253
253
  z.union([
254
254
  CaseExpression$outboundSchema,
255
255
  z.union([
256
- CelExpression$outboundSchema.and(z.object({ type: z.literal("cel") })),
256
+ CelExpression$outboundSchema,
257
257
  JMESPathExpression$outboundSchema.and(
258
258
  z.object({ type: z.literal("jmespath") }),
259
259
  ),
@@ -16,8 +16,16 @@ export function startCountingUnrecognized() {
16
16
  refCount++;
17
17
  const start = globalCount;
18
18
  return {
19
- end: () => {
19
+ /**
20
+ * Ends counting and returns the delta.
21
+ * @param delta - If provided, only this amount is added to the parent counter
22
+ * (used for nested unions where we only want to record the winning option's count).
23
+ * If not provided, records all counts since start().
24
+ */
25
+ end: (delta?: number) => {
20
26
  const count = globalCount - start;
27
+ // Reset globalCount back to start, then add only the specified delta
28
+ globalCount = start + (delta ?? count);
21
29
  if (--refCount === 0) globalCount = 0;
22
30
  return count;
23
31
  },
package/tsconfig.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "incremental": true,
4
- "tsBuildInfoFile": ".tsbuildinfo",
3
+ "incremental": false,
5
4
  "target": "ES2020",
6
5
  "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
6
  "jsx": "react-jsx",
@@ -4,7 +4,13 @@ export type Unrecognized<T> = T & {
4
4
  };
5
5
  declare function unrecognized<T>(value: T): Unrecognized<T>;
6
6
  export declare function startCountingUnrecognized(): {
7
- end: () => number;
7
+ /**
8
+ * Ends counting and returns the delta.
9
+ * @param delta - If provided, only this amount is added to the parent counter
10
+ * (used for nested unions where we only want to record the winning option's count).
11
+ * If not provided, records all counts since start().
12
+ */
13
+ end: (delta?: number) => number;
8
14
  };
9
15
  export { unrecognized };
10
16
  //# sourceMappingURL=unrecognized.d.ts.map