acpx 0.12.1 → 0.13.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.
Files changed (35) hide show
  1. package/README.md +8 -1
  2. package/dist/{cli-pKoIEH5O.js → cli-D52eGvxU.js} +5 -4
  3. package/dist/cli-D52eGvxU.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-BeKvumq9.d.ts} +4 -2
  9. package/dist/client-BeKvumq9.d.ts.map +1 -0
  10. package/dist/{flags-CjeFX5ki.js → flags---9OR06b.js} +36 -9
  11. package/dist/flags---9OR06b.js.map +1 -0
  12. package/dist/{flows-Cym6H3vg.js → flows-CYfjwbn2.js} +14 -4
  13. package/dist/flows-CYfjwbn2.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-CBecfnSH.js} +220 -15
  18. package/dist/live-checkpoint-CBecfnSH.js.map +1 -0
  19. package/dist/{output-fNqTAsFQ.js → output-CzN8vLdE.js} +26 -2
  20. package/dist/output-CzN8vLdE.js.map +1 -0
  21. package/dist/runtime.d.ts +4 -4
  22. package/dist/runtime.d.ts.map +1 -1
  23. package/dist/runtime.js +32 -10
  24. package/dist/runtime.js.map +1 -1
  25. package/dist/{session-options-C4uYkKDy.d.ts → session-options-CTdZvr68.d.ts} +4 -1
  26. package/dist/session-options-CTdZvr68.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/runtime.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as AcpPermissionRequest, c as NonInteractivePermissionPolicy, f as SessionRecord, i as AcpPermissionDecision, l as PermissionMode, n as SystemPromptOption, s as McpServer$1, t as SessionAgentOptions } from "./session-options-C4uYkKDy.js";
2
- import { a as RequestedModelUnsupportedErrorCode, i as RequestedModelUnsupportedError, n as REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, o as RequestedModelUnsupportedReason, r as REQUESTED_MODEL_UNSUPPORTED_REASONS, s as isRequestedModelUnsupportedError, t as AcpClient } from "./client-CFo_9MIo.js";
1
+ import { a as AcpPermissionRequest, c as NonInteractivePermissionPolicy, f as SessionRecord, i as AcpPermissionDecision, l as PermissionMode, n as SystemPromptOption, s as McpServer$1, t as SessionAgentOptions } from "./session-options-CTdZvr68.js";
2
+ import { a as RequestedModelUnsupportedErrorCode, i as RequestedModelUnsupportedError, n as REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, o as RequestedModelUnsupportedReason, r as REQUESTED_MODEL_UNSUPPORTED_REASONS, s as isRequestedModelUnsupportedError, t as AcpClient } from "./client-BeKvumq9.js";
3
3
  import fs from "node:fs";
4
4
  import { ToolCallContent, ToolCallLocation, ToolKind } from "@agentclientprotocol/sdk";
5
5
  //#region src/agent-registry.d.ts
@@ -257,7 +257,7 @@ interface AcpSessionStore {
257
257
  save(record: AcpSessionRecord): Promise<void>;
258
258
  }
259
259
  interface AcpAgentRegistry {
260
- resolve(agentName: string): string;
260
+ resolve(agentName: string): string | string[];
261
261
  list(): string[];
262
262
  }
