chatroom-cli 1.115.0 → 1.115.1

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
@@ -31407,17 +31407,6 @@ function isTurnPhaseIdle(phase) {
31407
31407
  }
31408
31408
  var init_check_agent_slot = () => {};
31409
31409
 
31410
- // src/daemon/services/task-service/domain/entities/operational-agent.ts
31411
- function isOperationalDesiredRunning(row) {
31412
- return row?.operationalState === "running" || row?.operationalState === "starting";
31413
- }
31414
- function isOperationalCircuitOpen(row) {
31415
- return row?.operationalState === "circuit_open";
31416
- }
31417
- function isOperationalStopIntentActive(row) {
31418
- return row?.stopState === "stopped" || row?.stopState === "stopping" || row?.stopState === "pending";
31419
- }
31420
-
31421
31410
  // src/daemon/services/task-service/domain/usecase/native-cold-session-delivery.ts
31422
31411
  function snapshotRequestsNativeColdSession(task) {
31423
31412
  return task.requestsNativeColdSession === true;
@@ -31430,18 +31419,12 @@ function isColdStartEligibleSlotState(slot) {
31430
31419
  function isNativeColdSessionDeliveryOwnedSpawn(task, slot) {
31431
31420
  return snapshotRequestsNativeColdSession(task) && isColdStartEligibleSlotState(slot);
31432
31421
  }
31433
- function explainColdSessionDeliveryBlock(task, slot, operational) {
31422
+ function explainColdSessionDeliveryBlock(task, slot) {
31434
31423
  if (!snapshotRequestsNativeColdSession(task))
31435
31424
  return null;
31436
31425
  if (isChatroomStopScopeActive(task.chatroomId)) {
31437
31426
  return "chatroom_stop_scope_active";
31438
31427
  }
31439
- if (isOperationalStopIntentActive(operational)) {
31440
- return "operational_stop_intent_active";
31441
- }
31442
- if (isOperationalCircuitOpen(operational)) {
31443
- return "operational_circuit_open";
31444
- }
31445
31428
  if (slot && isSlotSpawning(slot.state)) {
31446
31429
  return `slot_spawning (slotState=${slot.state})`;
31447
31430
  }
@@ -31462,25 +31445,21 @@ function isDeliverableTaskStatus(status3) {
31462
31445
  var init_assigned_task = () => {};
31463
31446
 
31464
31447
  // src/daemon/services/task-service/domain/usecase/native-ready-invariant.ts
31465
- function isAgentReadyForNativeDelivery(task, slot, operational) {
31466
- return explainAgentReadyForNativeDeliveryBlock(task, slot, operational) === null;
31448
+ function isAgentReadyForNativeDelivery(task, slot) {
31449
+ return explainAgentReadyForNativeDeliveryBlock(task, slot) === null;
31467
31450
  }
31468
- function explainAgentReadyForNativeDeliveryBlock(task, slot, explicitOperational) {
31451
+ function explainAgentReadyForNativeDeliveryBlock(task, slot) {
31469
31452
  const { agentConfig } = task;
31470
31453
  if (!isNativeHarness(agentConfig.agentHarness)) {
31471
31454
  return `not_native_harness (harness=${agentConfig.agentHarness})`;
31472
31455
  }
31473
- const operational = explicitOperational;
31474
- const coldBlock = explainColdSessionDeliveryBlock(task, slot, operational);
31456
+ const coldBlock = explainColdSessionDeliveryBlock(task, slot);
31475
31457
  if (coldBlock) {
31476
31458
  return coldBlock;
31477
31459
  }
31478
31460
  if (isNativeColdSessionDeliveryOwnedSpawn(task, slot)) {
31479
31461
  return null;
31480
31462
  }
31481
- if (!isOperationalDesiredRunning(operational)) {
31482
- return `operational_state_not_running (state=${operational?.operationalState ?? "missing"})`;
31483
- }
31484
31463
  if (!slot) {
31485
31464
  return agentConfig.spawnedAgentPid == null ? "spawned_pid_missing" : `slot_missing (expectedPid=${agentConfig.spawnedAgentPid})`;
31486
31465
  }
@@ -31533,7 +31512,7 @@ function explainNativeDeliveryBlock(task, opts) {
31533
31512
  return `acknowledged_wrong_role (assignedTo=${assignedTo ?? "none"}, role=${role})`;
31534
31513
  }
31535
31514
  }
31536
- return explainAgentReadyForNativeDeliveryBlock(task, opts.slot, opts.operational);
31515
+ return explainAgentReadyForNativeDeliveryBlock(task, opts.slot);
31537
31516
  }
31538
31517
  function buildNativeInjectionPrompt(params) {
31539
31518
  const preamble = AUGMENTATION_PREAMBLES[params.augmentationMode];
@@ -31880,9 +31859,6 @@ function stableBlockReason(reason) {
31880
31859
  "task_status_not_deliverable",
31881
31860
  "acknowledged_wrong_role",
31882
31861
  "chatroom_stop_scope_active",
31883
- "operational_stop_intent_active",
31884
- "operational_circuit_open",
31885
- "operational_state_not_running",
31886
31862
  "slot_missing",
31887
31863
  "slot_not_running",
31888
31864
  "slot_pid_missing",
@@ -31920,8 +31896,7 @@ function decideNextDelivery(tasks, context5) {
31920
31896
  return { kind: "wait", taskId: task.taskId, reason: "agent_start_in_flight" };
31921
31897
  }
31922
31898
  const blockReason = context5.explainNativeDeliveryBlock(task, {
31923
- slot: context5.slot,
31924
- operational: context5.operational
31899
+ slot: context5.slot
31925
31900
  });
31926
31901
  if (blockReason === null) {
31927
31902
  return {
@@ -31981,15 +31956,7 @@ class NativeTaskDeliveryCoordinator {
31981
31956
  const tasks = params.tasks;
31982
31957
  if (tasks.length === 0)
31983
31958
  return;
31984
- const {
31985
- runtime: runtime4,
31986
- effectContext: effectContext2,
31987
- agentMgr,
31988
- operationalModel,
31989
- isTaskActive,
31990
- onTaskDelivered,
31991
- executors
31992
- } = params;
31959
+ const { runtime: runtime4, effectContext: effectContext2, agentMgr, isTaskActive, onTaskDelivered, executors } = params;
31993
31960
  const deliveryState = getRoleDeliveryState();
31994
31961
  const taskService = params.taskService;
31995
31962
  const groups = new Map;
@@ -32012,12 +31979,10 @@ class NativeTaskDeliveryCoordinator {
32012
31979
  continue;
32013
31980
  const { role } = firstTask.agentConfig;
32014
31981
  const slot = agentMgr.getSlot(firstTask.chatroomId, role);
32015
- const operational = operationalModel.get(firstTask.chatroomId, role);
32016
31982
  const activeTaskId = roleTasks.find((candidate) => isTaskActive({ chatroomId: candidate.chatroomId, role, taskId: candidate.taskId }))?.taskId;
32017
31983
  const decision = decideNextDelivery(roleTasks, {
32018
31984
  role,
32019
31985
  slot,
32020
- operational,
32021
31986
  activeTaskId,
32022
31987
  deliveryInFlight: false,
32023
31988
  agentLifecycleInFlight: isRestartOrchestratorInFlight(firstTask.chatroomId, role),
@@ -32032,8 +31997,7 @@ class NativeTaskDeliveryCoordinator {
32032
31997
  attemptId,
32033
31998
  slotState: slot?.state ?? "missing",
32034
31999
  nativeTurnPhase: slot?.nativeTurnPhase ?? "unknown",
32035
- harnessSessionPresent: Boolean(slot?.harnessSessionId),
32036
- operationalState: operational?.operationalState ?? "missing"
32000
+ harnessSessionPresent: Boolean(slot?.harnessSessionId)
32037
32001
  });
32038
32002
  const row = ("taskId" in decision ? sortedTasks.find((candidate) => candidate.taskId === decision.taskId) : firstTask) ?? firstTask;
32039
32003
  if (decision.kind === "idle" || decision.kind === "blocked" || decision.kind === "wait") {
@@ -32051,7 +32015,7 @@ class NativeTaskDeliveryCoordinator {
32051
32015
  continue;
32052
32016
  try {
32053
32017
  if (executors) {
32054
- const startResult2 = await executors.startAgent(row, operational?.operationalState);
32018
+ const startResult2 = await executors.startAgent(row);
32055
32019
  console.log(`[NativeDelivery:execution] attempt=${attemptId} role=${role} chatroom=${row.chatroomId} task=${row.taskId} operation=start-agent result=${startResult2 && typeof startResult2 === "object" && "success" in startResult2 ? startResult2.success : "completed"}`);
32056
32020
  continue;
32057
32021
  }
@@ -32061,7 +32025,7 @@ class NativeTaskDeliveryCoordinator {
32061
32025
  agentHarness: row.agentConfig.agentHarness,
32062
32026
  model: row.agentConfig.model ?? "",
32063
32027
  workingDir: row.agentConfig.workingDir,
32064
- reason: operational?.operationalState === "running" ? AgentStartReasonEnum["platform.task_monitor_nudge"] : AgentStartReasonEnum["platform.pending_task_wake"],
32028
+ reason: AgentStartReasonEnum["platform.pending_task_wake"],
32065
32029
  wantResume: false,
32066
32030
  lifecycleRevision: row.agentConfig.configLifecycleRevision,
32067
32031
  taskId: row.taskId
@@ -32134,19 +32098,19 @@ var init_native_task_delivery_coordinator = __esm(() => {
32134
32098
  });
32135
32099
 
32136
32100
  // src/daemon/services/task-service/service/native-delivery/task-delivery-processor.ts
32137
- async function processTasksUpdate(runtime4, effectContext2, agentMgr, runSerializedForAgent, taskService, sessionDeps, machineId, pass, lifecycleOutbox, operationalModel, isTaskActive, options) {
32101
+ async function processTasksUpdate(runtime4, effectContext2, agentMgr, runSerializedForAgent, taskService, sessionDeps, machineId, pass, lifecycleOutbox, isTaskActive, options) {
32138
32102
  const first = options.snapshots[0];
32139
32103
  if (!first)
32140
32104
  return;
32141
32105
  logNativeDeliveryTrigger(pass, first.agentConfig.role, first.chatroomId, first.taskId);
32142
32106
  const executors = {
32143
- startAgent: (task, operationalState) => runSerializedForAgent({ chatroomId: task.chatroomId, role: task.agentConfig.role }, { timeoutMs: 120000 }, (ops, context5) => ops.startAgent({
32107
+ startAgent: (task) => runSerializedForAgent({ chatroomId: task.chatroomId, role: task.agentConfig.role }, { timeoutMs: 120000 }, (ops, context5) => ops.startAgent({
32144
32108
  chatroomId: task.chatroomId,
32145
32109
  role: task.agentConfig.role,
32146
32110
  agentHarness: task.agentConfig.agentHarness,
32147
32111
  model: task.agentConfig.model ?? "",
32148
32112
  workingDir: task.agentConfig.workingDir,
32149
- reason: operationalState === "running" ? AgentStartReasonEnum["platform.task_monitor_nudge"] : AgentStartReasonEnum["platform.pending_task_wake"],
32113
+ reason: AgentStartReasonEnum["platform.pending_task_wake"],
32150
32114
  wantResume: false,
32151
32115
  lifecycleRevision: task.agentConfig.configLifecycleRevision,
32152
32116
  taskId: task.taskId
@@ -32176,7 +32140,6 @@ async function processTasksUpdate(runtime4, effectContext2, agentMgr, runSeriali
32176
32140
  taskService,
32177
32141
  sessionDeps,
32178
32142
  lifecycleOutbox,
32179
- operationalModel,
32180
32143
  isTaskActive,
32181
32144
  machineId,
32182
32145
  onTaskDelivered: options.onTaskDelivered,
@@ -32219,7 +32182,7 @@ class NativeDeliveryService {
32219
32182
  this.requestReconcile({
32220
32183
  chatroomId: event.chatroomId,
32221
32184
  role: event.role,
32222
- source: "operational-signal"
32185
+ source: "agent-session-lost"
32223
32186
  }).catch((error) => {
32224
32187
  console.warn(`[NativeDelivery:failure] role=${event.role} chatroom=${event.chatroomId} operation=session-loss-reconcile error=${error instanceof Error ? error.message : String(error)}`);
32225
32188
  });
@@ -32392,7 +32355,7 @@ class NativeDeliveryService {
32392
32355
  async reconcileRole(pass, snapshots, onTaskDelivered) {
32393
32356
  if (snapshots.length === 0)
32394
32357
  return;
32395
- await processTasksUpdate(this.deps.runtime, this.deps.effectContext, this.deps.agentMgr, this.deps.runSerializedForAgent, this.deps.taskService, this.deps.sessionDeps, this.deps.machineId, pass, this.deps.lifecycleOutbox, this.deps.agentOperationalReadModel, ({ chatroomId, role, taskId }) => this.deps.agentTaskState.get({ chatroomId, role })?.taskId === taskId, {
32358
+ await processTasksUpdate(this.deps.runtime, this.deps.effectContext, this.deps.agentMgr, this.deps.runSerializedForAgent, this.deps.taskService, this.deps.sessionDeps, this.deps.machineId, pass, this.deps.lifecycleOutbox, ({ chatroomId, role, taskId }) => this.deps.agentTaskState.get({ chatroomId, role })?.taskId === taskId, {
32396
32359
  snapshots,
32397
32360
  onTaskDelivered: (args2) => {
32398
32361
  this.recordTaskDelivered(args2);
@@ -47688,10 +47651,6 @@ function createTaskService(deps) {
47688
47651
  inboxStore = createInboxStateStore(resolveInboxDbPath(deps.machineId));
47689
47652
  serviceStartedAt = Date.now();
47690
47653
  try {
47691
- await deps.backend.mutation(api.machines.backfillAgentOperationalStatusForMachine, {
47692
- sessionId: deps.sessionId,
47693
- machineId: deps.machineId
47694
- });
47695
47654
  await service4.syncAssignedTaskSnapshots();
47696
47655
  const snapshots = await fetchMachineAssignedTaskSnapshots({ ...deps, convexUrl: deps.convexUrl }, deps.machineId);
47697
47656
  taskSnapshotState.replace(snapshots);
@@ -47772,7 +47731,6 @@ var init_task_service = __esm(() => {
47772
47731
  init_esm();
47773
47732
  init_native_delivery_service();
47774
47733
  init_native_task_injector();
47775
- init_api3();
47776
47734
  init_fetch_machine_assigned_task_snapshots();
47777
47735
  init_inbox();
47778
47736
  init_task();
@@ -118115,301 +118073,8 @@ async function refreshWorkspaceMembership() {
118115
118073
  }
118116
118074
  var refreshRoomMembership = null;
118117
118075
 
118118
- // src/daemon/infrastructure/agent-operational/operational-signal-feeds.ts
118119
- function chatroomId(value) {
118120
- return value;
118121
- }
118122
- function signalPage(result) {
118123
- if (!result || typeof result !== "object")
118124
- return null;
118125
- const page = result;
118126
- if (!page.items?.length || !page.highKey)
118127
- return null;
118128
- return {
118129
- items: page.items,
118130
- afterSignalKey: "",
118131
- highSignalKey: page.highKey
118132
- };
118133
- }
118134
- function createFeed(input) {
118135
- return input;
118136
- }
118137
- function subscribeArgs(input) {
118138
- return {
118139
- sessionId: input.sessionId,
118140
- machineId: input.machineId,
118141
- chatroomId: chatroomId(input.chatroomId),
118142
- afterKey: input.afterKey,
118143
- limit: input.limit
118144
- };
118145
- }
118146
- function rangeArgs(input) {
118147
- return {
118148
- sessionId: input.sessionId,
118149
- machineId: input.machineId,
118150
- chatroomId: chatroomId(input.chatroomId),
118151
- afterSignalKey: input.afterSignalKey,
118152
- throughSignalKey: input.throughSignalKey,
118153
- limit: input.limit
118154
- };
118155
- }
118156
- function ackArgs(input) {
118157
- return {
118158
- sessionId: input.sessionId,
118159
- machineId: input.machineId,
118160
- chatroomId: chatroomId(input.chatroomId),
118161
- throughSignalKey: input.throughSignalKey
118162
- };
118163
- }
118164
- var createMachineFeed = (config4) => createFeed({
118165
- kind: config4.kind,
118166
- subscribe: (client4, input, onResult, onError3) => client4.onUpdate(config4.subscribe, subscribeArgs(input), (result) => {
118167
- const page = signalPage(result);
118168
- onResult(page ? { ...page, afterSignalKey: input.afterKey } : result);
118169
- }, onError3),
118170
- hydrate: async (client4, input) => await client4.query(config4.hydrate, rangeArgs(input)),
118171
- acknowledge: async (sessionDeps, input) => await sessionDeps.backend.mutation(config4.acknowledge, ackArgs({
118172
- ...input,
118173
- sessionId: sessionDeps.sessionId
118174
- }))
118175
- }), operationalSignalFeeds;
118176
- var init_operational_signal_feeds = __esm(() => {
118177
- init_api3();
118178
- operationalSignalFeeds = {
118179
- "agent-operational": createMachineFeed({
118180
- kind: "agent-operational",
118181
- subscribe: api.machines.subscribeMachineAgentOperationalSignalsSince,
118182
- hydrate: api.machines.listMachineAgentOperationalStatusForSignalRange,
118183
- acknowledge: api.machines.ackMachineAgentOperationalSignals
118184
- }),
118185
- connectivity: createMachineFeed({
118186
- kind: "connectivity",
118187
- subscribe: api.machines.subscribeMachineConnectivitySignalsSince,
118188
- hydrate: api.machines.listMachineConnectivityStatusForSignalRange,
118189
- acknowledge: api.machines.ackMachineConnectivitySignals
118190
- }),
118191
- "agent-stop": createMachineFeed({
118192
- kind: "agent-stop",
118193
- subscribe: api.machines.subscribeMachineAgentStopSignalsSince,
118194
- hydrate: api.machines.listMachineAgentStopStatusForSignalRange,
118195
- acknowledge: api.machines.ackMachineAgentStopSignals
118196
- }),
118197
- "agent-removal": createMachineFeed({
118198
- kind: "agent-removal",
118199
- subscribe: api.machines.subscribeMachineAgentRemovalSignalsSince,
118200
- hydrate: api.machines.listMachineAgentRemovalStatusForSignalRange,
118201
- acknowledge: api.machines.ackMachineAgentRemovalSignals
118202
- })
118203
- };
118204
- });
118205
-
118206
- // src/daemon/infrastructure/agent-operational/ack-machine-operational-signals.ts
118207
- async function ackMachineSignal(sessionDeps, machineId, chatroomId2, throughSignalKey, kind) {
118208
- const feed = operationalSignalFeeds[kind];
118209
- while (true) {
118210
- const result = await feed.acknowledge(sessionDeps, {
118211
- machineId,
118212
- chatroomId: chatroomId2,
118213
- throughSignalKey
118214
- });
118215
- if (!result.hasMore)
118216
- return;
118217
- if (result.deletedCount === 0) {
118218
- throw new Error(`${kind} signal ack reported more work without progress`);
118219
- }
118220
- }
118221
- }
118222
- var init_ack_machine_operational_signals = __esm(() => {
118223
- init_operational_signal_feeds();
118224
- });
118225
-
118226
- // src/daemon/infrastructure/agent-operational/agent-operational-read-model.ts
118227
- class AgentOperationalReadModel {
118228
- rows = new Map;
118229
- replace(rows) {
118230
- const changed = [];
118231
- const nextKeys = new Set;
118232
- for (const row of rows) {
118233
- const key = roleKey3(row.chatroomId, row.role);
118234
- nextKeys.add(key);
118235
- const prev = this.rows.get(key);
118236
- if (!prev || prev.revisionKey !== row.revisionKey)
118237
- changed.push({ chatroomId: row.chatroomId, role: row.role });
118238
- this.rows.set(key, row);
118239
- }
118240
- for (const [key, prev] of this.rows) {
118241
- if (!nextKeys.has(key)) {
118242
- changed.push({ chatroomId: prev.chatroomId, role: prev.role });
118243
- this.rows.delete(key);
118244
- }
118245
- }
118246
- return changed;
118247
- }
118248
- applySignalPage(rows, removed) {
118249
- const changed = [];
118250
- for (const row of rows) {
118251
- const key = roleKey3(row.chatroomId, row.role);
118252
- const prev = this.rows.get(key);
118253
- if (!prev || prev.revisionKey !== row.revisionKey) {
118254
- changed.push({ chatroomId: row.chatroomId, role: row.role });
118255
- }
118256
- this.rows.set(key, row);
118257
- }
118258
- for (const item of removed) {
118259
- const key = roleKey3(item.chatroomId, item.role);
118260
- if (this.rows.has(key))
118261
- changed.push(item);
118262
- this.rows.delete(key);
118263
- }
118264
- return changed;
118265
- }
118266
- get(chatroomId2, role) {
118267
- return this.rows.get(roleKey3(chatroomId2, role));
118268
- }
118269
- }
118270
- var roleKey3 = (chatroomId2, role) => `${chatroomId2}:${role.toLowerCase()}`;
118271
-
118272
- // src/daemon/infrastructure/agent-operational/fetch-machine-agent-operational-status.ts
118273
- async function fetchMachineAgentOperationalStatus(sessionDeps, machineId) {
118274
- const result = await sessionDeps.backend.query(api.machines.listMachineAgentOperationalStatus, {
118275
- sessionId: sessionDeps.sessionId,
118276
- machineId
118277
- });
118278
- return result;
118279
- }
118280
- var init_fetch_machine_agent_operational_status = __esm(() => {
118281
- init_api3();
118282
- });
118283
-
118284
- // src/daemon/infrastructure/agent-operational/operational-inbox.ts
118285
- function operationalSignalCursorAt(timestamp) {
118286
- return `${String(Math.max(0, Math.floor(timestamp))).padStart(16, "0")}:`;
118287
- }
118288
- function abortError2() {
118289
- const error51 = new Error("Operational inbox stopped");
118290
- error51.name = "AbortError";
118291
- return error51;
118292
- }
118293
- function throwIfAborted2(signal) {
118294
- if (signal?.aborted)
118295
- throw abortError2();
118296
- }
118297
- function feedFor(options) {
118298
- return options.feed ?? operationalSignalFeeds["agent-operational"];
118299
- }
118300
- function waitForOperationalSignalPage(options, afterSignalKey) {
118301
- return new Promise((resolve8, reject) => {
118302
- let unsubscribe;
118303
- let settled = false;
118304
- const cleanup = () => {
118305
- unsubscribe?.();
118306
- unsubscribe = undefined;
118307
- options.signal?.removeEventListener("abort", onAbort);
118308
- };
118309
- const settle2 = (fn2) => {
118310
- if (settled)
118311
- return;
118312
- settled = true;
118313
- cleanup();
118314
- fn2();
118315
- };
118316
- const onAbort = () => {
118317
- settle2(() => reject(abortError2()));
118318
- };
118319
- options.signal?.addEventListener("abort", onAbort, { once: true });
118320
- try {
118321
- throwIfAborted2(options.signal);
118322
- } catch (error51) {
118323
- settle2(() => reject(error51));
118324
- return;
118325
- }
118326
- unsubscribe = feedFor(options).subscribe(options.client, {
118327
- sessionId: options.sessionId,
118328
- machineId: options.machineId,
118329
- chatroomId: options.chatroomId,
118330
- afterKey: afterSignalKey,
118331
- limit: options.signalPageLimit ?? DEFAULT_SIGNAL_PAGE_LIMIT2
118332
- }, (result) => {
118333
- const page = result;
118334
- if (!page)
118335
- return;
118336
- settle2(() => resolve8(page));
118337
- }, (error51) => {
118338
- settle2(() => reject(error51));
118339
- });
118340
- });
118341
- }
118342
- async function* createOperationalSignalIterator(options) {
118343
- let afterSignalKey = options.initialAfterSignalKey ?? operationalSignalCursorAt(options.serviceStartedAt ?? Date.now());
118344
- while (!options.signal?.aborted) {
118345
- const page = await waitForOperationalSignalPage(options, afterSignalKey);
118346
- yield page;
118347
- afterSignalKey = page.highSignalKey;
118348
- }
118349
- }
118350
- async function fetchRowsForSignalPage(options, page) {
118351
- const rows = [];
118352
- const removed = [];
118353
- let afterSignalKey = page.afterSignalKey;
118354
- while (true) {
118355
- throwIfAborted2(options.signal);
118356
- const result = await feedFor(options).hydrate(options.client, {
118357
- sessionId: options.sessionId,
118358
- machineId: options.machineId,
118359
- chatroomId: options.chatroomId,
118360
- afterSignalKey,
118361
- throughSignalKey: page.highSignalKey,
118362
- limit: options.operationalPageLimit ?? DEFAULT_OPERATIONAL_PAGE_LIMIT
118363
- });
118364
- rows.push(...result.rows);
118365
- removed.push(...result.removed);
118366
- if (!result.hasMore || !result.nextSignalKey)
118367
- break;
118368
- afterSignalKey = result.nextSignalKey;
118369
- }
118370
- return { rows, removed };
118371
- }
118372
- async function runOperationalInbox(options, onUpdate) {
118373
- for await (const page of createOperationalSignalIterator(options)) {
118374
- const hydrated = await fetchRowsForSignalPage(options, page);
118375
- await onUpdate({
118376
- chatroomId: options.chatroomId,
118377
- signals: page.items,
118378
- rows: hydrated.rows,
118379
- removed: hydrated.removed,
118380
- afterSignalKey: page.afterSignalKey,
118381
- throughSignalKey: page.highSignalKey
118382
- });
118383
- }
118384
- }
118385
- var DEFAULT_SIGNAL_PAGE_LIMIT2 = 100, DEFAULT_OPERATIONAL_PAGE_LIMIT = 500;
118386
- var init_operational_inbox = __esm(() => {
118387
- init_operational_signal_feeds();
118388
- });
118389
-
118390
- // src/daemon/entry/operational-inbox-runtime.ts
118391
- function isAbortError2(error51) {
118392
- return error51 instanceof Error && error51.name === "AbortError";
118393
- }
118394
- function roomScopeKey(machineId, chatroomId2) {
118395
- return JSON.stringify([machineId, chatroomId2]);
118396
- }
118397
- async function runOperationalInboxLoopWithRestart(options, onUpdate, isStopped) {
118398
- let backoffMs = INBOX_RESTART_INITIAL_MS;
118399
- while (!isStopped()) {
118400
- try {
118401
- await runOperationalInbox(options, onUpdate);
118402
- return;
118403
- } catch (error51) {
118404
- if (isStopped() || isAbortError2(error51))
118405
- return;
118406
- console.warn(`[OperationalInbox room=${options.chatroomId}] loop error, restarting in ${backoffMs}ms:`, error51);
118407
- await new Promise((resolve8) => setTimeout(resolve8, backoffMs));
118408
- backoffMs = Math.min(backoffMs * 2, INBOX_RESTART_MAX_MS);
118409
- }
118410
- }
118411
- }
118412
- var INBOX_RESTART_INITIAL_MS = 1000, INBOX_RESTART_MAX_MS = 30000, startOperationalInboxEffect = (wsClient2) => exports_Effect.gen(function* () {
118076
+ // src/daemon/entry/task-inbox-runtime.ts
118077
+ var startTaskInboxEffect = (wsClient2) => exports_Effect.gen(function* () {
118413
118078
  const session2 = yield* DaemonSessionService;
118414
118079
  const agentMgr = yield* DaemonAgentProcessManagerService;
118415
118080
  const commandService = yield* DaemonAgentProcessManagerCommandService;
@@ -118429,12 +118094,6 @@ var INBOX_RESTART_INITIAL_MS = 1000, INBOX_RESTART_MAX_MS = 30000, startOperatio
118429
118094
  query: (fn2, args2) => session2.backend.query(fn2, args2)
118430
118095
  }
118431
118096
  };
118432
- console.log(`[${formatTimestamp()}] \uD83D\uDCEC Starting operational-inbox (chatroom-scoped operational signals)`);
118433
- const inboxStore = createInboxStateStore(resolveInboxDbPath(session2.machineId));
118434
- const serviceStartedAt = Date.now();
118435
- const abort = new AbortController;
118436
- let stopped = false;
118437
- const agentOperationalReadModel = new AgentOperationalReadModel;
118438
118097
  const agentTaskState = createAgentTaskStateService();
118439
118098
  const nativeDelivery = session2.taskService.createNativeDeliveryService({
118440
118099
  runtime: runtime4,
@@ -118444,96 +118103,19 @@ var INBOX_RESTART_INITIAL_MS = 1000, INBOX_RESTART_MAX_MS = 30000, startOperatio
118444
118103
  sessionDeps,
118445
118104
  machineId: session2.machineId,
118446
118105
  agentTaskState,
118447
- agentOperationalReadModel,
118448
118106
  lifecycleOutbox
118449
118107
  });
118450
118108
  yield* exports_Effect.tryPromise(() => session2.taskService.startTaskInbox(wsClient2)).pipe(exports_Effect.catchAll((error51) => {
118451
118109
  console.warn("[TaskService] task inbox bootstrap failed:", error51);
118452
118110
  return exports_Effect.void;
118453
118111
  }));
118454
- const knownRoomIds = new Set;
118112
+ let stopped = false;
118455
118113
  const roomWatchers = new Map;
118456
- const bootstrapSucceeded = yield* exports_Effect.tryPromise(async () => {
118457
- const rows = await fetchMachineAgentOperationalStatus(sessionDeps, session2.machineId);
118458
- agentOperationalReadModel.replace(rows);
118459
- for (const row of rows)
118460
- knownRoomIds.add(row.chatroomId);
118461
- return true;
118462
- }).pipe(exports_Effect.catchAll((error51) => {
118463
- console.warn("[OperationalInbox] bootstrap failed:", error51);
118464
- return exports_Effect.succeed(false);
118465
- }));
118466
- const operationalHandler = async (kind, update6) => {
118467
- const chatroomId2 = update6.chatroomId;
118468
- const changed = agentOperationalReadModel.applySignalPage(update6.rows, update6.removed);
118469
- await Promise.all(changed.map(({ chatroomId: roomId, role }) => nativeDelivery.requestReconcile({
118470
- chatroomId: roomId,
118471
- role,
118472
- source: "operational-signal"
118473
- })));
118474
- inboxStore.save({
118475
- inboxType: `operational:${kind}`,
118476
- scopeKey: roomScopeKey(session2.machineId, chatroomId2)
118477
- }, { afterSignalKey: update6.throughSignalKey });
118478
- try {
118479
- await ackMachineSignal(sessionDeps, session2.machineId, chatroomId2, update6.throughSignalKey, kind);
118480
- } catch (error51) {
118481
- console.warn(`[OperationalInbox kind=${kind} room=${chatroomId2}] signal cleanup failed:`, error51);
118482
- }
118483
- };
118484
- const ensureRoomInboxes = (chatroomId2) => {
118485
- const existing = roomWatchers.get(chatroomId2);
118486
- if (existing)
118487
- return existing.startPromise;
118488
- const controller = new AbortController;
118489
- const entry = {
118490
- controller,
118491
- startPromise: Promise.resolve()
118492
- };
118493
- roomWatchers.set(chatroomId2, entry);
118494
- entry.startPromise = (async () => {
118495
- if (!knownRoomIds.has(chatroomId2)) {
118496
- try {
118497
- const current = await fetchMachineAgentOperationalStatus(sessionDeps, session2.machineId);
118498
- agentOperationalReadModel.replace(current);
118499
- for (const row of current)
118500
- knownRoomIds.add(row.chatroomId);
118501
- } catch (error51) {
118502
- console.warn(`[OperationalInbox room=${chatroomId2}] operational hydration failed:`, error51);
118503
- }
118504
- }
118505
- await Promise.all(["agent-operational", "connectivity", "agent-stop", "agent-removal"].map(async (kind) => {
118506
- const operationalRoomKey = {
118507
- inboxType: `operational:${kind}`,
118508
- scopeKey: roomScopeKey(session2.machineId, chatroomId2)
118509
- };
118510
- const persistedRoom = inboxStore.get(operationalRoomKey);
118511
- let cursor = persistedRoom?.state.afterSignalKey;
118512
- if (!cursor) {
118513
- cursor = operationalSignalCursorAt(serviceStartedAt);
118514
- try {
118515
- inboxStore.save(operationalRoomKey, { afterSignalKey: cursor });
118516
- } catch (error51) {
118517
- console.warn(`[OperationalInbox kind=${kind} room=${chatroomId2}] failed to persist bootstrap baseline:`, error51);
118518
- }
118519
- }
118520
- if (persistedRoom || bootstrapSucceeded) {
118521
- ackMachineSignal(sessionDeps, session2.machineId, chatroomId2, cursor, kind).catch((error51) => console.warn(`[OperationalInbox kind=${kind} room=${chatroomId2}] startup signal cleanup failed:`, error51));
118522
- }
118523
- runOperationalInboxLoopWithRestart({
118524
- client: wsClient2,
118525
- sessionId: session2.sessionId,
118526
- machineId: session2.machineId,
118527
- chatroomId: chatroomId2,
118528
- feed: operationalSignalFeeds[kind],
118529
- serviceStartedAt,
118530
- initialAfterSignalKey: cursor,
118531
- signal: controller.signal
118532
- }, (update6) => operationalHandler(kind, update6), () => stopped);
118533
- }));
118534
- await session2.taskService.registerTaskChatroom(chatroomId2);
118535
- })();
118536
- return entry.startPromise;
118114
+ const ensureRoom = async (chatroomId) => {
118115
+ if (roomWatchers.has(chatroomId))
118116
+ return;
118117
+ roomWatchers.set(chatroomId, new AbortController);
118118
+ await session2.taskService.registerTaskChatroom(chatroomId);
118537
118119
  };
118538
118120
  const refreshRoomMembership2 = async () => {
118539
118121
  try {
@@ -118544,53 +118126,40 @@ var INBOX_RESTART_INITIAL_MS = 1000, INBOX_RESTART_MAX_MS = 30000, startOperatio
118544
118126
  if (stopped)
118545
118127
  return;
118546
118128
  const chatroomIds = [
118547
- ...new Set((workspaces ?? []).map((workspace) => workspace.chatroomId))
118129
+ ...new Set((workspaces ?? []).map((workspace) => String(workspace.chatroomId)))
118548
118130
  ];
118549
118131
  const activeChatroomIds = new Set(chatroomIds);
118550
- for (const [chatroomId2, watcher] of roomWatchers) {
118551
- if (activeChatroomIds.has(chatroomId2))
118132
+ for (const [chatroomId, controller] of roomWatchers) {
118133
+ if (activeChatroomIds.has(chatroomId))
118552
118134
  continue;
118553
- watcher.controller.abort();
118554
- session2.taskService.unregisterTaskChatroom(chatroomId2);
118555
- roomWatchers.delete(chatroomId2);
118556
- knownRoomIds.delete(chatroomId2);
118135
+ controller.abort();
118136
+ session2.taskService.unregisterTaskChatroom(chatroomId);
118137
+ roomWatchers.delete(chatroomId);
118557
118138
  }
118558
- await Promise.all(chatroomIds.map((chatroomId2) => ensureRoomInboxes(chatroomId2)));
118139
+ await Promise.all(chatroomIds.map((chatroomId) => ensureRoom(chatroomId)));
118559
118140
  } catch (error51) {
118560
118141
  console.warn("[WorkspaceMembership] room membership refresh failed:", error51);
118561
118142
  }
118562
118143
  };
118563
118144
  registerWorkspaceMembershipRefresh(refreshRoomMembership2);
118564
118145
  yield* exports_Effect.promise(refreshRoomMembership2);
118565
- yield* exports_Effect.tryPromise(() => Promise.all([...knownRoomIds].map((chatroomId2) => ensureRoomInboxes(chatroomId2)))).pipe(exports_Effect.catchAll((error51) => {
118566
- console.warn("[OperationalInbox] initial watcher start failed:", error51);
118567
- return exports_Effect.void;
118568
- }));
118569
118146
  return {
118570
118147
  nativeDelivery,
118571
118148
  stop() {
118572
118149
  stopped = true;
118573
- abort.abort();
118574
- for (const watcher of roomWatchers.values()) {
118575
- watcher.controller.abort();
118576
- }
118150
+ for (const controller of roomWatchers.values())
118151
+ controller.abort();
118577
118152
  unregisterWorkspaceMembershipRefresh();
118578
118153
  session2.taskService.stopTaskInbox();
118579
118154
  nativeDelivery.dispose();
118580
118155
  nativeDelivery.agentTaskState.clearAll();
118581
- inboxStore.close();
118582
118156
  }
118583
118157
  };
118584
118158
  });
118585
- var init_operational_inbox_runtime = __esm(() => {
118159
+ var init_task_inbox_runtime = __esm(() => {
118586
118160
  init_esm();
118587
118161
  init_daemon_services();
118588
118162
  init_api3();
118589
- init_ack_machine_operational_signals();
118590
- init_fetch_machine_agent_operational_status();
118591
- init_operational_inbox();
118592
- init_operational_signal_feeds();
118593
- init_inbox();
118594
118163
  init_service_interfaces();
118595
118164
  });
118596
118165
 
@@ -118935,11 +118504,11 @@ var init_on_daemon_shutdown = __esm(() => {
118935
118504
  console.log(`[${formatTimestamp()}] Stopping ${activeAgents.length} agent(s) locally...`);
118936
118505
  let totalStopped = 0;
118937
118506
  let totalFailed = 0;
118938
- yield* exports_Effect.all(activeAgents.map(({ chatroomId: chatroomId2, role }) => exports_Effect.promise(() => agentPm.stopAgent({ chatroomId: chatroomId2, role, reason: "daemon.shutdown" })).pipe(exports_Effect.tap(() => exports_Effect.sync(() => {
118507
+ yield* exports_Effect.all(activeAgents.map(({ chatroomId, role }) => exports_Effect.promise(() => agentPm.stopAgent({ chatroomId, role, reason: "daemon.shutdown" })).pipe(exports_Effect.tap(() => exports_Effect.sync(() => {
118939
118508
  totalStopped += 1;
118940
118509
  })), exports_Effect.catchAll((e) => exports_Effect.sync(() => {
118941
118510
  totalFailed += 1;
118942
- console.log(` ⚠️ Failed to stop ${role}@${chatroomId2}: ${e.message}`);
118511
+ console.log(` ⚠️ Failed to stop ${role}@${chatroomId}: ${e.message}`);
118943
118512
  })))), { concurrency: "unbounded" });
118944
118513
  if (totalFailed > 0) {
118945
118514
  console.log(`[${formatTimestamp()}] Shutdown stops: ${totalStopped} stopped, ${totalFailed} failed`);
@@ -119103,7 +118672,7 @@ function createDaemonRuntime(deps) {
119103
118672
  break;
119104
118673
  }
119105
118674
  });
119106
- taskInboxHandle = yield* startOperationalInboxEffect(deps.wsClient);
118675
+ taskInboxHandle = yield* startTaskInboxEffect(deps.wsClient);
119107
118676
  logObserverSubscriptionHandle = startLogObserverSubscription({ sessionId: session2.sessionId, machineId: session2.machineId }, deps.wsClient);
119108
118677
  const commandRunRuntime = yield* exports_Effect.runtime();
119109
118678
  agenticQueryWorkerHandle = startAgenticQuerySubscriptions({
@@ -119158,7 +118727,7 @@ var init_daemon_runtime = __esm(() => {
119158
118727
  init_command_run_subscription();
119159
118728
  init_log_observer_sync();
119160
118729
  init_init_daemon();
119161
- init_operational_inbox_runtime();
118730
+ init_task_inbox_runtime();
119162
118731
  init_git_subscription();
119163
118732
  init_api3();
119164
118733
  init_workspace_list_subscription();
@@ -119761,15 +119330,15 @@ function startEnhancerJobSubscriber2(deps, onEvent) {
119761
119330
  const onError3 = (err) => {
119762
119331
  console.warn(`[daemon] enhancer-job subscriber error: ${err instanceof Error ? err.message : String(err)}`);
119763
119332
  };
119764
- const watchChatroom = (chatroomId2) => {
119765
- if (watchers.has(chatroomId2) || stopped)
119333
+ const watchChatroom = (chatroomId) => {
119334
+ if (watchers.has(chatroomId) || stopped)
119766
119335
  return;
119767
119336
  const unsub = deps.wsClient.onUpdate(api.daemon.enhancer.index.pendingForChatroom, {
119768
119337
  sessionId: deps.sessionId,
119769
119338
  machineId: deps.machineId,
119770
- chatroomId: chatroomId2
119339
+ chatroomId
119771
119340
  }, onPendingJobs, onError3);
119772
- watchers.set(chatroomId2, unsub);
119341
+ watchers.set(chatroomId, unsub);
119773
119342
  };
119774
119343
  const refreshChatrooms = async () => {
119775
119344
  if (refreshInFlight)
@@ -120254,10 +119823,10 @@ function queryEventStream(db, input) {
120254
119823
  payload: JSON.parse(row.payload_json)
120255
119824
  }));
120256
119825
  }
120257
- function queryAfterId(db, afterId = 0, limit = 100, source, chatroomId2, role, harness, fromTimestamp, toTimestamp) {
119826
+ function queryAfterId(db, afterId = 0, limit = 100, source, chatroomId, role, harness, fromTimestamp, toTimestamp) {
120258
119827
  const filters = [
120259
119828
  source ? "AND source = ?" : "",
120260
- chatroomId2 ? "AND json_extract(metadata_json, '$.chatroomId') = ?" : "",
119829
+ chatroomId ? "AND json_extract(metadata_json, '$.chatroomId') = ?" : "",
120261
119830
  role ? "AND json_extract(metadata_json, '$.role') = ?" : "",
120262
119831
  harness ? "AND (json_extract(metadata_json, '$.harness') = ? OR source = ?)" : "",
120263
119832
  fromTimestamp !== undefined ? "AND timestamp >= ?" : "",
@@ -120266,7 +119835,7 @@ function queryAfterId(db, afterId = 0, limit = 100, source, chatroomId2, role, h
120266
119835
  const values3 = [
120267
119836
  afterId,
120268
119837
  ...source ? [source] : [],
120269
- ...chatroomId2 ? [chatroomId2] : [],
119838
+ ...chatroomId ? [chatroomId] : [],
120270
119839
  ...role ? [role] : [],
120271
119840
  ...harness ? [harness, `harness:${harness}`] : [],
120272
119841
  ...fromTimestamp !== undefined ? [fromTimestamp] : [],
@@ -120276,11 +119845,11 @@ function queryAfterId(db, afterId = 0, limit = 100, source, chatroomId2, role, h
120276
119845
  const rows = db.prepare(`SELECT * FROM log_entries WHERE id > ? ${filters} ORDER BY id ASC LIMIT ?`).all(...values3);
120277
119846
  return rows.map(map19);
120278
119847
  }
120279
- function queryHistory(db, beforeId, limit = 100, source, chatroomId2, role, harness, fromTimestamp, toTimestamp) {
119848
+ function queryHistory(db, beforeId, limit = 100, source, chatroomId, role, harness, fromTimestamp, toTimestamp) {
120280
119849
  const filters = [
120281
119850
  beforeId ? "AND id < ?" : "",
120282
119851
  source ? "AND source = ?" : "",
120283
- chatroomId2 ? "AND json_extract(metadata_json, '$.chatroomId') = ?" : "",
119852
+ chatroomId ? "AND json_extract(metadata_json, '$.chatroomId') = ?" : "",
120284
119853
  role ? "AND json_extract(metadata_json, '$.role') = ?" : "",
120285
119854
  harness ? "AND (json_extract(metadata_json, '$.harness') = ? OR source = ?)" : "",
120286
119855
  fromTimestamp !== undefined ? "AND timestamp >= ?" : "",
@@ -120289,7 +119858,7 @@ function queryHistory(db, beforeId, limit = 100, source, chatroomId2, role, harn
120289
119858
  const values3 = [
120290
119859
  ...beforeId ? [beforeId] : [],
120291
119860
  ...source ? [source] : [],
120292
- ...chatroomId2 ? [chatroomId2] : [],
119861
+ ...chatroomId ? [chatroomId] : [],
120293
119862
  ...role ? [role] : [],
120294
119863
  ...harness ? [harness, `harness:${harness}`] : [],
120295
119864
  ...fromTimestamp !== undefined ? [fromTimestamp] : [],
@@ -120299,9 +119868,9 @@ function queryHistory(db, beforeId, limit = 100, source, chatroomId2, role, harn
120299
119868
  const rows = db.prepare(`SELECT * FROM log_entries WHERE 1=1 ${filters} ORDER BY id DESC LIMIT ?`).all(...values3);
120300
119869
  return rows.map(map19).reverse();
120301
119870
  }
120302
- function listLogDimensions(db, chatroomId2, limit = 100) {
119871
+ function listLogDimensions(db, chatroomId, limit = 100) {
120303
119872
  const clamped = clamp4(limit);
120304
- const values3 = (sql) => db.prepare(sql).all(chatroomId2, clamped).map((r) => r.v);
119873
+ const values3 = (sql) => db.prepare(sql).all(chatroomId, clamped).map((r) => r.v);
120305
119874
  const roles = values3("SELECT DISTINCT json_extract(metadata_json, '$.role') AS v FROM log_entries WHERE json_extract(metadata_json, '$.chatroomId') = ? AND json_extract(metadata_json, '$.role') IS NOT NULL ORDER BY v LIMIT ?");
120306
119875
  const meta3 = values3("SELECT DISTINCT json_extract(metadata_json, '$.harness') AS v FROM log_entries WHERE json_extract(metadata_json, '$.chatroomId') = ? AND json_extract(metadata_json, '$.harness') IS NOT NULL ORDER BY v LIMIT ?");
120307
119876
  const source = values3("SELECT DISTINCT substr(source, 9) AS v FROM log_entries WHERE json_extract(metadata_json, '$.chatroomId') = ? AND source LIKE 'harness:%' ORDER BY v LIMIT ?");
@@ -120485,17 +120054,17 @@ var init_persistence = __esm(() => {
120485
120054
  // src/daemon/infrastructure/repository/log-repository.ts
120486
120055
  function createLogRepository(db) {
120487
120056
  return {
120488
- queryAfterId(afterId = 0, limit = 100, source, chatroomId2, role, harness, fromTimestamp, toTimestamp) {
120489
- return queryAfterId(db, afterId, limit, source, chatroomId2, role, harness, fromTimestamp, toTimestamp);
120057
+ queryAfterId(afterId = 0, limit = 100, source, chatroomId, role, harness, fromTimestamp, toTimestamp) {
120058
+ return queryAfterId(db, afterId, limit, source, chatroomId, role, harness, fromTimestamp, toTimestamp);
120490
120059
  },
120491
- queryHistory(beforeId, limit = 100, source, chatroomId2, role, harness, fromTimestamp, toTimestamp) {
120492
- return queryHistory(db, beforeId, limit, source, chatroomId2, role, harness, fromTimestamp, toTimestamp);
120060
+ queryHistory(beforeId, limit = 100, source, chatroomId, role, harness, fromTimestamp, toTimestamp) {
120061
+ return queryHistory(db, beforeId, limit, source, chatroomId, role, harness, fromTimestamp, toTimestamp);
120493
120062
  },
120494
120063
  listSources(limit = 100) {
120495
120064
  return listDistinctSources(db, limit);
120496
120065
  },
120497
- listDimensions(chatroomId2, limit = 100) {
120498
- return listLogDimensions(db, chatroomId2, limit);
120066
+ listDimensions(chatroomId, limit = 100) {
120067
+ return listLogDimensions(db, chatroomId, limit);
120499
120068
  },
120500
120069
  writeChatroomEvent(event) {
120501
120070
  return appendChatroomEvent(db, event);
@@ -134307,8 +133876,8 @@ function listLogHistory(reader, input) {
134307
133876
  const entries2 = input.afterId !== undefined ? reader.queryAfterId(input.afterId, limit, input.source, input.chatroomId, input.role, input.harness, input.fromTimestamp, input.toTimestamp) : reader.queryHistory(input.beforeId, limit, input.source, input.chatroomId, input.role, input.harness, input.fromTimestamp, input.toTimestamp);
134308
133877
  return { entries: entries2 };
134309
133878
  }
134310
- function listLogDimensions2(reader, chatroomId2, limit = 100) {
134311
- return reader.listDimensions ? reader.listDimensions(chatroomId2, limit) : { roles: [], harnesses: [] };
133879
+ function listLogDimensions2(reader, chatroomId, limit = 100) {
133880
+ return reader.listDimensions ? reader.listDimensions(chatroomId, limit) : { roles: [], harnesses: [] };
134312
133881
  }
134313
133882
  function listLogSources(reader, limit = 100) {
134314
133883
  return { sources: reader.listSources(limit) };
@@ -135526,7 +135095,7 @@ handoffCommandGroup.option("--chatroom-id <id>", "Chatroom identifier").option("
135526
135095
  console.error(`error: required option '${flag} <...>' not specified`);
135527
135096
  process.exit(1);
135528
135097
  }
135529
- const { chatroomId: chatroomId2, role, nextRole } = options;
135098
+ const { chatroomId, role, nextRole } = options;
135530
135099
  await maybeRequireAuth();
135531
135100
  const { decode: decode6 } = await Promise.resolve().then(() => exports_decode);
135532
135101
  const stdinContent = await readStdin();
@@ -135545,7 +135114,7 @@ handoffCommandGroup.option("--chatroom-id <id>", "Chatroom identifier").option("
135545
135114
  process.exit(1);
135546
135115
  }
135547
135116
  const { handoff: handoff2 } = await Promise.resolve().then(() => (init_handoff(), exports_handoff));
135548
- await handoff2(chatroomId2, {
135117
+ await handoff2(chatroomId, {
135549
135118
  role,
135550
135119
  message,
135551
135120
  nextRole
@@ -135869,18 +135438,18 @@ registerChatroomRoleCommand(program2, {
135869
135438
  name: "get-system-prompt",
135870
135439
  description: "Fetch the system prompt for your role in a chatroom",
135871
135440
  maybeRequireAuth,
135872
- run: async (chatroomId2, { role }) => {
135441
+ run: async (chatroomId, { role }) => {
135873
135442
  const { getSystemPrompt: getSystemPrompt2 } = await Promise.resolve().then(() => (init_get_system_prompt(), exports_get_system_prompt));
135874
- await getSystemPrompt2(chatroomId2, { role });
135443
+ await getSystemPrompt2(chatroomId, { role });
135875
135444
  }
135876
135445
  });
135877
135446
  registerChatroomRoleCommand(program2, {
135878
135447
  name: "get-role-guidance",
135879
135448
  description: "Fetch role-specific operating-model guidance for your role in a chatroom",
135880
135449
  maybeRequireAuth,
135881
- run: async (chatroomId2, { role }) => {
135450
+ run: async (chatroomId, { role }) => {
135882
135451
  const { getRoleGuidance: getRoleGuidance2 } = await Promise.resolve().then(() => (init_get_role_guidance(), exports_get_role_guidance));
135883
- await getRoleGuidance2(chatroomId2, { role });
135452
+ await getRoleGuidance2(chatroomId, { role });
135884
135453
  }
135885
135454
  });
135886
135455
  var telegramCommand = program2.command("telegram").description("Telegram integration commands");
@@ -135915,9 +135484,9 @@ opencodeCommand.command("install").description("Install chatroom as an OpenCode
135915
135484
  });
135916
135485
  program2.hook("preAction", async (_thisCommand, actionCommand) => {
135917
135486
  const opts = actionCommand.opts();
135918
- const chatroomId2 = opts["chatroomId"];
135487
+ const chatroomId = opts["chatroomId"];
135919
135488
  const role = opts["role"];
135920
- if (!chatroomId2 || !role)
135489
+ if (!chatroomId || !role)
135921
135490
  return;
135922
135491
  const { getSessionId: getSessionId2 } = await Promise.resolve().then(() => (init_storage(), exports_storage));
135923
135492
  const { getConvexClient: getConvexClient2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
@@ -135926,8 +135495,8 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
135926
135495
  if (!sessionId)
135927
135496
  return;
135928
135497
  const client4 = await getConvexClient2();
135929
- sendLifecycleHeartbeat2(client4, { sessionId, chatroomId: chatroomId2, role });
135498
+ sendLifecycleHeartbeat2(client4, { sessionId, chatroomId, role });
135930
135499
  });
135931
135500
  program2.parse();
135932
135501
 
135933
- //# debugId=A4A4E9F28A3DEB2964756E2164756E21
135502
+ //# debugId=CAC291D8342AA60364756E2164756E21