@adhdev/daemon-standalone 0.8.49 → 0.8.50
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 +269 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-BNnOxdJy.css +1 -0
- package/public/assets/index-DU0-KWDW.js +71 -0
- package/public/index.html +2 -2
- package/public/assets/index-BQmExzKO.css +0 -1
- package/public/assets/index-CkCJvMQZ.js +0 -71
package/dist/index.js
CHANGED
|
@@ -30803,6 +30803,8 @@ ${data.message || ""}`.trim();
|
|
|
30803
30803
|
CliProviderInstance: () => CliProviderInstance,
|
|
30804
30804
|
DAEMON_WS_PATH: () => DAEMON_WS_PATH,
|
|
30805
30805
|
DEFAULT_DAEMON_PORT: () => DEFAULT_DAEMON_PORT,
|
|
30806
|
+
DEFAULT_SESSION_HOST_APP_NAME: () => DEFAULT_SESSION_HOST_APP_NAME,
|
|
30807
|
+
DEFAULT_STANDALONE_SESSION_HOST_APP_NAME: () => DEFAULT_STANDALONE_SESSION_HOST_APP_NAME,
|
|
30806
30808
|
DaemonAgentStreamManager: () => DaemonAgentStreamManager,
|
|
30807
30809
|
DaemonCdpInitializer: () => DaemonCdpInitializer,
|
|
30808
30810
|
DaemonCdpManager: () => DaemonCdpManager,
|
|
@@ -30824,7 +30826,11 @@ ${data.message || ""}`.trim();
|
|
|
30824
30826
|
buildMachineInfo: () => buildMachineInfo2,
|
|
30825
30827
|
buildSessionEntries: () => buildSessionEntries,
|
|
30826
30828
|
buildStatusSnapshot: () => buildStatusSnapshot2,
|
|
30829
|
+
clearDebugTrace: () => clearDebugTrace,
|
|
30830
|
+
configureDebugTraceStore: () => configureDebugTraceStore,
|
|
30827
30831
|
connectCdpManager: () => connectCdpManager,
|
|
30832
|
+
createDebugTraceStore: () => createDebugTraceStore,
|
|
30833
|
+
createInteractionId: () => createInteractionId,
|
|
30828
30834
|
detectAllVersions: () => detectAllVersions,
|
|
30829
30835
|
detectCLIs: () => detectCLIs,
|
|
30830
30836
|
detectIDEs: () => detectIDEs,
|
|
@@ -30835,10 +30841,12 @@ ${data.message || ""}`.trim();
|
|
|
30835
30841
|
getAvailableIdeIds: () => getAvailableIdeIds,
|
|
30836
30842
|
getCurrentDaemonLogPath: () => getCurrentDaemonLogPath,
|
|
30837
30843
|
getDaemonLogDir: () => getDaemonLogDir,
|
|
30844
|
+
getDebugRuntimeConfig: () => getDebugRuntimeConfig,
|
|
30838
30845
|
getHostMemorySnapshot: () => getHostMemorySnapshot,
|
|
30839
30846
|
getLogLevel: () => getLogLevel,
|
|
30840
30847
|
getRecentActivity: () => getRecentActivity,
|
|
30841
30848
|
getRecentCommands: () => getRecentCommands,
|
|
30849
|
+
getRecentDebugTrace: () => getRecentDebugTrace,
|
|
30842
30850
|
getRecentLogs: () => getRecentLogs,
|
|
30843
30851
|
getSavedProviderSessions: () => getSavedProviderSessions,
|
|
30844
30852
|
getWorkspaceState: () => getWorkspaceState2,
|
|
@@ -30865,13 +30873,19 @@ ${data.message || ""}`.trim();
|
|
|
30865
30873
|
normalizeManagedStatus: () => normalizeManagedStatus,
|
|
30866
30874
|
probeCdpPort: () => probeCdpPort,
|
|
30867
30875
|
readChatHistory: () => readChatHistory,
|
|
30876
|
+
recordDebugTrace: () => recordDebugTrace,
|
|
30868
30877
|
registerExtensionProviders: () => registerExtensionProviders,
|
|
30869
30878
|
resetConfig: () => resetConfig,
|
|
30879
|
+
resetDebugRuntimeConfig: () => resetDebugRuntimeConfig,
|
|
30870
30880
|
resetState: () => resetState,
|
|
30881
|
+
resolveDebugRuntimeConfig: () => resolveDebugRuntimeConfig,
|
|
30882
|
+
resolveSessionHostAppName: () => resolveSessionHostAppName2,
|
|
30871
30883
|
saveConfig: () => saveConfig,
|
|
30872
30884
|
saveState: () => saveState,
|
|
30885
|
+
setDebugRuntimeConfig: () => setDebugRuntimeConfig,
|
|
30873
30886
|
setLogLevel: () => setLogLevel,
|
|
30874
30887
|
setupIdeInstance: () => setupIdeInstance,
|
|
30888
|
+
shouldCollectTraceCategory: () => shouldCollectTraceCategory,
|
|
30875
30889
|
shutdownDaemonComponents: () => shutdownDaemonComponents2,
|
|
30876
30890
|
spawnDetachedDaemonUpgradeHelper: () => spawnDetachedDaemonUpgradeHelper,
|
|
30877
30891
|
startDaemonDevSupport: () => startDaemonDevSupport2,
|
|
@@ -35227,6 +35241,128 @@ ${effect.notification.body || ""}`.trim();
|
|
|
35227
35241
|
return content.filter((b2) => b2.type === "text").map((b2) => b2.text).join("\n");
|
|
35228
35242
|
}
|
|
35229
35243
|
init_logger();
|
|
35244
|
+
var NORMAL_TRACE_BUFFER_SIZE = 200;
|
|
35245
|
+
var DEV_TRACE_BUFFER_SIZE = 1e3;
|
|
35246
|
+
var DEFAULT_CONFIG2 = {
|
|
35247
|
+
logLevel: "info",
|
|
35248
|
+
collectDebugTrace: false,
|
|
35249
|
+
traceContent: false,
|
|
35250
|
+
traceBufferSize: NORMAL_TRACE_BUFFER_SIZE,
|
|
35251
|
+
traceCategories: []
|
|
35252
|
+
};
|
|
35253
|
+
var currentConfig = { ...DEFAULT_CONFIG2 };
|
|
35254
|
+
function normalizeCategories(categories) {
|
|
35255
|
+
if (!Array.isArray(categories)) return [];
|
|
35256
|
+
return categories.map((category) => String(category || "").trim()).filter(Boolean);
|
|
35257
|
+
}
|
|
35258
|
+
function resolveDebugRuntimeConfig(options = {}) {
|
|
35259
|
+
const dev = options.dev === true;
|
|
35260
|
+
return {
|
|
35261
|
+
logLevel: options.logLevel || (dev ? "debug" : DEFAULT_CONFIG2.logLevel),
|
|
35262
|
+
collectDebugTrace: typeof options.trace === "boolean" ? options.trace : dev,
|
|
35263
|
+
traceContent: options.traceContent === true,
|
|
35264
|
+
traceBufferSize: Number.isFinite(options.traceBufferSize) ? Math.max(10, Math.floor(options.traceBufferSize)) : dev ? DEV_TRACE_BUFFER_SIZE : DEFAULT_CONFIG2.traceBufferSize,
|
|
35265
|
+
traceCategories: normalizeCategories(options.traceCategories)
|
|
35266
|
+
};
|
|
35267
|
+
}
|
|
35268
|
+
function setDebugRuntimeConfig(config2) {
|
|
35269
|
+
currentConfig = {
|
|
35270
|
+
...config2,
|
|
35271
|
+
traceCategories: normalizeCategories(config2.traceCategories),
|
|
35272
|
+
traceBufferSize: Math.max(10, Math.floor(config2.traceBufferSize || DEFAULT_CONFIG2.traceBufferSize))
|
|
35273
|
+
};
|
|
35274
|
+
}
|
|
35275
|
+
function getDebugRuntimeConfig() {
|
|
35276
|
+
return { ...currentConfig, traceCategories: [...currentConfig.traceCategories] };
|
|
35277
|
+
}
|
|
35278
|
+
function resetDebugRuntimeConfig() {
|
|
35279
|
+
currentConfig = { ...DEFAULT_CONFIG2 };
|
|
35280
|
+
}
|
|
35281
|
+
function shouldCollectTraceCategory(category) {
|
|
35282
|
+
const config2 = currentConfig;
|
|
35283
|
+
if (!config2.collectDebugTrace) return false;
|
|
35284
|
+
if (!category) return true;
|
|
35285
|
+
if (config2.traceCategories.length === 0) return true;
|
|
35286
|
+
return config2.traceCategories.includes(category);
|
|
35287
|
+
}
|
|
35288
|
+
function summarizeString(value) {
|
|
35289
|
+
return `[${value.length} chars]`;
|
|
35290
|
+
}
|
|
35291
|
+
function sanitizeTraceValue(value, traceContent) {
|
|
35292
|
+
if (traceContent) {
|
|
35293
|
+
if (Array.isArray(value)) return value.map((entry) => sanitizeTraceValue(entry, traceContent));
|
|
35294
|
+
if (value && typeof value === "object") {
|
|
35295
|
+
return Object.fromEntries(
|
|
35296
|
+
Object.entries(value).map(([key, nested]) => [key, sanitizeTraceValue(nested, traceContent)])
|
|
35297
|
+
);
|
|
35298
|
+
}
|
|
35299
|
+
return value;
|
|
35300
|
+
}
|
|
35301
|
+
if (typeof value === "string") return summarizeString(value);
|
|
35302
|
+
if (Array.isArray(value)) return value.map((entry) => sanitizeTraceValue(entry, traceContent));
|
|
35303
|
+
if (value && typeof value === "object") {
|
|
35304
|
+
return Object.fromEntries(
|
|
35305
|
+
Object.entries(value).map(([key, nested]) => [key, sanitizeTraceValue(nested, traceContent)])
|
|
35306
|
+
);
|
|
35307
|
+
}
|
|
35308
|
+
return value;
|
|
35309
|
+
}
|
|
35310
|
+
function sanitizeTracePayload(payload) {
|
|
35311
|
+
if (!payload) return {};
|
|
35312
|
+
const { traceContent } = getDebugRuntimeConfig();
|
|
35313
|
+
return sanitizeTraceValue(payload, traceContent);
|
|
35314
|
+
}
|
|
35315
|
+
function createEntry(event) {
|
|
35316
|
+
return {
|
|
35317
|
+
id: `trace_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`,
|
|
35318
|
+
ts: Date.now(),
|
|
35319
|
+
...event,
|
|
35320
|
+
payload: sanitizeTracePayload(event.payload)
|
|
35321
|
+
};
|
|
35322
|
+
}
|
|
35323
|
+
function createDebugTraceStore(options) {
|
|
35324
|
+
const entries = [];
|
|
35325
|
+
const capacity = Math.max(1, Math.floor(options.capacity || 100));
|
|
35326
|
+
return {
|
|
35327
|
+
record(event) {
|
|
35328
|
+
if (!options.enabled) return null;
|
|
35329
|
+
const entry = createEntry(event);
|
|
35330
|
+
entries.push(entry);
|
|
35331
|
+
if (entries.length > capacity) {
|
|
35332
|
+
entries.splice(0, entries.length - capacity);
|
|
35333
|
+
}
|
|
35334
|
+
return entry;
|
|
35335
|
+
},
|
|
35336
|
+
list(query = {}) {
|
|
35337
|
+
const limit = Math.max(1, Math.floor(query.limit || 100));
|
|
35338
|
+
return entries.filter((entry) => !query.interactionId || entry.interactionId === query.interactionId).filter((entry) => !query.category || entry.category === query.category).slice(-limit).map((entry) => ({ ...entry, payload: entry.payload ? { ...entry.payload } : {} }));
|
|
35339
|
+
},
|
|
35340
|
+
clear() {
|
|
35341
|
+
entries.splice(0, entries.length);
|
|
35342
|
+
}
|
|
35343
|
+
};
|
|
35344
|
+
}
|
|
35345
|
+
var globalStore = createDebugTraceStore({ enabled: false, capacity: getDebugRuntimeConfig().traceBufferSize });
|
|
35346
|
+
function configureDebugTraceStore() {
|
|
35347
|
+
const config2 = getDebugRuntimeConfig();
|
|
35348
|
+
globalStore = createDebugTraceStore({
|
|
35349
|
+
enabled: config2.collectDebugTrace,
|
|
35350
|
+
capacity: config2.traceBufferSize
|
|
35351
|
+
});
|
|
35352
|
+
}
|
|
35353
|
+
function recordDebugTrace(event) {
|
|
35354
|
+
if (!shouldCollectTraceCategory(event.category)) return null;
|
|
35355
|
+
return globalStore.record(event);
|
|
35356
|
+
}
|
|
35357
|
+
function getRecentDebugTrace(query = {}) {
|
|
35358
|
+
return globalStore.list(query);
|
|
35359
|
+
}
|
|
35360
|
+
function clearDebugTrace() {
|
|
35361
|
+
globalStore.clear();
|
|
35362
|
+
}
|
|
35363
|
+
function createInteractionId(prefix = "ix") {
|
|
35364
|
+
return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
35365
|
+
}
|
|
35230
35366
|
var RECENT_SEND_WINDOW_MS = 1200;
|
|
35231
35367
|
var recentSendByTarget = /* @__PURE__ */ new Map();
|
|
35232
35368
|
function hashSignatureParts2(parts) {
|
|
@@ -35293,6 +35429,20 @@ ${effect.notification.body || ""}`.trim();
|
|
|
35293
35429
|
const providerSessionId = typeof state?.providerSessionId === "string" ? state.providerSessionId.trim() : "";
|
|
35294
35430
|
return providerSessionId || targetSessionId;
|
|
35295
35431
|
}
|
|
35432
|
+
function getInteractionId(args) {
|
|
35433
|
+
return typeof args?._interactionId === "string" && args._interactionId.trim() ? args._interactionId.trim() : void 0;
|
|
35434
|
+
}
|
|
35435
|
+
function traceProviderEvent(args, category, stage, options) {
|
|
35436
|
+
recordDebugTrace({
|
|
35437
|
+
interactionId: getInteractionId(args),
|
|
35438
|
+
category,
|
|
35439
|
+
stage,
|
|
35440
|
+
level: options.level || "info",
|
|
35441
|
+
sessionId: typeof args?.targetSessionId === "string" ? args.targetSessionId : options.h.currentSession?.sessionId,
|
|
35442
|
+
providerType: options.provider?.type || options.h.currentProviderType || options.h.currentSession?.providerType,
|
|
35443
|
+
payload: options.payload
|
|
35444
|
+
});
|
|
35445
|
+
}
|
|
35296
35446
|
function callLegacyTextScript(script, text) {
|
|
35297
35447
|
if (typeof script !== "function") return null;
|
|
35298
35448
|
return script(text);
|
|
@@ -35538,6 +35688,16 @@ ${effect.notification.body || ""}`.trim();
|
|
|
35538
35688
|
}
|
|
35539
35689
|
if (parsed && typeof parsed === "object") {
|
|
35540
35690
|
_log(`Extension OK: ${parsed.messages?.length || 0} msgs`);
|
|
35691
|
+
traceProviderEvent(args, "provider", "extension.read_chat.success", {
|
|
35692
|
+
h,
|
|
35693
|
+
provider,
|
|
35694
|
+
payload: {
|
|
35695
|
+
method: "evaluateProviderScript",
|
|
35696
|
+
result: evalResult.result,
|
|
35697
|
+
parsed,
|
|
35698
|
+
messageCount: Array.isArray(parsed.messages) ? parsed.messages.length : 0
|
|
35699
|
+
}
|
|
35700
|
+
});
|
|
35541
35701
|
h.historyWriter.appendNewMessages(
|
|
35542
35702
|
provider?.type || "unknown_extension",
|
|
35543
35703
|
toHistoryPersistedMessages(normalizeReadChatMessages(parsed)),
|
|
@@ -35550,6 +35710,12 @@ ${effect.notification.body || ""}`.trim();
|
|
|
35550
35710
|
}
|
|
35551
35711
|
} catch (e) {
|
|
35552
35712
|
_log(`Extension error: ${e.message}`);
|
|
35713
|
+
traceProviderEvent(args, "provider", "extension.read_chat.error", {
|
|
35714
|
+
h,
|
|
35715
|
+
provider,
|
|
35716
|
+
level: "warn",
|
|
35717
|
+
payload: { method: "evaluateProviderScript", error: e.message }
|
|
35718
|
+
});
|
|
35553
35719
|
}
|
|
35554
35720
|
if (h.agentStream) {
|
|
35555
35721
|
const cdp2 = h.getCdp();
|
|
@@ -35613,27 +35779,45 @@ ${effect.notification.body || ""}`.trim();
|
|
|
35613
35779
|
const script = h.getProviderScript("readChat") || h.getProviderScript("read_chat");
|
|
35614
35780
|
if (script) {
|
|
35615
35781
|
try {
|
|
35616
|
-
const
|
|
35617
|
-
|
|
35618
|
-
|
|
35619
|
-
|
|
35620
|
-
|
|
35621
|
-
|
|
35782
|
+
const evalResult = await h.evaluateProviderScript("readChat", void 0, 5e4);
|
|
35783
|
+
if (evalResult?.result) {
|
|
35784
|
+
let parsed = evalResult.result;
|
|
35785
|
+
if (typeof parsed === "string") {
|
|
35786
|
+
try {
|
|
35787
|
+
parsed = JSON.parse(parsed);
|
|
35788
|
+
} catch {
|
|
35789
|
+
}
|
|
35790
|
+
}
|
|
35791
|
+
if (parsed && typeof parsed === "object" && parsed.messages?.length > 0) {
|
|
35792
|
+
_log(`OK: ${parsed.messages?.length} msgs`);
|
|
35793
|
+
traceProviderEvent(args, "provider", "ide.read_chat.success", {
|
|
35794
|
+
h,
|
|
35795
|
+
provider,
|
|
35796
|
+
payload: {
|
|
35797
|
+
method: "evaluate",
|
|
35798
|
+
result: evalResult.result,
|
|
35799
|
+
parsed,
|
|
35800
|
+
messageCount: Array.isArray(parsed.messages) ? parsed.messages.length : 0
|
|
35801
|
+
}
|
|
35802
|
+
});
|
|
35803
|
+
h.historyWriter.appendNewMessages(
|
|
35804
|
+
provider?.type || getCurrentProviderType(h, "unknown_ide"),
|
|
35805
|
+
toHistoryPersistedMessages(normalizeReadChatMessages(parsed)),
|
|
35806
|
+
parsed.title,
|
|
35807
|
+
args?.targetSessionId,
|
|
35808
|
+
historySessionId
|
|
35809
|
+
);
|
|
35810
|
+
return buildReadChatCommandResult(parsed, args);
|
|
35622
35811
|
}
|
|
35623
|
-
}
|
|
35624
|
-
if (parsed && typeof parsed === "object" && parsed.messages?.length > 0) {
|
|
35625
|
-
_log(`OK: ${parsed.messages?.length} msgs`);
|
|
35626
|
-
h.historyWriter.appendNewMessages(
|
|
35627
|
-
provider?.type || getCurrentProviderType(h, "unknown_ide"),
|
|
35628
|
-
toHistoryPersistedMessages(normalizeReadChatMessages(parsed)),
|
|
35629
|
-
parsed.title,
|
|
35630
|
-
args?.targetSessionId,
|
|
35631
|
-
historySessionId
|
|
35632
|
-
);
|
|
35633
|
-
return buildReadChatCommandResult(parsed, args);
|
|
35634
35812
|
}
|
|
35635
35813
|
} catch (e) {
|
|
35636
35814
|
LOG2.info("Command", `[read_chat] Script error: ${e.message}`);
|
|
35815
|
+
traceProviderEvent(args, "provider", "ide.read_chat.error", {
|
|
35816
|
+
h,
|
|
35817
|
+
provider,
|
|
35818
|
+
level: "warn",
|
|
35819
|
+
payload: { method: "evaluate", error: e.message }
|
|
35820
|
+
});
|
|
35637
35821
|
}
|
|
35638
35822
|
}
|
|
35639
35823
|
return buildReadChatCommandResult({ messages: [], status: "idle" }, args);
|
|
@@ -41495,6 +41679,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
41495
41679
|
ts: entry.ts,
|
|
41496
41680
|
cmd: entry.cmd,
|
|
41497
41681
|
src: entry.source,
|
|
41682
|
+
...entry.interactionId ? { interactionId: entry.interactionId } : {},
|
|
41498
41683
|
...entry.args ? { args: maskArgs(entry.args) } : {},
|
|
41499
41684
|
...entry.success !== void 0 ? { ok: entry.success } : {},
|
|
41500
41685
|
...entry.error ? { err: entry.error } : {},
|
|
@@ -41516,6 +41701,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
41516
41701
|
ts: parsed.ts,
|
|
41517
41702
|
cmd: parsed.cmd,
|
|
41518
41703
|
source: parsed.src,
|
|
41704
|
+
interactionId: parsed.interactionId,
|
|
41519
41705
|
args: parsed.args,
|
|
41520
41706
|
success: parsed.ok,
|
|
41521
41707
|
error: parsed.err,
|
|
@@ -41975,6 +42161,13 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
41975
42161
|
return "unknown";
|
|
41976
42162
|
}
|
|
41977
42163
|
}
|
|
42164
|
+
function normalizeCommandArgsWithInteractionId(args) {
|
|
42165
|
+
const base = args && typeof args === "object" ? { ...args } : {};
|
|
42166
|
+
if (typeof base._interactionId !== "string" || !String(base._interactionId).trim()) {
|
|
42167
|
+
base._interactionId = createInteractionId();
|
|
42168
|
+
}
|
|
42169
|
+
return base;
|
|
42170
|
+
}
|
|
41978
42171
|
function toHostedCliRuntimeDescriptor(record2) {
|
|
41979
42172
|
if (!record2 || typeof record2 !== "object") return null;
|
|
41980
42173
|
const runtimeId = typeof record2.sessionId === "string" ? record2.sessionId : "";
|
|
@@ -42013,20 +42206,50 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
42013
42206
|
async execute(cmd, args, source = "unknown") {
|
|
42014
42207
|
const cmdStart = Date.now();
|
|
42015
42208
|
const logSource = normalizeCommandSource(source);
|
|
42209
|
+
const normalizedArgs = normalizeCommandArgsWithInteractionId(args);
|
|
42210
|
+
const interactionId = typeof normalizedArgs._interactionId === "string" ? normalizedArgs._interactionId : void 0;
|
|
42211
|
+
recordDebugTrace({
|
|
42212
|
+
interactionId,
|
|
42213
|
+
category: "command",
|
|
42214
|
+
stage: "received",
|
|
42215
|
+
level: "info",
|
|
42216
|
+
payload: { cmd, source: logSource }
|
|
42217
|
+
});
|
|
42016
42218
|
try {
|
|
42017
|
-
const daemonResult = await this.executeDaemonCommand(cmd,
|
|
42219
|
+
const daemonResult = await this.executeDaemonCommand(cmd, normalizedArgs);
|
|
42018
42220
|
if (daemonResult) {
|
|
42019
|
-
logCommand({ ts: (/* @__PURE__ */ new Date()).toISOString(), cmd, source: logSource, args, success: daemonResult.success, durationMs: Date.now() - cmdStart });
|
|
42221
|
+
logCommand({ ts: (/* @__PURE__ */ new Date()).toISOString(), cmd, source: logSource, interactionId, args: normalizedArgs, success: daemonResult.success, durationMs: Date.now() - cmdStart });
|
|
42222
|
+
recordDebugTrace({
|
|
42223
|
+
interactionId,
|
|
42224
|
+
category: "command",
|
|
42225
|
+
stage: "completed",
|
|
42226
|
+
level: daemonResult.success ? "info" : "warn",
|
|
42227
|
+
payload: { cmd, source: logSource, success: daemonResult.success, durationMs: Date.now() - cmdStart }
|
|
42228
|
+
});
|
|
42020
42229
|
return daemonResult;
|
|
42021
42230
|
}
|
|
42022
|
-
const handlerResult = await this.deps.commandHandler.handle(cmd,
|
|
42023
|
-
logCommand({ ts: (/* @__PURE__ */ new Date()).toISOString(), cmd, source: logSource, args, success: handlerResult.success, durationMs: Date.now() - cmdStart });
|
|
42231
|
+
const handlerResult = await this.deps.commandHandler.handle(cmd, normalizedArgs);
|
|
42232
|
+
logCommand({ ts: (/* @__PURE__ */ new Date()).toISOString(), cmd, source: logSource, interactionId, args: normalizedArgs, success: handlerResult.success, durationMs: Date.now() - cmdStart });
|
|
42233
|
+
recordDebugTrace({
|
|
42234
|
+
interactionId,
|
|
42235
|
+
category: "command",
|
|
42236
|
+
stage: "completed",
|
|
42237
|
+
level: handlerResult.success ? "info" : "warn",
|
|
42238
|
+
payload: { cmd, source: logSource, success: handlerResult.success, durationMs: Date.now() - cmdStart }
|
|
42239
|
+
});
|
|
42024
42240
|
if (CHAT_COMMANDS.includes(cmd) && this.deps.onPostChatCommand) {
|
|
42025
42241
|
this.deps.onPostChatCommand();
|
|
42026
42242
|
}
|
|
42027
42243
|
return handlerResult;
|
|
42028
42244
|
} catch (e) {
|
|
42029
|
-
logCommand({ ts: (/* @__PURE__ */ new Date()).toISOString(), cmd, source: logSource, args, success: false, error: e.message, durationMs: Date.now() - cmdStart });
|
|
42245
|
+
logCommand({ ts: (/* @__PURE__ */ new Date()).toISOString(), cmd, source: logSource, interactionId, args: normalizedArgs, success: false, error: e.message, durationMs: Date.now() - cmdStart });
|
|
42246
|
+
recordDebugTrace({
|
|
42247
|
+
interactionId,
|
|
42248
|
+
category: "command",
|
|
42249
|
+
stage: "failed",
|
|
42250
|
+
level: "error",
|
|
42251
|
+
payload: { cmd, source: logSource, error: e?.message || String(e), durationMs: Date.now() - cmdStart }
|
|
42252
|
+
});
|
|
42030
42253
|
throw e;
|
|
42031
42254
|
}
|
|
42032
42255
|
}
|
|
@@ -42068,6 +42291,14 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
42068
42291
|
return { success: false, error: e.message };
|
|
42069
42292
|
}
|
|
42070
42293
|
}
|
|
42294
|
+
case "get_debug_trace": {
|
|
42295
|
+
const count = parseInt(args?.count) || parseInt(args?.limit) || 100;
|
|
42296
|
+
const sinceTs = Number(args?.since) || 0;
|
|
42297
|
+
const interactionId = typeof args?.interactionId === "string" ? args.interactionId : void 0;
|
|
42298
|
+
const category = typeof args?.category === "string" ? args.category : void 0;
|
|
42299
|
+
const trace = getRecentDebugTrace({ interactionId, category, limit: count }).filter((entry) => !sinceTs || entry.ts > sinceTs);
|
|
42300
|
+
return { success: true, trace, count: trace.length };
|
|
42301
|
+
}
|
|
42071
42302
|
case "session_host_get_diagnostics": {
|
|
42072
42303
|
if (!this.deps.sessionHostControl) return { success: false, error: "Session host control unavailable" };
|
|
42073
42304
|
const diagnostics = await this.deps.sessionHostControl.getDiagnostics({
|
|
@@ -49394,6 +49625,14 @@ data: ${JSON.stringify(msg.data)}
|
|
|
49394
49625
|
});
|
|
49395
49626
|
}
|
|
49396
49627
|
};
|
|
49628
|
+
var DEFAULT_SESSION_HOST_APP_NAME = "adhdev";
|
|
49629
|
+
var DEFAULT_STANDALONE_SESSION_HOST_APP_NAME = "adhdev-standalone";
|
|
49630
|
+
function resolveSessionHostAppName2(options = {}) {
|
|
49631
|
+
const env = options.env || process.env;
|
|
49632
|
+
const explicit = typeof env.ADHDEV_SESSION_HOST_NAME === "string" ? env.ADHDEV_SESSION_HOST_NAME.trim() : "";
|
|
49633
|
+
if (explicit) return explicit;
|
|
49634
|
+
return options.standalone ? DEFAULT_STANDALONE_SESSION_HOST_APP_NAME : DEFAULT_SESSION_HOST_APP_NAME;
|
|
49635
|
+
}
|
|
49397
49636
|
var import_session_host_core32 = require_dist();
|
|
49398
49637
|
var STARTUP_TIMEOUT_MS = 8e3;
|
|
49399
49638
|
var STARTUP_POLL_MS = 200;
|
|
@@ -49926,8 +50165,11 @@ var fs2 = __toESM(require("fs"));
|
|
|
49926
50165
|
var os2 = __toESM(require("os"));
|
|
49927
50166
|
var path = __toESM(require("path"));
|
|
49928
50167
|
var import_daemon_core = __toESM(require_dist2());
|
|
49929
|
-
var SESSION_HOST_APP_NAME =
|
|
50168
|
+
var SESSION_HOST_APP_NAME = (0, import_daemon_core.resolveSessionHostAppName)({ standalone: true });
|
|
49930
50169
|
var SESSION_HOST_START_TIMEOUT_MS = 15e3;
|
|
50170
|
+
function getStandaloneSessionHostAppName() {
|
|
50171
|
+
return SESSION_HOST_APP_NAME;
|
|
50172
|
+
}
|
|
49931
50173
|
function buildSessionHostEnv(baseEnv) {
|
|
49932
50174
|
const env = {};
|
|
49933
50175
|
for (const [key, value] of Object.entries(baseEnv)) {
|
|
@@ -50693,6 +50935,7 @@ var StandaloneServer = class {
|
|
|
50693
50935
|
const cdpCount = [...this.components.cdpManagers.values()].filter((m) => m.isConnected).length;
|
|
50694
50936
|
console.log(` CDP: ${cdpCount > 0 ? `\u2705 ${cdpCount} connected` : "\u274C none"}`);
|
|
50695
50937
|
console.log(` Providers: ${this.components.providerLoader.getAll().length} loaded`);
|
|
50938
|
+
console.log(` Session Host: ${getStandaloneSessionHostAppName()}`);
|
|
50696
50939
|
if (options.dev) {
|
|
50697
50940
|
console.log(` \u{1F6E0}\uFE0F DevConsole: http://127.0.0.1:19280`);
|
|
50698
50941
|
}
|
|
@@ -51703,6 +51946,9 @@ Options:
|
|
|
51703
51946
|
--dev Enable DevConsole to debug and test providers
|
|
51704
51947
|
--public <path> Custom path to the web dashboard distribution
|
|
51705
51948
|
--no-open Do not automatically open the browser on startup
|
|
51949
|
+
|
|
51950
|
+
Environment:
|
|
51951
|
+
ADHDEV_SESSION_HOST_NAME Override session host namespace (default: adhdev-standalone)
|
|
51706
51952
|
--help, -h Show this help message
|
|
51707
51953
|
|
|
51708
51954
|
Runtime commands:
|