@adhdev/daemon-standalone 0.9.48 → 0.9.49
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 +369 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-CXnxi_4k.js +91 -0
- package/public/assets/index-blpUofnU.css +1 -0
- package/public/index.html +2 -2
- package/public/assets/index-Bc-shVmU.css +0 -1
- package/public/assets/index-YrRopcws.js +0 -83
package/dist/index.js
CHANGED
|
@@ -29342,7 +29342,12 @@ var require_dist2 = __commonJS({
|
|
|
29342
29342
|
const isWin = os8.platform() === "win32";
|
|
29343
29343
|
try {
|
|
29344
29344
|
const cmd = isWin ? `where ${trimmed}` : `which ${trimmed}`;
|
|
29345
|
-
return (0, import_child_process4.execSync)(cmd, {
|
|
29345
|
+
return (0, import_child_process4.execSync)(cmd, {
|
|
29346
|
+
encoding: "utf-8",
|
|
29347
|
+
timeout: 5e3,
|
|
29348
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
29349
|
+
...isWin ? { windowsHide: true } : {}
|
|
29350
|
+
}).trim().split("\n")[0].trim();
|
|
29346
29351
|
} catch {
|
|
29347
29352
|
return isWin ? `${trimmed}.cmd` : trimmed;
|
|
29348
29353
|
}
|
|
@@ -32027,6 +32032,83 @@ var require_dist2 = __commonJS({
|
|
|
32027
32032
|
if (!this.isWaitingForResponse) return "";
|
|
32028
32033
|
return this.responseBuffer;
|
|
32029
32034
|
}
|
|
32035
|
+
getDebugSnapshot() {
|
|
32036
|
+
const screenText = this.readTerminalScreenText();
|
|
32037
|
+
const parsedResult = this.parsedStatusCache?.result && typeof this.parsedStatusCache.result === "object" ? this.parsedStatusCache.result : null;
|
|
32038
|
+
return {
|
|
32039
|
+
cliType: this.cliType,
|
|
32040
|
+
cliName: this.cliName,
|
|
32041
|
+
workingDir: this.workingDir,
|
|
32042
|
+
currentStatus: this.currentStatus,
|
|
32043
|
+
ready: this.ready,
|
|
32044
|
+
isWaitingForResponse: this.isWaitingForResponse,
|
|
32045
|
+
activeModal: this.activeModal,
|
|
32046
|
+
parseErrorMessage: this.parseErrorMessage,
|
|
32047
|
+
messageCounts: {
|
|
32048
|
+
committed: this.committedMessages.length,
|
|
32049
|
+
structured: this.structuredMessages.length,
|
|
32050
|
+
visible: this.messages.length,
|
|
32051
|
+
parsedCache: Array.isArray(parsedResult?.messages) ? parsedResult.messages.length : void 0
|
|
32052
|
+
},
|
|
32053
|
+
buffers: {
|
|
32054
|
+
accumulatedLength: this.accumulatedBuffer.length,
|
|
32055
|
+
accumulatedRawLength: this.accumulatedRawBuffer.length,
|
|
32056
|
+
recentOutputLength: this.recentOutputBuffer.length,
|
|
32057
|
+
responseLength: this.responseBuffer.length,
|
|
32058
|
+
startupLength: this.startupBuffer.length,
|
|
32059
|
+
accumulatedTail: this.accumulatedBuffer.slice(-24e3),
|
|
32060
|
+
accumulatedRawTail: this.accumulatedRawBuffer.slice(-24e3),
|
|
32061
|
+
recentOutputTail: this.recentOutputBuffer.slice(-12e3),
|
|
32062
|
+
responseTail: this.responseBuffer.slice(-12e3)
|
|
32063
|
+
},
|
|
32064
|
+
terminal: {
|
|
32065
|
+
screenText,
|
|
32066
|
+
lastScreenSnapshot: this.lastScreenSnapshot,
|
|
32067
|
+
lastScreenText: this.lastScreenText,
|
|
32068
|
+
lastOutputAt: this.lastOutputAt,
|
|
32069
|
+
lastNonEmptyOutputAt: this.lastNonEmptyOutputAt,
|
|
32070
|
+
lastScreenChangeAt: this.lastScreenChangeAt,
|
|
32071
|
+
lastScreenSnapshotReadAt: this.lastScreenSnapshotReadAt
|
|
32072
|
+
},
|
|
32073
|
+
parser: {
|
|
32074
|
+
scriptNames: listCliScriptNames(this.cliScripts),
|
|
32075
|
+
traceSessionId: this.traceSessionId,
|
|
32076
|
+
traceSeq: this.traceSeq,
|
|
32077
|
+
currentTurnScope: this.currentTurnScope,
|
|
32078
|
+
parsedStatusCache: parsedResult ? {
|
|
32079
|
+
id: parsedResult.id,
|
|
32080
|
+
status: parsedResult.status,
|
|
32081
|
+
title: parsedResult.title,
|
|
32082
|
+
providerSessionId: parsedResult.providerSessionId,
|
|
32083
|
+
transcriptAuthority: parsedResult.transcriptAuthority,
|
|
32084
|
+
coverage: parsedResult.coverage,
|
|
32085
|
+
messageCount: Array.isArray(parsedResult.messages) ? parsedResult.messages.length : void 0,
|
|
32086
|
+
activeModal: parsedResult.activeModal
|
|
32087
|
+
} : null,
|
|
32088
|
+
pendingScriptStatus: this.pendingScriptStatus,
|
|
32089
|
+
pendingScriptStatusSince: this.pendingScriptStatusSince
|
|
32090
|
+
},
|
|
32091
|
+
runtimeMetadata: this.getRuntimeMetadata(),
|
|
32092
|
+
statusHistory: this.statusHistory.slice(-80),
|
|
32093
|
+
traceEntries: this.traceEntries.slice(-120),
|
|
32094
|
+
timing: {
|
|
32095
|
+
spawnAt: this.spawnAt,
|
|
32096
|
+
startupFirstOutputAt: this.startupFirstOutputAt,
|
|
32097
|
+
submitPendingUntil: this.submitPendingUntil,
|
|
32098
|
+
responseSettleIgnoreUntil: this.responseSettleIgnoreUntil,
|
|
32099
|
+
responseEpoch: this.responseEpoch,
|
|
32100
|
+
resizeSuppressUntil: this.resizeSuppressUntil,
|
|
32101
|
+
lastApprovalResolvedAt: this.lastApprovalResolvedAt,
|
|
32102
|
+
committedMessagesChangedAt: this.committedMessagesChangedAt
|
|
32103
|
+
},
|
|
32104
|
+
finish: {
|
|
32105
|
+
idleFinishCandidate: this.idleFinishCandidate,
|
|
32106
|
+
finishRetryCount: this.finishRetryCount,
|
|
32107
|
+
submitRetryUsed: this.submitRetryUsed,
|
|
32108
|
+
submitRetryPromptSnippet: this.submitRetryPromptSnippet
|
|
32109
|
+
}
|
|
32110
|
+
};
|
|
32111
|
+
}
|
|
32030
32112
|
getRuntimeMetadata() {
|
|
32031
32113
|
if (!this.ptyProcess || typeof this.ptyProcess.getMetadata !== "function") return null;
|
|
32032
32114
|
return this.ptyProcess.getMetadata();
|
|
@@ -32382,6 +32464,7 @@ var require_dist2 = __commonJS({
|
|
|
32382
32464
|
detectCLIs: () => detectCLIs,
|
|
32383
32465
|
detectIDEs: () => detectIDEs,
|
|
32384
32466
|
ensureSessionHostReady: () => ensureSessionHostReady2,
|
|
32467
|
+
execNpmCommandSync: () => execNpmCommandSync,
|
|
32385
32468
|
findCdpManager: () => findCdpManager,
|
|
32386
32469
|
flattenMessageParts: () => flattenMessageParts,
|
|
32387
32470
|
forwardAgentStreamsToIdeInstance: () => forwardAgentStreamsToIdeInstance2,
|
|
@@ -32392,6 +32475,7 @@ var require_dist2 = __commonJS({
|
|
|
32392
32475
|
getDebugRuntimeConfig: () => getDebugRuntimeConfig,
|
|
32393
32476
|
getHostMemorySnapshot: () => getHostMemorySnapshot,
|
|
32394
32477
|
getLogLevel: () => getLogLevel,
|
|
32478
|
+
getNpmExecOptions: () => getNpmExecOptions,
|
|
32395
32479
|
getRecentActivity: () => getRecentActivity,
|
|
32396
32480
|
getRecentCommands: () => getRecentCommands,
|
|
32397
32481
|
getRecentDebugTrace: () => getRecentDebugTrace,
|
|
@@ -33120,7 +33204,11 @@ var require_dist2 = __commonJS({
|
|
|
33120
33204
|
}
|
|
33121
33205
|
function execAsync(cmd, timeoutMs = 5e3) {
|
|
33122
33206
|
return new Promise((resolve12) => {
|
|
33123
|
-
const child = (0, import_child_process2.exec)(cmd, {
|
|
33207
|
+
const child = (0, import_child_process2.exec)(cmd, {
|
|
33208
|
+
encoding: "utf-8",
|
|
33209
|
+
timeout: timeoutMs,
|
|
33210
|
+
...process.platform === "win32" ? { windowsHide: true } : {}
|
|
33211
|
+
}, (err, stdout) => {
|
|
33124
33212
|
if (err || !stdout?.trim()) {
|
|
33125
33213
|
resolve12(null);
|
|
33126
33214
|
} else {
|
|
@@ -38728,6 +38816,245 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38728
38816
|
...debugReadChat ? { debugReadChat } : {}
|
|
38729
38817
|
};
|
|
38730
38818
|
}
|
|
38819
|
+
var DEFAULT_DEBUG_SANITIZE_OPTIONS = {
|
|
38820
|
+
maxDepth: 8,
|
|
38821
|
+
maxArrayLength: 80,
|
|
38822
|
+
maxObjectKeys: 120,
|
|
38823
|
+
maxStringLength: 16e3
|
|
38824
|
+
};
|
|
38825
|
+
var SECRET_KEY_PATTERN = /(?:token|secret|password|passwd|authorization|cookie|api[_-]?key|access[_-]?key|refresh[_-]?token|client[_-]?secret|private[_-]?key)/i;
|
|
38826
|
+
function truncateDebugString(value, maxLength) {
|
|
38827
|
+
if (value.length <= maxLength) return value;
|
|
38828
|
+
return `${value.slice(0, maxLength)}\u2026[truncated ${value.length - maxLength} chars]`;
|
|
38829
|
+
}
|
|
38830
|
+
function redactDebugSecrets(value) {
|
|
38831
|
+
return value.replace(/(Authorization\s*:\s*Bearer\s+)[^\s'"`]+/gi, "$1[REDACTED:bearer]").replace(/(Bearer\s+)[A-Za-z0-9._~+\/-]{16,}=*/gi, "$1[REDACTED:bearer]").replace(/\b(?:gh[pousr]|github_pat)_[A-Za-z0-9_]{20,}\b/g, "[REDACTED:github-token]").replace(/\bsk-[A-Za-z0-9_-]{16,}\b/g, "[REDACTED:api-key]").replace(/\bxox[baprs]-[A-Za-z0-9-]{12,}\b/g, "[REDACTED:slack-token]").replace(/\b(?:adk|adm)_[A-Za-z0-9_-]{16,}\b/g, "[REDACTED:adhdev-token]").replace(/((?:api[_-]?key|token|secret|password|passwd|client[_-]?secret)\s*[:=]\s*)[^\s,'"`}&]+/gi, "$1[REDACTED:secret]").replace(/([?&](?:api[_-]?key|token|secret|password|client_secret)=)[^&#\s]+/gi, "$1[REDACTED:secret]");
|
|
38832
|
+
}
|
|
38833
|
+
function sanitizeDebugBundleValue(value, options = {}, depth = 0, keyHint = "") {
|
|
38834
|
+
const normalizedOptions = { ...DEFAULT_DEBUG_SANITIZE_OPTIONS, ...options };
|
|
38835
|
+
if (value === null || value === void 0) return value;
|
|
38836
|
+
if (typeof value === "number" || typeof value === "boolean") return value;
|
|
38837
|
+
if (typeof value === "bigint") return String(value);
|
|
38838
|
+
if (typeof value === "string") {
|
|
38839
|
+
if (SECRET_KEY_PATTERN.test(keyHint) && value.trim()) return "[REDACTED:secret-field]";
|
|
38840
|
+
return truncateDebugString(redactDebugSecrets(value), normalizedOptions.maxStringLength);
|
|
38841
|
+
}
|
|
38842
|
+
if (typeof value === "function") return `[Function ${value.name || "anonymous"}]`;
|
|
38843
|
+
if (typeof value !== "object") return String(value);
|
|
38844
|
+
if (depth >= normalizedOptions.maxDepth) return "[MaxDepth]";
|
|
38845
|
+
if (Array.isArray(value)) {
|
|
38846
|
+
const items = value.slice(0, normalizedOptions.maxArrayLength).map((item) => sanitizeDebugBundleValue(item, normalizedOptions, depth + 1, keyHint));
|
|
38847
|
+
if (value.length > normalizedOptions.maxArrayLength) {
|
|
38848
|
+
items.push(`[truncated ${value.length - normalizedOptions.maxArrayLength} items]`);
|
|
38849
|
+
}
|
|
38850
|
+
return items;
|
|
38851
|
+
}
|
|
38852
|
+
const record2 = value;
|
|
38853
|
+
const result = {};
|
|
38854
|
+
const entries = Object.entries(record2).slice(0, normalizedOptions.maxObjectKeys);
|
|
38855
|
+
for (const [key, item] of entries) {
|
|
38856
|
+
result[key] = sanitizeDebugBundleValue(item, normalizedOptions, depth + 1, key);
|
|
38857
|
+
}
|
|
38858
|
+
const remaining = Object.keys(record2).length - entries.length;
|
|
38859
|
+
if (remaining > 0) result.__truncatedKeys = remaining;
|
|
38860
|
+
return result;
|
|
38861
|
+
}
|
|
38862
|
+
function summarizeProviderForDebug(provider) {
|
|
38863
|
+
if (!provider) return null;
|
|
38864
|
+
const scripts = provider.scripts && typeof provider.scripts === "object" ? Object.keys(provider.scripts) : [];
|
|
38865
|
+
const controls = Array.isArray(provider.controls) ? provider.controls.map((control) => ({
|
|
38866
|
+
id: control?.id,
|
|
38867
|
+
label: control?.label,
|
|
38868
|
+
type: control?.type,
|
|
38869
|
+
settingKey: control?.settingKey,
|
|
38870
|
+
invokeScript: control?.invokeScript,
|
|
38871
|
+
listScript: control?.listScript,
|
|
38872
|
+
location: control?.location
|
|
38873
|
+
})) : [];
|
|
38874
|
+
return {
|
|
38875
|
+
type: provider.type,
|
|
38876
|
+
name: provider.name,
|
|
38877
|
+
category: provider.category,
|
|
38878
|
+
version: provider.version,
|
|
38879
|
+
canonicalHistory: provider.canonicalHistory,
|
|
38880
|
+
historyBehavior: provider.historyBehavior,
|
|
38881
|
+
webviewMatchText: provider.webviewMatchText,
|
|
38882
|
+
scriptNames: scripts,
|
|
38883
|
+
controls,
|
|
38884
|
+
resume: provider.resume
|
|
38885
|
+
};
|
|
38886
|
+
}
|
|
38887
|
+
function summarizeSessionForDebug(session) {
|
|
38888
|
+
if (!session || typeof session !== "object") return null;
|
|
38889
|
+
return {
|
|
38890
|
+
sessionId: session.sessionId,
|
|
38891
|
+
instanceKey: session.instanceKey,
|
|
38892
|
+
adapterKey: session.adapterKey,
|
|
38893
|
+
providerType: session.providerType,
|
|
38894
|
+
providerName: session.providerName,
|
|
38895
|
+
transport: session.transport,
|
|
38896
|
+
kind: session.kind,
|
|
38897
|
+
cdpManagerKey: session.cdpManagerKey,
|
|
38898
|
+
parentSessionId: session.parentSessionId,
|
|
38899
|
+
providerSessionId: session.providerSessionId,
|
|
38900
|
+
workspace: session.workspace,
|
|
38901
|
+
title: session.title,
|
|
38902
|
+
status: session.status,
|
|
38903
|
+
mode: session.mode,
|
|
38904
|
+
capabilities: session.capabilities
|
|
38905
|
+
};
|
|
38906
|
+
}
|
|
38907
|
+
function summarizeStateForDebug(state) {
|
|
38908
|
+
if (!state || typeof state !== "object") return null;
|
|
38909
|
+
const activeChat = state.activeChat && typeof state.activeChat === "object" ? state.activeChat : null;
|
|
38910
|
+
return {
|
|
38911
|
+
type: state.type,
|
|
38912
|
+
name: state.name,
|
|
38913
|
+
category: state.category,
|
|
38914
|
+
status: state.status,
|
|
38915
|
+
instanceId: state.instanceId,
|
|
38916
|
+
providerSessionId: state.providerSessionId,
|
|
38917
|
+
title: state.title,
|
|
38918
|
+
transport: state.transport,
|
|
38919
|
+
mode: state.mode,
|
|
38920
|
+
workspace: state.workspace,
|
|
38921
|
+
runtime: state.runtime,
|
|
38922
|
+
errorMessage: state.errorMessage,
|
|
38923
|
+
errorReason: state.errorReason,
|
|
38924
|
+
activeChat: activeChat ? {
|
|
38925
|
+
status: activeChat.status,
|
|
38926
|
+
title: activeChat.title,
|
|
38927
|
+
messageCount: Array.isArray(activeChat.messages) ? activeChat.messages.length : void 0,
|
|
38928
|
+
activeModal: activeChat.activeModal,
|
|
38929
|
+
messagesTail: Array.isArray(activeChat.messages) ? activeChat.messages.slice(-10) : void 0
|
|
38930
|
+
} : null,
|
|
38931
|
+
controlValues: state.controlValues,
|
|
38932
|
+
summaryMetadata: state.summaryMetadata
|
|
38933
|
+
};
|
|
38934
|
+
}
|
|
38935
|
+
function buildDebugBundleText(bundle) {
|
|
38936
|
+
return [
|
|
38937
|
+
"# ADHDev Chat Debug Bundle",
|
|
38938
|
+
"",
|
|
38939
|
+
"```json",
|
|
38940
|
+
JSON.stringify(bundle, null, 2),
|
|
38941
|
+
"```"
|
|
38942
|
+
].join("\n");
|
|
38943
|
+
}
|
|
38944
|
+
async function handleGetChatDebugBundle(h, args) {
|
|
38945
|
+
const provider = h.getProvider(args?.agentType);
|
|
38946
|
+
const transport = getTargetTransport(h, provider);
|
|
38947
|
+
const targetSessionId = typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "";
|
|
38948
|
+
const providerType = provider?.type || getCurrentProviderType(h, args?.agentType || "");
|
|
38949
|
+
const adapter = isCliLikeTransport(transport) ? getTargetedCliAdapter(h, args, provider?.type) : null;
|
|
38950
|
+
const targetInstance = getTargetInstance(h, args);
|
|
38951
|
+
let adapterStatus = null;
|
|
38952
|
+
let parsedStatus = null;
|
|
38953
|
+
let adapterDebugSnapshot = null;
|
|
38954
|
+
let partialResponse = "";
|
|
38955
|
+
if (adapter) {
|
|
38956
|
+
try {
|
|
38957
|
+
adapterStatus = adapter.getStatus?.();
|
|
38958
|
+
} catch (error48) {
|
|
38959
|
+
adapterStatus = { error: error48?.message || String(error48) };
|
|
38960
|
+
}
|
|
38961
|
+
try {
|
|
38962
|
+
parsedStatus = typeof adapter.getScriptParsedStatus === "function" ? parseMaybeJson(adapter.getScriptParsedStatus()) : null;
|
|
38963
|
+
} catch (error48) {
|
|
38964
|
+
parsedStatus = { error: error48?.message || String(error48) };
|
|
38965
|
+
}
|
|
38966
|
+
try {
|
|
38967
|
+
adapterDebugSnapshot = typeof adapter.getDebugSnapshot === "function" ? adapter.getDebugSnapshot() : null;
|
|
38968
|
+
} catch (error48) {
|
|
38969
|
+
adapterDebugSnapshot = { error: error48?.message || String(error48) };
|
|
38970
|
+
}
|
|
38971
|
+
try {
|
|
38972
|
+
partialResponse = adapter.getPartialResponse?.() || "";
|
|
38973
|
+
} catch {
|
|
38974
|
+
partialResponse = "";
|
|
38975
|
+
}
|
|
38976
|
+
}
|
|
38977
|
+
let instanceState = null;
|
|
38978
|
+
if (targetInstance?.getState) {
|
|
38979
|
+
try {
|
|
38980
|
+
instanceState = summarizeStateForDebug(targetInstance.getState());
|
|
38981
|
+
} catch (error48) {
|
|
38982
|
+
instanceState = { error: error48?.message || String(error48) };
|
|
38983
|
+
}
|
|
38984
|
+
}
|
|
38985
|
+
let readChat = null;
|
|
38986
|
+
try {
|
|
38987
|
+
const readResult = await handleReadChat(h, { ...args, tailLimit: Math.max(1, Math.min(40, Number(args?.tailLimit || 40))) });
|
|
38988
|
+
readChat = readResult.success ? {
|
|
38989
|
+
success: true,
|
|
38990
|
+
status: readResult.status,
|
|
38991
|
+
title: readResult.title,
|
|
38992
|
+
totalMessages: readResult.totalMessages,
|
|
38993
|
+
returnedMessages: Array.isArray(readResult.messages) ? readResult.messages.length : void 0,
|
|
38994
|
+
syncMode: readResult.syncMode,
|
|
38995
|
+
replaceFrom: readResult.replaceFrom,
|
|
38996
|
+
lastMessageSignature: readResult.lastMessageSignature,
|
|
38997
|
+
providerSessionId: readResult.providerSessionId,
|
|
38998
|
+
transcriptAuthority: readResult.transcriptAuthority,
|
|
38999
|
+
coverage: readResult.coverage,
|
|
39000
|
+
activeModal: readResult.activeModal,
|
|
39001
|
+
messagesTail: Array.isArray(readResult.messages) ? readResult.messages.slice(-20) : [],
|
|
39002
|
+
debugReadChat: readResult.debugReadChat
|
|
39003
|
+
} : { success: false, error: readResult.error };
|
|
39004
|
+
} catch (error48) {
|
|
39005
|
+
readChat = { success: false, error: error48?.message || String(error48) };
|
|
39006
|
+
}
|
|
39007
|
+
const cdp = h.getCdp();
|
|
39008
|
+
const rawBundle = {
|
|
39009
|
+
version: 1,
|
|
39010
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
39011
|
+
target: {
|
|
39012
|
+
targetSessionId,
|
|
39013
|
+
providerType,
|
|
39014
|
+
transport,
|
|
39015
|
+
routeManagerKey: h.currentManagerKey,
|
|
39016
|
+
currentIdeType: h.currentIdeType
|
|
39017
|
+
},
|
|
39018
|
+
session: summarizeSessionForDebug(h.currentSession),
|
|
39019
|
+
provider: summarizeProviderForDebug(provider),
|
|
39020
|
+
daemon: {
|
|
39021
|
+
pid: process.pid,
|
|
39022
|
+
platform: process.platform,
|
|
39023
|
+
nodeVersion: process.version,
|
|
39024
|
+
cwd: process.cwd()
|
|
39025
|
+
},
|
|
39026
|
+
cdp: {
|
|
39027
|
+
requested: !!cdp,
|
|
39028
|
+
connected: !!cdp?.isConnected,
|
|
39029
|
+
managerKey: getCurrentManagerKey(h)
|
|
39030
|
+
},
|
|
39031
|
+
instanceState,
|
|
39032
|
+
cli: adapter ? {
|
|
39033
|
+
cliType: adapter.cliType,
|
|
39034
|
+
cliName: adapter.cliName,
|
|
39035
|
+
workingDir: adapter.workingDir,
|
|
39036
|
+
status: adapterStatus?.status,
|
|
39037
|
+
activeModal: adapterStatus?.activeModal,
|
|
39038
|
+
messageCount: Array.isArray(adapterStatus?.messages) ? adapterStatus.messages.length : void 0,
|
|
39039
|
+
messagesTail: Array.isArray(adapterStatus?.messages) ? adapterStatus.messages.slice(-20) : void 0,
|
|
39040
|
+
parsedStatus,
|
|
39041
|
+
partialResponse,
|
|
39042
|
+
ready: typeof adapter.isReady === "function" ? adapter.isReady() : void 0,
|
|
39043
|
+
processing: typeof adapter.isProcessing === "function" ? adapter.isProcessing() : void 0,
|
|
39044
|
+
debugSnapshot: adapterDebugSnapshot
|
|
39045
|
+
} : null,
|
|
39046
|
+
readChat,
|
|
39047
|
+
frontend: args?.frontendSnapshot && typeof args.frontendSnapshot === "object" ? args.frontendSnapshot : null,
|
|
39048
|
+
recentLogs: getRecentLogs(80, "debug"),
|
|
39049
|
+
recentDebugTrace: getRecentDebugTrace({ limit: 120 })
|
|
39050
|
+
};
|
|
39051
|
+
const bundle = sanitizeDebugBundleValue(rawBundle);
|
|
39052
|
+
return {
|
|
39053
|
+
success: true,
|
|
39054
|
+
bundle,
|
|
39055
|
+
text: buildDebugBundleText(bundle)
|
|
39056
|
+
};
|
|
39057
|
+
}
|
|
38731
39058
|
function didProviderConfirmSend(result) {
|
|
38732
39059
|
const parsed = parseMaybeJson(result);
|
|
38733
39060
|
if (parsed === true) return true;
|
|
@@ -40910,6 +41237,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40910
41237
|
// ─── Chat commands (chat-commands.ts) ───────────────
|
|
40911
41238
|
case "read_chat":
|
|
40912
41239
|
return handleReadChat(this, args);
|
|
41240
|
+
case "get_chat_debug_bundle":
|
|
41241
|
+
return handleGetChatDebugBundle(this, args);
|
|
40913
41242
|
case "chat_history":
|
|
40914
41243
|
return handleChatHistory(this, args);
|
|
40915
41244
|
case "send_chat":
|
|
@@ -42580,7 +42909,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
42580
42909
|
cwd: this.workingDir,
|
|
42581
42910
|
env,
|
|
42582
42911
|
stdio: ["pipe", "pipe", "pipe"],
|
|
42583
|
-
shell: spawnConfig.shell || false
|
|
42912
|
+
shell: spawnConfig.shell || false,
|
|
42913
|
+
...process.platform === "win32" ? { windowsHide: true } : {}
|
|
42584
42914
|
});
|
|
42585
42915
|
const AUTH_ERROR_PATTERNS = [
|
|
42586
42916
|
/unauthorized|unauthenticated/i,
|
|
@@ -43270,7 +43600,10 @@ ${rawInput}` : rawInput;
|
|
|
43270
43600
|
return (0, import_fs5.existsSync)(expandExecutable(trimmed));
|
|
43271
43601
|
}
|
|
43272
43602
|
try {
|
|
43273
|
-
(0, import_child_process6.execFileSync)(process.platform === "win32" ? "where" : "which", [trimmed], {
|
|
43603
|
+
(0, import_child_process6.execFileSync)(process.platform === "win32" ? "where" : "which", [trimmed], {
|
|
43604
|
+
stdio: "ignore",
|
|
43605
|
+
...process.platform === "win32" ? { windowsHide: true } : {}
|
|
43606
|
+
});
|
|
43274
43607
|
return true;
|
|
43275
43608
|
} catch {
|
|
43276
43609
|
return false;
|
|
@@ -46191,7 +46524,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
46191
46524
|
const canUseAppLauncher = !!appName;
|
|
46192
46525
|
const useAppLauncher = preferredMethod === "app" ? canUseAppLauncher : preferredMethod === "cli" ? false : !canUseCli && canUseAppLauncher;
|
|
46193
46526
|
if (!useAppLauncher && ide.cliCommand) {
|
|
46194
|
-
(0, import_child_process7.spawn)(ide.cliCommand, args, { detached: true, stdio: "ignore" }).unref();
|
|
46527
|
+
(0, import_child_process7.spawn)(ide.cliCommand, args, { detached: true, stdio: "ignore", windowsHide: true }).unref();
|
|
46195
46528
|
} else if (appName) {
|
|
46196
46529
|
const openArgs = ["-a", appName, "--args", ...args];
|
|
46197
46530
|
(0, import_child_process7.spawn)("open", openArgs, { detached: true, stdio: "ignore" }).unref();
|
|
@@ -46220,7 +46553,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
46220
46553
|
const args = ["--remote-debugging-port=" + port];
|
|
46221
46554
|
if (newWindow) args.push("--new-window");
|
|
46222
46555
|
if (workspace) args.push(workspace);
|
|
46223
|
-
(0, import_child_process7.spawn)(cli, args, { detached: true, stdio: "ignore" }).unref();
|
|
46556
|
+
(0, import_child_process7.spawn)(cli, args, { detached: true, stdio: "ignore", windowsHide: true }).unref();
|
|
46224
46557
|
}
|
|
46225
46558
|
function getAvailableIdeIds() {
|
|
46226
46559
|
return getProviderLoader().getAvailableIdeTypes();
|
|
@@ -46699,23 +47032,23 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
46699
47032
|
if (platform10 === "win32") {
|
|
46700
47033
|
const npmCliPath = path16.join(binDir, "node_modules", "npm", "bin", "npm-cli.js");
|
|
46701
47034
|
if (fs8.existsSync(npmCliPath)) {
|
|
46702
|
-
return { executable: nodeExecutable, argsPrefix: [npmCliPath], execOptions:
|
|
47035
|
+
return { executable: nodeExecutable, argsPrefix: [npmCliPath], execOptions: getNpmExecOptions(platform10) };
|
|
46703
47036
|
}
|
|
46704
47037
|
for (const candidate of ["npm.exe", "npm"]) {
|
|
46705
47038
|
const candidatePath = path16.join(binDir, candidate);
|
|
46706
47039
|
if (fs8.existsSync(candidatePath)) {
|
|
46707
|
-
return { executable: candidatePath, argsPrefix: [], execOptions:
|
|
47040
|
+
return { executable: candidatePath, argsPrefix: [], execOptions: getNpmExecOptions(platform10) };
|
|
46708
47041
|
}
|
|
46709
47042
|
}
|
|
46710
|
-
return { executable: nodeExecutable, argsPrefix: [npmCliPath], execOptions:
|
|
47043
|
+
return { executable: nodeExecutable, argsPrefix: [npmCliPath], execOptions: getNpmExecOptions(platform10) };
|
|
46711
47044
|
}
|
|
46712
47045
|
for (const candidate of ["npm"]) {
|
|
46713
47046
|
const candidatePath = path16.join(binDir, candidate);
|
|
46714
47047
|
if (fs8.existsSync(candidatePath)) {
|
|
46715
|
-
return { executable: candidatePath, argsPrefix: [], execOptions:
|
|
47048
|
+
return { executable: candidatePath, argsPrefix: [], execOptions: getNpmExecOptions(platform10) };
|
|
46716
47049
|
}
|
|
46717
47050
|
}
|
|
46718
|
-
return { executable: "npm", argsPrefix: [], execOptions:
|
|
47051
|
+
return { executable: "npm", argsPrefix: [], execOptions: getNpmExecOptions(platform10) };
|
|
46719
47052
|
}
|
|
46720
47053
|
function findCurrentPackageRoot(currentCliPath, packageName) {
|
|
46721
47054
|
if (!currentCliPath) return null;
|
|
@@ -46786,13 +47119,28 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
46786
47119
|
execOptions: surface.execOptions || getNpmExecOptions(options.platform)
|
|
46787
47120
|
};
|
|
46788
47121
|
}
|
|
46789
|
-
function getNpmExecOptions(
|
|
47122
|
+
function getNpmExecOptions(platform10 = process.platform) {
|
|
47123
|
+
if (platform10 === "win32") {
|
|
47124
|
+
return { shell: false, windowsHide: true };
|
|
47125
|
+
}
|
|
46790
47126
|
return { shell: false };
|
|
46791
47127
|
}
|
|
47128
|
+
function execNpmCommandSync(args, options = {}, surface) {
|
|
47129
|
+
const execOptions = surface?.execOptions || getNpmExecOptions();
|
|
47130
|
+
return (0, import_child_process8.execFileSync)(
|
|
47131
|
+
surface?.npmExecutable || "npm",
|
|
47132
|
+
[...surface?.npmArgsPrefix || [], ...args],
|
|
47133
|
+
{
|
|
47134
|
+
...options,
|
|
47135
|
+
...execOptions,
|
|
47136
|
+
...process.platform === "win32" ? { windowsHide: true } : {}
|
|
47137
|
+
}
|
|
47138
|
+
);
|
|
47139
|
+
}
|
|
46792
47140
|
function killPid2(pid) {
|
|
46793
47141
|
try {
|
|
46794
47142
|
if (process.platform === "win32") {
|
|
46795
|
-
(0, import_child_process8.execFileSync)("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore" });
|
|
47143
|
+
(0, import_child_process8.execFileSync)("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
|
|
46796
47144
|
} else {
|
|
46797
47145
|
process.kill(pid, "SIGTERM");
|
|
46798
47146
|
}
|
|
@@ -46811,7 +47159,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
46811
47159
|
"Bypass",
|
|
46812
47160
|
"-Command",
|
|
46813
47161
|
`(Get-CimInstance Win32_Process -Filter "${pidFilter}").CommandLine`
|
|
46814
|
-
], { encoding: "utf8", timeout: 5e3, stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
47162
|
+
], { encoding: "utf8", timeout: 5e3, stdio: ["ignore", "pipe", "ignore"], windowsHide: true }).trim();
|
|
46815
47163
|
if (psOut) return psOut;
|
|
46816
47164
|
} catch {
|
|
46817
47165
|
}
|
|
@@ -46822,7 +47170,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
46822
47170
|
pidFilter,
|
|
46823
47171
|
"get",
|
|
46824
47172
|
"CommandLine"
|
|
46825
|
-
], { encoding: "utf8", timeout: 3e3, stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
47173
|
+
], { encoding: "utf8", timeout: 3e3, stdio: ["ignore", "pipe", "ignore"], windowsHide: true }).trim();
|
|
46826
47174
|
if (wmicOut) return wmicOut;
|
|
46827
47175
|
} catch {
|
|
46828
47176
|
}
|
|
@@ -46883,9 +47231,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
46883
47231
|
}
|
|
46884
47232
|
function cleanupStaleGlobalInstallDirs(pkgName, surface) {
|
|
46885
47233
|
const prefixArgs = surface.installPrefix ? ["--prefix", surface.installPrefix] : [];
|
|
46886
|
-
const npmRoot = (
|
|
47234
|
+
const npmRoot = String(execNpmCommandSync(["root", "-g", ...prefixArgs], { encoding: "utf8" }, surface)).trim();
|
|
46887
47235
|
if (!npmRoot) return;
|
|
46888
|
-
const npmPrefix = surface.installPrefix || (
|
|
47236
|
+
const npmPrefix = surface.installPrefix || String(execNpmCommandSync(["prefix", "-g", ...prefixArgs], { encoding: "utf8" }, surface)).trim();
|
|
46889
47237
|
const binDir = process.platform === "win32" ? npmPrefix : path16.join(npmPrefix, "bin");
|
|
46890
47238
|
const packageBaseName = pkgName.startsWith("@") ? pkgName.split("/")[1] : pkgName;
|
|
46891
47239
|
const binNames = /* @__PURE__ */ new Set([packageBaseName]);
|
|
@@ -47668,18 +48016,18 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
47668
48016
|
case "daemon_upgrade": {
|
|
47669
48017
|
LOG2.info("Upgrade", "Remote upgrade requested from dashboard");
|
|
47670
48018
|
try {
|
|
47671
|
-
const { execSync: execSync7 } = await import("child_process");
|
|
47672
48019
|
const isStandalone = this.deps.packageName === "@adhdev/daemon-standalone" || process.argv[1]?.includes("daemon-standalone");
|
|
47673
48020
|
const pkgName = isStandalone ? "@adhdev/daemon-standalone" : "adhdev";
|
|
47674
|
-
const
|
|
48021
|
+
const npmSurface = resolveCurrentGlobalInstallSurface({ packageName: pkgName });
|
|
48022
|
+
const latest = String(execNpmCommandSync(["view", pkgName, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
|
|
47675
48023
|
LOG2.info("Upgrade", `Latest ${pkgName}: v${latest}`);
|
|
47676
48024
|
let currentInstalled = null;
|
|
47677
48025
|
try {
|
|
47678
|
-
const currentJson =
|
|
48026
|
+
const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
|
|
47679
48027
|
encoding: "utf-8",
|
|
47680
48028
|
timeout: 1e4,
|
|
47681
48029
|
stdio: ["pipe", "pipe", "pipe"]
|
|
47682
|
-
}).trim();
|
|
48030
|
+
}, npmSurface)).trim();
|
|
47683
48031
|
const parsed = JSON.parse(currentJson);
|
|
47684
48032
|
currentInstalled = parsed?.dependencies?.[pkgName]?.version || null;
|
|
47685
48033
|
} catch {
|