@noetic-tools/core 5.3.0 → 5.4.1
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 +8 -6
- package/dist/adapters/in-memory-subprocess/step-completion.js +1 -1
- package/dist/adapters/openrouter.d.ts +12 -1
- package/dist/adapters/openrouter.js +79 -5
- package/dist/builders/acp-agent-tool.d.ts +67 -0
- package/dist/builders/acp-agent-tool.js +87 -0
- package/dist/builders/control-flow-builders.d.ts +13 -13
- package/dist/builders/control-flow-builders.js +11 -11
- package/dist/{patterns → builders}/dynamic-workflow.d.ts +1 -1
- package/dist/{patterns → builders}/dynamic-workflow.js +20 -14
- package/dist/builders/every.d.ts +14 -14
- package/dist/builders/every.js +16 -16
- package/dist/builders/layer-provides-builders.d.ts +1 -1
- package/dist/builders/layer-provides-builders.js +1 -1
- package/dist/builders/provide-builder.d.ts +5 -12
- package/dist/builders/provide-builder.js +9 -10
- package/dist/builders/spawn-builder.d.ts +0 -2
- package/dist/builders/spawn-builder.js +2 -3
- package/dist/builders/step-builders.d.ts +103 -92
- package/dist/builders/step-builders.js +146 -163
- package/dist/builders/tool-builder.d.ts +18 -22
- package/dist/builders/tool-builder.js +6 -4
- package/dist/builders/workflow-hydrator.d.ts +11 -7
- package/dist/builders/workflow-hydrator.js +75 -87
- package/dist/builders/workflow-step.d.ts +15 -27
- package/dist/builders/workflow-step.js +14 -19
- package/dist/conditions/conditions.d.ts +2 -2
- package/dist/conditions/conditions.js +1 -1
- package/dist/harness/agent-harness.d.ts +89 -46
- package/dist/harness/agent-harness.js +93 -39
- package/dist/harness/deps/types.d.ts +1 -1
- package/dist/harness/model-call.d.ts +1 -1
- package/dist/harness/model-call.js +23 -18
- package/dist/index.d.ts +27 -35
- package/dist/index.js +13 -29
- package/dist/interpreter/acp-events.d.ts +67 -0
- package/dist/interpreter/acp-events.js +256 -0
- package/dist/interpreter/acp-history.d.ts +22 -0
- package/dist/interpreter/acp-history.js +58 -0
- package/dist/interpreter/action-types.d.ts +1 -1
- package/dist/interpreter/collect-tools.js +10 -13
- package/dist/interpreter/execute-acp-agent.d.ts +10 -0
- package/dist/interpreter/execute-acp-agent.js +505 -0
- package/dist/interpreter/execute-action.d.ts +5 -5
- package/dist/interpreter/execute-action.js +284 -218
- package/dist/interpreter/execute-control.d.ts +9 -9
- package/dist/interpreter/execute-control.js +27 -27
- package/dist/interpreter/execute.d.ts +1 -1
- package/dist/interpreter/execute.js +29 -35
- package/dist/interpreter/step-dispatcher.d.ts +1 -1
- package/dist/interpreter/step-dispatcher.js +3 -3
- package/dist/interpreter/structured-output.d.ts +14 -0
- package/dist/interpreter/structured-output.js +40 -0
- package/dist/interpreter/typeguards.d.ts +1 -1
- package/dist/interpreter/typeguards.js +1 -1
- package/dist/portable/builders.d.ts +5 -3
- package/dist/portable/builders.js +8 -5
- package/dist/portable/context-layers.d.ts +1 -1
- package/dist/portable/context-layers.js +1 -1
- package/dist/runtime/acp-session-store.d.ts +75 -0
- package/dist/runtime/acp-session-store.js +0 -0
- package/dist/runtime/broadcaster-utils.d.ts +1 -1
- package/dist/runtime/broadcaster-utils.js +1 -1
- package/dist/runtime/context-impl.d.ts +8 -10
- package/dist/runtime/context-impl.js +8 -12
- package/dist/runtime/durable/step-ledger.d.ts +2 -2
- package/dist/runtime/durable/step-ledger.js +3 -3
- package/dist/runtime/session-runner.d.ts +12 -1
- package/dist/runtime/session-runner.js +33 -1
- package/dist/runtime/tool-context.js +0 -2
- package/dist/schemas/workflow.d.ts +3 -3
- package/dist/schemas/workflow.js +2 -2
- package/dist/types/checkpoint.d.ts +11 -2
- package/dist/types/checkpoint.js +10 -1
- package/dist/{runtime → util}/detached-handle.js +1 -1
- package/package.json +6 -4
- package/schema/noetic-workflow.schema.json +239 -260
- package/dist/builders/context-option.d.ts +0 -23
- package/dist/builders/context-option.js +0 -22
- package/dist/deprecated.d.ts +0 -30
- package/dist/deprecated.js +0 -28
- package/dist/interpreter/execute-sub-harness.d.ts +0 -8
- package/dist/interpreter/execute-sub-harness.js +0 -241
- package/dist/interpreter/sub-harness-events.d.ts +0 -48
- package/dist/interpreter/sub-harness-events.js +0 -208
- package/dist/patterns/interview.d.ts +0 -53
- package/dist/patterns/interview.js +0 -113
- package/dist/patterns/plans.d.ts +0 -44
- package/dist/patterns/plans.js +0 -125
- package/dist/patterns/ralph-wiggum.d.ts +0 -19
- package/dist/patterns/ralph-wiggum.js +0 -37
- package/dist/patterns/react.d.ts +0 -19
- package/dist/patterns/react.js +0 -41
- /package/dist/{runtime → util}/detached-handle.d.ts +0 -0
package/dist/builders/every.d.ts
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import type { ContextData } from '@noetic-tools/context';
|
|
2
|
-
import type { Channel,
|
|
2
|
+
import type { Channel, ScheduleErrorPolicy, Step, StepSchedule } from '@noetic-tools/types';
|
|
3
3
|
/**
|
|
4
|
-
* Configuration options accepted by the `
|
|
5
|
-
* discriminant. `
|
|
4
|
+
* Configuration options accepted by the `schedule()` builder, excluding the `kind`
|
|
5
|
+
* discriminant. `schedule()` schedules a body step on a fixed-interval, optionally
|
|
6
6
|
* woken early by a channel, and runs until the executing context is cancelled.
|
|
7
7
|
*
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
|
-
export interface
|
|
10
|
+
export interface ScheduleOptions<TContext = ContextData, I = unknown, O = unknown> {
|
|
11
11
|
/** Unique step identifier used in traces and error messages. */
|
|
12
12
|
id: string;
|
|
13
13
|
/** Body step executed on each iteration. */
|
|
14
14
|
step: Step<TContext, I, O>;
|
|
15
15
|
/** Park duration between iterations in milliseconds. Must be >= 0. */
|
|
16
|
-
|
|
16
|
+
interval: number;
|
|
17
17
|
/** Optional channel that wakes the parking interval when any value arrives. */
|
|
18
|
-
|
|
18
|
+
inbox?: Channel<unknown>;
|
|
19
19
|
/** Behavior when `step` throws. Defaults to `'continue'`. */
|
|
20
|
-
onError?:
|
|
20
|
+
onError?: ScheduleErrorPolicy;
|
|
21
21
|
/** Random jitter applied to the park duration in milliseconds. Must be >= 0. Default 0. */
|
|
22
22
|
jitter?: number;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* Creates
|
|
25
|
+
* Creates a `schedule` step that runs a body step on a fixed-interval schedule.
|
|
26
26
|
*
|
|
27
27
|
* The operator runs forever until the executing context is cancelled. After each
|
|
28
|
-
* iteration it parks for `
|
|
28
|
+
* iteration it parks for `interval ± jitter` milliseconds (or until `inbox` receives
|
|
29
29
|
* a message, whichever comes first).
|
|
30
30
|
*
|
|
31
31
|
* @public
|
|
32
32
|
* @param opts.id - Unique step identifier used in traces and error messages.
|
|
33
33
|
* @param opts.step - Body step executed on each iteration.
|
|
34
|
-
* @param opts.
|
|
35
|
-
* @param opts.
|
|
34
|
+
* @param opts.interval - Park duration between iterations in milliseconds.
|
|
35
|
+
* @param opts.inbox - Optional channel that wakes the parking interval when any value arrives.
|
|
36
36
|
* @param opts.onError - Error policy. `'continue'` (default) records a span event and continues; `'fail'` re-throws.
|
|
37
37
|
* @param opts.jitter - Random jitter in ms applied to the park duration. Default 0.
|
|
38
|
-
* @returns A `
|
|
38
|
+
* @returns A `StepSchedule` step.
|
|
39
39
|
* @throws `NoeticConfigError` with code `EMPTY_STEP_ID` if `id` is empty.
|
|
40
40
|
* @throws `NoeticConfigError` with code `MISSING_BODY_STEP` if `step` is not provided.
|
|
41
|
-
* @throws `NoeticConfigError` with code `INVALID_INTERVAL_MS` if `
|
|
41
|
+
* @throws `NoeticConfigError` with code `INVALID_INTERVAL_MS` if `interval` is negative or not finite.
|
|
42
42
|
* @throws `NoeticConfigError` with code `INVALID_JITTER` if `jitter` is negative or not finite.
|
|
43
43
|
*/
|
|
44
|
-
export declare function
|
|
44
|
+
export declare function schedule<TContext = ContextData, I = unknown, O = unknown>(opts: ScheduleOptions<TContext, I, O>): StepSchedule<TContext, I, O>;
|
package/dist/builders/every.js
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
1
|
import { NoeticConfigError } from '@noetic-tools/types';
|
|
2
2
|
import { getDefaultRegistrar } from '../types/step-registrar.js';
|
|
3
3
|
/**
|
|
4
|
-
* Creates
|
|
4
|
+
* Creates a `schedule` step that runs a body step on a fixed-interval schedule.
|
|
5
5
|
*
|
|
6
6
|
* The operator runs forever until the executing context is cancelled. After each
|
|
7
|
-
* iteration it parks for `
|
|
7
|
+
* iteration it parks for `interval ± jitter` milliseconds (or until `inbox` receives
|
|
8
8
|
* a message, whichever comes first).
|
|
9
9
|
*
|
|
10
10
|
* @public
|
|
11
11
|
* @param opts.id - Unique step identifier used in traces and error messages.
|
|
12
12
|
* @param opts.step - Body step executed on each iteration.
|
|
13
|
-
* @param opts.
|
|
14
|
-
* @param opts.
|
|
13
|
+
* @param opts.interval - Park duration between iterations in milliseconds.
|
|
14
|
+
* @param opts.inbox - Optional channel that wakes the parking interval when any value arrives.
|
|
15
15
|
* @param opts.onError - Error policy. `'continue'` (default) records a span event and continues; `'fail'` re-throws.
|
|
16
16
|
* @param opts.jitter - Random jitter in ms applied to the park duration. Default 0.
|
|
17
|
-
* @returns A `
|
|
17
|
+
* @returns A `StepSchedule` step.
|
|
18
18
|
* @throws `NoeticConfigError` with code `EMPTY_STEP_ID` if `id` is empty.
|
|
19
19
|
* @throws `NoeticConfigError` with code `MISSING_BODY_STEP` if `step` is not provided.
|
|
20
|
-
* @throws `NoeticConfigError` with code `INVALID_INTERVAL_MS` if `
|
|
20
|
+
* @throws `NoeticConfigError` with code `INVALID_INTERVAL_MS` if `interval` is negative or not finite.
|
|
21
21
|
* @throws `NoeticConfigError` with code `INVALID_JITTER` if `jitter` is negative or not finite.
|
|
22
22
|
*/
|
|
23
|
-
export function
|
|
23
|
+
export function schedule(opts) {
|
|
24
24
|
if (!opts.id || opts.id.trim() === '') {
|
|
25
25
|
throw new NoeticConfigError({
|
|
26
26
|
code: 'EMPTY_STEP_ID',
|
|
27
|
-
message: '
|
|
28
|
-
hint: 'Pass a unique string as the id field, e.g.
|
|
27
|
+
message: 'schedule() requires a non-empty id.',
|
|
28
|
+
hint: 'Pass a unique string as the id field, e.g. schedule({ id: "my-schedule", ... }).',
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
if (!opts.step) {
|
|
32
32
|
throw new NoeticConfigError({
|
|
33
33
|
code: 'MISSING_BODY_STEP',
|
|
34
|
-
message: '
|
|
34
|
+
message: 'schedule() requires a body step.',
|
|
35
35
|
hint: 'Provide the step to execute on each scheduled iteration.',
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
if (!Number.isFinite(opts.
|
|
38
|
+
if (!Number.isFinite(opts.interval) || opts.interval < 0) {
|
|
39
39
|
throw new NoeticConfigError({
|
|
40
40
|
code: 'INVALID_INTERVAL_MS',
|
|
41
|
-
message: `
|
|
41
|
+
message: `schedule() requires a non-negative finite interval, got ${opts.interval}.`,
|
|
42
42
|
hint: 'Pass a non-negative number of milliseconds for the park interval.',
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
if (opts.jitter !== undefined && (!Number.isFinite(opts.jitter) || opts.jitter < 0)) {
|
|
46
46
|
throw new NoeticConfigError({
|
|
47
47
|
code: 'INVALID_JITTER',
|
|
48
|
-
message: `
|
|
48
|
+
message: `schedule() requires a non-negative finite jitter, got ${opts.jitter}.`,
|
|
49
49
|
hint: 'Pass a non-negative number of milliseconds for jitter, or omit it.',
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
const built = {
|
|
53
|
-
kind: '
|
|
53
|
+
kind: 'schedule',
|
|
54
54
|
id: opts.id,
|
|
55
55
|
step: opts.step,
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
interval: opts.interval,
|
|
57
|
+
inbox: opts.inbox,
|
|
58
58
|
onError: opts.onError ?? 'continue',
|
|
59
59
|
jitter: opts.jitter ?? 0,
|
|
60
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { layerData,
|
|
1
|
+
export { layerData, layerFunction } from '@noetic-tools/context';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { layerData,
|
|
1
|
+
export { layerData, layerFunction } from '@noetic-tools/context';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ContextConfig, ContextData, ContextLayer } from '@noetic-tools/context';
|
|
2
|
-
import type { Step,
|
|
2
|
+
import type { Step, StepWithContext } from '@noetic-tools/types';
|
|
3
3
|
/**
|
|
4
4
|
* Creates a provide step that attaches context layers to its child without creating an isolated context.
|
|
5
5
|
* Like React's Context.Provider — layers are available to all descendant steps.
|
|
@@ -9,19 +9,12 @@ import type { Step, StepProvide } from '@noetic-tools/types';
|
|
|
9
9
|
* @param opts.id - Unique step identifier used in traces and error messages.
|
|
10
10
|
* @param opts.child - Step to execute with the provided layers.
|
|
11
11
|
* @param opts.context - Context layers to provide to descendant steps.
|
|
12
|
-
* @returns A `
|
|
12
|
+
* @returns A `StepWithContext` step.
|
|
13
13
|
* @throws `NoeticConfigError` with code `EMPTY_STEP_ID` if `id` is empty.
|
|
14
14
|
* @throws `NoeticConfigError` with code `MISSING_CHILD_STEP` if `child` is not provided.
|
|
15
15
|
*/
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function withContext<TContext = ContextData, I = unknown, O = unknown>(opts: {
|
|
17
17
|
id: string;
|
|
18
18
|
child: Step<TContext, I, O>;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* valid way to supply the layers. Exactly one of the two is required — the
|
|
22
|
-
* runtime enforces it, the same way `id` and `child` are enforced.
|
|
23
|
-
*/
|
|
24
|
-
context?: ContextConfig | ContextLayer[];
|
|
25
|
-
/** @deprecated Renamed to `context`. */
|
|
26
|
-
memory?: ContextConfig | ContextLayer[];
|
|
27
|
-
}): StepProvide<TContext, I, O>;
|
|
19
|
+
context: ContextConfig | ContextLayer[];
|
|
20
|
+
}): StepWithContext<TContext, I, O>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NoeticConfigError } from '@noetic-tools/types';
|
|
2
2
|
import { getDefaultRegistrar } from '../types/step-registrar.js';
|
|
3
|
-
import { resolveContextOption } from './context-option.js';
|
|
4
3
|
/**
|
|
5
4
|
* Creates a provide step that attaches context layers to its child without creating an isolated context.
|
|
6
5
|
* Like React's Context.Provider — layers are available to all descendant steps.
|
|
@@ -10,35 +9,35 @@ import { resolveContextOption } from './context-option.js';
|
|
|
10
9
|
* @param opts.id - Unique step identifier used in traces and error messages.
|
|
11
10
|
* @param opts.child - Step to execute with the provided layers.
|
|
12
11
|
* @param opts.context - Context layers to provide to descendant steps.
|
|
13
|
-
* @returns A `
|
|
12
|
+
* @returns A `StepWithContext` step.
|
|
14
13
|
* @throws `NoeticConfigError` with code `EMPTY_STEP_ID` if `id` is empty.
|
|
15
14
|
* @throws `NoeticConfigError` with code `MISSING_CHILD_STEP` if `child` is not provided.
|
|
16
15
|
*/
|
|
17
|
-
export function
|
|
16
|
+
export function withContext(opts) {
|
|
18
17
|
if (!opts.id?.trim()) {
|
|
19
18
|
throw new NoeticConfigError({
|
|
20
19
|
code: 'EMPTY_STEP_ID',
|
|
21
|
-
message: '
|
|
22
|
-
hint: 'Pass a unique string as the id field, e.g.
|
|
20
|
+
message: 'withContext() requires a non-empty id.',
|
|
21
|
+
hint: 'Pass a unique string as the id field, e.g. withContext({ id: "my-provider", ... }).',
|
|
23
22
|
});
|
|
24
23
|
}
|
|
25
24
|
if (!opts.child) {
|
|
26
25
|
throw new NoeticConfigError({
|
|
27
26
|
code: 'MISSING_CHILD_STEP',
|
|
28
|
-
message: '
|
|
27
|
+
message: 'withContext() requires a child step.',
|
|
29
28
|
hint: 'Provide a child step to execute with the provided context layers.',
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
|
-
const layers =
|
|
31
|
+
const layers = opts.context;
|
|
33
32
|
if (!layers) {
|
|
34
33
|
throw new NoeticConfigError({
|
|
35
34
|
code: 'MISSING_CONTEXT_LAYERS',
|
|
36
|
-
message: '
|
|
37
|
-
hint: 'Pass context: [
|
|
35
|
+
message: 'withContext() requires context layers.',
|
|
36
|
+
hint: 'Pass context: [scratchpad()].',
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
39
|
const built = {
|
|
41
|
-
kind: '
|
|
40
|
+
kind: 'withContext',
|
|
42
41
|
id: opts.id,
|
|
43
42
|
child: opts.child,
|
|
44
43
|
context: layers,
|
|
@@ -4,8 +4,6 @@ interface SpawnOpts<TContext, I, O> {
|
|
|
4
4
|
id: string;
|
|
5
5
|
child: Step<TContext, I, O>;
|
|
6
6
|
context?: ContextConfig | ContextLayer[];
|
|
7
|
-
/** @deprecated Renamed to `context`. */
|
|
8
|
-
memory?: ContextConfig | ContextLayer[];
|
|
9
7
|
timeout?: number;
|
|
10
8
|
/**
|
|
11
9
|
* Optional per-step subprocess adapter override. The interpreter routes
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NoeticConfigError } from '@noetic-tools/types';
|
|
2
2
|
import { getDefaultRegistrar } from '../types/step-registrar.js';
|
|
3
|
-
import { resolveContextOption } from './context-option.js';
|
|
4
3
|
//#endregion
|
|
5
4
|
//#region Public API
|
|
6
5
|
/**
|
|
@@ -38,12 +37,12 @@ export function spawn(opts) {
|
|
|
38
37
|
kind: 'spawn',
|
|
39
38
|
id: opts.id,
|
|
40
39
|
child: opts.child,
|
|
41
|
-
context:
|
|
40
|
+
context: opts.context,
|
|
42
41
|
timeout: opts.timeout,
|
|
43
42
|
subprocess: opts.subprocess,
|
|
44
43
|
};
|
|
45
44
|
getDefaultRegistrar().register(built);
|
|
46
|
-
// Ensure the child is addressable by id — builders for `
|
|
45
|
+
// Ensure the child is addressable by id — builders for `runCode`/`callModel`/`invokeTool`
|
|
47
46
|
// self-register, but a caller can construct a step literal and pass it as
|
|
48
47
|
// `child` without going through a builder.
|
|
49
48
|
getDefaultRegistrar().register(opts.child);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ContextData } from '@noetic-tools/context';
|
|
2
|
-
import type { Context, Lazy, ModelParams, OutputCodec, RetryPolicy, ServerToolSpec,
|
|
3
|
-
|
|
4
|
-
export interface StepRunOpts<TContext, I, O> {
|
|
2
|
+
import type { AcpAgent, AcpClientCapabilityConfig, AcpContentBlock, AcpMcpServer, AcpPermissionHandler, AcpPermissionPolicy, AcpSessionPolicy, Context, Lazy, ModelParams, OutputCodec, RetryPolicy, ServerToolSpec, StandardSchemaV1, StepAcpAgent, StepCallModel, StepInvokeTool, StepRunCode, SubprocessAdapter, Tool } from '@noetic-tools/types';
|
|
3
|
+
export interface RunCodeOpts<TContext, I, O> {
|
|
5
4
|
id: string;
|
|
6
5
|
execute: (input: I, ctx: Context<TContext>) => Promise<O>;
|
|
7
6
|
retry?: RetryPolicy;
|
|
@@ -12,7 +11,7 @@ export interface StepRunOpts<TContext, I, O> {
|
|
|
12
11
|
*/
|
|
13
12
|
subprocess?: SubprocessAdapter;
|
|
14
13
|
}
|
|
15
|
-
export interface
|
|
14
|
+
export interface CallModelOpts<TContext, O> {
|
|
16
15
|
id: string;
|
|
17
16
|
/** Model id. Eager string or `(ctx) => string` getter (resolved at step execution). */
|
|
18
17
|
model: Lazy<string, TContext>;
|
|
@@ -24,110 +23,122 @@ export interface StepLLMOpts<TContext, O> {
|
|
|
24
23
|
* server tool the provider executes, e.g. web search/fetch).
|
|
25
24
|
*/
|
|
26
25
|
tools?: Lazy<(Tool | ServerToolSpec)[] | undefined, TContext>;
|
|
27
|
-
/** Structured output: a Zod
|
|
28
|
-
output?:
|
|
26
|
+
/** Structured output: a Standard Schema (Zod, Valibot, …) or a streaming `OutputCodec` (e.g. OpenUI Lang). */
|
|
27
|
+
output?: StandardSchemaV1<unknown, O> | OutputCodec<O>;
|
|
28
|
+
/**
|
|
29
|
+
* Explicit raw JSON Schema override sent to the model. For non-Zod schemas,
|
|
30
|
+
* it takes precedence over StandardJSONSchemaV1 conversion.
|
|
31
|
+
*/
|
|
32
|
+
outputJsonSchema?: Record<string, unknown>;
|
|
29
33
|
params?: ModelParams;
|
|
30
34
|
emit?: boolean | ((eventType: string, data: Record<string, unknown>) => boolean);
|
|
31
35
|
}
|
|
32
|
-
export interface
|
|
36
|
+
export interface InvokeToolOpts<I, O> {
|
|
33
37
|
id: string;
|
|
34
|
-
tool: Tool<
|
|
38
|
+
tool: Tool<StandardSchemaV1<unknown, I>, StandardSchemaV1<unknown, O>>;
|
|
35
39
|
args?: Partial<I>;
|
|
36
40
|
}
|
|
37
|
-
export interface
|
|
41
|
+
export interface StepAcpAgentOpts<TContext, O> {
|
|
38
42
|
id: string;
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
/** Turn prompt. Eager string or `(ctx) => string` getter. */
|
|
42
|
-
prompt
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
/** An ACP agent adapter, e.g. `claudeCode()` from `@noetic-tools/acp`. Eager or `(ctx) => AcpAgent`. */
|
|
44
|
+
agent: Lazy<AcpAgent, TContext>;
|
|
45
|
+
/** Turn prompt as plain text. Eager string or `(ctx) => string` getter. */
|
|
46
|
+
prompt?: Lazy<string, TContext>;
|
|
47
|
+
/**
|
|
48
|
+
* Full ACP prompt content — images, audio, resource links, embedded context.
|
|
49
|
+
* Appended after `prompt`. Rejected before the turn is sent when the agent
|
|
50
|
+
* did not advertise the matching prompt capability.
|
|
51
|
+
*/
|
|
52
|
+
content?: Lazy<ReadonlyArray<AcpContentBlock> | undefined, TContext>;
|
|
53
|
+
/** MCP servers to expose to the agent for this session. */
|
|
54
|
+
mcpServers?: Lazy<ReadonlyArray<AcpMcpServer> | undefined, TContext>;
|
|
55
|
+
/** Working directory for the session. Defaults to `ctx.cwdState.cwd`. */
|
|
56
|
+
cwd?: Lazy<string | undefined, TContext>;
|
|
57
|
+
/** Session mode to switch to before prompting (e.g. `'plan'`). */
|
|
58
|
+
mode?: Lazy<string | undefined, TContext>;
|
|
59
|
+
/** Model to select before prompting, for agents that expose model selection. */
|
|
60
|
+
model?: Lazy<string | undefined, TContext>;
|
|
61
|
+
/** Declarative answer to the agent's permission requests. Defaults to denying. */
|
|
62
|
+
permissions?: AcpPermissionPolicy;
|
|
63
|
+
/** Async resolver consulted when the policy and steering both abstain. */
|
|
64
|
+
onPermissionRequest?: AcpPermissionHandler;
|
|
65
|
+
/** Which client capabilities to advertise to the agent. */
|
|
66
|
+
clientCapabilities?: AcpClientCapabilityConfig;
|
|
67
|
+
/** Optional Standard Schema; when set the assistant text is JSON-parsed and validated. */
|
|
68
|
+
output?: StandardSchemaV1<unknown, O>;
|
|
49
69
|
/** Session reuse + teardown policy across steps. */
|
|
50
|
-
session?:
|
|
70
|
+
session?: AcpSessionPolicy;
|
|
51
71
|
emit?: boolean | ((eventType: string, data: Record<string, unknown>) => boolean);
|
|
52
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Creates a pure async computation step.
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
* @param opts.id - Unique step identifier used in traces and error messages.
|
|
78
|
+
* @param opts.execute - Async function `(input, ctx) => output` that performs the work.
|
|
79
|
+
* @param opts.retry - Optional retry policy controlling attempts, backoff, and delay.
|
|
80
|
+
* @param opts.subprocess - Optional per-step subprocess adapter override.
|
|
81
|
+
* @returns A `StepRunCode` that can be composed into larger pipelines. The step
|
|
82
|
+
* is auto-registered in the shared step registry so the subprocess
|
|
83
|
+
* adapter can dispatch it by id.
|
|
84
|
+
* @throws `NoeticConfigError` with code `EMPTY_STEP_ID` if `id` is empty.
|
|
85
|
+
* @throws `NoeticConfigError` with code `MISSING_EXECUTE_FUNCTION` if `execute` is not provided.
|
|
86
|
+
* @throws `NoeticConfigError` with code `DUPLICATE_STEP_ID` if another step with the same id is already registered with a different body.
|
|
87
|
+
*/
|
|
88
|
+
export declare function runCode<TContext = ContextData, I = unknown, O = unknown>(opts: RunCodeOpts<TContext, I, O>): StepRunCode<TContext, I, O>;
|
|
89
|
+
/**
|
|
90
|
+
* Creates a model call step with optional tools and structured output.
|
|
91
|
+
*
|
|
92
|
+
* @public
|
|
93
|
+
* @param opts.id - Unique step identifier used in traces and error messages.
|
|
94
|
+
* @param opts.model - Model identifier, eager string or `(ctx) => string` getter (resolved at step execution time).
|
|
95
|
+
* @param opts.instructions - Optional system prompt; eager string or `(ctx) => string | undefined` getter.
|
|
96
|
+
* @param opts.tools - Optional tools; eager array or `(ctx) => Tool[] | undefined` getter.
|
|
97
|
+
* @param opts.output - Optional Zod schema enabling structured output parsing.
|
|
98
|
+
* @param opts.params - Optional model parameters (temperature, topP, maxTokens, stopSequences).
|
|
99
|
+
* @returns A `StepCallModel` that can be composed into larger pipelines. The step
|
|
100
|
+
* is auto-registered in the shared step registry.
|
|
101
|
+
* @throws `NoeticConfigError` with code `EMPTY_STEP_ID` if `id` is empty.
|
|
102
|
+
* @throws `NoeticConfigError` with code `MISSING_MODEL` if an eager `model` string is empty. Function-form models are validated at step execution.
|
|
103
|
+
*/
|
|
104
|
+
export declare function callModel<TContext = ContextData, I = unknown, O = unknown>(opts: CallModelOpts<TContext, O>): StepCallModel<TContext, I, O>;
|
|
105
|
+
/**
|
|
106
|
+
* Creates a tool execution step that invokes a typed tool definition.
|
|
107
|
+
*
|
|
108
|
+
* @public
|
|
109
|
+
* @param opts.id - Unique step identifier used in traces and error messages.
|
|
110
|
+
* @param opts.tool - The tool definition with typed input/output schemas.
|
|
111
|
+
* @param opts.args - Optional partial args that override or supplement model-provided arguments.
|
|
112
|
+
* @returns A `StepInvokeTool` that can be composed into larger pipelines. The step
|
|
113
|
+
* is auto-registered in the shared step registry.
|
|
114
|
+
* @throws `NoeticConfigError` with code `EMPTY_STEP_ID` if `id` is empty.
|
|
115
|
+
* @throws `NoeticConfigError` with code `MISSING_TOOL` if `tool` is not provided.
|
|
116
|
+
*/
|
|
117
|
+
export declare function invokeTool<TContext = ContextData, I = unknown, O = unknown>(opts: InvokeToolOpts<I, O>): StepInvokeTool<TContext, I, O>;
|
|
118
|
+
/**
|
|
119
|
+
* The ACP step builder namespace. Unlike the flattened base builders
|
|
120
|
+
* (`runCode`, `callModel`, `invokeTool`), the coding-agent builder stays
|
|
121
|
+
* grouped under `step`.
|
|
122
|
+
*
|
|
123
|
+
* @public
|
|
124
|
+
*/
|
|
53
125
|
export declare const step: {
|
|
54
126
|
/**
|
|
55
|
-
* Creates a
|
|
127
|
+
* Creates a step that delegates a turn to an external coding agent over the
|
|
128
|
+
* Agent Client Protocol.
|
|
56
129
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* @param opts.retry - Optional retry policy controlling attempts, backoff, and delay.
|
|
61
|
-
* @param opts.subprocess - Optional per-step subprocess adapter override.
|
|
62
|
-
* @returns A `StepRun` that can be composed into larger pipelines. The step
|
|
63
|
-
* is auto-registered in the shared step registry so the subprocess
|
|
64
|
-
* adapter can dispatch it by id.
|
|
65
|
-
* @throws `NoeticConfigError` with code `EMPTY_STEP_ID` if `id` is empty.
|
|
66
|
-
* @throws `NoeticConfigError` with code `MISSING_EXECUTE_FUNCTION` if `execute` is not provided.
|
|
67
|
-
* @throws `NoeticConfigError` with code `DUPLICATE_STEP_ID` if another step with the same id is already registered with a different body.
|
|
68
|
-
*/
|
|
69
|
-
run<TContext = ContextData, I = unknown, O = unknown>(opts: StepRunOpts<TContext, I, O>): StepRun<TContext, I, O>;
|
|
70
|
-
/**
|
|
71
|
-
* Creates an LLM model call step with optional tools and structured output.
|
|
72
|
-
*
|
|
73
|
-
* @public
|
|
74
|
-
* @param opts.id - Unique step identifier used in traces and error messages.
|
|
75
|
-
* @param opts.model - Model identifier, eager string or `(ctx) => string` getter (resolved at step execution time).
|
|
76
|
-
* @param opts.instructions - Optional system prompt; eager string or `(ctx) => string | undefined` getter.
|
|
77
|
-
* @param opts.tools - Optional tools; eager array or `(ctx) => Tool[] | undefined` getter.
|
|
78
|
-
* @param opts.output - Optional Zod schema enabling structured output parsing.
|
|
79
|
-
* @param opts.params - Optional model parameters (temperature, topP, maxTokens, stopSequences).
|
|
80
|
-
* @returns A `StepLLM` that can be composed into larger pipelines. The step
|
|
81
|
-
* is auto-registered in the shared step registry.
|
|
82
|
-
* @throws `NoeticConfigError` with code `EMPTY_STEP_ID` if `id` is empty.
|
|
83
|
-
* @throws `NoeticConfigError` with code `MISSING_MODEL` if an eager `model` string is empty. Function-form models are validated at step execution.
|
|
84
|
-
*/
|
|
85
|
-
llm<TContext = ContextData, I = unknown, O = unknown>(opts: StepLLMOpts<TContext, O>): StepLLM<TContext, I, O>;
|
|
86
|
-
/**
|
|
87
|
-
* Creates a tool execution step that invokes a typed tool definition.
|
|
88
|
-
*
|
|
89
|
-
* @public
|
|
90
|
-
* @param opts.id - Unique step identifier used in traces and error messages.
|
|
91
|
-
* @param opts.tool - The tool definition with typed input/output schemas.
|
|
92
|
-
* @param opts.args - Optional partial args that override or supplement LLM-provided arguments.
|
|
93
|
-
* @returns A `StepTool` that can be composed into larger pipelines. The step
|
|
94
|
-
* is auto-registered in the shared step registry.
|
|
95
|
-
* @throws `NoeticConfigError` with code `EMPTY_STEP_ID` if `id` is empty.
|
|
96
|
-
* @throws `NoeticConfigError` with code `MISSING_TOOL` if `tool` is not provided.
|
|
97
|
-
*/
|
|
98
|
-
tool<TContext = ContextData, I = unknown, O = unknown>(opts: StepToolOpts<I, O>): StepTool<TContext, I, O>;
|
|
99
|
-
/**
|
|
100
|
-
* Creates a step that delegates a turn to the Claude Code harness.
|
|
130
|
+
* One builder covers every ACP-speaking agent: the agent itself is supplied
|
|
131
|
+
* as an adapter, so adding an agent never changes this API or the published
|
|
132
|
+
* workflow schema.
|
|
101
133
|
*
|
|
102
134
|
* @public
|
|
103
135
|
* @param opts.id - Unique step identifier.
|
|
104
|
-
* @param opts.
|
|
136
|
+
* @param opts.agent - An agent adapter, e.g. `claudeCode()` from `@noetic-tools/acp`.
|
|
105
137
|
* @param opts.prompt - The turn prompt; eager string or `(ctx) => string` getter.
|
|
106
|
-
* @param opts.
|
|
107
|
-
* @param opts.output - Optional
|
|
108
|
-
* @returns A `
|
|
109
|
-
* @throws `NoeticConfigError` `EMPTY_STEP_ID` / `
|
|
110
|
-
*/
|
|
111
|
-
claudeCode<TContext = ContextData, I = unknown, O = unknown>(opts: StepSubHarnessOpts<TContext, O>): StepSubHarness<TContext, I, O>;
|
|
112
|
-
/**
|
|
113
|
-
* Creates a step that delegates a turn to the Codex harness.
|
|
114
|
-
* @public
|
|
115
|
-
* @param opts - See {@link step.claudeCode}; `opts.harness` is a `codex(...)` adapter.
|
|
116
|
-
* @returns A `StepSubHarness` of kind `codex`.
|
|
117
|
-
*/
|
|
118
|
-
codex<TContext = ContextData, I = unknown, O = unknown>(opts: StepSubHarnessOpts<TContext, O>): StepSubHarness<TContext, I, O>;
|
|
119
|
-
/**
|
|
120
|
-
* Creates a step that delegates a turn to the opencode harness.
|
|
121
|
-
* @public
|
|
122
|
-
* @param opts - See {@link step.claudeCode}; `opts.harness` is an `opencode(...)` adapter.
|
|
123
|
-
* @returns A `StepSubHarness` of kind `opencode`.
|
|
124
|
-
*/
|
|
125
|
-
opencode<TContext = ContextData, I = unknown, O = unknown>(opts: StepSubHarnessOpts<TContext, O>): StepSubHarness<TContext, I, O>;
|
|
126
|
-
/**
|
|
127
|
-
* Creates a step that delegates a turn to the pi harness.
|
|
128
|
-
* @public
|
|
129
|
-
* @param opts - See {@link step.claudeCode}; `opts.harness` is a `pi(...)` adapter.
|
|
130
|
-
* @returns A `StepSubHarness` of kind `pi`.
|
|
138
|
+
* @param opts.permissions - Declarative policy answering the agent's permission requests.
|
|
139
|
+
* @param opts.output - Optional Standard Schema enabling structured output parsing.
|
|
140
|
+
* @returns A `StepAcpAgent`, auto-registered in the step registry.
|
|
141
|
+
* @throws `NoeticConfigError` `EMPTY_STEP_ID` / `MISSING_ACP_AGENT` / `MISSING_PROMPT`.
|
|
131
142
|
*/
|
|
132
|
-
|
|
143
|
+
acpAgent<TContext = ContextData, I = unknown, O = unknown>(opts: StepAcpAgentOpts<TContext, O>): StepAcpAgent<TContext, I, O>;
|
|
133
144
|
};
|