@moxt-ai/mobius 0.0.467 → 0.0.469

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 (43) hide show
  1. package/dist/{chunk-X64YZNBY.js → chunk-N3SPAVPT.js} +2 -2
  2. package/dist/{chunk-X64YZNBY.js.map → chunk-N3SPAVPT.js.map} +1 -1
  3. package/dist/{chunk-KOLL57ZM.js → chunk-YEFL2MHP.js} +204 -70
  4. package/dist/{chunk-KOLL57ZM.js.map → chunk-YEFL2MHP.js.map} +3 -3
  5. package/dist/{cli-AYBTKEFI.js → cli-ZSEFDZK6.js} +3 -3
  6. package/dist/cli.js +2 -2
  7. package/dist/engine/acp/adapter/antigravity/background-wakeup.d.ts.map +1 -1
  8. package/dist/engine/acp/adapter/antigravity/background-wakeup.js +51 -7
  9. package/dist/engine/acp/adapter/antigravity/background-wakeup.js.map +1 -1
  10. package/dist/engine/acp/adapter/codex/agent-connection.d.ts.map +1 -1
  11. package/dist/engine/acp/adapter/codex/agent-connection.js +1 -0
  12. package/dist/engine/acp/adapter/codex/agent-connection.js.map +1 -1
  13. package/dist/engine/acp/adapter/execution-connections.d.ts.map +1 -1
  14. package/dist/engine/acp/adapter/execution-connections.js +1 -0
  15. package/dist/engine/acp/adapter/execution-connections.js.map +1 -1
  16. package/dist/engine/acp/adapter/session-events.d.ts +3 -1
  17. package/dist/engine/acp/adapter/session-events.d.ts.map +1 -1
  18. package/dist/engine/acp/adapter/session-events.js +1 -0
  19. package/dist/engine/acp/adapter/session-events.js.map +1 -1
  20. package/dist/engine/acp/agent/in-process-endpoint.d.ts +5 -0
  21. package/dist/engine/acp/agent/in-process-endpoint.d.ts.map +1 -1
  22. package/dist/engine/acp/connection/agent-connection.d.ts +2 -1
  23. package/dist/engine/acp/connection/agent-connection.d.ts.map +1 -1
  24. package/dist/engine/acp/harness/codex/agent.d.ts.map +1 -1
  25. package/dist/engine/acp/harness/codex/agent.js +10 -7
  26. package/dist/engine/acp/harness/codex/agent.js.map +1 -1
  27. package/dist/engine/acp/harness/codex/app-server-protocol.d.ts +8 -0
  28. package/dist/engine/acp/harness/codex/app-server-protocol.d.ts.map +1 -1
  29. package/dist/engine/acp/harness/codex/app-server-protocol.js +5 -2
  30. package/dist/engine/acp/harness/codex/app-server-protocol.js.map +1 -1
  31. package/dist/engine/acp/harness/codex/owned-agent.d.ts +2 -1
  32. package/dist/engine/acp/harness/codex/owned-agent.d.ts.map +1 -1
  33. package/dist/engine/acp/harness/codex/owned-agent.js +100 -31
  34. package/dist/engine/acp/harness/codex/owned-agent.js.map +1 -1
  35. package/dist/engine/acp/harness/codex/session-update.d.ts +2 -1
  36. package/dist/engine/acp/harness/codex/session-update.d.ts.map +1 -1
  37. package/dist/engine/acp/harness/codex/session-update.js.map +1 -1
  38. package/dist/engine/session/live/agent-session.d.ts.map +1 -1
  39. package/dist/engine/session/live/agent-session.js +29 -10
  40. package/dist/engine/session/live/agent-session.js.map +1 -1
  41. package/dist/engine.js +2 -2
  42. package/package.json +1 -1
  43. /package/dist/{cli-AYBTKEFI.js.map → cli-ZSEFDZK6.js.map} +0 -0
