@intellia/workflow-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +66 -0
  2. package/dist/cjs/builder.js +336 -0
  3. package/dist/cjs/builder.js.map +1 -0
  4. package/dist/cjs/conditions.js +55 -0
  5. package/dist/cjs/conditions.js.map +1 -0
  6. package/dist/cjs/define-agent-ref.js +6 -0
  7. package/dist/cjs/define-agent-ref.js.map +1 -0
  8. package/dist/cjs/define-knowledge-base.js +6 -0
  9. package/dist/cjs/define-knowledge-base.js.map +1 -0
  10. package/dist/cjs/define-node.js +8 -0
  11. package/dist/cjs/define-node.js.map +1 -0
  12. package/dist/cjs/define-tool-workflow.js +34 -0
  13. package/dist/cjs/define-tool-workflow.js.map +1 -0
  14. package/dist/cjs/define-tool.js +6 -0
  15. package/dist/cjs/define-tool.js.map +1 -0
  16. package/dist/cjs/define-workflow.js +40 -0
  17. package/dist/cjs/define-workflow.js.map +1 -0
  18. package/dist/cjs/graph.js +3 -0
  19. package/dist/cjs/graph.js.map +1 -0
  20. package/dist/cjs/index.js +44 -0
  21. package/dist/cjs/index.js.map +1 -0
  22. package/dist/cjs/node-type-support.js +27 -0
  23. package/dist/cjs/node-type-support.js.map +1 -0
  24. package/dist/cjs/refs.js +52 -0
  25. package/dist/cjs/refs.js.map +1 -0
  26. package/dist/cjs/schema.js +67 -0
  27. package/dist/cjs/schema.js.map +1 -0
  28. package/dist/esm/builder.js +331 -0
  29. package/dist/esm/builder.js.map +1 -0
  30. package/dist/esm/conditions.js +43 -0
  31. package/dist/esm/conditions.js.map +1 -0
  32. package/dist/esm/define-agent-ref.js +2 -0
  33. package/dist/esm/define-agent-ref.js.map +1 -0
  34. package/dist/esm/define-knowledge-base.js +2 -0
  35. package/dist/esm/define-knowledge-base.js.map +1 -0
  36. package/dist/esm/define-node.js +3 -0
  37. package/dist/esm/define-node.js.map +1 -0
  38. package/dist/esm/define-tool-workflow.js +30 -0
  39. package/dist/esm/define-tool-workflow.js.map +1 -0
  40. package/dist/esm/define-tool.js +2 -0
  41. package/dist/esm/define-tool.js.map +1 -0
  42. package/dist/esm/define-workflow.js +36 -0
  43. package/dist/esm/define-workflow.js.map +1 -0
  44. package/dist/esm/graph.js +1 -0
  45. package/dist/esm/graph.js.map +1 -0
  46. package/dist/esm/index.js +12 -0
  47. package/dist/esm/index.js.map +1 -0
  48. package/dist/esm/node-type-support.js +24 -0
  49. package/dist/esm/node-type-support.js.map +1 -0
  50. package/dist/esm/package.json +1 -0
  51. package/dist/esm/refs.js +42 -0
  52. package/dist/esm/refs.js.map +1 -0
  53. package/dist/esm/schema.js +62 -0
  54. package/dist/esm/schema.js.map +1 -0
  55. package/dist/index.d.ts +524 -0
  56. package/package.json +44 -0
  57. package/tsconfig.base.json +12 -0
