langflower 0.0.7 → 0.0.9
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 +1 -1
- 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 +1 -1
- package/ui-dist/main-2JJGCNTD.js +313 -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 +216 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/llm-loop-types.d.ts +125 -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 +32 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/run-agent-loop.js +58 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/run-llm-loop.d.ts +80 -0
- package/vendor/common-nodes/dist/ai/features/llm-loop/run-llm-loop.js +681 -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 +148 -0
- package/vendor/common-nodes/dist/ai/features/llm-session/llm-session-shell.js +198 -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 +35 -0
- package/vendor/common-nodes/dist/ai/features/path-choice/run-reactive-path-choice-loop.js +106 -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 +39 -0
- package/vendor/common-nodes/dist/ai/features/sub-agent-protocol.js +43 -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 +6 -0
- package/vendor/common-nodes/dist/ai/features/wait-for-subagent-result.js +30 -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 +240 -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 +208 -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 +91 -0
- package/vendor/common-nodes/dist/ai/nodes/review/node.d.ts +593 -0
- package/vendor/common-nodes/dist/ai/nodes/review/node.js +240 -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 +302 -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 +7 -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/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/inventory-tool-round.d.ts +2 -2
- package/vendor/common-nodes/package.json +10 -10
- 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/node-sdk/dist/node-factory/define-llm-node/define-llm-node.d.ts +1 -1
- package/vendor/node-sdk/dist/node-factory/define-llm-node/define-llm-node.js +1 -1
- 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/runtime/dist/runtime-editor.d.ts +5 -1
- package/vendor/runtime/dist/runtime-editor.js +19 -0
- package/vendor/runtime/dist/runtime-runner.js +17 -17
- package/vendor/runtime/dist/runtime.d.ts +2 -1
- package/vendor/runtime/dist/runtime.js +1 -0
- package/vendor/runtime/dist/testing/workflows/workflow-events.d.ts +8 -6
- package/vendor/runtime/dist/testing/workflows/workflow-events.js +19 -31
- package/vendor/runtime/dist/types.d.ts +33 -38
- package/vendor/runtime/dist/types.js +2 -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 +45 -5
- 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 +12 -0
- package/vendor/server/dist/bridge/get-live-wired-tools.js +80 -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/settings-draft-controller.js +26 -3
- 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 +15 -8
- 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/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/schemas/langflower-config.schema.json +11 -1
- package/vendor/server/skeleton/skills/langflower-helper/SKILL.md +49 -19
- package/vendor/server/skeleton/skills/langflower-helper/architecture.md +22 -9
- package/vendor/server/skeleton/skills/langflower-helper/layout.md +15 -15
- package/vendor/server/skeleton/skills/langflower-node-writer/SKILL.md +19 -9
- package/vendor/server/skeleton/skills/langflower-workflow-writer/SKILL.md +14 -10
- package/vendor/server/skeleton/workflows/starter.json +30 -3
- 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 +9 -9
- 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 +7 -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-SMO3L7U5.js +0 -311
|
@@ -46,6 +46,8 @@ export type CreateChatCompletionStreamArgs = {
|
|
|
46
46
|
readonly messages: readonly ChatCompletionMessage[];
|
|
47
47
|
readonly tools?: readonly ChatCompletionToolDefinition[];
|
|
48
48
|
readonly signal?: ChatCompletionAbortSignal;
|
|
49
|
+
readonly frequency_penalty?: number;
|
|
50
|
+
readonly presence_penalty?: number;
|
|
49
51
|
};
|
|
50
52
|
/** OpenAI-compatible chat stream factory (credentials resolved server-side). */
|
|
51
53
|
export type CreateChatCompletionStream = (args: CreateChatCompletionStreamArgs) => Promise<AsyncIterable<ChatCompletionStreamChunk>>;
|
|
@@ -116,6 +116,88 @@ export declare const critiqueNode: {
|
|
|
116
116
|
readonly min: 0;
|
|
117
117
|
readonly max: 32;
|
|
118
118
|
readonly step: 1;
|
|
119
|
+
}, {
|
|
120
|
+
readonly field: "autokickOnIdle";
|
|
121
|
+
readonly type: "boolean";
|
|
122
|
+
readonly label: "Autokick on idle and dead-loop";
|
|
123
|
+
readonly default: boolean;
|
|
124
|
+
}, {
|
|
125
|
+
readonly field: "deadLoopEnabled";
|
|
126
|
+
readonly type: "boolean";
|
|
127
|
+
readonly label: "Detect repetition dead loops";
|
|
128
|
+
readonly default: boolean;
|
|
129
|
+
}, {
|
|
130
|
+
readonly field: "maxAutokickAttempts";
|
|
131
|
+
readonly type: "number";
|
|
132
|
+
readonly label: "Max autokick reconnects (0 = unlimited)";
|
|
133
|
+
readonly default: number;
|
|
134
|
+
readonly min: 0;
|
|
135
|
+
readonly max: 1000;
|
|
136
|
+
readonly step: 1;
|
|
137
|
+
}, {
|
|
138
|
+
readonly field: "autokickBackoffMs";
|
|
139
|
+
readonly type: "number";
|
|
140
|
+
readonly label: "Autokick backoff base (ms)";
|
|
141
|
+
readonly default: number;
|
|
142
|
+
readonly min: 1000;
|
|
143
|
+
readonly step: 1000;
|
|
144
|
+
}, {
|
|
145
|
+
readonly field: "autokickMaxBackoffMs";
|
|
146
|
+
readonly type: "number";
|
|
147
|
+
readonly label: "Autokick backoff clamp (ms)";
|
|
148
|
+
readonly default: number;
|
|
149
|
+
readonly min: 1000;
|
|
150
|
+
readonly step: 1000;
|
|
151
|
+
}, {
|
|
152
|
+
readonly field: "autokickUserMessage";
|
|
153
|
+
readonly type: "string";
|
|
154
|
+
readonly label: "Autokick kick message";
|
|
155
|
+
readonly default: string;
|
|
156
|
+
}, {
|
|
157
|
+
readonly field: "autokickPenaltyFrequency";
|
|
158
|
+
readonly type: "number";
|
|
159
|
+
readonly label: "Autokick frequency_penalty delta";
|
|
160
|
+
readonly default: number;
|
|
161
|
+
readonly min: -2;
|
|
162
|
+
readonly max: 2;
|
|
163
|
+
readonly step: 0.1;
|
|
164
|
+
}, {
|
|
165
|
+
readonly field: "autokickPenaltyPresence";
|
|
166
|
+
readonly type: "number";
|
|
167
|
+
readonly label: "Autokick presence_penalty delta";
|
|
168
|
+
readonly default: number;
|
|
169
|
+
readonly min: -2;
|
|
170
|
+
readonly max: 2;
|
|
171
|
+
readonly step: 0.1;
|
|
172
|
+
}, {
|
|
173
|
+
readonly field: "deadLoopMaxWindowTokens";
|
|
174
|
+
readonly type: "number";
|
|
175
|
+
readonly label: "Dead-loop window (tokens)";
|
|
176
|
+
readonly default: number;
|
|
177
|
+
readonly min: 10;
|
|
178
|
+
readonly max: 8000;
|
|
179
|
+
readonly step: 1;
|
|
180
|
+
}, {
|
|
181
|
+
readonly field: "deadLoopConsecutiveThreshold";
|
|
182
|
+
readonly type: "number";
|
|
183
|
+
readonly label: "Dead-loop consecutive identical deltas";
|
|
184
|
+
readonly default: number;
|
|
185
|
+
readonly min: 1;
|
|
186
|
+
readonly step: 1;
|
|
187
|
+
}, {
|
|
188
|
+
readonly field: "deadLoopMinRepetitions";
|
|
189
|
+
readonly type: "number";
|
|
190
|
+
readonly label: "Dead-loop cyclic repetitions";
|
|
191
|
+
readonly default: number;
|
|
192
|
+
readonly min: 1;
|
|
193
|
+
readonly step: 1;
|
|
194
|
+
}, {
|
|
195
|
+
readonly field: "deadLoopMinPatternTokens";
|
|
196
|
+
readonly type: "number";
|
|
197
|
+
readonly label: "Dead-loop min pattern tokens";
|
|
198
|
+
readonly default: number;
|
|
199
|
+
readonly min: 1;
|
|
200
|
+
readonly step: 1;
|
|
119
201
|
}];
|
|
120
202
|
readonly bypassPorts: Record<string, import("@langflower/node-sdk").WireType>;
|
|
121
203
|
readonly inputsConfigs: readonly [import("@langflower/node-sdk").InputPortMeta<import("@langflower/node-sdk").ExecutionContext<readonly [...({
|
|
@@ -224,6 +306,88 @@ export declare const critiqueNode: {
|
|
|
224
306
|
readonly min: 0;
|
|
225
307
|
readonly max: 32;
|
|
226
308
|
readonly step: 1;
|
|
309
|
+
}, {
|
|
310
|
+
readonly field: "autokickOnIdle";
|
|
311
|
+
readonly type: "boolean";
|
|
312
|
+
readonly label: "Autokick on idle and dead-loop";
|
|
313
|
+
readonly default: boolean;
|
|
314
|
+
}, {
|
|
315
|
+
readonly field: "deadLoopEnabled";
|
|
316
|
+
readonly type: "boolean";
|
|
317
|
+
readonly label: "Detect repetition dead loops";
|
|
318
|
+
readonly default: boolean;
|
|
319
|
+
}, {
|
|
320
|
+
readonly field: "maxAutokickAttempts";
|
|
321
|
+
readonly type: "number";
|
|
322
|
+
readonly label: "Max autokick reconnects (0 = unlimited)";
|
|
323
|
+
readonly default: number;
|
|
324
|
+
readonly min: 0;
|
|
325
|
+
readonly max: 1000;
|
|
326
|
+
readonly step: 1;
|
|
327
|
+
}, {
|
|
328
|
+
readonly field: "autokickBackoffMs";
|
|
329
|
+
readonly type: "number";
|
|
330
|
+
readonly label: "Autokick backoff base (ms)";
|
|
331
|
+
readonly default: number;
|
|
332
|
+
readonly min: 1000;
|
|
333
|
+
readonly step: 1000;
|
|
334
|
+
}, {
|
|
335
|
+
readonly field: "autokickMaxBackoffMs";
|
|
336
|
+
readonly type: "number";
|
|
337
|
+
readonly label: "Autokick backoff clamp (ms)";
|
|
338
|
+
readonly default: number;
|
|
339
|
+
readonly min: 1000;
|
|
340
|
+
readonly step: 1000;
|
|
341
|
+
}, {
|
|
342
|
+
readonly field: "autokickUserMessage";
|
|
343
|
+
readonly type: "string";
|
|
344
|
+
readonly label: "Autokick kick message";
|
|
345
|
+
readonly default: string;
|
|
346
|
+
}, {
|
|
347
|
+
readonly field: "autokickPenaltyFrequency";
|
|
348
|
+
readonly type: "number";
|
|
349
|
+
readonly label: "Autokick frequency_penalty delta";
|
|
350
|
+
readonly default: number;
|
|
351
|
+
readonly min: -2;
|
|
352
|
+
readonly max: 2;
|
|
353
|
+
readonly step: 0.1;
|
|
354
|
+
}, {
|
|
355
|
+
readonly field: "autokickPenaltyPresence";
|
|
356
|
+
readonly type: "number";
|
|
357
|
+
readonly label: "Autokick presence_penalty delta";
|
|
358
|
+
readonly default: number;
|
|
359
|
+
readonly min: -2;
|
|
360
|
+
readonly max: 2;
|
|
361
|
+
readonly step: 0.1;
|
|
362
|
+
}, {
|
|
363
|
+
readonly field: "deadLoopMaxWindowTokens";
|
|
364
|
+
readonly type: "number";
|
|
365
|
+
readonly label: "Dead-loop window (tokens)";
|
|
366
|
+
readonly default: number;
|
|
367
|
+
readonly min: 10;
|
|
368
|
+
readonly max: 8000;
|
|
369
|
+
readonly step: 1;
|
|
370
|
+
}, {
|
|
371
|
+
readonly field: "deadLoopConsecutiveThreshold";
|
|
372
|
+
readonly type: "number";
|
|
373
|
+
readonly label: "Dead-loop consecutive identical deltas";
|
|
374
|
+
readonly default: number;
|
|
375
|
+
readonly min: 1;
|
|
376
|
+
readonly step: 1;
|
|
377
|
+
}, {
|
|
378
|
+
readonly field: "deadLoopMinRepetitions";
|
|
379
|
+
readonly type: "number";
|
|
380
|
+
readonly label: "Dead-loop cyclic repetitions";
|
|
381
|
+
readonly default: number;
|
|
382
|
+
readonly min: 1;
|
|
383
|
+
readonly step: 1;
|
|
384
|
+
}, {
|
|
385
|
+
readonly field: "deadLoopMinPatternTokens";
|
|
386
|
+
readonly type: "number";
|
|
387
|
+
readonly label: "Dead-loop min pattern tokens";
|
|
388
|
+
readonly default: number;
|
|
389
|
+
readonly min: 1;
|
|
390
|
+
readonly step: 1;
|
|
227
391
|
}], import("@langflower/node-sdk/llm").LlmExecutionCaps>>, ...import("@langflower/node-sdk").InputPortMeta<unknown>[]];
|
|
228
392
|
readonly outputsConfigs: (import("@langflower/node-sdk").OutputParams & import("@langflower/node-sdk").PortMeta)[];
|
|
229
393
|
readonly getInstance: () => import("@langflower/node-sdk").ReactiveNodeInstance<readonly [...({
|
|
@@ -332,6 +496,88 @@ export declare const critiqueNode: {
|
|
|
332
496
|
readonly min: 0;
|
|
333
497
|
readonly max: 32;
|
|
334
498
|
readonly step: 1;
|
|
499
|
+
}, {
|
|
500
|
+
readonly field: "autokickOnIdle";
|
|
501
|
+
readonly type: "boolean";
|
|
502
|
+
readonly label: "Autokick on idle and dead-loop";
|
|
503
|
+
readonly default: boolean;
|
|
504
|
+
}, {
|
|
505
|
+
readonly field: "deadLoopEnabled";
|
|
506
|
+
readonly type: "boolean";
|
|
507
|
+
readonly label: "Detect repetition dead loops";
|
|
508
|
+
readonly default: boolean;
|
|
509
|
+
}, {
|
|
510
|
+
readonly field: "maxAutokickAttempts";
|
|
511
|
+
readonly type: "number";
|
|
512
|
+
readonly label: "Max autokick reconnects (0 = unlimited)";
|
|
513
|
+
readonly default: number;
|
|
514
|
+
readonly min: 0;
|
|
515
|
+
readonly max: 1000;
|
|
516
|
+
readonly step: 1;
|
|
517
|
+
}, {
|
|
518
|
+
readonly field: "autokickBackoffMs";
|
|
519
|
+
readonly type: "number";
|
|
520
|
+
readonly label: "Autokick backoff base (ms)";
|
|
521
|
+
readonly default: number;
|
|
522
|
+
readonly min: 1000;
|
|
523
|
+
readonly step: 1000;
|
|
524
|
+
}, {
|
|
525
|
+
readonly field: "autokickMaxBackoffMs";
|
|
526
|
+
readonly type: "number";
|
|
527
|
+
readonly label: "Autokick backoff clamp (ms)";
|
|
528
|
+
readonly default: number;
|
|
529
|
+
readonly min: 1000;
|
|
530
|
+
readonly step: 1000;
|
|
531
|
+
}, {
|
|
532
|
+
readonly field: "autokickUserMessage";
|
|
533
|
+
readonly type: "string";
|
|
534
|
+
readonly label: "Autokick kick message";
|
|
535
|
+
readonly default: string;
|
|
536
|
+
}, {
|
|
537
|
+
readonly field: "autokickPenaltyFrequency";
|
|
538
|
+
readonly type: "number";
|
|
539
|
+
readonly label: "Autokick frequency_penalty delta";
|
|
540
|
+
readonly default: number;
|
|
541
|
+
readonly min: -2;
|
|
542
|
+
readonly max: 2;
|
|
543
|
+
readonly step: 0.1;
|
|
544
|
+
}, {
|
|
545
|
+
readonly field: "autokickPenaltyPresence";
|
|
546
|
+
readonly type: "number";
|
|
547
|
+
readonly label: "Autokick presence_penalty delta";
|
|
548
|
+
readonly default: number;
|
|
549
|
+
readonly min: -2;
|
|
550
|
+
readonly max: 2;
|
|
551
|
+
readonly step: 0.1;
|
|
552
|
+
}, {
|
|
553
|
+
readonly field: "deadLoopMaxWindowTokens";
|
|
554
|
+
readonly type: "number";
|
|
555
|
+
readonly label: "Dead-loop window (tokens)";
|
|
556
|
+
readonly default: number;
|
|
557
|
+
readonly min: 10;
|
|
558
|
+
readonly max: 8000;
|
|
559
|
+
readonly step: 1;
|
|
560
|
+
}, {
|
|
561
|
+
readonly field: "deadLoopConsecutiveThreshold";
|
|
562
|
+
readonly type: "number";
|
|
563
|
+
readonly label: "Dead-loop consecutive identical deltas";
|
|
564
|
+
readonly default: number;
|
|
565
|
+
readonly min: 1;
|
|
566
|
+
readonly step: 1;
|
|
567
|
+
}, {
|
|
568
|
+
readonly field: "deadLoopMinRepetitions";
|
|
569
|
+
readonly type: "number";
|
|
570
|
+
readonly label: "Dead-loop cyclic repetitions";
|
|
571
|
+
readonly default: number;
|
|
572
|
+
readonly min: 1;
|
|
573
|
+
readonly step: 1;
|
|
574
|
+
}, {
|
|
575
|
+
readonly field: "deadLoopMinPatternTokens";
|
|
576
|
+
readonly type: "number";
|
|
577
|
+
readonly label: "Dead-loop min pattern tokens";
|
|
578
|
+
readonly default: number;
|
|
579
|
+
readonly min: 1;
|
|
580
|
+
readonly step: 1;
|
|
335
581
|
}], import("@langflower/node-sdk/llm").LlmExecutionCaps>;
|
|
336
582
|
readonly paletteSecondary?: true;
|
|
337
583
|
readonly description?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { filter, map, Observable } from 'rxjs';
|
|
2
|
-
import { defineLlmNode, isSteerControlPayload, } from '@langflower/node-sdk/llm';
|
|
2
|
+
import { defineLlmNode, isSteerControlPayload, toLlmRecoveryPortValue, } from '@langflower/node-sdk/llm';
|
|
3
3
|
import { collectAgentToolHandles } from '../../tools/collect-agent-tool-handles.js';
|
|
4
4
|
import { buildEffectiveSystemPrompt } from '../build-effective-system-prompt.js';
|
|
5
5
|
import { resolveChatProviderModel } from '../resolve-chat-provider-model.js';
|
|
@@ -206,7 +206,7 @@ export const critiqueNode = defineLlmNode({
|
|
|
206
206
|
const toolLog$ = cycle$.pipeValue(demuxByKind('toolLog', (chunk) => chunk.text));
|
|
207
207
|
const recovery$ = cycle$.pipeValue(demuxByKind('recoveryNotice', (chunk) => {
|
|
208
208
|
const notice = chunk;
|
|
209
|
-
return
|
|
209
|
+
return toLlmRecoveryPortValue(notice);
|
|
210
210
|
}));
|
|
211
211
|
const response$ = cycle$.pipeValue(demuxByKind('accept', (chunk) => chunk
|
|
212
212
|
.result));
|
|
@@ -102,6 +102,88 @@ export declare const fakeLlmNode: {
|
|
|
102
102
|
readonly min: 0;
|
|
103
103
|
readonly max: 32;
|
|
104
104
|
readonly step: 1;
|
|
105
|
+
}, {
|
|
106
|
+
readonly field: "autokickOnIdle";
|
|
107
|
+
readonly type: "boolean";
|
|
108
|
+
readonly label: "Autokick on idle and dead-loop";
|
|
109
|
+
readonly default: boolean;
|
|
110
|
+
}, {
|
|
111
|
+
readonly field: "deadLoopEnabled";
|
|
112
|
+
readonly type: "boolean";
|
|
113
|
+
readonly label: "Detect repetition dead loops";
|
|
114
|
+
readonly default: boolean;
|
|
115
|
+
}, {
|
|
116
|
+
readonly field: "maxAutokickAttempts";
|
|
117
|
+
readonly type: "number";
|
|
118
|
+
readonly label: "Max autokick reconnects (0 = unlimited)";
|
|
119
|
+
readonly default: number;
|
|
120
|
+
readonly min: 0;
|
|
121
|
+
readonly max: 1000;
|
|
122
|
+
readonly step: 1;
|
|
123
|
+
}, {
|
|
124
|
+
readonly field: "autokickBackoffMs";
|
|
125
|
+
readonly type: "number";
|
|
126
|
+
readonly label: "Autokick backoff base (ms)";
|
|
127
|
+
readonly default: number;
|
|
128
|
+
readonly min: 1000;
|
|
129
|
+
readonly step: 1000;
|
|
130
|
+
}, {
|
|
131
|
+
readonly field: "autokickMaxBackoffMs";
|
|
132
|
+
readonly type: "number";
|
|
133
|
+
readonly label: "Autokick backoff clamp (ms)";
|
|
134
|
+
readonly default: number;
|
|
135
|
+
readonly min: 1000;
|
|
136
|
+
readonly step: 1000;
|
|
137
|
+
}, {
|
|
138
|
+
readonly field: "autokickUserMessage";
|
|
139
|
+
readonly type: "string";
|
|
140
|
+
readonly label: "Autokick kick message";
|
|
141
|
+
readonly default: string;
|
|
142
|
+
}, {
|
|
143
|
+
readonly field: "autokickPenaltyFrequency";
|
|
144
|
+
readonly type: "number";
|
|
145
|
+
readonly label: "Autokick frequency_penalty delta";
|
|
146
|
+
readonly default: number;
|
|
147
|
+
readonly min: -2;
|
|
148
|
+
readonly max: 2;
|
|
149
|
+
readonly step: 0.1;
|
|
150
|
+
}, {
|
|
151
|
+
readonly field: "autokickPenaltyPresence";
|
|
152
|
+
readonly type: "number";
|
|
153
|
+
readonly label: "Autokick presence_penalty delta";
|
|
154
|
+
readonly default: number;
|
|
155
|
+
readonly min: -2;
|
|
156
|
+
readonly max: 2;
|
|
157
|
+
readonly step: 0.1;
|
|
158
|
+
}, {
|
|
159
|
+
readonly field: "deadLoopMaxWindowTokens";
|
|
160
|
+
readonly type: "number";
|
|
161
|
+
readonly label: "Dead-loop window (tokens)";
|
|
162
|
+
readonly default: number;
|
|
163
|
+
readonly min: 10;
|
|
164
|
+
readonly max: 8000;
|
|
165
|
+
readonly step: 1;
|
|
166
|
+
}, {
|
|
167
|
+
readonly field: "deadLoopConsecutiveThreshold";
|
|
168
|
+
readonly type: "number";
|
|
169
|
+
readonly label: "Dead-loop consecutive identical deltas";
|
|
170
|
+
readonly default: number;
|
|
171
|
+
readonly min: 1;
|
|
172
|
+
readonly step: 1;
|
|
173
|
+
}, {
|
|
174
|
+
readonly field: "deadLoopMinRepetitions";
|
|
175
|
+
readonly type: "number";
|
|
176
|
+
readonly label: "Dead-loop cyclic repetitions";
|
|
177
|
+
readonly default: number;
|
|
178
|
+
readonly min: 1;
|
|
179
|
+
readonly step: 1;
|
|
180
|
+
}, {
|
|
181
|
+
readonly field: "deadLoopMinPatternTokens";
|
|
182
|
+
readonly type: "number";
|
|
183
|
+
readonly label: "Dead-loop min pattern tokens";
|
|
184
|
+
readonly default: number;
|
|
185
|
+
readonly min: 1;
|
|
186
|
+
readonly step: 1;
|
|
105
187
|
}, {
|
|
106
188
|
readonly field: "tokenDelayMs";
|
|
107
189
|
readonly type: "number";
|
|
@@ -205,6 +287,88 @@ export declare const fakeLlmNode: {
|
|
|
205
287
|
readonly min: 0;
|
|
206
288
|
readonly max: 32;
|
|
207
289
|
readonly step: 1;
|
|
290
|
+
}, {
|
|
291
|
+
readonly field: "autokickOnIdle";
|
|
292
|
+
readonly type: "boolean";
|
|
293
|
+
readonly label: "Autokick on idle and dead-loop";
|
|
294
|
+
readonly default: boolean;
|
|
295
|
+
}, {
|
|
296
|
+
readonly field: "deadLoopEnabled";
|
|
297
|
+
readonly type: "boolean";
|
|
298
|
+
readonly label: "Detect repetition dead loops";
|
|
299
|
+
readonly default: boolean;
|
|
300
|
+
}, {
|
|
301
|
+
readonly field: "maxAutokickAttempts";
|
|
302
|
+
readonly type: "number";
|
|
303
|
+
readonly label: "Max autokick reconnects (0 = unlimited)";
|
|
304
|
+
readonly default: number;
|
|
305
|
+
readonly min: 0;
|
|
306
|
+
readonly max: 1000;
|
|
307
|
+
readonly step: 1;
|
|
308
|
+
}, {
|
|
309
|
+
readonly field: "autokickBackoffMs";
|
|
310
|
+
readonly type: "number";
|
|
311
|
+
readonly label: "Autokick backoff base (ms)";
|
|
312
|
+
readonly default: number;
|
|
313
|
+
readonly min: 1000;
|
|
314
|
+
readonly step: 1000;
|
|
315
|
+
}, {
|
|
316
|
+
readonly field: "autokickMaxBackoffMs";
|
|
317
|
+
readonly type: "number";
|
|
318
|
+
readonly label: "Autokick backoff clamp (ms)";
|
|
319
|
+
readonly default: number;
|
|
320
|
+
readonly min: 1000;
|
|
321
|
+
readonly step: 1000;
|
|
322
|
+
}, {
|
|
323
|
+
readonly field: "autokickUserMessage";
|
|
324
|
+
readonly type: "string";
|
|
325
|
+
readonly label: "Autokick kick message";
|
|
326
|
+
readonly default: string;
|
|
327
|
+
}, {
|
|
328
|
+
readonly field: "autokickPenaltyFrequency";
|
|
329
|
+
readonly type: "number";
|
|
330
|
+
readonly label: "Autokick frequency_penalty delta";
|
|
331
|
+
readonly default: number;
|
|
332
|
+
readonly min: -2;
|
|
333
|
+
readonly max: 2;
|
|
334
|
+
readonly step: 0.1;
|
|
335
|
+
}, {
|
|
336
|
+
readonly field: "autokickPenaltyPresence";
|
|
337
|
+
readonly type: "number";
|
|
338
|
+
readonly label: "Autokick presence_penalty delta";
|
|
339
|
+
readonly default: number;
|
|
340
|
+
readonly min: -2;
|
|
341
|
+
readonly max: 2;
|
|
342
|
+
readonly step: 0.1;
|
|
343
|
+
}, {
|
|
344
|
+
readonly field: "deadLoopMaxWindowTokens";
|
|
345
|
+
readonly type: "number";
|
|
346
|
+
readonly label: "Dead-loop window (tokens)";
|
|
347
|
+
readonly default: number;
|
|
348
|
+
readonly min: 10;
|
|
349
|
+
readonly max: 8000;
|
|
350
|
+
readonly step: 1;
|
|
351
|
+
}, {
|
|
352
|
+
readonly field: "deadLoopConsecutiveThreshold";
|
|
353
|
+
readonly type: "number";
|
|
354
|
+
readonly label: "Dead-loop consecutive identical deltas";
|
|
355
|
+
readonly default: number;
|
|
356
|
+
readonly min: 1;
|
|
357
|
+
readonly step: 1;
|
|
358
|
+
}, {
|
|
359
|
+
readonly field: "deadLoopMinRepetitions";
|
|
360
|
+
readonly type: "number";
|
|
361
|
+
readonly label: "Dead-loop cyclic repetitions";
|
|
362
|
+
readonly default: number;
|
|
363
|
+
readonly min: 1;
|
|
364
|
+
readonly step: 1;
|
|
365
|
+
}, {
|
|
366
|
+
readonly field: "deadLoopMinPatternTokens";
|
|
367
|
+
readonly type: "number";
|
|
368
|
+
readonly label: "Dead-loop min pattern tokens";
|
|
369
|
+
readonly default: number;
|
|
370
|
+
readonly min: 1;
|
|
371
|
+
readonly step: 1;
|
|
208
372
|
}, {
|
|
209
373
|
readonly field: "tokenDelayMs";
|
|
210
374
|
readonly type: "number";
|
|
@@ -308,6 +472,88 @@ export declare const fakeLlmNode: {
|
|
|
308
472
|
readonly min: 0;
|
|
309
473
|
readonly max: 32;
|
|
310
474
|
readonly step: 1;
|
|
475
|
+
}, {
|
|
476
|
+
readonly field: "autokickOnIdle";
|
|
477
|
+
readonly type: "boolean";
|
|
478
|
+
readonly label: "Autokick on idle and dead-loop";
|
|
479
|
+
readonly default: boolean;
|
|
480
|
+
}, {
|
|
481
|
+
readonly field: "deadLoopEnabled";
|
|
482
|
+
readonly type: "boolean";
|
|
483
|
+
readonly label: "Detect repetition dead loops";
|
|
484
|
+
readonly default: boolean;
|
|
485
|
+
}, {
|
|
486
|
+
readonly field: "maxAutokickAttempts";
|
|
487
|
+
readonly type: "number";
|
|
488
|
+
readonly label: "Max autokick reconnects (0 = unlimited)";
|
|
489
|
+
readonly default: number;
|
|
490
|
+
readonly min: 0;
|
|
491
|
+
readonly max: 1000;
|
|
492
|
+
readonly step: 1;
|
|
493
|
+
}, {
|
|
494
|
+
readonly field: "autokickBackoffMs";
|
|
495
|
+
readonly type: "number";
|
|
496
|
+
readonly label: "Autokick backoff base (ms)";
|
|
497
|
+
readonly default: number;
|
|
498
|
+
readonly min: 1000;
|
|
499
|
+
readonly step: 1000;
|
|
500
|
+
}, {
|
|
501
|
+
readonly field: "autokickMaxBackoffMs";
|
|
502
|
+
readonly type: "number";
|
|
503
|
+
readonly label: "Autokick backoff clamp (ms)";
|
|
504
|
+
readonly default: number;
|
|
505
|
+
readonly min: 1000;
|
|
506
|
+
readonly step: 1000;
|
|
507
|
+
}, {
|
|
508
|
+
readonly field: "autokickUserMessage";
|
|
509
|
+
readonly type: "string";
|
|
510
|
+
readonly label: "Autokick kick message";
|
|
511
|
+
readonly default: string;
|
|
512
|
+
}, {
|
|
513
|
+
readonly field: "autokickPenaltyFrequency";
|
|
514
|
+
readonly type: "number";
|
|
515
|
+
readonly label: "Autokick frequency_penalty delta";
|
|
516
|
+
readonly default: number;
|
|
517
|
+
readonly min: -2;
|
|
518
|
+
readonly max: 2;
|
|
519
|
+
readonly step: 0.1;
|
|
520
|
+
}, {
|
|
521
|
+
readonly field: "autokickPenaltyPresence";
|
|
522
|
+
readonly type: "number";
|
|
523
|
+
readonly label: "Autokick presence_penalty delta";
|
|
524
|
+
readonly default: number;
|
|
525
|
+
readonly min: -2;
|
|
526
|
+
readonly max: 2;
|
|
527
|
+
readonly step: 0.1;
|
|
528
|
+
}, {
|
|
529
|
+
readonly field: "deadLoopMaxWindowTokens";
|
|
530
|
+
readonly type: "number";
|
|
531
|
+
readonly label: "Dead-loop window (tokens)";
|
|
532
|
+
readonly default: number;
|
|
533
|
+
readonly min: 10;
|
|
534
|
+
readonly max: 8000;
|
|
535
|
+
readonly step: 1;
|
|
536
|
+
}, {
|
|
537
|
+
readonly field: "deadLoopConsecutiveThreshold";
|
|
538
|
+
readonly type: "number";
|
|
539
|
+
readonly label: "Dead-loop consecutive identical deltas";
|
|
540
|
+
readonly default: number;
|
|
541
|
+
readonly min: 1;
|
|
542
|
+
readonly step: 1;
|
|
543
|
+
}, {
|
|
544
|
+
readonly field: "deadLoopMinRepetitions";
|
|
545
|
+
readonly type: "number";
|
|
546
|
+
readonly label: "Dead-loop cyclic repetitions";
|
|
547
|
+
readonly default: number;
|
|
548
|
+
readonly min: 1;
|
|
549
|
+
readonly step: 1;
|
|
550
|
+
}, {
|
|
551
|
+
readonly field: "deadLoopMinPatternTokens";
|
|
552
|
+
readonly type: "number";
|
|
553
|
+
readonly label: "Dead-loop min pattern tokens";
|
|
554
|
+
readonly default: number;
|
|
555
|
+
readonly min: 1;
|
|
556
|
+
readonly step: 1;
|
|
311
557
|
}, {
|
|
312
558
|
readonly field: "tokenDelayMs";
|
|
313
559
|
readonly type: "number";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type ChatCompletionAbortSignal = {
|
|
2
|
+
readonly aborted: boolean;
|
|
3
|
+
};
|
|
4
|
+
export type ChatCompletionToolCall = {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
/** JSON object string (OpenAI-compatible). */
|
|
8
|
+
readonly arguments: string;
|
|
9
|
+
};
|
|
10
|
+
export type ChatCompletionMessage = {
|
|
11
|
+
readonly role: 'system' | 'user';
|
|
12
|
+
readonly content: string;
|
|
13
|
+
} | {
|
|
14
|
+
readonly role: 'assistant';
|
|
15
|
+
readonly content: string;
|
|
16
|
+
readonly tool_calls?: readonly ChatCompletionToolCall[];
|
|
17
|
+
} | {
|
|
18
|
+
readonly role: 'tool';
|
|
19
|
+
readonly content: string;
|
|
20
|
+
readonly tool_call_id: string;
|
|
21
|
+
};
|
|
22
|
+
export type ChatCompletionToolDefinition = {
|
|
23
|
+
readonly type: 'function';
|
|
24
|
+
readonly function: {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly description?: string;
|
|
27
|
+
readonly parameters?: object;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type ChatCompletionFinishReason = 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'unknown';
|
|
31
|
+
export type ChatCompletionStreamChunk = {
|
|
32
|
+
readonly kind: 'reasoning';
|
|
33
|
+
readonly text: string;
|
|
34
|
+
} | {
|
|
35
|
+
readonly kind: 'draft';
|
|
36
|
+
readonly text: string;
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: 'done';
|
|
39
|
+
readonly text: string;
|
|
40
|
+
readonly tool_calls?: readonly ChatCompletionToolCall[];
|
|
41
|
+
readonly finishReason?: ChatCompletionFinishReason;
|
|
42
|
+
};
|
|
43
|
+
export type CreateChatCompletionStreamArgs = {
|
|
44
|
+
readonly providerId: string;
|
|
45
|
+
readonly model: string;
|
|
46
|
+
readonly messages: readonly ChatCompletionMessage[];
|
|
47
|
+
readonly tools?: readonly ChatCompletionToolDefinition[];
|
|
48
|
+
readonly signal?: ChatCompletionAbortSignal;
|
|
49
|
+
readonly frequency_penalty?: number;
|
|
50
|
+
readonly presence_penalty?: number;
|
|
51
|
+
};
|
|
52
|
+
/** OpenAI-compatible chat stream factory (credentials resolved server-side). */
|
|
53
|
+
export type CreateChatCompletionStream = (args: CreateChatCompletionStreamArgs) => Promise<AsyncIterable<ChatCompletionStreamChunk>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const autokickBackoffMs: (attempt: number, baseMs: number, maxMs: number) => number;
|
|
2
|
+
export declare const clampChatPenalty: (value: number) => number;
|
|
3
|
+
export declare const autokickPenalties: (attempt: number, delta: {
|
|
4
|
+
readonly frequency: number;
|
|
5
|
+
readonly presence: number;
|
|
6
|
+
}) => {
|
|
7
|
+
readonly frequency: number;
|
|
8
|
+
readonly presence: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const autokickKickUserTurn: (content: string) => {
|
|
11
|
+
readonly role: "user";
|
|
12
|
+
readonly content: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const autokickBackoffMs = (attempt, baseMs, maxMs) => {
|
|
2
|
+
const safeAttempt = Math.max(1, attempt);
|
|
3
|
+
const delay = baseMs * 2 ** (safeAttempt - 1);
|
|
4
|
+
return Math.min(delay, maxMs);
|
|
5
|
+
};
|
|
6
|
+
export const clampChatPenalty = (value) => Math.min(2, Math.max(-2, value));
|
|
7
|
+
export const autokickPenalties = (attempt, delta) => {
|
|
8
|
+
const safeAttempt = Math.max(1, attempt);
|
|
9
|
+
return {
|
|
10
|
+
frequency: clampChatPenalty(delta.frequency * safeAttempt),
|
|
11
|
+
presence: clampChatPenalty(delta.presence * safeAttempt),
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export const autokickKickUserTurn = (content) => ({
|
|
15
|
+
role: 'user',
|
|
16
|
+
content,
|
|
17
|
+
});
|