@adhdev/daemon-standalone 0.8.18 → 0.8.20
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 +124 -61
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-Bstot1gm.css +1 -0
- package/public/assets/index-Dbj6WLx2.js +61 -0
- package/public/index.html +2 -2
- package/public/assets/index-BDnxjriY.css +0 -1
- package/public/assets/index-D3Sx4iYL.js +0 -61
package/dist/index.js
CHANGED
|
@@ -27836,14 +27836,6 @@ var require_dist2 = __commonJS({
|
|
|
27836
27836
|
}
|
|
27837
27837
|
function normalizeConfig(raw) {
|
|
27838
27838
|
const parsed = isPlainObject2(raw) ? raw : {};
|
|
27839
|
-
const legacySessionReads = isPlainObject2(parsed.recentSessionReads) ? parsed.recentSessionReads : {};
|
|
27840
|
-
const sessionReads = isPlainObject2(parsed.sessionReads) ? parsed.sessionReads : {};
|
|
27841
|
-
const mergedSessionReads = Object.fromEntries(
|
|
27842
|
-
Object.entries({ ...legacySessionReads, ...sessionReads }).filter(([, value]) => typeof value === "number" && Number.isFinite(value))
|
|
27843
|
-
);
|
|
27844
|
-
const sessionReadMarkers = Object.fromEntries(
|
|
27845
|
-
Object.entries(isPlainObject2(parsed.sessionReadMarkers) ? parsed.sessionReadMarkers : {}).filter(([, value]) => typeof value === "string")
|
|
27846
|
-
);
|
|
27847
27839
|
return {
|
|
27848
27840
|
serverUrl: typeof parsed.serverUrl === "string" && parsed.serverUrl.trim() ? parsed.serverUrl : DEFAULT_CONFIG.serverUrl,
|
|
27849
27841
|
selectedIde: asNullableString(parsed.selectedIde),
|
|
@@ -27856,10 +27848,6 @@ var require_dist2 = __commonJS({
|
|
|
27856
27848
|
enabledIdes: asStringArray(parsed.enabledIdes),
|
|
27857
27849
|
workspaces: Array.isArray(parsed.workspaces) ? parsed.workspaces : [],
|
|
27858
27850
|
defaultWorkspaceId: asNullableString(parsed.defaultWorkspaceId) ?? asNullableString(parsed.activeWorkspaceId),
|
|
27859
|
-
recentActivity: Array.isArray(parsed.recentActivity) ? parsed.recentActivity : [],
|
|
27860
|
-
savedProviderSessions: Array.isArray(parsed.savedProviderSessions) ? parsed.savedProviderSessions : [],
|
|
27861
|
-
sessionReads: mergedSessionReads,
|
|
27862
|
-
sessionReadMarkers,
|
|
27863
27851
|
machineNickname: asNullableString(parsed.machineNickname),
|
|
27864
27852
|
machineId: asOptionalString(parsed.machineId),
|
|
27865
27853
|
machineSecret: parsed.machineSecret === null ? null : asOptionalString(parsed.machineSecret),
|
|
@@ -27900,6 +27888,30 @@ var require_dist2 = __commonJS({
|
|
|
27900
27888
|
function getConfigPath() {
|
|
27901
27889
|
return (0, import_path2.join)(getConfigDir(), "config.json");
|
|
27902
27890
|
}
|
|
27891
|
+
function migrateStateToStateFile(raw) {
|
|
27892
|
+
const statePath = (0, import_path2.join)(getConfigDir(), "state.json");
|
|
27893
|
+
if ((0, import_fs.existsSync)(statePath)) return;
|
|
27894
|
+
const recentActivity = Array.isArray(raw.recentActivity) ? raw.recentActivity : [];
|
|
27895
|
+
const savedProviderSessions = Array.isArray(raw.savedProviderSessions) ? raw.savedProviderSessions : [];
|
|
27896
|
+
const legacySessionReads = isPlainObject2(raw.recentSessionReads) ? raw.recentSessionReads : {};
|
|
27897
|
+
const sessionReads = isPlainObject2(raw.sessionReads) ? raw.sessionReads : {};
|
|
27898
|
+
const sessionReadMarkers = isPlainObject2(raw.sessionReadMarkers) ? raw.sessionReadMarkers : {};
|
|
27899
|
+
const hasData = recentActivity.length > 0 || savedProviderSessions.length > 0 || Object.keys(sessionReads).length > 0 || Object.keys(legacySessionReads).length > 0 || Object.keys(sessionReadMarkers).length > 0;
|
|
27900
|
+
if (!hasData) return;
|
|
27901
|
+
const mergedReads = Object.fromEntries(
|
|
27902
|
+
Object.entries({ ...legacySessionReads, ...sessionReads }).filter(([, v2]) => typeof v2 === "number" && Number.isFinite(v2))
|
|
27903
|
+
);
|
|
27904
|
+
const cleanedMarkers = Object.fromEntries(
|
|
27905
|
+
Object.entries(sessionReadMarkers).filter(([, v2]) => typeof v2 === "string")
|
|
27906
|
+
);
|
|
27907
|
+
const state = {
|
|
27908
|
+
recentActivity,
|
|
27909
|
+
savedProviderSessions,
|
|
27910
|
+
sessionReads: mergedReads,
|
|
27911
|
+
sessionReadMarkers: cleanedMarkers
|
|
27912
|
+
};
|
|
27913
|
+
(0, import_fs.writeFileSync)(statePath, JSON.stringify(state, null, 2), { encoding: "utf-8", mode: 384 });
|
|
27914
|
+
}
|
|
27903
27915
|
function loadConfig2() {
|
|
27904
27916
|
const configPath = getConfigPath();
|
|
27905
27917
|
if (!(0, import_fs.existsSync)(configPath)) {
|
|
@@ -27913,6 +27925,7 @@ var require_dist2 = __commonJS({
|
|
|
27913
27925
|
try {
|
|
27914
27926
|
const raw = (0, import_fs.readFileSync)(configPath, "utf-8");
|
|
27915
27927
|
const parsed = JSON.parse(raw);
|
|
27928
|
+
migrateStateToStateFile(parsed);
|
|
27916
27929
|
const normalizedInput = normalizeConfig(parsed);
|
|
27917
27930
|
const ensured = ensureMachineId(normalizedInput);
|
|
27918
27931
|
const normalized = ensured.config;
|
|
@@ -27989,10 +28002,6 @@ var require_dist2 = __commonJS({
|
|
|
27989
28002
|
enabledIdes: [],
|
|
27990
28003
|
workspaces: [],
|
|
27991
28004
|
defaultWorkspaceId: null,
|
|
27992
|
-
recentActivity: [],
|
|
27993
|
-
savedProviderSessions: [],
|
|
27994
|
-
sessionReads: {},
|
|
27995
|
-
sessionReadMarkers: {},
|
|
27996
28005
|
machineNickname: null,
|
|
27997
28006
|
machineId: void 0,
|
|
27998
28007
|
machineSecret: null,
|
|
@@ -30400,6 +30409,7 @@ ${data.message || ""}`.trim();
|
|
|
30400
30409
|
launchWithCdp: () => launchWithCdp,
|
|
30401
30410
|
listHostedCliRuntimes: () => listHostedCliRuntimes2,
|
|
30402
30411
|
loadConfig: () => loadConfig2,
|
|
30412
|
+
loadState: () => loadState,
|
|
30403
30413
|
logCommand: () => logCommand,
|
|
30404
30414
|
markSetupComplete: () => markSetupComplete,
|
|
30405
30415
|
maybeRunDaemonUpgradeHelperFromEnv: () => maybeRunDaemonUpgradeHelperFromEnv2,
|
|
@@ -30409,7 +30419,9 @@ ${data.message || ""}`.trim();
|
|
|
30409
30419
|
readChatHistory: () => readChatHistory,
|
|
30410
30420
|
registerExtensionProviders: () => registerExtensionProviders,
|
|
30411
30421
|
resetConfig: () => resetConfig,
|
|
30422
|
+
resetState: () => resetState,
|
|
30412
30423
|
saveConfig: () => saveConfig,
|
|
30424
|
+
saveState: () => saveState,
|
|
30413
30425
|
setLogLevel: () => setLogLevel,
|
|
30414
30426
|
setupIdeInstance: () => setupIdeInstance,
|
|
30415
30427
|
shutdownDaemonComponents: () => shutdownDaemonComponents2,
|
|
@@ -30604,35 +30616,35 @@ ${data.message || ""}`.trim();
|
|
|
30604
30616
|
}
|
|
30605
30617
|
return buildRecentActivityKey(entry);
|
|
30606
30618
|
}
|
|
30607
|
-
function appendRecentActivity(
|
|
30619
|
+
function appendRecentActivity(state, entry) {
|
|
30608
30620
|
const nextEntry = {
|
|
30609
30621
|
...entry,
|
|
30610
30622
|
workspace: entry.workspace ? normalizeWorkspace(entry.workspace) : void 0,
|
|
30611
30623
|
id: buildRecentActivityKeyForEntry(entry),
|
|
30612
30624
|
lastUsedAt: entry.lastUsedAt || Date.now()
|
|
30613
30625
|
};
|
|
30614
|
-
const filtered = (
|
|
30626
|
+
const filtered = (state.recentActivity || []).filter((item) => item.id !== nextEntry.id);
|
|
30615
30627
|
return {
|
|
30616
|
-
...
|
|
30628
|
+
...state,
|
|
30617
30629
|
recentActivity: [nextEntry, ...filtered].slice(0, MAX_ACTIVITY)
|
|
30618
30630
|
};
|
|
30619
30631
|
}
|
|
30620
|
-
function getRecentActivity(
|
|
30621
|
-
return [...
|
|
30632
|
+
function getRecentActivity(state, limit = 20) {
|
|
30633
|
+
return [...state.recentActivity || []].sort((a, b2) => b2.lastUsedAt - a.lastUsedAt).slice(0, limit);
|
|
30622
30634
|
}
|
|
30623
|
-
function getSessionSeenAt(
|
|
30624
|
-
return
|
|
30635
|
+
function getSessionSeenAt(state, sessionId) {
|
|
30636
|
+
return state.sessionReads?.[sessionId] || 0;
|
|
30625
30637
|
}
|
|
30626
|
-
function getSessionSeenMarker(
|
|
30627
|
-
return
|
|
30638
|
+
function getSessionSeenMarker(state, sessionId) {
|
|
30639
|
+
return state.sessionReadMarkers?.[sessionId] || "";
|
|
30628
30640
|
}
|
|
30629
|
-
function markSessionSeen(
|
|
30630
|
-
const prev =
|
|
30641
|
+
function markSessionSeen(state, sessionId, seenAt = Date.now(), completionMarker) {
|
|
30642
|
+
const prev = state.sessionReads || {};
|
|
30631
30643
|
const nextSeenAt = Math.max(prev[sessionId] || 0, seenAt);
|
|
30632
|
-
const prevMarkers =
|
|
30644
|
+
const prevMarkers = state.sessionReadMarkers || {};
|
|
30633
30645
|
const nextMarker = typeof completionMarker === "string" ? completionMarker : "";
|
|
30634
30646
|
return {
|
|
30635
|
-
...
|
|
30647
|
+
...state,
|
|
30636
30648
|
sessionReads: {
|
|
30637
30649
|
...prev,
|
|
30638
30650
|
[sessionId]: nextSeenAt
|
|
@@ -30656,11 +30668,11 @@ ${data.message || ""}`.trim();
|
|
|
30656
30668
|
function buildSavedProviderSessionKey(providerSessionId) {
|
|
30657
30669
|
return `saved:${providerSessionId.trim()}`;
|
|
30658
30670
|
}
|
|
30659
|
-
function upsertSavedProviderSession(
|
|
30671
|
+
function upsertSavedProviderSession(state, entry) {
|
|
30660
30672
|
const providerSessionId = typeof entry.providerSessionId === "string" ? entry.providerSessionId.trim() : "";
|
|
30661
|
-
if (!providerSessionId) return
|
|
30673
|
+
if (!providerSessionId) return state;
|
|
30662
30674
|
const id = buildSavedProviderSessionKey(providerSessionId);
|
|
30663
|
-
const existing = (
|
|
30675
|
+
const existing = (state.savedProviderSessions || []).find((item) => item.id === id);
|
|
30664
30676
|
const nextEntry = {
|
|
30665
30677
|
id,
|
|
30666
30678
|
kind: entry.kind,
|
|
@@ -30673,21 +30685,71 @@ ${data.message || ""}`.trim();
|
|
|
30673
30685
|
createdAt: existing?.createdAt || entry.createdAt || Date.now(),
|
|
30674
30686
|
lastUsedAt: entry.lastUsedAt || Date.now()
|
|
30675
30687
|
};
|
|
30676
|
-
const filtered = (
|
|
30688
|
+
const filtered = (state.savedProviderSessions || []).filter((item) => item.id !== id);
|
|
30677
30689
|
return {
|
|
30678
|
-
...
|
|
30690
|
+
...state,
|
|
30679
30691
|
savedProviderSessions: [nextEntry, ...filtered].slice(0, MAX_SAVED_SESSIONS)
|
|
30680
30692
|
};
|
|
30681
30693
|
}
|
|
30682
|
-
function getSavedProviderSessions(
|
|
30683
|
-
return [...
|
|
30694
|
+
function getSavedProviderSessions(state, filters) {
|
|
30695
|
+
return [...state.savedProviderSessions || []].filter((entry) => {
|
|
30684
30696
|
if (filters?.providerType && entry.providerType !== filters.providerType) return false;
|
|
30685
30697
|
if (filters?.kind && entry.kind !== filters.kind) return false;
|
|
30686
30698
|
return true;
|
|
30687
30699
|
}).sort((a, b2) => b2.lastUsedAt - a.lastUsedAt);
|
|
30688
30700
|
}
|
|
30689
|
-
var import_child_process2 = require("child_process");
|
|
30690
30701
|
var import_fs2 = require("fs");
|
|
30702
|
+
var import_path22 = require("path");
|
|
30703
|
+
init_config();
|
|
30704
|
+
var DEFAULT_STATE = {
|
|
30705
|
+
recentActivity: [],
|
|
30706
|
+
savedProviderSessions: [],
|
|
30707
|
+
sessionReads: {},
|
|
30708
|
+
sessionReadMarkers: {}
|
|
30709
|
+
};
|
|
30710
|
+
function isPlainObject22(value) {
|
|
30711
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
30712
|
+
}
|
|
30713
|
+
function getStatePath() {
|
|
30714
|
+
return (0, import_path22.join)(getConfigDir(), "state.json");
|
|
30715
|
+
}
|
|
30716
|
+
function normalizeState(raw) {
|
|
30717
|
+
const parsed = isPlainObject22(raw) ? raw : {};
|
|
30718
|
+
const sessionReads = Object.fromEntries(
|
|
30719
|
+
Object.entries(isPlainObject22(parsed.sessionReads) ? parsed.sessionReads : {}).filter(([, value]) => typeof value === "number" && Number.isFinite(value))
|
|
30720
|
+
);
|
|
30721
|
+
const sessionReadMarkers = Object.fromEntries(
|
|
30722
|
+
Object.entries(isPlainObject22(parsed.sessionReadMarkers) ? parsed.sessionReadMarkers : {}).filter(([, value]) => typeof value === "string")
|
|
30723
|
+
);
|
|
30724
|
+
return {
|
|
30725
|
+
recentActivity: Array.isArray(parsed.recentActivity) ? parsed.recentActivity : [],
|
|
30726
|
+
savedProviderSessions: Array.isArray(parsed.savedProviderSessions) ? parsed.savedProviderSessions : [],
|
|
30727
|
+
sessionReads,
|
|
30728
|
+
sessionReadMarkers
|
|
30729
|
+
};
|
|
30730
|
+
}
|
|
30731
|
+
function loadState() {
|
|
30732
|
+
const statePath = getStatePath();
|
|
30733
|
+
if (!(0, import_fs2.existsSync)(statePath)) {
|
|
30734
|
+
return { ...DEFAULT_STATE };
|
|
30735
|
+
}
|
|
30736
|
+
try {
|
|
30737
|
+
const raw = (0, import_fs2.readFileSync)(statePath, "utf-8");
|
|
30738
|
+
return normalizeState(JSON.parse(raw));
|
|
30739
|
+
} catch {
|
|
30740
|
+
return { ...DEFAULT_STATE };
|
|
30741
|
+
}
|
|
30742
|
+
}
|
|
30743
|
+
function saveState(state) {
|
|
30744
|
+
const statePath = getStatePath();
|
|
30745
|
+
const normalized = normalizeState(state);
|
|
30746
|
+
(0, import_fs2.writeFileSync)(statePath, JSON.stringify(normalized, null, 2), { encoding: "utf-8", mode: 384 });
|
|
30747
|
+
}
|
|
30748
|
+
function resetState() {
|
|
30749
|
+
saveState({ ...DEFAULT_STATE });
|
|
30750
|
+
}
|
|
30751
|
+
var import_child_process2 = require("child_process");
|
|
30752
|
+
var import_fs3 = require("fs");
|
|
30691
30753
|
var import_os22 = require("os");
|
|
30692
30754
|
var BUILTIN_IDE_DEFINITIONS = [];
|
|
30693
30755
|
var registeredIDEs = /* @__PURE__ */ new Map();
|
|
@@ -30733,9 +30795,9 @@ ${data.message || ""}`.trim();
|
|
|
30733
30795
|
if (p.includes("*")) {
|
|
30734
30796
|
const username = home.split(/[\\/]/).pop() || "";
|
|
30735
30797
|
const resolved = p.replace("*", username);
|
|
30736
|
-
if ((0,
|
|
30798
|
+
if ((0, import_fs3.existsSync)(resolved)) return resolved;
|
|
30737
30799
|
} else {
|
|
30738
|
-
if ((0,
|
|
30800
|
+
if ((0, import_fs3.existsSync)(p)) return p;
|
|
30739
30801
|
}
|
|
30740
30802
|
}
|
|
30741
30803
|
return null;
|
|
@@ -30750,7 +30812,7 @@ ${data.message || ""}`.trim();
|
|
|
30750
30812
|
let resolvedCli = cliPath;
|
|
30751
30813
|
if (!resolvedCli && appPath && os18 === "darwin") {
|
|
30752
30814
|
const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
|
|
30753
|
-
if ((0,
|
|
30815
|
+
if ((0, import_fs3.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
30754
30816
|
}
|
|
30755
30817
|
if (!resolvedCli && appPath && os18 === "win32") {
|
|
30756
30818
|
const { dirname: dirname6 } = await import("path");
|
|
@@ -30763,7 +30825,7 @@ ${data.message || ""}`.trim();
|
|
|
30763
30825
|
`${appDir}\\\\resources\\\\app\\\\bin\\\\${def.cli}.cmd`
|
|
30764
30826
|
];
|
|
30765
30827
|
for (const c of candidates) {
|
|
30766
|
-
if ((0,
|
|
30828
|
+
if ((0, import_fs3.existsSync)(c)) {
|
|
30767
30829
|
resolvedCli = c;
|
|
30768
30830
|
break;
|
|
30769
30831
|
}
|
|
@@ -37345,9 +37407,9 @@ ${data.message || ""}`.trim();
|
|
|
37345
37407
|
}
|
|
37346
37408
|
persistRecentActivity(entry) {
|
|
37347
37409
|
try {
|
|
37348
|
-
let
|
|
37410
|
+
let nextState = appendRecentActivity(loadState(), entry);
|
|
37349
37411
|
if (entry.providerSessionId && (entry.kind === "cli" || entry.kind === "acp")) {
|
|
37350
|
-
|
|
37412
|
+
nextState = upsertSavedProviderSession(nextState, {
|
|
37351
37413
|
kind: entry.kind,
|
|
37352
37414
|
providerType: entry.providerType,
|
|
37353
37415
|
providerName: entry.providerName,
|
|
@@ -37357,7 +37419,7 @@ ${data.message || ""}`.trim();
|
|
|
37357
37419
|
title: entry.title
|
|
37358
37420
|
});
|
|
37359
37421
|
}
|
|
37360
|
-
|
|
37422
|
+
saveState(nextState);
|
|
37361
37423
|
} catch (e) {
|
|
37362
37424
|
console.error(colorize("red", ` \u2717 Failed to save recent activity: ${e}`));
|
|
37363
37425
|
}
|
|
@@ -38145,14 +38207,14 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
38145
38207
|
*/
|
|
38146
38208
|
setIdeExtensionEnabled(ideType, extensionType, enabled) {
|
|
38147
38209
|
try {
|
|
38148
|
-
const { loadConfig: loadConfig22, saveConfig:
|
|
38210
|
+
const { loadConfig: loadConfig22, saveConfig: saveConfig3 } = (init_config(), __toCommonJS2(config_exports));
|
|
38149
38211
|
const config2 = loadConfig22();
|
|
38150
38212
|
const baseIdeType = ideType.split("_")[0];
|
|
38151
38213
|
if (!config2.ideSettings) config2.ideSettings = {};
|
|
38152
38214
|
if (!config2.ideSettings[baseIdeType]) config2.ideSettings[baseIdeType] = {};
|
|
38153
38215
|
if (!config2.ideSettings[baseIdeType].extensions) config2.ideSettings[baseIdeType].extensions = {};
|
|
38154
38216
|
config2.ideSettings[baseIdeType].extensions[extensionType] = { enabled };
|
|
38155
|
-
|
|
38217
|
+
saveConfig3(config2);
|
|
38156
38218
|
this.log(`IDE extension setting: ${ideType}.${extensionType}.enabled = ${enabled}`);
|
|
38157
38219
|
return true;
|
|
38158
38220
|
} catch (e) {
|
|
@@ -38717,12 +38779,12 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
38717
38779
|
}
|
|
38718
38780
|
if (schemaDef.type === "select" && schemaDef.options && !schemaDef.options.includes(value)) return false;
|
|
38719
38781
|
try {
|
|
38720
|
-
const { loadConfig: loadConfig22, saveConfig:
|
|
38782
|
+
const { loadConfig: loadConfig22, saveConfig: saveConfig3 } = (init_config(), __toCommonJS2(config_exports));
|
|
38721
38783
|
const config2 = loadConfig22();
|
|
38722
38784
|
if (!config2.providerSettings) config2.providerSettings = {};
|
|
38723
38785
|
if (!config2.providerSettings[type]) config2.providerSettings[type] = {};
|
|
38724
38786
|
config2.providerSettings[type][key] = value;
|
|
38725
|
-
|
|
38787
|
+
saveConfig3(config2);
|
|
38726
38788
|
this.log(`Setting updated: ${type}.${key} = ${JSON.stringify(value)}`);
|
|
38727
38789
|
return true;
|
|
38728
38790
|
} catch (e) {
|
|
@@ -39490,16 +39552,17 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
39490
39552
|
}
|
|
39491
39553
|
function buildStatusSnapshot2(options) {
|
|
39492
39554
|
const cfg = loadConfig2();
|
|
39555
|
+
const state = loadState();
|
|
39493
39556
|
const wsState = getWorkspaceState2(cfg);
|
|
39494
39557
|
const memSnap = getHostMemorySnapshot();
|
|
39495
|
-
const recentActivity = getRecentActivity(
|
|
39558
|
+
const recentActivity = getRecentActivity(state, 20);
|
|
39496
39559
|
const sessions = buildSessionEntries(
|
|
39497
39560
|
options.allStates,
|
|
39498
39561
|
options.cdpManagers
|
|
39499
39562
|
);
|
|
39500
39563
|
for (const session of sessions) {
|
|
39501
|
-
const lastSeenAt = getSessionSeenAt(
|
|
39502
|
-
const seenCompletionMarker = getSessionSeenMarker(
|
|
39564
|
+
const lastSeenAt = getSessionSeenAt(state, session.id);
|
|
39565
|
+
const seenCompletionMarker = getSessionSeenMarker(state, session.id);
|
|
39503
39566
|
const lastUsedAt = getSessionLastUsedAt(session);
|
|
39504
39567
|
const completionMarker = getSessionCompletionMarker(session);
|
|
39505
39568
|
const { unread, inboxBucket } = session.surfaceHidden ? { unread: false, inboxBucket: "idle" } : getUnreadState(
|
|
@@ -39833,9 +39896,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
39833
39896
|
const offset = Math.max(0, Number(args?.offset) || 0);
|
|
39834
39897
|
const limit = Math.max(1, Math.min(100, Number(args?.limit) || 30));
|
|
39835
39898
|
const { sessions: historySessions, hasMore } = listSavedHistorySessions(providerType, { offset, limit });
|
|
39836
|
-
const
|
|
39837
|
-
const savedSessions = getSavedProviderSessions(
|
|
39838
|
-
const recentSessions = getRecentActivity(
|
|
39899
|
+
const state = loadState();
|
|
39900
|
+
const savedSessions = getSavedProviderSessions(state, { providerType, kind });
|
|
39901
|
+
const recentSessions = getRecentActivity(state, 200).filter((entry) => entry.providerType === providerType && entry.kind === kind && entry.providerSessionId);
|
|
39839
39902
|
const savedSessionById = new Map(savedSessions.map((entry) => [entry.providerSessionId, entry]));
|
|
39840
39903
|
const recentSessionById = new Map(recentSessions.map((entry) => [entry.providerSessionId, entry]));
|
|
39841
39904
|
const providerMeta = this.deps.providerLoader.getMeta(providerType);
|
|
@@ -39926,19 +39989,19 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
39926
39989
|
this.deps.onIdeConnected?.();
|
|
39927
39990
|
if (result.success && resolvedWorkspace) {
|
|
39928
39991
|
try {
|
|
39929
|
-
const next = appendRecentActivity(
|
|
39992
|
+
const next = appendRecentActivity(loadState(), {
|
|
39930
39993
|
kind: "ide",
|
|
39931
39994
|
providerType: result.ideId || ideKey,
|
|
39932
39995
|
providerName: result.ideId || ideKey,
|
|
39933
39996
|
workspace: resolvedWorkspace,
|
|
39934
39997
|
title: result.ideId || ideKey
|
|
39935
39998
|
});
|
|
39936
|
-
|
|
39999
|
+
saveState(next);
|
|
39937
40000
|
} catch {
|
|
39938
40001
|
}
|
|
39939
40002
|
} else if (result.success && (result.ideId || ideKey)) {
|
|
39940
40003
|
try {
|
|
39941
|
-
|
|
40004
|
+
saveState(appendRecentActivity(loadState(), {
|
|
39942
40005
|
kind: "ide",
|
|
39943
40006
|
providerType: result.ideId || ideKey,
|
|
39944
40007
|
providerName: result.ideId || ideKey,
|
|
@@ -39967,8 +40030,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
39967
40030
|
if (!sessionId || typeof sessionId !== "string") {
|
|
39968
40031
|
return { success: false, error: "sessionId is required" };
|
|
39969
40032
|
}
|
|
39970
|
-
const
|
|
39971
|
-
const prevSeenAt =
|
|
40033
|
+
const currentState = loadState();
|
|
40034
|
+
const prevSeenAt = currentState.sessionReads?.[sessionId] || 0;
|
|
39972
40035
|
const sessionEntries = buildSessionEntries(
|
|
39973
40036
|
this.deps.instanceManager.collectAllStates(),
|
|
39974
40037
|
this.deps.cdpManagers
|
|
@@ -39976,7 +40039,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
39976
40039
|
const targetSession = sessionEntries.find((entry) => entry.id === sessionId);
|
|
39977
40040
|
const completionMarker = targetSession ? getSessionCompletionMarker(targetSession) : "";
|
|
39978
40041
|
const next = markSessionSeen(
|
|
39979
|
-
|
|
40042
|
+
currentState,
|
|
39980
40043
|
sessionId,
|
|
39981
40044
|
typeof args?.seenAt === "number" ? args.seenAt : Date.now(),
|
|
39982
40045
|
completionMarker
|
|
@@ -39984,7 +40047,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
39984
40047
|
if (READ_DEBUG_ENABLED2) {
|
|
39985
40048
|
LOG2.info("RecentRead", `mark_session_seen sessionId=${sessionId} seenAt=${String(args?.seenAt || "")} prevSeenAt=${String(prevSeenAt)} nextSeenAt=${String(next.sessionReads?.[sessionId] || 0)} marker=${completionMarker || "-"}`);
|
|
39986
40049
|
}
|
|
39987
|
-
|
|
40050
|
+
saveState(next);
|
|
39988
40051
|
this.deps.onStatusChange?.();
|
|
39989
40052
|
return {
|
|
39990
40053
|
success: true,
|