@@ -0,0 +1,524 @@
1
+ import { z } from 'zod/v4';
2
+ export { z } from 'zod/v4';
3
+
4
+ type JSONSchemaTypeName = "string" | "number" | "integer" | "boolean" | "object" | "array" | "null" | "any";
5
+ type JSONSchemaType = string | number | boolean | JSONSchemaObject | JSONSchemaArray | null;
6
+ interface JSONSchemaObject {
7
+ [key: string]: JSONSchemaType;
8
+ }
9
+ interface JSONSchemaArray extends Array<JSONSchemaType> {
10
+ }
11
+ interface JSONSchema {
12
+ title?: string;
13
+ description?: string;
14
+ default?: JSONSchemaType;
15
+ multipleOf?: number;
16
+ maximum?: number;
17
+ exclusiveMaximum?: number;
18
+ minimum?: number;
19
+ exclusiveMinimum?: number;
20
+ maxLength?: number;
21
+ minLength?: number;
22
+ pattern?: string;
23
+ additionalItems?: boolean | JSONSchema;
24
+ items?: JSONSchema;
25
+ maxItems?: number;
26
+ minItems?: number;
27
+ uniqueItems?: boolean;
28
+ maxProperties?: number;
29
+ minProperties?: number;
30
+ required?: string[];
31
+ additionalProperties?: boolean | JSONSchema;
32
+ definitions?: {
33
+ [k: string]: JSONSchema;
34
+ };
35
+ properties?: {
36
+ [k: string]: JSONSchema;
37
+ };
38
+ enum?: JSONSchemaType[];
39
+ type?: JSONSchemaTypeName;
40
+ allOf?: JSONSchema[];
41
+ anyOf?: JSONSchema[];
42
+ oneOf?: JSONSchema[];
43
+ not?: JSONSchema;
44
+ format?: string;
45
+ [k: string]: any;
46
+ }
47
+
48
+ type WorkflowNodeType = "trigger" | "approval" | "conditional" | "end" | "noop" | "agent" | "tool-call" | "function" | "bash" | "parallel" | "repeat" | "wait-for-callback" | "set-output" | "execute-workflow";
49
+ type Condition = {
50
+ variable: string;
51
+ dataType: "String" | "Boolean" | "Numeric" | "Timestamp";
52
+ comparison: "Equals" | "GreaterThan" | "GreaterThanEquals" | "LessThan" | "LessThanEquals" | "IsNull" | "IsPresent" | "Contains";
53
+ value: string | number | boolean;
54
+ };
55
+ type WaitForCallbackResume = {
56
+ /** Stable scope for the lookup key (e.g. "concierge:signing"). */
57
+ namespace: string;
58
+ /** Composed at runtime via JSONata. Resumer reads the same key. */
59
+ lookupKey: string;
60
+ /** Forwarded to the resumer verbatim. */
61
+ metadata?: Record<string, unknown>;
62
+ /** Default `"generic"`. Set `"feature"` to refuse the generic resume endpoint + tool. */
63
+ by?: "generic" | "feature";
64
+ /**
65
+ * Opt-in: makes this wait discoverable via workflow.listPendingWaits.
66
+ * JSONata-resolved to a user identifier (e.g. `$.results.trigger.hankoUserId`).
67
+ * Scoping to the organization is applied server-side.
68
+ */
69
+ pendingFor?: string;
70
+ };
71
+
72
+ interface VaultItemCredentialsValue {
73
+ email?: string;
74
+ username?: string;
75
+ password: string;
76
+ totpSecret?: string;
77
+ }
78
+ interface VaultItem {
79
+ value: string | VaultItemCredentialsValue;
80
+ }
81
+ interface HttpResponse<T = unknown> {
82
+ data: T;
83
+ status: number;
84
+ }
85
+ type MemoryScope = "organization" | "user";
86
+ interface HutlyApi {
87
+ vault: {
88
+ getItem(id: string): Promise<VaultItem | undefined>;
89
+ getForApp(appName: string): Promise<VaultItem | undefined>;
90
+ };
91
+ memory: {
92
+ get(agentId: string, userId: string, scope: MemoryScope, key: string): Promise<unknown>;
93
+ set(agentId: string, userId: string, scope: MemoryScope, key: string, value: unknown): Promise<void>;
94
+ list(agentId: string, userId: string, scope: MemoryScope, nextToken?: unknown): Promise<{
95
+ items: unknown[];
96
+ nextToken?: unknown;
97
+ }>;
98
+ delete(agentId: string, userId: string, scope: MemoryScope, key: string): Promise<void>;
99
+ };
100
+ http: {
101
+ get<T = unknown>(url: string, config?: Record<string, unknown>): Promise<HttpResponse<T>>;
102
+ post<T = unknown>(url: string, body?: unknown, config?: Record<string, unknown>): Promise<HttpResponse<T>>;
103
+ put<T = unknown>(url: string, body?: unknown, config?: Record<string, unknown>): Promise<HttpResponse<T>>;
104
+ delete<T = unknown>(url: string, config?: Record<string, unknown>): Promise<HttpResponse<T>>;
105
+ patch<T = unknown>(url: string, body?: unknown, config?: Record<string, unknown>): Promise<HttpResponse<T>>;
106
+ request<T = unknown>(config: Record<string, unknown>): Promise<HttpResponse<T>>;
107
+ };
108
+ secrets: {
109
+ get(name: string): Promise<string>;
110
+ };
111
+ moment: unknown;
112
+ askAI<T = unknown>(question: string, responseSchema: unknown, model?: "gpt5.1" | "gpt5.2" | "gpt5.4" | "gpt5.6-luna" | "gpt5.6-terra" | "gpt5.6-sol" | "gpt4.1"): Promise<T>;
113
+ }
114
+
115
+ declare const toJsonSchema: (t: z.ZodType) => JSONSchema;
116
+ declare const artifact: () => z.ZodObject<{
117
+ artifactId: z.ZodString;
118
+ filename: z.ZodString;
119
+ }, z.core.$strip>;
120
+
121
+ declare const REF: unique symbol;
122
+ declare const TPL: unique symbol;
123
+ declare const PHANTOM: unique symbol;
124
+ interface RefLike {
125
+ readonly [REF]: string;
126
+ }
127
+ interface TplLike {
128
+ readonly [TPL]: string;
129
+ }
130
+ type Handle<T> = RefLike & {
131
+ readonly [PHANTOM]?: T;
132
+ } & (T extends readonly unknown[] | string | number | boolean | null | undefined ? unknown : {
133
+ [K in keyof T]-?: Handle<T[K]>;
134
+ });
135
+ declare const isRef: (v: unknown) => v is RefLike;
136
+ declare const refPath: (r: RefLike) => string;
137
+ declare const isTpl: (v: unknown) => v is TplLike;
138
+ declare const tplText: (t: TplLike) => string;
139
+ declare const handleFor: <T>(basePath: string) => Handle<T>;
140
+ declare const tpl: (strings: TemplateStringsArray, ...vals: unknown[]) => TplLike;
141
+ declare const encodeValue: (v: unknown) => unknown;
142
+
143
+ interface FunctionDef<I, O> {
144
+ name: string;
145
+ input: z.ZodType<I>;
146
+ output: z.ZodType<O>;
147
+ run: (input: I, hutly: HutlyApi) => Promise<O>;
148
+ }
149
+ declare const defineFunction: <I, O>(spec: FunctionDef<I, O>) => FunctionDef<I, O>;
150
+ interface WholeStateFunctionDef<O> {
151
+ name: string;
152
+ output: z.ZodType<O>;
153
+ run: (payload: unknown, hutly: HutlyApi) => Promise<O>;
154
+ }
155
+ declare const defineWholeStateFunction: <O>(spec: WholeStateFunctionDef<O>) => WholeStateFunctionDef<O>;
156
+ interface BashSpec<O> {
157
+ name: string;
158
+ id?: string;
159
+ output: z.ZodType<O>;
160
+ secrets?: Record<string, string>;
161
+ timeoutSeconds?: number;
162
+ async?: boolean;
163
+ }
164
+
165
+ interface ToolDef<Id extends string = string> {
166
+ id: Id;
167
+ toolCode: string;
168
+ description: string;
169
+ config: Record<string, unknown>;
170
+ }
171
+ interface ToolConfigRegistry {
172
+ }
173
+ type ToolConfigFor<Code extends string> = Code extends keyof ToolConfigRegistry ? ToolConfigRegistry[Code] : Record<string, unknown>;
174
+ interface ToolInstanceRegistry {
175
+ }
176
+ interface ToolInstanceShape {
177
+ input: Record<string, unknown>;
178
+ output: Record<string, unknown>;
179
+ }
180
+ type ToolInstancesFor<Id extends string> = Id extends keyof ToolInstanceRegistry ? ToolInstanceRegistry[Id] extends Record<string, ToolInstanceShape> ? ToolInstanceRegistry[Id] : Record<string, ToolInstanceShape> : Record<string, ToolInstanceShape>;
181
+ declare const defineTool: <Code extends string, Id extends string>(spec: {
182
+ id: Id;
183
+ toolCode: Code;
184
+ description: string;
185
+ config: ToolConfigFor<Code>;
186
+ }) => ToolDef<Id>;
187
+
188
+ interface KnowledgeBaseDef {
189
+ id: string;
190
+ name: string;
191
+ description: string;
192
+ knowledgeBaseId: string;
193
+ instructions?: string;
194
+ }
195
+ declare const defineKnowledgeBase: (spec: KnowledgeBaseDef) => KnowledgeBaseDef;
196
+
197
+ interface AgentRefDef {
198
+ id: string;
199
+ name: string;
200
+ description: string;
201
+ agentId: string;
202
+ instructions?: string;
203
+ }
204
+ declare const defineAgentRef: (spec: AgentRefDef) => AgentRefDef;
205
+
206
+ type Cond = {
207
+ kind: "comparison";
208
+ condition: Condition;
209
+ } | {
210
+ kind: "jsonata";
211
+ expression: string;
212
+ };
213
+ declare const eq: <T extends string | number | boolean>(t: Handle<T>, v: T) => Cond;
214
+ declare const gt: (t: Handle<number>, v: number) => Cond;
215
+ declare const gte: (t: Handle<number>, v: number) => Cond;
216
+ declare const lt: (t: Handle<number>, v: number) => Cond;
217
+ declare const lte: (t: Handle<number>, v: number) => Cond;
218
+ declare const contains: (t: Handle<string>, v: string) => Cond;
219
+ declare const isNull: (t: RefLike) => Cond;
220
+ declare const isPresent: (t: RefLike) => Cond;
221
+ declare const jsonata: (strings: TemplateStringsArray, ...vals: unknown[]) => Cond;
222
+
223
+ interface Scope {
224
+ nodes: NodeSpec[];
225
+ }
226
+ interface NodeSpecBase {
227
+ id: string;
228
+ name: string;
229
+ onFailure?: Scope | "continue";
230
+ onFailureRejoin?: string | null;
231
+ }
232
+ type NodeSpec = (NodeSpecBase & {
233
+ kind: "function";
234
+ def: FunctionDef<unknown, unknown> | WholeStateFunctionDef<unknown>;
235
+ modulePath: string;
236
+ input: Record<string, unknown> | "whole-state";
237
+ }) | (NodeSpecBase & {
238
+ kind: "bash";
239
+ scriptPath: string;
240
+ output: z.ZodType;
241
+ secrets?: Record<string, string>;
242
+ timeoutSeconds?: number;
243
+ async?: boolean;
244
+ }) | (NodeSpecBase & {
245
+ kind: "tool-call";
246
+ tool: ToolDef;
247
+ toolName: string;
248
+ input: Record<string, unknown>;
249
+ output: z.ZodType;
250
+ }) | (NodeSpecBase & {
251
+ kind: "agent";
252
+ agentId?: string;
253
+ instructions: string;
254
+ input?: z.ZodType;
255
+ output: z.ZodType;
256
+ reasoning?: "none" | "low" | "medium" | "high";
257
+ enabled?: boolean;
258
+ description?: string;
259
+ showWholeChainState?: boolean;
260
+ failBeforeRunningIf?: string;
261
+ failAfterRunningIf?: string;
262
+ toolChoice?: string;
263
+ tools?: ToolDef[];
264
+ knowledgeBases?: KnowledgeBaseDef[];
265
+ otherAgents?: AgentRefDef[];
266
+ }) | (NodeSpecBase & {
267
+ kind: "execute-workflow";
268
+ workflow: WorkflowModule;
269
+ modulePath: string;
270
+ organizationId?: string;
271
+ input: Record<string, unknown> | string;
272
+ output: z.ZodType;
273
+ }) | (NodeSpecBase & {
274
+ kind: "approval";
275
+ notificationType: "Email" | "SMS";
276
+ callbackURL: string;
277
+ emailAddress?: string;
278
+ otherEmails?: string[] | string;
279
+ phoneNumber?: string;
280
+ message: string;
281
+ output: z.ZodType;
282
+ defaultValues?: JSONSchemaType;
283
+ }) | (NodeSpecBase & {
284
+ kind: "wait-for-callback";
285
+ output: z.ZodType;
286
+ timeoutSeconds?: number;
287
+ resume?: WaitForCallbackResume;
288
+ }) | (NodeSpecBase & {
289
+ kind: "noop";
290
+ }) | (NodeSpecBase & {
291
+ kind: "set-output";
292
+ output: Record<string, unknown>;
293
+ }) | (NodeSpecBase & {
294
+ kind: "conditional";
295
+ choices: {
296
+ id: string;
297
+ name?: string;
298
+ cond: Cond;
299
+ scope: Scope;
300
+ }[];
301
+ defaultPath: Scope;
302
+ }) | (NodeSpecBase & {
303
+ kind: "parallel";
304
+ branches: {
305
+ id: string;
306
+ scope: Scope;
307
+ }[];
308
+ }) | (NodeSpecBase & {
309
+ kind: "repeat";
310
+ numberOrList: number | string;
311
+ scope: Scope;
312
+ });
313
+ interface TriggerSpec {
314
+ type: "json" | "kb-file" | "canvas";
315
+ name?: string;
316
+ input?: z.ZodType;
317
+ }
318
+ interface WorkflowModule {
319
+ record(): RecordedWorkflow;
320
+ }
321
+ interface RecordedWorkflow {
322
+ name: string;
323
+ description: string;
324
+ slug: string;
325
+ kind: "standard" | "tool";
326
+ trigger: TriggerSpec;
327
+ scope: Scope;
328
+ output?: Record<string, unknown>;
329
+ outputSchema?: z.ZodType;
330
+ onFailure?: Scope;
331
+ ids: IdAllocator;
332
+ endNodeId?: string | null;
333
+ endNodeName?: string;
334
+ outputNodeId?: string;
335
+ outputNodeName?: string;
336
+ }
337
+
338
+ type OnFailure = ((b: Builder) => void) | "continue";
339
+ type NodeInput<I> = {
340
+ [K in keyof I]: I[K] | Handle<I[K]>;
341
+ };
342
+ type ToolCallInput<I> = {
343
+ [K in keyof I]: I[K] | Handle<I[K]> | TplLike;
344
+ };
345
+ interface AgentSpec<O> {
346
+ name: string;
347
+ id?: string;
348
+ agentId?: string | Handle<string>;
349
+ instructions: string | Handle<string>;
350
+ input?: z.ZodType;
351
+ output: z.ZodType<O>;
352
+ reasoning?: "none" | "low" | "medium" | "high";
353
+ enabled?: boolean;
354
+ description?: string | Handle<string>;
355
+ showWholeChainState?: boolean;
356
+ failBeforeRunningIf?: string | Handle<string>;
357
+ failAfterRunningIf?: string | Handle<string>;
358
+ toolChoice?: "auto" | "required" | "none" | string | Handle<string>;
359
+ tools?: ToolDef[];
360
+ knowledgeBases?: KnowledgeBaseDef[];
361
+ otherAgents?: AgentRefDef[];
362
+ onFailure?: OnFailure;
363
+ onFailureRejoin?: string | null;
364
+ }
365
+ interface ExecuteWorkflowSpec<O> {
366
+ name: string;
367
+ id?: string;
368
+ workflow: WorkflowModule;
369
+ input: NodeInput<Record<string, unknown>> | Handle<unknown>;
370
+ output: z.ZodType<O>;
371
+ organizationId?: string;
372
+ onFailure?: OnFailure;
373
+ onFailureRejoin?: string | null;
374
+ }
375
+ interface ApprovalSpec<O> {
376
+ name: string;
377
+ id?: string;
378
+ notificationType: "Email" | "SMS";
379
+ callbackURL: string | Handle<string>;
380
+ emailAddress?: string | Handle<string>;
381
+ otherEmails?: string[] | string | Handle<string[] | string>;
382
+ phoneNumber?: string | Handle<string>;
383
+ message: string | Handle<string>;
384
+ output: z.ZodType<O>;
385
+ defaultValues?: NodeInput<Record<string, unknown>> | Handle<unknown>;
386
+ onFailure?: OnFailure;
387
+ onFailureRejoin?: string | null;
388
+ }
389
+ interface WaitForCallbackSpec<O> {
390
+ name: string;
391
+ id?: string;
392
+ output: z.ZodType<O>;
393
+ timeoutSeconds?: number;
394
+ resume?: {
395
+ namespace: string | Handle<string>;
396
+ lookupKey: string | Handle<string>;
397
+ metadata?: NodeInput<Record<string, unknown>>;
398
+ by?: "generic" | "feature";
399
+ pendingFor?: string | Handle<string>;
400
+ };
401
+ onFailure?: OnFailure;
402
+ onFailureRejoin?: string | null;
403
+ }
404
+ declare class IdAllocator {
405
+ private used;
406
+ allocate(name: string): string;
407
+ reserve(id: string): string;
408
+ }
409
+ declare class Builder {
410
+ protected readonly ids: IdAllocator;
411
+ readonly scope: Scope;
412
+ constructor(ids: IdAllocator);
413
+ protected push<T>(node: NodeSpec): Handle<T>;
414
+ private resolveId;
415
+ function<I, O>(def: FunctionDef<I, O>, input: NodeInput<I>, opts?: {
416
+ id?: string;
417
+ onFailure?: OnFailure;
418
+ onFailureRejoin?: string | null;
419
+ }): Handle<O>;
420
+ function<O>(def: WholeStateFunctionDef<O>, opts?: {
421
+ id?: string;
422
+ onFailure?: OnFailure;
423
+ onFailureRejoin?: string | null;
424
+ }): Handle<O>;
425
+ bash<O>(scriptPath: string, spec: BashSpec<O> & {
426
+ onFailure?: OnFailure;
427
+ onFailureRejoin?: string | null;
428
+ }): Handle<O>;
429
+ toolCall<Id extends string, Name extends keyof ToolInstancesFor<Id> & string>(tool: ToolDef<Id>, instanceName: Name, spec: {
430
+ id?: string;
431
+ name?: string;
432
+ input: ToolCallInput<ToolInstancesFor<Id>[Name]["input"]>;
433
+ output: z.ZodType<ToolInstancesFor<Id>[Name]["output"]>;
434
+ onFailure?: OnFailure;
435
+ onFailureRejoin?: string | null;
436
+ }): Handle<ToolInstancesFor<Id>[Name]["output"]>;
437
+ agent<O>(spec: AgentSpec<O>): Handle<O>;
438
+ executeWorkflow<O>(spec: ExecuteWorkflowSpec<O>): Handle<O>;
439
+ approval<O>(spec: ApprovalSpec<O>): Handle<O>;
440
+ waitForCallback<O>(spec: WaitForCallbackSpec<O>): Handle<O>;
441
+ output(shape: Record<string, unknown>): Record<string, unknown>;
442
+ setOutput(shape: Record<string, unknown>, opts?: {
443
+ id?: string;
444
+ name?: string;
445
+ }): void;
446
+ noop(name: string, opts?: {
447
+ id?: string;
448
+ }): void;
449
+ if(cond: Cond, branches: {
450
+ then: (b: Builder) => void;
451
+ else?: (b: Builder) => void;
452
+ }, opts?: {
453
+ id?: string;
454
+ name?: string;
455
+ choiceId?: string;
456
+ choiceName?: string;
457
+ }): void;
458
+ choice(branches: {
459
+ id?: string;
460
+ name?: string;
461
+ cond: Cond;
462
+ then: (b: Builder) => void;
463
+ }[], opts?: {
464
+ else?: (b: Builder) => void;
465
+ id?: string;
466
+ name?: string;
467
+ }): void;
468
+ parallel(branches: Record<string, (b: Builder) => void>, opts?: {
469
+ id?: string;
470
+ name?: string;
471
+ }): void;
472
+ forEach(items: unknown, body: (b: Builder) => void, opts?: {
473
+ id?: string;
474
+ name?: string;
475
+ }): void;
476
+ recordBranch(fn?: (b: Builder) => void): Scope | undefined;
477
+ private resolveOnFailure;
478
+ }
479
+
480
+ interface WorkflowSpec<TInput> {
481
+ name: string;
482
+ description?: string;
483
+ slug: string;
484
+ trigger: {
485
+ type: "json" | "kb-file" | "canvas";
486
+ name?: string;
487
+ input?: z.ZodType<TInput>;
488
+ };
489
+ onFailure?: (b: Builder) => void;
490
+ endNodeId?: string | null;
491
+ endNodeName?: string;
492
+ outputNodeId?: string;
493
+ outputNodeName?: string;
494
+ build: (wf: Builder, trigger: Handle<TInput>) => Record<string, unknown> | void;
495
+ }
496
+ declare const defineWorkflow: <TInput>(spec: WorkflowSpec<TInput>) => WorkflowModule;
497
+
498
+ type ToolBuilder = Omit<Builder, "bash">;
499
+ interface ToolWorkflowSpec<TInput, TOutput> {
500
+ name: string;
501
+ description?: string;
502
+ slug: string;
503
+ triggerName?: string;
504
+ endNodeId?: string | null;
505
+ endNodeName?: string;
506
+ outputNodeId?: string;
507
+ outputNodeName?: string;
508
+ input: z.ZodType<TInput>;
509
+ output: z.ZodType<TOutput>;
510
+ build: (wf: ToolBuilder, trigger: Handle<TInput>) => Record<string, unknown>;
511
+ }
512
+ declare const defineToolWorkflow: <TInput, TOutput>(spec: ToolWorkflowSpec<TInput, TOutput>) => WorkflowModule;
513
+
514
+ type NodeTypeSupport = {
515
+ readonly status: "expressible";
516
+ readonly builder: unknown;
517
+ } | {
518
+ readonly status: "not-expressible";
519
+ readonly reason: string;
520
+ };
521
+ declare const NODE_TYPE_SUPPORT: Record<WorkflowNodeType, NodeTypeSupport>;
522
+
523
+ export { Builder, IdAllocator, NODE_TYPE_SUPPORT, artifact, contains, defineAgentRef, defineFunction, defineKnowledgeBase, defineTool, defineToolWorkflow, defineWholeStateFunction, defineWorkflow, encodeValue, eq, gt, gte, handleFor, isNull, isPresent, isRef, isTpl, jsonata, lt, lte, refPath, toJsonSchema, tpl, tplText };
524
+ export type { AgentRefDef, AgentSpec, ApprovalSpec, BashSpec, Cond, ExecuteWorkflowSpec, FunctionDef, Handle, HutlyApi, KnowledgeBaseDef, NodeInput, NodeSpec, NodeTypeSupport, OnFailure, RecordedWorkflow, RefLike, Scope, ToolBuilder, ToolCallInput, ToolConfigFor, ToolConfigRegistry, ToolDef, ToolInstanceRegistry, ToolInstanceShape, ToolInstancesFor, ToolWorkflowSpec, TplLike, TriggerSpec, WaitForCallbackSpec, WholeStateFunctionDef, WorkflowModule, WorkflowSpec };
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@intellia/workflow-sdk",
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "description": "TypeScript authoring surface for Hutly workflows",
6
+ "main": "dist/cjs/index.js",
7
+ "module": "dist/esm/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/esm/index.js",
13
+ "require": "./dist/cjs/index.js"
14
+ },
15
+ "./tsconfig.base.json": "./tsconfig.base.json"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "tsconfig.base.json",
20
+ "README.md"
21
+ ],
22
+ "scripts": {
23
+ "compile": "yarn compile:cjs && yarn compile:esm && yarn mark:esm && yarn bundle:dts",
24
+ "compile:cjs": "tsc --project tsconfig.json",
25
+ "compile:esm": "tsc --project tsconfig.module.json",
26
+ "mark:esm": "node -e \"require('fs').writeFileSync('dist/esm/package.json', JSON.stringify({ type: 'module' }) + '\\n')\"",
27
+ "bundle:dts": "node scripts/bundle-dts.mjs",
28
+ "test": "jest",
29
+ "test:watch": "jest --watch"
30
+ },
31
+ "dependencies": {
32
+ "zod": "3.25.76"
33
+ },
34
+ "devDependencies": {
35
+ "@intellia/workflow-translator": "*",
36
+ "@intellia/workflow-types": "*",
37
+ "@types/jest": "^29.5.4",
38
+ "jest": "^29.6.4",
39
+ "rollup": "^4.62.2",
40
+ "rollup-plugin-dts": "^6.1.0",
41
+ "ts-jest": "^29.1.1",
42
+ "typescript": "^5.2.2"
43
+ }
44
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "moduleResolution": "node",
4
+ "module": "commonjs",
5
+ "target": "es2020",
6
+ "lib": ["es2020"],
7
+ "esModuleInterop": true,
8
+ "strict": true,
9
+ "skipLibCheck": true,
10
+ "noEmit": true
11
+ }
12
+ }