chatroom-cli 1.74.0 → 1.75.0

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
@@ -77856,70 +77856,6 @@ function formatDecodeError(error) {
77856
77856
  return message;
77857
77857
  }
77858
77858
 
77859
- // ../../services/backend/config/reliability.ts
77860
- var HARNESS_SESSION_READY_TIMEOUT_MS = 5000, NATIVE_DELIVERY_RECONCILE_MS = 1e4, DAEMON_HEARTBEAT_INTERVAL_MS, DAEMON_HEARTBEAT_TTL_MS, AGENT_REQUEST_DEADLINE_MS = 120000, OBSERVED_FULL_PUSH_INTERVAL_MS, OBSERVED_SAFETY_POLL_MS = 30000, OBSERVED_SYNC_RECONCILE_MS, WORKSPACE_RECENCY_WINDOW_MS, WORKSPACE_LIST_RECONCILE_MS, CONNECTION_CLOSE_REQUEST_TTL_MS, ENHANCER_ATTEMPT_TIMEOUT_MS = 120000, ENHANCER_TERMINAL_JOB_RETENTION_MS, ENHANCER_CLI_POLL_INTERVAL_MS = 1000;
77861
- var init_reliability = __esm(() => {
77862
- DAEMON_HEARTBEAT_INTERVAL_MS = 5 * 60000;
77863
- DAEMON_HEARTBEAT_TTL_MS = 6 * DAEMON_HEARTBEAT_INTERVAL_MS;
77864
- OBSERVED_FULL_PUSH_INTERVAL_MS = 5 * 60000;
77865
- OBSERVED_SYNC_RECONCILE_MS = 15 * 60000;
77866
- WORKSPACE_RECENCY_WINDOW_MS = 7 * 24 * 60 * 60 * 1000;
77867
- WORKSPACE_LIST_RECONCILE_MS = 60 * 60 * 1000;
77868
- CONNECTION_CLOSE_REQUEST_TTL_MS = 10 * 60000;
77869
- ENHANCER_TERMINAL_JOB_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
77870
- });
77871
-
77872
- // src/commands/enhancer/wait-for-job.ts
77873
- var exports_wait_for_job = {};
77874
- __export(exports_wait_for_job, {
77875
- waitForEnhancerJob: () => waitForEnhancerJob
77876
- });
77877
- async function waitForEnhancerJob(chatroomId, jobId, deps) {
77878
- const sessionId = await deps.getSessionId();
77879
- if (!sessionId) {
77880
- throw new Error("Not authenticated");
77881
- }
77882
- while (true) {
77883
- const job = await deps.query(deps.endpoints.getJob, {
77884
- sessionId,
77885
- chatroomId,
77886
- jobId
77887
- });
77888
- if (!job) {
77889
- throw new Error("Enhancer job not found");
77890
- }
77891
- if (job.status === "complete") {
77892
- return "complete";
77893
- }
77894
- if (job.status === "cancelled") {
77895
- return "cancelled";
77896
- }
77897
- if (job.status === "failed") {
77898
- return "failed";
77899
- }
77900
- if (job.status === "running" && job.runningSince) {
77901
- const elapsed3 = Date.now() - job.runningSince;
77902
- if (elapsed3 > ENHANCER_ATTEMPT_TIMEOUT_MS) {
77903
- await deps.mutation(deps.endpoints.recordAttemptFailure, {
77904
- sessionId,
77905
- chatroomId,
77906
- jobId,
77907
- error: "Attempt timed out"
77908
- });
77909
- await sleep5(ENHANCER_CLI_POLL_INTERVAL_MS);
77910
- continue;
77911
- }
77912
- }
77913
- await sleep5(ENHANCER_CLI_POLL_INTERVAL_MS);
77914
- }
77915
- }
77916
- function sleep5(ms) {
77917
- return new Promise((resolve3) => setTimeout(resolve3, ms));
77918
- }
77919
- var init_wait_for_job = __esm(() => {
77920
- init_reliability();
77921
- });
77922
-
77923
77859
  // ../../services/backend/prompts/native/session-continuity.ts