263
263
  type AcpRuntimeOptions = {
@@ -396,7 +396,7 @@ type AcpxRuntimeLike = AcpRuntime & {
396
396
  doctor(): Promise<AcpRuntimeDoctorReport>;
397
397
  };
398
398
  declare function createAgentRegistry(params?: {
399
- overrides?: Record<string, string>;
399
+ overrides?: Record<string, string | string[]>;
400
400
  }): AcpAgentRegistry;
401
401
  declare class AcpxRuntime implements AcpxRuntimeLike {
402
402
  private readonly options;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","names":[],"sources":["../src/agent-registry.ts","../src/runtime/public/contract.ts","../src/runtime/engine/manager.ts","../src/runtime/public/file-session-store.ts","../src/runtime/public/errors.ts","../src/runtime/public/shared.ts","../src/runtime/public/handle-state.ts","../src/runtime.ts"],"mappings":";;;;;cAoFa;;;KCrED;KAEA;KAEA;KAaA;KAEA;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV;EACA;EACA,MAAM;EACN;EACA;;;;;;;;;EASA,iBAAiB;;KAGP;;;;;EAKV;EACA;;KAGU;EACV,QAAQ;EACR;EACA,cAAc;EACd,MAAM;EACN;EACA;EACA,SAAS;;KAGC;EACV,UAAU;EACV;;KAGU;EACV;EACA;;;;;;;KAQU;EACV;EACA;;;;;;;KAQU;EACV;EACA;EACA;EACA;EACA;EACA;;;;;;;;KASU;EACV;EACA;;EAEA;;;;;;;KAQU;EACV,aAAa;;EAEb,OAAO;;EAEP,aAAa,eAAe;;KAGlB;EACV;EACA;EACA;EACA;EACA,SAAS;;EAET,QAAQ;;;;;;;EAOR,oBAAoB;EACpB,UAAU;;KAGA;EACV;EACA;EACA;EACA;EACA;;KAGU;EAEN;EACA;EACA;EACA,MAAM;;EAGN;EACA;EACA,MAAM;EACN;EACA;;EAEA,OAAO;;;;;;EAMP,YAAY;;;;;;;EAOZ,oBAAoB;;EAGpB;EACA;EACA,MAAM;EACN;EACA;EACA;EACA,OAAO;EACP,YAAY;EACZ;EACA;EACA,UAAU;;;;;;;EAOV;EACA;;;;;;;EAOA;EACA;EACA;EACA;EACA;;KAGM;EACV;EACA;EACA;EACA;;KAGU;EAEN;EACA;;EAGA;EACA;;EAGA;EACA,OAAO;;UAGI;WACN;WACA,QAAQ,cAAc;WACtB,QAAQ,QAA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":"runtime.d.ts","names":[],"sources":["../src/agent-registry.ts","../src/runtime/public/contract.ts","../src/runtime/engine/manager.ts","../src/runtime/public/file-session-store.ts","../src/runtime/public/errors.ts","../src/runtime/public/shared.ts","../src/runtime/public/handle-state.ts","../src/runtime.ts"],"mappings":";;;;;cAkHa;;;KCnGD;KAEA;KAEA;KAaA;KAEA;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV;EACA;EACA,MAAM;EACN;EACA;;;;;;;;;EASA,iBAAiB;;KAGP;;;;;EAKV;EACA;;KAGU;EACV,QAAQ;EACR;EACA,cAAc;EACd,MAAM;EACN;EACA;EACA,SAAS;;KAGC;EACV,UAAU;EACV;;KAGU;EACV;EACA;;;;;;;KAQU;EACV;EACA;;;;;;;KAQU;EACV;EACA;EACA;EACA;EACA;EACA;;;;;;;;KASU;EACV;EACA;;EAEA;;;;;;;KAQU;EACV,aAAa;;EAEb,OAAO;;EAEP,aAAa,eAAe;;KAGlB;EACV;EACA;EACA;EACA;EACA,SAAS;;EAET,QAAQ;;;;;;;EAOR,oBAAoB;EACpB,UAAU;;KAGA;EACV;EACA;EACA;EACA;EACA;;KAGU;EAEN;EACA;EACA;EACA,MAAM;;EAGN;EACA;EACA,MAAM;EACN;EACA;;EAEA,OAAO;;;;;;EAMP,YAAY;;;;;;;EAOZ,oBAAoB;;EAGpB;EACA;EACA,MAAM;EACN;EACA;EACA;EACA,OAAO;EACP,YAAY;EACZ;EACA;EACA,UAAU;;;;;;;EAOV;EACA;;;;;;;EAOA;EACA;EACA;EACA;EACA;;KAGM;EACV;EACA;EACA;EACA;;KAGU;EAEN;EACA;;EAGA;EACA;;EAGA;EACA,OAAO;;UAGI;WACN;WACA,QAAQ,cAAc;WACtB,QAAQ,QAAQ;EACzB,OAAO;IAAU;MAAoB;EACrC,YAAY;IAAU;MAAoB;;UAG3B;EACf,cAAc,OAAO,wBAAwB,QAAQ;EACrD,UAAU,OAAO,sBAAsB;;;;;;EAMvC,QAAQ,OAAO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applyConversation, F as modelStateFromConfigOptions, It as normalizeOutputError, Lt as extractAcpError, M as RequestedModelUnsupportedError, Mt as resolveAgentCommand, O as reconcileAgentSessionId, Ot as withTimeout, P as isRequestedModelUnsupportedError, Rt as isAcpResourceNotFoundError, S as advertisedModelState, T as sessionOptionsFromRecord, Z as assertPersistedKeyPolicy, _ as createSessionConversation, a as applyRequestedModelIfAdvertised, b as recordSessionUpdate, c as setCurrentModelId, d as setDesiredModelId, f as syncAdvertisedModelState, g as cloneSessionConversation, h as cloneSessionAcpxState, i as connectAndLoadSession, j as REQUESTED_MODEL_UNSUPPORTED_REASONS, k as AcpClient, kt as DEFAULT_AGENT_NAME, l as setDesiredConfigOption, m as applyConfigOptionsToState, n as runPromptTurn, o as currentModelIdFromSetModelResponse, ot as parseSessionRecord, p as applyConfigOptionsToRecord, r as withConnectedSession, s as clearDesiredConfigOption, st as serializeSessionRecordForDisk, t as LiveSessionCheckpoint, u as setDesiredModeId, ut as defaultSessionEventLog, v as recordClientOperation, w as persistSessionOptions, wt as textPrompt, x as trimConversationForRuntime, y as recordPromptSubmission } from "./live-checkpoint-DQp4JSHD.js";
1
+ import { $ as createAtomicWriteTempPath, A as REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, D as applyLifecycleSnapshotToRecord, Dt as textPrompt, E as applyConversation, F as modelStateFromConfigOptions, Ft as resolveAgentArgv, Ht as extractAcpError, I as normalizeAgentCommandInput, It as resolveAgentCommand, Lt as resolveCanonicalAgentName, M as RequestedModelUnsupportedError, Mt as DEFAULT_AGENT_NAME, Nt as listBuiltInAgents, O as reconcileAgentSessionId, P as isRequestedModelUnsupportedError, Pt as normalizeAgentName, S as advertisedModelState, T as sessionOptionsFromRecord, Ut as isAcpResourceNotFoundError, Vt as normalizeOutputError, _ as createSessionConversation, a as applyRequestedModelIfAdvertised, b as recordSessionUpdate, c as setCurrentModelId, d as setDesiredModelId, et as assertPersistedKeyPolicy, f as syncAdvertisedModelState, g as cloneSessionConversation, h as cloneSessionAcpxState, i as connectAndLoadSession, j as REQUESTED_MODEL_UNSUPPORTED_REASONS, jt as withTimeout, k as AcpClient, l as setDesiredConfigOption, lt as parseSessionRecord, m as applyConfigOptionsToState, n as runPromptTurn, o as currentModelIdFromSetModelResponse, p as applyConfigOptionsToRecord, pt as defaultSessionEventLog, r as withConnectedSession, s as clearDesiredConfigOption, t as LiveSessionCheckpoint, u as setDesiredModeId, ut as serializeSessionRecordForDisk, v as recordClientOperation, w as persistSessionOptions, x as trimConversationForRuntime, y as recordPromptSubmission } from "./live-checkpoint-CBecfnSH.js";
2
2
  import path from "node:path";
3
3
  import fs from "node:fs/promises";
4
4
  import { randomUUID } from "node:crypto";
@@ -561,6 +561,7 @@ function createInitialRecord(params) {
561
561
  acpSessionId: params.sessionId,
562
562
  agentSessionId: params.agentSessionId,
563
563
  agentCommand: params.agentCommand,
564
+ agentArgv: params.agentArgv,
564
565
  cwd: params.cwd,
565
566
  name: params.sessionName,
566
567
  createdAt: now,
@@ -822,7 +823,7 @@ var AcpRuntimeManager = class {
822
823
  }
823
824
  async ensureSession(input) {
824
825
  const cwd = path.resolve(input.cwd?.trim() || this.options.cwd);
825
- const agentCommand = this.options.agentRegistry.resolve(input.agent);
826
+ const { agentCommand, agentArgv } = normalizeAgentCommandInput(this.options.agentRegistry.resolve(input.agent));
826
827
  const existing = await this.options.sessionStore.load(input.sessionKey);
827
828
  if (input.mode === "persistent" && existing && shouldReuseExistingRecord(existing, {
828
829
  cwd,
@@ -837,6 +838,7 @@ var AcpRuntimeManager = class {
837
838
  }
838
839
  const client = this.createClient({
839
840
  agentCommand,
841
+ agentArgv,
840
842
  cwd,
841
843
  mcpServers: [...this.options.mcpServers ?? []],
842
844
  permissionMode: this.options.permissionMode,
@@ -853,6 +855,7 @@ var AcpRuntimeManager = class {
853
855
  input,
854
856
  client,
855
857
  agentCommand,
858
+ agentArgv,
856
859
  cwd,
857
860
  session
858
861
  });
@@ -863,12 +866,13 @@ var AcpRuntimeManager = class {
863
866
  }
864
867
  }
865
868
  async createAndSaveRuntimeRecord(params) {
866
- const { input, client, agentCommand, cwd, session } = params;
869
+ const { input, client, agentCommand, agentArgv, cwd, session } = params;
867
870
  const record = createInitialRecord({
868
871
  recordId: createRecordId(input.sessionKey, input.mode),
869
872
  sessionName: input.sessionKey,
870
873
  sessionId: session.sessionId,
871
874
  agentCommand,
875
+ agentArgv,
872
876
  cwd,
873
877
  agentSessionId: session.agentSessionId
874
878
  });
@@ -1029,6 +1033,7 @@ var AcpRuntimeManager = class {
1029
1033
  createTurnClient(record) {
1030
1034
  return this.createClient({
1031
1035
  agentCommand: record.agentCommand,
1036
+ agentArgv: record.agentArgv,
1032
1037
  cwd: record.cwd,
1033
1038
  mcpServers: [...this.options.mcpServers ?? []],
1034
1039
  permissionMode: this.options.permissionMode,
@@ -1316,6 +1321,7 @@ var AcpRuntimeManager = class {
1316
1321
  const pendingClient = await this.readPendingPersistentClient(record, { consume: true });
1317
1322
  const client = pendingClient ?? this.createClient({
1318
1323
  agentCommand: record.agentCommand,
1324
+ agentArgv: record.agentArgv,
1319
1325
  cwd: record.cwd,
1320
1326
  mcpServers: [...this.options.mcpServers ?? []],
1321
1327
  permissionMode: this.options.permissionMode,
@@ -1382,7 +1388,7 @@ var FileSessionStore = class {
1382
1388
  const persisted = serializeSessionRecordForDisk(record);
1383
1389
  assertPersistedKeyPolicy(persisted);
1384
1390
  const file = this.filePath(record.acpxRecordId);
1385
- const tempFile = `${file}.${process.pid}.${Date.now()}.tmp`;
1391
+ const tempFile = createAtomicWriteTempPath(file);
1386
1392
  const payload = JSON.stringify(persisted, null, 2);
1387
1393
  await fs.writeFile(tempFile, `${payload}\n`, "utf8");
1388
1394
  await fs.rename(tempFile, file);
@@ -1464,7 +1470,7 @@ function normalizeRuntimeDetails(details) {
1464
1470
  }
1465
1471
  async function probeRuntime(options, deps = {}) {
1466
1472
  const agentName = options.probeAgent?.trim() || "codex";
1467
- const agentCommand = options.agentRegistry.resolve(agentName);
1473
+ const agentCommand = normalizeAgentCommandInput(options.agentRegistry.resolve(agentName));
1468
1474
  const client = createProbeClient(options, agentCommand, deps);
1469
1475
  try {
1470
1476
  await client.start();
@@ -1473,7 +1479,7 @@ async function probeRuntime(options, deps = {}) {
1473
1479
  message: "embedded ACP runtime ready",
1474
1480
  details: [
1475
1481
  `agent=${agentName}`,
1476
- `command=${agentCommand}`,
1482
+ `command=${agentCommand.agentCommand}`,
1477
1483
  `cwd=${options.cwd}`,
1478
1484
  ...client.initializeResult?.protocolVersion ? [`protocolVersion=${client.initializeResult.protocolVersion}`] : []
1479
1485
  ]
@@ -1484,7 +1490,7 @@ async function probeRuntime(options, deps = {}) {
1484
1490
  message: "embedded ACP runtime probe failed",
1485
1491
  details: [
1486
1492
  `agent=${agentName}`,
1487
- `command=${agentCommand}`,
1493
+ `command=${agentCommand.agentCommand}`,
1488
1494
  `cwd=${options.cwd}`,
1489
1495
  formatRuntimeDetail(error)
1490
1496
  ]
@@ -1495,7 +1501,7 @@ async function probeRuntime(options, deps = {}) {
1495
1501
  }
1496
1502
  function createProbeClient(options, agentCommand, deps) {
1497
1503
  const clientOptions = {
1498
- agentCommand,
1504
+ ...agentCommand,
1499
1505
  cwd: options.cwd,
1500
1506
  mcpServers: [...options.mcpServers ?? []],
1501
1507
  permissionMode: options.permissionMode,
@@ -1513,15 +1519,31 @@ const ACPX_CAPABILITIES = { controls: [
1513
1519
  "session/status"
1514
1520
  ] };
1515
1521
  function createAgentRegistry(params) {
1522
+ const overrides = normalizeRegistryOverrides(params?.overrides);
1516
1523
  return {
1517
1524
  resolve(agentName) {
1518
- return resolveAgentCommand(agentName, params?.overrides);
1525
+ const normalizedAgentName = normalizeAgentName(agentName);
1526
+ return overrides[normalizedAgentName] ?? overrides[resolveCanonicalAgentName(agentName)] ?? resolveAgentArgv(agentName) ?? resolveAgentCommand(agentName);
1519
1527
  },
1520
1528
  list() {
1521
- return listBuiltInAgents(params?.overrides);
1529
+ return listBuiltInAgents(overrides);
1522
1530
  }
1523
1531
  };
1524
1532
  }
1533
+ function normalizeRegistryOverrides(values) {
1534
+ const normalized = {};
1535
+ for (const [name, value] of Object.entries(values ?? {})) {
1536
+ const normalizedName = normalizeAgentName(name);
1537
+ if (!normalizedName) continue;
1538
+ const normalizedValue = normalizeRegistryOverride(value);
1539
+ if (normalizedValue) normalized[normalizedName] = normalizedValue;
1540
+ }
1541
+ return normalized;
1542
+ }
1543
+ function normalizeRegistryOverride(value) {
1544
+ if (typeof value === "string") return value.trim() || void 0;
1545
+ return value.length > 0 && value[0]?.length ? [...value] : void 0;
1546
+ }
1525
1547
  var AcpxRuntime = class {
1526
1548
  options;
1527
1549
  testOptions;