chatroom-cli 1.57.1 → 1.57.3

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/index.js CHANGED
@@ -75589,9 +75589,18 @@ function getPlannerToBuilderHandoffTemplate(nativeIntegration = false) {
75589
75589
  **Detail bar:** Specify down to **every file** the builder will create or modify (full repo paths). Include code snippets — types, signatures, stubs, or target implementations — until a competent builder **cannot misinterpret** what to write. Vague layers ("update the backend", "fix the component") are not acceptable.
75590
75590
 
75591
75591
  \`\`\`markdown
75592
+ ## Summary
75593
+ <brief context for this delegation slice — what problem it solves and where it fits in the larger task>
75594
+
75592
75595
  ## Goal
75593
75596
  <one sentence: the outcome this slice delivers>
75594
75597
 
75598
+ ## Key Knowledge for High Quality Bar
75599
+ <details that would move the implementation from good to excellent and delightful — domain context, user expectations, edge cases, naming, UX polish, invariants the builder must preserve>
75600
+
75601
+ ## Force Multipliers
75602
+ <choices that greatly simplify the solution while preserving long-term maintainability — reuse existing abstractions, avoid unnecessary layers, leverage platform conventions>
75603
+
75595
75604
  ## Files to implement (exhaustive, file-level)
75596
75605
  List **every** file in this slice. For each file, state the exact change and paste the code the builder should match (no guessing).
75597
75606
 
@@ -75661,9 +75670,19 @@ function getPlannerToUserReportTemplate() {
75661
75670
  ## Summary
75662
75671
  <what was accomplished, in plain terms — no references to prior messages>
75663
75672
 
75664
- ## Proof files changed
75673
+ ## Template Disclosure Confirmation
75674
+ - [ ] I confirm that I have seen this template at the start of any planning, before working on or delegating any task to the team
75675
+
75676
+ ## Proof of Principle
75677
+ <!-- Demonstrate adherence to:
75678
+ - Organization & Maintainability: a small change in requirements should result in a small change in code in a small number of files and folders.
75679
+ - Static Evaluability and Provability: the system's behavior should be provably correct by looking at the source code, then automated tests, then manual tests, in this order.
75680
+ -->
75681
+ <how this work follows the principles above — localized changes, readable structure, correctness provable from source then tests>
75682
+
75683
+ ## Proof of Completion
75665
75684
  - \`path/to/file.ts\` — <what changed and why>
75666
- <list every file you (or the builder) modified; this is the evidence of work>
75685
+ <evidence the goal was met — list every file you (or the builder) modified>
75667
75686
 
75668
75687
  ## Key Technical Decisions
75669
75688
  - <schema design, modules, interfaces, domain entities — what you chose and why, or "Not Applicable">
@@ -76172,7 +76191,7 @@ var claudeCapabilities;
76172
76191
  var init_claude_config = __esm(() => {
76173
76192
  claudeCapabilities = {
76174
76193
  runtimeKind: "cli",
76175
- supportsSessionResume: false,
76194
+ supportsDaemonMemoryResume: false,
76176
76195
  supportsNativeIntegration: false,
76177
76196
  lifecycle: {
76178
76197
  turnCompleted: false,
@@ -76188,7 +76207,7 @@ var commandcodeCapabilities;
76188
76207
  var init_commandcode_config = __esm(() => {
76189
76208
  commandcodeCapabilities = {
76190
76209
  runtimeKind: "cli",
76191
- supportsSessionResume: false,
76210
+ supportsDaemonMemoryResume: false,
76192
76211
  supportsNativeIntegration: false,
76193
76212
  lifecycle: {
76194
76213
  turnCompleted: true,
@@ -76204,7 +76223,7 @@ var copilotCapabilities;
76204
76223
  var init_copilot_config = __esm(() => {
76205
76224
  copilotCapabilities = {
76206
76225
  runtimeKind: "cli",
76207
- supportsSessionResume: false,
76226
+ supportsDaemonMemoryResume: false,
76208
76227
  supportsNativeIntegration: false,
76209
76228
  lifecycle: {
76210
76229
  turnCompleted: true,
@@ -76220,7 +76239,7 @@ var cursorSdkCapabilities;
76220
76239
  var init_cursor_sdk_config = __esm(() => {
76221
76240
  cursorSdkCapabilities = {
76222
76241
  runtimeKind: "sdk",
76223
- supportsSessionResume: false,
76242
+ supportsDaemonMemoryResume: true,
76224
76243
  supportsNativeIntegration: true,
76225
76244
  lifecycle: {
76226
76245
  turnCompleted: true,
@@ -76236,7 +76255,7 @@ var cursorCapabilities;
76236
76255
  var init_cursor_config = __esm(() => {
76237
76256
  cursorCapabilities = {
76238
76257
  runtimeKind: "cli",
76239
- supportsSessionResume: false,
76258
+ supportsDaemonMemoryResume: false,
76240
76259
  supportsNativeIntegration: false,
76241
76260
  lifecycle: {
76242
76261
  turnCompleted: true,
@@ -76252,7 +76271,7 @@ var opencodeSdkCapabilities;
76252
76271
  var init_opencode_sdk_config = __esm(() => {
76253
76272
  opencodeSdkCapabilities = {
76254
76273
  runtimeKind: "sdk",
76255
- supportsSessionResume: false,
76274
+ supportsDaemonMemoryResume: true,
76256
76275
  supportsNativeIntegration: true,
76257
76276
  lifecycle: {
76258
76277
  turnCompleted: true,
@@ -76268,7 +76287,7 @@ var opencodeCapabilities;
76268
76287
  var init_opencode_config = __esm(() => {
76269
76288
  opencodeCapabilities = {
76270
76289
  runtimeKind: "cli",
76271
- supportsSessionResume: false,
76290
+ supportsDaemonMemoryResume: false,
76272
76291
  supportsNativeIntegration: false,
76273
76292
  lifecycle: {
76274
76293
  turnCompleted: false,
@@ -76284,7 +76303,7 @@ var piSdkCapabilities;
76284
76303
  var init_pi_sdk_config = __esm(() => {
76285
76304
  piSdkCapabilities = {
76286
76305
  runtimeKind: "sdk",
76287
- supportsSessionResume: false,
76306
+ supportsDaemonMemoryResume: false,
76288
76307
  supportsNativeIntegration: true,
76289
76308
  lifecycle: {
76290
76309
  turnCompleted: true,
@@ -76300,7 +76319,7 @@ var piCapabilities;
76300
76319
  var init_pi_config = __esm(() => {
76301
76320
  piCapabilities = {
76302
76321
  runtimeKind: "cli",
76303
- supportsSessionResume: false,
76322
+ supportsDaemonMemoryResume: false,
76304
76323
  supportsNativeIntegration: false,
76305
76324
  lifecycle: {
76306
76325
  turnCompleted: true,
@@ -76353,43 +76372,6 @@ var init_types = __esm(() => {
76353
76372
  });
76354
76373
  // ../../services/backend/prompts/review-guidelines/index.ts
76355
76374
  var init_review_guidelines = () => {};
76356
- // ../../services/backend/prompts/cli/resume-session/message.ts
76357
- function composeResumeMessage(params) {
76358
- const { chatroomId, role, convexUrl, supportsNativeIntegration } = params;
76359
- const cliEnvPrefix = getCliEnvPrefix(convexUrl);
76360
- const contextRead = `${cliEnvPrefix}chatroom context read --chatroom-id="${chatroomId}" --role="${role}"`;
76361
- if (supportsNativeIntegration) {
76362
- return [
76363
- "Your previous turn has ended. Your session stays active.",
76364
- "The next chatroom task will be injected automatically when ready.",
76365
- "",
76366
- "If you need context on what you were doing, run:",
76367
- ` ${contextRead}`
76368
- ].join(`
76369
- `);
76370
- }
76371
- const getNextTask2 = getNextTaskCommand({
76372
- chatroomId,
76373
- role,
76374
- cliEnvPrefix
76375
- });
76376
- return [
76377
- "Your previous turn has ended. A pending chatroom task may already be waiting.",
76378
- "You MUST immediately run this command as a foreground blocking bash tool call (not in background):",
76379
- ` ${getNextTask2}`,
76380
- "",
76381
- "Do not reply with text only — run the command first. The harness delivers tasks only while get-next-task blocks.",
76382
- "",
76383
- "If you need context on what you were doing, run:",
76384
- ` ${contextRead}`
76385
- ].join(`
76386
- `);
76387
- }
76388
- var init_message = __esm(() => {
76389
- init_env();
76390
- init_command();
76391
- });
76392
-
76393
76375
  // ../../services/backend/prompts/generator.ts
76394
76376
  function generateHandoffOutput(params) {
76395
76377
  const { role, nextRole, chatroomId, convexUrl, supportsNativeIntegration } = params;
@@ -76428,7 +76410,6 @@ var init_generator = __esm(() => {
76428
76410
  init_utils3();
76429
76411
  init_types();
76430
76412
  init_review_guidelines();
76431
- init_message();
76432
76413
  });
76433
76414
 
76434
76415
  // src/commands/handoff/index.ts
@@ -84916,16 +84897,6 @@ function createTurnCompletedBackend(deps) {
84916
84897
  machineId: deps.machineId,
84917
84898
  ...args2
84918
84899
  }),
84919
- emitSessionResumed: (args2) => deps.backend.mutation(api.machines.emitSessionResumed, {
84920
- sessionId: deps.sessionId,
84921
- machineId: deps.machineId,
84922
- ...args2
84923
- }),
84924
- emitSessionResumeFailed: (args2) => deps.backend.mutation(api.machines.emitSessionResumeFailed, {
84925
- sessionId: deps.sessionId,
84926
- machineId: deps.machineId,
84927
- ...args2
84928
- }),
84929
84900
  emitAgentStartFailed: (args2) => deps.backend.mutation(api.machines.emitAgentStartFailed, {
84930
84901
  sessionId: deps.sessionId,
84931
84902
  machineId: deps.machineId,
@@ -85551,9 +85522,6 @@ async function tryAbortResumeStorm(deps, input, slot) {
85551
85522
  return false;
85552
85523
  }
85553
85524
  deps.resumeStormTracker.reset(input.chatroomId, input.role);
85554
- if (slot) {
85555
- slot.resumeInFlight = false;
85556
- }
85557
85525
  try {
85558
85526
  await deps.backend.emitResumeStormAborted({
85559
85527
  chatroomId: input.chatroomId,
@@ -85591,9 +85559,6 @@ var RECENT_LOG_LINE_CAP2 = 100;
85591
85559
 
85592
85560
  // src/domain/agent-lifecycle/use-cases/handle-turn-completed.ts
85593
85561
  async function handleTurnCompleted(deps, input, slot) {
85594
- if (slot?.resumeInFlight) {
85595
- return { outcome: "skipped_duplicate" };
85596
- }
85597
85562
  if (await tryAbortResumeStorm(deps, input, slot)) {
85598
85563
  return { outcome: "storm_aborted" };
85599
85564
  }
@@ -85612,35 +85577,6 @@ async function handleTurnCompleted(deps, input, slot) {
85612
85577
  deps.killProcess(input.pid);
85613
85578
  return { outcome: "killed_terminal_provider_error" };
85614
85579
  }
85615
- if (input.supportsSessionResume && input.wantResume) {
85616
- if (slot) {
85617
- slot.resumeInFlight = true;
85618
- }
85619
- try {
85620
- await deps.resumeTurn(input.pid, deps.composeResumePrompt({ chatroomId: input.chatroomId, role: input.role }));
85621
- try {
85622
- await deps.backend.emitSessionResumed({
85623
- chatroomId: input.chatroomId,
85624
- role: input.role,
85625
- ...slot?.harnessSessionId ? { harnessSessionId: slot.harnessSessionId } : {}
85626
- });
85627
- } catch {}
85628
- return { outcome: "resumed" };
85629
- } catch (err) {
85630
- try {
85631
- await deps.backend.emitSessionResumeFailed({
85632
- chatroomId: input.chatroomId,
85633
- role: input.role,
85634
- reason: err.message,
85635
- ...slot?.harnessSessionId ? { harnessSessionId: slot.harnessSessionId } : {}
85636
- });
85637
- } catch {}
85638
- } finally {
85639
- if (slot) {
85640
- slot.resumeInFlight = false;
85641
- }
85642
- }
85643
- }
85644
85580
  deps.killProcess(input.pid);
85645
85581
  return { outcome: "killed" };
85646
85582
  }
@@ -86051,7 +85987,6 @@ class AgentProcessManager {
86051
85987
  model: slot.model,
86052
85988
  workingDir: slot.workingDir,
86053
85989
  startedAt: slot.startedAt,
86054
- resumeInFlight: slot.resumeInFlight,
86055
85990
  recentLogLines: slot.recentLogLines,
86056
85991
  wantResume: slot.wantResume
86057
85992
  });
@@ -86157,9 +86092,7 @@ class AgentProcessManager {
86157
86092
  }
86158
86093
  async runHandleAgentEnd(opts) {
86159
86094
  const slot = this.slots.get(agentKey3(opts.chatroomId, opts.role));
86160
- const service3 = this.deps.agentServices.get(opts.harness);
86161
86095
  const capabilities = getHarnessCapabilities(opts.harness);
86162
- const supportsSessionResume = capabilities.supportsSessionResume && typeof service3?.resumeTurn === "function";
86163
86096
  this.updateSlotsMirror(opts.chatroomId, opts.role, {
86164
86097
  state: slot?.state ?? "idle",
86165
86098
  pid: slot?.pid,
@@ -86168,11 +86101,10 @@ class AgentProcessManager {
86168
86101
  model: slot?.model,
86169
86102
  workingDir: slot?.workingDir,
86170
86103
  startedAt: slot?.startedAt,
86171
- resumeInFlight: slot?.resumeInFlight,
86172
86104
  recentLogLines: slot?.recentLogLines,
86173
86105
  wantResume: slot?.wantResume
86174
86106
  });
86175
- console.log(`[AgentProcessManager] lifecycle.turn.completed: role=${opts.role} pid=${opts.pid} harness=${opts.harness} supportsResume=${supportsSessionResume}`);
86107
+ console.log(`[AgentProcessManager] lifecycle.turn.completed: role=${opts.role} pid=${opts.pid} harness=${opts.harness}`);
86176
86108
  if (capabilities.supportsNativeIntegration) {
86177
86109
  await this.runHandleNativeTurnEnd(opts, slot);
86178
86110
  return;
@@ -86181,18 +86113,6 @@ class AgentProcessManager {
86181
86113
  resumeStormTracker: this.deps.resumeStormTracker,
86182
86114
  backend: createTurnCompletedBackend(this.deps),
86183
86115
  now: () => this.deps.clock.now(),
86184
- composeResumePrompt: ({ chatroomId, role }) => composeResumeMessage({
86185
- chatroomId,
86186
- role,
86187
- convexUrl: this.deps.convexUrl,
86188
- supportsNativeIntegration: capabilities.supportsNativeIntegration
86189
- }),
86190
- resumeTurn: async (pid, prompt) => {
86191
- if (!service3?.resumeTurn) {
86192
- throw new Error("Harness does not support resumeTurn");
86193
- }
86194
- await service3.resumeTurn(pid, prompt);
86195
- },
86196
86116
  killProcess: (pid) => {
86197
86117
  try {
86198
86118
  this.deps.processes.kill(-pid, "SIGTERM");
@@ -86202,27 +86122,17 @@ class AgentProcessManager {
86202
86122
  }, {
86203
86123
  chatroomId: opts.chatroomId,
86204
86124
  role: opts.role,
86205
- pid: opts.pid,
86206
- supportsSessionResume,
86207
- wantResume: slot?.wantResume ?? true
86125
+ pid: opts.pid
86208
86126
  }, slot);
86209
- if (result.outcome === "skipped_duplicate") {
86210
- console.log(`[AgentProcessManager] lifecycle.turn.completed: skipping duplicate resume for ${opts.role} (resume already in flight)`);
86211
- } else if (result.outcome === "storm_aborted") {
86127
+ if (result.outcome === "storm_aborted") {
86212
86128
  console.log(`[AgentProcessManager] ✅ Handled rapid resume storm for ${opts.role}`);
86213
- } else if (result.outcome === "resumed") {
86214
- console.log(`[AgentProcessManager] ✅ Emitted agent.sessionResumed for ${opts.role}`);
86215
86129
  } else if (result.outcome === "killed") {
86216
- console.log(`[AgentProcessManager] lifecycle.turn.completed: killed process for ${opts.role} (resume disabled or failed)`);
86130
+ console.log(`[AgentProcessManager] lifecycle.turn.completed: killed process for ${opts.role}`);
86217
86131
  } else if (result.outcome === "killed_terminal_provider_error") {
86218
86132
  console.log(`[AgentProcessManager] ⛔ Terminal provider error for ${opts.role} — emitted agent.startFailed`);
86219
86133
  }
86220
86134
  }
86221
86135
  async runHandleNativeTurnEnd(opts, slot) {
86222
- if (slot?.resumeInFlight) {
86223
- console.log(`[AgentProcessManager] lifecycle.turn.completed: skipping duplicate native turn-end for ${opts.role}`);
86224
- return;
86225
- }
86226
86136
  if (await tryAbortResumeStorm({
86227
86137
  resumeStormTracker: this.deps.resumeStormTracker,
86228
86138
  backend: createTurnCompletedBackend(this.deps),
@@ -86231,9 +86141,7 @@ class AgentProcessManager {
86231
86141
  }, {
86232
86142
  chatroomId: opts.chatroomId,
86233
86143
  role: opts.role,
86234
- pid: opts.pid,
86235
- supportsSessionResume: false,
86236
- wantResume: false
86144
+ pid: opts.pid
86237
86145
  }, slot)) {
86238
86146
  console.log(`[AgentProcessManager] ✅ Handled rapid resume storm for ${opts.role}`);
86239
86147
  return;
@@ -86633,12 +86541,12 @@ class AgentProcessManager {
86633
86541
  if (!stored) {
86634
86542
  return null;
86635
86543
  }
86636
- const resumeFromDaemonMemory = opts.service.resumeFromDaemonMemory;
86637
- if (!resumeFromDaemonMemory) {
86544
+ if (!opts.service.resumeFromDaemonMemory) {
86638
86545
  return null;
86639
86546
  }
86640
86547
  try {
86641
- const spawnResult = await resumeFromDaemonMemory({
86548
+ await this.emitSessionResumeRequested(opts.chatroomId, opts.role, opts.agentHarness, stored.harnessSessionId);
86549
+ const spawnResult = await opts.service.resumeFromDaemonMemory({
86642
86550
  workingDir: stored.workingDir,
86643
86551
  prompt: createSpawnPrompt(opts.initPrompt),
86644
86552
  systemPrompt: opts.systemPrompt,
@@ -86685,6 +86593,21 @@ class AgentProcessManager {
86685
86593
  }
86686
86594
  return null;
86687
86595
  }
86596
+ async emitSessionResumeRequested(chatroomId, role, agentHarness, harnessSessionId) {
86597
+ try {
86598
+ await this.deps.backend.mutation(api.machines.emitSessionResumeRequested, {
86599
+ sessionId: this.deps.sessionId,
86600
+ machineId: this.deps.machineId,
86601
+ chatroomId,
86602
+ role,
86603
+ agentHarness,
86604
+ ...harnessSessionId ? { harnessSessionId } : {}
86605
+ });
86606
+ console.log(`[AgentProcessManager] ✅ Emitted agent.sessionResumeRequested for ${role}`);
86607
+ } catch (err) {
86608
+ console.log(` ⚠️ Failed to emit sessionResumeRequested event: ${err.message}`);
86609
+ }
86610
+ }
86688
86611
  async emitSessionResumed(chatroomId, role, harnessSessionId) {
86689
86612
  try {
86690
86613
  await this.deps.backend.mutation(api.machines.emitSessionResumed, {
@@ -87091,7 +87014,6 @@ class AgentProcessManager {
87091
87014
  }
87092
87015
  var AGENT_EXIT_RETRY_INTERVAL_MS = 1e4;
87093
87016
  var init_agent_process_manager = __esm(() => {
87094
- init_generator();
87095
87017
  init_types();
87096
87018
  init_participant();
87097
87019
  init_esm();
@@ -89665,4 +89587,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
89665
89587
  });
89666
89588
  program2.parse();
89667
89589
 
89668
- //# debugId=CFDE8D88B080E55664756E2164756E21
89590
+ //# debugId=4A0FE03BEB3CACE864756E2164756E21