77924
77860
  function getSessionContinuityLine(nativeIntegration) {
77925
77861
  if (nativeIntegration) {
@@ -83849,6 +83785,19 @@ var init_featureFlags = __esm(() => {
83849
83785
  };
83850
83786
  });
83851
83787
 
83788
+ // ../../services/backend/config/reliability.ts
83789
+ var HARNESS_SESSION_READY_TIMEOUT_MS = 5000, NATIVE_DELIVERY_RECONCILE_MS = 1e4, DAEMON_HEARTBEAT_INTERVAL_MS, DAEMON_HEARTBEAT_TTL_MS, AGENT_REQUEST_DEADLINE_MS = 120000, OBSERVED_FULL_PUSH_INTERVAL_MS, OBSERVED_SAFETY_POLL_MS = 30000, OBSERVED_SYNC_RECONCILE_MS, WORKSPACE_RECENCY_WINDOW_MS, WORKSPACE_LIST_RECONCILE_MS, CONNECTION_CLOSE_REQUEST_TTL_MS, ENHANCER_TERMINAL_JOB_RETENTION_MS;
83790
+ var init_reliability = __esm(() => {
83791
+ DAEMON_HEARTBEAT_INTERVAL_MS = 5 * 60000;
83792
+ DAEMON_HEARTBEAT_TTL_MS = 6 * DAEMON_HEARTBEAT_INTERVAL_MS;
83793
+ OBSERVED_FULL_PUSH_INTERVAL_MS = 5 * 60000;
83794
+ OBSERVED_SYNC_RECONCILE_MS = 15 * 60000;
83795
+ WORKSPACE_RECENCY_WINDOW_MS = 7 * 24 * 60 * 60 * 1000;
83796
+ WORKSPACE_LIST_RECONCILE_MS = 60 * 60 * 1000;
83797
+ CONNECTION_CLOSE_REQUEST_TTL_MS = 10 * 60000;
83798
+ ENHANCER_TERMINAL_JOB_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
83799
+ });
83800
+
83852
83801
  // src/commands/machine/daemon-start/command-event-types.ts
83853
83802
  function isDaemonCommandEventType(value) {
83854
83803
  return DAEMON_COMMAND_EVENT_TYPES.includes(value);
@@ -99290,7 +99239,7 @@ async function emitPhase(deps, event, phase, detail) {
99290
99239
  detail
99291
99240
  });
99292
99241
  }
