@adhdev/daemon-standalone 0.9.30 → 0.9.32
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 +123 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/{index-ClIg7ERo.js → index-B_SvdRkD.js} +23 -23
- package/public/index.html +1 -1
package/dist/index.js
CHANGED
|
@@ -28204,14 +28204,13 @@ var require_dist2 = __commonJS({
|
|
|
28204
28204
|
const shouldOutput = LEVEL_NUM[level] >= LEVEL_NUM[currentLevel];
|
|
28205
28205
|
const label = LEVEL_LABEL[level];
|
|
28206
28206
|
const line = `[${ts2()}] [${label}] [${category}] ${msg}`;
|
|
28207
|
+
if (!shouldOutput) return;
|
|
28207
28208
|
writeToFile(line);
|
|
28208
28209
|
ringBuffer.push({ ts: Date.now(), level, category, message: msg });
|
|
28209
28210
|
if (ringBuffer.length > RING_BUFFER_SIZE) {
|
|
28210
28211
|
ringBuffer.splice(0, ringBuffer.length - RING_BUFFER_SIZE);
|
|
28211
28212
|
}
|
|
28212
|
-
|
|
28213
|
-
origConsoleLog(line);
|
|
28214
|
-
}
|
|
28213
|
+
origConsoleLog(line);
|
|
28215
28214
|
}
|
|
28216
28215
|
function installGlobalInterceptor() {
|
|
28217
28216
|
if (interceptorInstalled) return;
|
|
@@ -30031,6 +30030,7 @@ var require_dist2 = __commonJS({
|
|
|
30031
30030
|
static STATUS_HOT_PATH_PARSE_MIN_INTERVAL_MS = 1e3;
|
|
30032
30031
|
static SCREEN_SNAPSHOT_MIN_INTERVAL_MS = 250;
|
|
30033
30032
|
static MAX_TRACE_ENTRIES = 250;
|
|
30033
|
+
static PARSE_MESSAGE_TAIL_LIMIT = 100;
|
|
30034
30034
|
providerResolutionMeta;
|
|
30035
30035
|
static FINISH_RETRY_DELAY_MS = 300;
|
|
30036
30036
|
static MAX_FINISH_RETRIES = 2;
|
|
@@ -30062,6 +30062,32 @@ var require_dist2 = __commonJS({
|
|
|
30062
30062
|
}
|
|
30063
30063
|
return null;
|
|
30064
30064
|
}
|
|
30065
|
+
selectParseBaseMessages(baseMessages) {
|
|
30066
|
+
if (baseMessages.length <= _ProviderCliAdapter.PARSE_MESSAGE_TAIL_LIMIT) return baseMessages;
|
|
30067
|
+
return baseMessages.slice(-_ProviderCliAdapter.PARSE_MESSAGE_TAIL_LIMIT);
|
|
30068
|
+
}
|
|
30069
|
+
messagesComparable(left, right) {
|
|
30070
|
+
if (!left || !right) return false;
|
|
30071
|
+
if ((left.role || "") !== (right.role || "")) return false;
|
|
30072
|
+
const leftText = normalizeComparableTranscriptText(left.content);
|
|
30073
|
+
const rightText = normalizeComparableTranscriptText(right.content);
|
|
30074
|
+
return !!leftText && leftText === rightText;
|
|
30075
|
+
}
|
|
30076
|
+
stitchParsedMessagesWithCommittedBase(parsedMessages, fullBaseMessages, parseBaseMessages) {
|
|
30077
|
+
if (!Array.isArray(parsedMessages) || parsedMessages.length === 0) return parsedMessages;
|
|
30078
|
+
if (fullBaseMessages.length <= parseBaseMessages.length) return parsedMessages;
|
|
30079
|
+
const parsedFirst = parsedMessages[0];
|
|
30080
|
+
const fullFirst = fullBaseMessages[0];
|
|
30081
|
+
if (parsedMessages.length >= fullBaseMessages.length && this.messagesComparable(parsedFirst, fullFirst)) {
|
|
30082
|
+
return parsedMessages;
|
|
30083
|
+
}
|
|
30084
|
+
const tailFirst = parseBaseMessages[0];
|
|
30085
|
+
if (tailFirst && this.messagesComparable(parsedFirst, tailFirst)) {
|
|
30086
|
+
const prefixLength = fullBaseMessages.length - parseBaseMessages.length;
|
|
30087
|
+
return [...fullBaseMessages.slice(0, prefixLength), ...parsedMessages];
|
|
30088
|
+
}
|
|
30089
|
+
return [...fullBaseMessages, ...parsedMessages];
|
|
30090
|
+
}
|
|
30065
30091
|
getIdleFinishConfirmMs() {
|
|
30066
30092
|
return this.timeouts.idleFinishConfirm;
|
|
30067
30093
|
}
|
|
@@ -30647,7 +30673,7 @@ var require_dist2 = __commonJS({
|
|
|
30647
30673
|
const ctx = { now, modal, status, parsedMessages, lastParsedAssistant, parsedStatus: parsedStatus || null, prevStatus };
|
|
30648
30674
|
if (!this.applyPendingScriptStatusDebounce(ctx)) return;
|
|
30649
30675
|
const recentInteractiveActivity = this.hasRecentInteractiveActivity(now);
|
|
30650
|
-
LOG2.
|
|
30676
|
+
LOG2.debug(
|
|
30651
30677
|
"CLI",
|
|
30652
30678
|
`[${this.cliType}] settled diagnostics prompt=${JSON.stringify(this.currentTurnScope?.prompt || "").slice(0, 140)} status=${String(status || "")} parsedStatus=${String(parsedStatus || "")} parsedMsgCount=${parsedMessages.length} lastParsedAssistant=${JSON.stringify(summarizeCliTraceText(lastParsedAssistant?.content || "", 120)).slice(0, 160)} responseBuffer=${JSON.stringify(summarizeCliTraceText(this.responseBuffer, 160)).slice(0, 220)} screen=${JSON.stringify(summarizeCliTraceText(screenText, 160)).slice(0, 220)}`
|
|
30653
30679
|
);
|
|
@@ -31014,18 +31040,26 @@ var require_dist2 = __commonJS({
|
|
|
31014
31040
|
try {
|
|
31015
31041
|
const screenText = this.terminalScreen.getText();
|
|
31016
31042
|
const tail = this.recentOutputBuffer.slice(-500);
|
|
31043
|
+
const parseBaseMessages = this.selectParseBaseMessages(this.committedMessages);
|
|
31017
31044
|
const input = buildCliParseInput({
|
|
31018
31045
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
31019
31046
|
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
31020
31047
|
recentOutputBuffer: this.recentOutputBuffer,
|
|
31021
31048
|
terminalScreenText: screenText,
|
|
31022
|
-
baseMessages:
|
|
31049
|
+
baseMessages: parseBaseMessages,
|
|
31023
31050
|
partialResponse: this.responseBuffer,
|
|
31024
31051
|
isWaitingForResponse: this.isWaitingForResponse,
|
|
31025
31052
|
scope: this.currentTurnScope,
|
|
31026
31053
|
runtimeSettings: this.runtimeSettings
|
|
31027
31054
|
});
|
|
31028
31055
|
const session = this.cliScripts.parseSession({ ...input, tail, tailScreen: buildCliScreenSnapshot(tail) });
|
|
31056
|
+
if (session && typeof session === "object" && Array.isArray(session.messages)) {
|
|
31057
|
+
session.messages = this.stitchParsedMessagesWithCommittedBase(
|
|
31058
|
+
session.messages,
|
|
31059
|
+
this.committedMessages,
|
|
31060
|
+
parseBaseMessages
|
|
31061
|
+
);
|
|
31062
|
+
}
|
|
31029
31063
|
this.parseErrorMessage = null;
|
|
31030
31064
|
return session && typeof session === "object" ? session : null;
|
|
31031
31065
|
} catch (e) {
|
|
@@ -31346,12 +31380,13 @@ var require_dist2 = __commonJS({
|
|
|
31346
31380
|
}
|
|
31347
31381
|
try {
|
|
31348
31382
|
const screenText = typeof screenTextOverride === "string" ? screenTextOverride : this.terminalScreen.getText();
|
|
31383
|
+
const parseBaseMessages = this.selectParseBaseMessages(baseMessages);
|
|
31349
31384
|
const input = buildCliParseInput({
|
|
31350
31385
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
31351
31386
|
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
31352
31387
|
recentOutputBuffer: this.recentOutputBuffer,
|
|
31353
31388
|
terminalScreenText: screenText,
|
|
31354
|
-
baseMessages,
|
|
31389
|
+
baseMessages: parseBaseMessages,
|
|
31355
31390
|
partialResponse,
|
|
31356
31391
|
isWaitingForResponse: this.isWaitingForResponse,
|
|
31357
31392
|
scope,
|
|
@@ -31363,6 +31398,11 @@ var require_dist2 = __commonJS({
|
|
|
31363
31398
|
}
|
|
31364
31399
|
const normalizedParsed = this.suppressStaleParsedApproval(parsed, input.recentBuffer, input.screenText);
|
|
31365
31400
|
if (normalizedParsed && Array.isArray(normalizedParsed.messages)) {
|
|
31401
|
+
normalizedParsed.messages = this.stitchParsedMessagesWithCommittedBase(
|
|
31402
|
+
normalizedParsed.messages,
|
|
31403
|
+
baseMessages,
|
|
31404
|
+
parseBaseMessages
|
|
31405
|
+
);
|
|
31366
31406
|
this.trimLastAssistantEcho(normalizedParsed.messages, scope?.prompt || getLastUserPromptText(baseMessages));
|
|
31367
31407
|
}
|
|
31368
31408
|
this.parseErrorMessage = null;
|
|
@@ -31972,7 +32012,7 @@ var require_dist2 = __commonJS({
|
|
|
31972
32012
|
DEFAULT_ACTIVE_CHAT_POLL_STATUSES: () => DEFAULT_ACTIVE_CHAT_POLL_STATUSES,
|
|
31973
32013
|
DEFAULT_CDP_DISCOVERY_INTERVAL_MS: () => DEFAULT_CDP_DISCOVERY_INTERVAL_MS,
|
|
31974
32014
|
DEFAULT_CDP_SCAN_INTERVAL_MS: () => DEFAULT_CDP_SCAN_INTERVAL_MS,
|
|
31975
|
-
DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS: () =>
|
|
32015
|
+
DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS: () => DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS2,
|
|
31976
32016
|
DEFAULT_DAEMON_PORT: () => DEFAULT_DAEMON_PORT,
|
|
31977
32017
|
DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS: () => DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS2,
|
|
31978
32018
|
DEFAULT_SESSION_HOST_APP_NAME: () => DEFAULT_SESSION_HOST_APP_NAME,
|
|
@@ -32955,7 +32995,7 @@ var require_dist2 = __commonJS({
|
|
|
32955
32995
|
"waiting_approval",
|
|
32956
32996
|
"starting"
|
|
32957
32997
|
]);
|
|
32958
|
-
var
|
|
32998
|
+
var DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS2 = 8e3;
|
|
32959
32999
|
var LIVE_RUNTIME_LIFECYCLES = /* @__PURE__ */ new Set(["starting", "running", "stopping", "interrupted"]);
|
|
32960
33000
|
function parseMessageTimestamp(value) {
|
|
32961
33001
|
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
@@ -32986,9 +33026,10 @@ var require_dist2 = __commonJS({
|
|
|
32986
33026
|
const now = options.now ?? Date.now();
|
|
32987
33027
|
const recentMessageGraceMs = Math.max(
|
|
32988
33028
|
0,
|
|
32989
|
-
Number.isFinite(options.recentMessageGraceMs) ? Number(options.recentMessageGraceMs) :
|
|
33029
|
+
Number.isFinite(options.recentMessageGraceMs) ? Number(options.recentMessageGraceMs) : DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS2
|
|
32990
33030
|
);
|
|
32991
33031
|
const activeStatuses = options.activeStatuses ?? DEFAULT_ACTIVE_CHAT_POLL_STATUSES;
|
|
33032
|
+
const activeSessionIds = options.activeSessionIds ?? /* @__PURE__ */ new Set();
|
|
32992
33033
|
const active = /* @__PURE__ */ new Set();
|
|
32993
33034
|
const excluded = /* @__PURE__ */ new Set();
|
|
32994
33035
|
for (const session of sessions) {
|
|
@@ -32998,6 +33039,10 @@ var require_dist2 = __commonJS({
|
|
|
32998
33039
|
excluded.add(sessionId);
|
|
32999
33040
|
continue;
|
|
33000
33041
|
}
|
|
33042
|
+
if (activeSessionIds.has(sessionId)) {
|
|
33043
|
+
active.add(sessionId);
|
|
33044
|
+
continue;
|
|
33045
|
+
}
|
|
33001
33046
|
const status = String(session?.status || "").toLowerCase();
|
|
33002
33047
|
const unread = session?.unread === true;
|
|
33003
33048
|
const inboxBucket = String(session?.inboxBucket || "").toLowerCase();
|
|
@@ -38483,6 +38528,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38483
38528
|
return { success: false, error: `${transport} adapter not found` };
|
|
38484
38529
|
}
|
|
38485
38530
|
if (isExtensionTransport(transport)) {
|
|
38531
|
+
let extensionReadChatError = "";
|
|
38486
38532
|
try {
|
|
38487
38533
|
const evalResult = await h.evaluateProviderScript("readChat", void 0, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
|
|
38488
38534
|
if (evalResult?.result) {
|
|
@@ -38490,7 +38536,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38490
38536
|
if (typeof parsed === "string") {
|
|
38491
38537
|
try {
|
|
38492
38538
|
parsed = JSON.parse(parsed);
|
|
38493
|
-
} catch {
|
|
38539
|
+
} catch (e) {
|
|
38540
|
+
extensionReadChatError = `extension read_chat parse failed: ${e?.message || String(e)}`;
|
|
38494
38541
|
}
|
|
38495
38542
|
}
|
|
38496
38543
|
if (parsed && typeof parsed === "object") {
|
|
@@ -38515,8 +38562,14 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38515
38562
|
);
|
|
38516
38563
|
return buildReadChatCommandResult(validated, args);
|
|
38517
38564
|
}
|
|
38565
|
+
if (!extensionReadChatError) {
|
|
38566
|
+
extensionReadChatError = "extension read_chat returned a non-object payload";
|
|
38567
|
+
}
|
|
38568
|
+
} else {
|
|
38569
|
+
extensionReadChatError = "extension read_chat returned no payload";
|
|
38518
38570
|
}
|
|
38519
38571
|
} catch (e) {
|
|
38572
|
+
extensionReadChatError = `extension read_chat failed: ${e?.message || String(e)}`;
|
|
38520
38573
|
_log(`Extension error: ${e.message}`);
|
|
38521
38574
|
traceProviderEvent(args, "provider", "extension.read_chat.error", {
|
|
38522
38575
|
h,
|
|
@@ -38530,8 +38583,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38530
38583
|
const parentSessionId = h.currentSession?.parentSessionId;
|
|
38531
38584
|
if (cdp2 && parentSessionId) {
|
|
38532
38585
|
const stream = await h.agentStream.collectActiveSession(cdp2, parentSessionId);
|
|
38533
|
-
if (stream
|
|
38534
|
-
return
|
|
38586
|
+
if (stream && stream.agentType !== provider?.type) {
|
|
38587
|
+
return { success: false, error: `extension read_chat stream agent mismatch for ${provider?.type || "unknown_extension"}` };
|
|
38535
38588
|
}
|
|
38536
38589
|
if (stream) {
|
|
38537
38590
|
h.historyWriter.appendNewMessages(
|
|
@@ -38549,12 +38602,13 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38549
38602
|
}
|
|
38550
38603
|
}
|
|
38551
38604
|
}
|
|
38552
|
-
return
|
|
38605
|
+
return { success: false, error: extensionReadChatError || "extension read_chat unavailable" };
|
|
38553
38606
|
}
|
|
38554
38607
|
const cdp = h.getCdp();
|
|
38555
38608
|
if (!cdp?.isConnected) return { success: false, error: "CDP not connected" };
|
|
38556
38609
|
const webviewScript = h.getProviderScript("webviewReadChat") || h.getProviderScript("webview_read_chat");
|
|
38557
38610
|
if (webviewScript) {
|
|
38611
|
+
let webviewReadChatError = "";
|
|
38558
38612
|
try {
|
|
38559
38613
|
const matchText = provider?.webviewMatchText;
|
|
38560
38614
|
const matchFn = matchText ? (body) => body.includes(matchText) : void 0;
|
|
@@ -38564,7 +38618,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38564
38618
|
if (typeof parsed === "string") {
|
|
38565
38619
|
try {
|
|
38566
38620
|
parsed = JSON.parse(parsed);
|
|
38567
|
-
} catch {
|
|
38621
|
+
} catch (e) {
|
|
38622
|
+
webviewReadChatError = `webview read_chat parse failed: ${e?.message || String(e)}`;
|
|
38568
38623
|
}
|
|
38569
38624
|
}
|
|
38570
38625
|
if (parsed && typeof parsed === "object") {
|
|
@@ -38579,14 +38634,21 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38579
38634
|
);
|
|
38580
38635
|
return buildReadChatCommandResult(validated, args);
|
|
38581
38636
|
}
|
|
38637
|
+
if (!webviewReadChatError) {
|
|
38638
|
+
webviewReadChatError = "webview read_chat returned a non-object payload";
|
|
38639
|
+
}
|
|
38640
|
+
} else {
|
|
38641
|
+
webviewReadChatError = "webview read_chat returned no payload";
|
|
38582
38642
|
}
|
|
38583
38643
|
} catch (e) {
|
|
38644
|
+
webviewReadChatError = `webview read_chat failed: ${e?.message || String(e)}`;
|
|
38584
38645
|
_log(`Webview readChat error: ${e.message}`);
|
|
38585
38646
|
}
|
|
38586
|
-
return
|
|
38647
|
+
return { success: false, error: webviewReadChatError || "webview read_chat unavailable" };
|
|
38587
38648
|
}
|
|
38588
38649
|
const script = h.getProviderScript("readChat") || h.getProviderScript("read_chat");
|
|
38589
38650
|
if (script) {
|
|
38651
|
+
let ideReadChatError = "";
|
|
38590
38652
|
try {
|
|
38591
38653
|
const evalResult = await h.evaluateProviderScript("readChat", void 0, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
|
|
38592
38654
|
if (evalResult?.result) {
|
|
@@ -38594,12 +38656,13 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38594
38656
|
if (typeof parsed === "string") {
|
|
38595
38657
|
try {
|
|
38596
38658
|
parsed = JSON.parse(parsed);
|
|
38597
|
-
} catch {
|
|
38659
|
+
} catch (e) {
|
|
38660
|
+
ideReadChatError = `ide read_chat parse failed: ${e?.message || String(e)}`;
|
|
38598
38661
|
}
|
|
38599
38662
|
}
|
|
38600
|
-
if (parsed && typeof parsed === "object"
|
|
38663
|
+
if (parsed && typeof parsed === "object") {
|
|
38601
38664
|
const validated = validateReadChatResultPayload(parsed, "ide read_chat");
|
|
38602
|
-
_log(`OK: ${validated.messages?.length} msgs`);
|
|
38665
|
+
_log(`OK: ${validated.messages?.length || 0} msgs`);
|
|
38603
38666
|
traceProviderEvent(args, "provider", "ide.read_chat.success", {
|
|
38604
38667
|
h,
|
|
38605
38668
|
provider,
|
|
@@ -38619,8 +38682,14 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38619
38682
|
);
|
|
38620
38683
|
return buildReadChatCommandResult(validated, args);
|
|
38621
38684
|
}
|
|
38685
|
+
if (!ideReadChatError) {
|
|
38686
|
+
ideReadChatError = "ide read_chat returned a non-object payload";
|
|
38687
|
+
}
|
|
38688
|
+
} else {
|
|
38689
|
+
ideReadChatError = "ide read_chat returned no payload";
|
|
38622
38690
|
}
|
|
38623
38691
|
} catch (e) {
|
|
38692
|
+
ideReadChatError = `ide read_chat failed: ${e?.message || String(e)}`;
|
|
38624
38693
|
LOG2.info("Command", `[read_chat] Script error: ${e.message}`);
|
|
38625
38694
|
traceProviderEvent(args, "provider", "ide.read_chat.error", {
|
|
38626
38695
|
h,
|
|
@@ -38629,8 +38698,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38629
38698
|
payload: { method: "evaluate", error: e.message }
|
|
38630
38699
|
});
|
|
38631
38700
|
}
|
|
38701
|
+
return { success: false, error: ideReadChatError || "ide read_chat unavailable" };
|
|
38632
38702
|
}
|
|
38633
|
-
return
|
|
38703
|
+
return { success: false, error: "read_chat unavailable" };
|
|
38634
38704
|
}
|
|
38635
38705
|
async function handleSendChat(h, args) {
|
|
38636
38706
|
const input = getSendChatInputEnvelope(args);
|
|
@@ -43834,6 +43904,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43834
43904
|
log(msg) {
|
|
43835
43905
|
this.logFn(`[ProviderLoader] ${msg}`);
|
|
43836
43906
|
}
|
|
43907
|
+
debugLog(msg) {
|
|
43908
|
+
LOG2.debug("Provider", `[ProviderLoader] ${msg}`);
|
|
43909
|
+
}
|
|
43837
43910
|
// ─── Public API ────────────────────────────────
|
|
43838
43911
|
/**
|
|
43839
43912
|
* User override root (~/.adhdev/providers by default).
|
|
@@ -44440,7 +44513,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44440
44513
|
const loaded = this.loadScriptsFromDir(type, entry.scriptDir);
|
|
44441
44514
|
if (loaded) {
|
|
44442
44515
|
resolved.scripts = loaded;
|
|
44443
|
-
this.
|
|
44516
|
+
this.debugLog(` [compatibility] ${type} v${currentVersion} \u2192 ${entry.scriptDir}`);
|
|
44444
44517
|
resolved._resolvedScriptDir = entry.scriptDir;
|
|
44445
44518
|
resolved._resolvedScriptsSource = `compatibility:${entry.ideVersion}`;
|
|
44446
44519
|
if (providerDir) {
|
|
@@ -44456,7 +44529,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44456
44529
|
const loaded = this.loadScriptsFromDir(type, base.defaultScriptDir);
|
|
44457
44530
|
if (loaded) {
|
|
44458
44531
|
resolved.scripts = loaded;
|
|
44459
|
-
this.
|
|
44532
|
+
this.debugLog(` [compatibility] ${type} v${currentVersion} \u2192 default: ${base.defaultScriptDir}`);
|
|
44460
44533
|
resolved._resolvedScriptDir = base.defaultScriptDir;
|
|
44461
44534
|
resolved._resolvedScriptsSource = "defaultScriptDir:version_miss";
|
|
44462
44535
|
if (providerDir) {
|
|
@@ -44491,7 +44564,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44491
44564
|
const loaded = this.loadScriptsFromDir(type, base.defaultScriptDir);
|
|
44492
44565
|
if (loaded) {
|
|
44493
44566
|
resolved.scripts = loaded;
|
|
44494
|
-
this.
|
|
44567
|
+
this.debugLog(` [compatibility] ${type} no version detected \u2192 default: ${base.defaultScriptDir}`);
|
|
44495
44568
|
resolved._resolvedScriptDir = base.defaultScriptDir;
|
|
44496
44569
|
resolved._resolvedScriptsSource = "defaultScriptDir:no_version";
|
|
44497
44570
|
if (providerDir) {
|
|
@@ -55511,6 +55584,8 @@ async function getWorkspaceSocketInfo(workspaceName) {
|
|
|
55511
55584
|
var import_daemon_core3 = __toESM(require_dist2());
|
|
55512
55585
|
var DEFAULT_PORT = 3847;
|
|
55513
55586
|
var STATUS_INTERVAL = 2e3;
|
|
55587
|
+
var CHAT_OUTPUT_ACTIVITY_HOT_MS = import_daemon_core3.DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS;
|
|
55588
|
+
var CHAT_OUTPUT_FLUSH_DEBOUNCE_MS = 700;
|
|
55514
55589
|
var STANDALONE_AUTH_SESSION_COOKIE = "adhdev_standalone_session";
|
|
55515
55590
|
var STANDALONE_PASSWORD_CONFIG_FILE = "standalone-auth.json";
|
|
55516
55591
|
var STANDALONE_PREFERENCES_CONFIG_FILE = "standalone-network.json";
|
|
@@ -55711,6 +55786,8 @@ var StandaloneServer = class {
|
|
|
55711
55786
|
wsChatFlushInFlight = false;
|
|
55712
55787
|
pendingWsChatFlush = null;
|
|
55713
55788
|
hotWsChatSessionIds = /* @__PURE__ */ new Set();
|
|
55789
|
+
wsChatOutputActiveAt = /* @__PURE__ */ new Map();
|
|
55790
|
+
wsChatOutputFlushTimer = null;
|
|
55714
55791
|
running = false;
|
|
55715
55792
|
components = null;
|
|
55716
55793
|
devServer = null;
|
|
@@ -55760,6 +55837,26 @@ var StandaloneServer = class {
|
|
|
55760
55837
|
const mode = this.getCliPresentationMode(sessionId);
|
|
55761
55838
|
return mode === "chat" || mode === "terminal";
|
|
55762
55839
|
}
|
|
55840
|
+
getRecentlyOutputActiveChatSessionIds(now) {
|
|
55841
|
+
const active = /* @__PURE__ */ new Set();
|
|
55842
|
+
for (const [sessionId, lastOutputAt] of this.wsChatOutputActiveAt) {
|
|
55843
|
+
if (now - lastOutputAt <= CHAT_OUTPUT_ACTIVITY_HOT_MS) {
|
|
55844
|
+
active.add(sessionId);
|
|
55845
|
+
} else {
|
|
55846
|
+
this.wsChatOutputActiveAt.delete(sessionId);
|
|
55847
|
+
}
|
|
55848
|
+
}
|
|
55849
|
+
return active;
|
|
55850
|
+
}
|
|
55851
|
+
markWsChatOutputActivity(sessionId) {
|
|
55852
|
+
if (!sessionId || !this.isCliSession(sessionId)) return;
|
|
55853
|
+
this.wsChatOutputActiveAt.set(sessionId, Date.now());
|
|
55854
|
+
if (this.wsChatOutputFlushTimer || this.clients.size === 0) return;
|
|
55855
|
+
this.wsChatOutputFlushTimer = setTimeout(() => {
|
|
55856
|
+
this.wsChatOutputFlushTimer = null;
|
|
55857
|
+
void this.flushWsChatSubscriptions(void 0, { onlyActive: true });
|
|
55858
|
+
}, CHAT_OUTPUT_FLUSH_DEBOUNCE_MS);
|
|
55859
|
+
}
|
|
55763
55860
|
hasPasswordAuth() {
|
|
55764
55861
|
return !!this.passwordConfig;
|
|
55765
55862
|
}
|
|
@@ -55857,6 +55954,7 @@ var StandaloneServer = class {
|
|
|
55857
55954
|
getP2p: () => ({
|
|
55858
55955
|
broadcastSessionOutput: (key, data) => {
|
|
55859
55956
|
if (this.clients.size === 0 || !this.isCliSession(key)) return;
|
|
55957
|
+
this.markWsChatOutputActivity(key);
|
|
55860
55958
|
const msg = JSON.stringify({ type: "session_output", sessionId: key, data });
|
|
55861
55959
|
for (const client of this.clients) {
|
|
55862
55960
|
if (client.readyState === 1) {
|
|
@@ -56617,10 +56715,12 @@ var StandaloneServer = class {
|
|
|
56617
56715
|
return prepared.update;
|
|
56618
56716
|
}
|
|
56619
56717
|
getHotChatSessionIdsForWsFlush() {
|
|
56718
|
+
const now = Date.now();
|
|
56620
56719
|
const snapshot = this.buildSharedSnapshot("live");
|
|
56621
56720
|
const hotSessions = (0, import_daemon_core3.classifyHotChatSessionsForSubscriptionFlush)(
|
|
56622
56721
|
snapshot.sessions,
|
|
56623
|
-
this.hotWsChatSessionIds
|
|
56722
|
+
this.hotWsChatSessionIds,
|
|
56723
|
+
{ now, activeSessionIds: this.getRecentlyOutputActiveChatSessionIds(now) }
|
|
56624
56724
|
);
|
|
56625
56725
|
this.hotWsChatSessionIds = hotSessions.active;
|
|
56626
56726
|
return hotSessions;
|