acpx 0.12.1 → 0.13.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.
Files changed (35) hide show
  1. package/README.md +64 -375
  2. package/dist/{cli-pKoIEH5O.js → cli-_7Sei6dD.js} +5 -4
  3. package/dist/cli-_7Sei6dD.js.map +1 -0
  4. package/dist/cli.d.ts +2 -2
  5. package/dist/cli.d.ts.map +1 -1
  6. package/dist/cli.js +72 -19
  7. package/dist/cli.js.map +1 -1
  8. package/dist/{client-CFo_9MIo.d.ts → client-CxNllqui.d.ts} +17 -3
  9. package/dist/client-CxNllqui.d.ts.map +1 -0
  10. package/dist/{flags-CjeFX5ki.js → flags-Ds6FzmHG.js} +36 -9
  11. package/dist/flags-Ds6FzmHG.js.map +1 -0
  12. package/dist/{flows-Cym6H3vg.js → flows-fzH0GKYF.js} +14 -4
  13. package/dist/flows-fzH0GKYF.js.map +1 -0
  14. package/dist/flows.d.ts +6 -2
  15. package/dist/flows.d.ts.map +1 -1
  16. package/dist/flows.js +1 -1
  17. package/dist/{live-checkpoint-DQp4JSHD.js → live-checkpoint-BSIrfgVo.js} +560 -196
  18. package/dist/live-checkpoint-BSIrfgVo.js.map +1 -0
  19. package/dist/{output-fNqTAsFQ.js → output-BZQE0gI1.js} +74 -11
  20. package/dist/output-BZQE0gI1.js.map +1 -0
  21. package/dist/runtime.d.ts +106 -19
  22. package/dist/runtime.d.ts.map +1 -1
  23. package/dist/runtime.js +631 -158
  24. package/dist/runtime.js.map +1 -1
  25. package/dist/{session-options-C4uYkKDy.d.ts → session-options-DwRDODlr.d.ts} +28 -3
  26. package/dist/session-options-DwRDODlr.d.ts.map +1 -0
  27. package/package.json +19 -19
  28. package/skills/acpx/SKILL.md +5 -2
  29. package/dist/cli-pKoIEH5O.js.map +0 -1
  30. package/dist/client-CFo_9MIo.d.ts.map +0 -1
  31. package/dist/flags-CjeFX5ki.js.map +0 -1
  32. package/dist/flows-Cym6H3vg.js.map +0 -1
  33. package/dist/live-checkpoint-DQp4JSHD.js.map +0 -1
  34. package/dist/output-fNqTAsFQ.js.map +0 -1
  35. package/dist/session-options-C4uYkKDy.d.ts.map +0 -1
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-fNqTAsFQ.js";
3
- import { At as listBuiltInAgents, Et as TimeoutError, G as listSessions, Gt as OUTPUT_FORMATS, H as findSession, It as normalizeOutputError, L as getAcpxVersion, Nt as exitCodeForOutputErrorCode, St as parsePromptSource, Tt as InterruptedError, U as findSessionByDirectoryWalk, V as findGitRepositoryRoot, Vt as EXIT_CODES, X as writeSessionRecord, Xt as AgentSpawnError, Yt as AcpxOperationalError, ct as normalizeRuntimeSessionId, ft as sessionEventActivePath, gt as isAcpJsonRpcMessage, jt as normalizeAgentName$1, kt as DEFAULT_AGENT_NAME, mt as sessionEventSegmentPath, ot as parseSessionRecord, pt as sessionEventLockPath, q as normalizeName, st as serializeSessionRecordForDisk, ut as defaultSessionEventLog, wt as textPrompt, xt as mergePromptSourceWithText, yt as PromptInputValidationError } from "./live-checkpoint-DQp4JSHD.js";
4
- import { _ 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 loadPermissionPolicySpec, y as resolvePermissionMode } from "./flags-CjeFX5ki.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-BZQE0gI1.js";
3
+ import { $ as writeSessionRecord, At as TimeoutError, B as getAcpxVersion, Ct as PromptInputValidationError, Et as parsePromptSource, Ft as normalizeAgentName$1, G as findSession, Ht as normalizeOutputError, J as listSessions, K as findSessionByDirectoryWalk, L as renderArgvIdentity, Nt as DEFAULT_AGENT_NAME, Ot as textPrompt, Pt as listBuiltInAgents, Tt as mergePromptSourceWithText, W as findGitRepositoryRoot, X as normalizeName, Zt as OUTPUT_FORMATS, _t as sessionEventLockPath, bt as isAcpJsonRpcMessage, dt as serializeSessionRecordForDisk, ft as normalizeRuntimeSessionId, gt as sessionEventActivePath, kt as InterruptedError, mt as defaultSessionEventLog, nn as AgentSpawnError, qt as EXIT_CODES, tn as AcpxOperationalError, ut as parseSessionRecord, vt as sessionEventSegmentPath, zt as exitCodeForOutputErrorCode } from "./live-checkpoint-BSIrfgVo.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-Ds6FzmHG.js";
5
5
  import { realpathSync } from "node:fs";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