99293
- function sleep6(ms) {
99242
+ function sleep5(ms) {
99294
99243
  return new Promise((resolve4) => setTimeout(resolve4, ms));
99295
99244
  }
99296
99245
  async function waitForHarnessSessionId(deps, event, pid) {
@@ -99312,7 +99261,7 @@ async function waitForHarnessSessionId(deps, event, pid) {
99312
99261
  if (slot?.harnessSessionId) {
99313
99262
  return slot.harnessSessionId;
99314
99263
  }
99315
- await sleep6(100);
99264
+ await sleep5(100);
99316
99265
  }
99317
99266
  await deps.session.backend.mutation(api.machines.emitHarnessSessionTimeout, {
99318
99267
  sessionId: deps.session.sessionId,
@@ -100820,7 +100769,7 @@ function logWaitingForShutdown(pid) {
100820
100769
  function logDaemonAlreadyRunning(pid) {
100821
100770
  console.error(`❌ Daemon already running for ${getConvexUrl()} (PID: ${pid})`);
100822
100771
  }
100823
- async function waitForLockOrTimeout(deadline, intervalMs, sleep7) {
100772
+ async function waitForLockOrTimeout(deadline, intervalMs, sleep6) {
100824
100773
  let loggedWait = false;
100825
100774
  while (Date.now() < deadline) {
100826
100775
  if (tryAcquireLock()) {
@@ -100831,16 +100780,16 @@ async function waitForLockOrTimeout(deadline, intervalMs, sleep7) {
100831
100780
  logWaitingForShutdown(pid);
100832
100781
  loggedWait = true;
100833
100782
  }
100834
- await sleep7(intervalMs);
100783
+ await sleep6(intervalMs);
100835
100784
  }
100836
100785
  return false;
100837
100786
  }
100838
100787
  async function acquireLockWithRetry(options) {
100839
100788
  const intervalMs = options?.intervalMs ?? LOCK_RETRY_INTERVAL_MS;
100840
100789
  const maxWaitMs = options?.maxWaitMs ?? LOCK_RETRY_MAX_WAIT_MS;
100841
- const sleep7 = options?.sleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
100790
+ const sleep6 = options?.sleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
100842
100791
  const deadline = Date.now() + maxWaitMs;
100843
- if (await waitForLockOrTimeout(deadline, intervalMs, sleep7)) {
100792
+ if (await waitForLockOrTimeout(deadline, intervalMs, sleep6)) {
100844
100793
  return true;
100845
100794
  }
100846
100795
  const { pid } = isDaemonRunning();
@@ -103888,6 +103837,10 @@ function startEnhancerJobSubscriber(sessionId, machineId, convexUrl, backend2, w
103888
103837
  },
103889
103838
  resolvedConvexUrl: convexUrl
103890
103839
  });
103840
+ spawnResult.onLogLine?.((line) => {
103841
+ process.stdout.write(`${line}
103842
+ `);
103843
+ });
103891
103844
  await new Promise((resolve4) => {
103892
103845
  spawnResult.onExit(() => resolve4());
103893
103846
  });
@@ -115694,7 +115647,6 @@ handoffCommandGroup.requiredOption("--chatroom-id <id>", "Chatroom identifier").
115694
115647
  const { api: api3 } = await Promise.resolve().then(() => (init_api3(), exports_api));
115695
115648
  const { getConvexClient: getConvexClient2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
115696
115649
  const { getSessionId: getSessionId2 } = await Promise.resolve().then(() => (init_storage(), exports_storage));
115697
- const { waitForEnhancerJob: waitForEnhancerJob2 } = await Promise.resolve().then(() => (init_wait_for_job(), exports_wait_for_job));
115698
115650
  const client4 = await getConvexClient2();
115699
115651
  const sessionId = await getSessionId2();
115700
115652
  if (sessionId) {
@@ -115704,40 +115656,23 @@ handoffCommandGroup.requiredOption("--chatroom-id <id>", "Chatroom identifier").
115704
115656
  chatroomId: options.chatroomId
115705
115657
  });
115706
115658
  if (config4 && config4.enabled) {
115707
- const result = await client4.mutation(api3.web.enhancer.index.enqueueHandoff, {
115659
+ await client4.mutation(api3.web.enhancer.index.enqueueHandoff, {
115708
115660
  sessionId,
115709
115661
  chatroomId: options.chatroomId,
115710
115662
  senderRole: options.role,
115711
115663
  targetRole: options.nextRole,
115712
115664
  content: message
115713
115665
  });
115714
- const jobId = result.jobId;
115715
- const outcome = await waitForEnhancerJob2(options.chatroomId, jobId, {
115716
- query: (endpoint, args2) => client4.query(endpoint, args2),
115717
- mutation: (endpoint, args2) => client4.mutation(endpoint, args2),
115718
- getSessionId: () => Promise.resolve(sessionId),
115719
- endpoints: {
115720
- getJob: api3.web.enhancer.index.getJob,
115721
- recordAttemptFailure: api3.web.enhancer.index.recordAttemptFailure
115722
- }
115723
- });
115724
- if (outcome === "failed") {
115725
- console.error(`
115726
- ❌ ERROR: Enhancer failed after all retries. No handoff was delivered.`);
115727
- process.exit(1);
115728
- }
115729
- if (outcome === "cancelled" || outcome === "complete") {
115730
- const { generateHandoffOutput: generateHandoffOutput2 } = await Promise.resolve().then(() => (init_generator(), exports_generator));
115731
- const { getConvexUrl: getConvexUrl2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
115732
- const convexUrl = await getConvexUrl2();
115733
- console.log(generateHandoffOutput2({
115734
- role: options.role,
115735
- nextRole: options.nextRole,
115736
- chatroomId: options.chatroomId,
115737
- convexUrl
115738
- }));
115739
- return;
115740
- }
115666
+ const { generateHandoffOutput: generateHandoffOutput2 } = await Promise.resolve().then(() => (init_generator(), exports_generator));
115667
+ const { getConvexUrl: getConvexUrl2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
115668
+ const convexUrl = await getConvexUrl2();
115669
+ console.log(generateHandoffOutput2({
115670
+ role: options.role,
115671
+ nextRole: options.nextRole,
115672
+ chatroomId: options.chatroomId,
115673
+ convexUrl
115674
+ }));
115675
+ return;
115741
115676
  }
115742
115677
  } catch (err) {
115743
115678
  const error51 = err;
@@ -116092,4 +116027,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
116092
116027
  });
116093
116028
  program2.parse();
116094
116029
 
116095
- //# debugId=594320A213AD613364756E2164756E21
116030
+ //# debugId=84E53044E3B850A464756E2164756E21