@valon-technologies/gestalt 0.0.1-alpha.19 → 0.0.1-alpha.21
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/README.md +4 -6
- package/package.json +1 -4
- package/src/agent-conversions.ts +69 -2
- package/src/agent-manager.ts +26 -22
- package/src/agent.ts +33 -27
- package/src/api.ts +19 -0
- package/src/authorization.ts +0 -63
- package/src/index.ts +48 -60
- package/src/indexeddb.ts +450 -46
- package/src/internal/gen/v1/agent_pb.ts +103 -162
- package/src/internal/gen/v1/authentication_pb.ts +1 -1
- package/src/internal/gen/v1/authorization_pb.ts +1 -1
- package/src/internal/gen/v1/cache_pb.ts +1 -1
- package/src/internal/gen/v1/datastore_pb.ts +1 -1
- package/src/internal/gen/v1/external_credential_pb.ts +1 -1
- package/src/internal/gen/v1/plugin_pb.ts +94 -16
- package/src/internal/gen/v1/pluginruntime_pb.ts +1 -1
- package/src/internal/gen/v1/runtime_pb.ts +1 -1
- package/src/internal/gen/v1/s3_pb.ts +1 -1
- package/src/internal/gen/v1/secrets_pb.ts +1 -1
- package/src/internal/gen/v1/workflow_pb.ts +170 -74
- package/src/plugin.ts +4 -4
- package/src/protocol.ts +4 -1
- package/src/runtime.ts +17 -4
- package/src/workflow-manager.ts +53 -57
- package/src/workflow.ts +231 -163
- package/src/protocol/v1.ts +0 -19
- package/src/test-agent-contract.ts +0 -43
package/src/workflow.ts
CHANGED
|
@@ -32,6 +32,8 @@ import {
|
|
|
32
32
|
WorkflowExecutionReferenceSchema,
|
|
33
33
|
WorkflowHost as WorkflowHostService,
|
|
34
34
|
WorkflowManualTriggerSchema,
|
|
35
|
+
WorkflowAgentStepSchema,
|
|
36
|
+
WorkflowAgentStepWhenSchema,
|
|
35
37
|
WorkflowOutputBindingSchema,
|
|
36
38
|
WorkflowOutputDeliverySchema,
|
|
37
39
|
WorkflowOutputValueSourceSchema,
|
|
@@ -77,6 +79,8 @@ import {
|
|
|
77
79
|
type WorkflowEventMatch as ProtoWorkflowEventMatch,
|
|
78
80
|
type WorkflowEventTriggerInvocation as ProtoWorkflowEventTriggerInvocation,
|
|
79
81
|
type WorkflowExecutionReference as ProtoWorkflowExecutionReference,
|
|
82
|
+
type WorkflowAgentStep as ProtoWorkflowAgentStep,
|
|
83
|
+
type WorkflowAgentStepWhen as ProtoWorkflowAgentStepWhen,
|
|
80
84
|
type WorkflowOutputBinding as ProtoWorkflowOutputBinding,
|
|
81
85
|
type WorkflowOutputDelivery as ProtoWorkflowOutputDelivery,
|
|
82
86
|
type WorkflowOutputValueSource as ProtoWorkflowOutputValueSource,
|
|
@@ -142,7 +146,6 @@ export interface BoundWorkflowPluginTarget {
|
|
|
142
146
|
instance?: string | undefined;
|
|
143
147
|
credentialMode?: string | undefined;
|
|
144
148
|
}
|
|
145
|
-
export type BoundWorkflowPluginTargetInput = BoundWorkflowPluginTarget;
|
|
146
149
|
|
|
147
150
|
export type WorkflowOutputValueSourceKind =
|
|
148
151
|
| { case: "agentOutput"; value: string }
|
|
@@ -153,10 +156,6 @@ export type WorkflowOutputValueSourceKind =
|
|
|
153
156
|
| { case: undefined; value?: undefined };
|
|
154
157
|
|
|
155
158
|
export interface WorkflowOutputValueSource {
|
|
156
|
-
kind: WorkflowOutputValueSourceKind;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export interface WorkflowOutputValueSourceInput {
|
|
160
159
|
agentOutput?: string | undefined;
|
|
161
160
|
signalPayload?: string | undefined;
|
|
162
161
|
signalMetadata?: string | undefined;
|
|
@@ -167,16 +166,14 @@ export interface WorkflowOutputValueSourceInput {
|
|
|
167
166
|
|
|
168
167
|
export interface WorkflowOutputBinding {
|
|
169
168
|
inputField?: string | undefined;
|
|
170
|
-
value?: WorkflowOutputValueSource |
|
|
169
|
+
value?: WorkflowOutputValueSource | undefined;
|
|
171
170
|
}
|
|
172
|
-
export type WorkflowOutputBindingInput = WorkflowOutputBinding;
|
|
173
171
|
|
|
174
172
|
export interface WorkflowOutputDelivery {
|
|
175
173
|
target?: BoundWorkflowPluginTarget | undefined;
|
|
176
174
|
inputBindings?: readonly WorkflowOutputBinding[] | undefined;
|
|
177
175
|
credentialMode?: string | undefined;
|
|
178
176
|
}
|
|
179
|
-
export type WorkflowOutputDeliveryInput = WorkflowOutputDelivery;
|
|
180
177
|
|
|
181
178
|
export interface BoundWorkflowAgentTarget {
|
|
182
179
|
providerName?: string | undefined;
|
|
@@ -190,8 +187,27 @@ export interface BoundWorkflowAgentTarget {
|
|
|
190
187
|
outputDelivery?: WorkflowOutputDelivery | undefined;
|
|
191
188
|
modelOptions?: JsonObjectInput | undefined;
|
|
192
189
|
sessionReadyDelivery?: WorkflowOutputDelivery | undefined;
|
|
190
|
+
steps?: readonly WorkflowAgentStep[] | undefined;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface WorkflowAgentStep {
|
|
194
|
+
id?: string | undefined;
|
|
195
|
+
prompt?: string | undefined;
|
|
196
|
+
messages?: readonly AgentMessage[] | undefined;
|
|
197
|
+
toolRefs?: readonly AgentToolRef[] | undefined;
|
|
198
|
+
responseSchema?: JsonObjectInput | undefined;
|
|
199
|
+
modelOptions?: JsonObjectInput | undefined;
|
|
200
|
+
timeoutSeconds?: number | undefined;
|
|
201
|
+
outputDelivery?: WorkflowOutputDelivery | undefined;
|
|
202
|
+
when?: WorkflowAgentStepWhen | undefined;
|
|
203
|
+
metadata?: JsonObjectInput | undefined;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export interface WorkflowAgentStepWhen {
|
|
207
|
+
stepId?: string | undefined;
|
|
208
|
+
outputPath?: string | undefined;
|
|
209
|
+
equals?: JsonInput | undefined;
|
|
193
210
|
}
|
|
194
|
-
export type BoundWorkflowAgentTargetInput = BoundWorkflowAgentTarget;
|
|
195
211
|
|
|
196
212
|
export type BoundWorkflowTargetKind =
|
|
197
213
|
| { case: "plugin"; value: BoundWorkflowPluginTarget }
|
|
@@ -199,10 +215,6 @@ export type BoundWorkflowTargetKind =
|
|
|
199
215
|
| { case: undefined; value?: undefined };
|
|
200
216
|
|
|
201
217
|
export interface BoundWorkflowTarget {
|
|
202
|
-
kind: BoundWorkflowTargetKind;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
export interface BoundWorkflowTargetInput {
|
|
206
218
|
plugin?: BoundWorkflowPluginTarget | undefined;
|
|
207
219
|
agent?: BoundWorkflowAgentTarget | undefined;
|
|
208
220
|
kind?: BoundWorkflowTargetKind | undefined;
|
|
@@ -214,7 +226,6 @@ export interface WorkflowActor {
|
|
|
214
226
|
displayName?: string | undefined;
|
|
215
227
|
authSource?: string | undefined;
|
|
216
228
|
}
|
|
217
|
-
export type WorkflowActorInput = WorkflowActor;
|
|
218
229
|
|
|
219
230
|
export interface WorkflowRunAsSubject {
|
|
220
231
|
subjectId?: string | undefined;
|
|
@@ -222,13 +233,11 @@ export interface WorkflowRunAsSubject {
|
|
|
222
233
|
displayName?: string | undefined;
|
|
223
234
|
authSource?: string | undefined;
|
|
224
235
|
}
|
|
225
|
-
export type WorkflowRunAsSubjectInput = WorkflowRunAsSubject;
|
|
226
236
|
|
|
227
237
|
export interface WorkflowAccessPermission {
|
|
228
238
|
plugin?: string | undefined;
|
|
229
239
|
operations?: readonly string[] | undefined;
|
|
230
240
|
}
|
|
231
|
-
export type WorkflowAccessPermissionInput = WorkflowAccessPermission;
|
|
232
241
|
|
|
233
242
|
export interface WorkflowEvent {
|
|
234
243
|
id?: string | undefined;
|
|
@@ -241,14 +250,12 @@ export interface WorkflowEvent {
|
|
|
241
250
|
data?: JsonObjectInput | undefined;
|
|
242
251
|
extensions?: Record<string, JsonInput> | undefined;
|
|
243
252
|
}
|
|
244
|
-
export type WorkflowEventInput = WorkflowEvent;
|
|
245
253
|
|
|
246
254
|
export interface WorkflowEventMatch {
|
|
247
255
|
type?: string | undefined;
|
|
248
256
|
source?: string | undefined;
|
|
249
257
|
subject?: string | undefined;
|
|
250
258
|
}
|
|
251
|
-
export type WorkflowEventMatchInput = WorkflowEventMatch;
|
|
252
259
|
|
|
253
260
|
export interface WorkflowSignal {
|
|
254
261
|
id?: string | undefined;
|
|
@@ -260,19 +267,16 @@ export interface WorkflowSignal {
|
|
|
260
267
|
idempotencyKey?: string | undefined;
|
|
261
268
|
sequence?: bigint | number | undefined;
|
|
262
269
|
}
|
|
263
|
-
export type WorkflowSignalInput = WorkflowSignal;
|
|
264
270
|
|
|
265
271
|
export interface WorkflowScheduleTrigger {
|
|
266
272
|
scheduleId?: string | undefined;
|
|
267
273
|
scheduledFor?: Date | undefined;
|
|
268
274
|
}
|
|
269
|
-
export type WorkflowScheduleTriggerInput = WorkflowScheduleTrigger;
|
|
270
275
|
|
|
271
276
|
export interface WorkflowEventTriggerInvocation {
|
|
272
277
|
triggerId?: string | undefined;
|
|
273
278
|
event?: WorkflowEvent | undefined;
|
|
274
279
|
}
|
|
275
|
-
export type WorkflowEventTriggerInvocationInput = WorkflowEventTriggerInvocation;
|
|
276
280
|
|
|
277
281
|
export type WorkflowRunTriggerKind =
|
|
278
282
|
| { case: "manual"; value?: Record<string, never> }
|
|
@@ -281,10 +285,6 @@ export type WorkflowRunTriggerKind =
|
|
|
281
285
|
| { case: undefined; value?: undefined };
|
|
282
286
|
|
|
283
287
|
export interface WorkflowRunTrigger {
|
|
284
|
-
kind: WorkflowRunTriggerKind;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
export interface WorkflowRunTriggerInput {
|
|
288
288
|
manual?: boolean | undefined;
|
|
289
289
|
schedule?: WorkflowScheduleTrigger | undefined;
|
|
290
290
|
event?: WorkflowEventTriggerInvocation | undefined;
|
|
@@ -292,123 +292,65 @@ export interface WorkflowRunTriggerInput {
|
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
export interface BoundWorkflowRun {
|
|
295
|
-
id: string;
|
|
296
|
-
status: WorkflowRunStatus;
|
|
297
|
-
target?: BoundWorkflowTarget | undefined;
|
|
298
|
-
trigger?: WorkflowRunTrigger | undefined;
|
|
299
|
-
createdAt?: Date | undefined;
|
|
300
|
-
startedAt?: Date | undefined;
|
|
301
|
-
completedAt?: Date | undefined;
|
|
302
|
-
statusMessage: string;
|
|
303
|
-
resultBody: string;
|
|
304
|
-
createdBy?: WorkflowActor | undefined;
|
|
305
|
-
executionRef: string;
|
|
306
|
-
workflowKey: string;
|
|
307
|
-
}
|
|
308
|
-
export interface BoundWorkflowRunInput {
|
|
309
295
|
id?: string | undefined;
|
|
310
296
|
status?: WorkflowRunStatus | undefined;
|
|
311
|
-
target?: BoundWorkflowTarget |
|
|
312
|
-
trigger?: WorkflowRunTrigger |
|
|
297
|
+
target?: BoundWorkflowTarget | undefined;
|
|
298
|
+
trigger?: WorkflowRunTrigger | undefined;
|
|
313
299
|
createdAt?: Date | undefined;
|
|
314
300
|
startedAt?: Date | undefined;
|
|
315
301
|
completedAt?: Date | undefined;
|
|
316
302
|
statusMessage?: string | undefined;
|
|
317
303
|
resultBody?: string | undefined;
|
|
318
|
-
createdBy?: WorkflowActor |
|
|
304
|
+
createdBy?: WorkflowActor | undefined;
|
|
319
305
|
executionRef?: string | undefined;
|
|
320
306
|
workflowKey?: string | undefined;
|
|
321
307
|
}
|
|
322
308
|
|
|
323
309
|
export interface BoundWorkflowSchedule {
|
|
324
|
-
id: string;
|
|
325
|
-
cron: string;
|
|
326
|
-
timezone: string;
|
|
327
|
-
target?: BoundWorkflowTarget | undefined;
|
|
328
|
-
paused: boolean;
|
|
329
|
-
createdAt?: Date | undefined;
|
|
330
|
-
updatedAt?: Date | undefined;
|
|
331
|
-
nextRunAt?: Date | undefined;
|
|
332
|
-
createdBy?: WorkflowActor | undefined;
|
|
333
|
-
executionRef: string;
|
|
334
|
-
}
|
|
335
|
-
export interface BoundWorkflowScheduleInput {
|
|
336
310
|
id?: string | undefined;
|
|
337
311
|
cron?: string | undefined;
|
|
338
312
|
timezone?: string | undefined;
|
|
339
|
-
target?: BoundWorkflowTarget |
|
|
313
|
+
target?: BoundWorkflowTarget | undefined;
|
|
340
314
|
paused?: boolean | undefined;
|
|
341
315
|
createdAt?: Date | undefined;
|
|
342
316
|
updatedAt?: Date | undefined;
|
|
343
317
|
nextRunAt?: Date | undefined;
|
|
344
|
-
createdBy?: WorkflowActor |
|
|
318
|
+
createdBy?: WorkflowActor | undefined;
|
|
345
319
|
executionRef?: string | undefined;
|
|
346
320
|
}
|
|
347
321
|
|
|
348
322
|
export interface BoundWorkflowEventTrigger {
|
|
349
|
-
id
|
|
323
|
+
id?: string | undefined;
|
|
350
324
|
match?: WorkflowEventMatch | undefined;
|
|
351
325
|
target?: BoundWorkflowTarget | undefined;
|
|
352
|
-
paused: boolean;
|
|
353
|
-
createdAt?: Date | undefined;
|
|
354
|
-
updatedAt?: Date | undefined;
|
|
355
|
-
createdBy?: WorkflowActor | undefined;
|
|
356
|
-
executionRef: string;
|
|
357
|
-
}
|
|
358
|
-
export interface BoundWorkflowEventTriggerInput {
|
|
359
|
-
id?: string | undefined;
|
|
360
|
-
match?: WorkflowEventMatch | WorkflowEventMatchInput | undefined;
|
|
361
|
-
target?: BoundWorkflowTarget | BoundWorkflowTargetInput | undefined;
|
|
362
326
|
paused?: boolean | undefined;
|
|
363
327
|
createdAt?: Date | undefined;
|
|
364
328
|
updatedAt?: Date | undefined;
|
|
365
|
-
createdBy?: WorkflowActor |
|
|
329
|
+
createdBy?: WorkflowActor | undefined;
|
|
366
330
|
executionRef?: string | undefined;
|
|
367
331
|
}
|
|
368
332
|
|
|
369
333
|
export interface BoundWorkflowDefinition {
|
|
370
|
-
id
|
|
334
|
+
id?: string | undefined;
|
|
371
335
|
target?: BoundWorkflowTarget | undefined;
|
|
372
336
|
createdBy?: WorkflowActor | undefined;
|
|
373
337
|
createdAt?: Date | undefined;
|
|
374
338
|
}
|
|
375
|
-
export interface BoundWorkflowDefinitionInput {
|
|
376
|
-
id?: string | undefined;
|
|
377
|
-
target?: BoundWorkflowTarget | BoundWorkflowTargetInput | undefined;
|
|
378
|
-
createdBy?: WorkflowActor | WorkflowActorInput | undefined;
|
|
379
|
-
createdAt?: Date | undefined;
|
|
380
|
-
}
|
|
381
339
|
|
|
382
340
|
export interface WorkflowExecutionReference {
|
|
383
|
-
id: string;
|
|
384
|
-
providerName: string;
|
|
385
|
-
target?: BoundWorkflowTarget | undefined;
|
|
386
|
-
subjectId: string;
|
|
387
|
-
credentialSubjectId: string;
|
|
388
|
-
permissions: readonly WorkflowAccessPermission[];
|
|
389
|
-
createdAt?: Date | undefined;
|
|
390
|
-
revokedAt?: Date | undefined;
|
|
391
|
-
subjectKind: string;
|
|
392
|
-
displayName: string;
|
|
393
|
-
authSource: string;
|
|
394
|
-
callerPluginName: string;
|
|
395
|
-
runAs?: WorkflowRunAsSubject | undefined;
|
|
396
|
-
sourceDefinitionId: string;
|
|
397
|
-
}
|
|
398
|
-
export interface WorkflowExecutionReferenceInput {
|
|
399
341
|
id?: string | undefined;
|
|
400
342
|
providerName?: string | undefined;
|
|
401
|
-
target?: BoundWorkflowTarget |
|
|
343
|
+
target?: BoundWorkflowTarget | undefined;
|
|
402
344
|
subjectId?: string | undefined;
|
|
403
345
|
credentialSubjectId?: string | undefined;
|
|
404
|
-
permissions?: readonly
|
|
346
|
+
permissions?: readonly WorkflowAccessPermission[] | undefined;
|
|
405
347
|
createdAt?: Date | undefined;
|
|
406
348
|
revokedAt?: Date | undefined;
|
|
407
349
|
subjectKind?: string | undefined;
|
|
408
350
|
displayName?: string | undefined;
|
|
409
351
|
authSource?: string | undefined;
|
|
410
352
|
callerPluginName?: string | undefined;
|
|
411
|
-
runAs?: WorkflowRunAsSubject |
|
|
353
|
+
runAs?: WorkflowRunAsSubject | undefined;
|
|
412
354
|
sourceDefinitionId?: string | undefined;
|
|
413
355
|
}
|
|
414
356
|
|
|
@@ -527,9 +469,9 @@ export interface PublishWorkflowProviderEventRequest {
|
|
|
527
469
|
|
|
528
470
|
/** Native input for invoking a workflow operation through the host service. */
|
|
529
471
|
export interface InvokeWorkflowOperationInput {
|
|
530
|
-
target?: BoundWorkflowTarget |
|
|
472
|
+
target?: BoundWorkflowTarget | BoundWorkflowTarget | undefined;
|
|
531
473
|
runId?: string | undefined;
|
|
532
|
-
trigger?: WorkflowRunTrigger |
|
|
474
|
+
trigger?: WorkflowRunTrigger | WorkflowRunTrigger | undefined;
|
|
533
475
|
input?: JsonObjectInput | undefined;
|
|
534
476
|
metadata?: JsonObjectInput | undefined;
|
|
535
477
|
createdBy?: WorkflowActor | undefined;
|
|
@@ -572,7 +514,7 @@ export interface ManagedWorkflowRunSignal {
|
|
|
572
514
|
}
|
|
573
515
|
|
|
574
516
|
/** Creates workflow actor metadata from native input. */
|
|
575
|
-
export function workflowActor(input:
|
|
517
|
+
export function workflowActor(input: WorkflowActor = {}): WorkflowActor {
|
|
576
518
|
return {
|
|
577
519
|
subjectId: input.subjectId ?? "",
|
|
578
520
|
subjectKind: input.subjectKind ?? "",
|
|
@@ -582,13 +524,13 @@ export function workflowActor(input: WorkflowActorInput = {}): WorkflowActor {
|
|
|
582
524
|
}
|
|
583
525
|
|
|
584
526
|
/** Returns native input copied from workflow actor metadata. */
|
|
585
|
-
export function workflowActorInputFromActor(input?: WorkflowActor):
|
|
527
|
+
export function workflowActorInputFromActor(input?: WorkflowActor): WorkflowActor | undefined {
|
|
586
528
|
return input === undefined ? undefined : { ...input };
|
|
587
529
|
}
|
|
588
530
|
|
|
589
531
|
/** Creates workflow run-as metadata from native input. */
|
|
590
532
|
export function workflowRunAsSubject(
|
|
591
|
-
input:
|
|
533
|
+
input: WorkflowRunAsSubject = {},
|
|
592
534
|
): WorkflowRunAsSubject {
|
|
593
535
|
return {
|
|
594
536
|
subjectId: input.subjectId ?? "",
|
|
@@ -601,13 +543,13 @@ export function workflowRunAsSubject(
|
|
|
601
543
|
/** Returns native input copied from workflow run-as metadata. */
|
|
602
544
|
export function workflowRunAsSubjectInputFromSubject(
|
|
603
545
|
input?: WorkflowRunAsSubject,
|
|
604
|
-
):
|
|
546
|
+
): WorkflowRunAsSubject | undefined {
|
|
605
547
|
return input === undefined ? undefined : { ...input };
|
|
606
548
|
}
|
|
607
549
|
|
|
608
550
|
/** Creates an execution-reference permission from native input. */
|
|
609
551
|
export function workflowAccessPermission(
|
|
610
|
-
input:
|
|
552
|
+
input: WorkflowAccessPermission = {},
|
|
611
553
|
): WorkflowAccessPermission {
|
|
612
554
|
return {
|
|
613
555
|
plugin: input.plugin ?? "",
|
|
@@ -618,7 +560,7 @@ export function workflowAccessPermission(
|
|
|
618
560
|
/** Returns native input copied from an execution-reference permission. */
|
|
619
561
|
export function workflowAccessPermissionInputFromPermission(
|
|
620
562
|
input: WorkflowAccessPermission,
|
|
621
|
-
):
|
|
563
|
+
): WorkflowAccessPermission {
|
|
622
564
|
return {
|
|
623
565
|
plugin: input.plugin,
|
|
624
566
|
operations: [...(input.operations ?? [])],
|
|
@@ -627,7 +569,7 @@ export function workflowAccessPermissionInputFromPermission(
|
|
|
627
569
|
|
|
628
570
|
/** Creates workflow event-match fields from native input. */
|
|
629
571
|
export function workflowEventMatch(
|
|
630
|
-
input:
|
|
572
|
+
input: WorkflowEventMatch = {},
|
|
631
573
|
): WorkflowEventMatch {
|
|
632
574
|
return {
|
|
633
575
|
type: input.type ?? "",
|
|
@@ -639,18 +581,18 @@ export function workflowEventMatch(
|
|
|
639
581
|
/** Returns native input copied from workflow event-match fields. */
|
|
640
582
|
export function workflowEventMatchInputFromMatch(
|
|
641
583
|
input?: WorkflowEventMatch,
|
|
642
|
-
):
|
|
584
|
+
): WorkflowEventMatch | undefined {
|
|
643
585
|
return input === undefined ? undefined : { ...input };
|
|
644
586
|
}
|
|
645
587
|
|
|
646
588
|
/** Creates a workflow output value source from native input. */
|
|
647
589
|
export function workflowOutputValueSource(
|
|
648
|
-
input:
|
|
590
|
+
input: WorkflowOutputValueSource | WorkflowOutputValueSource = {},
|
|
649
591
|
): WorkflowOutputValueSource {
|
|
650
592
|
if ("kind" in input && input.kind !== undefined) {
|
|
651
593
|
return { kind: cloneWorkflowOutputValueSourceKind(input.kind) };
|
|
652
594
|
}
|
|
653
|
-
const sourceInput = input as
|
|
595
|
+
const sourceInput = input as WorkflowOutputValueSource;
|
|
654
596
|
const selected = [
|
|
655
597
|
sourceInput.agentOutput === undefined ? undefined : "agentOutput",
|
|
656
598
|
sourceInput.signalPayload === undefined ? undefined : "signalPayload",
|
|
@@ -681,21 +623,22 @@ export function workflowOutputValueSource(
|
|
|
681
623
|
/** Returns native input copied from a workflow output value source. */
|
|
682
624
|
export function workflowOutputValueSourceInputFromSource(
|
|
683
625
|
input?: WorkflowOutputValueSource,
|
|
684
|
-
):
|
|
626
|
+
): WorkflowOutputValueSource | undefined {
|
|
685
627
|
if (input === undefined) {
|
|
686
628
|
return undefined;
|
|
687
629
|
}
|
|
688
|
-
|
|
630
|
+
const kind = input.kind;
|
|
631
|
+
switch (kind?.case) {
|
|
689
632
|
case "agentOutput":
|
|
690
|
-
return { agentOutput:
|
|
633
|
+
return { agentOutput: kind.value };
|
|
691
634
|
case "signalPayload":
|
|
692
|
-
return { signalPayload:
|
|
635
|
+
return { signalPayload: kind.value };
|
|
693
636
|
case "signalMetadata":
|
|
694
|
-
return { signalMetadata:
|
|
637
|
+
return { signalMetadata: kind.value };
|
|
695
638
|
case "agentSession":
|
|
696
|
-
return { agentSession:
|
|
639
|
+
return { agentSession: kind.value };
|
|
697
640
|
case "literal":
|
|
698
|
-
return { literal:
|
|
641
|
+
return { literal: kind.value };
|
|
699
642
|
default:
|
|
700
643
|
return {};
|
|
701
644
|
}
|
|
@@ -703,7 +646,7 @@ export function workflowOutputValueSourceInputFromSource(
|
|
|
703
646
|
|
|
704
647
|
/** Creates a workflow output binding from native input. */
|
|
705
648
|
export function workflowOutputBinding(
|
|
706
|
-
input:
|
|
649
|
+
input: WorkflowOutputBinding = {},
|
|
707
650
|
): WorkflowOutputBinding {
|
|
708
651
|
return {
|
|
709
652
|
inputField: input.inputField ?? "",
|
|
@@ -714,7 +657,7 @@ export function workflowOutputBinding(
|
|
|
714
657
|
/** Returns native input copied from a workflow output binding. */
|
|
715
658
|
export function workflowOutputBindingInputFromBinding(
|
|
716
659
|
input: WorkflowOutputBinding,
|
|
717
|
-
):
|
|
660
|
+
): WorkflowOutputBinding {
|
|
718
661
|
return {
|
|
719
662
|
inputField: input.inputField,
|
|
720
663
|
value: input.value === undefined
|
|
@@ -725,7 +668,7 @@ export function workflowOutputBindingInputFromBinding(
|
|
|
725
668
|
|
|
726
669
|
/** Creates a workflow output delivery from native input. */
|
|
727
670
|
export function workflowOutputDelivery(
|
|
728
|
-
input:
|
|
671
|
+
input: WorkflowOutputDelivery = {},
|
|
729
672
|
): WorkflowOutputDelivery {
|
|
730
673
|
return {
|
|
731
674
|
target: input.target === undefined ? undefined : boundWorkflowPluginTarget(input.target),
|
|
@@ -737,7 +680,7 @@ export function workflowOutputDelivery(
|
|
|
737
680
|
/** Returns native input copied from a workflow output delivery. */
|
|
738
681
|
export function workflowOutputDeliveryInputFromDelivery(
|
|
739
682
|
input?: WorkflowOutputDelivery,
|
|
740
|
-
):
|
|
683
|
+
): WorkflowOutputDelivery | undefined {
|
|
741
684
|
if (input === undefined) {
|
|
742
685
|
return undefined;
|
|
743
686
|
}
|
|
@@ -750,7 +693,7 @@ export function workflowOutputDeliveryInputFromDelivery(
|
|
|
750
693
|
|
|
751
694
|
/** Creates a bound plugin workflow target from native input. */
|
|
752
695
|
export function boundWorkflowPluginTarget(
|
|
753
|
-
input:
|
|
696
|
+
input: BoundWorkflowPluginTarget = {},
|
|
754
697
|
): BoundWorkflowPluginTarget {
|
|
755
698
|
return {
|
|
756
699
|
pluginName: input.pluginName ?? "",
|
|
@@ -765,7 +708,7 @@ export function boundWorkflowPluginTarget(
|
|
|
765
708
|
/** Returns native input copied from a bound plugin workflow target. */
|
|
766
709
|
export function boundWorkflowPluginTargetInputFromTarget(
|
|
767
710
|
input?: BoundWorkflowPluginTarget,
|
|
768
|
-
):
|
|
711
|
+
): BoundWorkflowPluginTarget | undefined {
|
|
769
712
|
if (input === undefined) {
|
|
770
713
|
return undefined;
|
|
771
714
|
}
|
|
@@ -781,7 +724,7 @@ export function boundWorkflowPluginTargetInputFromTarget(
|
|
|
781
724
|
|
|
782
725
|
/** Creates a bound agent workflow target from native input. */
|
|
783
726
|
export function boundWorkflowAgentTarget(
|
|
784
|
-
input:
|
|
727
|
+
input: BoundWorkflowAgentTarget = {},
|
|
785
728
|
): BoundWorkflowAgentTarget {
|
|
786
729
|
return {
|
|
787
730
|
providerName: input.providerName ?? "",
|
|
@@ -797,13 +740,14 @@ export function boundWorkflowAgentTarget(
|
|
|
797
740
|
sessionReadyDelivery: input.sessionReadyDelivery === undefined
|
|
798
741
|
? undefined
|
|
799
742
|
: workflowOutputDelivery(input.sessionReadyDelivery),
|
|
743
|
+
steps: (input.steps ?? []).map(workflowAgentStep),
|
|
800
744
|
};
|
|
801
745
|
}
|
|
802
746
|
|
|
803
747
|
/** Returns native input copied from a bound agent workflow target. */
|
|
804
748
|
export function boundWorkflowAgentTargetInputFromTarget(
|
|
805
749
|
input?: BoundWorkflowAgentTarget,
|
|
806
|
-
):
|
|
750
|
+
): BoundWorkflowAgentTarget | undefined {
|
|
807
751
|
if (input === undefined) {
|
|
808
752
|
return undefined;
|
|
809
753
|
}
|
|
@@ -819,17 +763,78 @@ export function boundWorkflowAgentTargetInputFromTarget(
|
|
|
819
763
|
outputDelivery: workflowOutputDeliveryInputFromDelivery(input.outputDelivery),
|
|
820
764
|
modelOptions: input.modelOptions === undefined ? undefined : jsonObjectClone(input.modelOptions),
|
|
821
765
|
sessionReadyDelivery: workflowOutputDeliveryInputFromDelivery(input.sessionReadyDelivery),
|
|
766
|
+
steps: (input.steps ?? []).map((step) => workflowAgentStepInputFromStep(step)!),
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/** Creates one bound workflow agent step from native input. */
|
|
771
|
+
export function workflowAgentStep(input: WorkflowAgentStep = {}): WorkflowAgentStep {
|
|
772
|
+
return {
|
|
773
|
+
id: input.id ?? "",
|
|
774
|
+
prompt: input.prompt ?? "",
|
|
775
|
+
messages: [...(input.messages ?? [])],
|
|
776
|
+
toolRefs: [...(input.toolRefs ?? [])],
|
|
777
|
+
responseSchema: input.responseSchema === undefined ? undefined : structFromObject(input.responseSchema),
|
|
778
|
+
modelOptions: input.modelOptions === undefined ? undefined : structFromObject(input.modelOptions),
|
|
779
|
+
timeoutSeconds: input.timeoutSeconds ?? 0,
|
|
780
|
+
outputDelivery: input.outputDelivery === undefined ? undefined : workflowOutputDelivery(input.outputDelivery),
|
|
781
|
+
when: input.when === undefined ? undefined : workflowAgentStepWhen(input.when),
|
|
782
|
+
metadata: input.metadata === undefined ? undefined : structFromObject(input.metadata),
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
/** Returns native input copied from one bound workflow agent step. */
|
|
787
|
+
export function workflowAgentStepInputFromStep(
|
|
788
|
+
input?: WorkflowAgentStep,
|
|
789
|
+
): WorkflowAgentStep | undefined {
|
|
790
|
+
if (input === undefined) {
|
|
791
|
+
return undefined;
|
|
792
|
+
}
|
|
793
|
+
return {
|
|
794
|
+
id: input.id,
|
|
795
|
+
prompt: input.prompt,
|
|
796
|
+
messages: [...(input.messages ?? [])],
|
|
797
|
+
toolRefs: [...(input.toolRefs ?? [])],
|
|
798
|
+
responseSchema: input.responseSchema === undefined ? undefined : jsonObjectClone(input.responseSchema),
|
|
799
|
+
modelOptions: input.modelOptions === undefined ? undefined : jsonObjectClone(input.modelOptions),
|
|
800
|
+
timeoutSeconds: input.timeoutSeconds,
|
|
801
|
+
outputDelivery: workflowOutputDeliveryInputFromDelivery(input.outputDelivery),
|
|
802
|
+
when: input.when === undefined ? undefined : workflowAgentStepWhenInputFromWhen(input.when),
|
|
803
|
+
metadata: input.metadata === undefined ? undefined : jsonObjectClone(input.metadata),
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/** Creates a narrow condition for running one workflow agent step. */
|
|
808
|
+
export function workflowAgentStepWhen(input: WorkflowAgentStepWhen = {}): WorkflowAgentStepWhen {
|
|
809
|
+
return {
|
|
810
|
+
stepId: input.stepId ?? "",
|
|
811
|
+
outputPath: input.outputPath ?? "",
|
|
812
|
+
equals: input.equals,
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
/** Returns native input copied from a workflow agent step condition. */
|
|
817
|
+
export function workflowAgentStepWhenInputFromWhen(
|
|
818
|
+
input?: WorkflowAgentStepWhen,
|
|
819
|
+
): WorkflowAgentStepWhen | undefined {
|
|
820
|
+
if (input === undefined) {
|
|
821
|
+
return undefined;
|
|
822
|
+
}
|
|
823
|
+
return {
|
|
824
|
+
stepId: input.stepId,
|
|
825
|
+
outputPath: input.outputPath,
|
|
826
|
+
equals: input.equals,
|
|
822
827
|
};
|
|
823
828
|
}
|
|
824
829
|
|
|
825
830
|
/** Creates a bound workflow target from native input. */
|
|
826
831
|
export function boundWorkflowTarget(
|
|
827
|
-
input:
|
|
832
|
+
input: BoundWorkflowTarget | BoundWorkflowTarget = {},
|
|
828
833
|
): BoundWorkflowTarget {
|
|
829
834
|
if ("kind" in input && input.kind !== undefined) {
|
|
830
835
|
return boundWorkflowTargetFromTarget({ kind: input.kind });
|
|
831
836
|
}
|
|
832
|
-
const targetInput = input as
|
|
837
|
+
const targetInput = input as BoundWorkflowTarget;
|
|
833
838
|
if (targetInput.plugin !== undefined && targetInput.agent !== undefined) {
|
|
834
839
|
throw new Error("bound workflow target must set either plugin or agent");
|
|
835
840
|
}
|
|
@@ -845,15 +850,16 @@ export function boundWorkflowTarget(
|
|
|
845
850
|
/** Returns native input copied from a bound workflow target. */
|
|
846
851
|
export function boundWorkflowTargetInputFromTarget(
|
|
847
852
|
input?: BoundWorkflowTarget,
|
|
848
|
-
):
|
|
853
|
+
): BoundWorkflowTarget | undefined {
|
|
849
854
|
if (input === undefined) {
|
|
850
855
|
return undefined;
|
|
851
856
|
}
|
|
852
|
-
|
|
857
|
+
const kind = input.kind;
|
|
858
|
+
switch (kind?.case) {
|
|
853
859
|
case "plugin":
|
|
854
|
-
return { plugin: boundWorkflowPluginTargetInputFromTarget(
|
|
860
|
+
return { plugin: boundWorkflowPluginTargetInputFromTarget(kind.value) };
|
|
855
861
|
case "agent":
|
|
856
|
-
return { agent: boundWorkflowAgentTargetInputFromTarget(
|
|
862
|
+
return { agent: boundWorkflowAgentTargetInputFromTarget(kind.value) };
|
|
857
863
|
default:
|
|
858
864
|
return {};
|
|
859
865
|
}
|
|
@@ -865,7 +871,7 @@ export function boundWorkflowTargetFromTarget(input: BoundWorkflowTarget): Bound
|
|
|
865
871
|
}
|
|
866
872
|
|
|
867
873
|
/** Creates a workflow event from native input. */
|
|
868
|
-
export function workflowEvent(input:
|
|
874
|
+
export function workflowEvent(input: WorkflowEvent = {}): WorkflowEvent {
|
|
869
875
|
return {
|
|
870
876
|
id: input.id ?? "",
|
|
871
877
|
source: input.source ?? "",
|
|
@@ -880,7 +886,7 @@ export function workflowEvent(input: WorkflowEventInput = {}): WorkflowEvent {
|
|
|
880
886
|
}
|
|
881
887
|
|
|
882
888
|
/** Returns native input copied from a workflow event. */
|
|
883
|
-
export function workflowEventInputFromEvent(input?: WorkflowEvent):
|
|
889
|
+
export function workflowEventInputFromEvent(input?: WorkflowEvent): WorkflowEvent | undefined {
|
|
884
890
|
if (input === undefined) {
|
|
885
891
|
return undefined;
|
|
886
892
|
}
|
|
@@ -903,7 +909,7 @@ export function workflowEventFromEvent(input: WorkflowEvent): WorkflowEvent {
|
|
|
903
909
|
}
|
|
904
910
|
|
|
905
911
|
/** Creates a workflow signal from native input. */
|
|
906
|
-
export function workflowSignal(input:
|
|
912
|
+
export function workflowSignal(input: WorkflowSignal = {}): WorkflowSignal {
|
|
907
913
|
return {
|
|
908
914
|
id: input.id ?? "",
|
|
909
915
|
name: input.name ?? "",
|
|
@@ -917,7 +923,7 @@ export function workflowSignal(input: WorkflowSignalInput = {}): WorkflowSignal
|
|
|
917
923
|
}
|
|
918
924
|
|
|
919
925
|
/** Returns native input copied from a workflow signal. */
|
|
920
|
-
export function workflowSignalInputFromSignal(input?: WorkflowSignal):
|
|
926
|
+
export function workflowSignalInputFromSignal(input?: WorkflowSignal): WorkflowSignal | undefined {
|
|
921
927
|
if (input === undefined) {
|
|
922
928
|
return undefined;
|
|
923
929
|
}
|
|
@@ -940,7 +946,7 @@ export function workflowSignalFromSignal(input: WorkflowSignal): WorkflowSignal
|
|
|
940
946
|
|
|
941
947
|
/** Creates a workflow schedule trigger from native input. */
|
|
942
948
|
export function workflowScheduleTrigger(
|
|
943
|
-
input:
|
|
949
|
+
input: WorkflowScheduleTrigger = {},
|
|
944
950
|
): WorkflowScheduleTrigger {
|
|
945
951
|
return {
|
|
946
952
|
scheduleId: input.scheduleId ?? "",
|
|
@@ -950,7 +956,7 @@ export function workflowScheduleTrigger(
|
|
|
950
956
|
|
|
951
957
|
/** Creates a workflow event-trigger invocation from native input. */
|
|
952
958
|
export function workflowEventTriggerInvocation(
|
|
953
|
-
input:
|
|
959
|
+
input: WorkflowEventTriggerInvocation = {},
|
|
954
960
|
): WorkflowEventTriggerInvocation {
|
|
955
961
|
return {
|
|
956
962
|
triggerId: input.triggerId ?? "",
|
|
@@ -960,12 +966,12 @@ export function workflowEventTriggerInvocation(
|
|
|
960
966
|
|
|
961
967
|
/** Creates a workflow run trigger from native input. */
|
|
962
968
|
export function workflowRunTrigger(
|
|
963
|
-
input:
|
|
969
|
+
input: WorkflowRunTrigger | WorkflowRunTrigger = {},
|
|
964
970
|
): WorkflowRunTrigger {
|
|
965
971
|
if ("kind" in input && input.kind !== undefined) {
|
|
966
972
|
return workflowRunTriggerFromTrigger({ kind: input.kind });
|
|
967
973
|
}
|
|
968
|
-
const triggerInput = input as
|
|
974
|
+
const triggerInput = input as WorkflowRunTrigger;
|
|
969
975
|
const selected = [
|
|
970
976
|
triggerInput.manual === true ? "manual" : undefined,
|
|
971
977
|
triggerInput.schedule === undefined ? undefined : "schedule",
|
|
@@ -990,20 +996,21 @@ export function workflowRunTrigger(
|
|
|
990
996
|
/** Returns native input copied from a workflow run trigger. */
|
|
991
997
|
export function workflowRunTriggerInputFromTrigger(
|
|
992
998
|
input?: WorkflowRunTrigger,
|
|
993
|
-
):
|
|
999
|
+
): WorkflowRunTrigger | undefined {
|
|
994
1000
|
if (input === undefined) {
|
|
995
1001
|
return undefined;
|
|
996
1002
|
}
|
|
997
|
-
|
|
1003
|
+
const kind = input.kind;
|
|
1004
|
+
switch (kind?.case) {
|
|
998
1005
|
case "manual":
|
|
999
1006
|
return { manual: true };
|
|
1000
1007
|
case "schedule":
|
|
1001
|
-
return { schedule: { ...
|
|
1008
|
+
return { schedule: { ...kind.value } };
|
|
1002
1009
|
case "event":
|
|
1003
1010
|
return {
|
|
1004
1011
|
event: {
|
|
1005
|
-
triggerId:
|
|
1006
|
-
event: workflowEventInputFromEvent(
|
|
1012
|
+
triggerId: kind.value.triggerId,
|
|
1013
|
+
event: workflowEventInputFromEvent(kind.value.event),
|
|
1007
1014
|
},
|
|
1008
1015
|
};
|
|
1009
1016
|
default:
|
|
@@ -1017,7 +1024,7 @@ export function workflowRunTriggerFromTrigger(input: WorkflowRunTrigger): Workfl
|
|
|
1017
1024
|
}
|
|
1018
1025
|
|
|
1019
1026
|
/** Creates a workflow-provider run from native input. */
|
|
1020
|
-
export function boundWorkflowRun(input:
|
|
1027
|
+
export function boundWorkflowRun(input: BoundWorkflowRun = {}): BoundWorkflowRun {
|
|
1021
1028
|
return {
|
|
1022
1029
|
id: input.id ?? "",
|
|
1023
1030
|
status: input.status ?? WorkflowRunStatus.UNSPECIFIED,
|
|
@@ -1035,7 +1042,7 @@ export function boundWorkflowRun(input: BoundWorkflowRunInput = {}): BoundWorkfl
|
|
|
1035
1042
|
}
|
|
1036
1043
|
|
|
1037
1044
|
/** Returns native input copied from a workflow-provider run. */
|
|
1038
|
-
export function boundWorkflowRunInputFromRun(input?: BoundWorkflowRun):
|
|
1045
|
+
export function boundWorkflowRunInputFromRun(input?: BoundWorkflowRun): BoundWorkflowRun | undefined {
|
|
1039
1046
|
if (input === undefined) {
|
|
1040
1047
|
return undefined;
|
|
1041
1048
|
}
|
|
@@ -1058,7 +1065,7 @@ export function boundWorkflowRunFromRun(input: BoundWorkflowRun): BoundWorkflowR
|
|
|
1058
1065
|
|
|
1059
1066
|
/** Creates a workflow-provider schedule from native input. */
|
|
1060
1067
|
export function boundWorkflowSchedule(
|
|
1061
|
-
input:
|
|
1068
|
+
input: BoundWorkflowSchedule = {},
|
|
1062
1069
|
): BoundWorkflowSchedule {
|
|
1063
1070
|
return {
|
|
1064
1071
|
id: input.id ?? "",
|
|
@@ -1077,7 +1084,7 @@ export function boundWorkflowSchedule(
|
|
|
1077
1084
|
/** Returns native input copied from a workflow-provider schedule. */
|
|
1078
1085
|
export function boundWorkflowScheduleInputFromSchedule(
|
|
1079
1086
|
input?: BoundWorkflowSchedule,
|
|
1080
|
-
):
|
|
1087
|
+
): BoundWorkflowSchedule | undefined {
|
|
1081
1088
|
if (input === undefined) {
|
|
1082
1089
|
return undefined;
|
|
1083
1090
|
}
|
|
@@ -1097,7 +1104,7 @@ export function boundWorkflowScheduleFromSchedule(
|
|
|
1097
1104
|
|
|
1098
1105
|
/** Creates a workflow-provider event trigger from native input. */
|
|
1099
1106
|
export function boundWorkflowEventTrigger(
|
|
1100
|
-
input:
|
|
1107
|
+
input: BoundWorkflowEventTrigger = {},
|
|
1101
1108
|
): BoundWorkflowEventTrigger {
|
|
1102
1109
|
return {
|
|
1103
1110
|
id: input.id ?? "",
|
|
@@ -1114,7 +1121,7 @@ export function boundWorkflowEventTrigger(
|
|
|
1114
1121
|
/** Returns native input copied from a workflow-provider event trigger. */
|
|
1115
1122
|
export function boundWorkflowEventTriggerInputFromTrigger(
|
|
1116
1123
|
input?: BoundWorkflowEventTrigger,
|
|
1117
|
-
):
|
|
1124
|
+
): BoundWorkflowEventTrigger | undefined {
|
|
1118
1125
|
if (input === undefined) {
|
|
1119
1126
|
return undefined;
|
|
1120
1127
|
}
|
|
@@ -1135,7 +1142,7 @@ export function boundWorkflowEventTriggerFromTrigger(
|
|
|
1135
1142
|
|
|
1136
1143
|
/** Creates a workflow execution reference from native input. */
|
|
1137
1144
|
export function workflowExecutionReference(
|
|
1138
|
-
input:
|
|
1145
|
+
input: WorkflowExecutionReference = {},
|
|
1139
1146
|
): WorkflowExecutionReference {
|
|
1140
1147
|
return {
|
|
1141
1148
|
id: input.id ?? "",
|
|
@@ -1158,7 +1165,7 @@ export function workflowExecutionReference(
|
|
|
1158
1165
|
/** Returns native input copied from a workflow execution reference. */
|
|
1159
1166
|
export function workflowExecutionReferenceInputFromReference(
|
|
1160
1167
|
input?: WorkflowExecutionReference,
|
|
1161
|
-
):
|
|
1168
|
+
): WorkflowExecutionReference | undefined {
|
|
1162
1169
|
if (input === undefined) {
|
|
1163
1170
|
return undefined;
|
|
1164
1171
|
}
|
|
@@ -1799,32 +1806,33 @@ export function workflowEventMatchFromProto(
|
|
|
1799
1806
|
}
|
|
1800
1807
|
|
|
1801
1808
|
export function workflowOutputValueSourceToProto(
|
|
1802
|
-
input?: WorkflowOutputValueSource |
|
|
1809
|
+
input?: WorkflowOutputValueSource | WorkflowOutputValueSource | undefined,
|
|
1803
1810
|
): ProtoWorkflowOutputValueSource | undefined {
|
|
1804
1811
|
if (input === undefined) {
|
|
1805
1812
|
return undefined;
|
|
1806
1813
|
}
|
|
1807
1814
|
const source = workflowOutputValueSource(input);
|
|
1808
|
-
|
|
1815
|
+
const kind = source.kind;
|
|
1816
|
+
switch (kind?.case) {
|
|
1809
1817
|
case "agentOutput":
|
|
1810
1818
|
return create(WorkflowOutputValueSourceSchema, {
|
|
1811
|
-
kind: { case: "agentOutput", value:
|
|
1819
|
+
kind: { case: "agentOutput", value: kind.value },
|
|
1812
1820
|
});
|
|
1813
1821
|
case "signalPayload":
|
|
1814
1822
|
return create(WorkflowOutputValueSourceSchema, {
|
|
1815
|
-
kind: { case: "signalPayload", value:
|
|
1823
|
+
kind: { case: "signalPayload", value: kind.value },
|
|
1816
1824
|
});
|
|
1817
1825
|
case "signalMetadata":
|
|
1818
1826
|
return create(WorkflowOutputValueSourceSchema, {
|
|
1819
|
-
kind: { case: "signalMetadata", value:
|
|
1827
|
+
kind: { case: "signalMetadata", value: kind.value },
|
|
1820
1828
|
});
|
|
1821
1829
|
case "agentSession":
|
|
1822
1830
|
return create(WorkflowOutputValueSourceSchema, {
|
|
1823
|
-
kind: { case: "agentSession", value:
|
|
1831
|
+
kind: { case: "agentSession", value: kind.value },
|
|
1824
1832
|
});
|
|
1825
1833
|
case "literal":
|
|
1826
1834
|
return create(WorkflowOutputValueSourceSchema, {
|
|
1827
|
-
kind: { case: "literal", value: valueFromJson(
|
|
1835
|
+
kind: { case: "literal", value: valueFromJson(kind.value) },
|
|
1828
1836
|
});
|
|
1829
1837
|
default:
|
|
1830
1838
|
return create(WorkflowOutputValueSourceSchema);
|
|
@@ -1945,6 +1953,7 @@ export function boundWorkflowAgentTargetToProto(
|
|
|
1945
1953
|
outputDelivery: workflowOutputDeliveryToProto(input.outputDelivery),
|
|
1946
1954
|
modelOptions: optionalStruct(input.modelOptions),
|
|
1947
1955
|
sessionReadyDelivery: workflowOutputDeliveryToProto(input.sessionReadyDelivery),
|
|
1956
|
+
steps: input.steps?.map(workflowAgentStepToProto) ?? [],
|
|
1948
1957
|
});
|
|
1949
1958
|
}
|
|
1950
1959
|
|
|
@@ -1966,24 +1975,82 @@ export function boundWorkflowAgentTargetFromProto(
|
|
|
1966
1975
|
outputDelivery: workflowOutputDeliveryFromProto(input.outputDelivery),
|
|
1967
1976
|
modelOptions: optionalObjectFromStruct(input.modelOptions),
|
|
1968
1977
|
sessionReadyDelivery: workflowOutputDeliveryFromProto(input.sessionReadyDelivery),
|
|
1978
|
+
steps: input.steps.map(workflowAgentStepFromProto),
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
export function workflowAgentStepToProto(input: WorkflowAgentStep): ProtoWorkflowAgentStep {
|
|
1983
|
+
return create(WorkflowAgentStepSchema, {
|
|
1984
|
+
id: input.id ?? "",
|
|
1985
|
+
prompt: input.prompt ?? "",
|
|
1986
|
+
messages: input.messages?.map(agentMessageToProto) ?? [],
|
|
1987
|
+
toolRefs: input.toolRefs?.map(agentToolRefToProto) ?? [],
|
|
1988
|
+
responseSchema: optionalStruct(input.responseSchema),
|
|
1989
|
+
modelOptions: optionalStruct(input.modelOptions),
|
|
1990
|
+
timeoutSeconds: input.timeoutSeconds ?? 0,
|
|
1991
|
+
outputDelivery: workflowOutputDeliveryToProto(input.outputDelivery),
|
|
1992
|
+
when: workflowAgentStepWhenToProto(input.when),
|
|
1993
|
+
metadata: optionalStruct(input.metadata),
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
export function workflowAgentStepFromProto(input: ProtoWorkflowAgentStep): WorkflowAgentStep {
|
|
1998
|
+
return {
|
|
1999
|
+
id: input.id,
|
|
2000
|
+
prompt: input.prompt,
|
|
2001
|
+
messages: input.messages.map(agentMessageFromProto),
|
|
2002
|
+
toolRefs: input.toolRefs.map(agentToolRefFromProto),
|
|
2003
|
+
responseSchema: optionalObjectFromStruct(input.responseSchema),
|
|
2004
|
+
modelOptions: optionalObjectFromStruct(input.modelOptions),
|
|
2005
|
+
timeoutSeconds: input.timeoutSeconds,
|
|
2006
|
+
outputDelivery: workflowOutputDeliveryFromProto(input.outputDelivery),
|
|
2007
|
+
when: workflowAgentStepWhenFromProto(input.when),
|
|
2008
|
+
metadata: optionalObjectFromStruct(input.metadata),
|
|
2009
|
+
};
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
export function workflowAgentStepWhenToProto(
|
|
2013
|
+
input?: WorkflowAgentStepWhen | undefined,
|
|
2014
|
+
): ProtoWorkflowAgentStepWhen | undefined {
|
|
2015
|
+
if (input === undefined) {
|
|
2016
|
+
return undefined;
|
|
2017
|
+
}
|
|
2018
|
+
return create(WorkflowAgentStepWhenSchema, {
|
|
2019
|
+
stepId: input.stepId ?? "",
|
|
2020
|
+
outputPath: input.outputPath ?? "",
|
|
2021
|
+
equals: input.equals === undefined ? undefined : valueFromJson(input.equals),
|
|
2022
|
+
});
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
export function workflowAgentStepWhenFromProto(
|
|
2026
|
+
input?: ProtoWorkflowAgentStepWhen | undefined,
|
|
2027
|
+
): WorkflowAgentStepWhen | undefined {
|
|
2028
|
+
if (input === undefined) {
|
|
2029
|
+
return undefined;
|
|
2030
|
+
}
|
|
2031
|
+
return {
|
|
2032
|
+
stepId: input.stepId,
|
|
2033
|
+
outputPath: input.outputPath,
|
|
2034
|
+
equals: input.equals === undefined ? undefined : jsonFromValue(input.equals),
|
|
1969
2035
|
};
|
|
1970
2036
|
}
|
|
1971
2037
|
|
|
1972
2038
|
export function boundWorkflowTargetToProto(
|
|
1973
|
-
input?: BoundWorkflowTarget |
|
|
2039
|
+
input?: BoundWorkflowTarget | BoundWorkflowTarget | undefined,
|
|
1974
2040
|
): ProtoBoundWorkflowTarget | undefined {
|
|
1975
2041
|
if (input === undefined) {
|
|
1976
2042
|
return undefined;
|
|
1977
2043
|
}
|
|
1978
2044
|
const target = boundWorkflowTarget(input);
|
|
1979
|
-
|
|
2045
|
+
const kind = target.kind;
|
|
2046
|
+
switch (kind?.case) {
|
|
1980
2047
|
case "plugin":
|
|
1981
2048
|
return create(BoundWorkflowTargetSchema, {
|
|
1982
|
-
kind: { case: "plugin", value: boundWorkflowPluginTargetToProto(
|
|
2049
|
+
kind: { case: "plugin", value: boundWorkflowPluginTargetToProto(kind.value)! },
|
|
1983
2050
|
});
|
|
1984
2051
|
case "agent":
|
|
1985
2052
|
return create(BoundWorkflowTargetSchema, {
|
|
1986
|
-
kind: { case: "agent", value: boundWorkflowAgentTargetToProto(
|
|
2053
|
+
kind: { case: "agent", value: boundWorkflowAgentTargetToProto(kind.value)! },
|
|
1987
2054
|
});
|
|
1988
2055
|
default:
|
|
1989
2056
|
return create(BoundWorkflowTargetSchema);
|
|
@@ -2125,24 +2192,25 @@ export function workflowEventTriggerInvocationFromProto(
|
|
|
2125
2192
|
}
|
|
2126
2193
|
|
|
2127
2194
|
export function workflowRunTriggerToProto(
|
|
2128
|
-
input?: WorkflowRunTrigger |
|
|
2195
|
+
input?: WorkflowRunTrigger | WorkflowRunTrigger | undefined,
|
|
2129
2196
|
): ProtoWorkflowRunTrigger | undefined {
|
|
2130
2197
|
if (input === undefined) {
|
|
2131
2198
|
return undefined;
|
|
2132
2199
|
}
|
|
2133
2200
|
const trigger = workflowRunTrigger(input);
|
|
2134
|
-
|
|
2201
|
+
const kind = trigger.kind;
|
|
2202
|
+
switch (kind?.case) {
|
|
2135
2203
|
case "manual":
|
|
2136
2204
|
return create(WorkflowRunTriggerSchema, {
|
|
2137
2205
|
kind: { case: "manual", value: create(WorkflowManualTriggerSchema) },
|
|
2138
2206
|
});
|
|
2139
2207
|
case "schedule":
|
|
2140
2208
|
return create(WorkflowRunTriggerSchema, {
|
|
2141
|
-
kind: { case: "schedule", value: workflowScheduleTriggerToProto(
|
|
2209
|
+
kind: { case: "schedule", value: workflowScheduleTriggerToProto(kind.value)! },
|
|
2142
2210
|
});
|
|
2143
2211
|
case "event":
|
|
2144
2212
|
return create(WorkflowRunTriggerSchema, {
|
|
2145
|
-
kind: { case: "event", value: workflowEventTriggerInvocationToProto(
|
|
2213
|
+
kind: { case: "event", value: workflowEventTriggerInvocationToProto(kind.value)! },
|
|
2146
2214
|
});
|
|
2147
2215
|
default:
|
|
2148
2216
|
return create(WorkflowRunTriggerSchema);
|