@openaide/codex-acp 1.1.0 → 1.1.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.
Files changed (2) hide show
  1. package/dist/index.js +35 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -22155,6 +22155,10 @@ function clientSupportsSubagents(capabilities) {
22155
22155
  if (typeof subagents === "object" && subagents !== null && !Array.isArray(subagents)) {
22156
22156
  return true;
22157
22157
  }
22158
+ const openaide = capabilities?._meta?.["openaide"];
22159
+ if (typeof openaide === "object" && openaide !== null && !Array.isArray(openaide) && openaide.nativeSubagentSessions === true) {
22160
+ return true;
22161
+ }
22158
22162
  return clientSupportsAirCapability(capabilities, AIR_NATIVE_SUBAGENT_SESSIONS_KEY);
22159
22163
  }
22160
22164
  function asSdkSessionNotification(notification) {
@@ -23707,6 +23711,7 @@ var CodexSubagentEventRouter = class _CodexSubagentEventRouter {
23707
23711
  materializationWaiters = /* @__PURE__ */ new Map();
23708
23712
  replayQueue = [];
23709
23713
  activeLegacyActivities = /* @__PURE__ */ new Set();
23714
+ projectedPromptIds = /* @__PURE__ */ new Set();
23710
23715
  async handle(notification) {
23711
23716
  if (notification.method === "turn/started") {
23712
23717
  return this.isKnownChild(notification.params.threadId);
@@ -23766,6 +23771,11 @@ var CodexSubagentEventRouter = class _CodexSubagentEventRouter {
23766
23771
  await this.reopen(childThreadId);
23767
23772
  }
23768
23773
  }
23774
+ if (item.tool === "sendInput" && notification.method === "item/started" && item.prompt?.trim()) {
23775
+ for (const childThreadId of item.receiverThreadIds) {
23776
+ await this.projectPrompt(childThreadId, item.id, item.prompt.trim());
23777
+ }
23778
+ }
23769
23779
  }
23770
23780
  let representedSpawn = false;
23771
23781
  if (item.tool === "spawnAgent") {
@@ -23781,7 +23791,14 @@ var CodexSubagentEventRouter = class _CodexSubagentEventRouter {
23781
23791
  logger.log(`Ignoring self-referential spawned subagent ${childSessionId}`);
23782
23792
  continue;
23783
23793
  }
23784
- if (this.children.has(childSessionId) || this.pendingSpawns.has(childSessionId) || this.terminalPendingSpawns.has(childSessionId)) {
23794
+ if (this.children.has(childSessionId)) {
23795
+ representedSpawn = true;
23796
+ if (notification.method === "item/started" && item.prompt?.trim()) {
23797
+ await this.projectPrompt(childSessionId, item.id, item.prompt.trim());
23798
+ }
23799
+ continue;
23800
+ }
23801
+ if (this.pendingSpawns.has(childSessionId) || this.terminalPendingSpawns.has(childSessionId)) {
23785
23802
  representedSpawn = true;
23786
23803
  continue;
23787
23804
  }
@@ -23789,6 +23806,7 @@ var CodexSubagentEventRouter = class _CodexSubagentEventRouter {
23789
23806
  parentThreadId,
23790
23807
  parentSessionId,
23791
23808
  task: item.prompt?.trim() || "Delegated task",
23809
+ ...item.prompt?.trim() ? { promptSourceId: item.id } : {},
23792
23810
  buffered: [],
23793
23811
  droppedBufferedNotifications: 0
23794
23812
  });
@@ -23917,10 +23935,25 @@ var CodexSubagentEventRouter = class _CodexSubagentEventRouter {
23917
23935
  path: normalizeAgentPath(path8),
23918
23936
  generation: 1
23919
23937
  });
23938
+ if (pending?.promptSourceId) {
23939
+ await this.projectPrompt(childSessionId, pending.promptSourceId, pending.task);
23940
+ }
23920
23941
  this.pendingSpawns.delete(childSessionId);
23921
23942
  this.replayQueue.push(...pending?.buffered ?? []);
23922
23943
  this.resolveMaterialization(childSessionId, childSessionId);
23923
23944
  }
23945
+ async projectPrompt(childThreadId, sourceId, prompt) {
23946
+ const child = this.children.get(childThreadId);
23947
+ if (!child) return;
23948
+ const messageId = `collab:${sourceId}:prompt`;
23949
+ if (this.projectedPromptIds.has(messageId)) return;
23950
+ await this.session.update({
23951
+ sessionUpdate: "user_message_chunk",
23952
+ content: { type: "text", text: prompt },
23953
+ messageId
23954
+ }, child.sessionId);
23955
+ this.projectedPromptIds.add(messageId);
23956
+ }
23924
23957
  finishPending(childSessionId) {
23925
23958
  const pending = this.pendingSpawns.get(childSessionId);
23926
23959
  if (!pending) return;
@@ -27228,7 +27261,7 @@ var package_default = {
27228
27261
  publishConfig: {
27229
27262
  access: "public"
27230
27263
  },
27231
- version: "1.1.0",
27264
+ version: "1.1.2",
27232
27265
  description: "",
27233
27266
  main: "dist/index.js",
27234
27267
  bin: {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.1.0",
6
+ "version": "1.1.2",
7
7
  "description": "",
8
8
  "main": "dist/index.js",
9
9
  "bin": {