acpx 0.13.0 → 0.13.2

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/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { a as runSessionQueueOwner, c as buildQueueOwnerArgOverride, g as __exportAll, h as isProcessAlive, l as flushPerfMetricsCapture, n as getTextErrorRemediationHints, o as runOnce, p as probeQueueOwnerHealth, t as createOutputFormatter, u as installPerfMetricsCapture } from "./output-CzN8vLdE.js";
3
- import { Dt as textPrompt, G as findSessionByDirectoryWalk, Kt as EXIT_CODES, L as renderArgvIdentity, Mt as DEFAULT_AGENT_NAME, Nt as listBuiltInAgents, Ot as InterruptedError, Pt as normalizeAgentName$1, Q as writeSessionRecord, Rt as exitCodeForOutputErrorCode, St as PromptInputValidationError, Tt as parsePromptSource, U as findGitRepositoryRoot, Vt as normalizeOutputError, W as findSession, Xt as OUTPUT_FORMATS, Y as normalizeName, _t as sessionEventSegmentPath, dt as normalizeRuntimeSessionId, en as AcpxOperationalError, gt as sessionEventLockPath, ht as sessionEventActivePath, kt as TimeoutError, lt as parseSessionRecord, pt as defaultSessionEventLog, q as listSessions, tn as AgentSpawnError, ut as serializeSessionRecordForDisk, wt as mergePromptSourceWithText, yt as isAcpJsonRpcMessage, z as getAcpxVersion } from "./live-checkpoint-CBecfnSH.js";
4
- import { S as loadPermissionPolicySpec, _ as resolveGlobalFlags, b as resolveSessionNameFromFlags, c as parseHistoryLimit, d as parseOutputFormat$1, f as parsePruneBeforeDate, g as resolveAgentInvocation, h as parseTtlSeconds, i as addSessionOption, l as parseMaxTurns, m as parseTimeoutSeconds, n as addPromptInputOption, o as parseAllowedTools, p as parseSessionName, r as addSessionNameOption, s as parseDaysOlderThan, t as addGlobalFlags, u as parseNonEmptyValue, v as resolveOutputPolicy, x as toTimerMilliseconds, y as resolvePermissionMode } from "./flags---9OR06b.js";
2
+ import { a as runSessionQueueOwner, c as buildQueueOwnerArgOverride, g as __exportAll, h as isProcessAlive, l as flushPerfMetricsCapture, n as getTextErrorRemediationHints, o as runOnce, p as probeQueueOwnerHealth, t as createOutputFormatter, u as installPerfMetricsCapture } from "./output-DiPPprGk.js";
3
+ import { $t as AgentSpawnError, At as DEFAULT_AGENT_NAME, Ct as parsePromptSource, Dt as TimeoutError, Et as InterruptedError, G as listSessions, H as findSession, It as exitCodeForOutputErrorCode, Jt as OUTPUT_FORMATS, L as getAcpxVersion, Mt as normalizeAgentName$1, P as renderArgvIdentity, Qt as AcpxOperationalError, St as mergePromptSourceWithText, Tt as textPrompt, U as findSessionByDirectoryWalk, V as findGitRepositoryRoot, Wt as EXIT_CODES, X as writeSessionRecord, _t as isAcpJsonRpcMessage, bt as PromptInputValidationError, ct as serializeSessionRecordForDisk, dt as defaultSessionEventLog, ht as sessionEventSegmentPath, jt as listBuiltInAgents, lt as normalizeRuntimeSessionId, mt as sessionEventLockPath, pt as sessionEventActivePath, q as normalizeName, st as parseSessionRecord, zt as normalizeOutputError } from "./live-checkpoint-Gw2oGjhe.js";
4
+ import { S as loadPermissionPolicySpec, _ as resolveGlobalFlags, b as resolveSessionNameFromFlags, c as parseHistoryLimit, d as parseOutputFormat$1, f as parsePruneBeforeDate, g as resolveAgentInvocation, h as parseTtlSeconds, i as addSessionOption, l as parseMaxTurns, m as parseTimeoutSeconds, n as addPromptInputOption, o as parseAllowedTools, p as parseSessionName, r as addSessionNameOption, s as parseDaysOlderThan, t as addGlobalFlags, u as parseNonEmptyValue, v as resolveOutputPolicy, x as toTimerMilliseconds, y as resolvePermissionMode } from "./flags-CM2rAdBo.js";
5
5
  import { realpathSync } from "node:fs";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
7
  import path from "node:path";
@@ -108,7 +108,8 @@ function parseEventLockPayload(raw) {
108
108
  }
