@noetic-tools/types 3.2.0 → 3.2.2
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 +3 -3
- package/dist/errors/noetic-error.js +7 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/schemas/workflow.d.ts +131 -61
- package/dist/schemas/workflow.js +129 -76
- package/dist/types/acp.d.ts +525 -0
- package/dist/types/acp.js +101 -0
- package/dist/types/common.d.ts +12 -0
- package/dist/types/context-harness.d.ts +172 -0
- package/dist/types/context.d.ts +7 -174
- package/dist/types/error.d.ts +5 -4
- package/dist/types/harness-result.d.ts +6 -0
- package/dist/types/observability.d.ts +2 -1
- package/dist/types/output-codec.d.ts +6 -6
- package/dist/types/output-codec.js +4 -4
- package/dist/types/runtime.d.ts +32 -11
- package/dist/types/steering.d.ts +2 -1
- package/dist/types/step.d.ts +68 -53
- package/dist/types/tool-context.d.ts +0 -7
- package/dist/util/message-helpers.js +8 -1
- package/package.json +2 -1
- package/dist/deprecated.d.ts +0 -39
- package/dist/types/sub-harness.d.ts +0 -273
- package/dist/types/sub-harness.js +0 -106
- /package/dist/{deprecated.js → types/context-harness.js} +0 -0
package/README.md
CHANGED
|
@@ -8,14 +8,14 @@ on: the conversation `Item` data model, LLM configuration (`LlmProviderConfig`,
|
|
|
8
8
|
platform adapter interfaces (`FsAdapter`, `ShellAdapter`, `SubprocessAdapter`),
|
|
9
9
|
the error model, and the `Item` schema.
|
|
10
10
|
|
|
11
|
-
It is consumed by [`@noetic-tools/
|
|
11
|
+
It is consumed by [`@noetic-tools/context`](https://www.npmjs.com/package/@noetic-tools/context)
|
|
12
12
|
and [`@noetic-tools/core`](https://www.npmjs.com/package/@noetic-tools/core),
|
|
13
13
|
both of which re-export the parts relevant to their public surface. Application
|
|
14
14
|
code normally imports these types from `@noetic-tools/core` rather than from
|
|
15
15
|
this package directly.
|
|
16
16
|
|
|
17
|
-
The `
|
|
18
|
-
`@noetic-tools/types/contract` subpath for
|
|
17
|
+
The `ContextLayer` contract is additionally exported at the
|
|
18
|
+
`@noetic-tools/types/contract` subpath for context-layer authors who want the
|
|
19
19
|
contract without the rest of the vocabulary.
|
|
20
20
|
|
|
21
21
|
## License
|
|
@@ -43,12 +43,12 @@ function formatMessage(error) {
|
|
|
43
43
|
switch (error.kind) {
|
|
44
44
|
case 'step_failed':
|
|
45
45
|
return `Step '${error.stepId}' failed: ${error.cause.message}`;
|
|
46
|
-
case '
|
|
47
|
-
return `
|
|
48
|
-
case '
|
|
49
|
-
return `
|
|
50
|
-
case '
|
|
51
|
-
return `
|
|
46
|
+
case 'model_refused':
|
|
47
|
+
return `Model refused at step '${error.stepId}': ${error.refusal}`;
|
|
48
|
+
case 'model_parse_error':
|
|
49
|
+
return `Model parse error at step '${error.stepId}': failed to parse output`;
|
|
50
|
+
case 'model_rate_limit':
|
|
51
|
+
return `Model rate limited at step '${error.stepId}'${error.retryAfter ? ` (retry after ${error.retryAfter}ms)` : ''}`;
|
|
52
52
|
case 'fork_partial':
|
|
53
53
|
return `Fork '${error.stepId}' partial failure: ${error.succeeded.length} succeeded, ${error.failed.length} failed`;
|
|
54
54
|
case 'channel_timeout':
|
|
@@ -66,7 +66,7 @@ function formatMessage(error) {
|
|
|
66
66
|
? `Item type '${error.itemType}' did not match any registered item extension schema.`
|
|
67
67
|
: `Item did not match any registered ${error.category} extension schema.`;
|
|
68
68
|
case 'handle_evicted':
|
|
69
|
-
return `Subprocess handle '${error.handleId}' evicted (step '${error.stepId}'): adapter returned null for ${error.
|
|
69
|
+
return `Subprocess handle '${error.handleId}' evicted (step '${error.stepId}'): adapter returned null for ${error.gracePeriod}ms`;
|
|
70
70
|
default: {
|
|
71
71
|
const _exhaustive = error;
|
|
72
72
|
void _exhaustive;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
* @noetic-tools/types — foundational type contracts and primitives shared
|
|
3
3
|
* across the Noetic framework.
|
|
4
4
|
*/
|
|
5
|
-
export * from './deprecated.js';
|
|
6
5
|
export * from './errors/noetic-config-error.js';
|
|
7
6
|
export * from './errors/noetic-error.js';
|
|
8
7
|
export * from './schemas/item.js';
|
|
9
8
|
export * from './schemas/workflow.js';
|
|
9
|
+
export * from './types/acp.js';
|
|
10
10
|
export * from './types/channel.js';
|
|
11
11
|
export * from './types/common.js';
|
|
12
12
|
export * from './types/context.js';
|
|
13
13
|
export * from './types/context-cache.js';
|
|
14
|
+
export * from './types/context-harness.js';
|
|
14
15
|
export * from './types/context-layer.js';
|
|
15
16
|
export * from './types/context-parts/item-log.js';
|
|
16
17
|
export * from './types/context-parts/layer-usage.js';
|
|
@@ -27,7 +28,6 @@ export * from './types/schema.js';
|
|
|
27
28
|
export * from './types/shell-adapter.js';
|
|
28
29
|
export * from './types/steering.js';
|
|
29
30
|
export * from './types/step.js';
|
|
30
|
-
export * from './types/sub-harness.js';
|
|
31
31
|
export * from './types/subprocess-adapter.js';
|
|
32
32
|
export * from './types/tool.js';
|
|
33
33
|
export * from './types/tool-context.js';
|
package/dist/index.js
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
* @noetic-tools/types — foundational type contracts and primitives shared
|
|
3
3
|
* across the Noetic framework.
|
|
4
4
|
*/
|
|
5
|
-
export * from './deprecated.js';
|
|
6
5
|
export * from './errors/noetic-config-error.js';
|
|
7
6
|
export * from './errors/noetic-error.js';
|
|
8
7
|
export * from './schemas/item.js';
|
|
9
8
|
export * from './schemas/workflow.js';
|
|
9
|
+
export * from './types/acp.js';
|
|
10
10
|
export * from './types/channel.js';
|
|
11
11
|
export * from './types/common.js';
|
|
12
12
|
export * from './types/context.js';
|
|
13
13
|
export * from './types/context-cache.js';
|
|
14
|
+
export * from './types/context-harness.js';
|
|
14
15
|
export * from './types/context-layer.js';
|
|
15
16
|
export * from './types/context-parts/item-log.js';
|
|
16
17
|
export * from './types/context-parts/layer-usage.js';
|
|
@@ -27,7 +28,6 @@ export * from './types/schema.js';
|
|
|
27
28
|
export * from './types/shell-adapter.js';
|
|
28
29
|
export * from './types/steering.js';
|
|
29
30
|
export * from './types/step.js';
|
|
30
|
-
export * from './types/sub-harness.js';
|
|
31
31
|
export * from './types/subprocess-adapter.js';
|
|
32
32
|
export * from './types/tool.js';
|
|
33
33
|
export * from './types/tool-context.js';
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
* Zod schemas for JSON-serialisable workflow definitions.
|
|
3
3
|
*
|
|
4
4
|
* A `WorkflowDocument` is a portable, JSON-safe representation of a noetic
|
|
5
|
-
* step tree. It covers every step kind. The `
|
|
6
|
-
* code STRING (not an in-process closure) dispatched through a subprocess
|
|
5
|
+
* step tree. It covers every step kind. The `runCode` node carries its body as
|
|
6
|
+
* a code STRING (not an in-process closure) dispatched through a subprocess
|
|
7
7
|
* adapter, keeping the document JSON-safe. The hydrator in
|
|
8
8
|
* `@noetic-tools/core` (`builders/workflow-hydrator.ts`) converts a validated
|
|
9
9
|
* document back into live `Step` objects via the existing builders.
|
|
10
10
|
*/
|
|
11
11
|
import { z } from 'zod';
|
|
12
|
-
import type { SubHarnessKind } from '../types/sub-harness.js';
|
|
13
12
|
interface UntilAnyPredicate {
|
|
14
13
|
kind: 'any';
|
|
15
14
|
predicates: UntilPredicate[];
|
|
@@ -27,9 +26,11 @@ export type UntilPredicate = {
|
|
|
27
26
|
usd: number;
|
|
28
27
|
} | {
|
|
29
28
|
kind: 'maxDuration';
|
|
30
|
-
|
|
29
|
+
duration: number;
|
|
31
30
|
} | {
|
|
32
31
|
kind: 'noToolCalls';
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'never';
|
|
33
34
|
} | {
|
|
34
35
|
kind: 'outputContains';
|
|
35
36
|
marker: string;
|
|
@@ -48,9 +49,9 @@ export declare const MergeStrategy: {
|
|
|
48
49
|
readonly First: 'first';
|
|
49
50
|
readonly Concat: 'concat';
|
|
50
51
|
};
|
|
51
|
-
/** @public Named merge strategy for
|
|
52
|
+
/** @public Named merge strategy for inParallel nodes. */
|
|
52
53
|
export type MergeStrategy = (typeof MergeStrategy)[keyof typeof MergeStrategy];
|
|
53
|
-
/** @public Zod schema for the named merge strategy used by `
|
|
54
|
+
/** @public Zod schema for the named merge strategy used by `inParallel` nodes. */
|
|
54
55
|
export declare const MergeStrategySchema: z.ZodEnum<{
|
|
55
56
|
concat: "concat";
|
|
56
57
|
first: "first";
|
|
@@ -63,7 +64,7 @@ declare const ModelParamsSchema: z.ZodObject<{
|
|
|
63
64
|
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
64
65
|
}, z.core.$strip>;
|
|
65
66
|
/**
|
|
66
|
-
* A uniform tool entry on
|
|
67
|
+
* A uniform tool entry on a `callModel` node. Every entry is an object keyed by
|
|
67
68
|
* `type`:
|
|
68
69
|
* - A CLIENT tool is `{ type: "<registered-tool-name>" }`. The hydrator
|
|
69
70
|
* resolves `type` against the tool registry; `parameters` (if present) is
|
|
@@ -76,11 +77,11 @@ declare const ModelParamsSchema: z.ZodObject<{
|
|
|
76
77
|
* Server vs client is decided by the `type` value (a reserved `openrouter:*`
|
|
77
78
|
* server-tool literal vs an arbitrary tool name), not by the entry's shape.
|
|
78
79
|
*/
|
|
79
|
-
declare const
|
|
80
|
+
declare const CallModelToolEntrySchema: z.ZodObject<{
|
|
80
81
|
type: z.ZodString;
|
|
81
82
|
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
82
83
|
}, z.core.$strip>;
|
|
83
|
-
/** Retry policy for a `
|
|
84
|
+
/** Retry policy for a `runCode` node, mirroring `RetryPolicy` in `@noetic-tools/types`. */
|
|
84
85
|
declare const RetryPolicySchema: z.ZodObject<{
|
|
85
86
|
maxAttempts: z.ZodNumber;
|
|
86
87
|
backoff: z.ZodEnum<{
|
|
@@ -91,34 +92,92 @@ declare const RetryPolicySchema: z.ZodObject<{
|
|
|
91
92
|
initialDelay: z.ZodNumber;
|
|
92
93
|
maxDelay: z.ZodOptional<z.ZodNumber>;
|
|
93
94
|
}, z.core.$strip>;
|
|
94
|
-
declare const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
default: "default";
|
|
100
|
-
plan: "plan";
|
|
95
|
+
declare const AcpPermissionPolicySchema: z.ZodObject<{
|
|
96
|
+
default: z.ZodOptional<z.ZodEnum<{
|
|
97
|
+
allow: "allow";
|
|
98
|
+
cancel: "cancel";
|
|
99
|
+
deny: "deny";
|
|
101
100
|
}>>;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
102
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
103
|
+
delete: "delete";
|
|
104
|
+
edit: "edit";
|
|
105
|
+
execute: "execute";
|
|
106
|
+
fetch: "fetch";
|
|
107
|
+
move: "move";
|
|
108
|
+
other: "other";
|
|
109
|
+
read: "read";
|
|
110
|
+
search: "search";
|
|
111
|
+
switch_mode: "switch_mode";
|
|
112
|
+
think: "think";
|
|
113
|
+
}>>;
|
|
114
|
+
title: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.core.$strip>>>;
|
|
116
|
+
deny: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
117
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
118
|
+
delete: "delete";
|
|
119
|
+
edit: "edit";
|
|
120
|
+
execute: "execute";
|
|
121
|
+
fetch: "fetch";
|
|
122
|
+
move: "move";
|
|
123
|
+
other: "other";
|
|
124
|
+
read: "read";
|
|
125
|
+
search: "search";
|
|
126
|
+
switch_mode: "switch_mode";
|
|
127
|
+
think: "think";
|
|
128
|
+
}>>;
|
|
129
|
+
title: z.ZodOptional<z.ZodString>;
|
|
130
|
+
}, z.core.$strip>>>;
|
|
131
|
+
persist: z.ZodOptional<z.ZodBoolean>;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
declare const AcpClientCapabilityConfigSchema: z.ZodObject<{
|
|
134
|
+
readTextFile: z.ZodOptional<z.ZodBoolean>;
|
|
135
|
+
writeTextFile: z.ZodOptional<z.ZodBoolean>;
|
|
136
|
+
terminal: z.ZodOptional<z.ZodBoolean>;
|
|
105
137
|
}, z.core.$strip>;
|
|
106
|
-
|
|
138
|
+
/** ACP `McpServer`. Stdio is untagged and mandatory for every agent; http/sse are capability-gated. */
|
|
139
|
+
declare const AcpMcpServerSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
140
|
+
type: z.ZodLiteral<"http">;
|
|
141
|
+
name: z.ZodString;
|
|
142
|
+
url: z.ZodString;
|
|
143
|
+
headers: z.ZodArray<z.ZodObject<{
|
|
144
|
+
name: z.ZodString;
|
|
145
|
+
value: z.ZodString;
|
|
146
|
+
}, z.core.$strip>>;
|
|
147
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
148
|
+
type: z.ZodLiteral<"sse">;
|
|
149
|
+
name: z.ZodString;
|
|
150
|
+
url: z.ZodString;
|
|
151
|
+
headers: z.ZodArray<z.ZodObject<{
|
|
152
|
+
name: z.ZodString;
|
|
153
|
+
value: z.ZodString;
|
|
154
|
+
}, z.core.$strip>>;
|
|
155
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
156
|
+
name: z.ZodString;
|
|
157
|
+
command: z.ZodString;
|
|
158
|
+
args: z.ZodArray<z.ZodString>;
|
|
159
|
+
env: z.ZodArray<z.ZodObject<{
|
|
160
|
+
name: z.ZodString;
|
|
161
|
+
value: z.ZodString;
|
|
162
|
+
}, z.core.$strip>>;
|
|
163
|
+
}, z.core.$strip>]>;
|
|
164
|
+
declare const AcpSessionPolicySchema: z.ZodObject<{
|
|
107
165
|
reuse: z.ZodOptional<z.ZodString>;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
166
|
+
keepAlive: z.ZodOptional<z.ZodEnum<{
|
|
167
|
+
harness: "harness";
|
|
168
|
+
run: "run";
|
|
169
|
+
step: "step";
|
|
112
170
|
}>>;
|
|
171
|
+
load: z.ZodOptional<z.ZodString>;
|
|
113
172
|
}, z.core.$strip>;
|
|
114
173
|
interface WorkflowNodeBase {
|
|
115
174
|
id: string;
|
|
116
175
|
}
|
|
117
176
|
/**
|
|
118
|
-
* A reference to a streaming `OutputCodec` for
|
|
177
|
+
* A reference to a streaming `OutputCodec` for a `callModel` node's structured
|
|
119
178
|
* output. The hydrator resolves `library` from `HydrationContext.uiLibraries`
|
|
120
179
|
* to a live codec (e.g. `openUi(myLibrary)` from `@noetic-tools/openui`), the
|
|
121
|
-
* same registry-resolution pattern
|
|
180
|
+
* same registry-resolution pattern `acp-agent` nodes use for adapters. Kept a
|
|
122
181
|
* *reference* because a codec is a runtime object, not JSON-expressible.
|
|
123
182
|
*/
|
|
124
183
|
export interface OutputCodecRef {
|
|
@@ -127,8 +186,8 @@ export interface OutputCodecRef {
|
|
|
127
186
|
/** Registry key resolved from `HydrationContext.uiLibraries`. */
|
|
128
187
|
library: string;
|
|
129
188
|
}
|
|
130
|
-
export interface
|
|
131
|
-
kind: '
|
|
189
|
+
export interface CallModelWorkflowNode extends WorkflowNodeBase {
|
|
190
|
+
kind: 'callModel';
|
|
132
191
|
model?: string;
|
|
133
192
|
instructions: string;
|
|
134
193
|
/**
|
|
@@ -138,26 +197,27 @@ export interface LlmWorkflowNode extends WorkflowNodeBase {
|
|
|
138
197
|
* parameters?: {...} }` (executed by the provider). Client vs server is
|
|
139
198
|
* decided by the `type` value.
|
|
140
199
|
*/
|
|
141
|
-
tools?: z.infer<typeof
|
|
200
|
+
tools?: z.infer<typeof CallModelToolEntrySchema>[];
|
|
142
201
|
params?: z.infer<typeof ModelParamsSchema>;
|
|
143
202
|
/** Streaming output-codec reference, resolved from `HydrationContext.uiLibraries`. */
|
|
144
203
|
output?: OutputCodecRef;
|
|
145
204
|
}
|
|
146
|
-
export interface
|
|
147
|
-
kind: '
|
|
205
|
+
export interface InvokeToolWorkflowNode extends WorkflowNodeBase {
|
|
206
|
+
kind: 'invokeTool';
|
|
148
207
|
toolName: string;
|
|
149
208
|
args?: Record<string, unknown>;
|
|
150
209
|
}
|
|
151
210
|
/**
|
|
152
|
-
* A node that runs a serialised code body. Unlike the programmatic
|
|
153
|
-
* (which carries a closure), the JSON form carries `execute` as
|
|
211
|
+
* A node that runs a serialised code body. Unlike the programmatic
|
|
212
|
+
* `step.runCode` (which carries a closure), the JSON form carries `execute` as
|
|
213
|
+
* a code STRING.
|
|
154
214
|
* The code is never eval'd in-process (Cloudflare Workers forbid eval); it is
|
|
155
215
|
* dispatched through a subprocess adapter (`ctx.subprocess`, or a named adapter
|
|
156
216
|
* resolved by ref). Execution therefore requires a subprocess adapter capable
|
|
157
217
|
* of running the code and returning its stdout.
|
|
158
218
|
*/
|
|
159
|
-
export interface
|
|
160
|
-
kind: '
|
|
219
|
+
export interface RunCodeWorkflowNode extends WorkflowNodeBase {
|
|
220
|
+
kind: 'runCode';
|
|
161
221
|
/** Source code executed in the subprocess. Receives the step input on stdin. */
|
|
162
222
|
execute: string;
|
|
163
223
|
/** Optional retry policy applied to the step. */
|
|
@@ -165,17 +225,17 @@ export interface RunWorkflowNode extends WorkflowNodeBase {
|
|
|
165
225
|
/** Named subprocess adapter ref; defaults to `ctx.subprocess` when omitted. */
|
|
166
226
|
subprocess?: string;
|
|
167
227
|
}
|
|
168
|
-
export interface
|
|
228
|
+
export interface ConditionalRoute {
|
|
169
229
|
match: string;
|
|
170
230
|
target: WorkflowNode;
|
|
171
231
|
}
|
|
172
|
-
export interface
|
|
173
|
-
kind: '
|
|
174
|
-
routes:
|
|
232
|
+
export interface ConditionalWorkflowNode extends WorkflowNodeBase {
|
|
233
|
+
kind: 'conditional';
|
|
234
|
+
routes: ConditionalRoute[];
|
|
175
235
|
default?: WorkflowNode;
|
|
176
236
|
}
|
|
177
|
-
export interface
|
|
178
|
-
kind: '
|
|
237
|
+
export interface InParallelWorkflowNode extends WorkflowNodeBase {
|
|
238
|
+
kind: 'inParallel';
|
|
179
239
|
mode: 'race' | 'all' | 'settle';
|
|
180
240
|
/**
|
|
181
241
|
* Static fan-out: one child per entry. Mutually exclusive with `each` —
|
|
@@ -188,8 +248,8 @@ export interface ForkWorkflowNode extends WorkflowNodeBase {
|
|
|
188
248
|
*/
|
|
189
249
|
each?: WorkflowNode;
|
|
190
250
|
/**
|
|
191
|
-
* Selector key into the
|
|
192
|
-
* fan out over. When omitted, the input string itself is parsed as a JSON
|
|
251
|
+
* Selector key into the inParallel input (parsed as JSON) locating the array
|
|
252
|
+
* to fan out over. When omitted, the input string itself is parsed as a JSON
|
|
193
253
|
* array. Only meaningful with `each`.
|
|
194
254
|
*/
|
|
195
255
|
over?: string;
|
|
@@ -202,14 +262,14 @@ export interface SpawnWorkflowNode extends WorkflowNodeBase {
|
|
|
202
262
|
timeout?: number;
|
|
203
263
|
/**
|
|
204
264
|
* Memory layers the child runs with, by registered name (resolved from
|
|
205
|
-
* `HydrationContext.layers`, like `
|
|
206
|
-
* layers — the default spawn behaviour. Naming layers here REPLACES
|
|
207
|
-
* inherited set for the child, so list every layer the child needs.
|
|
265
|
+
* `HydrationContext.layers`, like `withContext`). Omit to inherit the
|
|
266
|
+
* parent's layers — the default spawn behaviour. Naming layers here REPLACES
|
|
267
|
+
* the inherited set for the child, so list every layer the child needs.
|
|
208
268
|
*/
|
|
209
269
|
layers?: string[];
|
|
210
270
|
}
|
|
211
|
-
export interface
|
|
212
|
-
kind: '
|
|
271
|
+
export interface WithContextWorkflowNode extends WorkflowNodeBase {
|
|
272
|
+
kind: 'withContext';
|
|
213
273
|
child: WorkflowNode;
|
|
214
274
|
layers: string[];
|
|
215
275
|
}
|
|
@@ -223,23 +283,33 @@ export interface SequenceWorkflowNode extends WorkflowNodeBase {
|
|
|
223
283
|
kind: 'sequence';
|
|
224
284
|
steps: WorkflowNode[];
|
|
225
285
|
}
|
|
226
|
-
export interface
|
|
227
|
-
kind: '
|
|
286
|
+
export interface ScheduleWorkflowNode extends WorkflowNodeBase {
|
|
287
|
+
kind: 'schedule';
|
|
228
288
|
step: WorkflowNode;
|
|
229
|
-
|
|
289
|
+
interval: number;
|
|
230
290
|
onError?: 'continue' | 'fail';
|
|
231
291
|
}
|
|
232
292
|
/**
|
|
233
|
-
* A node that delegates a turn to
|
|
234
|
-
*
|
|
235
|
-
*
|
|
293
|
+
* A node that delegates a turn to an external coding agent over the Agent
|
|
294
|
+
* Client Protocol. `agent` is a registry key resolved from
|
|
295
|
+
* `HydrationContext.acpAgents` — an OPEN set, so supporting a new agent never
|
|
296
|
+
* changes this schema.
|
|
236
297
|
*/
|
|
237
|
-
export interface
|
|
238
|
-
kind:
|
|
298
|
+
export interface AcpAgentWorkflowNode extends WorkflowNodeBase {
|
|
299
|
+
kind: 'acp-agent';
|
|
300
|
+
/** Registry key for the ACP agent adapter (e.g. `claude-code`). */
|
|
301
|
+
agent: string;
|
|
239
302
|
prompt: string;
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
303
|
+
/** Absolute working directory for the session. Defaults to the runtime cwd. */
|
|
304
|
+
cwd?: string;
|
|
305
|
+
/** Session mode to switch to before prompting. */
|
|
306
|
+
mode?: string;
|
|
307
|
+
/** Model to select before prompting. */
|
|
308
|
+
model?: string;
|
|
309
|
+
mcpServers?: z.infer<typeof AcpMcpServerSchema>[];
|
|
310
|
+
permissions?: z.infer<typeof AcpPermissionPolicySchema>;
|
|
311
|
+
clientCapabilities?: z.infer<typeof AcpClientCapabilityConfigSchema>;
|
|
312
|
+
session?: z.infer<typeof AcpSessionPolicySchema>;
|
|
243
313
|
}
|
|
244
314
|
/**
|
|
245
315
|
* A node that runs another workflow document as a sub-step. The document is
|
|
@@ -256,7 +326,7 @@ export interface SubflowWorkflowNode extends WorkflowNodeBase {
|
|
|
256
326
|
input?: string;
|
|
257
327
|
}
|
|
258
328
|
/** @public Discriminated union of all JSON-serialisable workflow node kinds. */
|
|
259
|
-
export type WorkflowNode =
|
|
329
|
+
export type WorkflowNode = CallModelWorkflowNode | InvokeToolWorkflowNode | RunCodeWorkflowNode | ConditionalWorkflowNode | InParallelWorkflowNode | SpawnWorkflowNode | WithContextWorkflowNode | LoopWorkflowNode | SequenceWorkflowNode | ScheduleWorkflowNode | SubflowWorkflowNode | AcpAgentWorkflowNode;
|
|
260
330
|
/** @public Zod schema validating a single `WorkflowNode` (any JSON-safe kind). */
|
|
261
331
|
export declare const WorkflowNodeSchema: z.ZodType<WorkflowNode>;
|
|
262
332
|
/** @public Top-level envelope for a JSON workflow definition. */
|
|
@@ -290,7 +360,7 @@ export interface WorkflowGraph {
|
|
|
290
360
|
export declare function workflowGraph(root: WorkflowNode): WorkflowGraph;
|
|
291
361
|
/**
|
|
292
362
|
* Returns the maximum depth of a workflow tree.
|
|
293
|
-
* Leaf nodes (`
|
|
363
|
+
* Leaf nodes (`callModel`, `invokeTool`) have depth 0. Structural nodes add +1.
|
|
294
364
|
* A `subflow` ref counts as a leaf — depth does not see through named refs.
|
|
295
365
|
*/
|
|
296
366
|
export declare function workflowDepth(node: WorkflowNode): number;
|