langflower 0.0.9 → 0.0.10
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/package.json +2 -2
- package/ui-dist/index.html +2 -2
- package/ui-dist/main-Z7CPFXFA.js +313 -0
- package/ui-dist/styles-2TMDAUD7.css +1 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/llm-loop-reducer.js +0 -12
- package/vendor/common-nodes/dist/ai/features/llm-loop/llm-loop-types.d.ts +2 -7
- package/vendor/common-nodes/dist/ai/features/llm-loop/llm-loop-types.js +1 -1
- package/vendor/common-nodes/dist/ai/features/llm-loop/run-agent-loop.d.ts +0 -3
- package/vendor/common-nodes/dist/ai/features/llm-loop/run-agent-loop.js +22 -36
- package/vendor/common-nodes/dist/ai/features/llm-loop/run-llm-loop.d.ts +1 -7
- package/vendor/common-nodes/dist/ai/features/llm-loop/run-llm-loop.js +12 -35
- package/vendor/common-nodes/dist/ai/features/llm-session/llm-session-shell.d.ts +3 -10
- package/vendor/common-nodes/dist/ai/features/llm-session/llm-session-shell.js +9 -14
- package/vendor/common-nodes/dist/ai/features/path-choice/run-reactive-path-choice-loop.d.ts +0 -3
- package/vendor/common-nodes/dist/ai/features/path-choice/run-reactive-path-choice-loop.js +2 -15
- package/vendor/common-nodes/dist/ai/features/sub-agent-protocol.d.ts +1 -0
- package/vendor/common-nodes/dist/ai/features/sub-agent-protocol.js +1 -0
- package/vendor/common-nodes/dist/ai/features/ui-schema/llm-recovery-ui-schema.d.ts +1 -1
- package/vendor/common-nodes/dist/ai/features/ui-schema/llm-recovery-ui-schema.js +1 -1
- package/vendor/common-nodes/dist/ai/features/wait-for-subagent-result.d.ts +1 -0
- package/vendor/common-nodes/dist/ai/features/wait-for-subagent-result.js +1 -0
- package/vendor/common-nodes/dist/ai/nodes/critique/node.d.ts +3 -3
- package/vendor/common-nodes/dist/ai/nodes/critique/node.js +5 -18
- package/vendor/common-nodes/dist/ai/nodes/fake-llm/node.d.ts +3 -3
- package/vendor/common-nodes/dist/ai/nodes/fake-llm/node.js +3 -10
- package/vendor/common-nodes/dist/ai/nodes/openai-llm/node.d.ts +3 -3
- package/vendor/common-nodes/dist/ai/nodes/openai-llm/node.js +2 -9
- package/vendor/common-nodes/dist/ai/nodes/review/node.d.ts +3 -3
- package/vendor/common-nodes/dist/ai/nodes/review/node.js +5 -18
- package/vendor/common-nodes/dist/ai/nodes/sub-agent/node.d.ts +5 -5
- package/vendor/common-nodes/dist/ai/nodes/sub-agent/node.js +211 -96
- package/vendor/common-nodes/dist/catalog.js +2 -0
- package/vendor/common-nodes/dist/mcp/mcp-http/node.d.ts +4 -4
- package/vendor/common-nodes/dist/mcp/mcp-http/node.js +9 -10
- package/vendor/common-nodes/dist/mcp/mcp-stdio/node.d.ts +4 -4
- package/vendor/common-nodes/dist/mcp/mcp-stdio/node.js +9 -10
- package/vendor/common-nodes/dist/tools/collect-agent-tool-handles.d.ts +4 -4
- package/vendor/common-nodes/dist/tools/collect-agent-tool-handles.js +3 -11
- package/vendor/common-nodes/dist/tools/inventory-tool-round.d.ts +0 -10
- package/vendor/common-nodes/dist/tools/inventory-tool-round.js +0 -84
- package/vendor/common-nodes/dist/tools/tool-collection/node.d.ts +20 -0
- package/vendor/common-nodes/dist/tools/tool-collection/node.js +42 -0
- package/vendor/common-nodes/package.json +1 -5
- package/vendor/compiler/package.json +1 -1
- package/vendor/node-sdk/dist/node-factory/define-llm-node/default-llm-ports.d.ts +3 -7
- package/vendor/node-sdk/dist/node-factory/define-llm-node/default-llm-ports.js +4 -44
- package/vendor/node-sdk/dist/node-factory/define-llm-node/define-llm-node.d.ts +3 -5
- package/vendor/node-sdk/dist/node-factory/define-llm-node/define-llm-node.js +3 -5
- package/vendor/node-sdk/dist/node-factory/define-llm-node/llm-inventory-wire.d.ts +1 -0
- package/vendor/node-sdk/dist/node-factory/define-llm-node/llm-inventory-wire.js +1 -0
- package/vendor/node-sdk/dist/node-factory/define-mcp/mcp-handle.d.ts +3 -4
- package/vendor/node-sdk/dist/node-factory/define-mcp/mcp-handle.js +1 -1
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/types.d.ts +2 -4
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/ui-schema-inference.d.ts +1 -1
- package/vendor/node-sdk/package.json +1 -1
- package/vendor/runtime/dist/port-feed-override.d.ts +13 -0
- package/vendor/runtime/dist/port-feed-override.js +21 -0
- package/vendor/runtime/dist/port-signal-from-response.d.ts +15 -0
- package/vendor/runtime/dist/port-signal-from-response.js +48 -0
- package/vendor/runtime/dist/runtime-runner.d.ts +8 -3
- package/vendor/runtime/dist/runtime-runner.js +102 -81
- package/vendor/runtime/dist/runtime.d.ts +3 -2
- package/vendor/runtime/dist/runtime.js +1 -1
- package/vendor/runtime/dist/testing/workflows/workflow-events.d.ts +2 -0
- package/vendor/runtime/dist/testing/workflows/workflow-events.js +7 -5
- package/vendor/runtime/dist/types.d.ts +25 -8
- package/vendor/runtime/dist/types.js +3 -0
- package/vendor/runtime/package.json +1 -1
- package/vendor/server/dist/bridge/build-execution-context.js +3 -3
- package/vendor/server/dist/bridge/get-live-wired-tools.d.ts +3 -2
- package/vendor/server/dist/bridge/get-live-wired-tools.js +8 -5
- package/vendor/server/dist/bridge/wire-runner-handlers.js +2 -2
- package/vendor/server/dist/bridge/wire-workflow-handlers.js +23 -9
- package/vendor/server/dist/checkpoint/run-checkpoint-session.js +3 -3
- package/vendor/server/dist/session/reset-session-execution-feed.d.ts +6 -0
- package/vendor/server/dist/session/reset-session-execution-feed.js +8 -0
- package/vendor/server/skeleton/nodes/my-nodes/package.json +1 -1
- package/vendor/server/skeleton/skills/langflower-helper/SKILL.md +36 -22
- package/vendor/server/skeleton/skills/langflower-helper/architecture.md +7 -1
- package/vendor/server/skeleton/skills/langflower-helper/layout.md +3 -2
- package/vendor/server/skeleton/skills/langflower-workflow-writer/SKILL.md +12 -8
- package/vendor/server/skeleton/workflows/kb-create.json +15 -43
- package/vendor/server/skeleton/workflows/kb-navigate.json +8 -22
- package/vendor/server/skeleton/workflows/simple-coder.json +18 -46
- package/vendor/server/skeleton/workflows/starter.json +8 -22
- package/vendor/shared/dist/execution/derive-run-settle-outcome.js +2 -2
- package/vendor/shared/dist/execution/derive-run-settle-outcome.test.js +11 -8
- package/vendor/shared/dist/langflower-ws-waits.d.ts +3 -1
- package/vendor/shared/dist/langflower-ws-waits.js +2 -2
- package/ui-dist/main-2JJGCNTD.js +0 -313
- package/ui-dist/styles-EOXODOI7.css +0 -1
|
@@ -4,3 +4,4 @@ import { type Observable } from 'rxjs';
|
|
|
4
4
|
* aborted when the tool-loop AbortSignal fires (turn Observable teardown).
|
|
5
5
|
*/
|
|
6
6
|
export declare const waitForSubagentResult: (result$: Observable<unknown>, callId: string, signal: AbortSignal, timeoutMs?: number) => Promise<string>;
|
|
7
|
+
//# sourceMappingURL=wait-for-subagent-result.d.ts.map
|
|
@@ -28,3 +28,4 @@ const observeSubagentResult = (result$, callId, signal, timeoutMs = 0) => {
|
|
|
28
28
|
export const waitForSubagentResult = (result$, callId, signal, timeoutMs = 0) => signal.aborted
|
|
29
29
|
? Promise.reject(new Error('Sub-Agent wait aborted'))
|
|
30
30
|
: firstValueFrom(observeSubagentResult(result$, callId, signal, timeoutMs));
|
|
31
|
+
//# sourceMappingURL=wait-for-subagent-result.js.map
|
|
@@ -105,7 +105,7 @@ export declare const critiqueNode: {
|
|
|
105
105
|
readonly field: "subagentTimeoutMs";
|
|
106
106
|
readonly type: "number";
|
|
107
107
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
108
|
-
readonly default:
|
|
108
|
+
readonly default: number;
|
|
109
109
|
readonly min: 0;
|
|
110
110
|
readonly step: 1;
|
|
111
111
|
}, {
|
|
@@ -295,7 +295,7 @@ export declare const critiqueNode: {
|
|
|
295
295
|
readonly field: "subagentTimeoutMs";
|
|
296
296
|
readonly type: "number";
|
|
297
297
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
298
|
-
readonly default:
|
|
298
|
+
readonly default: number;
|
|
299
299
|
readonly min: 0;
|
|
300
300
|
readonly step: 1;
|
|
301
301
|
}, {
|
|
@@ -485,7 +485,7 @@ export declare const critiqueNode: {
|
|
|
485
485
|
readonly field: "subagentTimeoutMs";
|
|
486
486
|
readonly type: "number";
|
|
487
487
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
488
|
-
readonly default:
|
|
488
|
+
readonly default: number;
|
|
489
489
|
readonly min: 0;
|
|
490
490
|
readonly step: 1;
|
|
491
491
|
}, {
|
|
@@ -11,8 +11,6 @@ import { parseLlmRolePreset, resolveEffectiveSkillId, } from '../../features/llm
|
|
|
11
11
|
import { DEFAULT_PATH_CHOICE_MAX_ITERATIONS, PATH_CHOICE_MAX_ITERATIONS_CAP, normalizeMaxIterations, } from '../../features/prompt/normalize-max-iterations.js';
|
|
12
12
|
import { normalizeLlmRecoveryPolicy } from '../../features/llm-loop/normalize-llm-recovery-policy.js';
|
|
13
13
|
import { normalizeCompactionConfig } from '../../features/openai/normalize-compaction-params.js';
|
|
14
|
-
import { flattenSubAgentRegistrations, } from '../../features/sub-agent-protocol.js';
|
|
15
|
-
import { waitForSubagentResult } from '../../features/wait-for-subagent-result.js';
|
|
16
14
|
import { REVIEW_ACCEPT_TOOL, REVIEW_FEEDBACK_TOOL, } from '../../features/path-choice/control-tools.js';
|
|
17
15
|
import { runPathChoiceToolLoop, } from '../../features/path-choice/run-reactive-path-choice-loop.js';
|
|
18
16
|
import { getRunHostServices } from '../../features/run-host-services.js';
|
|
@@ -54,7 +52,7 @@ const buildRevisedPacketUserContent = (packet) => [
|
|
|
54
52
|
packet.trim().length > 0 ? packet : '(empty packet)',
|
|
55
53
|
].join('\n');
|
|
56
54
|
const hasUserMessage = (history) => history.some((message) => message.role === 'user');
|
|
57
|
-
const runCritiqueTurn = (context, packet, history
|
|
55
|
+
const runCritiqueTurn = (context, packet, history) => {
|
|
58
56
|
const factory = context.factory;
|
|
59
57
|
if (factory === undefined) {
|
|
60
58
|
return new Observable((subscriber) => {
|
|
@@ -79,13 +77,7 @@ const runCritiqueTurn = (context, packet, history, subagentResult$) => {
|
|
|
79
77
|
compaction: context.compaction,
|
|
80
78
|
recovery: context.recovery,
|
|
81
79
|
steerControl$: context.steerControl$,
|
|
82
|
-
subagentRegistrations: context.subagentRegistrations,
|
|
83
80
|
toolCtx: context.toolCtx,
|
|
84
|
-
...(context.subagentRegistrations.length > 0
|
|
85
|
-
? {
|
|
86
|
-
waitForSubagentResult: (callId, signal) => waitForSubagentResult(subagentResult$, callId, signal, context.recovery.subagentTimeoutMs),
|
|
87
|
-
}
|
|
88
|
-
: {}),
|
|
89
81
|
}).pipe(map((chunk) => {
|
|
90
82
|
if (chunk.kind === 'accept') {
|
|
91
83
|
return {
|
|
@@ -117,7 +109,7 @@ export const critiqueNode = defineLlmNode({
|
|
|
117
109
|
...llmRecoveryUiSchema,
|
|
118
110
|
],
|
|
119
111
|
bind(ctx, { makeInput, configureOutput, combineInputs }, inventory) {
|
|
120
|
-
const { tools,
|
|
112
|
+
const { tools, steerControl } = inventory;
|
|
121
113
|
const assignment = makeInput('assignment', {
|
|
122
114
|
name: 'assignment',
|
|
123
115
|
wireType: 'string',
|
|
@@ -137,7 +129,7 @@ export const critiqueNode = defineLlmNode({
|
|
|
137
129
|
defaultValue: '',
|
|
138
130
|
});
|
|
139
131
|
// Init peers only — packet is the session turn driver (ADR-016).
|
|
140
|
-
const context$ = combineInputs([assignment, systemPrompt, tools,
|
|
132
|
+
const context$ = combineInputs([assignment, systemPrompt, tools, ctx], ([assignmentValue, systemPromptValue, toolList, ec]) => {
|
|
141
133
|
const rolePreset = parseLlmRolePreset(ec.params.rolePreset);
|
|
142
134
|
const skillId = resolveEffectiveSkillId(rolePreset, ec.params.skillId);
|
|
143
135
|
const hostServices = getRunHostServices(ec);
|
|
@@ -169,10 +161,7 @@ export const critiqueNode = defineLlmNode({
|
|
|
169
161
|
tools: collectAgentToolHandles({
|
|
170
162
|
toolHandles: ec.toolHandles,
|
|
171
163
|
toolsPort: toolList,
|
|
172
|
-
mcpHandles: ec.mcpHandles,
|
|
173
|
-
mcpPort: mcpList,
|
|
174
164
|
}),
|
|
175
|
-
subagentRegistrations: flattenSubAgentRegistrations(subagentList),
|
|
176
165
|
toolCtx: {
|
|
177
166
|
projectDir: ec.projectDir,
|
|
178
167
|
runId: ec.runId,
|
|
@@ -198,7 +187,7 @@ export const critiqueNode = defineLlmNode({
|
|
|
198
187
|
trackAssistantHistory: false,
|
|
199
188
|
appendUserFeedbackToHistory: false,
|
|
200
189
|
session: undefined,
|
|
201
|
-
}), (context, turnPayload, history) => runCritiqueTurn(context, String(turnPayload ?? ''), history
|
|
190
|
+
}), (context, turnPayload, history) => runCritiqueTurn(context, String(turnPayload ?? ''), history), { primeTurn0: false });
|
|
202
191
|
const reasoning$ = cycle$.pipeValue(demuxByKind('reasoning', (chunk) => chunk
|
|
203
192
|
.text));
|
|
204
193
|
const draftResponse$ = cycle$.pipeValue(demuxByKind('draftResponse', (chunk) => chunk
|
|
@@ -212,8 +201,6 @@ export const critiqueNode = defineLlmNode({
|
|
|
212
201
|
.result));
|
|
213
202
|
const feedback$ = cycle$.pipeValue(demuxByKind('feedback', (chunk) => chunk
|
|
214
203
|
.notes));
|
|
215
|
-
const subagent$ = cycle$.pipeValue(demuxByKind('subagentSpawn', (chunk) => chunk
|
|
216
|
-
.payload));
|
|
217
204
|
return {
|
|
218
205
|
inputs: [assignment, packet, systemPrompt],
|
|
219
206
|
outputs: [
|
|
@@ -234,7 +221,7 @@ export const critiqueNode = defineLlmNode({
|
|
|
234
221
|
feed: { role: 'result' },
|
|
235
222
|
}),
|
|
236
223
|
],
|
|
237
|
-
inventoryOutputs: { toolLog$, recovery
|
|
224
|
+
inventoryOutputs: { toolLog$, recovery$ },
|
|
238
225
|
};
|
|
239
226
|
},
|
|
240
227
|
});
|
|
@@ -91,7 +91,7 @@ export declare const fakeLlmNode: {
|
|
|
91
91
|
readonly field: "subagentTimeoutMs";
|
|
92
92
|
readonly type: "number";
|
|
93
93
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
94
|
-
readonly default:
|
|
94
|
+
readonly default: number;
|
|
95
95
|
readonly min: 0;
|
|
96
96
|
readonly step: 1;
|
|
97
97
|
}, {
|
|
@@ -276,7 +276,7 @@ export declare const fakeLlmNode: {
|
|
|
276
276
|
readonly field: "subagentTimeoutMs";
|
|
277
277
|
readonly type: "number";
|
|
278
278
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
279
|
-
readonly default:
|
|
279
|
+
readonly default: number;
|
|
280
280
|
readonly min: 0;
|
|
281
281
|
readonly step: 1;
|
|
282
282
|
}, {
|
|
@@ -461,7 +461,7 @@ export declare const fakeLlmNode: {
|
|
|
461
461
|
readonly field: "subagentTimeoutMs";
|
|
462
462
|
readonly type: "number";
|
|
463
463
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
464
|
-
readonly default:
|
|
464
|
+
readonly default: number;
|
|
465
465
|
readonly min: 0;
|
|
466
466
|
readonly step: 1;
|
|
467
467
|
}, {
|
|
@@ -5,7 +5,6 @@ import { llmRecoveryUiSchema } from '../../features/ui-schema/llm-recovery-ui-sc
|
|
|
5
5
|
import { appendToolInventory, bindLlmAgentSession, } from '../../features/llm-session/llm-session-shell.js';
|
|
6
6
|
import { runAgentLoop, } from '../../features/llm-loop/run-agent-loop.js';
|
|
7
7
|
import { DISABLED_COMPACTION_CONFIG } from '../../features/openai/normalize-compaction-params.js';
|
|
8
|
-
import { waitForSubagentResult } from '../../features/wait-for-subagent-result.js';
|
|
9
8
|
import { createScriptedFactory, parseScriptedTurns, } from '../../features/scripted-chat-completion-stream.js';
|
|
10
9
|
import { getRunHostServices } from '../../features/run-host-services.js';
|
|
11
10
|
/**
|
|
@@ -108,7 +107,7 @@ const runFakeImitateCycle = (bundle) => {
|
|
|
108
107
|
];
|
|
109
108
|
return interval(delayMs).pipe(take(chunks.length), map((index) => chunks[index]));
|
|
110
109
|
};
|
|
111
|
-
const runFakeToolLoopCycle = (bundle, messages, factory
|
|
110
|
+
const runFakeToolLoopCycle = (bundle, messages, factory) => {
|
|
112
111
|
return runAgentLoop({
|
|
113
112
|
factory,
|
|
114
113
|
providerId: bundle.providerId.length > 0 ? bundle.providerId : 'fake',
|
|
@@ -120,18 +119,12 @@ const runFakeToolLoopCycle = (bundle, messages, factory, subagentResult$) => {
|
|
|
120
119
|
maxIterations: bundle.maxIterations,
|
|
121
120
|
compaction: DISABLED_COMPACTION_CONFIG,
|
|
122
121
|
recovery: bundle.recovery,
|
|
123
|
-
subagentRegistrations: bundle.subagentRegistrations,
|
|
124
122
|
...(bundle.requestPermission !== undefined
|
|
125
123
|
? { requestPermission: bundle.requestPermission }
|
|
126
124
|
: {}),
|
|
127
125
|
...(bundle.steerControl$ !== undefined
|
|
128
126
|
? { steerControl$: bundle.steerControl$ }
|
|
129
127
|
: {}),
|
|
130
|
-
...(bundle.subagentRegistrations.length > 0
|
|
131
|
-
? {
|
|
132
|
-
waitForSubagentResult: (callId, signal) => waitForSubagentResult(subagentResult$, callId, signal),
|
|
133
|
-
}
|
|
134
|
-
: {}),
|
|
135
128
|
});
|
|
136
129
|
};
|
|
137
130
|
const resolveSessionFactory = (context) =>
|
|
@@ -193,13 +186,13 @@ export const fakeLlmNode = defineLlmNode({
|
|
|
193
186
|
session: resolveSessionFactory(context),
|
|
194
187
|
};
|
|
195
188
|
},
|
|
196
|
-
runTurn: (context, feedback, history,
|
|
189
|
+
runTurn: (context, feedback, history, sessionFactory) => {
|
|
197
190
|
const bundle = {
|
|
198
191
|
...context,
|
|
199
192
|
feedback: feedback ?? '',
|
|
200
193
|
};
|
|
201
194
|
if (sessionFactory !== undefined) {
|
|
202
|
-
return runFakeToolLoopCycle(bundle, history, sessionFactory
|
|
195
|
+
return runFakeToolLoopCycle(bundle, history, sessionFactory);
|
|
203
196
|
}
|
|
204
197
|
return runFakeImitateCycle(bundle);
|
|
205
198
|
},
|
|
@@ -104,7 +104,7 @@ export declare const openAiLlmNode: {
|
|
|
104
104
|
readonly field: "subagentTimeoutMs";
|
|
105
105
|
readonly type: "number";
|
|
106
106
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
107
|
-
readonly default:
|
|
107
|
+
readonly default: number;
|
|
108
108
|
readonly min: 0;
|
|
109
109
|
readonly step: 1;
|
|
110
110
|
}, {
|
|
@@ -294,7 +294,7 @@ export declare const openAiLlmNode: {
|
|
|
294
294
|
readonly field: "subagentTimeoutMs";
|
|
295
295
|
readonly type: "number";
|
|
296
296
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
297
|
-
readonly default:
|
|
297
|
+
readonly default: number;
|
|
298
298
|
readonly min: 0;
|
|
299
299
|
readonly step: 1;
|
|
300
300
|
}, {
|
|
@@ -484,7 +484,7 @@ export declare const openAiLlmNode: {
|
|
|
484
484
|
readonly field: "subagentTimeoutMs";
|
|
485
485
|
readonly type: "number";
|
|
486
486
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
487
|
-
readonly default:
|
|
487
|
+
readonly default: number;
|
|
488
488
|
readonly min: 0;
|
|
489
489
|
readonly step: 1;
|
|
490
490
|
}, {
|
|
@@ -5,7 +5,6 @@ import { llmCompactionUiSchema } from '../../features/ui-schema/llm-compaction-u
|
|
|
5
5
|
import { llmRecoveryUiSchema } from '../../features/ui-schema/llm-recovery-ui-schema.js';
|
|
6
6
|
import { appendToolInventory, bindLlmAgentSession, } from '../../features/llm-session/llm-session-shell.js';
|
|
7
7
|
import { runAgentLoop, } from '../../features/llm-loop/run-agent-loop.js';
|
|
8
|
-
import { waitForSubagentResult } from '../../features/wait-for-subagent-result.js';
|
|
9
8
|
import { getRunHostServices } from '../../features/run-host-services.js';
|
|
10
9
|
const requireChatConfig = (providerId, model) => {
|
|
11
10
|
if (providerId.trim().length === 0) {
|
|
@@ -15,7 +14,7 @@ const requireChatConfig = (providerId, model) => {
|
|
|
15
14
|
throw new Error('Model is required for OpenAI-compatible chat');
|
|
16
15
|
}
|
|
17
16
|
};
|
|
18
|
-
const runOpenAiTurn = (context, messages, _feedback
|
|
17
|
+
const runOpenAiTurn = (context, messages, _feedback) => {
|
|
19
18
|
const factory = context.factory;
|
|
20
19
|
if (factory === undefined) {
|
|
21
20
|
return new Observable((subscriber) => {
|
|
@@ -36,18 +35,12 @@ const runOpenAiTurn = (context, messages, _feedback, subagentResult$) => {
|
|
|
36
35
|
maxIterations: context.maxIterations,
|
|
37
36
|
compaction: context.compaction,
|
|
38
37
|
recovery: context.recovery,
|
|
39
|
-
subagentRegistrations: context.subagentRegistrations,
|
|
40
38
|
...(context.requestPermission !== undefined
|
|
41
39
|
? { requestPermission: context.requestPermission }
|
|
42
40
|
: {}),
|
|
43
41
|
...(context.steerControl$ !== undefined
|
|
44
42
|
? { steerControl$: context.steerControl$ }
|
|
45
43
|
: {}),
|
|
46
|
-
...(context.subagentRegistrations.length > 0
|
|
47
|
-
? {
|
|
48
|
-
waitForSubagentResult: (callId, signal) => waitForSubagentResult(subagentResult$, callId, signal, context.recovery.subagentTimeoutMs),
|
|
49
|
-
}
|
|
50
|
-
: {}),
|
|
51
44
|
});
|
|
52
45
|
};
|
|
53
46
|
/**
|
|
@@ -85,7 +78,7 @@ export const openAiLlmNode = defineLlmNode({
|
|
|
85
78
|
appendUserFeedbackToHistory: true,
|
|
86
79
|
session: undefined,
|
|
87
80
|
}),
|
|
88
|
-
runTurn: (context, feedback, history
|
|
81
|
+
runTurn: (context, feedback, history) => runOpenAiTurn(context, history, feedback),
|
|
89
82
|
});
|
|
90
83
|
},
|
|
91
84
|
});
|
|
@@ -110,7 +110,7 @@ export declare const reviewNode: {
|
|
|
110
110
|
readonly field: "subagentTimeoutMs";
|
|
111
111
|
readonly type: "number";
|
|
112
112
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
113
|
-
readonly default:
|
|
113
|
+
readonly default: number;
|
|
114
114
|
readonly min: 0;
|
|
115
115
|
readonly step: 1;
|
|
116
116
|
}, {
|
|
@@ -300,7 +300,7 @@ export declare const reviewNode: {
|
|
|
300
300
|
readonly field: "subagentTimeoutMs";
|
|
301
301
|
readonly type: "number";
|
|
302
302
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
303
|
-
readonly default:
|
|
303
|
+
readonly default: number;
|
|
304
304
|
readonly min: 0;
|
|
305
305
|
readonly step: 1;
|
|
306
306
|
}, {
|
|
@@ -490,7 +490,7 @@ export declare const reviewNode: {
|
|
|
490
490
|
readonly field: "subagentTimeoutMs";
|
|
491
491
|
readonly type: "number";
|
|
492
492
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
493
|
-
readonly default:
|
|
493
|
+
readonly default: number;
|
|
494
494
|
readonly min: 0;
|
|
495
495
|
readonly step: 1;
|
|
496
496
|
}, {
|
|
@@ -11,8 +11,6 @@ import { parseLlmRolePreset, resolveEffectiveSkillId, } from '../../features/llm
|
|
|
11
11
|
import { DEFAULT_PATH_CHOICE_MAX_ITERATIONS, PATH_CHOICE_MAX_ITERATIONS_CAP, normalizeMaxIterations, } from '../../features/prompt/normalize-max-iterations.js';
|
|
12
12
|
import { normalizeLlmRecoveryPolicy } from '../../features/llm-loop/normalize-llm-recovery-policy.js';
|
|
13
13
|
import { normalizeCompactionConfig } from '../../features/openai/normalize-compaction-params.js';
|
|
14
|
-
import { flattenSubAgentRegistrations, } from '../../features/sub-agent-protocol.js';
|
|
15
|
-
import { waitForSubagentResult } from '../../features/wait-for-subagent-result.js';
|
|
16
14
|
import { REVIEW_ACCEPT_TOOL, REVIEW_FEEDBACK_TOOL, } from '../../features/path-choice/control-tools.js';
|
|
17
15
|
import { runPathChoiceToolLoop, } from '../../features/path-choice/run-reactive-path-choice-loop.js';
|
|
18
16
|
import { getRunHostServices } from '../../features/run-host-services.js';
|
|
@@ -52,7 +50,7 @@ const buildRevisedResultUserContent = (result) => [
|
|
|
52
50
|
result.trim().length > 0 ? result : '(empty result)',
|
|
53
51
|
].join('\n');
|
|
54
52
|
const hasUserMessage = (history) => history.some((message) => message.role === 'user');
|
|
55
|
-
const runReviewTurn = (context, result, history
|
|
53
|
+
const runReviewTurn = (context, result, history) => {
|
|
56
54
|
const factory = context.factory;
|
|
57
55
|
if (factory === undefined) {
|
|
58
56
|
return new Observable((subscriber) => {
|
|
@@ -77,13 +75,7 @@ const runReviewTurn = (context, result, history, subagentResult$) => {
|
|
|
77
75
|
compaction: context.compaction,
|
|
78
76
|
recovery: context.recovery,
|
|
79
77
|
steerControl$: context.steerControl$,
|
|
80
|
-
subagentRegistrations: context.subagentRegistrations,
|
|
81
78
|
toolCtx: context.toolCtx,
|
|
82
|
-
...(context.subagentRegistrations.length > 0
|
|
83
|
-
? {
|
|
84
|
-
waitForSubagentResult: (callId, signal) => waitForSubagentResult(subagentResult$, callId, signal, context.recovery.subagentTimeoutMs),
|
|
85
|
-
}
|
|
86
|
-
: {}),
|
|
87
79
|
}).pipe(map((chunk) => {
|
|
88
80
|
if (chunk.kind === 'accept') {
|
|
89
81
|
return {
|
|
@@ -120,7 +112,7 @@ export const reviewNode = defineLlmNode({
|
|
|
120
112
|
...llmRecoveryUiSchema,
|
|
121
113
|
],
|
|
122
114
|
bind(ctx, { makeInput, configureOutput, combineInputs }, inventory) {
|
|
123
|
-
const { tools,
|
|
115
|
+
const { tools, steerControl } = inventory;
|
|
124
116
|
const task = makeInput('task', {
|
|
125
117
|
name: 'task',
|
|
126
118
|
wireType: 'string',
|
|
@@ -140,7 +132,7 @@ export const reviewNode = defineLlmNode({
|
|
|
140
132
|
defaultValue: '',
|
|
141
133
|
});
|
|
142
134
|
// Init peers only — result is the session turn driver (ADR-016).
|
|
143
|
-
const context$ = combineInputs([task, systemPrompt, tools,
|
|
135
|
+
const context$ = combineInputs([task, systemPrompt, tools, ctx], ([taskValue, systemPromptValue, toolList, ec]) => {
|
|
144
136
|
const rolePreset = parseLlmRolePreset(ec.params.rolePreset);
|
|
145
137
|
const skillId = resolveEffectiveSkillId(rolePreset, ec.params.skillId);
|
|
146
138
|
const hostServices = getRunHostServices(ec);
|
|
@@ -172,10 +164,7 @@ export const reviewNode = defineLlmNode({
|
|
|
172
164
|
tools: collectAgentToolHandles({
|
|
173
165
|
toolHandles: ec.toolHandles,
|
|
174
166
|
toolsPort: toolList,
|
|
175
|
-
mcpHandles: ec.mcpHandles,
|
|
176
|
-
mcpPort: mcpList,
|
|
177
167
|
}),
|
|
178
|
-
subagentRegistrations: flattenSubAgentRegistrations(subagentList),
|
|
179
168
|
toolCtx: {
|
|
180
169
|
projectDir: ec.projectDir,
|
|
181
170
|
runId: ec.runId,
|
|
@@ -201,7 +190,7 @@ export const reviewNode = defineLlmNode({
|
|
|
201
190
|
trackAssistantHistory: false,
|
|
202
191
|
appendUserFeedbackToHistory: false,
|
|
203
192
|
session: undefined,
|
|
204
|
-
}), (context, turnPayload, history) => runReviewTurn(context, String(turnPayload ?? ''), history
|
|
193
|
+
}), (context, turnPayload, history) => runReviewTurn(context, String(turnPayload ?? ''), history), { primeTurn0: false });
|
|
205
194
|
const reasoning$ = cycle$.pipeValue(demuxByKind('reasoning', (chunk) => chunk.text));
|
|
206
195
|
const draftResponse$ = cycle$.pipeValue(demuxByKind('draftResponse', (chunk) => chunk
|
|
207
196
|
.text));
|
|
@@ -212,8 +201,6 @@ export const reviewNode = defineLlmNode({
|
|
|
212
201
|
}));
|
|
213
202
|
const response$ = cycle$.pipeValue(demuxByKind('accept', (chunk) => chunk.result));
|
|
214
203
|
const feedback$ = cycle$.pipeValue(demuxByKind('feedback', (chunk) => chunk.notes));
|
|
215
|
-
const subagent$ = cycle$.pipeValue(demuxByKind('subagentSpawn', (chunk) => chunk
|
|
216
|
-
.payload));
|
|
217
204
|
return {
|
|
218
205
|
inputs: [task, result, systemPrompt],
|
|
219
206
|
outputs: [
|
|
@@ -234,7 +221,7 @@ export const reviewNode = defineLlmNode({
|
|
|
234
221
|
feed: { role: 'result' },
|
|
235
222
|
}),
|
|
236
223
|
],
|
|
237
|
-
inventoryOutputs: { toolLog$, recovery
|
|
224
|
+
inventoryOutputs: { toolLog$, recovery$ },
|
|
238
225
|
};
|
|
239
226
|
},
|
|
240
227
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Sub-Agent: ordinary OpenAI-compatible agent
|
|
3
|
-
*
|
|
2
|
+
* Sub-Agent: ordinary OpenAI-compatible agent that announces one ToolHandle
|
|
3
|
+
* on `subagent-registration`. Parent invoke runs this node's in-node loop.
|
|
4
4
|
* @see docs/ADR.md ADR-021
|
|
5
5
|
*/
|
|
6
6
|
export declare const subAgentNode: {
|
|
@@ -117,7 +117,7 @@ export declare const subAgentNode: {
|
|
|
117
117
|
readonly field: "subagentTimeoutMs";
|
|
118
118
|
readonly type: "number";
|
|
119
119
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
120
|
-
readonly default:
|
|
120
|
+
readonly default: number;
|
|
121
121
|
readonly min: 0;
|
|
122
122
|
readonly step: 1;
|
|
123
123
|
}, {
|
|
@@ -322,7 +322,7 @@ export declare const subAgentNode: {
|
|
|
322
322
|
readonly field: "subagentTimeoutMs";
|
|
323
323
|
readonly type: "number";
|
|
324
324
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
325
|
-
readonly default:
|
|
325
|
+
readonly default: number;
|
|
326
326
|
readonly min: 0;
|
|
327
327
|
readonly step: 1;
|
|
328
328
|
}, {
|
|
@@ -527,7 +527,7 @@ export declare const subAgentNode: {
|
|
|
527
527
|
readonly field: "subagentTimeoutMs";
|
|
528
528
|
readonly type: "number";
|
|
529
529
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
530
|
-
readonly default:
|
|
530
|
+
readonly default: number;
|
|
531
531
|
readonly min: 0;
|
|
532
532
|
readonly step: 1;
|
|
533
533
|
}, {
|