@1agents/acp-service 0.10.12 → 0.11.1
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/acp-connection.js +33 -0
- package/dist/src/bridge.js +44 -1
- package/dist/src/capacity-queue.d.ts +3 -1
- package/dist/src/capacity-queue.js +4 -0
- package/dist/src/catalog.js +13 -3
- package/package.json +4 -4
- package/skills/acp-service/SKILL.md +1 -1
- package/vendor/dsh/adapter.d.ts +6 -0
- package/vendor/dsh/adapter.js +23 -0
- package/vendor/dsh/index.js +19 -0
- 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,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { C as resolveOutputPolicy, S as resolveGlobalFlags, i as sessionOptionsFromGlobalFlags, n as resolvePermissionPolicyFromFlags, t as readCliInputFile, u as hasExplicitPermissionModeFlag, w as resolvePermissionMode, x as resolveAgentInvocation } from "./input-file-BsfVGZgn.js";
|
|
2
|
+
import { c as validateFlowDefinition, h as isDefinedFlow, o as FlowRunner } from "./flows-CDj5YcTh.js";
|
|
3
|
+
import { rt as permissionModeSatisfies } from "./queue-owner-runtime-DHBQbjXo.js";
|
|
4
4
|
import Module, { register } from "node:module";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { InvalidArgumentError } from "commander";
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
10
|
-
|
|
10
|
+
// src/flows/module-resolution.ts
|
|
11
11
|
const moduleResolver = Module;
|
|
12
12
|
const resolveFilenameKey = "_resolveFilename";
|
|
13
13
|
let installed = false;
|
|
@@ -30,8 +30,7 @@ function installFlowRuntimeResolution(runtimeUrl) {
|
|
|
30
30
|
};
|
|
31
31
|
installed = true;
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
//#region src/flows/cli.ts
|
|
33
|
+
// src/flows/cli.ts
|
|
35
34
|
async function handleFlowRun(flowFile, flags, command, config) {
|
|
36
35
|
const globalFlags = resolveGlobalFlags(command, config);
|
|
37
36
|
const permissionMode = resolvePermissionMode(globalFlags, config.defaultPermissions);
|
|
@@ -56,7 +55,8 @@ async function handleFlowRun(flowFile, flags, command, config) {
|
|
|
56
55
|
ttlMs: globalFlags.ttl,
|
|
57
56
|
verbose: globalFlags.verbose,
|
|
58
57
|
suppressSdkConsoleErrors: outputPolicy.suppressSdkConsoleErrors,
|
|
59
|
-
sessionOptions: sessionOptionsFromGlobalFlags(globalFlags)
|
|
58
|
+
sessionOptions: sessionOptionsFromGlobalFlags(globalFlags),
|
|
59
|
+
configOptions: flags.configOption
|
|
60
60
|
}).run(flow, input, { flowPath }), globalFlags);
|
|
61
61
|
}
|
|
62
62
|
function assertFlowPermissionRequirements(flow, permissionMode, globalFlags) {
|
|
@@ -73,15 +73,27 @@ function buildFlowPermissionFailureMessage(flow, requiredMode, reason, explicit
|
|
|
73
73
|
].join(" ");
|
|
74
74
|
}
|
|
75
75
|
async function readFlowInput(flags) {
|
|
76
|
-
if (flags.inputJson && flags.inputFile) throw new InvalidArgumentError("Use only one of --input-json or --input-file");
|
|
77
|
-
if (flags.inputJson) return parseJsonInput(flags.inputJson, "--input-json");
|
|
78
|
-
if (flags.inputFile) {
|
|
76
|
+
if (flags.inputJson !== void 0 && flags.inputFile !== void 0) throw new InvalidArgumentError("Use only one of --input-json or --input-file");
|
|
77
|
+
if (flags.inputJson !== void 0) return parseJsonInput(flags.inputJson, "--input-json");
|
|
78
|
+
if (flags.inputFile !== void 0) {
|
|
79
79
|
const inputPath = path.resolve(flags.inputFile);
|
|
80
|
-
return parseJsonInput(await
|
|
80
|
+
return parseJsonInput(await readCliInputFile(inputPath, "Flow input file"), "--input-file");
|
|
81
81
|
}
|
|
82
82
|
return {};
|
|
83
83
|
}
|
|
84
|
+
async function assertFlowFile(flowPath) {
|
|
85
|
+
let stats;
|
|
86
|
+
try {
|
|
87
|
+
stats = await fs.stat(flowPath);
|
|
88
|
+
} catch (error) {
|
|
89
|
+
const code = error.code;
|
|
90
|
+
if (code === "ENOENT" || code === "ENOTDIR") throw new Error(`Flow file not found: ${flowPath}`, { cause: error });
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
if (!stats.isFile()) throw new Error(`Flow file is not a file: ${flowPath}`);
|
|
94
|
+
}
|
|
84
95
|
async function loadFlowModule(flowPath) {
|
|
96
|
+
await assertFlowFile(flowPath);
|
|
85
97
|
const extension = path.extname(flowPath).toLowerCase();
|
|
86
98
|
installFlowRuntimeResolution(pathToFileURL(resolveFlowRuntimeImportSpecifier()).href);
|
|
87
99
|
const candidate = findFlowDefinition(await loadFlowRuntimeModule(pathToFileURL(flowPath).href, extension));
|
|
@@ -140,6 +152,14 @@ function parseJsonInput(raw, label) {
|
|
|
140
152
|
throw new InvalidArgumentError(`${label} must contain valid JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
141
153
|
}
|
|
142
154
|
}
|
|
155
|
+
function omitSessionSettings(bindings) {
|
|
156
|
+
const output = {};
|
|
157
|
+
for (const [key, binding] of Object.entries(bindings)) {
|
|
158
|
+
const { requestedSettings: _requested, acceptedSettings: _accepted, ...rest } = binding;
|
|
159
|
+
output[key] = rest;
|
|
160
|
+
}
|
|
161
|
+
return output;
|
|
162
|
+
}
|
|
143
163
|
function printFlowRunResult(result, globalFlags) {
|
|
144
164
|
const payload = {
|
|
145
165
|
action: "flow_run_result",
|
|
@@ -156,7 +176,7 @@ function printFlowRunResult(result, globalFlags) {
|
|
|
156
176
|
waitingOn: result.state.waitingOn,
|
|
157
177
|
runDir: result.runDir,
|
|
158
178
|
outputs: result.state.outputs,
|
|
159
|
-
sessionBindings: result.state.sessionBindings
|
|
179
|
+
sessionBindings: omitSessionSettings(result.state.sessionBindings)
|
|
160
180
|
};
|
|
161
181
|
if (globalFlags.format === "json") {
|
|
162
182
|
process.stdout.write(`${JSON.stringify(payload)}\n`);
|
|
@@ -176,7 +196,6 @@ function printFlowRunResult(result, globalFlags) {
|
|
|
176
196
|
if (payload.waitingOn) process.stdout.write(`waitingOn: ${payload.waitingOn}\n`);
|
|
177
197
|
process.stdout.write(`${JSON.stringify(payload.outputs, null, 2)}\n`);
|
|
178
198
|
}
|
|
179
|
-
//#endregion
|
|
180
199
|
export { handleFlowRun };
|
|
181
200
|
|
|
182
|
-
//# sourceMappingURL=cli-
|
|
201
|
+
//# sourceMappingURL=cli-B5gQOSDl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-B5gQOSDl.js","names":[],"sources":["../src/flows/module-resolution.ts","../src/flows/cli.ts"],"sourcesContent":["import Module, { register } from \"node:module\";\nimport { fileURLToPath } from \"node:url\";\n\ntype ResolveFilename = (\n specifier: string,\n parent: unknown,\n isMain?: boolean,\n options?: unknown,\n) => string;\n\nconst moduleResolver = Module as unknown as { _resolveFilename: ResolveFilename };\nconst resolveFilenameKey = \"_resolveFilename\";\nlet installed = false;\n\n/** Resolve the public flow entrypoint in both ESM and CommonJS dependency graphs. */\nexport function installFlowRuntimeResolution(runtimeUrl: string): void {\n if (installed) {\n return;\n }\n const hook = `\n let runtimeUrl;\n const flowSpecifiers = new Set([\"acpx/flows\", \"@scottzx/1acp/flows\"]);\n export function initialize(data) { runtimeUrl = data.runtimeUrl; }\n export function resolve(specifier, context, nextResolve) {\n return nextResolve(flowSpecifiers.has(specifier) ? runtimeUrl : specifier, context);\n }\n `;\n register(`data:text/javascript,${encodeURIComponent(hook)}`, { data: { runtimeUrl } });\n // Node 22.13 supports ESM hooks but predates synchronous CommonJS hooks.\n const resolve = moduleResolver[resolveFilenameKey];\n const runtimePath = fileURLToPath(runtimeUrl);\n const flowSpecifiers = new Set([\"acpx/flows\", \"@scottzx/1acp/flows\"]);\n moduleResolver[resolveFilenameKey] = function (specifier, parent, isMain, options) {\n return resolve.call(\n this,\n flowSpecifiers.has(specifier) ? runtimePath : specifier,\n parent,\n isMain,\n options,\n );\n };\n installed = true;\n}\n","import { randomUUID } from \"node:crypto\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { InvalidArgumentError, type Command } from \"commander\";\nimport type { ResolvedAcpxConfig } from \"../cli/config.js\";\nimport {\n hasExplicitPermissionModeFlag,\n resolveAgentInvocation,\n resolveGlobalFlags,\n resolveOutputPolicy,\n resolvePermissionMode,\n type GlobalFlags,\n type SessionConfigOptionAssignment,\n} from \"../cli/flags.js\";\nimport { readCliInputFile } from \"../cli/input-file.js\";\nimport {\n resolvePermissionPolicyFromFlags,\n sessionOptionsFromGlobalFlags,\n} from \"../cli/invocation-options.js\";\nimport { type FlowDefinition, FlowRunner } from \"../flows.js\";\nimport { permissionModeSatisfies } from \"../permissions.js\";\nimport type { PermissionMode } from \"../types.js\";\nimport { isDefinedFlow } from \"./authoring.js\";\nimport { validateFlowDefinition } from \"./graph.js\";\nimport { installFlowRuntimeResolution } from \"./module-resolution.js\";\nimport type { FlowSessionBinding } from \"./types.js\";\n\ntype FlowRunFlags = {\n inputJson?: string;\n inputFile?: string;\n defaultAgent?: string;\n configOption?: SessionConfigOptionAssignment[];\n};\n\nexport async function handleFlowRun(\n flowFile: string,\n flags: FlowRunFlags,\n command: Command,\n config: ResolvedAcpxConfig,\n): Promise<void> {\n const globalFlags = resolveGlobalFlags(command, config);\n const permissionMode = resolvePermissionMode(globalFlags, config.defaultPermissions);\n const permissionPolicy = await resolvePermissionPolicyFromFlags(globalFlags);\n const outputPolicy = resolveOutputPolicy(globalFlags.format, globalFlags.jsonStrict === true);\n const input = await readFlowInput(flags);\n const flowPath = path.resolve(flowFile);\n const flow = await loadFlowModule(flowPath);\n assertFlowPermissionRequirements(flow, permissionMode, globalFlags);\n\n const runner = new FlowRunner({\n resolveAgent: (profile?: string) => {\n return resolveAgentInvocation(profile ?? flags.defaultAgent, globalFlags, config);\n },\n permissionMode,\n mcpServers: config.mcpServers,\n nonInteractivePermissions: globalFlags.nonInteractivePermissions,\n permissionPolicy,\n authCredentials: config.auth,\n authPolicy: globalFlags.authPolicy,\n fs: globalFlags.fs,\n timeoutMs: globalFlags.timeout,\n ttlMs: globalFlags.ttl,\n verbose: globalFlags.verbose,\n suppressSdkConsoleErrors: outputPolicy.suppressSdkConsoleErrors,\n sessionOptions: sessionOptionsFromGlobalFlags(globalFlags),\n configOptions: flags.configOption,\n });\n\n const result = await runner.run(flow, input, {\n flowPath,\n });\n\n printFlowRunResult(result, globalFlags);\n}\n\nfunction assertFlowPermissionRequirements(\n flow: FlowDefinition,\n permissionMode: PermissionMode,\n globalFlags: GlobalFlags,\n): void {\n const permissions = flow.permissions;\n if (!permissions) {\n return;\n }\n\n if (permissions.requireExplicitGrant && !hasExplicitPermissionModeFlag(globalFlags)) {\n throw new InvalidArgumentError(\n buildFlowPermissionFailureMessage(flow, permissions.requiredMode, permissions.reason, true),\n );\n }\n\n if (!permissionModeSatisfies(permissionMode, permissions.requiredMode)) {\n throw new InvalidArgumentError(\n buildFlowPermissionFailureMessage(flow, permissions.requiredMode, permissions.reason, false),\n );\n }\n}\n\nfunction buildFlowPermissionFailureMessage(\n flow: FlowDefinition,\n requiredMode: PermissionMode,\n reason?: string,\n explicit = false,\n): string {\n return [\n explicit\n ? `Flow \"${flow.name}\" requires an explicit ${requiredMode} grant.`\n : `Flow \"${flow.name}\" requires permission mode ${requiredMode}.`,\n `Rerun with --${requiredMode}.`,\n ...(reason ? [`Reason: ${reason}`] : []),\n ].join(\" \");\n}\n\nasync function readFlowInput(flags: FlowRunFlags): Promise<unknown> {\n if (flags.inputJson !== undefined && flags.inputFile !== undefined) {\n throw new InvalidArgumentError(\"Use only one of --input-json or --input-file\");\n }\n\n if (flags.inputJson !== undefined) {\n return parseJsonInput(flags.inputJson, \"--input-json\");\n }\n\n if (flags.inputFile !== undefined) {\n const inputPath = path.resolve(flags.inputFile);\n const payload = await readCliInputFile(inputPath, \"Flow input file\");\n return parseJsonInput(payload, \"--input-file\");\n }\n\n return {};\n}\n\nasync function assertFlowFile(flowPath: string): Promise<void> {\n let stats: Awaited<ReturnType<typeof fs.stat>>;\n try {\n stats = await fs.stat(flowPath);\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code;\n if (code === \"ENOENT\" || code === \"ENOTDIR\") {\n throw new Error(`Flow file not found: ${flowPath}`, { cause: error });\n }\n throw error;\n }\n if (!stats.isFile()) {\n throw new Error(`Flow file is not a file: ${flowPath}`);\n }\n}\n\nasync function loadFlowModule(flowPath: string): Promise<FlowDefinition> {\n // The module loaders report a missing path as an unresolved import with their own require stack.\n await assertFlowFile(flowPath);\n const extension = path.extname(flowPath).toLowerCase();\n installFlowRuntimeResolution(pathToFileURL(resolveFlowRuntimeImportSpecifier()).href);\n const module = await loadFlowRuntimeModule(pathToFileURL(flowPath).href, extension);\n const candidate = findFlowDefinition(module);\n if (!candidate) {\n throw new Error(\n `Flow module must export default defineFlow({...}) from \"acpx/flows\" (or \"@scottzx/1acp/flows\"): ${flowPath}`,\n );\n }\n validateFlowDefinition(candidate);\n return candidate;\n}\n\nfunction resolveFlowRuntimeImportSpecifier(): string {\n const selfPath = fileURLToPath(import.meta.url);\n let runtimePath: string;\n\n if (selfPath.endsWith(`${path.sep}src${path.sep}flows${path.sep}cli.ts`)) {\n runtimePath = fileURLToPath(new URL(\"../flows.ts\", import.meta.url));\n } else if (selfPath.endsWith(`${path.sep}src${path.sep}flows${path.sep}cli.js`)) {\n runtimePath = fileURLToPath(new URL(\"../flows.js\", import.meta.url));\n } else {\n runtimePath = fileURLToPath(new URL(\"./flows.js\", import.meta.url));\n }\n return runtimePath.replaceAll(path.sep, \"/\");\n}\n\ntype FlowModule = {\n default?: unknown;\n \"module.exports\"?: unknown;\n};\n\nasync function loadFlowRuntimeModule(flowUrl: string, extension: string): Promise<FlowModule> {\n if (extension === \".ts\" || extension === \".tsx\" || extension === \".cts\") {\n const { register } = await import(\"tsx/cjs/api\");\n const loader = register({ namespace: randomUUID() });\n try {\n return loader.require(flowUrl, import.meta.url) as FlowModule;\n } finally {\n loader.unregister();\n }\n }\n\n if (extension === \".mts\") {\n const { register } = await import(\"tsx/esm/api\");\n const loader = register({ namespace: randomUUID() });\n try {\n return (await loader.import(flowUrl, import.meta.url)) as FlowModule;\n } finally {\n await loader.unregister();\n }\n }\n\n return (await import(flowUrl)) as FlowModule;\n}\n\nfunction findFlowDefinition(module: FlowModule): FlowDefinition | null {\n const candidates = [\n module,\n module.default,\n module[\"module.exports\"],\n getNestedDefault(module.default),\n getNestedDefault(module[\"module.exports\"]),\n ];\n\n for (const candidate of candidates) {\n if (isDefinedFlow(candidate)) {\n return candidate;\n }\n }\n\n return null;\n}\n\nfunction getNestedDefault(value: unknown): unknown {\n if (!value || typeof value !== \"object\" || !(\"default\" in value)) {\n return null;\n }\n return (value as { default?: unknown }).default ?? null;\n}\n\nfunction parseJsonInput(raw: string, label: string): unknown {\n try {\n return JSON.parse(raw);\n } catch (error) {\n throw new InvalidArgumentError(\n `${label} must contain valid JSON: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n}\n\n// Settings evidence carries option values; it stays in the run bundle, not stdout.\nfunction omitSessionSettings(\n bindings: Record<string, FlowSessionBinding>,\n): Record<string, Omit<FlowSessionBinding, \"requestedSettings\" | \"acceptedSettings\">> {\n const output: Record<\n string,\n Omit<FlowSessionBinding, \"requestedSettings\" | \"acceptedSettings\">\n > = {};\n for (const [key, binding] of Object.entries(bindings)) {\n const { requestedSettings: _requested, acceptedSettings: _accepted, ...rest } = binding;\n output[key] = rest;\n }\n return output;\n}\n\nfunction printFlowRunResult(\n result: Awaited<ReturnType<FlowRunner[\"run\"]>>,\n globalFlags: GlobalFlags,\n): void {\n const payload = {\n action: \"flow_run_result\",\n runId: result.state.runId,\n flowName: result.state.flowName,\n runTitle: result.state.runTitle,\n flowPath: result.state.flowPath,\n status: result.state.status,\n currentNode: result.state.currentNode,\n currentNodeType: result.state.currentNodeType,\n currentNodeStartedAt: result.state.currentNodeStartedAt,\n lastHeartbeatAt: result.state.lastHeartbeatAt,\n statusDetail: result.state.statusDetail,\n waitingOn: result.state.waitingOn,\n runDir: result.runDir,\n outputs: result.state.outputs,\n sessionBindings: omitSessionSettings(result.state.sessionBindings),\n };\n\n if (globalFlags.format === \"json\") {\n process.stdout.write(`${JSON.stringify(payload)}\\n`);\n return;\n }\n\n if (globalFlags.format === \"quiet\") {\n process.stdout.write(`${result.state.runId}\\n`);\n return;\n }\n\n process.stdout.write(`runId: ${payload.runId}\\n`);\n process.stdout.write(`flow: ${payload.flowName}\\n`);\n if (payload.runTitle) {\n process.stdout.write(`title: ${payload.runTitle}\\n`);\n }\n process.stdout.write(`status: ${payload.status}\\n`);\n process.stdout.write(`runDir: ${payload.runDir}\\n`);\n if (payload.currentNode) {\n process.stdout.write(`currentNode: ${payload.currentNode}\\n`);\n }\n if (payload.statusDetail) {\n process.stdout.write(`statusDetail: ${payload.statusDetail}\\n`);\n }\n if (payload.waitingOn) {\n process.stdout.write(`waitingOn: ${payload.waitingOn}\\n`);\n }\n process.stdout.write(`${JSON.stringify(payload.outputs, null, 2)}\\n`);\n}\n"],"mappings":";;;;;;;;;;AAUA,MAAM,iBAAiB;AACvB,MAAM,qBAAqB;AAC3B,IAAI,YAAY;;AAGhB,SAAgB,6BAA6B,YAA0B;CACrE,IAAI,WACF;CAUF,SAAS,wBAAwB,mBAAmB;;;;;;;GAAI,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;CAErF,MAAM,UAAU,eAAe;CAC/B,MAAM,cAAc,cAAc,UAAU;CAC5C,MAAM,iCAAiB,IAAI,IAAI,CAAC,cAAc,qBAAqB,CAAC;CACpE,eAAe,sBAAsB,SAAU,WAAW,QAAQ,QAAQ,SAAS;EACjF,OAAO,QAAQ,KACb,MACA,eAAe,IAAI,SAAS,IAAI,cAAc,WAC9C,QACA,QACA,OACF;CACF;CACA,YAAY;AACd;;ACPA,eAAsB,cACpB,UACA,OACA,SACA,QACe;CACf,MAAM,cAAc,mBAAmB,SAAS,MAAM;CACtD,MAAM,iBAAiB,sBAAsB,aAAa,OAAO,kBAAkB;CACnF,MAAM,mBAAmB,MAAM,iCAAiC,WAAW;CAC3E,MAAM,eAAe,oBAAoB,YAAY,QAAQ,YAAY,eAAe,IAAI;CAC5F,MAAM,QAAQ,MAAM,cAAc,KAAK;CACvC,MAAM,WAAW,KAAK,QAAQ,QAAQ;CACtC,MAAM,OAAO,MAAM,eAAe,QAAQ;CAC1C,iCAAiC,MAAM,gBAAgB,WAAW;CAyBlE,mBAAmB,MAJE,IAnBF,WAAW;EAC5B,eAAe,YAAqB;GAClC,OAAO,uBAAuB,WA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
|
1
|
+
import { k as SessionRecord } from "./session-options-Ci4aw1oD.js";
|
|
2
|
+
import "commander";
|
|
4
3
|
export declare function parseTtlSeconds(value: string): number;
|
|
5
4
|
export declare function parseAllowedTools(value: string): string[];
|
|
6
5
|
export declare function parseMaxTurns(value: string): number;
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/cli/output/render.d.ts
|
|
9
6
|
type SessionConnectionStatus = "connected" | "starting" | "needs reconnect";
|
|
10
7
|
export declare function formatPromptSessionBannerLine(record: SessionRecord, currentCwd: string, connectionStatus?: SessionConnectionStatus): string;
|
|
11
|
-
//#endregion
|
|
12
8
|
export {};
|
|
13
9
|
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","names":[],"sources":["../src/cli/flags.ts","../src/cli/output/render.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","names":[],"sources":["../src/cli/flags.ts","../src/cli/output/render.ts"],"mappings":";;wBA0KgB,gBAAgB;wBA+EhB,kBAAkB;wBAgBlB,cAAc;KCvPzB;wBAkMW,8BACd,QAAQ,eACR,oBACA,mBAAkB"}
|