@@ -80,7 +80,7 @@ var __callDispose = (stack, error, hasError) => {
80
80
  // package.json
81
81
  var package_default = {
82
82
  name: "@moxt-ai/mobius",
83
- version: "0.0.467",
83
+ version: "0.0.469",
84
84
  description: "Mobius CLI for pairing and running local AI agent services.",
85
85
  type: "module",
86
86
  bin: {
@@ -171,4 +171,4 @@ export {
171
171
  __callDispose,
172
172
  package_default
173
173
  };
174
- //# sourceMappingURL=chunk-X64YZNBY.js.map
174
+ //# sourceMappingURL=chunk-N3SPAVPT.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../package.json"],
4
- "sourcesContent": ["{\n \"name\": \"@moxt-ai/mobius\",\n \"version\": \"0.0.467\",\n \"description\": \"Mobius CLI for pairing and running local AI agent services.\",\n \"type\": \"module\",\n \"bin\": {\n \"mobius\": \"dist/cli.js\"\n },\n \"exports\": {\n \"./engine\": {\n \"mobius-source\": \"./src/exports/engine.ts\",\n \"types\": \"./dist/exports/engine.d.ts\",\n \"default\": \"./dist/engine.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"NOTICE\",\n \"THIRD-PARTY-NOTICES.txt\"\n ],\n \"engines\": {\n \"node\": \">=22.19.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"exports\": {\n \"./engine\": {\n \"types\": \"./dist/exports/engine.d.ts\",\n \"import\": \"./dist/engine.js\",\n \"default\": \"./dist/engine.js\"\n }\n }\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/moxt-ai/mobius.git\",\n \"directory\": \"packages/cli\"\n },\n \"scripts\": {\n \"prebuild\": \"tsc --project src/engine/acp/harness/claude/upstream/tsconfig.json && tsc --project src/engine/acp/harness/pi/upstream/tsconfig.json\",\n \"build\": \"node scripts/build.ts && tsc --project tsconfig.build.json\",\n \"dev\": \"node --watch src/cli/entrypoint.ts\",\n \"pretypecheck\": \"tsc --project src/engine/acp/harness/claude/upstream/tsconfig.json && tsc --project src/engine/acp/harness/pi/upstream/tsconfig.json\",\n \"prepack\": \"pnpm build\",\n \"start\": \"node dist/cli.js\",\n \"typecheck\": \"tsc --project tsconfig.json && tsc --project tests/tsconfig.json\",\n \"pretest:controlled\": \"pnpm build\",\n \"test:controlled\": \"vitest run tests/sessions tests/runtime\",\n \"pretest:manual\": \"pnpm pretest:controlled\",\n \"test:manual\": \"vitest run tests/manual\",\n \"pretest:agents\": \"pnpm build\",\n \"test:agents\": \"vitest run tests/agents --maxWorkers=2\"\n },\n \"dependencies\": {\n \"undici\": \"8.12.2\"\n },\n \"devDependencies\": {\n \"@moxt-ai/mobius-sdk-before-prompt-suggestions\": \"npm:@moxt-ai/mobius-sdk@0.0.181\",\n \"@agentclientprotocol/sdk\": \"^1.4.0\",\n \"@anthropic-ai/claude-agent-sdk\": \"0.3.257\",\n \"@anthropic-ai/sdk\": \"0.122.0\",\n \"@moxt-ai/mobius-sdk\": \"workspace:*\",\n \"@moxt-ai/mobius-test\": \"workspace:*\",\n \"@types/node\": \"^24.13.5\",\n \"@types/semver\": \"^7.8.0\",\n \"@types/ws\": \"^8.18.1\",\n \"commander\": \"15.0.0\",\n \"drizzle-kit\": \"1.0.0-rc.4\",\n \"drizzle-orm\": \"1.0.0-rc.4\",\n \"esbuild\": \"0.28.2\",\n \"ignore\": \"7.0.9\",\n \"semver\": \"^7.8.5\",\n \"valibot\": \"1.5.0\",\n \"ws\": \"^8.21.3\",\n \"zod\": \"^4.6.7\"\n },\n \"keywords\": [],\n \"author\": \"Moxt\",\n \"license\": \"Apache-2.0\",\n \"bugs\": {\n \"url\": \"https://github.com/moxt-ai/mobius/issues\"\n },\n \"homepage\": \"https://github.com/moxt-ai/mobius#readme\"\n}\n"],
4
+ "sourcesContent": ["{\n \"name\": \"@moxt-ai/mobius\",\n \"version\": \"0.0.469\",\n \"description\": \"Mobius CLI for pairing and running local AI agent services.\",\n \"type\": \"module\",\n \"bin\": {\n \"mobius\": \"dist/cli.js\"\n },\n \"exports\": {\n \"./engine\": {\n \"mobius-source\": \"./src/exports/engine.ts\",\n \"types\": \"./dist/exports/engine.d.ts\",\n \"default\": \"./dist/engine.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"NOTICE\",\n \"THIRD-PARTY-NOTICES.txt\"\n ],\n \"engines\": {\n \"node\": \">=22.19.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"exports\": {\n \"./engine\": {\n \"types\": \"./dist/exports/engine.d.ts\",\n \"import\": \"./dist/engine.js\",\n \"default\": \"./dist/engine.js\"\n }\n }\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/moxt-ai/mobius.git\",\n \"directory\": \"packages/cli\"\n },\n \"scripts\": {\n \"prebuild\": \"tsc --project src/engine/acp/harness/claude/upstream/tsconfig.json && tsc --project src/engine/acp/harness/pi/upstream/tsconfig.json\",\n \"build\": \"node scripts/build.ts && tsc --project tsconfig.build.json\",\n \"dev\": \"node --watch src/cli/entrypoint.ts\",\n \"pretypecheck\": \"tsc --project src/engine/acp/harness/claude/upstream/tsconfig.json && tsc --project src/engine/acp/harness/pi/upstream/tsconfig.json\",\n \"prepack\": \"pnpm build\",\n \"start\": \"node dist/cli.js\",\n \"typecheck\": \"tsc --project tsconfig.json && tsc --project tests/tsconfig.json\",\n \"pretest:controlled\": \"pnpm build\",\n \"test:controlled\": \"vitest run tests/sessions tests/runtime\",\n \"pretest:manual\": \"pnpm pretest:controlled\",\n \"test:manual\": \"vitest run tests/manual\",\n \"pretest:agents\": \"pnpm build\",\n \"test:agents\": \"vitest run tests/agents --maxWorkers=2\"\n },\n \"dependencies\": {\n \"undici\": \"8.12.2\"\n },\n \"devDependencies\": {\n \"@moxt-ai/mobius-sdk-before-prompt-suggestions\": \"npm:@moxt-ai/mobius-sdk@0.0.181\",\n \"@agentclientprotocol/sdk\": \"^1.4.0\",\n \"@anthropic-ai/claude-agent-sdk\": \"0.3.257\",\n \"@anthropic-ai/sdk\": \"0.122.0\",\n \"@moxt-ai/mobius-sdk\": \"workspace:*\",\n \"@moxt-ai/mobius-test\": \"workspace:*\",\n \"@types/node\": \"^24.13.5\",\n \"@types/semver\": \"^7.8.0\",\n \"@types/ws\": \"^8.18.1\",\n \"commander\": \"15.0.0\",\n \"drizzle-kit\": \"1.0.0-rc.4\",\n \"drizzle-orm\": \"1.0.0-rc.4\",\n \"esbuild\": \"0.28.2\",\n \"ignore\": \"7.0.9\",\n \"semver\": \"^7.8.5\",\n \"valibot\": \"1.5.0\",\n \"ws\": \"^8.21.3\",\n \"zod\": \"^4.6.7\"\n },\n \"keywords\": [],\n \"author\": \"Moxt\",\n \"license\": \"Apache-2.0\",\n \"bugs\": {\n \"url\": \"https://github.com/moxt-ai/mobius/issues\"\n },\n \"homepage\": \"https://github.com/moxt-ai/mobius#readme\"\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACI,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,KAAO;AAAA,IACH,QAAU;AAAA,EACd;AAAA,EACA,SAAW;AAAA,IACP,YAAY;AAAA,MACR,iBAAiB;AAAA,MACjB,OAAS;AAAA,MACT,SAAW;AAAA,IACf;AAAA,EACJ;AAAA,EACA,OAAS;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAAA,EACA,SAAW;AAAA,IACP,MAAQ;AAAA,EACZ;AAAA,EACA,eAAiB;AAAA,IACb,QAAU;AAAA,IACV,SAAW;AAAA,MACP,YAAY;AAAA,QACR,OAAS;AAAA,QACT,QAAU;AAAA,QACV,SAAW;AAAA,MACf;AAAA,IACJ;AAAA,EACJ;AAAA,EACA,YAAc;AAAA,IACV,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACjB;AAAA,EACA,SAAW;AAAA,IACP,UAAY;AAAA,IACZ,OAAS;AAAA,IACT,KAAO;AAAA,IACP,cAAgB;AAAA,IAChB,SAAW;AAAA,IACX,OAAS;AAAA,IACT,WAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,eAAe;AAAA,IACf,kBAAkB;AAAA,IAClB,eAAe;AAAA,EACnB;AAAA,EACA,cAAgB;AAAA,IACZ,QAAU;AAAA,EACd;AAAA,EACA,iBAAmB;AAAA,IACf,iDAAiD;AAAA,IACjD,4BAA4B;AAAA,IAC5B,kCAAkC;AAAA,IAClC,qBAAqB;AAAA,IACrB,uBAAuB;AAAA,IACvB,wBAAwB;AAAA,IACxB,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,WAAa;AAAA,IACb,eAAe;AAAA,IACf,eAAe;AAAA,IACf,SAAW;AAAA,IACX,QAAU;AAAA,IACV,QAAU;AAAA,IACV,SAAW;AAAA,IACX,IAAM;AAAA,IACN,KAAO;AAAA,EACX;AAAA,EACA,UAAY,CAAC;AAAA,EACb,QAAU;AAAA,EACV,SAAW;AAAA,EACX,MAAQ;AAAA,IACJ,KAAO;AAAA,EACX;AAAA,EACA,UAAY;AAChB;",
6
6
  "names": []
7
7
  }
@@ -5,7 +5,7 @@ import {
5
5
  __toESM,
6
6
  __using,
7
7
  package_default
8
- } from "./chunk-X64YZNBY.js";
8
+ } from "./chunk-N3SPAVPT.js";
9
9
 
10
10
  // ../../node_modules/.pnpm/ignore@7.0.9/node_modules/ignore/index.js
11
11
  var require_ignore = __commonJS({
@@ -29111,6 +29111,7 @@ var systemTimer = new SystemTimer();
29111
29111
 
29112
29112
  // src/engine/acp/adapter/antigravity/background-wakeup.ts
29113
29113
  var TRANSCRIPT_TAIL_BYTES = 65536;
29114
+ var SUBAGENT_RECONCILE_TAIL_BYTES = 1048576;
29114
29115
  var TRANSCRIPT_INITIAL_DELAY_MS = 40;
29115
29116
  var TRANSCRIPT_POLL_INTERVAL_MS = 150;
29116
29117
  var MAX_PARTIAL_SETTLED_TEXT_DEFERRALS = 2;
@@ -29118,6 +29119,7 @@ var WAKEUP_INACTIVITY_TIMEOUT_MS = 3e5;
29118
29119
  var SESSION_UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;
29119
29120
  var SUBAGENT_CONVERSATION_ID_PATTERN = /"conversationId"\s*:\s*"([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"/giu;
29120
29121
  var SUBAGENT_IDLE_ID_PATTERN = /\bSubagent ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}) (?:has gone|went) idle\b/giu;
29122
+ var SUBAGENT_MESSAGE_SENDER_PATTERN = /^\[Message\]\s+timestamp=\S+\s+sender=([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?!\/)\b/gimu;
29121
29123
  var AGENT_EXECUTOR_ERROR_PATTERN = /^\s*⚠ agent executor error:\s*(.+?)\s*$/su;
29122
29124
  var TASK_RESULT_SENDER_PATTERN = /\bsender=([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\/(task-\d+)\b/giu;
29123
29125
  var BACKGROUND_TASK_CREATED_PATTERN = /\bTool is running as a background task with task id:\s*([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\/(task-\d+)\b/iu;
@@ -29161,7 +29163,7 @@ function resolveGeminiHome(launchEnvironment) {
29161
29163
  const home = launchEnvironment["HOME"]?.trim() || launchEnvironment["USERPROFILE"]?.trim() || homedir();
29162
29164
  return home.length > 0 ? join11(home, ".gemini") : void 0;
29163
29165
  }
29164
- async function readTranscriptTailState(launchEnvironment, sessionId, baselineStepIndex) {
29166
+ async function readTranscriptTailState(launchEnvironment, sessionId, baselineStepIndex, maximumBytes = TRANSCRIPT_TAIL_BYTES) {
29165
29167
  if (!SESSION_UUID_PATTERN.test(sessionId)) {
29166
29168
  return null;
29167
29169
  }
@@ -29172,7 +29174,7 @@ async function readTranscriptTailState(launchEnvironment, sessionId, baselineSte
29172
29174
  const tail = await readScopedFileTail(
29173
29175
  geminiHome,
29174
29176
  join11("antigravity-cli", "brain", sessionId, ".system_generated", "logs", "transcript.jsonl"),
29175
- TRANSCRIPT_TAIL_BYTES
29177
+ maximumBytes
29176
29178
  );
29177
29179
  if (tail === null) {
29178
29180
  return null;
@@ -29791,17 +29793,24 @@ var AntigravityBackgroundWakeup = class {
29791
29793
  if (step.step_index <= session.sessionOpenStepIndex || maxStepExclusive !== void 0 && step.step_index >= maxStepExclusive || step.type !== "SYSTEM_MESSAGE" || session.subagents.consumedIdleSteps.has(step.step_index) || step.content === void 0) {
29792
29794
  continue;
29793
29795
  }
29794
- const idleIds = extractUuidMatches(step.content, SUBAGENT_IDLE_ID_PATTERN);
29795
- if (idleIds.length === 0) {
29796
+ const resolvedIds = /* @__PURE__ */ new Set([
29797
+ ...extractUuidMatches(step.content, SUBAGENT_IDLE_ID_PATTERN),
29798
+ ...extractUuidMatches(step.content, SUBAGENT_MESSAGE_SENDER_PATTERN)
29799
+ ]);
29800
+ if (resolvedIds.size === 0) {
29796
29801
  continue;
29797
29802
  }
29798
- session.subagents.consumedIdleSteps.add(step.step_index);
29799
- for (const conversationId of idleIds) {
29803
+ let matchedAny = false;
29804
+ for (const conversationId of resolvedIds) {
29800
29805
  const toolCallId = this.#findSubagentToolCallId(session, conversationId);
29801
29806
  if (toolCallId !== void 0) {
29807
+ matchedAny = true;
29802
29808
  onMatchedToolCall(toolCallId);
29803
29809
  }
29804
29810
  }
29811
+ if (matchedAny || session.subagents.pendingToolCallIds.length === 0) {
29812
+ session.subagents.consumedIdleSteps.add(step.step_index);
29813
+ }
29805
29814
  }
29806
29815
  };
29807
29816
  #markTriggeredSubagentIdles = (session, steps) => {
@@ -30090,6 +30099,25 @@ var AntigravityBackgroundWakeup = class {
30090
30099
  this.#rescheduleTranscriptCheck(sessionId, current, generation, stageEpoch, currentStage);
30091
30100
  return;
30092
30101
  }
30102
+ if (this.#hasSubagentTasks(current) && tail.firstStepIndex > current.baselineStepIndex + 1) {
30103
+ const widerTail = await readTranscriptTailState(
30104
+ this.#launchEnvironment,
30105
+ sessionId,
30106
+ current.baselineStepIndex,
30107
+ SUBAGENT_RECONCILE_TAIL_BYTES
30108
+ );
30109
+ if (this.#disposed) {
30110
+ return;
30111
+ }
30112
+ const afterWider = this.#sessions.get(sessionId);
30113
+ if (afterWider !== current || afterWider.phase.kind !== "wakeup" || afterWider.phase.generation !== generation || afterWider.phase.stage.stageEpoch !== stageEpoch || afterWider.phase.stage.kind !== "streaming" && afterWider.phase.stage.kind !== "awaiting-output") {
30114
+ return;
30115
+ }
30116
+ if (widerTail !== null) {
30117
+ this.#syncSubagentCreations(current, widerTail.steps);
30118
+ this.#consumeSubagentIdlesThrough(current, widerTail.steps, tail.settledStep.stepIndex);
30119
+ }
30120
+ }
30093
30121
  this.#consumeSettledReplyText(current, tail.settledStep);
30094
30122
  if (this.#settleWakeupReply(sessionId, current, tail, tail.settledStep.stepIndex)) {
30095
30123
  this.#emitNotifications(this.#finishWakeup(sessionId, current, "end_turn", false));
@@ -30512,7 +30540,7 @@ var AntigravityBackgroundWakeup = class {
30512
30540
  tracked.sessionId,
30513
30541
  session2.baselineStepIndex
30514
30542
  );
30515
- const promptCancelled = this.#disposed || session2.phase.kind === "client-prompt" && session2.phase.cancelled || session2.phase.kind === "idle" && session2.phase.cancelRequested || responseStopReason === "cancelled";
30543
+ let promptCancelled = this.#disposed || session2.phase.kind === "client-prompt" && session2.phase.cancelled || session2.phase.kind === "idle" && session2.phase.cancelRequested || responseStopReason === "cancelled";
30516
30544
  if (tail !== null) {
30517
30545
  session2.baselineStepIndex = Math.max(session2.baselineStepIndex, tail.maxStepIndex);
30518
30546
  this.#syncSubagentCreations(session2, tail.steps);
@@ -30537,6 +30565,19 @@ var AntigravityBackgroundWakeup = class {
30537
30565
  }
30538
30566
  if (lastPlannerStepIndex !== void 0) {
30539
30567
  this.#consumeSubagentIdlesThrough(session2, tail.steps, lastPlannerStepIndex);
30568
+ if (this.#hasSubagentTasks(session2) && tail.firstStepIndex > prePromptStepIndex + 1) {
30569
+ const widerTail = await readTranscriptTailState(
30570
+ this.#launchEnvironment,
30571
+ tracked.sessionId,
30572
+ session2.baselineStepIndex,
30573
+ SUBAGENT_RECONCILE_TAIL_BYTES
30574
+ );
30575
+ promptCancelled = this.#disposed || session2.phase.kind === "client-prompt" && session2.phase.cancelled || session2.phase.kind === "idle" && session2.phase.cancelRequested || responseStopReason === "cancelled";
30576
+ if (!promptCancelled && widerTail !== null && this.#sessions.get(tracked.sessionId) === session2) {
30577
+ this.#syncSubagentCreations(session2, widerTail.steps);
30578
+ this.#consumeSubagentIdlesThrough(session2, widerTail.steps, lastPlannerStepIndex);
30579
+ }
30580
+ }
30540
30581
  }
30541
30582
  }
30542
30583
  }
@@ -77808,12 +77849,16 @@ var threadTurnsSchema = external_exports.array(threadTurnSchema).max(1e5);
77808
77849
  var collaborationModeSchema = external_exports.object({
77809
77850
  mode: external_exports.enum(["default", "plan"])
77810
77851
  });
77852
+ var threadTitleSchema = external_exports.string().transform((value) => value.slice(0, 500));
77853
+ var threadNameResponseSchema = external_exports.object({
77854
+ thread: external_exports.object({ id: boundedText(256), name: threadTitleSchema.nullish() })
77855
+ });
77811
77856
  var threadLifecycleResponseSchema = external_exports.object({
77812
77857
  collaborationMode: collaborationModeSchema.nullish(),
77813
77858
  model: boundedText(256).nullish(),
77814
77859
  reasoningEffort: boundedText(256).nullish(),
77815
77860
  serviceTier: boundedText(256).nullish(),
77816
- thread: external_exports.object({ id: boundedText(256), turns: threadTurnsSchema })
77861
+ thread: threadNameResponseSchema.shape.thread.extend({ turns: threadTurnsSchema })
77817
77862
  });
77818
77863
  var CODEX_HISTORY_TURN_PAGE_LIMIT = 20;
77819
77864
  var threadTurnsPageSchema = external_exports.object({
@@ -77822,7 +77867,6 @@ var threadTurnsPageSchema = external_exports.object({
77822
77867
  });
77823
77868
  var threadResumeResponseSchema = threadLifecycleResponseSchema;
77824
77869
  var threadForkResponseSchema = threadLifecycleResponseSchema;
77825
- var threadTitleSchema = external_exports.string().transform((value) => value.slice(0, 500));
77826
77870
  var threadSummarySchema = external_exports.object({
77827
77871
  cwd: boundedText(2048),
77828
77872
  id: boundedText(256),
@@ -78401,6 +78445,8 @@ var APPROVAL_TIMEOUT_MILLISECONDS = 36e5;
78401
78445
  var COMPACT_TIMEOUT_MILLISECONDS = 36e5;
78402
78446
  var COMPACT_ITEM_WAIT_MILLISECONDS = 6e5;
78403
78447
  var NEXT_PROMPT_INSTRUCTION = "Predict the next message the user will send in this conversation. Reply with only that message, written in the user's own voice as they would type it, in one short sentence. Do not use tools. If there is no clear next step, reply with nothing.";
78448
+ var TITLE_INSTRUCTION = "Generate a concise title for this conversation based on what the user wants to accomplish. Ignore setup instructions and tool output. Use the user's language and at most 10 words. Return only the title on one line, without quotes or markdown. Do not use tools.";
78449
+ var TITLE_CHARACTER_LIMIT2 = 80;
78404
78450
  var HOOK_EVENTS_A_SAMPLE_SKIPS = /* @__PURE__ */ new Set([
78405
78451
  "permissionRequest",
78406
78452
  "postToolUse",
@@ -78555,6 +78601,7 @@ var CodexOwnedAcpAgent = class {
78555
78601
  #turnSettledCompaction = false;
78556
78602
  /** The next-prompt sample running for the latest completed turn; a later turn or closing cancels it. */
78557
78603
  #sampling = null;
78604
+ #title = { kind: "untitled" };
78558
78605
  constructor(context) {
78559
78606
  this.#context = context;
78560
78607
  this.#appServer = context.client;
@@ -78563,6 +78610,7 @@ var CodexOwnedAcpAgent = class {
78563
78610
  nativeTurnId = () => this.#nativeTurnId;
78564
78611
  onTerminated = (termination) => {
78565
78612
  this.#cancelSampling();
78613
+ this.#settleTitle();
78566
78614
  if (this.#turn !== null) {
78567
78615
  this.#turn.steeringContent.clear();
78568
78616
  }
@@ -78571,6 +78619,7 @@ var CodexOwnedAcpAgent = class {
78571
78619
  };
78572
78620
  close = async () => {
78573
78621
  this.#cancelSampling();
78622
+ this.#settleTitle();
78574
78623
  if (this.#turn !== null) {
78575
78624
  this.#turn.steeringContent.clear();
78576
78625
  }
@@ -78629,6 +78678,7 @@ var CodexOwnedAcpAgent = class {
78629
78678
  "session_busy"
78630
78679
  );
78631
78680
  }
78681
+ this.#cancelTitleSample();
78632
78682
  const completion = Promise.withResolvers();
78633
78683
  void completion.promise.catch(() => {
78634
78684
  });
@@ -78739,7 +78789,8 @@ var CodexOwnedAcpAgent = class {
78739
78789
  }
78740
78790
  if (method === "thread/name/updated") {
78741
78791
  const threadName = params.threadName;
78742
- if (typeof threadName === "string" && threadName.length > 0) {
78792
+ if (typeof threadName === "string" && threadName.trim().length > 0) {
78793
+ this.#settleTitle();
78743
78794
  await this.#enqueue(async () => {
78744
78795
  await this.#context.emit({ sessionUpdate: "session_info_update", title: threadName });
78745
78796
  });
@@ -79039,6 +79090,7 @@ var CodexOwnedAcpAgent = class {
79039
79090
  throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
79040
79091
  }
79041
79092
  this.#cancelSampling();
79093
+ this.#cancelTitleSample();
79042
79094
  const completion = Promise.withResolvers();
79043
79095
  void completion.promise.catch(() => {
79044
79096
  });
@@ -79080,8 +79132,11 @@ var CodexOwnedAcpAgent = class {
79080
79132
  }
79081
79133
  try {
79082
79134
  const result = await completion.promise;
79083
- if (promptSuggestionTurnId !== void 0 && result.stopReason === "end_turn") {
79084
- this.#sampleNextPrompt(promptSuggestionTurnId, turn.turn.id);
79135
+ if (result.stopReason === "end_turn") {
79136
+ this.#maybeGenerateTitle(turn.turn.id);
79137
+ if (promptSuggestionTurnId !== void 0) {
79138
+ this.#sampleNextPrompt(promptSuggestionTurnId, turn.turn.id);
79139
+ }
79085
79140
  }
79086
79141
  return turn.input.kind === "identified" ? await promptResultWithMessageId2(Promise.resolve(result), turn.input.messageId) : result;
79087
79142
  } catch (cause) {
@@ -79180,51 +79235,107 @@ var CodexOwnedAcpAgent = class {
79180
79235
  const sampling = new AbortController();
79181
79236
  this.#sampling = sampling;
79182
79237
  const signal = AbortSignal.any([sampling.signal, AbortSignal.timeout(SAMPLE_TIMEOUT_MILLISECONDS)]);
79183
- const sample = async () => {
79184
- if (sourceTurnId.length === 0) {
79185
- return { kind: "failed" };
79186
- }
79187
- try {
79188
- const configured = hooksListResponseSchema.parse(
79189
- await this.#appServer.request("hooks/list", { cwds: [this.#context.cwd()] }, signal)
79190
- );
79191
- if (configured.data.some(
79192
- (entry) => entry.hooks.some((hook) => hook.enabled && !HOOK_EVENTS_A_SAMPLE_SKIPS.has(hook.eventName))
79193
- )) {
79194
- return { kind: "unsupported" };
79195
- }
79196
- const response = threadSampleResponseSchema.parse(
79197
- await this.#appServer.request(
79198
- "thread/sample",
79199
- {
79200
- effort: "low",
79201
- expectedTurnId: sourceTurnId,
79202
- prompt: NEXT_PROMPT_INSTRUCTION,
79203
- threadId: this.#context.threadId()
79204
- },
79205
- signal,
79206
- (requestId) => {
79207
- void this.#appServer.request(
79208
- "thread/sample/cancel",
79209
- { requestId },
79210
- AbortSignal.timeout(SAMPLE_CANCEL_TIMEOUT_MILLISECONDS)
79211
- ).catch(() => void 0);
79212
- }
79213
- )
79214
- );
79215
- const text2 = response.text?.trim() ?? "";
79216
- return text2.length === 0 ? { kind: "none" } : { kind: "suggested", text: text2 };
79217
- } catch {
79218
- return { kind: "failed" };
79219
- }
79220
- };
79221
- void sample().then((outcome) => {
79238
+ void this.#sampleText(NEXT_PROMPT_INSTRUCTION, sourceTurnId, signal).then((outcome) => {
79222
79239
  if (this.#sampling === sampling) {
79223
79240
  this.#sampling = null;
79224
79241
  this.#context.onPromptSuggestion?.({ outcome, turnId });
79225
79242
  }
79226
79243
  });
79227
79244
  };
79245
+ #sampleText = async (instruction, sourceTurnId, signal) => {
79246
+ if (sourceTurnId.length === 0) {
79247
+ return { kind: "failed" };
79248
+ }
79249
+ try {
79250
+ const configured = hooksListResponseSchema.parse(
79251
+ await this.#appServer.request("hooks/list", { cwds: [this.#context.cwd()] }, signal)
79252
+ );
79253
+ if (configured.data.some(
79254
+ (entry) => entry.hooks.some((hook) => hook.enabled && !HOOK_EVENTS_A_SAMPLE_SKIPS.has(hook.eventName))
79255
+ )) {
79256
+ return { kind: "unsupported" };
79257
+ }
79258
+ const response = threadSampleResponseSchema.parse(
79259
+ await this.#appServer.request(
79260
+ "thread/sample",
79261
+ {
79262
+ effort: "low",
79263
+ expectedTurnId: sourceTurnId,
79264
+ prompt: instruction,
79265
+ threadId: this.#context.threadId()
79266
+ },
79267
+ signal,
79268
+ (requestId) => {
79269
+ void this.#appServer.request(
79270
+ "thread/sample/cancel",
79271
+ { requestId },
79272
+ AbortSignal.timeout(SAMPLE_CANCEL_TIMEOUT_MILLISECONDS)
79273
+ ).catch(() => void 0);
79274
+ }
79275
+ )
79276
+ );
79277
+ const text2 = response.text?.trim() ?? "";
79278
+ return text2.length === 0 ? { kind: "none" } : { kind: "suggested", text: text2 };
79279
+ } catch {
79280
+ return { kind: "failed" };
79281
+ }
79282
+ };
79283
+ #cancelTitleSample = () => {
79284
+ if (this.#title.kind === "pending") {
79285
+ this.#title.request.abort();
79286
+ this.#title = { kind: "untitled" };
79287
+ }
79288
+ };
79289
+ #settleTitle = () => {
79290
+ this.#cancelTitleSample();
79291
+ this.#title = { kind: "settled" };
79292
+ };
79293
+ #maybeGenerateTitle = (sourceTurnId) => {
79294
+ const target = this.#context.automaticTitle?.();
79295
+ if (target === void 0 || target.signal.aborted || this.#title.kind !== "untitled") {
79296
+ return;
79297
+ }
79298
+ const request = new AbortController();
79299
+ this.#title = { kind: "pending", request };
79300
+ const signal = AbortSignal.any([
79301
+ target.signal,
79302
+ request.signal,
79303
+ AbortSignal.timeout(SAMPLE_TIMEOUT_MILLISECONDS)
79304
+ ]);
79305
+ const threadId = this.#context.threadId();
79306
+ const generate = async () => {
79307
+ const outcome = await this.#sampleText(TITLE_INSTRUCTION, sourceTurnId, signal);
79308
+ if (outcome.kind === "unsupported" && !signal.aborted) {
79309
+ this.#settleTitle();
79310
+ }
79311
+ if (outcome.kind !== "suggested") {
79312
+ return;
79313
+ }
79314
+ const name2 = Array.from(outcome.text.replace(/\s+/gu, " ")).slice(0, TITLE_CHARACTER_LIMIT2).join("").trim();
79315
+ const saved = threadNameResponseSchema.parse(
79316
+ await this.#appServer.request("thread/read", { threadId, includeTurns: false }, signal)
79317
+ );
79318
+ signal.throwIfAborted();
79319
+ if (saved.thread.id !== threadId) {
79320
+ throw new AcpExecutionError("Codex returned a different thread", {}, "invalid_agent_session");
79321
+ }
79322
+ if (!saved.thread.name?.trim()) {
79323
+ await target.publish(name2);
79324
+ }
79325
+ if (this.#title.kind === "pending" && this.#title.request === request) {
79326
+ this.#settleTitle();
79327
+ }
79328
+ };
79329
+ void generate().catch(() => {
79330
+ if (!signal.aborted) {
79331
+ console.warn("Codex could not publish the automatic session title");
79332
+ }
79333
+ }).finally(() => {
79334
+ if (this.#title.kind === "pending" && this.#title.request === request) {
79335
+ this.#title = { kind: "untitled" };
79336
+ }
79337
+ });
79338
+ };
79228
79339
  #completeTurn = async (turn) => {
79229
79340
  const active = this.#turn;
79230
79341
  if (active === null || active.turn.id !== turn.id) {
@@ -80716,8 +80827,9 @@ var CodexAcpAgent = class {
80716
80827
  #onPromptDelegation;
80717
80828
  #onPromptSuggestion;
80718
80829
  #onUsageQuota;
80719
- /** Whether this app-server serves `thread/sample`, which predicts the member's next prompt. */
80720
- #promptSampling = false;
80830
+ /** Whether this app-server serves `thread/sample` for background title and prompt generation. */
80831
+ #threadSampling = false;
80832
+ #nativeTitlePresent = false;
80721
80833
  #nativeSessionId = "";
80722
80834
  #threadCwd = "";
80723
80835
  #sessionAgent;
@@ -80753,6 +80865,7 @@ var CodexAcpAgent = class {
80753
80865
  settings: this.#settings,
80754
80866
  threadId: () => this.#nativeSessionId,
80755
80867
  cwd: () => this.#threadCwd,
80868
+ automaticTitle: () => this.#threadSampling && !this.#nativeTitlePresent ? options.automaticTitle : void 0,
80756
80869
  connection: () => this.#connection,
80757
80870
  emit: this.#emit,
80758
80871
  onBackgroundActivity: (activity) => {
@@ -80779,7 +80892,7 @@ var CodexAcpAgent = class {
80779
80892
  this.#app = agent({ name: "mobius-codex" }).onConnect((connection) => {
80780
80893
  this.#connection = connection;
80781
80894
  }).onRequest(methods.agent.initialize, async () => ({
80782
- _meta: { promptSuggestions: { supported: this.#promptSampling }, steering: { supported: true } },
80895
+ _meta: { promptSuggestions: { supported: this.#threadSampling }, steering: { supported: true } },
80783
80896
  agentCapabilities: {
80784
80897
  loadSession: true,
80785
80898
  promptCapabilities: { embeddedContext: true, image: true },
@@ -80846,7 +80959,7 @@ var CodexAcpAgent = class {
80846
80959
  };
80847
80960
  }).onRequest(methods.agent.session.prompt, async (context) => {
80848
80961
  const promptSuggestionTurnId = promptSuggestionTurn2(context.params._meta);
80849
- const samples = this.#promptSampling && this.#sessionAgent.runsTurns && !isCompactCommand(context.params.prompt);
80962
+ const samples = this.#threadSampling && this.#sessionAgent.runsTurns && !isCompactCommand(context.params.prompt);
80850
80963
  if (promptSuggestionTurnId !== void 0 && !samples) {
80851
80964
  this.#onPromptSuggestion?.({ outcome: { kind: "unsupported" }, turnId: promptSuggestionTurnId });
80852
80965
  }
@@ -80903,13 +81016,13 @@ var CodexAcpAgent = class {
80903
81016
  initialize = async (signal) => {
80904
81017
  await this.#appServer.initialize(signal);
80905
81018
  await this.#settings.loadModels(signal);
80906
- this.#promptSampling = await this.#probePromptSampling(signal);
81019
+ this.#threadSampling = await this.#probeThreadSampling(signal);
80907
81020
  };
80908
81021
  /**
80909
81022
  * Asks the app-server itself whether it serves `thread/sample`: cancelling a sample that does not exist succeeds
80910
81023
  * there and fails as an unknown method on a release without sampling.
80911
81024
  */
80912
- #probePromptSampling = async (signal) => {
81025
+ #probeThreadSampling = async (signal) => {
80913
81026
  try {
80914
81027
  await this.#appServer.request(
80915
81028
  "thread/sample/cancel",
@@ -80992,13 +81105,14 @@ var CodexAcpAgent = class {
80992
81105
  return;
80993
81106
  }
80994
81107
  this.#nativeSessionId = resumed.thread.id;
81108
+ this.#nativeTitlePresent = Boolean(resumed.thread.name?.trim());
80995
81109
  this.#threadCwd = cwd;
80996
81110
  this.#settings.selectRestoredThread(resumed);
80997
81111
  await this.#settings.probeCollaborationMode(this.#nativeSessionId, signal);
80998
81112
  };
80999
81113
  /** What the session response tells Mobius about the session behavior selected while opening it. */
81000
81114
  #sessionMeta = () => ({
81001
- promptSuggestions: { supported: this.#promptSampling && this.#sessionAgent.runsTurns },
81115
+ promptSuggestions: { supported: this.#threadSampling && this.#sessionAgent.runsTurns },
81002
81116
  steering: { supported: this.#sessionAgent.steeringSupported },
81003
81117
  codex: { runsTurns: this.#sessionAgent.runsTurns }
81004
81118
  });
@@ -81045,6 +81159,7 @@ var CodexAgentConnection = class extends EndpointAgentConnection {
81045
81159
  command: options.command,
81046
81160
  cwd: options.cwd,
81047
81161
  environment: options.environment,
81162
+ ...options.automaticTitle === void 0 ? {} : { automaticTitle: options.automaticTitle },
81048
81163
  ...options.sessionEnvironment && { sessionEnvironment: options.sessionEnvironment },
81049
81164
  onSessionUpdate: options.client.onUpdate,
81050
81165
  onBackgroundActivity: (activity) => options.onBackgroundActivity?.(activity),
@@ -87160,6 +87275,7 @@ var AdapterSessionConnection = class {
87160
87275
  this.#connection = options.agent.createConnection({
87161
87276
  cwd: options.cwd,
87162
87277
  client: client2,
87278
+ ...options.automaticTitle === void 0 ? {} : { automaticTitle: options.automaticTitle },
87163
87279
  onBackgroundActivity: (activity) => {
87164
87280
  if (this.#lifetime.signal.aborted) {
87165
87281
  return;
@@ -87366,6 +87482,7 @@ var AcpExecutionConnections = class {
87366
87482
  const connection = new AdapterSessionConnection(
87367
87483
  {
87368
87484
  agent: params.scope.agent,
87485
+ ...params.automaticTitle === void 0 ? {} : { automaticTitle: params.automaticTitle },
87369
87486
  cwd: params.scope.cwd,
87370
87487
  ...params.scope.externalizeUpdate === void 0 ? {} : { externalizeUpdate: params.scope.externalizeUpdate },
87371
87488
  onEvent: (event) => params.onSessionEvent(connection.events.sessionId(), event),
@@ -96976,6 +97093,7 @@ var AgentSession = class _AgentSession {
96976
97093
  #restored = false;
96977
97094
  #sessionTitle = null;
96978
97095
  #generateTitle;
97096
+ #automaticTitle = new AbortController();
96979
97097
  #sessionUpdatedAt = "";
96980
97098
  constructor(agent2, cwd, additionalDirectories, mobiusSessionId, getObserver, agentCommand, store, metrics, adapter, externalize, promptSuggestions, timer, titlePolicy) {
96981
97099
  this.#agentCommand = () => agentCommand(this.#mobiusSessionId);
@@ -97008,6 +97126,7 @@ var AgentSession = class _AgentSession {
97008
97126
  ...externalize === void 0 ? {} : { externalizeUpdate: (update, signal) => externalize(this.#mobiusSessionId, update, signal) }
97009
97127
  };
97010
97128
  this.#subscriber = {
97129
+ ...this.#generateTitle ? { automaticTitle: { signal: this.#automaticTitle.signal, publish: this.#publishAutomaticTitle } } : {},
97011
97130
  onSessionEvent: async (nativeSessionId, event) => {
97012
97131
  if (this.#nativeSessionId.length === 0) {
97013
97132
  this.selectNativeSession(nativeSessionId);
@@ -97653,7 +97772,29 @@ var AgentSession = class _AgentSession {
97653
97772
  this.#nativeIdentity = { kind: "bound", nativeSessionId: sessionId };
97654
97773
  this.#nativeHistoryOwnership = { kind: "agent-owned" };
97655
97774
  };
97775
+ #publishAutomaticTitle = async (title) => {
97776
+ if (this.#automaticTitle.signal.aborted) {
97777
+ return;
97778
+ }
97779
+ await this.#processEvent({
97780
+ kind: "info",
97781
+ changes: [{ kind: "title", value: title }],
97782
+ payload: { sessionUpdate: "session_info_update", title }
97783
+ });
97784
+ };
97656
97785
  #processEvent = async (event) => {
97786
+ if (event.kind === "info") {
97787
+ for (const change of event.changes) {
97788
+ switch (change.kind) {
97789
+ case "title":
97790
+ this.setSessionTitle(change.value);
97791
+ break;
97792
+ case "updated-at":
97793
+ this.#sessionUpdatedAt = change.value;
97794
+ break;
97795
+ }
97796
+ }
97797
+ }
97657
97798
  if (event.kind === "configuration" || event.kind === "mode") {
97658
97799
  this.#configOptions = event.kind === "configuration" ? event.configOptions : this.#configOptions.map(
97659
97800
  (option) => option.category === "mode" ? { ...option, currentValue: event.modeId } : option
@@ -97684,16 +97825,6 @@ var AgentSession = class _AgentSession {
97684
97825
  await this.emitConfigUpdate();
97685
97826
  return;
97686
97827
  case "info":
97687
- for (const change of event.changes) {
97688
- switch (change.kind) {
97689
- case "title":
97690
- this.#sessionTitle = change.value;
97691
- break;
97692
- case "updated-at":
97693
- this.#sessionUpdatedAt = change.value;
97694
- break;
97695
- }
97696
- }
97697
97828
  if (this.#nativeSessionId.length > 0) {
97698
97829
  this.writeStoredSession((/* @__PURE__ */ new Date()).toISOString());
97699
97830
  }
@@ -98067,6 +98198,9 @@ var AgentSession = class _AgentSession {
98067
98198
  }
98068
98199
  setSessionTitle(title) {
98069
98200
  this.#sessionTitle = title;
98201
+ if (title.trim().length > 0) {
98202
+ this.#automaticTitle.abort();
98203
+ }
98070
98204
  }
98071
98205
  assertNativeSession = (sessionId) => {
98072
98206
  if (sessionId !== this.#nativeSessionId) {
@@ -106108,4 +106242,4 @@ export {
106108
106242
  * MIT Licensed
106109
106243
  *)
106110
106244
  */
106111
- //# sourceMappingURL=chunk-KOLL57ZM.js.map
106245
+ //# sourceMappingURL=chunk-YEFL2MHP.js.map