7
  import path from "node:path";
@@ -387,11 +387,11 @@ let sessionModulePromise;
387
387
  let outputModulePromise;
388
388
  let outputRenderModulePromise;
389
389
  function loadSessionModule() {
390
- sessionModulePromise ??= import("./output-fNqTAsFQ.js").then((n) => n.i);
390
+ sessionModulePromise ??= import("./output-BZQE0gI1.js").then((n) => n.i);
391
391
  return sessionModulePromise;
392
392
  }
393
393
  function loadOutputModule() {
394
- outputModulePromise ??= import("./output-fNqTAsFQ.js").then((n) => n.r);
394
+ outputModulePromise ??= import("./output-BZQE0gI1.js").then((n) => n.r);
395
395
  return outputModulePromise;
396
396
  }
397
397
  function loadOutputRenderModule() {
@@ -463,6 +463,7 @@ async function resolvePermissionPolicyFromFlags$1(globalFlags) {
463
463
  function buildSessionStartOptions(params) {
464
464
  return {
465
465
  agentCommand: params.agent.agentCommand,
466
+ agentArgv: params.agent.agentArgv,
466
467
  cwd: params.agent.cwd,
467
468
  name: params.flags.name,
468
469
  resumeSessionId: params.flags.resumeSession,
@@ -472,6 +473,7 @@ function buildSessionStartOptions(params) {
472
473
  permissionPolicy: params.permissionPolicy,
473
474
  authCredentials: params.config.auth,
474
475
  authPolicy: params.globalFlags.authPolicy,
476
+ fs: params.globalFlags.fs,
475
477
  terminal: params.globalFlags.terminal,
476
478
  timeoutMs: params.globalFlags.timeout,
477
479
  verbose: params.globalFlags.verbose,
@@ -540,6 +542,7 @@ async function handlePrompt(explicitAgentName, promptParts, flags, command, conf
540
542
  permissionPolicy,
541
543
  authCredentials: config.auth,
542
544
  authPolicy: globalFlags.authPolicy,
545
+ fs: globalFlags.fs,
543
546
  terminal: globalFlags.terminal,
544
547
  outputFormatter,
545
548
  errorEmissionPolicy: { queueErrorAlreadyEmitted: outputPolicy.queueErrorAlreadyEmitted },
@@ -588,6 +591,7 @@ async function handleExec(explicitAgentName, promptParts, flags, command, config
588
591
  const agent = resolveAgentInvocation(explicitAgentName, globalFlags, config);
589
592
  applyPermissionExitCode(await runOnce({
590
593
  agentCommand: agent.agentCommand,
594
+ agentArgv: agent.agentArgv,
591
595
  cwd: agent.cwd,
592
596
  prompt,
593
597
  mcpServers: config.mcpServers,
@@ -596,6 +600,7 @@ async function handleExec(explicitAgentName, promptParts, flags, command, config
596
600
  permissionPolicy,
597
601
  authCredentials: config.auth,
598
602
  authPolicy: globalFlags.authPolicy,
603
+ fs: globalFlags.fs,
599
604
  terminal: globalFlags.terminal,
600
605
  outputFormatter,
601
606
  errorEmissionPolicy: { queueErrorAlreadyEmitted: outputPolicy.queueErrorAlreadyEmitted },
@@ -688,6 +693,7 @@ async function handleSetMode(explicitAgentName, modeId, flags, command, config)
688
693
  nonInteractivePermissions: globalFlags.nonInteractivePermissions,
689
694
  authCredentials: config.auth,
690
695
  authPolicy: globalFlags.authPolicy,
696
+ fs: globalFlags.fs,
691
697
  terminal: globalFlags.terminal,
692
698
  timeoutMs: globalFlags.timeout,
693
699
  verbose: globalFlags.verbose
@@ -706,6 +712,7 @@ async function handleSetModel(explicitAgentName, modelId, flags, command, config
706
712
  nonInteractivePermissions: globalFlags.nonInteractivePermissions,
707
713
  authCredentials: config.auth,
708
714
  authPolicy: globalFlags.authPolicy,
715
+ fs: globalFlags.fs,
709
716
  terminal: globalFlags.terminal,
710
717
  timeoutMs: globalFlags.timeout,
711
718
  verbose: globalFlags.verbose
@@ -730,6 +737,7 @@ async function handleSetConfigOption(explicitAgentName, configId, value, flags,
730
737
  nonInteractivePermissions: globalFlags.nonInteractivePermissions,
731
738
  authCredentials: config.auth,
732
739
  authPolicy: globalFlags.authPolicy,
740
+ fs: globalFlags.fs,
733
741
  terminal: globalFlags.terminal,
734
742
  timeoutMs: globalFlags.timeout,
735
743
  verbose: globalFlags.verbose
@@ -744,6 +752,7 @@ async function tryListAgentSessions(agent, flags, globalFlags, config) {
744
752
  try {
745
753
  return await listAgentSessions({
746
754
  agentCommand: agent.agentCommand,
755
+ agentArgv: agent.agentArgv,
747
756
  cwd: agent.cwd,
748
757
  cursor: flags.cursor,
749
758
  filterCwd: resolveSessionListFilterCwd(flags, agent.cwd),
@@ -753,6 +762,7 @@ async function tryListAgentSessions(agent, flags, globalFlags, config) {
753
762
  permissionPolicy,
754
763
  authCredentials: config.auth,
755
764
  authPolicy: globalFlags.authPolicy,
765
+ fs: globalFlags.fs,
756
766
  terminal: globalFlags.terminal,
757
767
  timeoutMs: globalFlags.timeout,
758
768
  verbose: globalFlags.verbose
@@ -1169,6 +1179,7 @@ async function runAgentForCompare(params) {
1169
1179
  const agent = resolveAgentInvocation(params.agentName, params.globalFlags, params.config);
1170
1180
  const result = await runOnce({
1171
1181
  agentCommand: agent.agentCommand,
1182
+ agentArgv: agent.agentArgv,
1172
1183
  cwd: agent.cwd,
1173
1184
  prompt: params.prompt,
1174
1185
  mcpServers: params.config.mcpServers,
@@ -1177,6 +1188,7 @@ async function runAgentForCompare(params) {
1177
1188
  permissionPolicy: params.permissionPolicy,
1178
1189
  authCredentials: params.config.auth,
1179
1190
  authPolicy: params.globalFlags.authPolicy,
1191
+ fs: params.globalFlags.fs,
1180
1192
  terminal: params.globalFlags.terminal,
1181
1193
  outputFormatter: formatter,
1182
1194
  suppressSdkConsoleErrors: true,
@@ -1413,12 +1425,16 @@ function isObject(value) {
1413
1425
  function parseTtlMs(value, sourcePath) {
1414
1426
  if (value == null) return;
1415
1427
  if (typeof value !== "number" || !Number.isFinite(value) || value < 0) throw new Error(`Invalid config ttl in ${sourcePath}: expected non-negative seconds`);
1416
- return Math.round(value * 1e3);
1428
+ const milliseconds = toTimerMilliseconds(value, true);
1429
+ if (milliseconds === void 0) throw new Error(`Invalid config ttl in ${sourcePath}: exceeds maximum supported timer delay`);
1430
+ return milliseconds;
1417
1431
  }
1418
1432
  function parseTimeoutMs(value, sourcePath) {
1419
1433
  if (value == null) return;
1420
1434
  if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) throw new Error(`Invalid config timeout in ${sourcePath}: expected positive seconds or null`);
1421
- return Math.round(value * 1e3);
1435
+ const milliseconds = toTimerMilliseconds(value, false);
1436
+ if (milliseconds === void 0) throw new Error(`Invalid config timeout in ${sourcePath}: exceeds maximum supported timer delay`);
1437
+ return milliseconds;
1422
1438
  }
1423
1439
  function parseQueueMaxDepth(value, sourcePath) {
1424
1440
  if (value == null) return;
@@ -1454,15 +1470,42 @@ function parseAgents(value, sourcePath) {
1454
1470
  if (value == null) return;
1455
1471
  if (!isObject(value)) throw new Error(`Invalid config agents in ${sourcePath}: expected object`);
1456
1472
  const parsed = {};
1457
- for (const [name, raw] of Object.entries(value)) {
1458
- if (!isObject(raw)) throw new Error(`Invalid config agents.${name} in ${sourcePath}: expected object with command`);
1459
- const command = raw.command;
1460
- if (typeof command !== "string" || command.trim().length === 0) throw new Error(`Invalid config agents.${name}.command in ${sourcePath}: expected non-empty string`);
1461
- const args = parseAgentArgs(raw.args, name, sourcePath);
1462
- parsed[normalizeAgentName$1(name)] = args.length > 0 ? `${command.trim()} ${args.map(quoteCommandArg).join(" ")}` : command.trim();
1463
- }
1473
+ for (const [name, raw] of Object.entries(value)) parsed[normalizeAgentName$1(name)] = parseAgentEntry(raw, name, sourcePath);
1464
1474
  return parsed;
1465
1475
  }
1476
+ function parseAgentEntry(raw, name, sourcePath) {
1477
+ if (!isObject(raw)) throw new Error(`Invalid config agents.${name} in ${sourcePath}: expected object with command`);
1478
+ return Object.prototype.hasOwnProperty.call(raw, "argv") ? parseArgvAgentEntry(raw, name, sourcePath) : parseLegacyAgentEntry(raw, name, sourcePath);
1479
+ }
1480
+ function parseArgvAgentEntry(raw, name, sourcePath) {
1481
+ if (Object.prototype.hasOwnProperty.call(raw, "command") || Object.prototype.hasOwnProperty.call(raw, "args")) throw new Error(`Invalid config agents.${name} in ${sourcePath}: use argv alone, not command or args`);
1482
+ const argv = parseAgentArgv(raw.argv, name, sourcePath);
1483
+ return {
1484
+ command: renderArgv(argv),
1485
+ argv
1486
+ };
1487
+ }
1488
+ function parseLegacyAgentEntry(raw, name, sourcePath) {
1489
+ const command = raw.command;
1490
+ if (typeof command !== "string" || command.trim().length === 0) throw new Error(`Invalid config agents.${name}.command in ${sourcePath}: expected non-empty string`);
1491
+ const trimmedCommand = command.trim();
1492
+ if (!Object.prototype.hasOwnProperty.call(raw, "args")) return { command: trimmedCommand };
1493
+ if (/[\s'"]/u.test(trimmedCommand)) throw new Error(`Invalid config agents.${name}.command in ${sourcePath}: command must be an unquoted executable with no whitespace when args is present; migrate the complete launch to argv`);
1494
+ const args = parseAgentArgs(raw.args, name, sourcePath);
1495
+ return {
1496
+ command: args.length > 0 ? `${trimmedCommand} ${args.map(quoteCommandArg).join(" ")}` : trimmedCommand,
1497
+ argv: [trimmedCommand, ...args]
1498
+ };
1499
+ }
1500
+ function parseAgentArgv(value, agentName, sourcePath) {
1501
+ if (!Array.isArray(value) || value.length === 0) throw new Error(`Invalid config agents.${agentName}.argv in ${sourcePath}: expected non-empty array of strings`);
1502
+ const argv = value.map((arg, index) => {
1503
+ if (typeof arg !== "string") throw new Error(`Invalid config agents.${agentName}.argv[${index}] in ${sourcePath}: expected string`);
1504
+ return arg;
1505
+ });
1506
+ if (argv[0]?.length === 0) throw new Error(`Invalid config agents.${agentName}.argv[0] in ${sourcePath}: expected non-empty executable`);
1507
+ return argv;
1508
+ }
1466
1509
  function parseAgentArgs(value, agentName, sourcePath) {
1467
1510
  if (value == null) return [];
1468
1511
  if (!Array.isArray(value)) throw new Error(`Invalid config agents.${agentName}.args in ${sourcePath}: expected array of strings`);
@@ -1474,6 +1517,9 @@ function parseAgentArgs(value, agentName, sourcePath) {
1474
1517
  function quoteCommandArg(value) {
1475
1518
  return JSON.stringify(value);
1476
1519
  }
1520
+ function renderArgv(argv) {
1521
+ return renderArgvIdentity(argv);
1522
+ }
1477
1523
  function parseAuth(value, sourcePath) {
1478
1524
  if (value == null) return;
1479
1525
  if (!isObject(value)) throw new Error(`Invalid config auth in ${sourcePath}: expected object`);
@@ -1611,13 +1657,13 @@ function resolveDisableExec(projectConfig, projectPath, globalConfig, globalPath
1611
1657
  }
1612
1658
  function toConfigDisplay(config) {
1613
1659
  const agents = {};
1614
- for (const [name, command] of Object.entries(config.agents)) agents[name] = { command };
1660
+ for (const [name, agent] of Object.entries(config.agents)) agents[name] = agent.argv ? { argv: [...agent.argv] } : { command: agent.command };
1615
1661
  return {
1616
1662
  defaultAgent: config.defaultAgent,
1617
1663
  defaultPermissions: config.defaultPermissions,
1618
1664
  nonInteractivePermissions: config.nonInteractivePermissions,
1619
1665
  authPolicy: config.authPolicy,
1620
- ttl: Math.round(config.ttlMs / 1e3),
1666
+ ttl: config.ttlMs / 1e3,
1621
1667
  timeout: config.timeoutMs == null ? null : config.timeoutMs / 1e3,
1622
1668
  queueMaxDepth: config.queueMaxDepth,
1623
1669
  format: config.format,
@@ -1723,6 +1769,7 @@ function registerConfigCommand(program, config) {
1723
1769
  //#region src/cli/output/render.ts
1724
1770
  var render_exports = /* @__PURE__ */ __exportAll({
1725
1771
  agentSessionIdPayload: () => agentSessionIdPayload,
1772
+ classifySessionConnectionStatus: () => classifySessionConnectionStatus,
1726
1773
  formatPromptSessionBannerLine: () => formatPromptSessionBannerLine,
1727
1774
  printAgentSessionsByFormat: () => printAgentSessionsByFormat,
1728
1775
  printClosedSessionByFormat: () => printClosedSessionByFormat,
@@ -1742,8 +1789,12 @@ function formatRoutedFrom(sessionCwd, currentCwd) {
1742
1789
  if (!relative || relative === ".") return;
1743
1790
  return relative.startsWith(".") ? relative : `.${path.sep}${relative}`;
1744
1791
  }
1792
+ function classifySessionConnectionStatus(health) {
1793
+ if (health.healthy) return "connected";
1794
+ return health.hasLease ? "needs reconnect" : "starting";
1795
+ }
1745
1796
  async function resolveSessionConnectionStatus(record) {
1746
- return (await probeQueueOwnerHealth(record.acpxRecordId)).healthy ? "connected" : "needs reconnect";
1797
+ return classifySessionConnectionStatus(await probeQueueOwnerHealth(record.acpxRecordId));
1747
1798
  }
1748
1799
  function printSessionsByFormat(sessions, format) {
1749
1800
  if (format === "json") {
@@ -1848,7 +1899,7 @@ function printQueuedPromptByFormat(result, format) {
1848
1899
  if (format === "quiet") return;
1849
1900
  process.stdout.write(`[queued] ${result.requestId}\n`);
1850
1901
  }
1851
- function formatPromptSessionBannerLine(record, currentCwd, connectionStatus = "needs reconnect") {
1902
+ function formatPromptSessionBannerLine(record, currentCwd, connectionStatus = "starting") {
1852
1903
  const label = formatSessionLabel(record);
1853
1904
  const normalizedSessionCwd = path.resolve(record.cwd);
1854
1905
  const normalizedCurrentCwd = path.resolve(currentCwd);
@@ -2181,7 +2232,7 @@ function registerAgentCommand(program, agentName, config) {
2181
2232
  }
2182
2233
  function registerFlowCommand(program, config) {
2183
2234
  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) {
2184
- const { handleFlowRun } = await import("./cli-pKoIEH5O.js");
2235
+ const { handleFlowRun } = await import("./cli-_7Sei6dD.js");
2185
2236
  await handleFlowRun(file, flags, this, config);
2186
2237
  });
2187
2238
  }
@@ -2234,6 +2285,7 @@ function assignQueueOwnerTransportOptions(options, record) {
2234
2285
  function assignQueueOwnerScalarOptions(options, record) {
2235
2286
  if (record.nonInteractivePermissions === "deny" || record.nonInteractivePermissions === "fail") options.nonInteractivePermissions = record.nonInteractivePermissions;
2236
2287
  if (record.authPolicy === "skip" || record.authPolicy === "fail") options.authPolicy = record.authPolicy;
2288
+ assignBooleanOption(options, "fs", record.fs);
2237
2289
  assignBooleanOption(options, "terminal", record.terminal);
2238
2290
  assignBooleanOption(options, "suppressSdkConsoleErrors", record.suppressSdkConsoleErrors);
2239
2291
  assignBooleanOption(options, "verbose", record.verbose);
@@ -2347,6 +2399,7 @@ const TOP_LEVEL_VERSION_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
2347
2399
  "--deny-all",
2348
2400
  "--suppress-reads",
2349
2401
  "--json-strict",
2402
+ "--no-fs",
2350
2403
  "--no-terminal",
2351
2404
  "--verbose"
2352
2405
  ]);