109
109
  async function hasLiveEventLock(recordId) {
110
110
  try {
111
- return isProcessAlive(parseEventLockPayload(await fs$1.readFile(sessionEventLockPath(recordId), "utf8")).pid);
111
+ const payload = await fs$1.readFile(sessionEventLockPath(recordId), "utf8");
112
+ return isProcessAlive(parseEventLockPayload(payload).pid);
112
113
  } catch (error) {
113
114
  if (error.code === "ENOENT") return false;
114
115
  throw error;
@@ -387,11 +388,11 @@ let sessionModulePromise;
387
388
  let outputModulePromise;
388
389
  let outputRenderModulePromise;
389
390
  function loadSessionModule() {
390
- sessionModulePromise ??= import("./output-CzN8vLdE.js").then((n) => n.i);
391
+ sessionModulePromise ??= import("./output-DiPPprGk.js").then((n) => n.i);
391
392
  return sessionModulePromise;
392
393
  }
393
394
  function loadOutputModule() {
394
- outputModulePromise ??= import("./output-CzN8vLdE.js").then((n) => n.r);
395
+ outputModulePromise ??= import("./output-DiPPprGk.js").then((n) => n.r);
395
396
  return outputModulePromise;
396
397
  }
397
398
  function loadOutputRenderModule() {
@@ -418,7 +419,8 @@ async function readPrompt(promptParts, filePath, cwd) {
418
419
  }
419
420
  }
420
421
  async function readPromptFromFile(filePath, cwd, promptParts) {
421
- const prompt = mergePromptSourceWithText(filePath === "-" ? await readPromptInputFromStdin() : await fs$1.readFile(path.resolve(cwd, filePath), "utf8"), promptParts.join(" "));
422
+ const source = filePath === "-" ? await readPromptInputFromStdin() : await fs$1.readFile(path.resolve(cwd, filePath), "utf8");
423
+ const prompt = mergePromptSourceWithText(source, promptParts.join(" "));
422
424
  if (prompt.length === 0) throw new InvalidArgumentError("Prompt from --file is empty");
423
425
  return prompt;
424
426
  }
@@ -457,7 +459,8 @@ async function resolvePermissionPolicyFromFlags$1(globalFlags) {
457
459
  try {
458
460
  return await loadPermissionPolicySpec(globalFlags.permissionPolicy, globalFlags.cwd);
459
461
  } catch (error) {
460
- throw new InvalidArgumentError(`Invalid permission policy: ${error instanceof Error ? error.message : String(error)}`);
462
+ const message = error instanceof Error ? error.message : String(error);
463
+ throw new InvalidArgumentError(`Invalid permission policy: ${message}`);
461
464
  }
462
465
  }
463
466
  function buildSessionStartOptions(params) {
@@ -1044,7 +1047,8 @@ async function readStdin() {
1044
1047
  return data;
1045
1048
  }
1046
1049
  async function readPromptFile(filePath, promptText, cwd) {
1047
- const prompt = mergePromptSourceWithText(filePath === "-" ? await readStdin() : await fs$1.readFile(path.resolve(cwd, filePath), "utf8"), promptText);
1050
+ const source = filePath === "-" ? await readStdin() : await fs$1.readFile(path.resolve(cwd, filePath), "utf8");
1051
+ const prompt = mergePromptSourceWithText(source, promptText);
1048
1052
  if (prompt.length === 0) throw new InvalidArgumentError("Prompt from --file is empty");
1049
1053
  return prompt;
1050
1054
  }
@@ -1133,7 +1137,8 @@ async function resolvePermissionPolicyFromFlags(globalFlags) {
1133
1137
  try {
1134
1138
  return await loadPermissionPolicySpec(globalFlags.permissionPolicy, globalFlags.cwd);
1135
1139
  } catch (error) {
1136
- throw new InvalidArgumentError(`Invalid permission policy: ${error instanceof Error ? error.message : String(error)}`);
1140
+ const message = error instanceof Error ? error.message : String(error);
1141
+ throw new InvalidArgumentError(`Invalid permission policy: ${message}`);
1137
1142
  }
1138
1143
  }
1139
1144
  function buildSuccessRow(agentName, result, capture, startedAt) {
@@ -2232,7 +2237,7 @@ function registerAgentCommand(program, agentName, config) {
2232
2237
  }
2233
2238
  function registerFlowCommand(program, config) {
2234
2239
  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) {
2235
- const { handleFlowRun } = await import("./cli-D52eGvxU.js");
2240
+ const { handleFlowRun } = await import("./cli-DJT3MRRI.js");
2236
2241
  await handleFlowRun(file, flags, this, config);
2237
2242
  });
2238
2243
  }
@@ -2336,7 +2341,8 @@ function assignSessionEnv(options, value) {
2336
2341
  if (entries.length > 0) options.env = Object.fromEntries(entries);
2337
2342
  }
2338
2343
  async function runQueueOwnerFromEnv(env) {
2339
- await runSessionQueueOwner(parseQueueOwnerPayload(await readQueueOwnerPayloadFromEnv(env)));
2344
+ const options = parseQueueOwnerPayload(await readQueueOwnerPayloadFromEnv(env));
2345
+ await runSessionQueueOwner(options);
2340
2346
  }
2341
2347
  async function readQueueOwnerPayloadFromEnv(env) {
2342
2348
  const payloadFile = env[QUEUE_OWNER_PAYLOAD_FILE_ENV];
@@ -2666,8 +2672,9 @@ async function main(argv = process.argv) {
2666
2672
  const initialCwd = detectInitialCwd(rawArgs);
2667
2673
  const config = await loadResolvedConfig(initialCwd, { mcpConfigPath: detectMcpConfigPath(rawArgs, initialCwd) });
2668
2674
  const requestedJsonStrict = detectJsonStrict(rawArgs);
2675
+ const requestedOutputFormat = detectRequestedOutputFormat(rawArgs, config.format);
2669
2676
  const requestedOutputPolicy = {
2670
- ...resolveOutputPolicy(detectRequestedOutputFormat(rawArgs, config.format), requestedJsonStrict),
2677
+ ...resolveOutputPolicy(requestedOutputFormat, requestedJsonStrict),
2671
2678
  suppressReads: rawArgs.some((token) => token === "--suppress-reads")
2672
2679
  };
2673
2680
  const program = createProgram(requestedJsonStrict);