@1agents/acp-service 0.8.3 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/bin/a2a.js +10 -2
- package/dist/bin/acp-service.js +6 -0
- package/dist/bin/roles.d.ts +1 -0
- package/dist/bin/roles.js +24 -0
- package/dist/src/a2a/executor.d.ts +16 -1
- package/dist/src/a2a/executor.js +205 -19
- package/dist/src/a2a/gateway.d.ts +77 -0
- package/dist/src/a2a/gateway.js +349 -27
- package/dist/src/a2a/index.d.ts +7 -1
- package/dist/src/a2a/index.js +4 -0
- package/dist/src/a2a/result-metadata.d.ts +3 -0
- package/dist/src/a2a/result-metadata.js +2 -1
- package/dist/src/a2a/server.js +2 -1
- package/dist/src/a2a/store.js +7 -1
- package/dist/src/a2a/types.d.ts +32 -1
- package/dist/src/a2a/types.js +11 -1
- package/dist/src/acp-connection.js +93 -12
- package/dist/src/bridge.js +127 -4
- package/dist/src/capacity-lifecycle.d.ts +5 -0
- package/dist/src/capacity-lifecycle.js +57 -0
- package/dist/src/capacity-queue.d.ts +23 -0
- package/dist/src/capacity-queue.js +251 -0
- package/dist/src/capacity.d.ts +76 -0
- package/dist/src/capacity.js +377 -0
- package/dist/src/execution/human-review.d.ts +103 -0
- package/dist/src/execution/human-review.js +87 -0
- package/dist/src/execution/ledger.d.ts +5 -0
- package/dist/src/execution/ledger.js +39 -8
- package/dist/src/execution/ppt-delivery.d.ts +36 -3
- package/dist/src/execution/ppt-delivery.js +243 -53
- package/dist/src/execution/project-discovery.d.ts +56 -0
- package/dist/src/execution/project-discovery.js +429 -0
- package/dist/src/execution/report-review.d.ts +60 -0
- package/dist/src/execution/report-review.js +173 -0
- package/dist/src/execution/targets.d.ts +5 -0
- package/dist/src/execution/targets.js +1 -0
- package/dist/src/execution/workbench.d.ts +131 -0
- package/dist/src/execution/workbench.js +265 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +3 -0
- package/dist/src/roles/index.d.ts +1 -0
- package/dist/src/roles/index.js +1 -0
- package/dist/src/roles/skills.d.ts +71 -0
- package/dist/src/roles/skills.js +427 -0
- package/package.json +5 -1
- package/skills/acp-service/SKILL.md +21 -7
- package/skills/acp-service/references/a2a.md +9 -5
- package/skills/acp-service/references/async-caller.md +48 -0
- package/skills/acp-service/references/roles-and-tasks.md +120 -0
- package/skills/acp-service/scripts/a2a-caller.py +242 -0
- package/vendor/dsh/README.md +2 -0
- package/vendor/dsh/a2a-executor.d.ts +4 -1
- package/vendor/dsh/a2a-executor.js +46 -2
- package/vendor/dsh/adapter.d.ts +10 -0
- package/vendor/dsh/adapter.js +67 -3
- package/vendor/dsh/index.js +2 -1
- package/vendor/runtime/dist/{cli-DeOpE2Xz.js → cli-DXmYwv3U.js} +4 -4
- package/vendor/runtime/dist/{cli-DeOpE2Xz.js.map → cli-DXmYwv3U.js.map} +1 -1
- package/vendor/runtime/dist/cli.js +7 -7
- package/vendor/runtime/dist/client-VQsqcIOJ.d.ts.map +1 -1
- package/vendor/runtime/dist/docs-site/runtime-process-lifecycle.html +1 -0
- package/vendor/runtime/dist/{flows-oaBGn31w.js → flows-DJ17ajbw.js} +3 -3
- package/vendor/runtime/dist/{flows-oaBGn31w.js.map → flows-DJ17ajbw.js.map} +1 -1
- package/vendor/runtime/dist/flows.js +1 -1
- package/vendor/runtime/dist/{invocation-options-CUDEE8vW.js → invocation-options-PBfCgrdi.js} +3 -3
- package/vendor/runtime/dist/{invocation-options-CUDEE8vW.js.map → invocation-options-PBfCgrdi.js.map} +1 -1
- package/vendor/runtime/dist/{output-CFv3jcOQ.js → output-B3MDn7kv.js} +2 -2
- package/vendor/runtime/dist/{output-CFv3jcOQ.js.map → output-B3MDn7kv.js.map} +1 -1
- package/vendor/runtime/dist/{queue-owner-runtime-DvMJiGbP.js → queue-owner-runtime-DXCVngwU.js} +15 -8
- package/vendor/runtime/dist/queue-owner-runtime-DXCVngwU.js.map +1 -0
- package/vendor/runtime/dist/runtime.js +1 -1
- package/vendor/runtime/dist/{session-watch-Di-wIdCH.js → session-watch-DURyCw31.js} +2 -2
- package/vendor/runtime/dist/{session-watch-Di-wIdCH.js.map → session-watch-DURyCw31.js.map} +1 -1
- package/vendor/runtime/dist/queue-owner-runtime-DvMJiGbP.js.map +0 -1
package/vendor/dsh/adapter.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** Presents an external Agent's output through DSH's existing streaming surface. */
|
|
2
2
|
import { createHash } from 'node:crypto';
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
4
5
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
5
6
|
import { LlmError } from '@deepseek-ai/dsh-llm';
|
|
6
7
|
import { RequestError } from '@agentclientprotocol/sdk';
|
|
@@ -8,6 +9,26 @@ import { connect, object } from './transport.js';
|
|
|
8
9
|
import { State, hasActiveWriter } from './state.js';
|
|
9
10
|
import { mergeTool } from './tool-events.js';
|
|
10
11
|
import { toSafeError } from '@1agents/acp-service/runtime';
|
|
12
|
+
export function validateSessionPolicies(policies = []) {
|
|
13
|
+
const seen = new Set();
|
|
14
|
+
if (!Array.isArray(policies))
|
|
15
|
+
throw new Error('sessionPolicies must be an array');
|
|
16
|
+
return policies.map(policy => {
|
|
17
|
+
if (!policy || typeof policy.cwd !== 'string' || !isAbsolute(policy.cwd)
|
|
18
|
+
|| typeof policy.agent !== 'string' || !/^[a-z0-9_-]+$/i.test(policy.agent)
|
|
19
|
+
|| !['approve-reads', 'approve-all', 'deny-all'].includes(policy.permissionMode)
|
|
20
|
+
|| (policy.initialModeId !== undefined && (typeof policy.initialModeId !== 'string' || !policy.initialModeId))) {
|
|
21
|
+
throw new Error('Invalid workspace-scoped ACP session policy');
|
|
22
|
+
}
|
|
23
|
+
const normalized = { ...policy, cwd: resolve(policy.cwd) };
|
|
24
|
+
const key = JSON.stringify([normalized.cwd, normalized.agent]);
|
|
25
|
+
if (seen.has(key))
|
|
26
|
+
throw new Error('Duplicate workspace-scoped ACP session policy');
|
|
27
|
+
seen.add(key);
|
|
28
|
+
return normalized;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const recoveryMessage = 'ACP session initialization failed and remote cleanup could not be confirmed; host recovery is required before retrying.';
|
|
11
32
|
/** Only the negotiated service's direct canonical error data is a projection. */
|
|
12
33
|
function serviceProjection(error) {
|
|
13
34
|
if (!(error instanceof RequestError) || error.code !== -32000
|
|
@@ -69,6 +90,7 @@ export class AcpAdapter {
|
|
|
69
90
|
config;
|
|
70
91
|
diagnostics;
|
|
71
92
|
state;
|
|
93
|
+
initializationFailures = new Map();
|
|
72
94
|
controllers = new Map();
|
|
73
95
|
jobs = new Set();
|
|
74
96
|
links = new Map();
|
|
@@ -239,7 +261,12 @@ export class AcpAdapter {
|
|
|
239
261
|
throw new Error('Create the ACP session in a workspace first');
|
|
240
262
|
const endpoint = new URL(`/agents/${encodeURIComponent(name)}`, this.config.serviceUrl);
|
|
241
263
|
endpoint.protocol = endpoint.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
264
|
+
const initializationFailure = this.initializationFailures.get(agent.id);
|
|
265
|
+
if (initializationFailure)
|
|
266
|
+
throw initializationFailure;
|
|
242
267
|
let binding = this.state.get(agent.id);
|
|
268
|
+
if (binding && 'initializationCleanupPending' in binding)
|
|
269
|
+
throw new Error(recoveryMessage);
|
|
243
270
|
if (binding && (binding.agent !== name || binding.cwd !== cwd || binding.endpoint !== endpoint.href)) {
|
|
244
271
|
const boundary = this.ctx.sessionProjections.stateOf(agent.session, 'turnBoundary');
|
|
245
272
|
const previousEndpoint = new URL(`/agents/${encodeURIComponent(binding.agent)}`, this.config.serviceUrl);
|
|
@@ -317,23 +344,60 @@ export class AcpAdapter {
|
|
|
317
344
|
question: (p, s) => this.question(agent, p, interactionSignal(s)),
|
|
318
345
|
plan: (p, s) => this.plan(agent, p, interactionSignal(s)),
|
|
319
346
|
}, this.lifetime.signal);
|
|
347
|
+
let createdBinding;
|
|
320
348
|
try {
|
|
321
|
-
const
|
|
349
|
+
const policy = this.config.sessionPolicies?.find(p => p.cwd === resolve(cwd) && p.agent === name);
|
|
350
|
+
const params = { cwd, mcpServers: [], _meta: { '1agents': { permissionMode: policy?.permissionMode ?? 'approve-reads' } } };
|
|
322
351
|
const cancellationSignal = AbortSignal.any([this.lifetime.signal, AbortSignal.timeout(60_000)]);
|
|
323
352
|
const result = binding
|
|
324
353
|
? await link.rpc.request(binding.restoreMethod ?? 'session/load', { ...params, sessionId: binding.sessionId }, { cancellationSignal })
|
|
325
354
|
: await link.rpc.request('session/new', params, { cancellationSignal });
|
|
326
355
|
if (!binding)
|
|
327
|
-
|
|
356
|
+
createdBinding = { agent: name, endpoint: endpoint.href, cwd, sessionId: result.sessionId };
|
|
328
357
|
capabilities.configOptions = result.configOptions ?? capabilities.configOptions;
|
|
329
358
|
capabilities.modes = result.modes ?? undefined;
|
|
359
|
+
// Select an advertised native mode before the first prompt. Loading an
|
|
360
|
+
// existing session must retain its native mode and user selections.
|
|
361
|
+
if (!binding && policy?.initialModeId) {
|
|
362
|
+
if (!capabilities.modes?.availableModes.some(m => m.id === policy.initialModeId))
|
|
363
|
+
throw new Error('Configured initial ACP mode is not advertised by the Agent');
|
|
364
|
+
await link.rpc.request('session/set_mode', { sessionId: result.sessionId, modeId: policy.initialModeId }, { cancellationSignal });
|
|
365
|
+
capabilities.modes.currentModeId = policy.initialModeId;
|
|
366
|
+
}
|
|
367
|
+
if (createdBinding)
|
|
368
|
+
this.state.save(agent.id, createdBinding);
|
|
330
369
|
void link.closed.then(() => { if (this.links.get(agent.id) === operation)
|
|
331
370
|
this.links.delete(agent.id); });
|
|
332
371
|
return link;
|
|
333
372
|
}
|
|
334
373
|
catch (error) {
|
|
374
|
+
let failure = error;
|
|
375
|
+
if (createdBinding) {
|
|
376
|
+
const cleanup = new AbortController();
|
|
377
|
+
try {
|
|
378
|
+
// SDK cancellation alone only notifies the peer, so bound the wait locally as well.
|
|
379
|
+
await Promise.race([
|
|
380
|
+
link.rpc.request('session/close', { sessionId: createdBinding.sessionId }, { cancellationSignal: cleanup.signal }),
|
|
381
|
+
delay(5000, undefined, { signal: cleanup.signal }).then(() => { throw new Error(recoveryMessage); }),
|
|
382
|
+
]);
|
|
383
|
+
}
|
|
384
|
+
catch {
|
|
385
|
+
// Preserve a recovery identity rather than create another process on retry.
|
|
386
|
+
const recoveryError = new Error(recoveryMessage);
|
|
387
|
+
this.initializationFailures.set(agent.id, recoveryError);
|
|
388
|
+
const recovering = { ...createdBinding, initializationCleanupPending: true };
|
|
389
|
+
try {
|
|
390
|
+
this.state.save(agent.id, recovering);
|
|
391
|
+
}
|
|
392
|
+
catch { /* The in-memory guard still blocks retry if local storage is also unavailable. */ }
|
|
393
|
+
failure = recoveryError;
|
|
394
|
+
}
|
|
395
|
+
finally {
|
|
396
|
+
cleanup.abort();
|
|
397
|
+
}
|
|
398
|
+
}
|
|
335
399
|
link.close();
|
|
336
|
-
throw
|
|
400
|
+
throw failure;
|
|
337
401
|
}
|
|
338
402
|
})();
|
|
339
403
|
this.links.set(agent.id, operation);
|
package/vendor/dsh/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { join, resolve } from 'node:path';
|
|
4
4
|
import { openDiagnostics } from './diagnostics.js';
|
|
5
|
-
import { AcpAdapter } from './adapter.js';
|
|
5
|
+
import { AcpAdapter, validateSessionPolicies } from './adapter.js';
|
|
6
6
|
import { discoverPresets } from './discovery.js';
|
|
7
7
|
import { NativeSessions } from './imports.js';
|
|
8
8
|
import { acquireService, resolveServiceOptions } from './service-process.js';
|
|
@@ -21,6 +21,7 @@ export async function apply(ctx, input = {}) {
|
|
|
21
21
|
serviceUrl, agents: presets.map(preset => preset.id),
|
|
22
22
|
stateDirectory: input.stateDirectory ?? join(home, 'plugins', '1agents-acp', 'sessions'),
|
|
23
23
|
reconnectAttempts: input.reconnectAttempts ?? 5, reconnectDelayMs: input.reconnectDelayMs ?? 1000,
|
|
24
|
+
sessionPolicies: validateSessionPolicies(input.sessionPolicies),
|
|
24
25
|
};
|
|
25
26
|
if (config.agents.some(a => !/^[a-z0-9_-]+$/i.test(a)))
|
|
26
27
|
throw new Error('agents must contain ACP registry names');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { rt as permissionModeSatisfies } from "./queue-owner-runtime-
|
|
2
|
-
import { C as resolvePermissionMode, S as resolveOutputPolicy, b as resolveAgentInvocation, l as hasExplicitPermissionModeFlag, r as sessionOptionsFromGlobalFlags, t as resolvePermissionPolicyFromFlags, x as resolveGlobalFlags } from "./invocation-options-
|
|
3
|
-
import { c as validateFlowDefinition, h as isDefinedFlow, o as FlowRunner } from "./flows-
|
|
1
|
+
import { rt as permissionModeSatisfies } from "./queue-owner-runtime-DXCVngwU.js";
|
|
2
|
+
import { C as resolvePermissionMode, S as resolveOutputPolicy, b as resolveAgentInvocation, l as hasExplicitPermissionModeFlag, r as sessionOptionsFromGlobalFlags, t as resolvePermissionPolicyFromFlags, x as resolveGlobalFlags } from "./invocation-options-PBfCgrdi.js";
|
|
3
|
+
import { c as validateFlowDefinition, h as isDefinedFlow, o as FlowRunner } from "./flows-DJ17ajbw.js";
|
|
4
4
|
import Module, { register } from "node:module";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
6
|
import path from "node:path";
|
|
@@ -179,4 +179,4 @@ function printFlowRunResult(result, globalFlags) {
|
|
|
179
179
|
//#endregion
|
|
180
180
|
export { handleFlowRun };
|
|
181
181
|
|
|
182
|
-
//# sourceMappingURL=cli-
|
|
182
|
+
//# sourceMappingURL=cli-DXmYwv3U.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-DeOpE2Xz.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} from \"../cli/flags.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\";\n\ntype FlowRunFlags = {\n inputJson?: string;\n inputFile?: string;\n defaultAgent?: string;\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 });\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 && flags.inputFile) {\n throw new InvalidArgumentError(\"Use only one of --input-json or --input-file\");\n }\n\n if (flags.inputJson) {\n return parseJsonInput(flags.inputJson, \"--input-json\");\n }\n\n if (flags.inputFile) {\n const inputPath = path.resolve(flags.inputFile);\n const payload = await fs.readFile(inputPath, \"utf8\");\n return parseJsonInput(payload, \"--input-file\");\n }\n\n return {};\n}\n\nasync function loadFlowModule(flowPath: string): Promise<FlowDefinition> {\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\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: 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;;;ACXA,eAAsB,cACpB,UACA,OACA,SACA,QACe;CACf,MAAM,cAAc,mBAAmB,SAAS,MAAM;CACt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OAAO,MAAM;EAC3B,WAAW,OAAO,MAAM;EACxB,QAAQ,OAAO;EACf,SAAS,OAAO,MAAM;EACtB,iBAAiB,OAAO,MAAM;CAChC;CAEA,IAAI,YAAY,WAAW,QAAQ;EACjC,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,OAAO,EAAE,GAAG;EACnD;CACF;CAEA,IAAI,YAAY,WAAW,SAAS;EAClC,QAAQ,OAAO,MAAM,GAAG,OAAO,MAAM,MAAM,GAAG;EAC9C;CACF;CAEA,QAAQ,OAAO,MAAM,UAAU,QAAQ,MAAM,GAAG;CAChD,QAAQ,OAAO,MAAM,SAAS,QAAQ,SAAS,GAAG;CAClD,IAAI,QAAQ,UACV,QAAQ,OAAO,MAAM,UAAU,QAAQ,SAAS,GAAG;CAErD,QAAQ,OAAO,MAAM,WAAW,QAAQ,OAAO,GAAG;CAClD,QAAQ,OAAO,MAAM,WAAW,QAAQ,OAAO,GAAG;CAClD,IAAI,QAAQ,aACV,QAAQ,OAAO,MAAM,gBAAgB,QAAQ,YAAY,GAAG;CAE9D,IAAI,QAAQ,cACV,QAAQ,OAAO,MAAM,iBAAiB,QAAQ,aAAa,GAAG;CAEhE,IAAI,QAAQ,WACV,QAAQ,OAAO,MAAM,cAAc,QAAQ,UAAU,GAAG;CAE1D,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,QAAQ,SAAS,MAAM,CAAC,EAAE,GAAG;AACtE"}
|
|
1
|
+
{"version":3,"file":"cli-DXmYwv3U.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} from \"../cli/flags.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\";\n\ntype FlowRunFlags = {\n inputJson?: string;\n inputFile?: string;\n defaultAgent?: string;\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 });\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 && flags.inputFile) {\n throw new InvalidArgumentError(\"Use only one of --input-json or --input-file\");\n }\n\n if (flags.inputJson) {\n return parseJsonInput(flags.inputJson, \"--input-json\");\n }\n\n if (flags.inputFile) {\n const inputPath = path.resolve(flags.inputFile);\n const payload = await fs.readFile(inputPath, \"utf8\");\n return parseJsonInput(payload, \"--input-file\");\n }\n\n return {};\n}\n\nasync function loadFlowModule(flowPath: string): Promise<FlowDefinition> {\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\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: 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;;;ACXA,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,KAA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ACnD;CACF;CAEA,IAAI,YAAY,WAAW,SAAS;EAClC,QAAQ,OAAO,MAAM,GAAG,OAAO,MAAM,MAAM,GAAG;EAC9C;CACF;CAEA,QAAQ,OAAO,MAAM,UAAU,QAAQ,MAAM,GAAG;CAChD,QAAQ,OAAO,MAAM,SAAS,QAAQ,SAAS,GAAG;CAClD,IAAI,QAAQ,UACV,QAAQ,OAAO,MAAM,UAAU,QAAQ,SAAS,GAAG;CAErD,QAAQ,OAAO,MAAM,WAAW,QAAQ,OAAO,GAAG;CAClD,QAAQ,OAAO,MAAM,WAAW,QAAQ,OAAO,GAAG;CAClD,IAAI,QAAQ,aACV,QAAQ,OAAO,MAAM,gBAAgB,QAAQ,YAAY,GAAG;CAE9D,IAAI,QAAQ,cACV,QAAQ,OAAO,MAAM,iBAAiB,QAAQ,aAAa,GAAG;CAEhE,IAAI,QAAQ,WACV,QAAQ,OAAO,MAAM,cAAc,QAAQ,UAAU,GAAG;CAE1D,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,QAAQ,SAAS,MAAM,CAAC,EAAE,GAAG;AACtE"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { c as __exportAll, n as getTextErrorRemediationHints, o as toTimerMilliseconds, t as createOutputFormatter } from "./output-
|
|
2
|
+
import { c as __exportAll, n as getTextErrorRemediationHints, o as toTimerMilliseconds, t as createOutputFormatter } from "./output-B3MDn7kv.js";
|
|
3
3
|
import { A as findSession, C as textPrompt, Ct as exitCodeForOutputErrorCode, Dt as normalizeOutputError, F as normalizeName, Ft as OUTPUT_FORMATS, G as normalizeAgentSessionId, N as listSessions, Nt as EXIT_CODES, O as absolutePath, St as isProcessAlive, U as serializeSessionRecordForDisk, Ut as AgentSpawnError, V as parseSessionRecord, Vt as AcpxOperationalError, _t as sessionEventLockPath, b as mergePromptSourceWithText, c as probeQueueOwnerHealth, dt as boundedEventMaxSegments, ft as defaultSessionEventLog, gt as sessionEventActivePath, j as findSessionByDirectoryWalk, k as findGitRepositoryRoot, v as PromptInputValidationError, x as parsePromptSource, xt as _usingCtx, yt as writePrivateFile, z as writeSessionRecord } from "./ipc-BQQpcEdP.js";
|
|
4
4
|
import { A as renderArgvIdentity, i as DEFAULT_AGENT_NAME, l as normalizeAgentName$1, s as listBuiltInAgents } from "./agent-registry-R7A3MSpr.js";
|
|
5
|
-
import { ct as listSessionEvents, d as flushPerfMetricsCapture, dt as TimeoutError, f as installPerfMetricsCapture, i as runOnce, lt as isLegacyZedCodexAcpInvocation, n as runSessionQueueOwner, nt as getAcpxVersion, ot as acquireSessionImport, s as DISCARD_OUTPUT_FORMATTER, st as acquireSessionScope, u as buildQueueOwnerArgOverride, ut as InterruptedError } from "./queue-owner-runtime-
|
|
6
|
-
import { C as resolvePermissionMode, E as resolveSessionsListFlags, S as resolveOutputPolicy, T as resolveSessionNameFromFlags, _ as parseSessionName, a as addGlobalFlags, b as resolveAgentInvocation, c as addSessionOption, d as parseDaysOlderThan, f as parseHistoryLimit, g as parsePruneBeforeDate, h as parseOutputFormat$1, i as addExecConfigOption, m as parseNonEmptyValue, n as sessionConnectionOptions, o as addPromptInputOption, p as parseMaxTurns, r as sessionOptionsFromGlobalFlags, s as addSessionNameOption, t as resolvePermissionPolicyFromFlags, u as parseAllowedTools, v as parseTimeoutSeconds, w as resolvePromptFlags, x as resolveGlobalFlags, y as parseTtlSeconds } from "./invocation-options-
|
|
5
|
+
import { ct as listSessionEvents, d as flushPerfMetricsCapture, dt as TimeoutError, f as installPerfMetricsCapture, i as runOnce, lt as isLegacyZedCodexAcpInvocation, n as runSessionQueueOwner, nt as getAcpxVersion, ot as acquireSessionImport, s as DISCARD_OUTPUT_FORMATTER, st as acquireSessionScope, u as buildQueueOwnerArgOverride, ut as InterruptedError } from "./queue-owner-runtime-DXCVngwU.js";
|
|
6
|
+
import { C as resolvePermissionMode, E as resolveSessionsListFlags, S as resolveOutputPolicy, T as resolveSessionNameFromFlags, _ as parseSessionName, a as addGlobalFlags, b as resolveAgentInvocation, c as addSessionOption, d as parseDaysOlderThan, f as parseHistoryLimit, g as parsePruneBeforeDate, h as parseOutputFormat$1, i as addExecConfigOption, m as parseNonEmptyValue, n as sessionConnectionOptions, o as addPromptInputOption, p as parseMaxTurns, r as sessionOptionsFromGlobalFlags, s as addSessionNameOption, t as resolvePermissionPolicyFromFlags, u as parseAllowedTools, v as parseTimeoutSeconds, w as resolvePromptFlags, x as resolveGlobalFlags, y as parseTtlSeconds } from "./invocation-options-PBfCgrdi.js";
|
|
7
7
|
import { realpathSync } from "node:fs";
|
|
8
8
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
9
9
|
import path from "node:path";
|
|
@@ -416,11 +416,11 @@ let sessionModulePromise;
|
|
|
416
416
|
let outputModulePromise;
|
|
417
417
|
let outputRenderModulePromise;
|
|
418
418
|
function loadSessionModule() {
|
|
419
|
-
sessionModulePromise ??= import("./output-
|
|
419
|
+
sessionModulePromise ??= import("./output-B3MDn7kv.js").then((n) => n.s);
|
|
420
420
|
return sessionModulePromise;
|
|
421
421
|
}
|
|
422
422
|
function loadOutputModule() {
|
|
423
|
-
outputModulePromise ??= import("./output-
|
|
423
|
+
outputModulePromise ??= import("./output-B3MDn7kv.js").then((n) => n.r);
|
|
424
424
|
return outputModulePromise;
|
|
425
425
|
}
|
|
426
426
|
function loadOutputRenderModule() {
|
|
@@ -902,7 +902,7 @@ async function handleSessionsWatch(explicitAgentName, flags, command, config) {
|
|
|
902
902
|
includeClosed: true
|
|
903
903
|
});
|
|
904
904
|
if (!record) throw new Error(missingScopedSessionMessage(agent, sessionName));
|
|
905
|
-
const { runSessionWatch } = await import("./session-watch-
|
|
905
|
+
const { runSessionWatch } = await import("./session-watch-DURyCw31.js");
|
|
906
906
|
await runSessionWatch(record, {
|
|
907
907
|
cursor: flags.cursor,
|
|
908
908
|
policy: resolveRequestedOutputPolicy(globalFlags)
|
|
@@ -2149,7 +2149,7 @@ function registerAgentCommand(program, agentName, config) {
|
|
|
2149
2149
|
}
|
|
2150
2150
|
function registerFlowCommand(program, config) {
|
|
2151
2151
|
program.command("flow").description("Run multi-step ACP workflows from flow files").command("run").description("Run a flow file").argument("<file>", "Flow module path").option("--input-json <json>", "Flow input as JSON").option("--input-file <path>", "Read flow input JSON from file").option("--default-agent <name>", "Default agent profile for ACP nodes without profile", (value) => parseNonEmptyValue("Default agent", value)).action(async function(file, flags) {
|
|
2152
|
-
const { handleFlowRun } = await import("./cli-
|
|
2152
|
+
const { handleFlowRun } = await import("./cli-DXmYwv3U.js");
|
|
2153
2153
|
await handleFlowRun(file, flags, this, config);
|
|
2154
2154
|
});
|
|
2155
2155
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-VQsqcIOJ.d.ts","names":[],"sources":["../src/async-control.ts","../src/acp/model-config-state.ts","../src/acp/client.ts"],"mappings":";;;KAcY;EACV,SAAS;EACT;;;;KChBU;EACV;EACA;EACA,iBAAiB;IACf;IACA;;;;;KCsVC;EACH,YAAY;EACZ;EACA;EACA;;KAGU;EACV;EACA;EACA,gBAAgB;EAChB,SAAS;EACT;EACA;;KAGU;EACV;EACA,gBAAgB;EAChB,SAAS;EACT;EACA;;KAGU,sBAAsB;KA4C7B;KAwFO;EACV;EACA,QAAQ,OAAO;EACf;EACA,QAAQ;EACR;;KAGU;EACV;EACA;EACA;EACA,WAAW;;cAoBA;UACH;UACA;UACA;mBACS;mBACA;mBACA;UACT;UACA;UACA;mBAQS;mBAMA;mBACA;UACT;UACA;UACA;UACA;UAMA;0BACgB;UAChB;UACA;mBACS;mBACA;mBACA;UACT;UACA;UAEA;UACA;UACA;UACA;mBACS;mBACA;mBACA;mBACA;mBACA;mBACA;EAEL,YAAA,SAAS;MAsEjB,oBAAoB;EAIxB;EAIA,sBAAsB;EAItB,6BAA6B;EAW7B;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA,iBACE,UAAU,KACR;EA0BJ;UAIQ;EAUR,qBAAqB;IACnB,iBAAiB;IACjB,4BAA4B;IAC5B,mBAAmB;IACnB;IACA;IACA;IACA;;UAuBM;UASA;UAcA;EAUR,mBAAmB;EAInB,gBAAgB;EAUhB;UAIQ;EAWF,MACJ,YAAY,qBACZ,UAAU,KAAK,sCACd;UA0FW;UAWA;UAgEN;UAiBM;UAyBN;UAwBA;UAIM;
|
|
1
|
+
{"version":3,"file":"client-VQsqcIOJ.d.ts","names":[],"sources":["../src/async-control.ts","../src/acp/model-config-state.ts","../src/acp/client.ts"],"mappings":";;;KAcY;EACV,SAAS;EACT;;;;KChBU;EACV;EACA;EACA,iBAAiB;IACf;IACA;;;;;KCsVC;EACH,YAAY;EACZ;EACA;EACA;;KAGU;EACV;EACA;EACA,gBAAgB;EAChB,SAAS;EACT;EACA;;KAGU;EACV;EACA,gBAAgB;EAChB,SAAS;EACT;EACA;;KAGU,sBAAsB;KA4C7B;KAwFO;EACV;EACA,QAAQ,OAAO;EACf;EACA,QAAQ;EACR;;KAGU;EACV;EACA;EACA;EACA,WAAW;;cAoBA;UACH;UACA;UACA;mBACS;mBACA;mBACA;UACT;UACA;UACA;mBAQS;mBAMA;mBACA;UACT;UACA;UACA;UACA;UAMA;0BACgB;UAChB;UACA;mBACS;mBACA;mBACA;UACT;UACA;UAEA;UACA;UACA;UACA;mBACS;mBACA;mBACA;mBACA;mBACA;mBACA;EAEL,YAAA,SAAS;MAsEjB,oBAAoB;EAIxB;EAIA,sBAAsB;EAItB,6BAA6B;EAW7B;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA,iBACE,UAAU,KACR;EA0BJ;UAIQ;EAUR,qBAAqB;IACnB,iBAAiB;IACjB,4BAA4B;IAC5B,mBAAmB;IACnB;IACA;IACA;IACA;;UAuBM;UASA;UAcA;EAUR,mBAAmB;EAInB,gBAAgB;EAUhB;UAIQ;EAWF,MACJ,YAAY,qBACZ,UAAU,KAAK,sCACd;UA0FW;UAWA;UAgEN;UAiBM;UAyBN;UAwBA;UAIM;UAgDN;UAO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ASA;UASA;UAoBN;UASA;UAMA;UAaA;UAWM;;UAkBN;UAiBA;UAWM;EAgCR,0BAA0B;IAC9B;IACA;MACE"}
|
|
@@ -255,6 +255,7 @@ body:not(.home) .doc>h1:first-child{display:none}
|
|
|
255
255
|
<p>Compatibility and startup-diagnostic invocations of the selected adapter also use these hooks. One session or runtime probe can create several processes: correlate events by <code>launchId</code>, not only by scope. Each invocation reports its actual command and arguments, including version/help checks before the ACP startup arguments have been selected. Denied compatibility admission prevents startup; a denied optional diagnostic omits version enrichment and preserves the original startup failure. Short POSIX checks own separate process groups; the ACP bridge keeps its inherited process group.</p>
|
|
256
256
|
<p>Compatibility commands retain their execution deadline after spawning. Their owned cleanup can extend settlement beyond that deadline; host admission waits remain under host control. Probe completion does not settle a pending host admission callback or permit a later launch after the client has closed.</p>
|
|
257
257
|
<p><code>onBeforeSpawn</code> and <code>onSpawned</code> are awaited admission boundaries. Rejecting before spawn prevents launch. Rejecting after spawn terminates the child before startup returns that error. An exit during admission is delivered after the admission callback settles, so a late successful write cannot overwrite an earlier exit observation.</p>
|
|
258
|
+
<p><code>onSpawnFailed</code> also reports admission rejection and cancellation before spawn, including authority revoked after <code>onBeforeSpawn</code> successfully reserved capacity. The observation retains the original error so hosts can release a reservation even when no child PID was created. A client closed during held compatibility probe admission reports the same failure without launching that probe.</p>
|
|
258
259
|
<p>For embedded runtime session creation, a positive <code>timeoutMs</code> bounds ACP initialization. If the agent never completes the handshake, <code>ensureSession()</code> rejects with <code>ACP_SESSION_INIT_FAILED</code> after closing the client and cleaning up its observed processes. Cleanup can extend beyond the initialization deadline. Omitting the timeout preserves unlimited initialization. This deadline does not bound the later <code>session/new</code> or <code>session/load</code> request.</p>
|
|
259
260
|
<p>The host owns admission timeouts, cancellation and recovery. A callback that never settles can hold startup indefinitely; <code>close()</code> is not an admission-cancellation mechanism. Hosts should bound their own storage or policy operations and settle or reject admission when abandoning a launch.</p>
|
|
260
261
|
<p>If a launch finishes admission after the client was closed, acpx stops that child without adopting it or disturbing a replacement connection. The admitted child still produces spawn and exit observations.</p>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as MAX_TIMER_DELAY_MS, t as createOutputFormatter } from "./output-
|
|
1
|
+
import { a as MAX_TIMER_DELAY_MS, t as createOutputFormatter } from "./output-B3MDn7kv.js";
|
|
2
2
|
import { C as textPrompt, It as PERMISSION_MODES, R as resolveSessionRecord, Rt as SESSION_RECORD_SCHEMA, S as promptToDisplayText, bt as writePrivateJsonFile, ft as defaultSessionEventLog, yt as writePrivateFile } from "./ipc-BQQpcEdP.js";
|
|
3
3
|
import { P as runTimedExecFile } from "./agent-registry-R7A3MSpr.js";
|
|
4
|
-
import { G as recordSessionUpdate, H as createSessionConversation, U as recordClientOperation, W as recordPromptSubmission, dt as TimeoutError, i as runOnce, m as createSessionWithClient, mt as withTimeout, o as sendSessionDirect, pt as withInterrupt, q as cloneSessionAcpxState, ut as InterruptedError } from "./queue-owner-runtime-
|
|
4
|
+
import { G as recordSessionUpdate, H as createSessionConversation, U as recordClientOperation, W as recordPromptSubmission, dt as TimeoutError, i as runOnce, m as createSessionWithClient, mt as withTimeout, o as sendSessionDirect, pt as withInterrupt, q as cloneSessionAcpxState, ut as InterruptedError } from "./queue-owner-runtime-DXCVngwU.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
7
7
|
import fs from "node:fs/promises";
|
|
@@ -2471,4 +2471,4 @@ function formatDecisionPrompt(question, choices, field) {
|
|
|
2471
2471
|
//#endregion
|
|
2472
2472
|
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
2473
|
|
|
2474
|
-
//# sourceMappingURL=flows-
|
|
2474
|
+
//# sourceMappingURL=flows-DJ17ajbw.js.map
|