langflower 0.0.8 → 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/{chunk-Y6VMBLSJ.js → chunk-7UMVYN3A.js} +1 -1
- package/ui-dist/{chunk-6DQ2XSRW.js → chunk-MDGXX73Z.js} +3 -3
- 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/chat-completion-stream.d.ts +2 -0
- package/vendor/common-nodes/dist/ai/critique/node.d.ts +246 -0
- package/vendor/common-nodes/dist/ai/critique/node.js +2 -2
- package/vendor/common-nodes/dist/ai/fake-llm/node.d.ts +246 -0
- package/vendor/common-nodes/dist/ai/features/chat-completion-stream.d.ts +53 -0
- package/vendor/common-nodes/dist/ai/features/chat-completion-stream.js +1 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/autokick-recovery.d.ts +13 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/autokick-recovery.js +17 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/classify-llm-failure.d.ts +2 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/classify-llm-failure.js +113 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/dead-loop-detector.d.ts +28 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/dead-loop-detector.js +194 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/live-get-tools.d.ts +9 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/live-get-tools.js +21 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/llm-loop-reducer.d.ts +2 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/llm-loop-reducer.js +204 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/llm-loop-types.d.ts +120 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/llm-loop-types.js +39 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/normalize-llm-recovery-policy.d.ts +2 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/normalize-llm-recovery-policy.js +59 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/operators/normalize-tool-result.d.ts +1 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/operators/normalize-tool-result.js +7 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/operators/observe-provider-stream.d.ts +43 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/operators/observe-provider-stream.js +96 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/run-agent-loop.d.ts +29 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/run-agent-loop.js +44 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/run-llm-loop.d.ts +74 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/run-llm-loop.js +658 -0
- package/vendor/common-nodes/dist/ai/features/llm-role-preset.d.ts +69 -0
- package/vendor/common-nodes/dist/ai/features/llm-role-preset.js +265 -0
- package/vendor/common-nodes/dist/ai/features/llm-session/llm-session-shell.d.ts +141 -0
- package/vendor/common-nodes/dist/ai/features/llm-session/llm-session-shell.js +193 -0
- package/vendor/common-nodes/dist/ai/features/llm-session/run-session-machine.d.ts +21 -0
- package/vendor/common-nodes/dist/ai/features/llm-session/run-session-machine.js +118 -0
- package/vendor/common-nodes/dist/ai/features/openai/context-length-error.d.ts +14 -0
- package/vendor/common-nodes/dist/ai/features/openai/context-length-error.js +63 -0
- package/vendor/common-nodes/dist/ai/features/openai/create-chat-completion-stream.d.ts +19 -0
- package/vendor/common-nodes/dist/ai/features/openai/create-chat-completion-stream.js +182 -0
- package/vendor/common-nodes/dist/ai/features/openai/list-provider-models.d.ts +28 -0
- package/vendor/common-nodes/dist/ai/features/openai/list-provider-models.js +52 -0
- package/vendor/common-nodes/dist/ai/features/openai/llm-context-compaction.d.ts +31 -0
- package/vendor/common-nodes/dist/ai/features/openai/llm-context-compaction.js +326 -0
- package/vendor/common-nodes/dist/ai/features/openai/normalize-compaction-params.d.ts +14 -0
- package/vendor/common-nodes/dist/ai/features/openai/normalize-compaction-params.js +21 -0
- package/vendor/common-nodes/dist/ai/features/openai/prepare-chat-completion.d.ts +30 -0
- package/vendor/common-nodes/dist/ai/features/openai/prepare-chat-completion.js +132 -0
- package/vendor/common-nodes/dist/ai/features/path-choice/control-tools.d.ts +20 -0
- package/vendor/common-nodes/dist/ai/features/path-choice/control-tools.js +70 -0
- package/vendor/common-nodes/dist/ai/features/path-choice/run-reactive-path-choice-loop.d.ts +32 -0
- package/vendor/common-nodes/dist/ai/features/path-choice/run-reactive-path-choice-loop.js +93 -0
- package/vendor/common-nodes/dist/ai/features/prompt/build-effective-system-prompt.d.ts +9 -0
- package/vendor/common-nodes/dist/ai/features/prompt/build-effective-system-prompt.js +21 -0
- package/vendor/common-nodes/dist/ai/features/prompt/normalize-max-iterations.d.ts +13 -0
- package/vendor/common-nodes/dist/ai/features/prompt/normalize-max-iterations.js +23 -0
- package/vendor/common-nodes/dist/ai/features/prompt/resolve-chat-provider-model.d.ts +10 -0
- package/vendor/common-nodes/dist/ai/features/prompt/resolve-chat-provider-model.js +8 -0
- package/vendor/common-nodes/dist/ai/features/run-host-services.d.ts +54 -0
- package/vendor/common-nodes/dist/ai/features/run-host-services.js +29 -0
- package/vendor/common-nodes/dist/ai/features/scripted-chat-completion-stream.d.ts +17 -0
- package/vendor/common-nodes/dist/ai/features/scripted-chat-completion-stream.js +61 -0
- package/vendor/common-nodes/dist/ai/features/sub-agent-protocol.d.ts +40 -0
- package/vendor/common-nodes/dist/ai/features/sub-agent-protocol.js +44 -0
- package/vendor/common-nodes/dist/ai/features/ui-schema/llm-compaction-ui-schema.d.ts +14 -0
- package/vendor/common-nodes/dist/ai/features/ui-schema/llm-compaction-ui-schema.js +18 -0
- package/vendor/common-nodes/dist/ai/features/ui-schema/llm-panel-ui-schema.d.ts +80 -0
- package/vendor/common-nodes/dist/ai/features/ui-schema/llm-panel-ui-schema.js +76 -0
- package/vendor/common-nodes/dist/ai/features/ui-schema/llm-recovery-ui-schema.d.ts +113 -0
- package/vendor/common-nodes/dist/ai/features/ui-schema/llm-recovery-ui-schema.js +131 -0
- package/vendor/common-nodes/dist/ai/features/wait-for-subagent-result.d.ts +7 -0
- package/vendor/common-nodes/dist/ai/features/wait-for-subagent-result.js +31 -0
- package/vendor/common-nodes/dist/ai/llm-loop/autokick-recovery.d.ts +13 -0
- package/vendor/common-nodes/dist/ai/llm-loop/autokick-recovery.js +17 -0
- package/vendor/common-nodes/dist/ai/llm-loop/dead-loop-detector.d.ts +28 -0
- package/vendor/common-nodes/dist/ai/llm-loop/dead-loop-detector.js +194 -0
- package/vendor/common-nodes/dist/ai/llm-loop/llm-loop-reducer.js +36 -0
- package/vendor/common-nodes/dist/ai/llm-loop/llm-loop-types.d.ts +35 -0
- package/vendor/common-nodes/dist/ai/llm-loop/llm-loop-types.js +19 -0
- package/vendor/common-nodes/dist/ai/llm-loop/normalize-llm-recovery-policy.js +52 -9
- package/vendor/common-nodes/dist/ai/llm-loop/operators/observe-provider-stream.d.ts +8 -2
- package/vendor/common-nodes/dist/ai/llm-loop/operators/observe-provider-stream.js +43 -13
- package/vendor/common-nodes/dist/ai/llm-loop/run-llm-loop.d.ts +3 -5
- package/vendor/common-nodes/dist/ai/llm-loop/run-llm-loop.js +116 -1
- package/vendor/common-nodes/dist/ai/llm-recovery-ui-schema.d.ts +82 -0
- package/vendor/common-nodes/dist/ai/llm-recovery-ui-schema.js +95 -0
- package/vendor/common-nodes/dist/ai/llm-session-shell.d.ts +4 -9
- package/vendor/common-nodes/dist/ai/llm-session-shell.js +2 -4
- package/vendor/common-nodes/dist/ai/nodes/critique/node.d.ts +588 -0
- package/vendor/common-nodes/dist/ai/nodes/critique/node.js +227 -0
- package/vendor/common-nodes/dist/ai/nodes/fake-llm/node.d.ts +571 -0
- package/vendor/common-nodes/dist/ai/nodes/fake-llm/node.js +201 -0
- package/vendor/common-nodes/dist/ai/nodes/openai-llm/node.d.ts +587 -0
- package/vendor/common-nodes/dist/ai/nodes/openai-llm/node.js +84 -0
- package/vendor/common-nodes/dist/ai/nodes/review/node.d.ts +593 -0
- package/vendor/common-nodes/dist/ai/nodes/review/node.js +227 -0
- package/vendor/common-nodes/dist/ai/nodes/sub-agent/node.d.ts +630 -0
- package/vendor/common-nodes/dist/ai/nodes/sub-agent/node.js +417 -0
- package/vendor/common-nodes/dist/ai/openai/create-chat-completion-stream.js +6 -0
- package/vendor/common-nodes/dist/ai/openai/prepare-chat-completion.d.ts +2 -0
- package/vendor/common-nodes/dist/ai/openai/prepare-chat-completion.js +18 -0
- package/vendor/common-nodes/dist/ai/openai-llm/node.d.ts +246 -0
- package/vendor/common-nodes/dist/ai/review/node.d.ts +246 -0
- package/vendor/common-nodes/dist/ai/review/node.js +2 -2
- package/vendor/common-nodes/dist/ai/sub-agent/node.d.ts +246 -0
- package/vendor/common-nodes/dist/ai/sub-agent/node.js +2 -2
- package/vendor/common-nodes/dist/catalog.js +9 -5
- package/vendor/common-nodes/dist/compile-custom-nodes/node.d.ts +21 -0
- package/vendor/common-nodes/dist/compile-custom-nodes/node.js +45 -0
- package/vendor/common-nodes/dist/crawl/crawl/node.js +1 -1
- package/vendor/common-nodes/dist/crawl/fetch-url/node.js +1 -1
- package/vendor/common-nodes/dist/flow/repeat/node.js +6 -1
- package/vendor/common-nodes/dist/langflower-tools/emit-registration-tools.d.ts +18 -0
- package/vendor/common-nodes/dist/langflower-tools/emit-registration-tools.js +29 -0
- package/vendor/common-nodes/dist/langflower-tools/node.d.ts +20 -0
- package/vendor/common-nodes/dist/langflower-tools/node.js +77 -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/text/append-file/node.js +1 -1
- package/vendor/common-nodes/dist/text/read-file/node.js +1 -1
- package/vendor/common-nodes/dist/text/write-file/node.js +1 -1
- 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 +1 -11
- 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 +9 -13
- package/vendor/compiler/dist/compile-project-nodes.d.ts +2 -1
- package/vendor/compiler/dist/compile-project-nodes.js +35 -6
- package/vendor/compiler/dist/resolve-host-types.d.ts +0 -5
- package/vendor/compiler/dist/resolve-host-types.js +0 -8
- 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 +4 -6
- package/vendor/node-sdk/dist/node-factory/define-llm-node/define-llm-node.js +4 -6
- 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-llm-node/recovery-notice.d.ts +8 -0
- package/vendor/node-sdk/dist/node-factory/define-llm-node/recovery-notice.js +14 -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-editor.d.ts +5 -1
- package/vendor/runtime/dist/runtime-editor.js +19 -0
- package/vendor/runtime/dist/runtime-runner.d.ts +8 -3
- package/vendor/runtime/dist/runtime-runner.js +108 -87
- package/vendor/runtime/dist/runtime.d.ts +3 -1
- package/vendor/runtime/dist/runtime.js +1 -0
- package/vendor/runtime/dist/testing/workflows/workflow-events.d.ts +10 -6
- package/vendor/runtime/dist/testing/workflows/workflow-events.js +21 -31
- package/vendor/runtime/dist/types.d.ts +52 -40
- package/vendor/runtime/dist/types.js +5 -1
- package/vendor/runtime/package.json +1 -1
- package/vendor/server/dist/bridge/attach-langflower-bridge.js +3 -2
- package/vendor/server/dist/bridge/bridge-event-log.js +17 -102
- package/vendor/server/dist/bridge/build-execution-context.d.ts +5 -2
- package/vendor/server/dist/bridge/build-execution-context.js +48 -8
- package/vendor/server/dist/bridge/forward-runner-event.d.ts +1 -1
- package/vendor/server/dist/bridge/forward-runner-event.js +7 -12
- package/vendor/server/dist/bridge/get-live-wired-tools.d.ts +13 -0
- package/vendor/server/dist/bridge/get-live-wired-tools.js +83 -0
- package/vendor/server/dist/bridge/langflower-tools-rpc.d.ts +7 -0
- package/vendor/server/dist/bridge/langflower-tools-rpc.js +29 -0
- package/vendor/server/dist/bridge/wire-custom-palette-handlers.d.ts +2 -1
- package/vendor/server/dist/bridge/wire-custom-palette-handlers.js +3 -5
- package/vendor/server/dist/bridge/wire-runner-handlers.js +17 -10
- package/vendor/server/dist/bridge/wire-workflow-handlers.js +23 -9
- package/vendor/server/dist/checkpoint/run-checkpoint-session.d.ts +1 -1
- package/vendor/server/dist/checkpoint/run-checkpoint-session.js +10 -9
- package/vendor/server/dist/palette/compile-and-hot-swap-custom-nodes.d.ts +10 -0
- package/vendor/server/dist/palette/compile-and-hot-swap-custom-nodes.js +23 -0
- 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.d.ts +5 -0
- package/vendor/server/dist/workflow/apply-editor-mutation.js +32 -0
- package/vendor/server/skeleton/instructions.md +9 -5
- package/vendor/server/skeleton/nodes/my-nodes/README.md +4 -3
- package/vendor/server/skeleton/nodes/my-nodes/package.json +1 -1
- package/vendor/server/skeleton/skills/langflower-helper/SKILL.md +82 -38
- package/vendor/server/skeleton/skills/langflower-helper/architecture.md +29 -10
- package/vendor/server/skeleton/skills/langflower-helper/layout.md +16 -15
- package/vendor/server/skeleton/skills/langflower-node-writer/SKILL.md +19 -9
- package/vendor/server/skeleton/skills/langflower-workflow-writer/SKILL.md +23 -15
- 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 +35 -22
- package/vendor/shared/dist/execution/derive-run-settle-outcome.d.ts +1 -1
- package/vendor/shared/dist/execution/derive-run-settle-outcome.js +4 -3
- package/vendor/shared/dist/execution/derive-run-settle-outcome.test.js +18 -15
- package/vendor/shared/dist/langflower-bus-config.d.ts +6 -14
- package/vendor/shared/dist/langflower-bus-config.js +4 -12
- package/vendor/shared/dist/langflower-config/resolve-wired-tool-options.js +6 -0
- package/vendor/shared/dist/langflower-config/resolve-wired-tool-options.test.js +30 -0
- package/vendor/shared/dist/langflower-ws-waits.d.ts +9 -14
- package/vendor/shared/dist/langflower-ws-waits.js +14 -14
- package/vendor/websocket-bridge/dist/bridge-codec.d.ts +1 -0
- package/vendor/websocket-bridge/dist/bridge-codec.js +11 -11
- package/vendor/websocket-bridge/dist/bridge-frame.js +1 -1
- package/vendor/websocket-bridge/dist/bridge-subjects.d.ts +1 -1
- package/vendor/websocket-bridge/dist/bridge-subjects.js +2 -2
- package/vendor/websocket-bridge/dist/bridge-types.d.ts +13 -1
- package/vendor/websocket-bridge/dist/create-client.js +3 -3
- package/vendor/websocket-bridge/dist/create-server.js +12 -6
- package/vendor/websocket-bridge/package.json +8 -0
- package/ui-dist/main-ECEWAM6V.js +0 -311
- package/ui-dist/styles-EOXODOI7.css +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { defineReactiveNode } from '@langflower/node-sdk';
|
|
2
|
-
import { MCP_HANDLE_WIRE_TYPE } from '@langflower/node-sdk/mcp';
|
|
1
|
+
import { defineReactiveNode, TOOL_HANDLE_WIRE_TYPE, } from '@langflower/node-sdk';
|
|
3
2
|
import { buildMcpHandle } from '@langflower/tools/build-mcp-handle';
|
|
4
3
|
import { formatMcpConnectError } from '@langflower/tools/format-mcp-connect-error';
|
|
5
4
|
import { connectMcpStdioFromCli } from '@langflower/tools/mcp-stdio-client';
|
|
@@ -10,16 +9,16 @@ const paramsKey = (params) => JSON.stringify({
|
|
|
10
9
|
command: params.command,
|
|
11
10
|
});
|
|
12
11
|
/**
|
|
13
|
-
* Owns stdio MCP connect/close; emits live {@link
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* silent EMPTY).
|
|
12
|
+
* Owns stdio MCP connect/close; emits live {@link ToolHandle}[] for LLM `tools`.
|
|
13
|
+
* Server name and tools come from MCP initialize / tools/list. Session stays
|
|
14
|
+
* in invoke closures. Connect/initialize/build failure → output port **error**
|
|
15
|
+
* (not silent EMPTY).
|
|
17
16
|
*/
|
|
18
17
|
export const mcpStdioNode = defineReactiveNode({
|
|
19
18
|
type: 'common-mcp-stdio',
|
|
20
19
|
displayName: 'MCP stdio',
|
|
21
20
|
category: 'Tools',
|
|
22
|
-
description: 'Launches an MCP server over stdio from a shell command line and emits
|
|
21
|
+
description: 'Launches an MCP server over stdio from a shell command line and emits its tools for LLM `tools` ports.',
|
|
23
22
|
uiSchema: [],
|
|
24
23
|
bind(ctx, { makeInput, configureOutput, combineInputs }) {
|
|
25
24
|
const command = makeInput('command', {
|
|
@@ -71,7 +70,7 @@ export const mcpStdioNode = defineReactiveNode({
|
|
|
71
70
|
await client.close();
|
|
72
71
|
return;
|
|
73
72
|
}
|
|
74
|
-
subscriber.next(handle);
|
|
73
|
+
subscriber.next(handle.tools);
|
|
75
74
|
};
|
|
76
75
|
void run().catch(fail);
|
|
77
76
|
return () => {
|
|
@@ -83,8 +82,8 @@ export const mcpStdioNode = defineReactiveNode({
|
|
|
83
82
|
return {
|
|
84
83
|
inputs: [command],
|
|
85
84
|
outputs: [
|
|
86
|
-
configureOutput('
|
|
87
|
-
wireType:
|
|
85
|
+
configureOutput('tools', handle$, {
|
|
86
|
+
wireType: TOOL_HANDLE_WIRE_TYPE,
|
|
88
87
|
}),
|
|
89
88
|
],
|
|
90
89
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineReactiveNode } from '@langflower/node-sdk';
|
|
2
2
|
import { createProjectFilesContext } from '@langflower/tools/create-project-files-context';
|
|
3
3
|
import { from, map, mergeMap, throwError } from 'rxjs';
|
|
4
|
-
import { getRunHostServices } from '../../ai/run-host-services.js';
|
|
4
|
+
import { getRunHostServices } from '../../ai/features/run-host-services.js';
|
|
5
5
|
/**
|
|
6
6
|
* Append to a project-relative text file via `createProjectFilesContext` (no permission ask).
|
|
7
7
|
* Non-empty files get `delimiter` between existing text and `content`.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineReactiveNode } from '@langflower/node-sdk';
|
|
2
2
|
import { createProjectFilesContext } from '@langflower/tools/create-project-files-context';
|
|
3
3
|
import { from, mergeMap, throwError } from 'rxjs';
|
|
4
|
-
import { getRunHostServices } from '../../ai/run-host-services.js';
|
|
4
|
+
import { getRunHostServices } from '../../ai/features/run-host-services.js';
|
|
5
5
|
/**
|
|
6
6
|
* Read a project-relative text file via `createProjectFilesContext` (no permission ask).
|
|
7
7
|
* Wire `update` (dynamic) to re-read when the path is unchanged.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineReactiveNode } from '@langflower/node-sdk';
|
|
2
2
|
import { createProjectFilesContext } from '@langflower/tools/create-project-files-context';
|
|
3
3
|
import { from, map, mergeMap, throwError } from 'rxjs';
|
|
4
|
-
import { getRunHostServices } from '../../ai/run-host-services.js';
|
|
4
|
+
import { getRunHostServices } from '../../ai/features/run-host-services.js';
|
|
5
5
|
/**
|
|
6
6
|
* Overwrite a project-relative text file via `createProjectFilesContext` (no permission ask).
|
|
7
7
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ToolHandle } from '@langflower/node-sdk';
|
|
2
|
-
|
|
2
|
+
/** Flatten multi-wire values that may be single handles or arrays (packs). */
|
|
3
|
+
export declare const flattenToolHandles: (wired: readonly unknown[]) => readonly ToolHandle[];
|
|
3
4
|
/**
|
|
4
|
-
* Agent inventory: EC ∪ port for tools
|
|
5
|
+
* Agent inventory: EC ∪ port for tools.
|
|
5
6
|
* No catalog list, no enabledToolIds filter (server already filtered EC).
|
|
7
|
+
* Later `toolHandles` last-wins on `toolId` (jsonc MCP after builtins).
|
|
6
8
|
*/
|
|
7
9
|
export declare const collectAgentToolHandles: (options: {
|
|
8
10
|
readonly toolHandles: readonly ToolHandle[] | undefined;
|
|
9
11
|
readonly toolsPort: unknown;
|
|
10
|
-
readonly mcpHandles: readonly McpHandle[] | undefined;
|
|
11
|
-
readonly mcpPort: unknown;
|
|
12
12
|
}) => readonly ToolHandle[];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { flattenMcpHandles } from '../mcp/flatten-mcp-handles.js';
|
|
2
1
|
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
3
2
|
const isToolHandle = (value) => {
|
|
4
3
|
if (!isRecord(value)) {
|
|
@@ -12,7 +11,7 @@ const isToolHandle = (value) => {
|
|
|
12
11
|
typeof value.invoke === 'function');
|
|
13
12
|
};
|
|
14
13
|
/** Flatten multi-wire values that may be single handles or arrays (packs). */
|
|
15
|
-
const flattenToolHandles = (wired) => wired.flatMap((item) => {
|
|
14
|
+
export const flattenToolHandles = (wired) => wired.flatMap((item) => {
|
|
16
15
|
if (Array.isArray(item)) {
|
|
17
16
|
return item.filter(isToolHandle);
|
|
18
17
|
}
|
|
@@ -22,8 +21,9 @@ const flattenToolHandles = (wired) => wired.flatMap((item) => {
|
|
|
22
21
|
return [];
|
|
23
22
|
});
|
|
24
23
|
/**
|
|
25
|
-
* Agent inventory: EC ∪ port for tools
|
|
24
|
+
* Agent inventory: EC ∪ port for tools.
|
|
26
25
|
* No catalog list, no enabledToolIds filter (server already filtered EC).
|
|
26
|
+
* Later `toolHandles` last-wins on `toolId` (jsonc MCP after builtins).
|
|
27
27
|
*/
|
|
28
28
|
export const collectAgentToolHandles = (options) => {
|
|
29
29
|
const portTools = Array.isArray(options.toolsPort)
|
|
@@ -38,13 +38,5 @@ export const collectAgentToolHandles = (options) => {
|
|
|
38
38
|
for (const handle of options.toolHandles ?? []) {
|
|
39
39
|
byId.set(handle.toolId, handle);
|
|
40
40
|
}
|
|
41
|
-
for (const mcp of [
|
|
42
|
-
...(options.mcpHandles ?? []),
|
|
43
|
-
...flattenMcpHandles(options.mcpPort),
|
|
44
|
-
]) {
|
|
45
|
-
for (const handle of mcp.tools) {
|
|
46
|
-
byId.set(handle.toolId, handle);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
41
|
return [...byId.values()];
|
|
50
42
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { ToolHandle } from '@langflower/node-sdk';
|
|
2
2
|
import { type Harness } from '@langflower/tools/create-project-harness';
|
|
3
3
|
import type { ToolHandlerContext } from '@langflower/tools/domain-tool-configs';
|
|
4
|
-
import type { ChatCompletionToolCall, ChatCompletionToolDefinition } from '../ai/chat-completion-stream.js';
|
|
5
|
-
import type { SubAgentRegistration, SubAgentSpawnPayload } from '../ai/sub-agent-protocol.js';
|
|
6
|
-
export declare const SPAWN_SUBAGENT_TOOL = "spawn_subagent";
|
|
4
|
+
import type { ChatCompletionToolCall, ChatCompletionToolDefinition } from '../ai/features/chat-completion-stream.js';
|
|
7
5
|
export declare const previewToolLogText: (text: string) => string;
|
|
8
6
|
export declare const toChatToolDefinitions: (tools: readonly ToolHandle[]) => readonly ChatCompletionToolDefinition[];
|
|
9
7
|
export declare const parseToolArgs: (raw: string) => Readonly<Record<string, unknown>>;
|
|
@@ -20,11 +18,3 @@ export declare const invokeInventoryTool: (harness: Harness | undefined, tools:
|
|
|
20
18
|
readonly ok: boolean;
|
|
21
19
|
readonly text: string;
|
|
22
20
|
}>;
|
|
23
|
-
export declare const buildSpawnSubagentChatTool: (registrations: readonly SubAgentRegistration[]) => ChatCompletionToolDefinition;
|
|
24
|
-
export declare const resolveSpawnPayload: (call: ChatCompletionToolCall, registrations: readonly SubAgentRegistration[], openCallId: string | undefined) => {
|
|
25
|
-
readonly ok: true;
|
|
26
|
-
readonly payload: SubAgentSpawnPayload;
|
|
27
|
-
} | {
|
|
28
|
-
readonly ok: false;
|
|
29
|
-
readonly text: string;
|
|
30
|
-
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isBuiltinToolId, } from '@langflower/tools/create-project-harness';
|
|
2
2
|
import { formatPermissionDeniedText } from '@langflower/tools/permission';
|
|
3
|
-
export const SPAWN_SUBAGENT_TOOL = 'spawn_subagent';
|
|
4
3
|
const TOOL_LOG_PREVIEW = 400;
|
|
5
4
|
export const previewToolLogText = (text) => {
|
|
6
5
|
const trimmed = text.trim();
|
|
@@ -90,86 +89,3 @@ export const invokeInventoryTool = async (harness, tools, call, toolCtx, options
|
|
|
90
89
|
};
|
|
91
90
|
}
|
|
92
91
|
};
|
|
93
|
-
export const buildSpawnSubagentChatTool = (registrations) => {
|
|
94
|
-
const catalog = registrations
|
|
95
|
-
.map((reg) => {
|
|
96
|
-
const skills = reg.skills.length === 0
|
|
97
|
-
? 'none'
|
|
98
|
-
: reg.skills
|
|
99
|
-
.map((skill) => `${skill.skillId}${skill.description.length > 0 ? ` (${skill.description})` : ''}`)
|
|
100
|
-
.join(', ');
|
|
101
|
-
return `- nodeId=${reg.targetNodeId} name=${reg.name}: ${reg.description} skills=[${skills}]`;
|
|
102
|
-
})
|
|
103
|
-
.join('\n');
|
|
104
|
-
return {
|
|
105
|
-
type: 'function',
|
|
106
|
-
function: {
|
|
107
|
-
name: SPAWN_SUBAGENT_TOOL,
|
|
108
|
-
description: [
|
|
109
|
-
'Spawn one Sub-Agent on the canvas (sequential — wait for its result before another spawn).',
|
|
110
|
-
'Pick nodeId from the catalog. skillId may be empty if unused.',
|
|
111
|
-
'Catalog:',
|
|
112
|
-
catalog.length > 0 ? catalog : '(no Sub-Agents registered)',
|
|
113
|
-
].join('\n'),
|
|
114
|
-
parameters: {
|
|
115
|
-
type: 'object',
|
|
116
|
-
properties: {
|
|
117
|
-
nodeId: {
|
|
118
|
-
type: 'string',
|
|
119
|
-
description: 'targetNodeId of the Sub-Agent to spawn',
|
|
120
|
-
},
|
|
121
|
-
skillId: {
|
|
122
|
-
type: 'string',
|
|
123
|
-
description: 'Optional skill id announced by that Sub-Agent; empty if none',
|
|
124
|
-
},
|
|
125
|
-
task: {
|
|
126
|
-
type: 'string',
|
|
127
|
-
description: 'Task text for the Sub-Agent body',
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
required: ['nodeId', 'task'],
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
export const resolveSpawnPayload = (call, registrations, openCallId) => {
|
|
136
|
-
if (openCallId !== undefined) {
|
|
137
|
-
return {
|
|
138
|
-
ok: false,
|
|
139
|
-
text: `Serial spawn only: already waiting for callId=${openCallId}.`,
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
const args = parseToolArgs(call.arguments);
|
|
143
|
-
const nodeId = typeof args.nodeId === 'string' ? args.nodeId.trim() : '';
|
|
144
|
-
const task = typeof args.task === 'string' ? args.task : '';
|
|
145
|
-
const skillId = typeof args.skillId === 'string' ? args.skillId.trim() : '';
|
|
146
|
-
if (nodeId.length === 0) {
|
|
147
|
-
return { ok: false, text: 'spawn_subagent requires nodeId.' };
|
|
148
|
-
}
|
|
149
|
-
if (task.trim().length === 0) {
|
|
150
|
-
return { ok: false, text: 'spawn_subagent requires a non-empty task.' };
|
|
151
|
-
}
|
|
152
|
-
const target = registrations.find((reg) => reg.targetNodeId === nodeId);
|
|
153
|
-
if (target === undefined) {
|
|
154
|
-
return {
|
|
155
|
-
ok: false,
|
|
156
|
-
text: `Unknown Sub-Agent nodeId «${nodeId}» (not in subagentRegistration).`,
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
if (skillId.length > 0 &&
|
|
160
|
-
!target.skills.some((skill) => skill.skillId === skillId)) {
|
|
161
|
-
return {
|
|
162
|
-
ok: false,
|
|
163
|
-
text: `Skill «${skillId}» is not announced by Sub-Agent «${nodeId}».`,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
return {
|
|
167
|
-
ok: true,
|
|
168
|
-
payload: {
|
|
169
|
-
callId: call.id,
|
|
170
|
-
nodeId,
|
|
171
|
-
skillId,
|
|
172
|
-
task,
|
|
173
|
-
},
|
|
174
|
-
};
|
|
175
|
-
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional hub: combine many `tools` wires into one `ToolHandle[]`.
|
|
3
|
+
* Duplicate `toolId` last-wins (later slot). Empty / unwired → `[]`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const toolCollectionNode: {
|
|
6
|
+
readonly emitOncePerActivation: boolean;
|
|
7
|
+
readonly stopsRun: boolean;
|
|
8
|
+
readonly chatEntry: boolean;
|
|
9
|
+
readonly uiSchema: readonly [];
|
|
10
|
+
readonly bypassPorts: Record<string, import("@langflower/node-sdk").WireType>;
|
|
11
|
+
readonly inputsConfigs: readonly [import("@langflower/node-sdk").InputPortMeta<import("@langflower/node-sdk").ExecutionContext<readonly [], Record<string, never>>>, ...import("@langflower/node-sdk").InputPortMeta<unknown>[]];
|
|
12
|
+
readonly outputsConfigs: (import("@langflower/node-sdk").OutputParams & import("@langflower/node-sdk").PortMeta)[];
|
|
13
|
+
readonly getInstance: () => import("@langflower/node-sdk").ReactiveNodeInstance<readonly [], Record<string, never>>;
|
|
14
|
+
readonly paletteSecondary?: true;
|
|
15
|
+
readonly description?: string;
|
|
16
|
+
readonly type: string;
|
|
17
|
+
readonly displayName: string;
|
|
18
|
+
readonly category: string | undefined;
|
|
19
|
+
readonly icon: string | undefined;
|
|
20
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineReactiveNode, TOOL_HANDLE_WIRE_TYPE, } from '@langflower/node-sdk';
|
|
2
|
+
import { map } from 'rxjs';
|
|
3
|
+
import { flattenToolHandles } from '../collect-agent-tool-handles.js';
|
|
4
|
+
const mergeToolHandlesLastWins = (wired) => {
|
|
5
|
+
const flattened = Array.isArray(wired)
|
|
6
|
+
? flattenToolHandles(wired)
|
|
7
|
+
: flattenToolHandles(wired === undefined || wired === null ? [] : [wired]);
|
|
8
|
+
const byId = new Map();
|
|
9
|
+
for (const handle of flattened) {
|
|
10
|
+
byId.set(handle.toolId, handle);
|
|
11
|
+
}
|
|
12
|
+
return [...byId.values()];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Optional hub: combine many `tools` wires into one `ToolHandle[]`.
|
|
16
|
+
* Duplicate `toolId` last-wins (later slot). Empty / unwired → `[]`.
|
|
17
|
+
*/
|
|
18
|
+
export const toolCollectionNode = defineReactiveNode({
|
|
19
|
+
type: 'common-tool-collection',
|
|
20
|
+
displayName: 'Tool collection',
|
|
21
|
+
category: 'Tools',
|
|
22
|
+
description: 'Merges many `tools` wires into one `ToolHandle[]`. ' +
|
|
23
|
+
'Duplicate toolId last-wins. Optional — agents still accept multi combine.',
|
|
24
|
+
uiSchema: [],
|
|
25
|
+
bind(_ctx, { makeInput, configureOutput }) {
|
|
26
|
+
const tools = makeInput('tools', {
|
|
27
|
+
name: 'tools',
|
|
28
|
+
wireType: TOOL_HANDLE_WIRE_TYPE,
|
|
29
|
+
multi: 'combine',
|
|
30
|
+
defaultValue: [],
|
|
31
|
+
});
|
|
32
|
+
const merged$ = tools.pipeValue(map((wired) => mergeToolHandlesLastWins(wired)));
|
|
33
|
+
return {
|
|
34
|
+
inputs: [tools],
|
|
35
|
+
outputs: [
|
|
36
|
+
configureOutput('tools', merged$, {
|
|
37
|
+
wireType: TOOL_HANDLE_WIRE_TYPE,
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -14,31 +14,27 @@
|
|
|
14
14
|
"import": "./dist/test-nodes/test-index.js"
|
|
15
15
|
},
|
|
16
16
|
"./ai/llm-role-preset": {
|
|
17
|
-
"types": "./dist/ai/llm-role-preset.d.ts",
|
|
18
|
-
"import": "./dist/ai/llm-role-preset.js"
|
|
19
|
-
},
|
|
20
|
-
"./ai/sub-agent-protocol": {
|
|
21
|
-
"types": "./dist/ai/sub-agent-protocol.d.ts",
|
|
22
|
-
"import": "./dist/ai/sub-agent-protocol.js"
|
|
17
|
+
"types": "./dist/ai/features/llm-role-preset.d.ts",
|
|
18
|
+
"import": "./dist/ai/features/llm-role-preset.js"
|
|
23
19
|
},
|
|
24
20
|
"./ai/run-host-services": {
|
|
25
|
-
"types": "./dist/ai/run-host-services.d.ts",
|
|
26
|
-
"import": "./dist/ai/run-host-services.js"
|
|
21
|
+
"types": "./dist/ai/features/run-host-services.d.ts",
|
|
22
|
+
"import": "./dist/ai/features/run-host-services.js"
|
|
27
23
|
},
|
|
28
24
|
"./ai/openai/create-chat-completion-stream": {
|
|
29
|
-
"types": "./dist/ai/openai/create-chat-completion-stream.d.ts",
|
|
30
|
-
"import": "./dist/ai/openai/create-chat-completion-stream.js"
|
|
25
|
+
"types": "./dist/ai/features/openai/create-chat-completion-stream.d.ts",
|
|
26
|
+
"import": "./dist/ai/features/openai/create-chat-completion-stream.js"
|
|
31
27
|
},
|
|
32
28
|
"./ai/openai/list-provider-models": {
|
|
33
|
-
"types": "./dist/ai/openai/list-provider-models.d.ts",
|
|
34
|
-
"import": "./dist/ai/openai/list-provider-models.js"
|
|
29
|
+
"types": "./dist/ai/features/openai/list-provider-models.d.ts",
|
|
30
|
+
"import": "./dist/ai/features/openai/list-provider-models.js"
|
|
35
31
|
}
|
|
36
32
|
},
|
|
37
33
|
"dependencies": {
|
|
38
34
|
"@langflower/node-sdk": "file:../node-sdk",
|
|
39
35
|
"@langflower/runtime": "file:../runtime",
|
|
40
36
|
"@langflower/tools": "file:../tools",
|
|
41
|
-
"@rx-evo/stateful-observable": "^0.
|
|
37
|
+
"@rx-evo/stateful-observable": "^0.6.0",
|
|
42
38
|
"openai": "^4.104.0",
|
|
43
39
|
"rxjs": "^7.8.1"
|
|
44
40
|
},
|
|
@@ -7,7 +7,8 @@ export declare const hasCustomNodePacks: (projectDir: string) => Promise<boolean
|
|
|
7
7
|
* Scan `.langflower/nodes/`. Each pack runs independently; within a pack each
|
|
8
8
|
* `export default` entry is typechecked then esbuilt only if clean.
|
|
9
9
|
* Returns all successful definitions plus all failures (partial success OK).
|
|
10
|
-
* Empty / missing `nodes/`
|
|
10
|
+
* Always deletes `.langflower/.cache/nodes/` first. Empty / missing `nodes/`
|
|
11
|
+
* does not recreate the cache dir.
|
|
11
12
|
*/
|
|
12
13
|
export declare const compileProjectNodes: (projectDir: string) => Promise<CompileProjectNodesResult>;
|
|
13
14
|
export type { CompileDiagnostic, CompilePackError, CompileProjectNodesResult, } from './compile-types.js';
|
|
@@ -1,17 +1,39 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
|
+
import os from 'node:os';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { pathToFileURL } from 'node:url';
|
|
4
5
|
import { bundleEntry } from './bundle-pack.js';
|
|
5
|
-
import { computePackCacheKey } from './cache-key.js';
|
|
6
6
|
import { discoverPacks } from './discover-packs.js';
|
|
7
7
|
import { diagnosticsForEntry, typecheckPack } from './typecheck-pack.js';
|
|
8
8
|
import { formatCompilePackError } from './format-compilation-errors.js';
|
|
9
9
|
import { parseDefaultExport } from './validate-default-export.js';
|
|
10
10
|
import { deleteCompilationErrorsFile, writeCompilationErrorsFile, } from './write-compilation-errors.js';
|
|
11
11
|
const cacheRoot = (projectDir) => path.join(projectDir, '.langflower', '.cache', 'nodes');
|
|
12
|
+
const wipeCacheRoot = async (projectDir) => {
|
|
13
|
+
try {
|
|
14
|
+
await fs.rm(cacheRoot(projectDir), { recursive: true, force: true });
|
|
15
|
+
return { ok: true };
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
19
|
+
return {
|
|
20
|
+
ok: false,
|
|
21
|
+
error: formatCompilePackError('.cache/nodes', [
|
|
22
|
+
{
|
|
23
|
+
message: `Failed to delete custom-node cache: ${message}`,
|
|
24
|
+
},
|
|
25
|
+
], projectDir),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
};
|
|
12
29
|
const loadBundledDefault = async (outfile, entryPath, packageName, projectDir) => {
|
|
13
|
-
const
|
|
30
|
+
const loadFile = path.join(os.tmpdir(), `lf-node-load-${process.hrtime.bigint()}.mjs`);
|
|
14
31
|
try {
|
|
32
|
+
// Stable outfile stays at `<pack>/<entry>.mjs` for git diff. Import a
|
|
33
|
+
// unique temp copy so Node / Vitest ESM cache cannot reuse the previous
|
|
34
|
+
// module for that path (query strings are not enough under Vitest).
|
|
35
|
+
await fs.copyFile(outfile, loadFile);
|
|
36
|
+
const href = `${pathToFileURL(loadFile).href}?t=${Date.now()}`;
|
|
15
37
|
const mod = await import(href);
|
|
16
38
|
const defaultExport = typeof mod === 'object' && mod !== null && 'default' in mod
|
|
17
39
|
? mod.default
|
|
@@ -40,9 +62,11 @@ const loadBundledDefault = async (outfile, entryPath, packageName, projectDir) =
|
|
|
40
62
|
};
|
|
41
63
|
const relativeEntry = (packDir, entryPath) => path.relative(packDir, entryPath).split(path.sep).join('/');
|
|
42
64
|
const compileEntry = async (projectDir, pack, entryPath) => {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
65
|
+
const relative = relativeEntry(pack.packDir, entryPath)
|
|
66
|
+
.replace(/[\\/]/g, '__')
|
|
67
|
+
.replace(/\.tsx$/u, '')
|
|
68
|
+
.replace(/\.ts$/u, '');
|
|
69
|
+
const outfile = path.join(cacheRoot(projectDir), pack.packageName.replace(/[^\w.-]+/g, '_'), `${relative}.mjs`);
|
|
46
70
|
const bundled = await bundleEntry({
|
|
47
71
|
entryPath,
|
|
48
72
|
packDir: pack.packDir,
|
|
@@ -95,10 +119,15 @@ export const hasCustomNodePacks = async (projectDir) => {
|
|
|
95
119
|
* Scan `.langflower/nodes/`. Each pack runs independently; within a pack each
|
|
96
120
|
* `export default` entry is typechecked then esbuilt only if clean.
|
|
97
121
|
* Returns all successful definitions plus all failures (partial success OK).
|
|
98
|
-
* Empty / missing `nodes/`
|
|
122
|
+
* Always deletes `.langflower/.cache/nodes/` first. Empty / missing `nodes/`
|
|
123
|
+
* does not recreate the cache dir.
|
|
99
124
|
*/
|
|
100
125
|
export const compileProjectNodes = async (projectDir) => {
|
|
101
126
|
const packs = await discoverPacks(projectDir);
|
|
127
|
+
const wiped = await wipeCacheRoot(projectDir);
|
|
128
|
+
if (!wiped.ok) {
|
|
129
|
+
return { nodes: [], errors: [wiped.error] };
|
|
130
|
+
}
|
|
102
131
|
if (packs.length === 0) {
|
|
103
132
|
return { nodes: [], errors: [] };
|
|
104
133
|
}
|
|
@@ -8,11 +8,6 @@ export declare const isHostPeerSpecifier: (id: string) => boolean;
|
|
|
8
8
|
* compiler's install tree. Works with `npm i -g` and an empty project.
|
|
9
9
|
*/
|
|
10
10
|
export declare const resolveHostPackageEntry: (specifier: string) => string | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Stable stamp of resolved host peer roots for cache invalidation when the
|
|
13
|
-
* Langflower install tree moves or upgrades.
|
|
14
|
-
*/
|
|
15
|
-
export declare const hostRuntimeEntryStamp: () => string;
|
|
16
11
|
/**
|
|
17
12
|
* Resolve declaration entry for a host package installed next to the
|
|
18
13
|
* compiler (global Langflower tree), using package.json `types` /
|
|
@@ -64,14 +64,6 @@ export const isHostPeerSpecifier = (id) => {
|
|
|
64
64
|
* compiler's install tree. Works with `npm i -g` and an empty project.
|
|
65
65
|
*/
|
|
66
66
|
export const resolveHostPackageEntry = (specifier) => resolvePackageEntry(specifier);
|
|
67
|
-
/**
|
|
68
|
-
* Stable stamp of resolved host peer roots for cache invalidation when the
|
|
69
|
-
* Langflower install tree moves or upgrades.
|
|
70
|
-
*/
|
|
71
|
-
export const hostRuntimeEntryStamp = () => HOST_PEER_PACKAGES.map((name) => {
|
|
72
|
-
const entry = resolveHostPackageEntry(name);
|
|
73
|
-
return `${name}=${entry === undefined ? '' : toPosix(entry)}`;
|
|
74
|
-
}).join('\n');
|
|
75
67
|
/**
|
|
76
68
|
* Prefer `exports` types conditions (import → require → default), then
|
|
77
69
|
* top-level `types` / `typings`.
|
|
@@ -3,13 +3,10 @@ import type { StatefulObservable } from '@rx-evo/stateful-observable';
|
|
|
3
3
|
import type { configureOutput, InputConfig, makeInput, OutputConfig } from '../define-reactive-node/io-helpers.js';
|
|
4
4
|
import type { LlmRecoveryNotice } from './recovery-notice.js';
|
|
5
5
|
/** Port ids that every LLM-class node must expose (inventory + observability). */
|
|
6
|
-
export declare const LLM_INVENTORY_INPUT_PORT_IDS: readonly ["tools", "
|
|
7
|
-
export declare const LLM_INVENTORY_OUTPUT_PORT_IDS: readonly ["toolLog", "recovery"
|
|
6
|
+
export declare const LLM_INVENTORY_INPUT_PORT_IDS: readonly ["tools", "steerControl"];
|
|
7
|
+
export declare const LLM_INVENTORY_OUTPUT_PORT_IDS: readonly ["toolLog", "recovery"];
|
|
8
8
|
export type LlmInventoryInputs = {
|
|
9
9
|
readonly tools: InputConfig;
|
|
10
|
-
readonly mcp: InputConfig;
|
|
11
|
-
readonly subagentRegistration: InputConfig;
|
|
12
|
-
readonly subagentResult: InputConfig;
|
|
13
10
|
/** Soft Pause / Steer (ADR-032) — hidden + HITL textarea. */
|
|
14
11
|
readonly steerControl: InputConfig;
|
|
15
12
|
/** Ordered list for `inputs: [...]` spreads. */
|
|
@@ -18,7 +15,6 @@ export type LlmInventoryInputs = {
|
|
|
18
15
|
export type LlmInventoryOutputStreams = {
|
|
19
16
|
readonly toolLog$: StatefulObservable<string, unknown, PortMeta | undefined>;
|
|
20
17
|
readonly recovery$: StatefulObservable<LlmRecoveryNotice, unknown, PortMeta | undefined>;
|
|
21
|
-
readonly subagent$: StatefulObservable<unknown, unknown, PortMeta | undefined>;
|
|
22
18
|
};
|
|
23
19
|
/**
|
|
24
20
|
* Create the shared LLM inventory inputs. Authors may extend with role ports
|
|
@@ -26,6 +22,6 @@ export type LlmInventoryOutputStreams = {
|
|
|
26
22
|
*/
|
|
27
23
|
export declare const defaultLlmInventoryInputs: (make: typeof makeInput) => LlmInventoryInputs;
|
|
28
24
|
/**
|
|
29
|
-
* Configure the shared LLM inventory outputs (`toolLog`, `recovery
|
|
25
|
+
* Configure the shared LLM inventory outputs (`toolLog`, `recovery`).
|
|
30
26
|
*/
|
|
31
27
|
export declare const defaultLlmInventoryOutputs: (configure: typeof configureOutput, streams: LlmInventoryOutputStreams) => readonly OutputConfig[];
|
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
import { MCP_HANDLE_WIRE_TYPE } from '../define-mcp/mcp-handle.js';
|
|
2
1
|
import { TOOL_HANDLE_WIRE_TYPE } from '../define-tool-registrations/tool-handle.js';
|
|
3
|
-
import { SUBAGENT_REGISTRATION_WIRE_TYPE, SUBAGENT_RESULT_WIRE_TYPE, SUBAGENT_SPAWN_WIRE_TYPE, } from './llm-inventory-wire.js';
|
|
4
2
|
import { STEER_CONTROL_PORT_ID, } from './steer-control.js';
|
|
5
3
|
import { RECOVERY_PORT_ID } from './recovery-notice.js';
|
|
6
4
|
/** Port ids that every LLM-class node must expose (inventory + observability). */
|
|
7
5
|
export const LLM_INVENTORY_INPUT_PORT_IDS = [
|
|
8
6
|
'tools',
|
|
9
|
-
'mcp',
|
|
10
|
-
'subagentRegistration',
|
|
11
|
-
'subagentResult',
|
|
12
7
|
STEER_CONTROL_PORT_ID,
|
|
13
8
|
];
|
|
14
|
-
export const LLM_INVENTORY_OUTPUT_PORT_IDS = [
|
|
15
|
-
'toolLog',
|
|
16
|
-
'recovery',
|
|
17
|
-
'subagent',
|
|
18
|
-
];
|
|
9
|
+
export const LLM_INVENTORY_OUTPUT_PORT_IDS = ['toolLog', 'recovery'];
|
|
19
10
|
/**
|
|
20
11
|
* Create the shared LLM inventory inputs. Authors may extend with role ports
|
|
21
12
|
* but must not omit these.
|
|
@@ -27,26 +18,6 @@ export const defaultLlmInventoryInputs = (make) => {
|
|
|
27
18
|
multi: 'combine',
|
|
28
19
|
defaultValue: [],
|
|
29
20
|
});
|
|
30
|
-
const mcp = make('mcp', {
|
|
31
|
-
name: 'mcp',
|
|
32
|
-
wireType: MCP_HANDLE_WIRE_TYPE,
|
|
33
|
-
multi: 'combine',
|
|
34
|
-
defaultValue: [],
|
|
35
|
-
});
|
|
36
|
-
const subagentRegistration = make('subagentRegistration', {
|
|
37
|
-
name: 'subagentRegistration',
|
|
38
|
-
wireType: SUBAGENT_REGISTRATION_WIRE_TYPE,
|
|
39
|
-
multi: 'combine',
|
|
40
|
-
defaultValue: [],
|
|
41
|
-
});
|
|
42
|
-
const subagentResult = make('subagentResult', {
|
|
43
|
-
name: 'subagentResult',
|
|
44
|
-
wireType: SUBAGENT_RESULT_WIRE_TYPE,
|
|
45
|
-
multi: 'merge',
|
|
46
|
-
defaultValue: null,
|
|
47
|
-
// Protocol payload from Sub-Agent — omit from work log.
|
|
48
|
-
feed: { role: 'none' },
|
|
49
|
-
});
|
|
50
21
|
const steerControl = make(STEER_CONTROL_PORT_ID, {
|
|
51
22
|
name: 'Steer',
|
|
52
23
|
wireType: 'any',
|
|
@@ -64,21 +35,12 @@ export const defaultLlmInventoryInputs = (make) => {
|
|
|
64
35
|
});
|
|
65
36
|
return {
|
|
66
37
|
tools,
|
|
67
|
-
mcp,
|
|
68
|
-
subagentRegistration,
|
|
69
|
-
subagentResult,
|
|
70
38
|
steerControl,
|
|
71
|
-
inputs: [
|
|
72
|
-
tools,
|
|
73
|
-
mcp,
|
|
74
|
-
subagentRegistration,
|
|
75
|
-
subagentResult,
|
|
76
|
-
steerControl,
|
|
77
|
-
],
|
|
39
|
+
inputs: [tools, steerControl],
|
|
78
40
|
};
|
|
79
41
|
};
|
|
80
42
|
/**
|
|
81
|
-
* Configure the shared LLM inventory outputs (`toolLog`, `recovery
|
|
43
|
+
* Configure the shared LLM inventory outputs (`toolLog`, `recovery`).
|
|
82
44
|
*/
|
|
83
45
|
export const defaultLlmInventoryOutputs = (configure, streams) => [
|
|
84
46
|
configure('toolLog', streams.toolLog$, {
|
|
@@ -87,10 +49,8 @@ export const defaultLlmInventoryOutputs = (configure, streams) => [
|
|
|
87
49
|
}),
|
|
88
50
|
configure(RECOVERY_PORT_ID, streams.recovery$, {
|
|
89
51
|
wireType: 'any',
|
|
52
|
+
// Feed-only — canvas and palette skip hidden outputs.
|
|
90
53
|
hidden: true,
|
|
91
54
|
feed: { role: 'recovery', streaming: true },
|
|
92
55
|
}),
|
|
93
|
-
configure('subagent', streams.subagent$, {
|
|
94
|
-
wireType: SUBAGENT_SPAWN_WIRE_TYPE,
|
|
95
|
-
}),
|
|
96
56
|
];
|
|
@@ -17,10 +17,9 @@ type LlmCtx<UI extends readonly UISchemaConstItem[]> = Parameters<DefinedReactiv
|
|
|
17
17
|
export type { LlmExecutionCaps };
|
|
18
18
|
/**
|
|
19
19
|
* Purpose factory atop {@link defineReactiveNode}: every LLM-class node gets
|
|
20
|
-
* the shared inventory / observability ports (`tools`, `
|
|
21
|
-
* `
|
|
22
|
-
*
|
|
23
|
-
* inventory set.
|
|
20
|
+
* the shared inventory / observability ports (`tools`, `steerControl`,
|
|
21
|
+
* `toolLog`, `recovery`). Authors may extend with role ports but cannot omit
|
|
22
|
+
* the inventory set.
|
|
24
23
|
*/
|
|
25
24
|
export declare const defineLlmNode: <UI extends readonly UISchemaConstItem[]>(config: Omit<DefinedReactiveNodeConfig<UI, LlmExecutionCaps>, "bind"> & {
|
|
26
25
|
readonly bind: (ctx: LlmCtx<UI>, helpers: ReactiveBindHelpers, inventory: LlmInventoryInputs) => LlmBindResult;
|
|
@@ -41,6 +40,5 @@ export declare const defineLlmNode: <UI extends readonly UISchemaConstItem[]>(co
|
|
|
41
40
|
readonly icon: string | undefined;
|
|
42
41
|
};
|
|
43
42
|
export { LLM_INVENTORY_INPUT_PORT_IDS, LLM_INVENTORY_OUTPUT_PORT_IDS, type LlmInventoryInputs, type LlmInventoryOutputStreams, } from './default-llm-ports.js';
|
|
44
|
-
export { SUBAGENT_REGISTRATION_WIRE_TYPE, SUBAGENT_RESULT_WIRE_TYPE, SUBAGENT_SPAWN_WIRE_TYPE, } from './llm-inventory-wire.js';
|
|
45
43
|
export { STEER_CONTROL_PORT_ID, isSteerControlContinue, isSteerControlPause, isSteerControlPayload, type SteerControlPayload, type SteerControlPause, type SteerControlResume, type SteerControlSteer, } from './steer-control.js';
|
|
46
|
-
export { RECOVERY_PORT_ID, isLlmRecoveryNotice, isLlmRecoverySuspended, recoveryNoticeText, type LlmRecoveryNotice, type LlmRecoveryNoticeCode, } from './recovery-notice.js';
|
|
44
|
+
export { RECOVERY_PORT_ID, isLlmRecoveryNotice, isLlmRecoverySuspended, recoveryNoticeText, toLlmRecoveryPortValue, type LlmRecoveryNotice, type LlmRecoveryNoticeCode, type LlmRecoveryRetryReason, } from './recovery-notice.js';
|
|
@@ -21,10 +21,9 @@ const assertNoInventoryOutputs = (outputs) => {
|
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
23
|
* Purpose factory atop {@link defineReactiveNode}: every LLM-class node gets
|
|
24
|
-
* the shared inventory / observability ports (`tools`, `
|
|
25
|
-
* `
|
|
26
|
-
*
|
|
27
|
-
* inventory set.
|
|
24
|
+
* the shared inventory / observability ports (`tools`, `steerControl`,
|
|
25
|
+
* `toolLog`, `recovery`). Authors may extend with role ports but cannot omit
|
|
26
|
+
* the inventory set.
|
|
28
27
|
*/
|
|
29
28
|
export const defineLlmNode = (config) => {
|
|
30
29
|
const { bind: authorBind, ...rest } = config;
|
|
@@ -46,6 +45,5 @@ export const defineLlmNode = (config) => {
|
|
|
46
45
|
});
|
|
47
46
|
};
|
|
48
47
|
export { LLM_INVENTORY_INPUT_PORT_IDS, LLM_INVENTORY_OUTPUT_PORT_IDS, } from './default-llm-ports.js';
|
|
49
|
-
export { SUBAGENT_REGISTRATION_WIRE_TYPE, SUBAGENT_RESULT_WIRE_TYPE, SUBAGENT_SPAWN_WIRE_TYPE, } from './llm-inventory-wire.js';
|
|
50
48
|
export { STEER_CONTROL_PORT_ID, isSteerControlContinue, isSteerControlPause, isSteerControlPayload, } from './steer-control.js';
|
|
51
|
-
export { RECOVERY_PORT_ID, isLlmRecoveryNotice, isLlmRecoverySuspended, recoveryNoticeText, } from './recovery-notice.js';
|
|
49
|
+
export { RECOVERY_PORT_ID, isLlmRecoveryNotice, isLlmRecoverySuspended, recoveryNoticeText, toLlmRecoveryPortValue, } from './recovery-notice.js';
|