@1agents/acp-service 0.10.12 → 0.11.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/dist/src/catalog.js +13 -3
- package/package.json +4 -4
- package/skills/acp-service/SKILL.md +1 -1
- package/vendor/runtime/README.md +36 -11
- package/vendor/runtime/dist/{agent-registry-DxcyXXqb.js → agent-registry-CsdsVpJb.js} +209 -177
- package/vendor/runtime/dist/agent-registry-CsdsVpJb.js.map +1 -0
- package/vendor/runtime/dist/agent-registry.d.ts +0 -2
- package/vendor/runtime/dist/agent-registry.d.ts.map +1 -1
- package/vendor/runtime/dist/agent-registry.js +1 -1
- package/vendor/runtime/dist/{cli-BKmMxgix.js → cli-B5gQOSDl.js} +33 -14
- package/vendor/runtime/dist/cli-B5gQOSDl.js.map +1 -0
- package/vendor/runtime/dist/cli.d.ts +2 -6
- package/vendor/runtime/dist/cli.d.ts.map +1 -1
- package/vendor/runtime/dist/cli.js +189 -164
- package/vendor/runtime/dist/cli.js.map +1 -1
- package/vendor/runtime/dist/{client-C5zneoBs.d.ts → client-D5y4RXME.d.ts} +4 -12
- package/vendor/runtime/dist/client-D5y4RXME.d.ts.map +1 -0
- package/vendor/runtime/dist/docs-site/CLI.html +19 -21
- package/vendor/runtime/dist/docs-site/VISION.html +3 -2
- package/vendor/runtime/dist/docs-site/agents.html +10 -15
- package/vendor/runtime/dist/docs-site/assets/agents/Apache-2.0.txt +202 -0
- package/vendor/runtime/dist/docs-site/assets/agents/LobeHub-MIT.txt +21 -0
- package/vendor/runtime/dist/docs-site/assets/agents/Mux-AGPL-3.0.txt +661 -0
- package/vendor/runtime/dist/docs-site/assets/agents/README.md +41 -0
- package/vendor/runtime/dist/docs-site/assets/agents/ante.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/antigravity.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/claude.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/codex.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/copilot.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/cursor.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/deepseek-harness.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/devin.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/droid.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/fast-agent.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/fx.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/gemini.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/goose.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/grok-build.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/iflow.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/junie.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/kilocode.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/kimi.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/kiro.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/mcode.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/mux.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/octomind.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/openclaw.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/opencode.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/pi.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/pool.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/qoder.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/qwen.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/trae.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/zeroclaw.png +0 -0
- package/vendor/runtime/dist/docs-site/compare.html +8 -7
- package/vendor/runtime/dist/docs-site/config.html +5 -4
- package/vendor/runtime/dist/docs-site/custom-agents.html +13 -13
- package/vendor/runtime/dist/docs-site/exit-codes.html +4 -3
- package/vendor/runtime/dist/docs-site/flows.html +21 -8
- package/vendor/runtime/dist/docs-site/index.html +7 -6
- package/vendor/runtime/dist/docs-site/install.html +7 -6
- package/vendor/runtime/dist/docs-site/llms.txt +6 -6
- package/vendor/runtime/dist/docs-site/output-formats.html +9 -8
- package/vendor/runtime/dist/docs-site/permissions.html +5 -4
- package/vendor/runtime/dist/docs-site/prompting.html +9 -7
- package/vendor/runtime/dist/docs-site/quickstart.html +5 -4
- package/vendor/runtime/dist/docs-site/releasing.html +9 -8
- package/vendor/runtime/dist/docs-site/runtime-environment.html +28 -5
- package/vendor/runtime/dist/docs-site/runtime-process-lifecycle.html +13 -7
- package/vendor/runtime/dist/docs-site/safe-errors.html +3 -2
- package/vendor/runtime/dist/docs-site/session-control.html +7 -6
- package/vendor/runtime/dist/docs-site/session-watch.html +6 -5
- package/vendor/runtime/dist/docs-site/sessions.html +13 -10
- package/vendor/runtime/dist/docs-site/shared-sessions.html +7 -4
- package/vendor/runtime/dist/{flows-VrII9VKZ.js → flows-CDj5YcTh.js} +136 -68
- package/vendor/runtime/dist/flows-CDj5YcTh.js.map +1 -0
- package/vendor/runtime/dist/flows.d.ts +28 -19
- package/vendor/runtime/dist/flows.d.ts.map +1 -1
- package/vendor/runtime/dist/flows.js +1 -1
- package/vendor/runtime/dist/{invocation-options-DHMZ5Rrb.js → input-file-BsfVGZgn.js} +30 -15
- package/vendor/runtime/dist/input-file-BsfVGZgn.js.map +1 -0
- package/vendor/runtime/dist/{ipc-CNNM5DP_.js → ipc-DfqJsbk6.js} +114 -146
- package/vendor/runtime/dist/ipc-DfqJsbk6.js.map +1 -0
- package/vendor/runtime/dist/{output-DtzXtiBc.js → output-DOIF4iFc.js} +20 -47
- package/vendor/runtime/dist/output-DOIF4iFc.js.map +1 -0
- package/vendor/runtime/dist/{queue-owner-runtime-ehuh3SQU.js → queue-owner-runtime-DHBQbjXo.js} +394 -258
- package/vendor/runtime/dist/queue-owner-runtime-DHBQbjXo.js.map +1 -0
- package/vendor/runtime/dist/runtime.d.ts +37 -36
- package/vendor/runtime/dist/runtime.d.ts.map +1 -1
- package/vendor/runtime/dist/runtime.js +117 -172
- package/vendor/runtime/dist/runtime.js.map +1 -1
- package/vendor/runtime/dist/{session-options-NjpFwf-c.d.ts → session-options-Ci4aw1oD.d.ts} +13 -16
- package/vendor/runtime/dist/session-options-Ci4aw1oD.d.ts.map +1 -0
- package/vendor/runtime/dist/{session-watch-CbKfGRkZ.js → session-watch-DRwFHcWw.js} +5 -6
- package/vendor/runtime/dist/{session-watch-CbKfGRkZ.js.map → session-watch-DRwFHcWw.js.map} +1 -1
- package/vendor/runtime/dist/{watch-BGt4kcE6.js → watch-CUDGkljG.js} +3 -4
- package/vendor/runtime/dist/{watch-BGt4kcE6.js.map → watch-CUDGkljG.js.map} +1 -1
- package/vendor/runtime/package.json +3 -3
- package/vendor/runtime/skills/acpx/SKILL.md +42 -11
- package/vendor/runtime/dist/agent-registry-DxcyXXqb.js.map +0 -1
- package/vendor/runtime/dist/cli-BKmMxgix.js.map +0 -1
- package/vendor/runtime/dist/client-C5zneoBs.d.ts.map +0 -1
- package/vendor/runtime/dist/flows-VrII9VKZ.js.map +0 -1
- package/vendor/runtime/dist/invocation-options-DHMZ5Rrb.js.map +0 -1
- package/vendor/runtime/dist/ipc-CNNM5DP_.js.map +0 -1
- package/vendor/runtime/dist/output-DtzXtiBc.js.map +0 -1
- package/vendor/runtime/dist/queue-owner-runtime-ehuh3SQU.js.map +0 -1
- package/vendor/runtime/dist/session-options-NjpFwf-c.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { G as recordSessionUpdate, H as createSessionConversation, K as cloneSessionAcpxState, U as recordClientOperation, W as recordPromptSubmission, dt as TimeoutError, i as runOnce, m as createSessionWithClient, mt as withTimeout, o as sendSessionDirect, pt as withInterrupt, ut as InterruptedError } from "./queue-owner-runtime-DHBQbjXo.js";
|
|
2
|
+
import { C as promptToDisplayText, It as PERMISSION_MODES, Rt as SESSION_RECORD_SCHEMA, bt as writePrivateFile, in as describeSpawnEnoent, pt as defaultSessionEventLog, w as textPrompt, xt as writePrivateJsonFile, z as resolveSessionRecord } from "./ipc-DfqJsbk6.js";
|
|
3
|
+
import { a as MAX_TIMER_DELAY_MS, t as createOutputFormatter } from "./output-DOIF4iFc.js";
|
|
4
|
+
import { D as runTimedExecFile } from "./agent-registry-CsdsVpJb.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
7
7
|
import fs from "node:fs/promises";
|
|
@@ -11,14 +11,13 @@ import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
|
11
11
|
import { ZodError, z } from "zod";
|
|
12
12
|
import { createHash, randomUUID } from "node:crypto";
|
|
13
13
|
import { performance } from "node:perf_hooks";
|
|
14
|
-
|
|
14
|
+
// src/flows/timeout.ts
|
|
15
15
|
function resolveFlowTimeoutMs(timeoutMs) {
|
|
16
16
|
if (timeoutMs === void 0) return;
|
|
17
17
|
if (!Number.isFinite(timeoutMs) || timeoutMs > 2147483647) throw new TypeError(`timeoutMs must be a finite number no greater than ${MAX_TIMER_DELAY_MS}`);
|
|
18
18
|
return timeoutMs > 0 ? timeoutMs : void 0;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
//#region src/flows/attempt.ts
|
|
20
|
+
// src/flows/attempt.ts
|
|
22
21
|
/** One node attempt owns admission and completion of its managed operations. */
|
|
23
22
|
var FlowAttempt = class {
|
|
24
23
|
signal;
|
|
@@ -142,8 +141,7 @@ var FlowAttempt = class {
|
|
|
142
141
|
return new AggregateError(failures, "Flow attempt cleanup failed", { cause: failures[0] });
|
|
143
142
|
}
|
|
144
143
|
};
|
|
145
|
-
|
|
146
|
-
//#region src/flows/authoring.ts
|
|
144
|
+
// src/flows/authoring.ts
|
|
147
145
|
const FLOW_DEFINITION_BRAND = Symbol.for("acpx.flow.definition");
|
|
148
146
|
function markDefinedFlow(definition) {
|
|
149
147
|
if (isDefinedFlow(definition)) return definition;
|
|
@@ -158,8 +156,7 @@ function markDefinedFlow(definition) {
|
|
|
158
156
|
function isDefinedFlow(value) {
|
|
159
157
|
return value != null && typeof value === "object" && value[FLOW_DEFINITION_BRAND] === true;
|
|
160
158
|
}
|
|
161
|
-
|
|
162
|
-
//#region src/flows/schema.ts
|
|
159
|
+
// src/flows/schema.ts
|
|
163
160
|
const FLOW_NODE_TYPES = [
|
|
164
161
|
"acp",
|
|
165
162
|
"compute",
|
|
@@ -193,6 +190,11 @@ const acpNodeSchema = extensibleObject({
|
|
|
193
190
|
...flowNodeCommonShape,
|
|
194
191
|
nodeType: z.literal("acp"),
|
|
195
192
|
profile: z.string().optional(),
|
|
193
|
+
modelId: nonEmptyTrimmedStringSchema.optional(),
|
|
194
|
+
configOptions: z.array(extensibleObject({
|
|
195
|
+
configId: nonEmptyTrimmedStringSchema,
|
|
196
|
+
value: nonEmptyTrimmedStringSchema
|
|
197
|
+
})).optional(),
|
|
196
198
|
cwd: z.union([z.string(), functionSchema("cwd")]).optional(),
|
|
197
199
|
session: acpSessionSchema.optional(),
|
|
198
200
|
prompt: functionSchema("prompt"),
|
|
@@ -320,8 +322,7 @@ function formatIssue(issue, parentPath = []) {
|
|
|
320
322
|
function hasOwn(value, key) {
|
|
321
323
|
return value != null && typeof value === "object" && Object.prototype.hasOwnProperty.call(value, key);
|
|
322
324
|
}
|
|
323
|
-
|
|
324
|
-
//#region src/flows/definition.ts
|
|
325
|
+
// src/flows/definition.ts
|
|
325
326
|
function defineFlow(definition) {
|
|
326
327
|
assertValidFlowDefinitionShape(definition);
|
|
327
328
|
return markDefinedFlow(definition);
|
|
@@ -366,8 +367,7 @@ function checkpoint(definition = {}) {
|
|
|
366
367
|
assertValidCheckpointNodeDefinition(node);
|
|
367
368
|
return node;
|
|
368
369
|
}
|
|
369
|
-
|
|
370
|
-
//#region src/flows/executors/shell-output.ts
|
|
370
|
+
// src/flows/executors/shell-output.ts
|
|
371
371
|
function validateShellActionMaxBufferBytes(value) {
|
|
372
372
|
if (value === void 0) return;
|
|
373
373
|
if (!Number.isSafeInteger(value) || value < 0) throw new Error("Shell action maxBufferBytes must be a non-negative safe integer");
|
|
@@ -396,8 +396,7 @@ function createShellOutputCapture(maxBufferBytes, inactive, overflow) {
|
|
|
396
396
|
}
|
|
397
397
|
};
|
|
398
398
|
}
|
|
399
|
-
|
|
400
|
-
//#region src/flows/executors/shell-process.ts
|
|
399
|
+
// src/flows/executors/shell-process.ts
|
|
401
400
|
const KILL_GRACE_MS = 1e3;
|
|
402
401
|
async function readPosixProcesses() {
|
|
403
402
|
return (await runTimedExecFile("ps", ["-eo", "pid=,ppid=,pgid=,stat="])).trim().split("\n").map((line) => {
|
|
@@ -519,8 +518,7 @@ function hasShellProcesses(child) {
|
|
|
519
518
|
return error.code !== "ESRCH";
|
|
520
519
|
}
|
|
521
520
|
}
|
|
522
|
-
|
|
523
|
-
//#region src/flows/executors/shell.ts
|
|
521
|
+
// src/flows/executors/shell.ts
|
|
524
522
|
function writeShellStdin(child, stdin) {
|
|
525
523
|
const stream = child.stdin;
|
|
526
524
|
if (!stream) return;
|
|
@@ -693,12 +691,13 @@ async function runShellProcess(spec, options, mode) {
|
|
|
693
691
|
const timeoutMs = resolveShellActionTimeoutMs(spec.timeoutMs);
|
|
694
692
|
validateShellActionMaxBufferBytes(spec.maxBufferBytes);
|
|
695
693
|
if (spec.stdin !== void 0 && typeof spec.stdin !== "string") throw new TypeError("stdin must be a string");
|
|
694
|
+
const env = {
|
|
695
|
+
...process.env,
|
|
696
|
+
...spec.env
|
|
697
|
+
};
|
|
696
698
|
const child = spawn(spec.command, args, {
|
|
697
699
|
cwd,
|
|
698
|
-
env
|
|
699
|
-
...process.env,
|
|
700
|
-
...spec.env
|
|
701
|
-
},
|
|
700
|
+
env,
|
|
702
701
|
shell: spec.shell,
|
|
703
702
|
stdio: [
|
|
704
703
|
"pipe",
|
|
@@ -717,7 +716,11 @@ async function runShellProcess(spec, options, mode) {
|
|
|
717
716
|
return result;
|
|
718
717
|
} catch (error) {
|
|
719
718
|
await termination.cancel("SIGTERM");
|
|
720
|
-
throw error
|
|
719
|
+
throw describeSpawnEnoent(error, `Shell action failed (${renderShellCommand(spec.command, args)}): `, {
|
|
720
|
+
command: spec.command,
|
|
721
|
+
cwd,
|
|
722
|
+
env
|
|
723
|
+
});
|
|
721
724
|
} finally {
|
|
722
725
|
await termination.dispose();
|
|
723
726
|
}
|
|
@@ -727,8 +730,7 @@ function throwIfShellCancelled(signal, mode) {
|
|
|
727
730
|
const reason = signal.reason;
|
|
728
731
|
if (mode === "command" || reason instanceof TimeoutError || reason instanceof InterruptedError) throw reason;
|
|
729
732
|
}
|
|
730
|
-
|
|
731
|
-
//#region src/flows/graph.ts
|
|
733
|
+
// src/flows/graph.ts
|
|
732
734
|
function validateFlowDefinition(flow) {
|
|
733
735
|
assertValidFlowDefinitionShape(flow);
|
|
734
736
|
assertKnownFlowNode(flow, flow.startAt, "Flow start node is missing");
|
|
@@ -776,8 +778,7 @@ function getByPath(value, jsonPath) {
|
|
|
776
778
|
return current[key];
|
|
777
779
|
}, value);
|
|
778
780
|
}
|
|
779
|
-
|
|
780
|
-
//#region src/flows/runtime-support.ts
|
|
781
|
+
// src/flows/runtime-support.ts
|
|
781
782
|
function isoNow$1() {
|
|
782
783
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
783
784
|
}
|
|
@@ -1056,8 +1057,30 @@ function findConversationDeltaStart(before, after) {
|
|
|
1056
1057
|
function deepEqualJson(left, right) {
|
|
1057
1058
|
return JSON.stringify(left) === JSON.stringify(right);
|
|
1058
1059
|
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1060
|
+
// src/flows/session-settings.ts
|
|
1061
|
+
function assertCompatibleSessionSettings(node, binding) {
|
|
1062
|
+
const pinned = binding.requestedSettings ?? { configOptions: [] };
|
|
1063
|
+
if (node.modelId !== void 0 && node.modelId.trim() !== normalizedModel(pinned.model)) throw new Error(`Conflicting model for persistent session handle "${binding.handle}"`);
|
|
1064
|
+
const pinnedOptions = finalSelections(pinned.configOptions);
|
|
1065
|
+
for (const [configId, value] of finalSelections(node.configOptions ?? [])) if (pinnedOptions.get(configId) !== value) throw new Error(`Conflicting config option "${configId}" for persistent session handle "${binding.handle}"`);
|
|
1066
|
+
}
|
|
1067
|
+
function normalizedModel(model) {
|
|
1068
|
+
return model?.trim();
|
|
1069
|
+
}
|
|
1070
|
+
function finalSelections(selections) {
|
|
1071
|
+
return new Map(selections.map(({ configId, value }) => [configId, value]));
|
|
1072
|
+
}
|
|
1073
|
+
function assertReplayedSessionSettings(binding, configuration) {
|
|
1074
|
+
const accepted = binding.acceptedSettings ?? { configOptions: [] };
|
|
1075
|
+
if (!replayedModelMatches(accepted.model, configuration.model)) throw new Error(`Cannot replay pinned model for persistent session handle "${binding.handle}"`);
|
|
1076
|
+
const expected = new Map(accepted.configOptions.map(({ configId, acceptedValue }) => [configId, acceptedValue]));
|
|
1077
|
+
for (const [configId, acceptedValue] of new Map(configuration.configOptions.map((selection) => [selection.configId, selection.acceptedValue]))) if (expected.get(configId) !== acceptedValue) throw new Error(`Cannot replay pinned config option "${configId}" for persistent session handle "${binding.handle}"`);
|
|
1078
|
+
}
|
|
1079
|
+
function replayedModelMatches(expected, actual) {
|
|
1080
|
+
if (!expected?.applied) return true;
|
|
1081
|
+
return actual?.applied === true && actual.accepted === expected.accepted;
|
|
1082
|
+
}
|
|
1083
|
+
// src/flows/store.ts
|
|
1061
1084
|
const FLOW_BUNDLE_SCHEMA = "acpx.flow-run-bundle.v1";
|
|
1062
1085
|
const FLOW_TRACE_SCHEMA = "acpx.flow-trace-event.v1";
|
|
1063
1086
|
const FLOW_SNAPSHOT_SCHEMA = "acpx.flow-definition-snapshot.v1";
|
|
@@ -1378,6 +1401,8 @@ function snapshotAcpNode(node, common) {
|
|
|
1378
1401
|
return {
|
|
1379
1402
|
...common,
|
|
1380
1403
|
...node.profile ? { profile: node.profile } : {},
|
|
1404
|
+
...node.modelId === void 0 ? {} : { modelId: node.modelId },
|
|
1405
|
+
...node.configOptions === void 0 ? {} : { configOptions: node.configOptions.map((selection) => ({ ...selection })) },
|
|
1381
1406
|
session: {
|
|
1382
1407
|
...node.session?.handle ? { handle: node.session.handle } : {},
|
|
1383
1408
|
...node.session?.isolated ? { isolated: true } : {}
|
|
@@ -1431,8 +1456,7 @@ function sessionDirPath(bundleId) {
|
|
|
1431
1456
|
function isoNow() {
|
|
1432
1457
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
1433
1458
|
}
|
|
1434
|
-
|
|
1435
|
-
//#region src/flows/runtime.ts
|
|
1459
|
+
// src/flows/runtime.ts
|
|
1436
1460
|
const DEFAULT_FLOW_HEARTBEAT_MS = 5e3;
|
|
1437
1461
|
const DEFAULT_FLOW_STEP_TIMEOUT_MS = 9e5;
|
|
1438
1462
|
function setNodeValue(values, nodeId, value) {
|
|
@@ -1450,6 +1474,7 @@ var FlowRunner = class {
|
|
|
1450
1474
|
defaultNodeTimeoutMs;
|
|
1451
1475
|
suppressSdkConsoleErrors;
|
|
1452
1476
|
sessionOptions;
|
|
1477
|
+
configOptions;
|
|
1453
1478
|
services;
|
|
1454
1479
|
store;
|
|
1455
1480
|
pendingPersistentSessionClients = /* @__PURE__ */ new Map();
|
|
@@ -1473,6 +1498,7 @@ var FlowRunner = class {
|
|
|
1473
1498
|
this.defaultNodeTimeoutMs = options.defaultNodeTimeoutMs ?? options.timeoutMs ?? DEFAULT_FLOW_STEP_TIMEOUT_MS;
|
|
1474
1499
|
this.suppressSdkConsoleErrors = options.suppressSdkConsoleErrors;
|
|
1475
1500
|
this.sessionOptions = options.sessionOptions;
|
|
1501
|
+
this.configOptions = options.configOptions ?? [];
|
|
1476
1502
|
this.services = options.services ?? {};
|
|
1477
1503
|
this.store = new FlowRunStore(options.outputRoot);
|
|
1478
1504
|
}
|
|
@@ -1529,7 +1555,7 @@ var FlowRunner = class {
|
|
|
1529
1555
|
cancellation ??= this.cancelShellOwners(runDir, signal);
|
|
1530
1556
|
cancellation.catch(() => {});
|
|
1531
1557
|
this.attempts.get(runDir)?.cancel(reason, signal);
|
|
1532
|
-
await execution
|
|
1558
|
+
await execution;
|
|
1533
1559
|
}).then((value) => ({
|
|
1534
1560
|
ok: true,
|
|
1535
1561
|
value
|
|
@@ -1886,9 +1912,22 @@ var FlowRunner = class {
|
|
|
1886
1912
|
async executeAcpNode(runDir, state, flow, node, context) {
|
|
1887
1913
|
const attempt = context.attempt;
|
|
1888
1914
|
const prepared = await this.prepareAcpPrompt(runDir, state, node, context);
|
|
1889
|
-
|
|
1890
|
-
const
|
|
1891
|
-
|
|
1915
|
+
const isolated = node.session?.isolated;
|
|
1916
|
+
const binding = isolated ? createIsolatedSessionBinding(flow.name, state.runId, attempt.attemptId, node.profile, prepared.agentInfo) : await this.ensureSessionBinding(runDir, state, flow, node, prepared.agentInfo, attempt);
|
|
1917
|
+
if (isolated) {
|
|
1918
|
+
const requestedSettings = this.resolveSessionSettings(node);
|
|
1919
|
+
if (requestedSettings.model !== void 0 || requestedSettings.configOptions.length > 0) binding.requestedSettings = requestedSettings;
|
|
1920
|
+
}
|
|
1921
|
+
prepared.result.sessionInfo = binding;
|
|
1922
|
+
if (isolated) await attempt.own(() => this.initializeIsolatedSessionBundle(runDir, state, binding, attempt));
|
|
1923
|
+
await attempt.own(() => this.appendAcpPromptPreparedTrace(runDir, state, binding, prepared.promptArtifact, attempt));
|
|
1924
|
+
const prompt = await attempt.own(() => isolated ? this.runIsolatedPrompt(runDir, state, binding, prepared) : this.runPersistentPrompt(runDir, state, binding, prepared));
|
|
1925
|
+
await attempt.own(() => this.appendAcpResponseParsedTrace(runDir, state, prompt, attempt));
|
|
1926
|
+
const output = await this.parseAcpOutput(node, context, prompt.rawText);
|
|
1927
|
+
return {
|
|
1928
|
+
...prepared.result,
|
|
1929
|
+
output
|
|
1930
|
+
};
|
|
1892
1931
|
}
|
|
1893
1932
|
async prepareAcpPrompt(runDir, state, node, context) {
|
|
1894
1933
|
const resolvedAgent = this.resolveAgent(node.profile);
|
|
@@ -1936,14 +1975,6 @@ var FlowRunner = class {
|
|
|
1936
1975
|
payload: { statusDetail: state.statusDetail }
|
|
1937
1976
|
});
|
|
1938
1977
|
}
|
|
1939
|
-
async executeIsolatedAcpPrompt(runDir, state, flow, node, context, prepared) {
|
|
1940
|
-
const binding = createIsolatedSessionBinding(flow.name, state.runId, prepared.attempt.attemptId, node.profile, prepared.agentInfo);
|
|
1941
|
-
prepared.result.sessionInfo = binding;
|
|
1942
|
-
await prepared.attempt.own(() => this.initializeIsolatedSessionBundle(runDir, state, binding, prepared.attempt));
|
|
1943
|
-
await prepared.attempt.own(() => this.appendAcpPromptPreparedTrace(runDir, state, binding, prepared.promptArtifact, prepared.attempt));
|
|
1944
|
-
const prompt = await prepared.attempt.own(() => this.runIsolatedPrompt(runDir, state, binding, prepared));
|
|
1945
|
-
return await this.finishAcpPrompt(runDir, state, node, context, prepared, prompt);
|
|
1946
|
-
}
|
|
1947
1978
|
async initializeIsolatedSessionBundle(runDir, state, binding, attempt) {
|
|
1948
1979
|
const timestamp = attempt.startedAt;
|
|
1949
1980
|
const initialRecord = createSyntheticSessionRecord({
|
|
@@ -1956,12 +1987,6 @@ var FlowRunner = class {
|
|
|
1956
1987
|
});
|
|
1957
1988
|
await this.store.ensureSessionBundle(runDir, state, binding, initialRecord);
|
|
1958
1989
|
}
|
|
1959
|
-
async executePersistentAcpPrompt(runDir, state, node, context, prepared, binding) {
|
|
1960
|
-
prepared.result.sessionInfo = binding;
|
|
1961
|
-
await prepared.attempt.own(() => this.appendAcpPromptPreparedTrace(runDir, state, binding, prepared.promptArtifact, prepared.attempt));
|
|
1962
|
-
const prompt = await prepared.attempt.own(() => this.runPersistentPrompt(runDir, state, binding, prepared));
|
|
1963
|
-
return await this.finishAcpPrompt(runDir, state, node, context, prepared, prompt);
|
|
1964
|
-
}
|
|
1965
1990
|
async appendAcpPromptPreparedTrace(runDir, state, binding, promptArtifact, attempt) {
|
|
1966
1991
|
await this.store.appendTrace(runDir, state, {
|
|
1967
1992
|
scope: "acp",
|
|
@@ -1975,14 +2000,6 @@ var FlowRunner = class {
|
|
|
1975
2000
|
}
|
|
1976
2001
|
});
|
|
1977
2002
|
}
|
|
1978
|
-
async finishAcpPrompt(runDir, state, node, context, prepared, prompt) {
|
|
1979
|
-
await prepared.attempt.own(() => this.appendAcpResponseParsedTrace(runDir, state, prompt, prepared.attempt));
|
|
1980
|
-
const output = await this.parseAcpOutput(node, context, prompt.rawText);
|
|
1981
|
-
return {
|
|
1982
|
-
...prepared.result,
|
|
1983
|
-
output
|
|
1984
|
-
};
|
|
1985
|
-
}
|
|
1986
2003
|
async publishAcpCapture(runDir, state, prepared, sessionInfo, record, messageStart, rawText, events) {
|
|
1987
2004
|
const result = prepared.result;
|
|
1988
2005
|
result.sessionInfo = sessionInfo;
|
|
@@ -2062,14 +2079,26 @@ var FlowRunner = class {
|
|
|
2062
2079
|
}, heartbeatMs);
|
|
2063
2080
|
return () => clearInterval(timer);
|
|
2064
2081
|
}
|
|
2082
|
+
resolveSessionSettings(node) {
|
|
2083
|
+
return {
|
|
2084
|
+
model: node.modelId ?? this.sessionOptions?.model,
|
|
2085
|
+
configOptions: [...this.configOptions, ...node.configOptions ?? []].map(({ configId, value }) => ({
|
|
2086
|
+
configId,
|
|
2087
|
+
value
|
|
2088
|
+
}))
|
|
2089
|
+
};
|
|
2090
|
+
}
|
|
2065
2091
|
async ensureSessionBinding(runDir, state, flow, node, agent, attempt) {
|
|
2066
2092
|
const handle = node.session?.handle ?? "main";
|
|
2067
2093
|
const key = createSessionBindingKey(agent.agentCommand, agent.cwd, handle, agent.agentArgv);
|
|
2068
2094
|
const existing = state.sessionBindings[key];
|
|
2069
2095
|
if (existing) {
|
|
2096
|
+
assertCompatibleSessionSettings(node, existing);
|
|
2070
2097
|
await attempt.own(() => this.store.ensureSessionBundle(runDir, state, existing));
|
|
2071
2098
|
return existing;
|
|
2072
2099
|
}
|
|
2100
|
+
const requestedSettings = this.resolveSessionSettings(node);
|
|
2101
|
+
let acceptedSettings;
|
|
2073
2102
|
const name = createSessionName(flow.name, handle, agent.cwd, state.runId);
|
|
2074
2103
|
const created = await attempt.own(async () => {
|
|
2075
2104
|
const acquired = await createSessionWithClient({
|
|
@@ -2080,7 +2109,14 @@ var FlowRunner = class {
|
|
|
2080
2109
|
...this.connectionOptions,
|
|
2081
2110
|
signal: attempt.signal,
|
|
2082
2111
|
handleProcessInterrupts: false,
|
|
2083
|
-
sessionOptions:
|
|
2112
|
+
sessionOptions: {
|
|
2113
|
+
...this.sessionOptions,
|
|
2114
|
+
model: requestedSettings.model
|
|
2115
|
+
},
|
|
2116
|
+
configOptions: requestedSettings.configOptions,
|
|
2117
|
+
onSessionConfigured: (configuration) => {
|
|
2118
|
+
acceptedSettings = configuration;
|
|
2119
|
+
}
|
|
2084
2120
|
});
|
|
2085
2121
|
this.pendingClientReleases.set(acquired.client, attempt.registerCancellation(async () => {
|
|
2086
2122
|
const clients = this.pendingPersistentSessionClients.get(runDir);
|
|
@@ -2091,6 +2127,10 @@ var FlowRunner = class {
|
|
|
2091
2127
|
});
|
|
2092
2128
|
attempt.assertActive();
|
|
2093
2129
|
const binding = {
|
|
2130
|
+
...requestedSettings.model !== void 0 || requestedSettings.configOptions.length > 0 ? {
|
|
2131
|
+
requestedSettings,
|
|
2132
|
+
acceptedSettings
|
|
2133
|
+
} : {},
|
|
2094
2134
|
key,
|
|
2095
2135
|
handle,
|
|
2096
2136
|
bundleId: createSessionBundleId(handle, key),
|
|
@@ -2198,7 +2238,17 @@ var FlowRunner = class {
|
|
|
2198
2238
|
errorEmissionPolicy: { queueErrorAlreadyEmitted: false },
|
|
2199
2239
|
onAcpMessage: events.onAcpMessage,
|
|
2200
2240
|
suppressSdkConsoleErrors: this.suppressSdkConsoleErrors,
|
|
2201
|
-
client: initialClient
|
|
2241
|
+
client: initialClient,
|
|
2242
|
+
skipConfigurationForLoadedSession: initialClient !== void 0,
|
|
2243
|
+
sessionOptions: {
|
|
2244
|
+
...this.sessionOptions,
|
|
2245
|
+
model: binding.requestedSettings?.model
|
|
2246
|
+
},
|
|
2247
|
+
configOptions: binding.requestedSettings?.configOptions,
|
|
2248
|
+
onSessionConfigured: (configuration) => {
|
|
2249
|
+
assertReplayedSessionSettings(binding, configuration);
|
|
2250
|
+
if (binding.requestedSettings) binding.acceptedSettings = configuration;
|
|
2251
|
+
}
|
|
2202
2252
|
}, {
|
|
2203
2253
|
signal: attempt.signal,
|
|
2204
2254
|
handleProcessInterrupts: false
|
|
@@ -2248,7 +2298,14 @@ var FlowRunner = class {
|
|
|
2248
2298
|
acpxState = recordClientOperation(conversation, acpxState, operation);
|
|
2249
2299
|
},
|
|
2250
2300
|
suppressSdkConsoleErrors: this.suppressSdkConsoleErrors,
|
|
2251
|
-
sessionOptions:
|
|
2301
|
+
sessionOptions: {
|
|
2302
|
+
...this.sessionOptions,
|
|
2303
|
+
model: binding.requestedSettings?.model
|
|
2304
|
+
},
|
|
2305
|
+
configOptions: binding.requestedSettings?.configOptions,
|
|
2306
|
+
onSessionConfigured: (configuration) => {
|
|
2307
|
+
if (binding.requestedSettings) binding.acceptedSettings = configuration;
|
|
2308
|
+
}
|
|
2252
2309
|
}, {
|
|
2253
2310
|
signal: attempt.signal,
|
|
2254
2311
|
handleProcessInterrupts: false
|
|
@@ -2273,8 +2330,7 @@ var FlowRunner = class {
|
|
|
2273
2330
|
});
|
|
2274
2331
|
}
|
|
2275
2332
|
};
|
|
2276
|
-
|
|
2277
|
-
//#region src/flows/json.ts
|
|
2333
|
+
// src/flows/json.ts
|
|
2278
2334
|
function normalizeJsonText(text) {
|
|
2279
2335
|
if (typeof text === "string") return text.trim();
|
|
2280
2336
|
if (text == null) return "";
|
|
@@ -2343,10 +2399,24 @@ function extractFencedJsonText(text) {
|
|
|
2343
2399
|
let contentStart = openingFenceIndex + 3;
|
|
2344
2400
|
if (text.slice(contentStart, contentStart + 4).toLowerCase() === "json" && isFenceWhitespace(text[contentStart + 4])) contentStart += 4;
|
|
2345
2401
|
while (isFenceWhitespace(text[contentStart])) contentStart += 1;
|
|
2346
|
-
const closingFenceIndex = text
|
|
2402
|
+
const closingFenceIndex = findClosingJsonFence(text, contentStart);
|
|
2347
2403
|
if (closingFenceIndex === -1) return null;
|
|
2348
2404
|
return text.slice(contentStart, closingFenceIndex).trim();
|
|
2349
2405
|
}
|
|
2406
|
+
function findClosingJsonFence(text, contentStart) {
|
|
2407
|
+
let inString = false;
|
|
2408
|
+
let escaped = false;
|
|
2409
|
+
for (let index = contentStart; index < text.length; index += 1) {
|
|
2410
|
+
const char = text[index];
|
|
2411
|
+
if (inString) {
|
|
2412
|
+
const next = scanStringChar(char, escaped);
|
|
2413
|
+
escaped = next.escaped;
|
|
2414
|
+
inString = next.inString;
|
|
2415
|
+
} else if (char === "\"") inString = true;
|
|
2416
|
+
else if (text.startsWith("```", index)) return index;
|
|
2417
|
+
}
|
|
2418
|
+
return -1;
|
|
2419
|
+
}
|
|
2350
2420
|
function isFenceWhitespace(char) {
|
|
2351
2421
|
return char === " " || char === "\n" || char === "\r" || char === " ";
|
|
2352
2422
|
}
|
|
@@ -2402,8 +2472,7 @@ function scanStringChar(char, escaped) {
|
|
|
2402
2472
|
inString: char !== "\""
|
|
2403
2473
|
};
|
|
2404
2474
|
}
|
|
2405
|
-
|
|
2406
|
-
//#region src/flows/decision.ts
|
|
2475
|
+
// src/flows/decision.ts
|
|
2407
2476
|
const DEFAULT_FIELD = "route";
|
|
2408
2477
|
const SIMPLE_FIELD_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
2409
2478
|
function decision(definition) {
|
|
@@ -2468,7 +2537,6 @@ function formatDecisionPrompt(question, choices, field) {
|
|
|
2468
2537
|
"Do not include any other text outside the JSON object."
|
|
2469
2538
|
].join("\n");
|
|
2470
2539
|
}
|
|
2471
|
-
//#endregion
|
|
2472
2540
|
export { parseStrictJsonObject as a, validateFlowDefinition as c, checkpoint as d, compute as f, isDefinedFlow as h, parseJsonObject as i, acp as l, shell as m, decisionEdge as n, FlowRunner as o, defineFlow as p, extractJsonObject as r, flowRunsBaseDir as s, decision as t, action as u };
|
|
2473
2541
|
|
|
2474
|
-
//# sourceMappingURL=flows-
|
|
2542
|
+
//# sourceMappingURL=flows-CDj5YcTh.js.map
|