chatroom-cli 1.74.0 → 1.76.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 +67 -107
- package/dist/index.js.map +10 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -77540,8 +77540,11 @@ ${CODE_CHANGE_VERIFICATION_CONFIRMATION}
|
|
|
77540
77540
|
|
|
77541
77541
|
${getUnresolvedDecisionsSectionBlock()}
|
|
77542
77542
|
|
|
77543
|
-
## Notes
|
|
77544
|
-
<anything the user should know,
|
|
77543
|
+
## Notes
|
|
77544
|
+
<anything the user should know — context, caveats, or observations not covered above. Omit if none.>
|
|
77545
|
+
|
|
77546
|
+
## Next steps
|
|
77547
|
+
<follow-up actions for the user or team. Omit if none.>
|
|
77545
77548
|
\`\`\``;
|
|
77546
77549
|
}
|
|
77547
77550
|
var init_planner_to_user = __esm(() => {
|
|
@@ -77638,8 +77641,11 @@ ${CODE_CHANGE_VERIFICATION_CONFIRMATION}
|
|
|
77638
77641
|
|
|
77639
77642
|
${getUnresolvedDecisionsSectionBlock()}
|
|
77640
77643
|
|
|
77641
|
-
## Notes
|
|
77642
|
-
<anything the user should know,
|
|
77644
|
+
## Notes
|
|
77645
|
+
<anything the user should know — context, caveats, or observations not covered above. Omit if none.>
|
|
77646
|
+
|
|
77647
|
+
## Next steps
|
|
77648
|
+
<follow-up actions for the user or team. Omit if none.>
|
|
77643
77649
|
\`\`\``;
|
|
77644
77650
|
}
|
|
77645
77651
|
var init_solo_to_user = __esm(() => {
|
|
@@ -77856,70 +77862,6 @@ function formatDecodeError(error) {
|
|
|
77856
77862
|
return message;
|
|
77857
77863
|
}
|
|
77858
77864
|
|
|
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
77865
|
// ../../services/backend/prompts/native/session-continuity.ts
|
|
77924
77866
|
function getSessionContinuityLine(nativeIntegration) {
|
|
77925
77867
|
if (nativeIntegration) {
|
|
@@ -83849,6 +83791,19 @@ var init_featureFlags = __esm(() => {
|
|
|
83849
83791
|
};
|
|
83850
83792
|
});
|
|
83851
83793
|
|
|
83794
|
+
// ../../services/backend/config/reliability.ts
|
|
83795
|
+
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;
|
|
83796
|
+
var init_reliability = __esm(() => {
|
|
83797
|
+
DAEMON_HEARTBEAT_INTERVAL_MS = 5 * 60000;
|
|
83798
|
+
DAEMON_HEARTBEAT_TTL_MS = 6 * DAEMON_HEARTBEAT_INTERVAL_MS;
|
|
83799
|
+
OBSERVED_FULL_PUSH_INTERVAL_MS = 5 * 60000;
|
|
83800
|
+
OBSERVED_SYNC_RECONCILE_MS = 15 * 60000;
|
|
83801
|
+
WORKSPACE_RECENCY_WINDOW_MS = 7 * 24 * 60 * 60 * 1000;
|
|
83802
|
+
WORKSPACE_LIST_RECONCILE_MS = 60 * 60 * 1000;
|
|
83803
|
+
CONNECTION_CLOSE_REQUEST_TTL_MS = 10 * 60000;
|
|
83804
|
+
ENHANCER_TERMINAL_JOB_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
|
|
83805
|
+
});
|
|
83806
|
+
|
|
83852
83807
|
// src/commands/machine/daemon-start/command-event-types.ts
|
|
83853
83808
|
function isDaemonCommandEventType(value) {
|
|
83854
83809
|
return DAEMON_COMMAND_EVENT_TYPES.includes(value);
|
|
@@ -99290,7 +99245,7 @@ async function emitPhase(deps, event, phase, detail) {
|
|
|
99290
99245
|
detail
|
|
99291
99246
|
});
|
|
99292
99247
|
}
|
|
99293
|
-
function
|
|
99248
|
+
function sleep5(ms) {
|
|
99294
99249
|
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
99295
99250
|
}
|
|
99296
99251
|
async function waitForHarnessSessionId(deps, event, pid) {
|
|
@@ -99312,7 +99267,7 @@ async function waitForHarnessSessionId(deps, event, pid) {
|
|
|
99312
99267
|
if (slot?.harnessSessionId) {
|
|
99313
99268
|
return slot.harnessSessionId;
|
|
99314
99269
|
}
|
|
99315
|
-
await
|
|
99270
|
+
await sleep5(100);
|
|
99316
99271
|
}
|
|
99317
99272
|
await deps.session.backend.mutation(api.machines.emitHarnessSessionTimeout, {
|
|
99318
99273
|
sessionId: deps.session.sessionId,
|
|
@@ -100820,7 +100775,7 @@ function logWaitingForShutdown(pid) {
|
|
|
100820
100775
|
function logDaemonAlreadyRunning(pid) {
|
|
100821
100776
|
console.error(`❌ Daemon already running for ${getConvexUrl()} (PID: ${pid})`);
|
|
100822
100777
|
}
|
|
100823
|
-
async function waitForLockOrTimeout(deadline, intervalMs,
|
|
100778
|
+
async function waitForLockOrTimeout(deadline, intervalMs, sleep6) {
|
|
100824
100779
|
let loggedWait = false;
|
|
100825
100780
|
while (Date.now() < deadline) {
|
|
100826
100781
|
if (tryAcquireLock()) {
|
|
@@ -100831,16 +100786,16 @@ async function waitForLockOrTimeout(deadline, intervalMs, sleep7) {
|
|
|
100831
100786
|
logWaitingForShutdown(pid);
|
|
100832
100787
|
loggedWait = true;
|
|
100833
100788
|
}
|
|
100834
|
-
await
|
|
100789
|
+
await sleep6(intervalMs);
|
|
100835
100790
|
}
|
|
100836
100791
|
return false;
|
|
100837
100792
|
}
|
|
100838
100793
|
async function acquireLockWithRetry(options) {
|
|
100839
100794
|
const intervalMs = options?.intervalMs ?? LOCK_RETRY_INTERVAL_MS;
|
|
100840
100795
|
const maxWaitMs = options?.maxWaitMs ?? LOCK_RETRY_MAX_WAIT_MS;
|
|
100841
|
-
const
|
|
100796
|
+
const sleep6 = options?.sleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
|
|
100842
100797
|
const deadline = Date.now() + maxWaitMs;
|
|
100843
|
-
if (await waitForLockOrTimeout(deadline, intervalMs,
|
|
100798
|
+
if (await waitForLockOrTimeout(deadline, intervalMs, sleep6)) {
|
|
100844
100799
|
return true;
|
|
100845
100800
|
}
|
|
100846
100801
|
const { pid } = isDaemonRunning();
|
|
@@ -103394,7 +103349,6 @@ class BufferedJournalFactory {
|
|
|
103394
103349
|
return;
|
|
103395
103350
|
flushInProgress = true;
|
|
103396
103351
|
const batch = buffer.splice(0);
|
|
103397
|
-
console.log(`[journal] Flushing ${batch.length} chunks for session ${harnessSessionId}`);
|
|
103398
103352
|
outputRepository.appendChunks(harnessSessionId, batch).catch((err) => {
|
|
103399
103353
|
buffer.unshift(...batch);
|
|
103400
103354
|
logger.warn(`[journal] Flush FAILED for ${harnessSessionId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -103413,7 +103367,6 @@ class BufferedJournalFactory {
|
|
|
103413
103367
|
messageId: chunk2.messageId,
|
|
103414
103368
|
partType: chunk2.partType
|
|
103415
103369
|
});
|
|
103416
|
-
logger.log?.(`[journal] chunk recorded session=${harnessSessionId} messageId=${chunk2.messageId ?? "-"} partType=${chunk2.partType ?? "text"} bytes=${chunk2.content.length}`);
|
|
103417
103370
|
},
|
|
103418
103371
|
async flush() {
|
|
103419
103372
|
await waitForInProgress();
|
|
@@ -103839,6 +103792,19 @@ var init_start_subscriptions2 = __esm(() => {
|
|
|
103839
103792
|
// src/commands/machine/daemon-start/enhancer/constants.ts
|
|
103840
103793
|
var ENHANCER_AGENT_ROLE = "enhancer";
|
|
103841
103794
|
|
|
103795
|
+
// src/commands/machine/daemon-start/enhancer/enhancer-log.ts
|
|
103796
|
+
function formatEnhancerLogLine(message) {
|
|
103797
|
+
const trimmed = message.trimEnd();
|
|
103798
|
+
if (trimmed.startsWith(ENHANCER_LOG_PREFIX))
|
|
103799
|
+
return trimmed;
|
|
103800
|
+
return `${ENHANCER_LOG_PREFIX} ${trimmed}`;
|
|
103801
|
+
}
|
|
103802
|
+
function writeEnhancerLog(message) {
|
|
103803
|
+
process.stdout.write(`${formatEnhancerLogLine(message)}
|
|
103804
|
+
`);
|
|
103805
|
+
}
|
|
103806
|
+
var ENHANCER_LOG_PREFIX = "[enhancer]";
|
|
103807
|
+
|
|
103842
103808
|
// src/commands/machine/daemon-start/enhancer/job-subscriber.ts
|
|
103843
103809
|
function startEnhancerJobSubscriber(sessionId, machineId, convexUrl, backend2, wsClient2, agentServices) {
|
|
103844
103810
|
const inFlight = new Set;
|
|
@@ -103860,12 +103826,14 @@ function startEnhancerJobSubscriber(sessionId, machineId, convexUrl, backend2, w
|
|
|
103860
103826
|
if (!claim.claimed)
|
|
103861
103827
|
return;
|
|
103862
103828
|
claimed = true;
|
|
103829
|
+
writeEnhancerLog(`claimed job=${job.jobId} chatroom=${job.chatroomId}`);
|
|
103863
103830
|
const payload = await backend2.query(api.daemon.enhancer.index.getSpawnPayload, {
|
|
103864
103831
|
sessionId,
|
|
103865
103832
|
jobId: job.jobId
|
|
103866
103833
|
});
|
|
103867
103834
|
chatroomId = payload.chatroomId;
|
|
103868
103835
|
jobId = payload.jobId;
|
|
103836
|
+
writeEnhancerLog(`spawning harness=${payload.agentHarness} model=${payload.model} job=${payload.jobId}`);
|
|
103869
103837
|
const service3 = agentServices.get(payload.agentHarness);
|
|
103870
103838
|
if (!service3) {
|
|
103871
103839
|
await backend2.mutation(api.web.enhancer.index.recordAttemptFailure, {
|
|
@@ -103888,6 +103856,13 @@ function startEnhancerJobSubscriber(sessionId, machineId, convexUrl, backend2, w
|
|
|
103888
103856
|
},
|
|
103889
103857
|
resolvedConvexUrl: convexUrl
|
|
103890
103858
|
});
|
|
103859
|
+
spawnResult.onLogLine?.((line) => {
|
|
103860
|
+
writeEnhancerLog(line);
|
|
103861
|
+
});
|
|
103862
|
+
spawnResult.onAssistantText?.((text) => {
|
|
103863
|
+
if (text)
|
|
103864
|
+
writeEnhancerLog(`text] ${text}`);
|
|
103865
|
+
});
|
|
103891
103866
|
await new Promise((resolve4) => {
|
|
103892
103867
|
spawnResult.onExit(() => resolve4());
|
|
103893
103868
|
});
|
|
@@ -103896,6 +103871,9 @@ function startEnhancerJobSubscriber(sessionId, machineId, convexUrl, backend2, w
|
|
|
103896
103871
|
chatroomId: payload.chatroomId,
|
|
103897
103872
|
jobId: payload.jobId
|
|
103898
103873
|
});
|
|
103874
|
+
if (status3?.status === "complete") {
|
|
103875
|
+
writeEnhancerLog(`completed job=${payload.jobId}`);
|
|
103876
|
+
}
|
|
103899
103877
|
if (status3?.status === "running") {
|
|
103900
103878
|
await backend2.mutation(api.web.enhancer.index.recordAttemptFailure, {
|
|
103901
103879
|
sessionId,
|
|
@@ -103905,7 +103883,7 @@ function startEnhancerJobSubscriber(sessionId, machineId, convexUrl, backend2, w
|
|
|
103905
103883
|
});
|
|
103906
103884
|
}
|
|
103907
103885
|
} catch (err) {
|
|
103908
|
-
|
|
103886
|
+
writeEnhancerLog(`error: ${err instanceof Error ? err.message : String(err)}`);
|
|
103909
103887
|
if (claimed) {
|
|
103910
103888
|
await backend2.mutation(api.web.enhancer.index.recordAttemptFailure, {
|
|
103911
103889
|
sessionId,
|
|
@@ -115694,7 +115672,6 @@ handoffCommandGroup.requiredOption("--chatroom-id <id>", "Chatroom identifier").
|
|
|
115694
115672
|
const { api: api3 } = await Promise.resolve().then(() => (init_api3(), exports_api));
|
|
115695
115673
|
const { getConvexClient: getConvexClient2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
|
|
115696
115674
|
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
115675
|
const client4 = await getConvexClient2();
|
|
115699
115676
|
const sessionId = await getSessionId2();
|
|
115700
115677
|
if (sessionId) {
|
|
@@ -115704,40 +115681,23 @@ handoffCommandGroup.requiredOption("--chatroom-id <id>", "Chatroom identifier").
|
|
|
115704
115681
|
chatroomId: options.chatroomId
|
|
115705
115682
|
});
|
|
115706
115683
|
if (config4 && config4.enabled) {
|
|
115707
|
-
|
|
115684
|
+
await client4.mutation(api3.web.enhancer.index.enqueueHandoff, {
|
|
115708
115685
|
sessionId,
|
|
115709
115686
|
chatroomId: options.chatroomId,
|
|
115710
115687
|
senderRole: options.role,
|
|
115711
115688
|
targetRole: options.nextRole,
|
|
115712
115689
|
content: message
|
|
115713
115690
|
});
|
|
115714
|
-
const
|
|
115715
|
-
const
|
|
115716
|
-
|
|
115717
|
-
|
|
115718
|
-
|
|
115719
|
-
|
|
115720
|
-
|
|
115721
|
-
|
|
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
|
-
}
|
|
115691
|
+
const { generateHandoffOutput: generateHandoffOutput2 } = await Promise.resolve().then(() => (init_generator(), exports_generator));
|
|
115692
|
+
const { getConvexUrl: getConvexUrl2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
|
|
115693
|
+
const convexUrl = await getConvexUrl2();
|
|
115694
|
+
console.log(generateHandoffOutput2({
|
|
115695
|
+
role: options.role,
|
|
115696
|
+
nextRole: options.nextRole,
|
|
115697
|
+
chatroomId: options.chatroomId,
|
|
115698
|
+
convexUrl
|
|
115699
|
+
}));
|
|
115700
|
+
return;
|
|
115741
115701
|
}
|
|
115742
115702
|
} catch (err) {
|
|
115743
115703
|
const error51 = err;
|
|
@@ -116092,4 +116052,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
|
116092
116052
|
});
|
|
116093
116053
|
program2.parse();
|
|
116094
116054
|
|
|
116095
|
-
//# debugId=
|
|
116055
|
+
//# debugId=7F5BB9A13B1C8A7564756E2164756E21
|