chatroom-cli 1.57.2 → 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 +33 -130
- package/dist/index.js.map +23 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -76191,7 +76191,7 @@ var claudeCapabilities;
|
|
|
76191
76191
|
var init_claude_config = __esm(() => {
|
|
76192
76192
|
claudeCapabilities = {
|
|
76193
76193
|
runtimeKind: "cli",
|
|
76194
|
-
|
|
76194
|
+
supportsDaemonMemoryResume: false,
|
|
76195
76195
|
supportsNativeIntegration: false,
|
|
76196
76196
|
lifecycle: {
|
|
76197
76197
|
turnCompleted: false,
|
|
@@ -76207,7 +76207,7 @@ var commandcodeCapabilities;
|
|
|
76207
76207
|
var init_commandcode_config = __esm(() => {
|
|
76208
76208
|
commandcodeCapabilities = {
|
|
76209
76209
|
runtimeKind: "cli",
|
|
76210
|
-
|
|
76210
|
+
supportsDaemonMemoryResume: false,
|
|
76211
76211
|
supportsNativeIntegration: false,
|
|
76212
76212
|
lifecycle: {
|
|
76213
76213
|
turnCompleted: true,
|
|
@@ -76223,7 +76223,7 @@ var copilotCapabilities;
|
|
|
76223
76223
|
var init_copilot_config = __esm(() => {
|
|
76224
76224
|
copilotCapabilities = {
|
|
76225
76225
|
runtimeKind: "cli",
|
|
76226
|
-
|
|
76226
|
+
supportsDaemonMemoryResume: false,
|
|
76227
76227
|
supportsNativeIntegration: false,
|
|
76228
76228
|
lifecycle: {
|
|
76229
76229
|
turnCompleted: true,
|
|
@@ -76239,7 +76239,7 @@ var cursorSdkCapabilities;
|
|
|
76239
76239
|
var init_cursor_sdk_config = __esm(() => {
|
|
76240
76240
|
cursorSdkCapabilities = {
|
|
76241
76241
|
runtimeKind: "sdk",
|
|
76242
|
-
|
|
76242
|
+
supportsDaemonMemoryResume: true,
|
|
76243
76243
|
supportsNativeIntegration: true,
|
|
76244
76244
|
lifecycle: {
|
|
76245
76245
|
turnCompleted: true,
|
|
@@ -76255,7 +76255,7 @@ var cursorCapabilities;
|
|
|
76255
76255
|
var init_cursor_config = __esm(() => {
|
|
76256
76256
|
cursorCapabilities = {
|
|
76257
76257
|
runtimeKind: "cli",
|
|
76258
|
-
|
|
76258
|
+
supportsDaemonMemoryResume: false,
|
|
76259
76259
|
supportsNativeIntegration: false,
|
|
76260
76260
|
lifecycle: {
|
|
76261
76261
|
turnCompleted: true,
|
|
@@ -76271,7 +76271,7 @@ var opencodeSdkCapabilities;
|
|
|
76271
76271
|
var init_opencode_sdk_config = __esm(() => {
|
|
76272
76272
|
opencodeSdkCapabilities = {
|
|
76273
76273
|
runtimeKind: "sdk",
|
|
76274
|
-
|
|
76274
|
+
supportsDaemonMemoryResume: true,
|
|
76275
76275
|
supportsNativeIntegration: true,
|
|
76276
76276
|
lifecycle: {
|
|
76277
76277
|
turnCompleted: true,
|
|
@@ -76287,7 +76287,7 @@ var opencodeCapabilities;
|
|
|
76287
76287
|
var init_opencode_config = __esm(() => {
|
|
76288
76288
|
opencodeCapabilities = {
|
|
76289
76289
|
runtimeKind: "cli",
|
|
76290
|
-
|
|
76290
|
+
supportsDaemonMemoryResume: false,
|
|
76291
76291
|
supportsNativeIntegration: false,
|
|
76292
76292
|
lifecycle: {
|
|
76293
76293
|
turnCompleted: false,
|
|
@@ -76303,7 +76303,7 @@ var piSdkCapabilities;
|
|
|
76303
76303
|
var init_pi_sdk_config = __esm(() => {
|
|
76304
76304
|
piSdkCapabilities = {
|
|
76305
76305
|
runtimeKind: "sdk",
|
|
76306
|
-
|
|
76306
|
+
supportsDaemonMemoryResume: false,
|
|
76307
76307
|
supportsNativeIntegration: true,
|
|
76308
76308
|
lifecycle: {
|
|
76309
76309
|
turnCompleted: true,
|
|
@@ -76319,7 +76319,7 @@ var piCapabilities;
|
|
|
76319
76319
|
var init_pi_config = __esm(() => {
|
|
76320
76320
|
piCapabilities = {
|
|
76321
76321
|
runtimeKind: "cli",
|
|
76322
|
-
|
|
76322
|
+
supportsDaemonMemoryResume: false,
|
|
76323
76323
|
supportsNativeIntegration: false,
|
|
76324
76324
|
lifecycle: {
|
|
76325
76325
|
turnCompleted: true,
|
|
@@ -76372,43 +76372,6 @@ var init_types = __esm(() => {
|
|
|
76372
76372
|
});
|
|
76373
76373
|
// ../../services/backend/prompts/review-guidelines/index.ts
|
|
76374
76374
|
var init_review_guidelines = () => {};
|
|
76375
|
-
// ../../services/backend/prompts/cli/resume-session/message.ts
|
|
76376
|
-
function composeResumeMessage(params) {
|
|
76377
|
-
const { chatroomId, role, convexUrl, supportsNativeIntegration } = params;
|
|
76378
|
-
const cliEnvPrefix = getCliEnvPrefix(convexUrl);
|
|
76379
|
-
const contextRead = `${cliEnvPrefix}chatroom context read --chatroom-id="${chatroomId}" --role="${role}"`;
|
|
76380
|
-
if (supportsNativeIntegration) {
|
|
76381
|
-
return [
|
|
76382
|
-
"Your previous turn has ended. Your session stays active.",
|
|
76383
|
-
"The next chatroom task will be injected automatically when ready.",
|
|
76384
|
-
"",
|
|
76385
|
-
"If you need context on what you were doing, run:",
|
|
76386
|
-
` ${contextRead}`
|
|
76387
|
-
].join(`
|
|
76388
|
-
`);
|
|
76389
|
-
}
|
|
76390
|
-
const getNextTask2 = getNextTaskCommand({
|
|
76391
|
-
chatroomId,
|
|
76392
|
-
role,
|
|
76393
|
-
cliEnvPrefix
|
|
76394
|
-
});
|
|
76395
|
-
return [
|
|
76396
|
-
"Your previous turn has ended. A pending chatroom task may already be waiting.",
|
|
76397
|
-
"You MUST immediately run this command as a foreground blocking bash tool call (not in background):",
|
|
76398
|
-
` ${getNextTask2}`,
|
|
76399
|
-
"",
|
|
76400
|
-
"Do not reply with text only — run the command first. The harness delivers tasks only while get-next-task blocks.",
|
|
76401
|
-
"",
|
|
76402
|
-
"If you need context on what you were doing, run:",
|
|
76403
|
-
` ${contextRead}`
|
|
76404
|
-
].join(`
|
|
76405
|
-
`);
|
|
76406
|
-
}
|
|
76407
|
-
var init_message = __esm(() => {
|
|
76408
|
-
init_env();
|
|
76409
|
-
init_command();
|
|
76410
|
-
});
|
|
76411
|
-
|
|
76412
76375
|
// ../../services/backend/prompts/generator.ts
|
|
76413
76376
|
function generateHandoffOutput(params) {
|
|
76414
76377
|
const { role, nextRole, chatroomId, convexUrl, supportsNativeIntegration } = params;
|
|
@@ -76447,7 +76410,6 @@ var init_generator = __esm(() => {
|
|
|
76447
76410
|
init_utils3();
|
|
76448
76411
|
init_types();
|
|
76449
76412
|
init_review_guidelines();
|
|
76450
|
-
init_message();
|
|
76451
76413
|
});
|
|
76452
76414
|
|
|
76453
76415
|
// src/commands/handoff/index.ts
|
|
@@ -84935,16 +84897,6 @@ function createTurnCompletedBackend(deps) {
|
|
|
84935
84897
|
machineId: deps.machineId,
|
|
84936
84898
|
...args2
|
|
84937
84899
|
}),
|
|
84938
|
-
emitSessionResumed: (args2) => deps.backend.mutation(api.machines.emitSessionResumed, {
|
|
84939
|
-
sessionId: deps.sessionId,
|
|
84940
|
-
machineId: deps.machineId,
|
|
84941
|
-
...args2
|
|
84942
|
-
}),
|
|
84943
|
-
emitSessionResumeFailed: (args2) => deps.backend.mutation(api.machines.emitSessionResumeFailed, {
|
|
84944
|
-
sessionId: deps.sessionId,
|
|
84945
|
-
machineId: deps.machineId,
|
|
84946
|
-
...args2
|
|
84947
|
-
}),
|
|
84948
84900
|
emitAgentStartFailed: (args2) => deps.backend.mutation(api.machines.emitAgentStartFailed, {
|
|
84949
84901
|
sessionId: deps.sessionId,
|
|
84950
84902
|
machineId: deps.machineId,
|
|
@@ -85570,9 +85522,6 @@ async function tryAbortResumeStorm(deps, input, slot) {
|
|
|
85570
85522
|
return false;
|
|
85571
85523
|
}
|
|
85572
85524
|
deps.resumeStormTracker.reset(input.chatroomId, input.role);
|
|
85573
|
-
if (slot) {
|
|
85574
|
-
slot.resumeInFlight = false;
|
|
85575
|
-
}
|
|
85576
85525
|
try {
|
|
85577
85526
|
await deps.backend.emitResumeStormAborted({
|
|
85578
85527
|
chatroomId: input.chatroomId,
|
|
@@ -85610,9 +85559,6 @@ var RECENT_LOG_LINE_CAP2 = 100;
|
|
|
85610
85559
|
|
|
85611
85560
|
// src/domain/agent-lifecycle/use-cases/handle-turn-completed.ts
|
|
85612
85561
|
async function handleTurnCompleted(deps, input, slot) {
|
|
85613
|
-
if (slot?.resumeInFlight) {
|
|
85614
|
-
return { outcome: "skipped_duplicate" };
|
|
85615
|
-
}
|
|
85616
85562
|
if (await tryAbortResumeStorm(deps, input, slot)) {
|
|
85617
85563
|
return { outcome: "storm_aborted" };
|
|
85618
85564
|
}
|
|
@@ -85631,35 +85577,6 @@ async function handleTurnCompleted(deps, input, slot) {
|
|
|
85631
85577
|
deps.killProcess(input.pid);
|
|
85632
85578
|
return { outcome: "killed_terminal_provider_error" };
|
|
85633
85579
|
}
|
|
85634
|
-
if (input.supportsSessionResume && input.wantResume) {
|
|
85635
|
-
if (slot) {
|
|
85636
|
-
slot.resumeInFlight = true;
|
|
85637
|
-
}
|
|
85638
|
-
try {
|
|
85639
|
-
await deps.resumeTurn(input.pid, deps.composeResumePrompt({ chatroomId: input.chatroomId, role: input.role }));
|
|
85640
|
-
try {
|
|
85641
|
-
await deps.backend.emitSessionResumed({
|
|
85642
|
-
chatroomId: input.chatroomId,
|
|
85643
|
-
role: input.role,
|
|
85644
|
-
...slot?.harnessSessionId ? { harnessSessionId: slot.harnessSessionId } : {}
|
|
85645
|
-
});
|
|
85646
|
-
} catch {}
|
|
85647
|
-
return { outcome: "resumed" };
|
|
85648
|
-
} catch (err) {
|
|
85649
|
-
try {
|
|
85650
|
-
await deps.backend.emitSessionResumeFailed({
|
|
85651
|
-
chatroomId: input.chatroomId,
|
|
85652
|
-
role: input.role,
|
|
85653
|
-
reason: err.message,
|
|
85654
|
-
...slot?.harnessSessionId ? { harnessSessionId: slot.harnessSessionId } : {}
|
|
85655
|
-
});
|
|
85656
|
-
} catch {}
|
|
85657
|
-
} finally {
|
|
85658
|
-
if (slot) {
|
|
85659
|
-
slot.resumeInFlight = false;
|
|
85660
|
-
}
|
|
85661
|
-
}
|
|
85662
|
-
}
|
|
85663
85580
|
deps.killProcess(input.pid);
|
|
85664
85581
|
return { outcome: "killed" };
|
|
85665
85582
|
}
|
|
@@ -86070,7 +85987,6 @@ class AgentProcessManager {
|
|
|
86070
85987
|
model: slot.model,
|
|
86071
85988
|
workingDir: slot.workingDir,
|
|
86072
85989
|
startedAt: slot.startedAt,
|
|
86073
|
-
resumeInFlight: slot.resumeInFlight,
|
|
86074
85990
|
recentLogLines: slot.recentLogLines,
|
|
86075
85991
|
wantResume: slot.wantResume
|
|
86076
85992
|
});
|
|
@@ -86176,9 +86092,7 @@ class AgentProcessManager {
|
|
|
86176
86092
|
}
|
|
86177
86093
|
async runHandleAgentEnd(opts) {
|
|
86178
86094
|
const slot = this.slots.get(agentKey3(opts.chatroomId, opts.role));
|
|
86179
|
-
const service3 = this.deps.agentServices.get(opts.harness);
|
|
86180
86095
|
const capabilities = getHarnessCapabilities(opts.harness);
|
|
86181
|
-
const supportsSessionResume = capabilities.supportsSessionResume && typeof service3?.resumeTurn === "function";
|
|
86182
86096
|
this.updateSlotsMirror(opts.chatroomId, opts.role, {
|
|
86183
86097
|
state: slot?.state ?? "idle",
|
|
86184
86098
|
pid: slot?.pid,
|
|
@@ -86187,11 +86101,10 @@ class AgentProcessManager {
|
|
|
86187
86101
|
model: slot?.model,
|
|
86188
86102
|
workingDir: slot?.workingDir,
|
|
86189
86103
|
startedAt: slot?.startedAt,
|
|
86190
|
-
resumeInFlight: slot?.resumeInFlight,
|
|
86191
86104
|
recentLogLines: slot?.recentLogLines,
|
|
86192
86105
|
wantResume: slot?.wantResume
|
|
86193
86106
|
});
|
|
86194
|
-
console.log(`[AgentProcessManager] lifecycle.turn.completed: role=${opts.role} pid=${opts.pid} harness=${opts.harness}
|
|
86107
|
+
console.log(`[AgentProcessManager] lifecycle.turn.completed: role=${opts.role} pid=${opts.pid} harness=${opts.harness}`);
|
|
86195
86108
|
if (capabilities.supportsNativeIntegration) {
|
|
86196
86109
|
await this.runHandleNativeTurnEnd(opts, slot);
|
|
86197
86110
|
return;
|
|
@@ -86200,18 +86113,6 @@ class AgentProcessManager {
|
|
|
86200
86113
|
resumeStormTracker: this.deps.resumeStormTracker,
|
|
86201
86114
|
backend: createTurnCompletedBackend(this.deps),
|
|
86202
86115
|
now: () => this.deps.clock.now(),
|
|
86203
|
-
composeResumePrompt: ({ chatroomId, role }) => composeResumeMessage({
|
|
86204
|
-
chatroomId,
|
|
86205
|
-
role,
|
|
86206
|
-
convexUrl: this.deps.convexUrl,
|
|
86207
|
-
supportsNativeIntegration: capabilities.supportsNativeIntegration
|
|
86208
|
-
}),
|
|
86209
|
-
resumeTurn: async (pid, prompt) => {
|
|
86210
|
-
if (!service3?.resumeTurn) {
|
|
86211
|
-
throw new Error("Harness does not support resumeTurn");
|
|
86212
|
-
}
|
|
86213
|
-
await service3.resumeTurn(pid, prompt);
|
|
86214
|
-
},
|
|
86215
86116
|
killProcess: (pid) => {
|
|
86216
86117
|
try {
|
|
86217
86118
|
this.deps.processes.kill(-pid, "SIGTERM");
|
|
@@ -86221,27 +86122,17 @@ class AgentProcessManager {
|
|
|
86221
86122
|
}, {
|
|
86222
86123
|
chatroomId: opts.chatroomId,
|
|
86223
86124
|
role: opts.role,
|
|
86224
|
-
pid: opts.pid
|
|
86225
|
-
supportsSessionResume,
|
|
86226
|
-
wantResume: slot?.wantResume ?? true
|
|
86125
|
+
pid: opts.pid
|
|
86227
86126
|
}, slot);
|
|
86228
|
-
if (result.outcome === "
|
|
86229
|
-
console.log(`[AgentProcessManager] lifecycle.turn.completed: skipping duplicate resume for ${opts.role} (resume already in flight)`);
|
|
86230
|
-
} else if (result.outcome === "storm_aborted") {
|
|
86127
|
+
if (result.outcome === "storm_aborted") {
|
|
86231
86128
|
console.log(`[AgentProcessManager] ✅ Handled rapid resume storm for ${opts.role}`);
|
|
86232
|
-
} else if (result.outcome === "resumed") {
|
|
86233
|
-
console.log(`[AgentProcessManager] ✅ Emitted agent.sessionResumed for ${opts.role}`);
|
|
86234
86129
|
} else if (result.outcome === "killed") {
|
|
86235
|
-
console.log(`[AgentProcessManager] lifecycle.turn.completed: killed process for ${opts.role}
|
|
86130
|
+
console.log(`[AgentProcessManager] lifecycle.turn.completed: killed process for ${opts.role}`);
|
|
86236
86131
|
} else if (result.outcome === "killed_terminal_provider_error") {
|
|
86237
86132
|
console.log(`[AgentProcessManager] ⛔ Terminal provider error for ${opts.role} — emitted agent.startFailed`);
|
|
86238
86133
|
}
|
|
86239
86134
|
}
|
|
86240
86135
|
async runHandleNativeTurnEnd(opts, slot) {
|
|
86241
|
-
if (slot?.resumeInFlight) {
|
|
86242
|
-
console.log(`[AgentProcessManager] lifecycle.turn.completed: skipping duplicate native turn-end for ${opts.role}`);
|
|
86243
|
-
return;
|
|
86244
|
-
}
|
|
86245
86136
|
if (await tryAbortResumeStorm({
|
|
86246
86137
|
resumeStormTracker: this.deps.resumeStormTracker,
|
|
86247
86138
|
backend: createTurnCompletedBackend(this.deps),
|
|
@@ -86250,9 +86141,7 @@ class AgentProcessManager {
|
|
|
86250
86141
|
}, {
|
|
86251
86142
|
chatroomId: opts.chatroomId,
|
|
86252
86143
|
role: opts.role,
|
|
86253
|
-
pid: opts.pid
|
|
86254
|
-
supportsSessionResume: false,
|
|
86255
|
-
wantResume: false
|
|
86144
|
+
pid: opts.pid
|
|
86256
86145
|
}, slot)) {
|
|
86257
86146
|
console.log(`[AgentProcessManager] ✅ Handled rapid resume storm for ${opts.role}`);
|
|
86258
86147
|
return;
|
|
@@ -86652,12 +86541,12 @@ class AgentProcessManager {
|
|
|
86652
86541
|
if (!stored) {
|
|
86653
86542
|
return null;
|
|
86654
86543
|
}
|
|
86655
|
-
|
|
86656
|
-
if (!resumeFromDaemonMemory) {
|
|
86544
|
+
if (!opts.service.resumeFromDaemonMemory) {
|
|
86657
86545
|
return null;
|
|
86658
86546
|
}
|
|
86659
86547
|
try {
|
|
86660
|
-
|
|
86548
|
+
await this.emitSessionResumeRequested(opts.chatroomId, opts.role, opts.agentHarness, stored.harnessSessionId);
|
|
86549
|
+
const spawnResult = await opts.service.resumeFromDaemonMemory({
|
|
86661
86550
|
workingDir: stored.workingDir,
|
|
86662
86551
|
prompt: createSpawnPrompt(opts.initPrompt),
|
|
86663
86552
|
systemPrompt: opts.systemPrompt,
|
|
@@ -86704,6 +86593,21 @@ class AgentProcessManager {
|
|
|
86704
86593
|
}
|
|
86705
86594
|
return null;
|
|
86706
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
|
+
}
|
|
86707
86611
|
async emitSessionResumed(chatroomId, role, harnessSessionId) {
|
|
86708
86612
|
try {
|
|
86709
86613
|
await this.deps.backend.mutation(api.machines.emitSessionResumed, {
|
|
@@ -87110,7 +87014,6 @@ class AgentProcessManager {
|
|
|
87110
87014
|
}
|
|
87111
87015
|
var AGENT_EXIT_RETRY_INTERVAL_MS = 1e4;
|
|
87112
87016
|
var init_agent_process_manager = __esm(() => {
|
|
87113
|
-
init_generator();
|
|
87114
87017
|
init_types();
|
|
87115
87018
|
init_participant();
|
|
87116
87019
|
init_esm();
|
|
@@ -89684,4 +89587,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
|
89684
89587
|
});
|
|
89685
89588
|
program2.parse();
|
|
89686
89589
|
|
|
89687
|
-
//# debugId=
|
|
89590
|
+
//# debugId=4A0FE03BEB3CACE864756E2164756E21
|