@adhdev/daemon-standalone 0.8.82 → 0.8.83
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 +133 -75
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-B20P8eXh.js +79 -0
- package/public/assets/index-CEEcXMM_.css +1 -0
- package/public/index.html +2 -2
- package/vendor/session-host-daemon/index.js +13 -1
- package/vendor/session-host-daemon/index.js.map +1 -1
- package/vendor/session-host-daemon/index.mjs +14 -3
- package/vendor/session-host-daemon/index.mjs.map +1 -1
- package/public/assets/index-CZ5HGYXl.js +0 -72
- package/public/assets/index-aSH26MZ8.css +0 -1
package/dist/index.js
CHANGED
|
@@ -28806,6 +28806,59 @@ var require_dist2 = __commonJS({
|
|
|
28806
28806
|
VALID_ROLES = ["user", "assistant", "system", "human"];
|
|
28807
28807
|
}
|
|
28808
28808
|
});
|
|
28809
|
+
function normalizeCategories(categories) {
|
|
28810
|
+
if (!Array.isArray(categories)) return [];
|
|
28811
|
+
return categories.map((category) => String(category || "").trim()).filter(Boolean);
|
|
28812
|
+
}
|
|
28813
|
+
function resolveDebugRuntimeConfig(options = {}) {
|
|
28814
|
+
const dev = options.dev === true;
|
|
28815
|
+
return {
|
|
28816
|
+
logLevel: options.logLevel || (dev ? "debug" : DEFAULT_CONFIG2.logLevel),
|
|
28817
|
+
collectDebugTrace: typeof options.trace === "boolean" ? options.trace : dev,
|
|
28818
|
+
traceContent: options.traceContent === true,
|
|
28819
|
+
traceBufferSize: Number.isFinite(options.traceBufferSize) ? Math.max(10, Math.floor(options.traceBufferSize)) : dev ? DEV_TRACE_BUFFER_SIZE : DEFAULT_CONFIG2.traceBufferSize,
|
|
28820
|
+
traceCategories: normalizeCategories(options.traceCategories)
|
|
28821
|
+
};
|
|
28822
|
+
}
|
|
28823
|
+
function setDebugRuntimeConfig(config2) {
|
|
28824
|
+
currentConfig = {
|
|
28825
|
+
...config2,
|
|
28826
|
+
traceCategories: normalizeCategories(config2.traceCategories),
|
|
28827
|
+
traceBufferSize: Math.max(10, Math.floor(config2.traceBufferSize || DEFAULT_CONFIG2.traceBufferSize))
|
|
28828
|
+
};
|
|
28829
|
+
}
|
|
28830
|
+
function getDebugRuntimeConfig() {
|
|
28831
|
+
return { ...currentConfig, traceCategories: [...currentConfig.traceCategories] };
|
|
28832
|
+
}
|
|
28833
|
+
function resetDebugRuntimeConfig() {
|
|
28834
|
+
currentConfig = { ...DEFAULT_CONFIG2 };
|
|
28835
|
+
}
|
|
28836
|
+
function shouldCollectTraceCategory(category) {
|
|
28837
|
+
const config2 = currentConfig;
|
|
28838
|
+
if (!config2.collectDebugTrace) return false;
|
|
28839
|
+
if (!category) return true;
|
|
28840
|
+
if (config2.traceCategories.length === 0) return true;
|
|
28841
|
+
return config2.traceCategories.includes(category);
|
|
28842
|
+
}
|
|
28843
|
+
var NORMAL_TRACE_BUFFER_SIZE;
|
|
28844
|
+
var DEV_TRACE_BUFFER_SIZE;
|
|
28845
|
+
var DEFAULT_CONFIG2;
|
|
28846
|
+
var currentConfig;
|
|
28847
|
+
var init_debug_config = __esm2({
|
|
28848
|
+
"src/logging/debug-config.ts"() {
|
|
28849
|
+
"use strict";
|
|
28850
|
+
NORMAL_TRACE_BUFFER_SIZE = 200;
|
|
28851
|
+
DEV_TRACE_BUFFER_SIZE = 1e3;
|
|
28852
|
+
DEFAULT_CONFIG2 = {
|
|
28853
|
+
logLevel: "info",
|
|
28854
|
+
collectDebugTrace: false,
|
|
28855
|
+
traceContent: false,
|
|
28856
|
+
traceBufferSize: NORMAL_TRACE_BUFFER_SIZE,
|
|
28857
|
+
traceCategories: []
|
|
28858
|
+
};
|
|
28859
|
+
currentConfig = { ...DEFAULT_CONFIG2 };
|
|
28860
|
+
}
|
|
28861
|
+
});
|
|
28809
28862
|
function isModuleNotFoundError(error48, ref) {
|
|
28810
28863
|
if (!(error48 instanceof Error)) return false;
|
|
28811
28864
|
const message = error48.message || "";
|
|
@@ -29003,10 +29056,12 @@ var require_dist2 = __commonJS({
|
|
|
29003
29056
|
if (loggedTerminalBackends.has(key)) return;
|
|
29004
29057
|
loggedTerminalBackends.add(key);
|
|
29005
29058
|
if (backendKind === "xterm" && preference !== "xterm" && !ghosttyAvailable) {
|
|
29006
|
-
|
|
29007
|
-
|
|
29008
|
-
|
|
29009
|
-
|
|
29059
|
+
const message = `[terminal-screen] ghostty-vt unavailable; using xterm fallback (preference=${preference})`;
|
|
29060
|
+
if (preference === "auto") {
|
|
29061
|
+
LOG2.info("Terminal", message);
|
|
29062
|
+
} else {
|
|
29063
|
+
LOG2.warn("Terminal", message);
|
|
29064
|
+
}
|
|
29010
29065
|
return;
|
|
29011
29066
|
}
|
|
29012
29067
|
LOG2.info(
|
|
@@ -29654,6 +29709,7 @@ var require_dist2 = __commonJS({
|
|
|
29654
29709
|
"use strict";
|
|
29655
29710
|
os10 = __toESM2(require("os"));
|
|
29656
29711
|
init_logger();
|
|
29712
|
+
init_debug_config();
|
|
29657
29713
|
init_terminal_screen();
|
|
29658
29714
|
init_pty_transport();
|
|
29659
29715
|
init_provider_cli_shared();
|
|
@@ -29687,7 +29743,15 @@ var require_dist2 = __commonJS({
|
|
|
29687
29743
|
`[${this.cliType}] Provider resolution: providerDir=${this.providerResolutionMeta.providerDir || "-"} scriptDir=${this.providerResolutionMeta.scriptDir || "-"} scriptsPath=${this.providerResolutionMeta.scriptsPath || "-"} source=${this.providerResolutionMeta.scriptsSource || "-"} version=${this.providerResolutionMeta.resolvedVersion || "-"}`
|
|
29688
29744
|
);
|
|
29689
29745
|
} else {
|
|
29690
|
-
|
|
29746
|
+
const resolutionSummary = `providerDir=${this.providerResolutionMeta.providerDir || "-"} scriptDir=${this.providerResolutionMeta.scriptDir || "-"} scriptsPath=${this.providerResolutionMeta.scriptsPath || "-"} source=${this.providerResolutionMeta.scriptsSource || "-"} version=${this.providerResolutionMeta.resolvedVersion || "-"}`;
|
|
29747
|
+
const hasResolvedProviderScripts = Boolean(
|
|
29748
|
+
this.providerResolutionMeta.providerDir || this.providerResolutionMeta.scriptDir || this.providerResolutionMeta.scriptsPath || this.providerResolutionMeta.scriptsSource || this.providerResolutionMeta.resolvedVersion
|
|
29749
|
+
);
|
|
29750
|
+
if (hasResolvedProviderScripts) {
|
|
29751
|
+
LOG2.warn("CLI", `[${this.cliType}] \u26A0 No CLI scripts loaded! Provider needs scripts/{version}/scripts.js (${resolutionSummary})`);
|
|
29752
|
+
} else {
|
|
29753
|
+
LOG2.info("CLI", `[${this.cliType}] CLI scripts not yet resolved (${resolutionSummary})`);
|
|
29754
|
+
}
|
|
29691
29755
|
}
|
|
29692
29756
|
}
|
|
29693
29757
|
cliType;
|
|
@@ -29766,7 +29830,8 @@ var require_dist2 = __commonJS({
|
|
|
29766
29830
|
currentTurnScope = null;
|
|
29767
29831
|
traceEntries = [];
|
|
29768
29832
|
traceSeq = 0;
|
|
29769
|
-
traceSessionId =
|
|
29833
|
+
traceSessionId = "";
|
|
29834
|
+
parsedStatusCache = null;
|
|
29770
29835
|
static MAX_TRACE_ENTRIES = 250;
|
|
29771
29836
|
providerResolutionMeta;
|
|
29772
29837
|
static FINISH_RETRY_DELAY_MS = 300;
|
|
@@ -30007,7 +30072,8 @@ var require_dist2 = __commonJS({
|
|
|
30007
30072
|
this.terminalScreen.write(rawData);
|
|
30008
30073
|
const cleanData = sanitizeTerminalText(rawData);
|
|
30009
30074
|
const now = Date.now();
|
|
30010
|
-
const
|
|
30075
|
+
const screenText = this.terminalScreen.getText();
|
|
30076
|
+
const normalizedScreenSnapshot = normalizeScreenSnapshot(screenText);
|
|
30011
30077
|
this.lastOutputAt = now;
|
|
30012
30078
|
if (cleanData.trim()) this.lastNonEmptyOutputAt = now;
|
|
30013
30079
|
if (normalizedScreenSnapshot !== this.lastScreenSnapshot) {
|
|
@@ -30020,13 +30086,14 @@ var require_dist2 = __commonJS({
|
|
|
30020
30086
|
if (this.idleFinishCandidate && (rawData.length > 0 || cleanData.length > 0)) {
|
|
30021
30087
|
this.clearIdleFinishCandidate("new_output");
|
|
30022
30088
|
}
|
|
30023
|
-
|
|
30024
|
-
|
|
30025
|
-
|
|
30026
|
-
|
|
30027
|
-
|
|
30028
|
-
|
|
30029
|
-
|
|
30089
|
+
if (getDebugRuntimeConfig().collectDebugTrace) {
|
|
30090
|
+
this.recordTrace("output", {
|
|
30091
|
+
rawLength: rawData.length,
|
|
30092
|
+
cleanLength: cleanData.length,
|
|
30093
|
+
rawPreview: summarizeCliTraceText(rawData, 300),
|
|
30094
|
+
cleanPreview: summarizeCliTraceText(cleanData, 300)
|
|
30095
|
+
});
|
|
30096
|
+
}
|
|
30030
30097
|
if (this.startupParseGate) {
|
|
30031
30098
|
this.scheduleStartupSettleCheck();
|
|
30032
30099
|
}
|
|
@@ -30728,12 +30795,19 @@ var require_dist2 = __commonJS({
|
|
|
30728
30795
|
* Called by command handler / dashboard for rich content rendering.
|
|
30729
30796
|
*/
|
|
30730
30797
|
getScriptParsedStatus() {
|
|
30798
|
+
const screenText = this.terminalScreen.getText();
|
|
30799
|
+
const cached2 = this.parsedStatusCache;
|
|
30800
|
+
if (cached2 && cached2.committedMessagesRef === this.committedMessages && cached2.responseBuffer === this.responseBuffer && cached2.currentTurnScope === this.currentTurnScope && cached2.recentOutputBuffer === this.recentOutputBuffer && cached2.accumulatedBuffer === this.accumulatedBuffer && cached2.accumulatedRawBuffer === this.accumulatedRawBuffer && cached2.screenText === screenText && cached2.currentStatus === this.currentStatus && cached2.activeModal === this.activeModal && cached2.cliName === this.cliName && cached2.lastOutputAt === this.lastOutputAt) {
|
|
30801
|
+
return cached2.result;
|
|
30802
|
+
}
|
|
30731
30803
|
const parsed = this.parseCurrentTranscript(
|
|
30732
30804
|
this.committedMessages,
|
|
30733
30805
|
this.responseBuffer,
|
|
30734
|
-
this.currentTurnScope
|
|
30806
|
+
this.currentTurnScope,
|
|
30807
|
+
screenText
|
|
30735
30808
|
);
|
|
30736
30809
|
const shouldPreferCommittedMessages = !this.currentTurnScope && this.currentStatus === "idle" && !this.activeModal;
|
|
30810
|
+
let result;
|
|
30737
30811
|
if (parsed && Array.isArray(parsed.messages)) {
|
|
30738
30812
|
const hydratedMessages = shouldPreferCommittedMessages ? this.committedMessages.map((message, index) => buildChatMessage({
|
|
30739
30813
|
...message,
|
|
@@ -30745,7 +30819,7 @@ var require_dist2 = __commonJS({
|
|
|
30745
30819
|
scope: this.currentTurnScope,
|
|
30746
30820
|
lastOutputAt: this.lastOutputAt
|
|
30747
30821
|
});
|
|
30748
|
-
|
|
30822
|
+
result = {
|
|
30749
30823
|
id: parsed.id || "cli_session",
|
|
30750
30824
|
status: parsed.status || this.currentStatus,
|
|
30751
30825
|
title: parsed.title || this.cliName,
|
|
@@ -30753,20 +30827,36 @@ var require_dist2 = __commonJS({
|
|
|
30753
30827
|
activeModal: parsed.activeModal ?? this.activeModal,
|
|
30754
30828
|
providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0
|
|
30755
30829
|
};
|
|
30830
|
+
} else {
|
|
30831
|
+
const messages = [...this.committedMessages];
|
|
30832
|
+
result = {
|
|
30833
|
+
id: "cli_session",
|
|
30834
|
+
status: this.currentStatus,
|
|
30835
|
+
title: this.cliName,
|
|
30836
|
+
messages: messages.map((message, index) => buildChatMessage({
|
|
30837
|
+
...message,
|
|
30838
|
+
id: message.id || `msg_${index}`,
|
|
30839
|
+
index: typeof message.index === "number" ? message.index : index,
|
|
30840
|
+
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
30841
|
+
})),
|
|
30842
|
+
activeModal: this.activeModal
|
|
30843
|
+
};
|
|
30756
30844
|
}
|
|
30757
|
-
|
|
30758
|
-
|
|
30759
|
-
|
|
30760
|
-
|
|
30761
|
-
|
|
30762
|
-
|
|
30763
|
-
|
|
30764
|
-
|
|
30765
|
-
|
|
30766
|
-
|
|
30767
|
-
|
|
30768
|
-
|
|
30845
|
+
this.parsedStatusCache = {
|
|
30846
|
+
committedMessagesRef: this.committedMessages,
|
|
30847
|
+
responseBuffer: this.responseBuffer,
|
|
30848
|
+
currentTurnScope: this.currentTurnScope,
|
|
30849
|
+
recentOutputBuffer: this.recentOutputBuffer,
|
|
30850
|
+
accumulatedBuffer: this.accumulatedBuffer,
|
|
30851
|
+
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
30852
|
+
screenText,
|
|
30853
|
+
currentStatus: this.currentStatus,
|
|
30854
|
+
activeModal: this.activeModal,
|
|
30855
|
+
cliName: this.cliName,
|
|
30856
|
+
lastOutputAt: this.lastOutputAt,
|
|
30857
|
+
result
|
|
30769
30858
|
};
|
|
30859
|
+
return result;
|
|
30770
30860
|
}
|
|
30771
30861
|
async invokeScript(scriptName, args) {
|
|
30772
30862
|
const fn2 = this.cliScripts?.[scriptName];
|
|
@@ -30789,17 +30879,18 @@ var require_dist2 = __commonJS({
|
|
|
30789
30879
|
args: args && typeof args === "object" ? { ...args } : {}
|
|
30790
30880
|
}));
|
|
30791
30881
|
}
|
|
30792
|
-
parseCurrentTranscript(baseMessages, partialResponse, scope) {
|
|
30882
|
+
parseCurrentTranscript(baseMessages, partialResponse, scope, screenTextOverride) {
|
|
30793
30883
|
if (!this.cliScripts?.parseOutput) {
|
|
30794
30884
|
this.parseErrorMessage = null;
|
|
30795
30885
|
return null;
|
|
30796
30886
|
}
|
|
30797
30887
|
try {
|
|
30888
|
+
const screenText = typeof screenTextOverride === "string" ? screenTextOverride : this.terminalScreen.getText();
|
|
30798
30889
|
const input = buildCliParseInput({
|
|
30799
30890
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
30800
30891
|
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
30801
30892
|
recentOutputBuffer: this.recentOutputBuffer,
|
|
30802
|
-
terminalScreenText:
|
|
30893
|
+
terminalScreenText: screenText,
|
|
30803
30894
|
baseMessages,
|
|
30804
30895
|
partialResponse,
|
|
30805
30896
|
isWaitingForResponse: this.isWaitingForResponse,
|
|
@@ -32447,9 +32538,15 @@ ${data.message || ""}`.trim();
|
|
|
32447
32538
|
continue;
|
|
32448
32539
|
}
|
|
32449
32540
|
const status = String(session?.status || "").toLowerCase();
|
|
32541
|
+
const unread = session?.unread === true;
|
|
32542
|
+
const inboxBucket = String(session?.inboxBucket || "").toLowerCase();
|
|
32543
|
+
const runtimeSurfaceKind = String(session?.runtimeSurfaceKind || "").toLowerCase();
|
|
32544
|
+
const runtimeLifecycle = String(session?.runtimeLifecycle || "").toLowerCase();
|
|
32545
|
+
const isLiveRuntime = runtimeSurfaceKind === "live_runtime" || LIVE_RUNTIME_LIFECYCLES.has(runtimeLifecycle);
|
|
32450
32546
|
const lastMessageAt = parseMessageTimestamp(session?.lastMessageAt);
|
|
32451
32547
|
const recentlyUpdated = lastMessageAt > 0 && now - lastMessageAt <= recentMessageGraceMs;
|
|
32452
|
-
|
|
32548
|
+
const shouldKeepRecentTailHot = recentlyUpdated && (unread || inboxBucket === "task_complete" || inboxBucket === "needs_attention" || isLiveRuntime || activeStatuses.has(status));
|
|
32549
|
+
if (activeStatuses.has(status) || shouldKeepRecentTailHot) {
|
|
32453
32550
|
active.add(sessionId);
|
|
32454
32551
|
}
|
|
32455
32552
|
}
|
|
@@ -37030,50 +37127,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
37030
37127
|
}
|
|
37031
37128
|
init_read_chat_contract();
|
|
37032
37129
|
init_logger();
|
|
37033
|
-
|
|
37034
|
-
var DEV_TRACE_BUFFER_SIZE = 1e3;
|
|
37035
|
-
var DEFAULT_CONFIG2 = {
|
|
37036
|
-
logLevel: "info",
|
|
37037
|
-
collectDebugTrace: false,
|
|
37038
|
-
traceContent: false,
|
|
37039
|
-
traceBufferSize: NORMAL_TRACE_BUFFER_SIZE,
|
|
37040
|
-
traceCategories: []
|
|
37041
|
-
};
|
|
37042
|
-
var currentConfig = { ...DEFAULT_CONFIG2 };
|
|
37043
|
-
function normalizeCategories(categories) {
|
|
37044
|
-
if (!Array.isArray(categories)) return [];
|
|
37045
|
-
return categories.map((category) => String(category || "").trim()).filter(Boolean);
|
|
37046
|
-
}
|
|
37047
|
-
function resolveDebugRuntimeConfig(options = {}) {
|
|
37048
|
-
const dev = options.dev === true;
|
|
37049
|
-
return {
|
|
37050
|
-
logLevel: options.logLevel || (dev ? "debug" : DEFAULT_CONFIG2.logLevel),
|
|
37051
|
-
collectDebugTrace: typeof options.trace === "boolean" ? options.trace : dev,
|
|
37052
|
-
traceContent: options.traceContent === true,
|
|
37053
|
-
traceBufferSize: Number.isFinite(options.traceBufferSize) ? Math.max(10, Math.floor(options.traceBufferSize)) : dev ? DEV_TRACE_BUFFER_SIZE : DEFAULT_CONFIG2.traceBufferSize,
|
|
37054
|
-
traceCategories: normalizeCategories(options.traceCategories)
|
|
37055
|
-
};
|
|
37056
|
-
}
|
|
37057
|
-
function setDebugRuntimeConfig(config2) {
|
|
37058
|
-
currentConfig = {
|
|
37059
|
-
...config2,
|
|
37060
|
-
traceCategories: normalizeCategories(config2.traceCategories),
|
|
37061
|
-
traceBufferSize: Math.max(10, Math.floor(config2.traceBufferSize || DEFAULT_CONFIG2.traceBufferSize))
|
|
37062
|
-
};
|
|
37063
|
-
}
|
|
37064
|
-
function getDebugRuntimeConfig() {
|
|
37065
|
-
return { ...currentConfig, traceCategories: [...currentConfig.traceCategories] };
|
|
37066
|
-
}
|
|
37067
|
-
function resetDebugRuntimeConfig() {
|
|
37068
|
-
currentConfig = { ...DEFAULT_CONFIG2 };
|
|
37069
|
-
}
|
|
37070
|
-
function shouldCollectTraceCategory(category) {
|
|
37071
|
-
const config2 = currentConfig;
|
|
37072
|
-
if (!config2.collectDebugTrace) return false;
|
|
37073
|
-
if (!category) return true;
|
|
37074
|
-
if (config2.traceCategories.length === 0) return true;
|
|
37075
|
-
return config2.traceCategories.includes(category);
|
|
37076
|
-
}
|
|
37130
|
+
init_debug_config();
|
|
37077
37131
|
function summarizeString(value) {
|
|
37078
37132
|
return `[${value.length} chars]`;
|
|
37079
37133
|
}
|
|
@@ -39960,6 +40014,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
39960
40014
|
}
|
|
39961
40015
|
async onTick() {
|
|
39962
40016
|
if (this.providerSessionId) return;
|
|
40017
|
+
if (this.type === "hermes-cli" && this.launchMode === "new") return;
|
|
39963
40018
|
let probedSessionId = null;
|
|
39964
40019
|
const probeConfig = this.provider.sessionProbe;
|
|
39965
40020
|
if (probeConfig) {
|
|
@@ -44614,6 +44669,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44614
44669
|
session.lastSeenAt = lastSeenAt;
|
|
44615
44670
|
session.unread = overlayUnread;
|
|
44616
44671
|
session.inboxBucket = overlayInboxBucket;
|
|
44672
|
+
session.completionMarker = completionMarker;
|
|
44673
|
+
session.seenCompletionMarker = seenCompletionMarker;
|
|
44617
44674
|
if (READ_DEBUG_ENABLED && (session.unread || session.inboxBucket !== "idle" || session.providerType.includes("codex"))) {
|
|
44618
44675
|
const recentReadSnapshot = {
|
|
44619
44676
|
sessionId: session.id,
|
|
@@ -45856,6 +45913,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
45856
45913
|
}
|
|
45857
45914
|
};
|
|
45858
45915
|
init_logger();
|
|
45916
|
+
init_debug_config();
|
|
45859
45917
|
var DEFAULT_DAEMON_PORT = 19222;
|
|
45860
45918
|
var DAEMON_WS_PATH = "/ipc";
|
|
45861
45919
|
function normalizeSyncMode(syncMode) {
|