langflower 0.0.9 → 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.
- package/README.md +96 -70
- package/docs/public/README.md +2 -2
- package/docs/public/configuration.md +4 -0
- package/docs/public/extending.md +18 -2
- package/docs/public/getting-started.md +7 -0
- package/docs/public/how-it-works.md +18 -11
- package/docs/public/product.md +35 -25
- package/package.json +2 -2
- package/ui-dist/chunk-QI4IYILJ.js +4 -0
- package/ui-dist/{chunk-7UMVYN3A.js → chunk-UG3GFV4Y.js} +1 -1
- package/ui-dist/index.html +2 -2
- package/ui-dist/main-ODIDCCNX.js +315 -0
- package/ui-dist/styles-2JMBAQC3.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 +5 -12
- package/vendor/common-nodes/dist/ai/features/llm-session/llm-session-shell.js +48 -21
- package/vendor/common-nodes/dist/ai/features/llm-session/run-session-machine.d.ts +11 -0
- package/vendor/common-nodes/dist/ai/features/llm-session/run-session-machine.js +2 -2
- 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/run-host-services.d.ts +10 -0
- 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 +10 -19
- 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 +10 -11
- 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 +7 -10
- package/vendor/common-nodes/dist/ai/nodes/review/node.d.ts +3 -3
- package/vendor/common-nodes/dist/ai/nodes/review/node.js +12 -19
- 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 +251 -96
- package/vendor/common-nodes/dist/catalog.js +12 -0
- package/vendor/common-nodes/dist/crawl/crawl/node.js +11 -3
- package/vendor/common-nodes/dist/crawl/crawl-tools/node.js +5 -1
- package/vendor/common-nodes/dist/crawl/extract-links/node.js +7 -1
- package/vendor/common-nodes/dist/crawl/fetch-url/node.js +13 -4
- package/vendor/common-nodes/dist/crawl/save-page/node.js +11 -3
- package/vendor/common-nodes/dist/embeddings/create-embedding.d.ts +39 -0
- package/vendor/common-nodes/dist/embeddings/create-embedding.js +154 -0
- package/vendor/common-nodes/dist/embeddings/embed-provider/node.d.ts +53 -0
- package/vendor/common-nodes/dist/embeddings/embed-provider/node.js +126 -0
- package/vendor/common-nodes/dist/embeddings/embed-similarity/node.d.ts +20 -0
- package/vendor/common-nodes/dist/embeddings/embed-similarity/node.js +81 -0
- package/vendor/common-nodes/dist/embeddings/embed-text/node.d.ts +53 -0
- package/vendor/common-nodes/dist/embeddings/embed-text/node.js +91 -0
- package/vendor/common-nodes/dist/embeddings/from-embedding.d.ts +8 -0
- package/vendor/common-nodes/dist/embeddings/from-embedding.js +24 -0
- package/vendor/common-nodes/dist/embeddings/resolve-embedding-provider-model.d.ts +11 -0
- package/vendor/common-nodes/dist/embeddings/resolve-embedding-provider-model.js +8 -0
- package/vendor/common-nodes/dist/flow/checkpoint/node.js +7 -3
- package/vendor/common-nodes/dist/flow/delay/node.d.ts +2 -6
- package/vendor/common-nodes/dist/flow/delay/node.js +13 -9
- package/vendor/common-nodes/dist/flow/loop/node.js +7 -1
- package/vendor/common-nodes/dist/flow/merge/node.js +7 -1
- package/vendor/common-nodes/dist/flow/repeat/node.js +5 -1
- package/vendor/common-nodes/dist/flow/router/node.js +7 -1
- package/vendor/common-nodes/dist/hitl/chat-input/node.d.ts +2 -2
- package/vendor/common-nodes/dist/hitl/chat-input/node.js +8 -4
- package/vendor/common-nodes/dist/hitl/review-gate/node.js +11 -5
- package/vendor/common-nodes/dist/langflower-tools/node.js +5 -1
- package/vendor/common-nodes/dist/logic/assert/node.js +7 -1
- package/vendor/common-nodes/dist/logic/compare/node.js +7 -1
- package/vendor/common-nodes/dist/logic/gate/node.js +7 -1
- package/vendor/common-nodes/dist/logic/if/node.js +7 -1
- package/vendor/common-nodes/dist/logic/switch/node.js +7 -1
- package/vendor/common-nodes/dist/mcp/mcp-http/node.d.ts +4 -4
- package/vendor/common-nodes/dist/mcp/mcp-http/node.js +61 -60
- package/vendor/common-nodes/dist/mcp/mcp-stdio/node.d.ts +4 -4
- package/vendor/common-nodes/dist/mcp/mcp-stdio/node.js +58 -57
- package/vendor/common-nodes/dist/memory/memory-tools/node.js +5 -1
- package/vendor/common-nodes/dist/output/finish/node.js +13 -1
- package/vendor/common-nodes/dist/output/preview/node.js +9 -2
- package/vendor/common-nodes/dist/primitives/boolean/node.js +7 -1
- package/vendor/common-nodes/dist/primitives/number/node.js +7 -1
- package/vendor/common-nodes/dist/primitives/string/node.js +7 -1
- package/vendor/common-nodes/dist/primitives/string-multiline/node.d.ts +17 -0
- package/vendor/common-nodes/dist/primitives/string-multiline/node.js +31 -0
- package/vendor/common-nodes/dist/text/append-file/node.js +11 -3
- package/vendor/common-nodes/dist/text/concat/node.js +5 -1
- package/vendor/common-nodes/dist/text/read-file/node.js +9 -3
- package/vendor/common-nodes/dist/text/split-paced/node.d.ts +21 -0
- package/vendor/common-nodes/dist/text/split-paced/node.js +93 -0
- package/vendor/common-nodes/dist/text/write-file/node.js +11 -3
- 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 +45 -0
- package/vendor/common-nodes/package.json +5 -5
- package/vendor/compiler/package.json +1 -1
- package/vendor/node-sdk/dist/node-factory/define-embed/embed-handle.d.ts +25 -0
- package/vendor/node-sdk/dist/node-factory/define-embed/embed-handle.js +25 -0
- 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 +4 -4
- package/vendor/node-sdk/dist/node-factory/define-mcp/mcp-handle.js +2 -1
- package/vendor/node-sdk/dist/node-factory/define-node/define-node.d.ts +2 -0
- package/vendor/node-sdk/dist/node-factory/define-node/define-node.js +4 -1
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/define-reactive-node.d.ts +3 -1
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/define-reactive-node.js +2 -1
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/io-helpers.d.ts +15 -0
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/io-helpers.js +17 -1
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/port-meta.d.ts +17 -4
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/test/samples/delay-node.js +4 -2
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/types.d.ts +6 -7
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/ui-schema-inference.d.ts +1 -1
- package/vendor/node-sdk/dist/testing/create-node-harness.d.ts +30 -0
- package/vendor/node-sdk/dist/testing/create-node-harness.js +68 -0
- package/vendor/node-sdk/package.json +5 -5
- 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 +26 -9
- package/vendor/runtime/dist/types.js +3 -0
- package/vendor/runtime/package.json +1 -1
- package/vendor/server/dist/bootstrap/project-bootstrap.service.d.ts +1 -1
- package/vendor/server/dist/bootstrap/seed-skeleton.d.ts +2 -2
- package/vendor/server/dist/bootstrap/seed-skeleton.js +17 -2
- package/vendor/server/dist/bridge/bind-embed-context.d.ts +7 -0
- package/vendor/server/dist/bridge/bind-embed-context.js +16 -0
- package/vendor/server/dist/bridge/build-execution-context.d.ts +2 -2
- package/vendor/server/dist/bridge/build-execution-context.js +8 -4
- package/vendor/server/dist/bridge/emit-bootstrap.js +4 -1
- 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/settings-draft-controller.js +7 -3
- package/vendor/server/dist/bridge/wire-config-handlers.js +2 -0
- package/vendor/server/dist/bridge/wire-editor-handlers.js +14 -0
- 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/config/langflower-config.service.d.ts +2 -0
- package/vendor/server/dist/config/langflower-config.service.js +30 -0
- package/vendor/server/dist/session/build-session-bootstrap.js +1 -0
- package/vendor/server/dist/session/langflower-session.d.ts +3 -1
- package/vendor/server/dist/session/langflower-session.js +3 -1
- 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/dist/workflow/apply-editor-mutation.js +6 -0
- package/vendor/server/dist/workflow/workflow-persisted-inputs.js +8 -6
- package/vendor/server/skeleton/instructions.md +15 -3
- package/vendor/server/skeleton/nodes/hello-embed/README.md +185 -0
- package/vendor/server/skeleton/nodes/hello-embed/hello-embed.nodes.test.ts +181 -0
- package/vendor/server/skeleton/nodes/hello-embed/ingest.ts +126 -0
- package/vendor/server/skeleton/nodes/hello-embed/lib/chunk-markdown.test.ts +40 -0
- package/vendor/server/skeleton/nodes/hello-embed/lib/chunk-markdown.ts +123 -0
- package/vendor/server/skeleton/nodes/hello-embed/lib/ingest-search.test.ts +180 -0
- package/vendor/server/skeleton/nodes/hello-embed/lib/ingest.ts +128 -0
- package/vendor/server/skeleton/nodes/hello-embed/lib/paths.test.ts +20 -0
- package/vendor/server/skeleton/nodes/hello-embed/lib/paths.ts +70 -0
- package/vendor/server/skeleton/nodes/hello-embed/lib/schema.ts +21 -0
- package/vendor/server/skeleton/nodes/hello-embed/lib/search.ts +254 -0
- package/vendor/server/skeleton/nodes/hello-embed/lib/text-embedder.ts +14 -0
- package/vendor/server/skeleton/nodes/hello-embed/lib/vectors.ts +126 -0
- package/vendor/server/skeleton/nodes/hello-embed/lib/walk-markdown.test.ts +62 -0
- package/vendor/server/skeleton/nodes/hello-embed/lib/walk-markdown.ts +67 -0
- package/vendor/server/skeleton/nodes/hello-embed/package.json +11 -0
- package/vendor/server/skeleton/nodes/hello-embed/search-handle.ts +119 -0
- package/vendor/server/skeleton/nodes/hello-embed/search.ts +98 -0
- package/vendor/server/skeleton/nodes/hello-embed/tsconfig.json +14 -0
- package/vendor/server/skeleton/nodes/my-nodes/README.md +13 -3
- package/vendor/server/skeleton/nodes/my-nodes/package.json +1 -1
- package/vendor/server/skeleton/schemas/langflower-config.schema.json +4 -0
- package/vendor/server/skeleton/skills/langflower-helper/SKILL.md +125 -38
- package/vendor/server/skeleton/skills/langflower-helper/architecture.md +17 -6
- package/vendor/server/skeleton/skills/langflower-helper/layout.md +24 -17
- package/vendor/server/skeleton/skills/langflower-node-writer/SKILL.md +8 -1
- 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-ingest.json +88 -0
- package/vendor/server/skeleton/workflows/kb-manual-search.json +105 -0
- package/vendor/server/skeleton/workflows/kb-navigate.json +8 -22
- package/vendor/server/skeleton/workflows/kb-rag.json +192 -0
- package/vendor/server/skeleton/workflows/kb-tool.json +111 -0
- 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-bus-config.d.ts +22 -6
- package/vendor/shared/dist/langflower-bus-config.js +23 -7
- package/vendor/shared/dist/langflower-config/merge-langflower-config-layers.test.js +8 -0
- package/vendor/shared/dist/langflower-config/settings-draft.d.ts +5 -0
- package/vendor/shared/dist/langflower-config/settings-draft.js +15 -7
- package/vendor/shared/dist/langflower-ws-waits.d.ts +3 -1
- package/vendor/shared/dist/langflower-ws-waits.js +2 -2
- package/vendor/shared/dist/langflower.d.ts +1 -1
- package/vendor/shared/dist/langflower.js +1 -1
- package/vendor/shared/dist/types/langflower-bootstrap.d.ts +6 -0
- package/vendor/shared/dist/types/langflower-config.d.ts +17 -0
- package/vendor/shared/dist/types/langflower-palette.d.ts +2 -1
- package/vendor/tools/dist/harness-types.d.ts +1 -1
- package/vendor/tools/dist/mcp/build-mcp-handle.d.ts +3 -21
- package/vendor/tools/dist/mcp/build-mcp-handle.js +2 -11
- package/vendor/tools/dist/mcp/create-system-mcp-handles.d.ts +9 -6
- package/vendor/tools/dist/mcp/create-system-mcp-handles.js +21 -17
- package/vendor/tools/package.json +1 -0
- package/ui-dist/chunk-MDGXX73Z.js +0 -4
- package/ui-dist/main-2JJGCNTD.js +0 -313
- package/ui-dist/styles-EOXODOI7.css +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EMPTY, concat, filter, from, map, mergeScan, of, scan, startWith, switchMap, throwError, } from 'rxjs';
|
|
2
|
-
const isBlankTurn = (raw) => raw === null ||
|
|
2
|
+
export const isBlankTurn = (raw) => raw === null ||
|
|
3
3
|
raw === undefined ||
|
|
4
4
|
(typeof raw === 'string' && raw.trim().length === 0);
|
|
5
5
|
const readHistorySync = (chunk) => {
|
|
@@ -63,7 +63,7 @@ const denyMaxFeedbackTurns = (state, maxFeedbackTurns) => {
|
|
|
63
63
|
},
|
|
64
64
|
}), throwError(() => message));
|
|
65
65
|
};
|
|
66
|
-
const runTurnFromState = (context, state, raw, primeTurn0, runTurn) => {
|
|
66
|
+
export const runTurnFromState = (context, state, raw, primeTurn0, runTurn) => {
|
|
67
67
|
if (!state.turn0Done) {
|
|
68
68
|
if (!primeTurn0 && isBlankTurn(raw)) {
|
|
69
69
|
return EMPTY;
|
|
@@ -4,7 +4,6 @@ import type { Harness } from '@langflower/tools/create-project-harness';
|
|
|
4
4
|
import type { ToolHandlerContext } from '@langflower/tools/domain-tool-configs';
|
|
5
5
|
import type { Observable } from 'rxjs';
|
|
6
6
|
import type { ChatCompletionMessage, CreateChatCompletionStream } from '../chat-completion-stream.js';
|
|
7
|
-
import type { SubAgentRegistration } from '../sub-agent-protocol.js';
|
|
8
7
|
import type { LlmCompactionConfig } from '../openai/normalize-compaction-params.js';
|
|
9
8
|
import { type LlmRecoveryPolicy } from '../llm-loop/llm-loop-types.js';
|
|
10
9
|
import { type SharedLlmLoopChunk } from '../llm-loop/run-llm-loop.js';
|
|
@@ -27,9 +26,7 @@ export declare const runPathChoiceToolLoop: (args: {
|
|
|
27
26
|
readonly tools?: readonly ToolHandle[];
|
|
28
27
|
readonly harness?: Harness;
|
|
29
28
|
readonly toolCtx?: ToolHandlerContext;
|
|
30
|
-
readonly subagentRegistrations?: readonly SubAgentRegistration[];
|
|
31
29
|
readonly compaction?: LlmCompactionConfig;
|
|
32
30
|
readonly recovery?: LlmRecoveryPolicy;
|
|
33
31
|
readonly steerControl$?: Observable<SteerControlPayload>;
|
|
34
|
-
readonly waitForSubagentResult?: (callId: string, signal: AbortSignal) => Promise<string>;
|
|
35
32
|
}) => Observable<ReviewLoopChunk>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseToolArgs, previewToolLogText, toChatToolDefinitions, } from '../../../tools/inventory-tool-round.js';
|
|
2
2
|
import { DISABLED_COMPACTION_CONFIG } from '../openai/normalize-compaction-params.js';
|
|
3
3
|
import { DEFAULT_LLM_RECOVERY_POLICY, } from '../llm-loop/llm-loop-types.js';
|
|
4
4
|
import { runLlmLoop, } from '../llm-loop/run-llm-loop.js';
|
|
@@ -73,7 +73,6 @@ const PATH_CHOICE_POLICY = {
|
|
|
73
73
|
};
|
|
74
74
|
export const runPathChoiceToolLoop = (args) => {
|
|
75
75
|
const inventory = args.tools ?? [];
|
|
76
|
-
const subagentRegistrations = args.subagentRegistrations ?? [];
|
|
77
76
|
return runLlmLoop({
|
|
78
77
|
factory: args.factory,
|
|
79
78
|
providerId: args.providerId,
|
|
@@ -81,26 +80,14 @@ export const runPathChoiceToolLoop = (args) => {
|
|
|
81
80
|
messages: args.messages,
|
|
82
81
|
maxIterations: args.maxIterations,
|
|
83
82
|
inventoryTools: inventory,
|
|
84
|
-
chatTools: [
|
|
85
|
-
...REVIEW_CHAT_TOOLS,
|
|
86
|
-
...toChatToolDefinitions(inventory),
|
|
87
|
-
...(subagentRegistrations.length > 0
|
|
88
|
-
? [buildSpawnSubagentChatTool(subagentRegistrations)]
|
|
89
|
-
: []),
|
|
90
|
-
],
|
|
83
|
+
chatTools: [...REVIEW_CHAT_TOOLS, ...toChatToolDefinitions(inventory)],
|
|
91
84
|
compaction: args.compaction ?? DISABLED_COMPACTION_CONFIG,
|
|
92
85
|
recovery: args.recovery ?? DEFAULT_LLM_RECOVERY_POLICY,
|
|
93
86
|
policy: PATH_CHOICE_POLICY,
|
|
94
|
-
subagentRegistrations,
|
|
95
87
|
...(args.harness !== undefined ? { harness: args.harness } : {}),
|
|
96
88
|
...(args.toolCtx !== undefined ? { toolCtx: args.toolCtx } : {}),
|
|
97
89
|
...(args.steerControl$ !== undefined
|
|
98
90
|
? { steerControl$: args.steerControl$ }
|
|
99
91
|
: {}),
|
|
100
|
-
...(args.waitForSubagentResult !== undefined
|
|
101
|
-
? {
|
|
102
|
-
waitForSubagentResult: args.waitForSubagentResult,
|
|
103
|
-
}
|
|
104
|
-
: {}),
|
|
105
92
|
});
|
|
106
93
|
};
|
|
@@ -8,10 +8,12 @@ import type { ToolInvokeCall } from '@langflower/tools/create-project-harness';
|
|
|
8
8
|
import type { ToolHandlerContext } from '@langflower/tools/domain-tool-configs';
|
|
9
9
|
import type { PermissionAskRequest } from '@langflower/tools/permission';
|
|
10
10
|
import type { CreateChatCompletionStream } from './chat-completion-stream.js';
|
|
11
|
+
import type { CreateEmbedding } from '../../embeddings/create-embedding.js';
|
|
11
12
|
export declare const runHostServicesSymbol: unique symbol;
|
|
12
13
|
export type LangflowerBusRequest = (intent: string, payload: unknown) => Promise<unknown>;
|
|
13
14
|
export type RunHostServices = {
|
|
14
15
|
readonly createChatCompletionStream?: CreateChatCompletionStream;
|
|
16
|
+
readonly createEmbedding?: CreateEmbedding;
|
|
15
17
|
readonly skillMarkdown?: string;
|
|
16
18
|
readonly agentsMarkdown?: string;
|
|
17
19
|
/**
|
|
@@ -22,6 +24,14 @@ export type RunHostServices = {
|
|
|
22
24
|
readonly providerId: string;
|
|
23
25
|
readonly model: string;
|
|
24
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Parsed effective `LangflowerConfig.embedding` (`providerId/modelId`).
|
|
29
|
+
* Empty embed-node `providerId` / `model` params fall back to these.
|
|
30
|
+
*/
|
|
31
|
+
readonly defaultEmbedding?: {
|
|
32
|
+
readonly providerId: string;
|
|
33
|
+
readonly model: string;
|
|
34
|
+
};
|
|
25
35
|
readonly authorize?: (call: ToolInvokeCall) => Promise<'allow' | 'deny'>;
|
|
26
36
|
/**
|
|
27
37
|
* Direct HITL ask (tool gates + agent limit continue). Bypasses permission
|
|
@@ -37,3 +37,4 @@ export declare const isSubAgentSpawnPayload: (value: unknown) => value is SubAge
|
|
|
37
37
|
export declare const isSubAgentResultPayload: (value: unknown) => value is SubAgentResultPayload;
|
|
38
38
|
/** Flatten multi-wire combine values (single reg or arrays). */
|
|
39
39
|
export declare const flattenSubAgentRegistrations: (wired: unknown) => readonly SubAgentRegistration[];
|
|
40
|
+
//# sourceMappingURL=sub-agent-protocol.d.ts.map
|
|
@@ -17,7 +17,7 @@ export declare const llmRecoveryUiSchema: readonly [{
|
|
|
17
17
|
readonly field: "subagentTimeoutMs";
|
|
18
18
|
readonly type: "number";
|
|
19
19
|
readonly label: "Sub-Agent timeout (ms, 0 disables)";
|
|
20
|
-
readonly default:
|
|
20
|
+
readonly default: number;
|
|
21
21
|
readonly min: 0;
|
|
22
22
|
readonly step: 1;
|
|
23
23
|
}, {
|
|
@@ -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 {
|
|
@@ -109,7 +101,11 @@ export const critiqueNode = defineLlmNode({
|
|
|
109
101
|
type: 'common-critique',
|
|
110
102
|
displayName: 'Critique',
|
|
111
103
|
category: 'AI',
|
|
112
|
-
description:
|
|
104
|
+
description: `
|
|
105
|
+
Attack the work against the original assignment. **Accept** when it is good enough, or send **feedback** with findings.
|
|
106
|
+
|
|
107
|
+
Wire the assignment on the first input and the packet to critique on the second. Needs a model that can call tools.
|
|
108
|
+
`.trim(),
|
|
113
109
|
uiSchema: [
|
|
114
110
|
...llmPanelUiSchema.filter((item) => item.field !== 'maxIterations'),
|
|
115
111
|
llmMaxIterationsUiField(DEFAULT_PATH_CHOICE_MAX_ITERATIONS, PATH_CHOICE_MAX_ITERATIONS_CAP),
|
|
@@ -117,7 +113,7 @@ export const critiqueNode = defineLlmNode({
|
|
|
117
113
|
...llmRecoveryUiSchema,
|
|
118
114
|
],
|
|
119
115
|
bind(ctx, { makeInput, configureOutput, combineInputs }, inventory) {
|
|
120
|
-
const { tools,
|
|
116
|
+
const { tools, steerControl } = inventory;
|
|
121
117
|
const assignment = makeInput('assignment', {
|
|
122
118
|
name: 'assignment',
|
|
123
119
|
wireType: 'string',
|
|
@@ -137,7 +133,7 @@ export const critiqueNode = defineLlmNode({
|
|
|
137
133
|
defaultValue: '',
|
|
138
134
|
});
|
|
139
135
|
// Init peers only — packet is the session turn driver (ADR-016).
|
|
140
|
-
const context$ = combineInputs([assignment, systemPrompt, tools,
|
|
136
|
+
const context$ = combineInputs([assignment, systemPrompt, tools, ctx], ([assignmentValue, systemPromptValue, toolList, ec]) => {
|
|
141
137
|
const rolePreset = parseLlmRolePreset(ec.params.rolePreset);
|
|
142
138
|
const skillId = resolveEffectiveSkillId(rolePreset, ec.params.skillId);
|
|
143
139
|
const hostServices = getRunHostServices(ec);
|
|
@@ -169,10 +165,7 @@ export const critiqueNode = defineLlmNode({
|
|
|
169
165
|
tools: collectAgentToolHandles({
|
|
170
166
|
toolHandles: ec.toolHandles,
|
|
171
167
|
toolsPort: toolList,
|
|
172
|
-
mcpHandles: ec.mcpHandles,
|
|
173
|
-
mcpPort: mcpList,
|
|
174
168
|
}),
|
|
175
|
-
subagentRegistrations: flattenSubAgentRegistrations(subagentList),
|
|
176
169
|
toolCtx: {
|
|
177
170
|
projectDir: ec.projectDir,
|
|
178
171
|
runId: ec.runId,
|
|
@@ -198,7 +191,7 @@ export const critiqueNode = defineLlmNode({
|
|
|
198
191
|
trackAssistantHistory: false,
|
|
199
192
|
appendUserFeedbackToHistory: false,
|
|
200
193
|
session: undefined,
|
|
201
|
-
}), (context, turnPayload, history) => runCritiqueTurn(context, String(turnPayload ?? ''), history
|
|
194
|
+
}), (context, turnPayload, history) => runCritiqueTurn(context, String(turnPayload ?? ''), history), { primeTurn0: false });
|
|
202
195
|
const reasoning$ = cycle$.pipeValue(demuxByKind('reasoning', (chunk) => chunk
|
|
203
196
|
.text));
|
|
204
197
|
const draftResponse$ = cycle$.pipeValue(demuxByKind('draftResponse', (chunk) => chunk
|
|
@@ -212,8 +205,6 @@ export const critiqueNode = defineLlmNode({
|
|
|
212
205
|
.result));
|
|
213
206
|
const feedback$ = cycle$.pipeValue(demuxByKind('feedback', (chunk) => chunk
|
|
214
207
|
.notes));
|
|
215
|
-
const subagent$ = cycle$.pipeValue(demuxByKind('subagentSpawn', (chunk) => chunk
|
|
216
|
-
.payload));
|
|
217
208
|
return {
|
|
218
209
|
inputs: [assignment, packet, systemPrompt],
|
|
219
210
|
outputs: [
|
|
@@ -234,7 +225,7 @@ export const critiqueNode = defineLlmNode({
|
|
|
234
225
|
feed: { role: 'result' },
|
|
235
226
|
}),
|
|
236
227
|
],
|
|
237
|
-
inventoryOutputs: { toolLog$, recovery
|
|
228
|
+
inventoryOutputs: { toolLog$, recovery$ },
|
|
238
229
|
};
|
|
239
230
|
},
|
|
240
231
|
});
|
|
@@ -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) =>
|
|
@@ -151,7 +144,13 @@ export const fakeLlmNode = defineLlmNode({
|
|
|
151
144
|
type: 'common-fake-llm',
|
|
152
145
|
displayName: 'Fake LLM',
|
|
153
146
|
category: 'AI',
|
|
154
|
-
description:
|
|
147
|
+
description: `
|
|
148
|
+
Demo stand-in for a real model. Streams reasoning, then a reply — no API key needed.
|
|
149
|
+
|
|
150
|
+
Typical uses:
|
|
151
|
+
- Smoke-test a graph
|
|
152
|
+
- Scripted tool calls in CI
|
|
153
|
+
`.trim(),
|
|
155
154
|
uiSchema: [
|
|
156
155
|
...llmPanelUiSchema,
|
|
157
156
|
...llmRecoveryUiSchema,
|
|
@@ -193,13 +192,13 @@ export const fakeLlmNode = defineLlmNode({
|
|
|
193
192
|
session: resolveSessionFactory(context),
|
|
194
193
|
};
|
|
195
194
|
},
|
|
196
|
-
runTurn: (context, feedback, history,
|
|
195
|
+
runTurn: (context, feedback, history, sessionFactory) => {
|
|
197
196
|
const bundle = {
|
|
198
197
|
...context,
|
|
199
198
|
feedback: feedback ?? '',
|
|
200
199
|
};
|
|
201
200
|
if (sessionFactory !== undefined) {
|
|
202
|
-
return runFakeToolLoopCycle(bundle, history, sessionFactory
|
|
201
|
+
return runFakeToolLoopCycle(bundle, history, sessionFactory);
|
|
203
202
|
}
|
|
204
203
|
return runFakeImitateCycle(bundle);
|
|
205
204
|
},
|
|
@@ -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
|
/**
|
|
@@ -61,7 +54,11 @@ export const openAiLlmNode = defineLlmNode({
|
|
|
61
54
|
type: 'common-openai-llm',
|
|
62
55
|
displayName: 'OpenAI-compatible LLM',
|
|
63
56
|
category: 'AI',
|
|
64
|
-
description:
|
|
57
|
+
description: `
|
|
58
|
+
Talk to an OpenAI-compatible model. Pick provider, model, and role in the inspector.
|
|
59
|
+
|
|
60
|
+
Wire tools and skills so the model can search, edit files, or call specialists. The reply streams in the work log.
|
|
61
|
+
`.trim(),
|
|
65
62
|
uiSchema: [
|
|
66
63
|
...llmPanelUiSchema,
|
|
67
64
|
...llmCompactionUiSchema,
|
|
@@ -85,7 +82,7 @@ export const openAiLlmNode = defineLlmNode({
|
|
|
85
82
|
appendUserFeedbackToHistory: true,
|
|
86
83
|
session: undefined,
|
|
87
84
|
}),
|
|
88
|
-
runTurn: (context, feedback, history
|
|
85
|
+
runTurn: (context, feedback, history) => runOpenAiTurn(context, history, feedback),
|
|
89
86
|
});
|
|
90
87
|
},
|
|
91
88
|
});
|
|
@@ -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 {
|
|
@@ -112,7 +104,13 @@ export const reviewNode = defineLlmNode({
|
|
|
112
104
|
type: 'common-review',
|
|
113
105
|
displayName: 'Review',
|
|
114
106
|
category: 'AI',
|
|
115
|
-
description:
|
|
107
|
+
description: `
|
|
108
|
+
A reviewer that must **accept** the work or send **feedback**. Needs a model that can call tools.
|
|
109
|
+
|
|
110
|
+
Typical uses:
|
|
111
|
+
- Gate a draft before the next stage
|
|
112
|
+
- Optional extra tools or Sub-Agents for the reviewer to use first
|
|
113
|
+
`.trim(),
|
|
116
114
|
uiSchema: [
|
|
117
115
|
...llmPanelUiSchema.filter((item) => item.field !== 'maxIterations'),
|
|
118
116
|
llmMaxIterationsUiField(DEFAULT_PATH_CHOICE_MAX_ITERATIONS, PATH_CHOICE_MAX_ITERATIONS_CAP),
|
|
@@ -120,7 +118,7 @@ export const reviewNode = defineLlmNode({
|
|
|
120
118
|
...llmRecoveryUiSchema,
|
|
121
119
|
],
|
|
122
120
|
bind(ctx, { makeInput, configureOutput, combineInputs }, inventory) {
|
|
123
|
-
const { tools,
|
|
121
|
+
const { tools, steerControl } = inventory;
|
|
124
122
|
const task = makeInput('task', {
|
|
125
123
|
name: 'task',
|
|
126
124
|
wireType: 'string',
|
|
@@ -140,7 +138,7 @@ export const reviewNode = defineLlmNode({
|
|
|
140
138
|
defaultValue: '',
|
|
141
139
|
});
|
|
142
140
|
// Init peers only — result is the session turn driver (ADR-016).
|
|
143
|
-
const context$ = combineInputs([task, systemPrompt, tools,
|
|
141
|
+
const context$ = combineInputs([task, systemPrompt, tools, ctx], ([taskValue, systemPromptValue, toolList, ec]) => {
|
|
144
142
|
const rolePreset = parseLlmRolePreset(ec.params.rolePreset);
|
|
145
143
|
const skillId = resolveEffectiveSkillId(rolePreset, ec.params.skillId);
|
|
146
144
|
const hostServices = getRunHostServices(ec);
|
|
@@ -172,10 +170,7 @@ export const reviewNode = defineLlmNode({
|
|
|
172
170
|
tools: collectAgentToolHandles({
|
|
173
171
|
toolHandles: ec.toolHandles,
|
|
174
172
|
toolsPort: toolList,
|
|
175
|
-
mcpHandles: ec.mcpHandles,
|
|
176
|
-
mcpPort: mcpList,
|
|
177
173
|
}),
|
|
178
|
-
subagentRegistrations: flattenSubAgentRegistrations(subagentList),
|
|
179
174
|
toolCtx: {
|
|
180
175
|
projectDir: ec.projectDir,
|
|
181
176
|
runId: ec.runId,
|
|
@@ -201,7 +196,7 @@ export const reviewNode = defineLlmNode({
|
|
|
201
196
|
trackAssistantHistory: false,
|
|
202
197
|
appendUserFeedbackToHistory: false,
|
|
203
198
|
session: undefined,
|
|
204
|
-
}), (context, turnPayload, history) => runReviewTurn(context, String(turnPayload ?? ''), history
|
|
199
|
+
}), (context, turnPayload, history) => runReviewTurn(context, String(turnPayload ?? ''), history), { primeTurn0: false });
|
|
205
200
|
const reasoning$ = cycle$.pipeValue(demuxByKind('reasoning', (chunk) => chunk.text));
|
|
206
201
|
const draftResponse$ = cycle$.pipeValue(demuxByKind('draftResponse', (chunk) => chunk
|
|
207
202
|
.text));
|
|
@@ -212,8 +207,6 @@ export const reviewNode = defineLlmNode({
|
|
|
212
207
|
}));
|
|
213
208
|
const response$ = cycle$.pipeValue(demuxByKind('accept', (chunk) => chunk.result));
|
|
214
209
|
const feedback$ = cycle$.pipeValue(demuxByKind('feedback', (chunk) => chunk.notes));
|
|
215
|
-
const subagent$ = cycle$.pipeValue(demuxByKind('subagentSpawn', (chunk) => chunk
|
|
216
|
-
.payload));
|
|
217
210
|
return {
|
|
218
211
|
inputs: [task, result, systemPrompt],
|
|
219
212
|
outputs: [
|
|
@@ -234,7 +227,7 @@ export const reviewNode = defineLlmNode({
|
|
|
234
227
|
feed: { role: 'result' },
|
|
235
228
|
}),
|
|
236
229
|
],
|
|
237
|
-
inventoryOutputs: { toolLog$, recovery
|
|
230
|
+
inventoryOutputs: { toolLog$, recovery$ },
|
|
238
231
|
};
|
|
239
232
|
},
|
|
240
233
|
});
|
|
@@ -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
|
}, {
|