@adhdev/daemon-standalone 0.8.58 → 0.8.60
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 +575 -193
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-DR_4zaPh.js +73 -0
- package/public/assets/index-DY0zxjVr.css +1 -0
- package/public/index.html +2 -2
- package/public/assets/index-CF-NeZlX.js +0 -72
- package/public/assets/index-DA7jOoZ9.css +0 -1
package/dist/index.js
CHANGED
|
@@ -29270,6 +29270,7 @@ var require_dist2 = __commonJS({
|
|
|
29270
29270
|
static MAX_TRACE_ENTRIES = 250;
|
|
29271
29271
|
providerResolutionMeta;
|
|
29272
29272
|
static IDLE_FINISH_CONFIRM_MS = 2e3;
|
|
29273
|
+
static HERMES_IDLE_FINISH_CONFIRM_MS = 5e3;
|
|
29273
29274
|
static STATUS_ACTIVITY_HOLD_MS = 2e3;
|
|
29274
29275
|
static FINISH_RETRY_DELAY_MS = 300;
|
|
29275
29276
|
static MAX_FINISH_RETRIES = 2;
|
|
@@ -29277,6 +29278,12 @@ var require_dist2 = __commonJS({
|
|
|
29277
29278
|
this.messages = [...this.committedMessages];
|
|
29278
29279
|
this.structuredMessages = [...this.committedMessages];
|
|
29279
29280
|
}
|
|
29281
|
+
getIdleFinishConfirmMs() {
|
|
29282
|
+
return this.cliType === "hermes-cli" ? _ProviderCliAdapter.HERMES_IDLE_FINISH_CONFIRM_MS : _ProviderCliAdapter.IDLE_FINISH_CONFIRM_MS;
|
|
29283
|
+
}
|
|
29284
|
+
getStatusActivityHoldMs() {
|
|
29285
|
+
return this.cliType === "hermes-cli" ? _ProviderCliAdapter.HERMES_IDLE_FINISH_CONFIRM_MS : _ProviderCliAdapter.STATUS_ACTIVITY_HOLD_MS;
|
|
29286
|
+
}
|
|
29280
29287
|
setStatus(status, trigger) {
|
|
29281
29288
|
const prev = this.currentStatus;
|
|
29282
29289
|
if (prev === status) return;
|
|
@@ -29299,6 +29306,7 @@ var require_dist2 = __commonJS({
|
|
|
29299
29306
|
}
|
|
29300
29307
|
armIdleFinishCandidate(assistantLength) {
|
|
29301
29308
|
const now = Date.now();
|
|
29309
|
+
const idleFinishConfirmMs = this.getIdleFinishConfirmMs();
|
|
29302
29310
|
this.idleFinishCandidate = {
|
|
29303
29311
|
armedAt: now,
|
|
29304
29312
|
lastOutputAt: this.lastOutputAt,
|
|
@@ -29307,7 +29315,7 @@ var require_dist2 = __commonJS({
|
|
|
29307
29315
|
assistantLength
|
|
29308
29316
|
};
|
|
29309
29317
|
this.recordTrace("idle_candidate_armed", {
|
|
29310
|
-
confirmMs:
|
|
29318
|
+
confirmMs: idleFinishConfirmMs,
|
|
29311
29319
|
candidate: this.idleFinishCandidate,
|
|
29312
29320
|
...buildCliTraceParseSnapshot({
|
|
29313
29321
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
@@ -29322,7 +29330,7 @@ var require_dist2 = __commonJS({
|
|
|
29322
29330
|
this.settleTimer = null;
|
|
29323
29331
|
this.settledBuffer = this.recentOutputBuffer;
|
|
29324
29332
|
this.evaluateSettled();
|
|
29325
|
-
},
|
|
29333
|
+
}, idleFinishConfirmMs);
|
|
29326
29334
|
}
|
|
29327
29335
|
recordTrace(type, payload = {}) {
|
|
29328
29336
|
const entry = {
|
|
@@ -29701,7 +29709,8 @@ var require_dist2 = __commonJS({
|
|
|
29701
29709
|
hasRecentInteractiveActivity(now) {
|
|
29702
29710
|
const quietForMs = this.lastNonEmptyOutputAt ? now - this.lastNonEmptyOutputAt : Number.MAX_SAFE_INTEGER;
|
|
29703
29711
|
const screenStableMs = this.lastScreenChangeAt ? now - this.lastScreenChangeAt : Number.MAX_SAFE_INTEGER;
|
|
29704
|
-
|
|
29712
|
+
const holdMs = this.getStatusActivityHoldMs();
|
|
29713
|
+
return quietForMs < holdMs || screenStableMs < holdMs;
|
|
29705
29714
|
}
|
|
29706
29715
|
getStartupConfirmationModal(screenText) {
|
|
29707
29716
|
const text = sanitizeTerminalText(String(screenText || ""));
|
|
@@ -29853,6 +29862,7 @@ var require_dist2 = __commonJS({
|
|
|
29853
29862
|
clearPendingScriptStatus();
|
|
29854
29863
|
}
|
|
29855
29864
|
const recentInteractiveActivity = this.hasRecentInteractiveActivity(now);
|
|
29865
|
+
const statusActivityHoldMs = this.getStatusActivityHoldMs();
|
|
29856
29866
|
const shouldHoldGenerating = scriptStatus === "idle" && this.isWaitingForResponse && !modal && recentInteractiveActivity;
|
|
29857
29867
|
if (shouldHoldGenerating) {
|
|
29858
29868
|
this.clearIdleFinishCandidate("hold_generating_recent_activity");
|
|
@@ -29868,7 +29878,7 @@ var require_dist2 = __commonJS({
|
|
|
29868
29878
|
recentInteractiveActivity,
|
|
29869
29879
|
lastNonEmptyOutputAt: this.lastNonEmptyOutputAt,
|
|
29870
29880
|
lastScreenChangeAt: this.lastScreenChangeAt,
|
|
29871
|
-
holdMs:
|
|
29881
|
+
holdMs: statusActivityHoldMs,
|
|
29872
29882
|
...buildCliTraceParseSnapshot({
|
|
29873
29883
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
29874
29884
|
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
@@ -29957,11 +29967,12 @@ var require_dist2 = __commonJS({
|
|
|
29957
29967
|
const screenStableMs = this.lastScreenChangeAt ? now - this.lastScreenChangeAt : 0;
|
|
29958
29968
|
const hasAssistantTurn = !!lastParsedAssistant;
|
|
29959
29969
|
const assistantLength = lastParsedAssistant?.content?.length || 0;
|
|
29960
|
-
const
|
|
29961
|
-
const
|
|
29970
|
+
const idleFinishConfirmMs = this.getIdleFinishConfirmMs();
|
|
29971
|
+
const idleQuietThresholdMs = Math.max(idleFinishConfirmMs, this.timeouts.outputSettle);
|
|
29972
|
+
const idleStableThresholdMs = idleFinishConfirmMs;
|
|
29962
29973
|
const idleReady = visibleIdlePrompt && !modal && hasAssistantTurn && quietForMs >= idleQuietThresholdMs && screenStableMs >= idleStableThresholdMs;
|
|
29963
29974
|
const candidate = this.idleFinishCandidate;
|
|
29964
|
-
const candidateQuiet = !!candidate && candidate.responseEpoch === this.responseEpoch && candidate.lastOutputAt === this.lastOutputAt && candidate.lastScreenChangeAt === this.lastScreenChangeAt && assistantLength >= candidate.assistantLength && now - candidate.armedAt >=
|
|
29975
|
+
const candidateQuiet = !!candidate && candidate.responseEpoch === this.responseEpoch && candidate.lastOutputAt === this.lastOutputAt && candidate.lastScreenChangeAt === this.lastScreenChangeAt && assistantLength >= candidate.assistantLength && now - candidate.armedAt >= idleFinishConfirmMs;
|
|
29965
29976
|
const canFinishImmediately = idleReady && candidateQuiet;
|
|
29966
29977
|
this.recordTrace("idle_decision", {
|
|
29967
29978
|
visibleIdlePrompt,
|
|
@@ -29973,7 +29984,7 @@ var require_dist2 = __commonJS({
|
|
|
29973
29984
|
idleQuietThresholdMs,
|
|
29974
29985
|
idleStableThresholdMs,
|
|
29975
29986
|
idleReady,
|
|
29976
|
-
idleFinishConfirmMs
|
|
29987
|
+
idleFinishConfirmMs,
|
|
29977
29988
|
idleFinishCandidate: candidate,
|
|
29978
29989
|
candidateQuiet,
|
|
29979
29990
|
canFinishImmediately,
|
|
@@ -31131,6 +31142,66 @@ ${data.message || ""}`.trim();
|
|
|
31131
31142
|
return { config: { ...config2, defaultWorkspaceId: id } };
|
|
31132
31143
|
}
|
|
31133
31144
|
var path22 = __toESM2(require("path"));
|
|
31145
|
+
function normalizeSummaryItem(item) {
|
|
31146
|
+
if (!item || typeof item !== "object") return null;
|
|
31147
|
+
const id = String(item.id || "").trim();
|
|
31148
|
+
const value = String(item.value || "").trim();
|
|
31149
|
+
if (!id || !value) return null;
|
|
31150
|
+
const normalized = {
|
|
31151
|
+
id,
|
|
31152
|
+
value
|
|
31153
|
+
};
|
|
31154
|
+
if (typeof item.label === "string" && item.label.trim()) normalized.label = item.label.trim();
|
|
31155
|
+
if (typeof item.shortValue === "string" && item.shortValue.trim()) normalized.shortValue = item.shortValue.trim();
|
|
31156
|
+
if (typeof item.icon === "string" && item.icon.trim()) normalized.icon = item.icon.trim();
|
|
31157
|
+
if (typeof item.order === "number" && Number.isFinite(item.order)) normalized.order = item.order;
|
|
31158
|
+
return normalized;
|
|
31159
|
+
}
|
|
31160
|
+
function normalizeProviderSummaryMetadata(summary) {
|
|
31161
|
+
if (!summary || !Array.isArray(summary.items)) return void 0;
|
|
31162
|
+
const items = summary.items.map((item) => normalizeSummaryItem(item)).filter((item) => !!item).sort((left, right) => {
|
|
31163
|
+
const orderDiff = (left.order ?? Number.MAX_SAFE_INTEGER) - (right.order ?? Number.MAX_SAFE_INTEGER);
|
|
31164
|
+
if (orderDiff !== 0) return orderDiff;
|
|
31165
|
+
return left.id.localeCompare(right.id);
|
|
31166
|
+
});
|
|
31167
|
+
return items.length > 0 ? { items } : void 0;
|
|
31168
|
+
}
|
|
31169
|
+
function buildProviderSummaryMetadata(items) {
|
|
31170
|
+
return normalizeProviderSummaryMetadata({ items: items.filter(Boolean) });
|
|
31171
|
+
}
|
|
31172
|
+
function buildLegacyModelModeSummaryMetadata(params) {
|
|
31173
|
+
return buildProviderSummaryMetadata([
|
|
31174
|
+
params.model ? {
|
|
31175
|
+
id: "model",
|
|
31176
|
+
label: "Model",
|
|
31177
|
+
value: String(params.modelLabel || params.model).trim(),
|
|
31178
|
+
shortValue: String(params.model).trim(),
|
|
31179
|
+
order: 10
|
|
31180
|
+
} : null,
|
|
31181
|
+
params.mode ? {
|
|
31182
|
+
id: "mode",
|
|
31183
|
+
label: "Mode",
|
|
31184
|
+
value: String(params.modeLabel || params.mode).trim(),
|
|
31185
|
+
shortValue: String(params.mode).trim(),
|
|
31186
|
+
order: 20
|
|
31187
|
+
} : null
|
|
31188
|
+
]);
|
|
31189
|
+
}
|
|
31190
|
+
function resolveProviderStateSummaryMetadata(params) {
|
|
31191
|
+
const explicit = normalizeProviderSummaryMetadata(params.summaryMetadata);
|
|
31192
|
+
if (explicit) return explicit;
|
|
31193
|
+
const model = typeof params.controlValues?.model === "string" ? params.controlValues.model : void 0;
|
|
31194
|
+
const mode = typeof params.controlValues?.mode === "string" ? params.controlValues.mode : void 0;
|
|
31195
|
+
return buildLegacyModelModeSummaryMetadata({
|
|
31196
|
+
model,
|
|
31197
|
+
mode,
|
|
31198
|
+
modelLabel: params.modelLabel,
|
|
31199
|
+
modeLabel: params.modeLabel
|
|
31200
|
+
});
|
|
31201
|
+
}
|
|
31202
|
+
function normalizePersistedSummaryMetadata(params) {
|
|
31203
|
+
return normalizeProviderSummaryMetadata(params.summaryMetadata);
|
|
31204
|
+
}
|
|
31134
31205
|
var MAX_ACTIVITY = 30;
|
|
31135
31206
|
function normalizeWorkspace(workspace) {
|
|
31136
31207
|
if (!workspace) return "";
|
|
@@ -31154,6 +31225,9 @@ ${data.message || ""}`.trim();
|
|
|
31154
31225
|
const nextEntry = {
|
|
31155
31226
|
...entry,
|
|
31156
31227
|
workspace: entry.workspace ? normalizeWorkspace(entry.workspace) : void 0,
|
|
31228
|
+
summaryMetadata: normalizePersistedSummaryMetadata({
|
|
31229
|
+
summaryMetadata: entry.summaryMetadata
|
|
31230
|
+
}),
|
|
31157
31231
|
id: buildRecentActivityKeyForEntry(entry),
|
|
31158
31232
|
lastUsedAt: entry.lastUsedAt || Date.now()
|
|
31159
31233
|
};
|
|
@@ -31164,7 +31238,12 @@ ${data.message || ""}`.trim();
|
|
|
31164
31238
|
};
|
|
31165
31239
|
}
|
|
31166
31240
|
function getRecentActivity(state, limit = 20) {
|
|
31167
|
-
return [...state.recentActivity || []].
|
|
31241
|
+
return [...state.recentActivity || []].map((entry) => ({
|
|
31242
|
+
...entry,
|
|
31243
|
+
summaryMetadata: normalizePersistedSummaryMetadata({
|
|
31244
|
+
summaryMetadata: entry.summaryMetadata
|
|
31245
|
+
})
|
|
31246
|
+
})).sort((a, b2) => b2.lastUsedAt - a.lastUsedAt).slice(0, limit);
|
|
31168
31247
|
}
|
|
31169
31248
|
function getSessionSeenAt(state, sessionId) {
|
|
31170
31249
|
return state.sessionReads?.[sessionId] || 0;
|
|
@@ -31214,7 +31293,9 @@ ${data.message || ""}`.trim();
|
|
|
31214
31293
|
providerName: entry.providerName,
|
|
31215
31294
|
providerSessionId,
|
|
31216
31295
|
workspace: entry.workspace ? normalizeWorkspace2(entry.workspace) : void 0,
|
|
31217
|
-
|
|
31296
|
+
summaryMetadata: normalizePersistedSummaryMetadata({
|
|
31297
|
+
summaryMetadata: entry.summaryMetadata
|
|
31298
|
+
}),
|
|
31218
31299
|
title: entry.title,
|
|
31219
31300
|
createdAt: existing?.createdAt || entry.createdAt || Date.now(),
|
|
31220
31301
|
lastUsedAt: entry.lastUsedAt || Date.now()
|
|
@@ -31230,7 +31311,12 @@ ${data.message || ""}`.trim();
|
|
|
31230
31311
|
if (filters?.providerType && entry.providerType !== filters.providerType) return false;
|
|
31231
31312
|
if (filters?.kind && entry.kind !== filters.kind) return false;
|
|
31232
31313
|
return true;
|
|
31233
|
-
}).
|
|
31314
|
+
}).map((entry) => ({
|
|
31315
|
+
...entry,
|
|
31316
|
+
summaryMetadata: normalizePersistedSummaryMetadata({
|
|
31317
|
+
summaryMetadata: entry.summaryMetadata
|
|
31318
|
+
})
|
|
31319
|
+
})).sort((a, b2) => b2.lastUsedAt - a.lastUsedAt);
|
|
31234
31320
|
}
|
|
31235
31321
|
var import_fs2 = require("fs");
|
|
31236
31322
|
var import_path22 = require("path");
|
|
@@ -32969,8 +33055,6 @@ ${data.message || ""}`.trim();
|
|
|
32969
33055
|
if (rawValue === void 0 || rawValue === null) continue;
|
|
32970
33056
|
values[ctrl.id] = normalizeControlValue(rawValue);
|
|
32971
33057
|
}
|
|
32972
|
-
if (data.model !== void 0 && values.model === void 0) values.model = normalizeControlValue(data.model);
|
|
32973
|
-
if (data.mode !== void 0 && values.mode === void 0) values.mode = normalizeControlValue(data.mode);
|
|
32974
33058
|
return Object.keys(values).length > 0 ? values : void 0;
|
|
32975
33059
|
}
|
|
32976
33060
|
function normalizeProviderEffects(data) {
|
|
@@ -33072,7 +33156,7 @@ ${data.message || ""}`.trim();
|
|
|
33072
33156
|
}
|
|
33073
33157
|
if (!option || typeof option !== "object") return null;
|
|
33074
33158
|
const record2 = option;
|
|
33075
|
-
const value = typeof record2.value === "string" ? record2.value : typeof record2.id === "string" ? record2.id : null;
|
|
33159
|
+
const value = typeof record2.value === "string" ? record2.value : typeof record2.id === "string" ? record2.id : typeof record2.name === "string" ? record2.name : null;
|
|
33076
33160
|
if (!value) return null;
|
|
33077
33161
|
const label = typeof record2.label === "string" ? record2.label : typeof record2.name === "string" ? record2.name : value;
|
|
33078
33162
|
const normalized = { value, label };
|
|
@@ -33604,6 +33688,59 @@ ${data.message || ""}`.trim();
|
|
|
33604
33688
|
return { sessions: [], hasMore: false };
|
|
33605
33689
|
}
|
|
33606
33690
|
}
|
|
33691
|
+
function isControlValue(value) {
|
|
33692
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
33693
|
+
}
|
|
33694
|
+
function asControlValueMap(value) {
|
|
33695
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
33696
|
+
const result = {};
|
|
33697
|
+
for (const [entryKey, entryValue] of Object.entries(value)) {
|
|
33698
|
+
if (isControlValue(entryValue)) result[entryKey] = entryValue;
|
|
33699
|
+
}
|
|
33700
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
33701
|
+
}
|
|
33702
|
+
function getLegacyModelModeValues(data) {
|
|
33703
|
+
if (!data || typeof data !== "object") return void 0;
|
|
33704
|
+
const legacy = {};
|
|
33705
|
+
if (typeof data.model === "string" && data.model.trim()) legacy.model = data.model.trim();
|
|
33706
|
+
if (typeof data.mode === "string" && data.mode.trim()) legacy.mode = data.mode.trim();
|
|
33707
|
+
return Object.keys(legacy).length > 0 ? legacy : void 0;
|
|
33708
|
+
}
|
|
33709
|
+
function mergeProviderPatchState(params) {
|
|
33710
|
+
const {
|
|
33711
|
+
providerControls,
|
|
33712
|
+
data,
|
|
33713
|
+
currentControlValues,
|
|
33714
|
+
currentSummaryMetadata,
|
|
33715
|
+
mergeWithCurrent = true
|
|
33716
|
+
} = params;
|
|
33717
|
+
const sources = [
|
|
33718
|
+
mergeWithCurrent ? asControlValueMap(currentControlValues) : void 0,
|
|
33719
|
+
asControlValueMap(data?.controlValues),
|
|
33720
|
+
asControlValueMap(extractProviderControlValues(providerControls, data)),
|
|
33721
|
+
getLegacyModelModeValues(data)
|
|
33722
|
+
];
|
|
33723
|
+
const controlValues = Object.assign({}, ...sources.filter(Boolean));
|
|
33724
|
+
return {
|
|
33725
|
+
controlValues,
|
|
33726
|
+
summaryMetadata: data?.summaryMetadata !== void 0 ? data.summaryMetadata : currentSummaryMetadata
|
|
33727
|
+
};
|
|
33728
|
+
}
|
|
33729
|
+
function normalizeProviderStateControlValues(controlValues) {
|
|
33730
|
+
return controlValues && Object.keys(controlValues).length > 0 ? controlValues : void 0;
|
|
33731
|
+
}
|
|
33732
|
+
function resolveProviderStateSurface(params) {
|
|
33733
|
+
const controlValues = normalizeProviderStateControlValues(params.controlValues);
|
|
33734
|
+
return {
|
|
33735
|
+
controlValues,
|
|
33736
|
+
summaryMetadata: resolveProviderStateSummaryMetadata({
|
|
33737
|
+
summaryMetadata: params.summaryMetadata,
|
|
33738
|
+
controlValues,
|
|
33739
|
+
modelLabel: params.modelLabel,
|
|
33740
|
+
modeLabel: params.modeLabel
|
|
33741
|
+
})
|
|
33742
|
+
};
|
|
33743
|
+
}
|
|
33607
33744
|
var ExtensionProviderInstance = class {
|
|
33608
33745
|
type;
|
|
33609
33746
|
category = "extension";
|
|
@@ -33617,9 +33754,8 @@ ${data.message || ""}`.trim();
|
|
|
33617
33754
|
messages = [];
|
|
33618
33755
|
prevMessageHashes = /* @__PURE__ */ new Map();
|
|
33619
33756
|
activeModal = null;
|
|
33620
|
-
currentModel = "";
|
|
33621
|
-
currentMode = "";
|
|
33622
33757
|
controlValues = {};
|
|
33758
|
+
summaryMetadata = void 0;
|
|
33623
33759
|
appliedEffectKeys = /* @__PURE__ */ new Set();
|
|
33624
33760
|
runtimeMessages = [];
|
|
33625
33761
|
lastAgentStatus = "idle";
|
|
@@ -33654,6 +33790,10 @@ ${data.message || ""}`.trim();
|
|
|
33654
33790
|
if (!this.context?.cdp?.isConnected) return;
|
|
33655
33791
|
}
|
|
33656
33792
|
getState() {
|
|
33793
|
+
const surface = resolveProviderStateSurface({
|
|
33794
|
+
summaryMetadata: this.summaryMetadata,
|
|
33795
|
+
controlValues: this.controlValues
|
|
33796
|
+
});
|
|
33657
33797
|
return {
|
|
33658
33798
|
type: this.type,
|
|
33659
33799
|
name: this.provider.name,
|
|
@@ -33667,10 +33807,9 @@ ${data.message || ""}`.trim();
|
|
|
33667
33807
|
activeModal: this.activeModal,
|
|
33668
33808
|
inputContent: ""
|
|
33669
33809
|
} : null,
|
|
33670
|
-
|
|
33671
|
-
currentPlan: this.currentMode || void 0,
|
|
33672
|
-
controlValues: this.controlValues,
|
|
33810
|
+
controlValues: surface.controlValues,
|
|
33673
33811
|
providerControls: this.provider.controls,
|
|
33812
|
+
summaryMetadata: surface.summaryMetadata,
|
|
33674
33813
|
agentStreams: this.agentStreams,
|
|
33675
33814
|
instanceId: this.instanceId,
|
|
33676
33815
|
lastUpdated: Date.now(),
|
|
@@ -33683,10 +33822,14 @@ ${data.message || ""}`.trim();
|
|
|
33683
33822
|
if (data?.streams) this.agentStreams = data.streams;
|
|
33684
33823
|
if (data?.messages) this.messages = this.assignReceivedAt(data.messages);
|
|
33685
33824
|
if (data?.activeModal !== void 0) this.activeModal = data.activeModal;
|
|
33686
|
-
|
|
33687
|
-
|
|
33688
|
-
|
|
33689
|
-
|
|
33825
|
+
const patchedState = mergeProviderPatchState({
|
|
33826
|
+
providerControls: this.provider.controls,
|
|
33827
|
+
data,
|
|
33828
|
+
currentControlValues: this.controlValues,
|
|
33829
|
+
currentSummaryMetadata: this.summaryMetadata
|
|
33830
|
+
});
|
|
33831
|
+
this.controlValues = patchedState.controlValues;
|
|
33832
|
+
this.summaryMetadata = patchedState.summaryMetadata;
|
|
33690
33833
|
if (typeof data?.sessionId === "string" && data.sessionId.trim()) this.chatId = data.sessionId;
|
|
33691
33834
|
if (typeof data?.title === "string" && data.title.trim()) this.chatTitle = data.title;
|
|
33692
33835
|
if (typeof data?.agentName === "string" && data.agentName.trim()) this.agentName = data.agentName;
|
|
@@ -33787,8 +33930,14 @@ ${data.message || ""}`.trim();
|
|
|
33787
33930
|
}
|
|
33788
33931
|
applyProviderResponse(data, options) {
|
|
33789
33932
|
if (!data || typeof data !== "object") return;
|
|
33790
|
-
const
|
|
33791
|
-
|
|
33933
|
+
const patchedState = mergeProviderPatchState({
|
|
33934
|
+
providerControls: this.provider.controls,
|
|
33935
|
+
data,
|
|
33936
|
+
currentControlValues: this.controlValues,
|
|
33937
|
+
currentSummaryMetadata: this.summaryMetadata
|
|
33938
|
+
});
|
|
33939
|
+
this.controlValues = patchedState.controlValues;
|
|
33940
|
+
this.summaryMetadata = patchedState.summaryMetadata;
|
|
33792
33941
|
const effects = normalizeProviderEffects(data);
|
|
33793
33942
|
for (const effect of effects) {
|
|
33794
33943
|
const effectWhen = effect.when || "immediate";
|
|
@@ -33938,8 +34087,6 @@ ${effect.notification.body || ""}`.trim();
|
|
|
33938
34087
|
this.messages = [];
|
|
33939
34088
|
this.prevMessageHashes.clear();
|
|
33940
34089
|
this.activeModal = null;
|
|
33941
|
-
this.currentModel = "";
|
|
33942
|
-
this.currentMode = "";
|
|
33943
34090
|
this.controlValues = {};
|
|
33944
34091
|
this.currentStatus = "idle";
|
|
33945
34092
|
this.chatId = null;
|
|
@@ -34069,6 +34216,10 @@ ${effect.notification.body || ""}`.trim();
|
|
|
34069
34216
|
for (const ext of this.extensions.values()) {
|
|
34070
34217
|
extensionStates.push(ext.getState());
|
|
34071
34218
|
}
|
|
34219
|
+
const surface = resolveProviderStateSurface({
|
|
34220
|
+
summaryMetadata: this.cachedChat?.summaryMetadata,
|
|
34221
|
+
controlValues: this.cachedChat?.controlValues
|
|
34222
|
+
});
|
|
34072
34223
|
return {
|
|
34073
34224
|
type: this.type,
|
|
34074
34225
|
name: this.provider.name,
|
|
@@ -34085,11 +34236,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
34085
34236
|
workspace: this.workspace || null,
|
|
34086
34237
|
extensions: extensionStates,
|
|
34087
34238
|
cdpConnected: cdp?.isConnected || false,
|
|
34088
|
-
|
|
34089
|
-
currentPlan: this.cachedChat?.mode || void 0,
|
|
34090
|
-
currentAutoApprove: this.cachedChat?.autoApprove || void 0,
|
|
34091
|
-
controlValues: this.cachedChat?.controlValues || void 0,
|
|
34239
|
+
controlValues: surface.controlValues,
|
|
34092
34240
|
providerControls: this.provider.controls,
|
|
34241
|
+
summaryMetadata: surface.summaryMetadata,
|
|
34093
34242
|
instanceId: this.instanceId,
|
|
34094
34243
|
lastUpdated: Date.now(),
|
|
34095
34244
|
settings: this.settings,
|
|
@@ -34261,8 +34410,13 @@ ${effect.notification.body || ""}`.trim();
|
|
|
34261
34410
|
chat.messages = messages.filter((m) => !hiddenKinds.has(m.kind || ""));
|
|
34262
34411
|
}
|
|
34263
34412
|
}
|
|
34264
|
-
const
|
|
34265
|
-
|
|
34413
|
+
const patchedState = mergeProviderPatchState({
|
|
34414
|
+
providerControls: this.provider.controls,
|
|
34415
|
+
data: chat,
|
|
34416
|
+
mergeWithCurrent: false
|
|
34417
|
+
});
|
|
34418
|
+
chat.controlValues = Object.keys(patchedState.controlValues).length > 0 ? patchedState.controlValues : void 0;
|
|
34419
|
+
chat.summaryMetadata = patchedState.summaryMetadata;
|
|
34266
34420
|
this.cachedChat = { ...chat, activeModal };
|
|
34267
34421
|
this.detectAgentTransitions(chat, now);
|
|
34268
34422
|
const persistedMessages = chat.messages || messages;
|
|
@@ -34349,14 +34503,18 @@ ${effect.notification.body || ""}`.trim();
|
|
|
34349
34503
|
}
|
|
34350
34504
|
applyProviderResponse(data, options) {
|
|
34351
34505
|
if (!data || typeof data !== "object") return;
|
|
34352
|
-
const
|
|
34353
|
-
|
|
34354
|
-
|
|
34355
|
-
|
|
34356
|
-
|
|
34357
|
-
|
|
34358
|
-
|
|
34359
|
-
|
|
34506
|
+
const patchedState = mergeProviderPatchState({
|
|
34507
|
+
providerControls: this.provider.controls,
|
|
34508
|
+
data,
|
|
34509
|
+
currentControlValues: this.cachedChat?.controlValues,
|
|
34510
|
+
currentSummaryMetadata: this.cachedChat?.summaryMetadata
|
|
34511
|
+
});
|
|
34512
|
+
this.cachedChat = {
|
|
34513
|
+
...this.cachedChat || {},
|
|
34514
|
+
...data,
|
|
34515
|
+
controlValues: Object.keys(patchedState.controlValues).length > 0 ? patchedState.controlValues : void 0,
|
|
34516
|
+
summaryMetadata: patchedState.summaryMetadata
|
|
34517
|
+
};
|
|
34360
34518
|
const effects = normalizeProviderEffects(data);
|
|
34361
34519
|
for (const effect of effects) {
|
|
34362
34520
|
const effectWhen = effect.when || "immediate";
|
|
@@ -35129,6 +35287,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
35129
35287
|
function buildIdeWorkspaceSession(state, cdpManagers, options) {
|
|
35130
35288
|
const profile = options.profile || "full";
|
|
35131
35289
|
const activeChat = normalizeActiveChatData(state.activeChat, getActiveChatOptions(profile));
|
|
35290
|
+
const summaryMetadata = normalizeProviderSummaryMetadata(state.summaryMetadata);
|
|
35291
|
+
const controlValues = normalizeProviderStateControlValues(state.controlValues);
|
|
35132
35292
|
const includeSessionMetadata = shouldIncludeSessionMetadata(profile);
|
|
35133
35293
|
const includeSessionControls = shouldIncludeSessionControls(profile);
|
|
35134
35294
|
const title = activeChat?.title || state.name;
|
|
@@ -35145,13 +35305,11 @@ ${effect.notification.body || ""}`.trim();
|
|
|
35145
35305
|
title,
|
|
35146
35306
|
...includeSessionMetadata && { workspace: state.workspace || null },
|
|
35147
35307
|
activeChat,
|
|
35308
|
+
...summaryMetadata && { summaryMetadata },
|
|
35148
35309
|
...includeSessionMetadata && { capabilities: IDE_SESSION_CAPABILITIES },
|
|
35149
35310
|
cdpConnected: state.cdpConnected ?? isCdpConnected(cdpManagers, state.type),
|
|
35150
|
-
currentModel: state.currentModel,
|
|
35151
|
-
currentPlan: state.currentPlan,
|
|
35152
|
-
currentAutoApprove: state.currentAutoApprove,
|
|
35153
35311
|
...includeSessionControls && {
|
|
35154
|
-
controlValues
|
|
35312
|
+
...controlValues && { controlValues },
|
|
35155
35313
|
providerControls: state.providerControls
|
|
35156
35314
|
},
|
|
35157
35315
|
errorMessage: state.errorMessage,
|
|
@@ -35162,6 +35320,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
35162
35320
|
function buildExtensionAgentSession(parent, ext, options) {
|
|
35163
35321
|
const profile = options.profile || "full";
|
|
35164
35322
|
const activeChat = normalizeActiveChatData(ext.activeChat, getActiveChatOptions(profile));
|
|
35323
|
+
const summaryMetadata = normalizeProviderSummaryMetadata(ext.summaryMetadata);
|
|
35324
|
+
const controlValues = normalizeProviderStateControlValues(ext.controlValues);
|
|
35165
35325
|
const includeSessionMetadata = shouldIncludeSessionMetadata(profile);
|
|
35166
35326
|
const includeSessionControls = shouldIncludeSessionControls(profile);
|
|
35167
35327
|
return {
|
|
@@ -35177,11 +35337,10 @@ ${effect.notification.body || ""}`.trim();
|
|
|
35177
35337
|
title: activeChat?.title || ext.name,
|
|
35178
35338
|
...includeSessionMetadata && { workspace: parent.workspace || null },
|
|
35179
35339
|
activeChat,
|
|
35340
|
+
...summaryMetadata && { summaryMetadata },
|
|
35180
35341
|
...includeSessionMetadata && { capabilities: EXTENSION_SESSION_CAPABILITIES },
|
|
35181
|
-
currentModel: ext.currentModel,
|
|
35182
|
-
currentPlan: ext.currentPlan,
|
|
35183
35342
|
...includeSessionControls && {
|
|
35184
|
-
controlValues
|
|
35343
|
+
...controlValues && { controlValues },
|
|
35185
35344
|
providerControls: ext.providerControls
|
|
35186
35345
|
},
|
|
35187
35346
|
errorMessage: ext.errorMessage,
|
|
@@ -35192,6 +35351,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
35192
35351
|
function buildCliSession(state, options) {
|
|
35193
35352
|
const profile = options.profile || "full";
|
|
35194
35353
|
const activeChat = normalizeActiveChatData(state.activeChat, getActiveChatOptions(profile));
|
|
35354
|
+
const summaryMetadata = normalizeProviderSummaryMetadata(state.summaryMetadata);
|
|
35355
|
+
const controlValues = normalizeProviderStateControlValues(state.controlValues);
|
|
35195
35356
|
const includeSessionMetadata = shouldIncludeSessionMetadata(profile);
|
|
35196
35357
|
const includeRuntimeMetadata = shouldIncludeRuntimeMetadata(profile);
|
|
35197
35358
|
const includeSessionControls = shouldIncludeSessionControls(profile);
|
|
@@ -35218,11 +35379,12 @@ ${effect.notification.body || ""}`.trim();
|
|
|
35218
35379
|
mode: state.mode,
|
|
35219
35380
|
resume: state.resume,
|
|
35220
35381
|
activeChat,
|
|
35382
|
+
...summaryMetadata && { summaryMetadata },
|
|
35221
35383
|
...includeSessionMetadata && {
|
|
35222
35384
|
capabilities: state.mode === "terminal" ? PTY_SESSION_CAPABILITIES : CLI_CHAT_SESSION_CAPABILITIES
|
|
35223
35385
|
},
|
|
35224
35386
|
...includeSessionControls && {
|
|
35225
|
-
controlValues
|
|
35387
|
+
...controlValues && { controlValues },
|
|
35226
35388
|
providerControls: state.providerControls
|
|
35227
35389
|
},
|
|
35228
35390
|
errorMessage: state.errorMessage,
|
|
@@ -35233,6 +35395,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
35233
35395
|
function buildAcpSession(state, options) {
|
|
35234
35396
|
const profile = options.profile || "full";
|
|
35235
35397
|
const activeChat = normalizeActiveChatData(state.activeChat, getActiveChatOptions(profile));
|
|
35398
|
+
const summaryMetadata = normalizeProviderSummaryMetadata(state.summaryMetadata);
|
|
35399
|
+
const controlValues = normalizeProviderStateControlValues(state.controlValues);
|
|
35236
35400
|
const includeSessionMetadata = shouldIncludeSessionMetadata(profile);
|
|
35237
35401
|
const includeSessionControls = shouldIncludeSessionControls(profile);
|
|
35238
35402
|
return {
|
|
@@ -35248,13 +35412,10 @@ ${effect.notification.body || ""}`.trim();
|
|
|
35248
35412
|
title: activeChat?.title || state.name,
|
|
35249
35413
|
...includeSessionMetadata && { workspace: state.workspace || null },
|
|
35250
35414
|
activeChat,
|
|
35415
|
+
...summaryMetadata && { summaryMetadata },
|
|
35251
35416
|
...includeSessionMetadata && { capabilities: ACP_SESSION_CAPABILITIES },
|
|
35252
|
-
currentModel: state.currentModel,
|
|
35253
|
-
currentPlan: state.currentPlan,
|
|
35254
35417
|
...includeSessionControls && {
|
|
35255
|
-
|
|
35256
|
-
acpModes: state.acpModes,
|
|
35257
|
-
controlValues: state.controlValues,
|
|
35418
|
+
...controlValues && { controlValues },
|
|
35258
35419
|
providerControls: state.providerControls
|
|
35259
35420
|
},
|
|
35260
35421
|
errorMessage: state.errorMessage,
|
|
@@ -37288,8 +37449,17 @@ ${effect.notification.body || ""}`.trim();
|
|
|
37288
37449
|
);
|
|
37289
37450
|
return { success: true, reloaded: true, ...sourceConfig };
|
|
37290
37451
|
}
|
|
37291
|
-
function normalizeProviderScriptArgs(args) {
|
|
37452
|
+
function normalizeProviderScriptArgs(args, scriptName) {
|
|
37292
37453
|
const normalizedArgs = { ...args || {} };
|
|
37454
|
+
const normalizedScriptName = String(scriptName || "").toLowerCase();
|
|
37455
|
+
if (Object.prototype.hasOwnProperty.call(normalizedArgs, "value")) {
|
|
37456
|
+
if (normalizedArgs.model === void 0 && (normalizedScriptName === "setmodel" || normalizedScriptName === "setmodelgui" || normalizedScriptName === "webviewsetmodel")) {
|
|
37457
|
+
normalizedArgs.model = normalizedArgs.value;
|
|
37458
|
+
}
|
|
37459
|
+
if (normalizedArgs.mode === void 0 && (normalizedScriptName === "setmode" || normalizedScriptName === "webviewsetmode")) {
|
|
37460
|
+
normalizedArgs.mode = normalizedArgs.value;
|
|
37461
|
+
}
|
|
37462
|
+
}
|
|
37293
37463
|
for (const key of ["mode", "model", "message", "action", "button", "text", "sessionId", "value"]) {
|
|
37294
37464
|
if (key in normalizedArgs && !(key.toUpperCase() in normalizedArgs)) {
|
|
37295
37465
|
normalizedArgs[key.toUpperCase()] = normalizedArgs[key];
|
|
@@ -37335,7 +37505,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
37335
37505
|
if (!provider.scripts?.[actualScriptName]) {
|
|
37336
37506
|
return { success: false, error: `Script '${actualScriptName}' not available for ${resolvedProviderType}` };
|
|
37337
37507
|
}
|
|
37338
|
-
const normalizedArgs = normalizeProviderScriptArgs(args);
|
|
37508
|
+
const normalizedArgs = normalizeProviderScriptArgs(args, actualScriptName);
|
|
37339
37509
|
if (provider.category === "cli") {
|
|
37340
37510
|
const adapter = h.getCliAdapter(args?.targetSessionId || resolvedProviderType);
|
|
37341
37511
|
if (!adapter?.invokeScript) {
|
|
@@ -38188,6 +38358,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38188
38358
|
generatingDebouncePending = null;
|
|
38189
38359
|
lastApprovalEventAt = 0;
|
|
38190
38360
|
controlValues = {};
|
|
38361
|
+
summaryMetadata = void 0;
|
|
38191
38362
|
appliedEffectKeys = /* @__PURE__ */ new Set();
|
|
38192
38363
|
historyWriter;
|
|
38193
38364
|
runtimeMessages = [];
|
|
@@ -38330,13 +38501,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38330
38501
|
if (historyMessageCount !== null) {
|
|
38331
38502
|
parsedMessages = historyMessageCount > 0 ? parsedMessages.slice(-historyMessageCount) : [];
|
|
38332
38503
|
}
|
|
38333
|
-
const controlValues = extractProviderControlValues(this.provider.controls, parsedStatus);
|
|
38334
|
-
if (controlValues) {
|
|
38335
|
-
this.controlValues = { ...this.controlValues, ...controlValues };
|
|
38336
|
-
}
|
|
38337
38504
|
const mergedMessages = this.mergeConversationMessages(parsedMessages);
|
|
38338
|
-
const currentModel = typeof parsedStatus?.model === "string" && parsedStatus.model.trim() ? parsedStatus.model.trim() : typeof this.controlValues.model === "string" && this.controlValues.model.trim() ? this.controlValues.model.trim() : void 0;
|
|
38339
|
-
const currentPlan = typeof parsedStatus?.mode === "string" && parsedStatus.mode.trim() ? parsedStatus.mode.trim() : typeof this.controlValues.mode === "string" && this.controlValues.mode.trim() ? this.controlValues.mode.trim() : void 0;
|
|
38340
38505
|
const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
|
|
38341
38506
|
if (parsedMessages.length > 0) {
|
|
38342
38507
|
const shouldSkipReplayPersist = this.suppressIdleHistoryReplay && adapterStatus.status === "idle" && parsedStatus?.status === "idle";
|
|
@@ -38358,6 +38523,10 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38358
38523
|
}
|
|
38359
38524
|
}
|
|
38360
38525
|
this.applyProviderResponse(parsedStatus, { phase: "immediate" });
|
|
38526
|
+
const surface = resolveProviderStateSurface({
|
|
38527
|
+
summaryMetadata: this.summaryMetadata,
|
|
38528
|
+
controlValues: this.controlValues
|
|
38529
|
+
});
|
|
38361
38530
|
return {
|
|
38362
38531
|
type: this.type,
|
|
38363
38532
|
name: this.provider.name,
|
|
@@ -38373,8 +38542,6 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38373
38542
|
inputContent: ""
|
|
38374
38543
|
},
|
|
38375
38544
|
workspace: this.workingDir,
|
|
38376
|
-
currentModel,
|
|
38377
|
-
currentPlan,
|
|
38378
38545
|
instanceId: this.instanceId,
|
|
38379
38546
|
providerSessionId: this.providerSessionId,
|
|
38380
38547
|
lastUpdated: Date.now(),
|
|
@@ -38389,8 +38556,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38389
38556
|
attachedClients: runtime.attachedClients || []
|
|
38390
38557
|
} : void 0,
|
|
38391
38558
|
resume: this.provider.resume,
|
|
38392
|
-
controlValues:
|
|
38393
|
-
providerControls: this.provider.controls
|
|
38559
|
+
controlValues: surface.controlValues,
|
|
38560
|
+
providerControls: this.provider.controls,
|
|
38561
|
+
summaryMetadata: surface.summaryMetadata
|
|
38394
38562
|
};
|
|
38395
38563
|
}
|
|
38396
38564
|
setPresentationMode(mode) {
|
|
@@ -38594,10 +38762,14 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38594
38762
|
this.suppressIdleHistoryReplay = false;
|
|
38595
38763
|
this.adapter.clearHistory();
|
|
38596
38764
|
}
|
|
38597
|
-
const
|
|
38598
|
-
|
|
38599
|
-
|
|
38600
|
-
|
|
38765
|
+
const patchedState = mergeProviderPatchState({
|
|
38766
|
+
providerControls: this.provider.controls,
|
|
38767
|
+
data,
|
|
38768
|
+
currentControlValues: this.controlValues,
|
|
38769
|
+
currentSummaryMetadata: this.summaryMetadata
|
|
38770
|
+
});
|
|
38771
|
+
this.controlValues = patchedState.controlValues;
|
|
38772
|
+
this.summaryMetadata = patchedState.summaryMetadata;
|
|
38601
38773
|
const effects = normalizeProviderEffects(data);
|
|
38602
38774
|
for (const effect of effects) {
|
|
38603
38775
|
const effectWhen = effect.when || "immediate";
|
|
@@ -38961,8 +39133,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38961
39133
|
lastStatus = "starting";
|
|
38962
39134
|
generatingStartedAt = 0;
|
|
38963
39135
|
agentCapabilities = {};
|
|
38964
|
-
|
|
38965
|
-
currentMode;
|
|
39136
|
+
currentSelections = {};
|
|
38966
39137
|
activeToolCalls = [];
|
|
38967
39138
|
stopReason = null;
|
|
38968
39139
|
partialContent = "";
|
|
@@ -39042,8 +39213,6 @@ ${effect.notification.body || ""}`.trim();
|
|
|
39042
39213
|
inputContent: ""
|
|
39043
39214
|
},
|
|
39044
39215
|
workspace: this.workingDir,
|
|
39045
|
-
currentModel: this.currentModel,
|
|
39046
|
-
currentPlan: this.currentMode,
|
|
39047
39216
|
instanceId: this.instanceId,
|
|
39048
39217
|
lastUpdated: Date.now(),
|
|
39049
39218
|
settings: this.settings,
|
|
@@ -39054,11 +39223,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
39054
39223
|
// Error details for dashboard display
|
|
39055
39224
|
errorMessage: this.errorMessage || void 0,
|
|
39056
39225
|
errorReason: this.errorReason || void 0,
|
|
39057
|
-
controlValues:
|
|
39058
|
-
|
|
39059
|
-
|
|
39060
|
-
},
|
|
39061
|
-
providerControls: this.provider.controls
|
|
39226
|
+
controlValues: this.getSelectionControlValues(),
|
|
39227
|
+
providerControls: this.provider.controls,
|
|
39228
|
+
summaryMetadata: this.buildSelectionSummaryMetadata()
|
|
39062
39229
|
};
|
|
39063
39230
|
}
|
|
39064
39231
|
onEvent(event, data) {
|
|
@@ -39092,6 +39259,54 @@ ${effect.notification.body || ""}`.trim();
|
|
|
39092
39259
|
getInstanceId() {
|
|
39093
39260
|
return this.instanceId;
|
|
39094
39261
|
}
|
|
39262
|
+
resolveConfigOptionLabel(category, value) {
|
|
39263
|
+
if (!value) return void 0;
|
|
39264
|
+
const option = this.configOptions.find((entry) => entry.category === category);
|
|
39265
|
+
return option?.options.find((candidate) => candidate.value === value)?.name || value;
|
|
39266
|
+
}
|
|
39267
|
+
resolveModeLabel(modeId) {
|
|
39268
|
+
if (!modeId) return void 0;
|
|
39269
|
+
return this.availableModes.find((mode) => mode.id === modeId)?.name || modeId;
|
|
39270
|
+
}
|
|
39271
|
+
getCurrentSelection(category) {
|
|
39272
|
+
return this.currentSelections[category];
|
|
39273
|
+
}
|
|
39274
|
+
setCurrentSelection(category, value) {
|
|
39275
|
+
const normalized = typeof value === "string" ? value.trim() : "";
|
|
39276
|
+
if (normalized) {
|
|
39277
|
+
this.currentSelections[category] = normalized;
|
|
39278
|
+
return;
|
|
39279
|
+
}
|
|
39280
|
+
delete this.currentSelections[category];
|
|
39281
|
+
}
|
|
39282
|
+
getSelectionControlValues() {
|
|
39283
|
+
const model = this.getCurrentSelection("model");
|
|
39284
|
+
const mode = this.getCurrentSelection("mode");
|
|
39285
|
+
return {
|
|
39286
|
+
...model ? { model } : {},
|
|
39287
|
+
...mode ? { mode } : {}
|
|
39288
|
+
};
|
|
39289
|
+
}
|
|
39290
|
+
resolveSelectionLabel(category, value) {
|
|
39291
|
+
if (!value) return void 0;
|
|
39292
|
+
const configLabel = this.resolveConfigOptionLabel(category, value);
|
|
39293
|
+
if (configLabel && configLabel !== value) return configLabel;
|
|
39294
|
+
if (category === "mode") {
|
|
39295
|
+
const modeLabel = this.resolveModeLabel(value);
|
|
39296
|
+
if (modeLabel) return modeLabel;
|
|
39297
|
+
}
|
|
39298
|
+
return configLabel || value;
|
|
39299
|
+
}
|
|
39300
|
+
buildSelectionSummaryMetadata() {
|
|
39301
|
+
const model = this.getCurrentSelection("model");
|
|
39302
|
+
const mode = this.getCurrentSelection("mode");
|
|
39303
|
+
return buildLegacyModelModeSummaryMetadata({
|
|
39304
|
+
model,
|
|
39305
|
+
mode,
|
|
39306
|
+
modelLabel: this.resolveSelectionLabel("model", model),
|
|
39307
|
+
modeLabel: this.resolveSelectionLabel("mode", mode)
|
|
39308
|
+
});
|
|
39309
|
+
}
|
|
39095
39310
|
// ─── ACP Config Options & Modes ─────────────────────
|
|
39096
39311
|
parseConfigOptions(raw) {
|
|
39097
39312
|
if (!Array.isArray(raw)) return;
|
|
@@ -39123,12 +39338,14 @@ ${effect.notification.body || ""}`.trim();
|
|
|
39123
39338
|
}
|
|
39124
39339
|
}
|
|
39125
39340
|
this.configOptions.push({ category, configId, currentValue, options: flatOptions });
|
|
39126
|
-
if (category === "model"
|
|
39341
|
+
if (category === "model" || category === "mode") {
|
|
39342
|
+
this.setCurrentSelection(category, currentValue);
|
|
39343
|
+
}
|
|
39127
39344
|
}
|
|
39128
39345
|
}
|
|
39129
39346
|
parseModes(raw) {
|
|
39130
39347
|
if (!raw) return;
|
|
39131
|
-
|
|
39348
|
+
this.setCurrentSelection("mode", raw.currentModeId);
|
|
39132
39349
|
if (Array.isArray(raw.availableModes)) {
|
|
39133
39350
|
this.availableModes = raw.availableModes.map((m) => ({
|
|
39134
39351
|
id: m.id,
|
|
@@ -39147,8 +39364,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
39147
39364
|
if (this.useStaticConfig) {
|
|
39148
39365
|
opt.currentValue = value;
|
|
39149
39366
|
this.selectedConfig[opt.configId] = value;
|
|
39150
|
-
if (category === "model") this.
|
|
39151
|
-
if (category === "mode") this.currentMode = value;
|
|
39367
|
+
if (category === "model" || category === "mode") this.setCurrentSelection(category, value);
|
|
39152
39368
|
this.log.info(`[${this.type}] Static config ${category} set to: ${value} \u2014 restarting agent`);
|
|
39153
39369
|
await this.restartWithNewConfig();
|
|
39154
39370
|
return;
|
|
@@ -39166,7 +39382,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
39166
39382
|
value
|
|
39167
39383
|
});
|
|
39168
39384
|
opt.currentValue = value;
|
|
39169
|
-
if (category === "model") this.
|
|
39385
|
+
if (category === "model" || category === "mode") this.setCurrentSelection(category, value);
|
|
39170
39386
|
if (result?.configOptions) this.parseConfigOptions(result.configOptions);
|
|
39171
39387
|
this.log.info(`[${this.type}] Config ${category} set to: ${value} | response: ${JSON.stringify(result)?.slice(0, 300)}`);
|
|
39172
39388
|
} catch (e) {
|
|
@@ -39182,7 +39398,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
39182
39398
|
opt.currentValue = modeId;
|
|
39183
39399
|
this.selectedConfig[opt.configId] = modeId;
|
|
39184
39400
|
}
|
|
39185
|
-
this.
|
|
39401
|
+
this.setCurrentSelection("mode", modeId);
|
|
39186
39402
|
this.log.info(`[${this.type}] Static mode set to: ${modeId} \u2014 restarting agent`);
|
|
39187
39403
|
await this.restartWithNewConfig();
|
|
39188
39404
|
return;
|
|
@@ -39197,7 +39413,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
39197
39413
|
sessionId: this.sessionId,
|
|
39198
39414
|
modeId
|
|
39199
39415
|
});
|
|
39200
|
-
this.
|
|
39416
|
+
this.setCurrentSelection("mode", modeId);
|
|
39201
39417
|
this.log.info(`[${this.type}] Mode set to: ${modeId}`);
|
|
39202
39418
|
} catch (e) {
|
|
39203
39419
|
const message = e?.message || "Unknown ACP mode error";
|
|
@@ -39455,8 +39671,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
39455
39671
|
if (result?.modes) this.log.debug(`[${this.type}] modes: ${JSON.stringify(result.modes).slice(0, 300)}`);
|
|
39456
39672
|
this.parseConfigOptions(result?.configOptions);
|
|
39457
39673
|
this.parseModes(result?.modes);
|
|
39458
|
-
if (!this.
|
|
39459
|
-
this.
|
|
39674
|
+
if (!this.getCurrentSelection("model") && result?.models?.currentModelId) {
|
|
39675
|
+
this.setCurrentSelection("model", result.models.currentModelId);
|
|
39460
39676
|
}
|
|
39461
39677
|
if (this.configOptions.length === 0 && this.provider.staticConfigOptions?.length) {
|
|
39462
39678
|
this.useStaticConfig = true;
|
|
@@ -39470,13 +39686,16 @@ ${effect.notification.body || ""}`.trim();
|
|
|
39470
39686
|
});
|
|
39471
39687
|
if (defaultVal) {
|
|
39472
39688
|
this.selectedConfig[sc2.configId] = defaultVal;
|
|
39473
|
-
if (sc2.category === "model"
|
|
39474
|
-
|
|
39689
|
+
if (sc2.category === "model" || sc2.category === "mode") {
|
|
39690
|
+
this.setCurrentSelection(sc2.category, defaultVal);
|
|
39691
|
+
}
|
|
39475
39692
|
}
|
|
39476
39693
|
}
|
|
39477
39694
|
this.log.info(`[${this.type}] Using static configOptions (${this.configOptions.length} options)`);
|
|
39478
39695
|
}
|
|
39479
|
-
|
|
39696
|
+
const currentModel = this.getCurrentSelection("model");
|
|
39697
|
+
const currentMode = this.getCurrentSelection("mode");
|
|
39698
|
+
this.log.info(`[${this.type}] Session created: ${this.sessionId}${currentModel ? ` (model: ${currentModel})` : ""}${currentMode ? ` (mode: ${currentMode})` : ""}`);
|
|
39480
39699
|
if (this.configOptions.length > 0) {
|
|
39481
39700
|
this.log.info(`[${this.type}] Config options: ${this.configOptions.map((c) => `${c.category}(${c.options.length})`).join(", ")}`);
|
|
39482
39701
|
}
|
|
@@ -39651,7 +39870,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
39651
39870
|
break;
|
|
39652
39871
|
}
|
|
39653
39872
|
case "current_mode_update": {
|
|
39654
|
-
this.
|
|
39873
|
+
this.setCurrentSelection("mode", update.currentModeId);
|
|
39655
39874
|
break;
|
|
39656
39875
|
}
|
|
39657
39876
|
case "config_option_update": {
|
|
@@ -39724,7 +39943,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
39724
39943
|
this.detectStatusTransition();
|
|
39725
39944
|
}
|
|
39726
39945
|
if (params.model) {
|
|
39727
|
-
this.
|
|
39946
|
+
this.setCurrentSelection("model", params.model);
|
|
39728
39947
|
}
|
|
39729
39948
|
}
|
|
39730
39949
|
/** Map SDK ToolCallStatus to internal status */
|
|
@@ -40007,7 +40226,11 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40007
40226
|
}
|
|
40008
40227
|
persistRecentActivity(entry) {
|
|
40009
40228
|
try {
|
|
40010
|
-
|
|
40229
|
+
const summaryMetadata = normalizeProviderSummaryMetadata(entry.summaryMetadata);
|
|
40230
|
+
let nextState = appendRecentActivity(loadState(), {
|
|
40231
|
+
...entry,
|
|
40232
|
+
summaryMetadata
|
|
40233
|
+
});
|
|
40011
40234
|
if (entry.providerSessionId && (entry.kind === "cli" || entry.kind === "acp")) {
|
|
40012
40235
|
nextState = upsertSavedProviderSession(nextState, {
|
|
40013
40236
|
kind: entry.kind,
|
|
@@ -40015,7 +40238,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40015
40238
|
providerName: entry.providerName,
|
|
40016
40239
|
providerSessionId: entry.providerSessionId,
|
|
40017
40240
|
workspace: entry.workspace,
|
|
40018
|
-
|
|
40241
|
+
summaryMetadata,
|
|
40019
40242
|
title: entry.title
|
|
40020
40243
|
});
|
|
40021
40244
|
}
|
|
@@ -40205,7 +40428,7 @@ ${installInfo}`
|
|
|
40205
40428
|
providerType: normalizedType,
|
|
40206
40429
|
providerName: provider.displayName || provider.name || normalizedType,
|
|
40207
40430
|
workspace: resolvedDir,
|
|
40208
|
-
|
|
40431
|
+
summaryMetadata: buildLegacyModelModeSummaryMetadata({ model: initialModel }),
|
|
40209
40432
|
sessionId,
|
|
40210
40433
|
title: provider.displayName || provider.name || normalizedType
|
|
40211
40434
|
});
|
|
@@ -40307,7 +40530,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
40307
40530
|
providerName: provider?.displayName || provider?.name || normalizedType,
|
|
40308
40531
|
providerSessionId: sessionBinding.providerSessionId,
|
|
40309
40532
|
workspace: resolvedDir,
|
|
40310
|
-
|
|
40533
|
+
summaryMetadata: buildLegacyModelModeSummaryMetadata({ model: initialModel }),
|
|
40311
40534
|
sessionId: key,
|
|
40312
40535
|
title: provider?.displayName || provider?.name || normalizedType
|
|
40313
40536
|
});
|
|
@@ -42455,11 +42678,87 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
42455
42678
|
}
|
|
42456
42679
|
cleanOldFiles();
|
|
42457
42680
|
init_logger();
|
|
42681
|
+
var LIVE_LIFECYCLES = /* @__PURE__ */ new Set(["starting", "running", "stopping", "interrupted"]);
|
|
42682
|
+
function isSessionHostLiveRuntime(record2) {
|
|
42683
|
+
const lifecycle = String(record2?.lifecycle || "").trim();
|
|
42684
|
+
return LIVE_LIFECYCLES.has(lifecycle);
|
|
42685
|
+
}
|
|
42686
|
+
function getSessionHostRecoveryLabel(meta3) {
|
|
42687
|
+
const recoveryState = typeof meta3?.runtimeRecoveryState === "string" ? String(meta3.runtimeRecoveryState).trim() : "";
|
|
42688
|
+
if (!recoveryState) return null;
|
|
42689
|
+
if (recoveryState === "auto_resumed") return "restored after restart";
|
|
42690
|
+
if (recoveryState === "resume_failed") return "restore failed";
|
|
42691
|
+
if (recoveryState === "host_restart_interrupted") return "host restart interrupted";
|
|
42692
|
+
if (recoveryState === "orphan_snapshot") return "snapshot recovered";
|
|
42693
|
+
return recoveryState.replace(/_/g, " ");
|
|
42694
|
+
}
|
|
42695
|
+
function isSessionHostRecoverySnapshot(record2) {
|
|
42696
|
+
if (!record2) return false;
|
|
42697
|
+
if (isSessionHostLiveRuntime(record2)) return false;
|
|
42698
|
+
const lifecycle = String(record2.lifecycle || "").trim();
|
|
42699
|
+
if (lifecycle && lifecycle !== "stopped" && lifecycle !== "failed") {
|
|
42700
|
+
return false;
|
|
42701
|
+
}
|
|
42702
|
+
const meta3 = record2.meta || void 0;
|
|
42703
|
+
if (meta3?.restoredFromStorage === true) return true;
|
|
42704
|
+
return getSessionHostRecoveryLabel(meta3) !== null;
|
|
42705
|
+
}
|
|
42706
|
+
function getSessionHostSurfaceKind(record2) {
|
|
42707
|
+
if (isSessionHostLiveRuntime(record2)) return "live_runtime";
|
|
42708
|
+
if (isSessionHostRecoverySnapshot(record2)) return "recovery_snapshot";
|
|
42709
|
+
return "inactive_record";
|
|
42710
|
+
}
|
|
42711
|
+
function partitionSessionHostRecords(records) {
|
|
42712
|
+
const liveRuntimes = [];
|
|
42713
|
+
const recoverySnapshots = [];
|
|
42714
|
+
const inactiveRecords = [];
|
|
42715
|
+
for (const record2 of records) {
|
|
42716
|
+
const kind = getSessionHostSurfaceKind(record2);
|
|
42717
|
+
if (kind === "live_runtime") {
|
|
42718
|
+
liveRuntimes.push(record2);
|
|
42719
|
+
} else if (kind === "recovery_snapshot") {
|
|
42720
|
+
recoverySnapshots.push(record2);
|
|
42721
|
+
} else {
|
|
42722
|
+
inactiveRecords.push(record2);
|
|
42723
|
+
}
|
|
42724
|
+
}
|
|
42725
|
+
return {
|
|
42726
|
+
liveRuntimes,
|
|
42727
|
+
recoverySnapshots,
|
|
42728
|
+
inactiveRecords
|
|
42729
|
+
};
|
|
42730
|
+
}
|
|
42731
|
+
function partitionSessionHostDiagnosticsSessions(records) {
|
|
42732
|
+
return partitionSessionHostRecords(records || []);
|
|
42733
|
+
}
|
|
42458
42734
|
var os16 = __toESM2(require("os"));
|
|
42459
42735
|
init_config();
|
|
42460
42736
|
init_terminal_screen();
|
|
42461
42737
|
init_logger();
|
|
42462
42738
|
var READ_DEBUG_ENABLED = process.argv.includes("--dev") || process.env.ADHDEV_READ_DEBUG === "1";
|
|
42739
|
+
var recentReadDebugSignatureBySession = /* @__PURE__ */ new Map();
|
|
42740
|
+
function buildRecentReadDebugSignature(snapshot) {
|
|
42741
|
+
return [
|
|
42742
|
+
snapshot.providerType,
|
|
42743
|
+
snapshot.status,
|
|
42744
|
+
snapshot.inboxBucket,
|
|
42745
|
+
snapshot.unread ? "1" : "0",
|
|
42746
|
+
String(snapshot.lastSeenAt),
|
|
42747
|
+
snapshot.completionMarker,
|
|
42748
|
+
snapshot.seenCompletionMarker,
|
|
42749
|
+
String(snapshot.lastUpdated),
|
|
42750
|
+
String(snapshot.lastUsedAt),
|
|
42751
|
+
snapshot.lastRole,
|
|
42752
|
+
String(snapshot.messageUpdatedAt)
|
|
42753
|
+
].join("|");
|
|
42754
|
+
}
|
|
42755
|
+
function shouldEmitRecentReadDebugLog(cache, snapshot) {
|
|
42756
|
+
const nextSignature = buildRecentReadDebugSignature(snapshot);
|
|
42757
|
+
const previousSignature = cache.get(snapshot.sessionId);
|
|
42758
|
+
if (previousSignature === nextSignature) return false;
|
|
42759
|
+
cache.set(snapshot.sessionId, nextSignature);
|
|
42760
|
+
return true;
|
|
42761
|
+
}
|
|
42463
42762
|
function buildDetectedIdeInfos(detectedIdes, cdpManagers) {
|
|
42464
42763
|
return detectedIdes.filter((ide) => ide.installed !== false).map((ide) => ({
|
|
42465
42764
|
id: ide.id,
|
|
@@ -42611,7 +42910,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
42611
42910
|
providerSessionId: item.providerSessionId,
|
|
42612
42911
|
title: item.title || item.providerName,
|
|
42613
42912
|
workspace: item.workspace,
|
|
42614
|
-
|
|
42913
|
+
summaryMetadata: item.summaryMetadata,
|
|
42615
42914
|
lastLaunchedAt: item.lastUsedAt
|
|
42616
42915
|
})).sort((a, b2) => b2.lastLaunchedAt - a.lastLaunchedAt).slice(0, 12);
|
|
42617
42916
|
}
|
|
@@ -42652,9 +42951,24 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
42652
42951
|
session.unread = unread;
|
|
42653
42952
|
session.inboxBucket = inboxBucket;
|
|
42654
42953
|
if (READ_DEBUG_ENABLED && (session.unread || session.inboxBucket !== "idle" || session.providerType.includes("codex"))) {
|
|
42954
|
+
const recentReadSnapshot = {
|
|
42955
|
+
sessionId: session.id,
|
|
42956
|
+
providerType: session.providerType,
|
|
42957
|
+
status: String(session.status || ""),
|
|
42958
|
+
inboxBucket,
|
|
42959
|
+
unread,
|
|
42960
|
+
lastSeenAt,
|
|
42961
|
+
completionMarker: completionMarker || "-",
|
|
42962
|
+
seenCompletionMarker: seenCompletionMarker || "-",
|
|
42963
|
+
lastUpdated: Number(session.lastUpdated || 0),
|
|
42964
|
+
lastUsedAt,
|
|
42965
|
+
lastRole: getLastMessageRole(sourceSession),
|
|
42966
|
+
messageUpdatedAt: getSessionMessageUpdatedAt(sourceSession)
|
|
42967
|
+
};
|
|
42968
|
+
if (!shouldEmitRecentReadDebugLog(recentReadDebugSignatureBySession, recentReadSnapshot)) continue;
|
|
42655
42969
|
LOG2.info(
|
|
42656
42970
|
"RecentRead",
|
|
42657
|
-
`snapshot session id=${
|
|
42971
|
+
`snapshot session id=${recentReadSnapshot.sessionId} provider=${recentReadSnapshot.providerType} status=${recentReadSnapshot.status} bucket=${recentReadSnapshot.inboxBucket} unread=${String(recentReadSnapshot.unread)} lastSeenAt=${recentReadSnapshot.lastSeenAt} completionMarker=${recentReadSnapshot.completionMarker} seenMarker=${recentReadSnapshot.seenCompletionMarker} lastUpdated=${String(recentReadSnapshot.lastUpdated)} lastUsedAt=${recentReadSnapshot.lastUsedAt} lastRole=${recentReadSnapshot.lastRole} msgUpdatedAt=${recentReadSnapshot.messageUpdatedAt}`
|
|
42658
42972
|
);
|
|
42659
42973
|
}
|
|
42660
42974
|
const lastDisplayMessage = getLastDisplayMessage(sourceSession);
|
|
@@ -42925,11 +43239,104 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
42925
43239
|
providerSessionId: typeof record2.meta?.providerSessionId === "string" ? String(record2.meta.providerSessionId) : void 0
|
|
42926
43240
|
};
|
|
42927
43241
|
}
|
|
43242
|
+
function getWriteConflictOwnerClientId(error48) {
|
|
43243
|
+
const message = typeof error48 === "string" ? error48 : error48 instanceof Error ? error48.message : "";
|
|
43244
|
+
const match = /^Write owned by\s+(.+)$/.exec(message.trim());
|
|
43245
|
+
return match?.[1]?.trim() || void 0;
|
|
43246
|
+
}
|
|
43247
|
+
function summarizeSessionHostRecord(result) {
|
|
43248
|
+
if (!result || typeof result !== "object") return {};
|
|
43249
|
+
const record2 = result;
|
|
43250
|
+
return {
|
|
43251
|
+
runtimeKey: typeof record2.runtimeKey === "string" ? record2.runtimeKey : void 0,
|
|
43252
|
+
lifecycle: typeof record2.lifecycle === "string" ? record2.lifecycle : void 0,
|
|
43253
|
+
surfaceKind: getSessionHostSurfaceKind(record2),
|
|
43254
|
+
attachedClientCount: Array.isArray(record2.attachedClients) ? record2.attachedClients.length : void 0,
|
|
43255
|
+
hasWriteOwner: !!record2.writeOwner,
|
|
43256
|
+
writeOwnerClientId: typeof record2.writeOwner?.clientId === "string" ? record2.writeOwner.clientId : void 0
|
|
43257
|
+
};
|
|
43258
|
+
}
|
|
43259
|
+
function summarizeSessionHostRecords(result) {
|
|
43260
|
+
const records = Array.isArray(result) ? result : [];
|
|
43261
|
+
const groups = partitionSessionHostRecords(records);
|
|
43262
|
+
return {
|
|
43263
|
+
sessionCount: records.length,
|
|
43264
|
+
liveRuntimeCount: groups.liveRuntimes.length,
|
|
43265
|
+
recoverySnapshotCount: groups.recoverySnapshots.length,
|
|
43266
|
+
inactiveRecordCount: groups.inactiveRecords.length
|
|
43267
|
+
};
|
|
43268
|
+
}
|
|
43269
|
+
function summarizeSessionHostDiagnostics(result) {
|
|
43270
|
+
const diagnostics = result && typeof result === "object" ? result : {};
|
|
43271
|
+
const sessions = Array.isArray(diagnostics.sessions) ? diagnostics.sessions : [];
|
|
43272
|
+
return {
|
|
43273
|
+
runtimeCount: typeof diagnostics.runtimeCount === "number" ? diagnostics.runtimeCount : void 0,
|
|
43274
|
+
...summarizeSessionHostRecords(sessions)
|
|
43275
|
+
};
|
|
43276
|
+
}
|
|
43277
|
+
function summarizeSessionHostPruneResult(result) {
|
|
43278
|
+
const value = result && typeof result === "object" ? result : {};
|
|
43279
|
+
return {
|
|
43280
|
+
duplicateGroupCount: typeof value.duplicateGroupCount === "number" ? value.duplicateGroupCount : void 0,
|
|
43281
|
+
prunedCount: Array.isArray(value.prunedSessionIds) ? value.prunedSessionIds.length : void 0,
|
|
43282
|
+
keptCount: Array.isArray(value.keptSessionIds) ? value.keptSessionIds.length : void 0
|
|
43283
|
+
};
|
|
43284
|
+
}
|
|
42928
43285
|
var DaemonCommandRouter = class {
|
|
42929
43286
|
deps;
|
|
42930
43287
|
constructor(deps) {
|
|
42931
43288
|
this.deps = deps;
|
|
42932
43289
|
}
|
|
43290
|
+
async traceSessionHostAction(action, args, run, summarizeResult) {
|
|
43291
|
+
const interactionId = typeof args?._interactionId === "string" ? args._interactionId : void 0;
|
|
43292
|
+
const sessionId = typeof args?.sessionId === "string" ? args.sessionId : void 0;
|
|
43293
|
+
const requestedPayload = { action };
|
|
43294
|
+
if (sessionId) requestedPayload.sessionId = sessionId;
|
|
43295
|
+
if (typeof args?.clientId === "string") requestedPayload.clientId = args.clientId;
|
|
43296
|
+
if (typeof args?.signal === "string") requestedPayload.signal = args.signal;
|
|
43297
|
+
if (typeof args?.providerType === "string") requestedPayload.providerType = args.providerType;
|
|
43298
|
+
if (typeof args?.workspace === "string") requestedPayload.workspace = args.workspace;
|
|
43299
|
+
if (typeof args?.dryRun === "boolean") requestedPayload.dryRun = args.dryRun;
|
|
43300
|
+
recordDebugTrace({
|
|
43301
|
+
interactionId,
|
|
43302
|
+
category: "session_host",
|
|
43303
|
+
stage: "action_requested",
|
|
43304
|
+
level: "info",
|
|
43305
|
+
sessionId,
|
|
43306
|
+
payload: requestedPayload
|
|
43307
|
+
});
|
|
43308
|
+
try {
|
|
43309
|
+
const result = await run();
|
|
43310
|
+
recordDebugTrace({
|
|
43311
|
+
interactionId,
|
|
43312
|
+
category: "session_host",
|
|
43313
|
+
stage: "action_result",
|
|
43314
|
+
level: "info",
|
|
43315
|
+
sessionId,
|
|
43316
|
+
payload: {
|
|
43317
|
+
...requestedPayload,
|
|
43318
|
+
success: true,
|
|
43319
|
+
...summarizeResult ? summarizeResult(result) : {}
|
|
43320
|
+
}
|
|
43321
|
+
});
|
|
43322
|
+
return result;
|
|
43323
|
+
} catch (error48) {
|
|
43324
|
+
recordDebugTrace({
|
|
43325
|
+
interactionId,
|
|
43326
|
+
category: "session_host",
|
|
43327
|
+
stage: "action_failed",
|
|
43328
|
+
level: "error",
|
|
43329
|
+
sessionId,
|
|
43330
|
+
payload: {
|
|
43331
|
+
...requestedPayload,
|
|
43332
|
+
error: error48?.message || String(error48),
|
|
43333
|
+
failureKind: getWriteConflictOwnerClientId(error48) ? "write_conflict" : "request_failed",
|
|
43334
|
+
conflictOwnerClientId: getWriteConflictOwnerClientId(error48)
|
|
43335
|
+
}
|
|
43336
|
+
});
|
|
43337
|
+
throw error48;
|
|
43338
|
+
}
|
|
43339
|
+
}
|
|
42933
43340
|
/**
|
|
42934
43341
|
* Unified command routing.
|
|
42935
43342
|
* Returns result for all commands:
|
|
@@ -43039,44 +43446,60 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43039
43446
|
}
|
|
43040
43447
|
case "session_host_get_diagnostics": {
|
|
43041
43448
|
if (!this.deps.sessionHostControl) return { success: false, error: "Session host control unavailable" };
|
|
43042
|
-
const diagnostics = await this.deps.sessionHostControl.getDiagnostics({
|
|
43449
|
+
const diagnostics = await this.traceSessionHostAction("session_host_get_diagnostics", args, () => this.deps.sessionHostControl.getDiagnostics({
|
|
43043
43450
|
includeSessions: args?.includeSessions !== false,
|
|
43044
43451
|
limit: Number(args?.limit) || void 0
|
|
43045
|
-
})
|
|
43452
|
+
}), (result) => ({
|
|
43453
|
+
includeSessions: args?.includeSessions !== false,
|
|
43454
|
+
limit: Number(args?.limit) || void 0,
|
|
43455
|
+
...summarizeSessionHostDiagnostics(result)
|
|
43456
|
+
}));
|
|
43046
43457
|
return { success: true, diagnostics };
|
|
43047
43458
|
}
|
|
43048
43459
|
case "session_host_list_sessions": {
|
|
43049
43460
|
if (!this.deps.sessionHostControl) return { success: false, error: "Session host control unavailable" };
|
|
43050
|
-
const sessions = await this.deps.sessionHostControl.listSessions();
|
|
43461
|
+
const sessions = await this.traceSessionHostAction("session_host_list_sessions", args, () => this.deps.sessionHostControl.listSessions(), (records) => summarizeSessionHostRecords(records));
|
|
43051
43462
|
return { success: true, sessions };
|
|
43052
43463
|
}
|
|
43053
43464
|
case "session_host_stop_session": {
|
|
43054
43465
|
if (!this.deps.sessionHostControl) return { success: false, error: "Session host control unavailable" };
|
|
43055
43466
|
const sessionId = typeof args?.sessionId === "string" ? args.sessionId : "";
|
|
43056
43467
|
if (!sessionId) return { success: false, error: "sessionId required" };
|
|
43057
|
-
const record2 = await this.deps.sessionHostControl.stopSession(sessionId);
|
|
43468
|
+
const record2 = await this.traceSessionHostAction("session_host_stop_session", args, () => this.deps.sessionHostControl.stopSession(sessionId), (result) => summarizeSessionHostRecord(result));
|
|
43058
43469
|
return { success: true, record: record2 };
|
|
43059
43470
|
}
|
|
43060
43471
|
case "session_host_resume_session": {
|
|
43061
43472
|
if (!this.deps.sessionHostControl) return { success: false, error: "Session host control unavailable" };
|
|
43062
43473
|
const sessionId = typeof args?.sessionId === "string" ? args.sessionId : "";
|
|
43063
43474
|
if (!sessionId) return { success: false, error: "sessionId required" };
|
|
43064
|
-
const record2 = await this.
|
|
43065
|
-
|
|
43066
|
-
|
|
43067
|
-
|
|
43068
|
-
|
|
43475
|
+
const record2 = await this.traceSessionHostAction("session_host_resume_session", args, async () => {
|
|
43476
|
+
const nextRecord = await this.deps.sessionHostControl.resumeSession(sessionId);
|
|
43477
|
+
const hosted = toHostedCliRuntimeDescriptor(nextRecord);
|
|
43478
|
+
if (hosted) {
|
|
43479
|
+
await this.deps.cliManager.restoreHostedSessions([hosted]);
|
|
43480
|
+
}
|
|
43481
|
+
return nextRecord;
|
|
43482
|
+
}, (result) => ({
|
|
43483
|
+
...summarizeSessionHostRecord(result),
|
|
43484
|
+
restoredHostedSession: !!toHostedCliRuntimeDescriptor(result)
|
|
43485
|
+
}));
|
|
43069
43486
|
return { success: true, record: record2 };
|
|
43070
43487
|
}
|
|
43071
43488
|
case "session_host_restart_session": {
|
|
43072
43489
|
if (!this.deps.sessionHostControl) return { success: false, error: "Session host control unavailable" };
|
|
43073
43490
|
const sessionId = typeof args?.sessionId === "string" ? args.sessionId : "";
|
|
43074
43491
|
if (!sessionId) return { success: false, error: "sessionId required" };
|
|
43075
|
-
const record2 = await this.
|
|
43076
|
-
|
|
43077
|
-
|
|
43078
|
-
|
|
43079
|
-
|
|
43492
|
+
const record2 = await this.traceSessionHostAction("session_host_restart_session", args, async () => {
|
|
43493
|
+
const nextRecord = await this.deps.sessionHostControl.restartSession(sessionId);
|
|
43494
|
+
const hosted = toHostedCliRuntimeDescriptor(nextRecord);
|
|
43495
|
+
if (hosted) {
|
|
43496
|
+
await this.deps.cliManager.restoreHostedSessions([hosted]);
|
|
43497
|
+
}
|
|
43498
|
+
return nextRecord;
|
|
43499
|
+
}, (result) => ({
|
|
43500
|
+
...summarizeSessionHostRecord(result),
|
|
43501
|
+
restoredHostedSession: !!toHostedCliRuntimeDescriptor(result)
|
|
43502
|
+
}));
|
|
43080
43503
|
return { success: true, record: record2 };
|
|
43081
43504
|
}
|
|
43082
43505
|
case "session_host_send_signal": {
|
|
@@ -43085,7 +43508,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43085
43508
|
const signal = typeof args?.signal === "string" ? args.signal : "";
|
|
43086
43509
|
if (!sessionId) return { success: false, error: "sessionId required" };
|
|
43087
43510
|
if (!signal) return { success: false, error: "signal required" };
|
|
43088
|
-
const record2 = await this.deps.sessionHostControl.sendSignal(sessionId, signal);
|
|
43511
|
+
const record2 = await this.traceSessionHostAction("session_host_send_signal", args, () => this.deps.sessionHostControl.sendSignal(sessionId, signal), (result) => summarizeSessionHostRecord(result));
|
|
43089
43512
|
return { success: true, record: record2 };
|
|
43090
43513
|
}
|
|
43091
43514
|
case "session_host_force_detach_client": {
|
|
@@ -43094,16 +43517,16 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43094
43517
|
const clientId = typeof args?.clientId === "string" ? args.clientId : "";
|
|
43095
43518
|
if (!sessionId) return { success: false, error: "sessionId required" };
|
|
43096
43519
|
if (!clientId) return { success: false, error: "clientId required" };
|
|
43097
|
-
const record2 = await this.deps.sessionHostControl.forceDetachClient(sessionId, clientId);
|
|
43520
|
+
const record2 = await this.traceSessionHostAction("session_host_force_detach_client", args, () => this.deps.sessionHostControl.forceDetachClient(sessionId, clientId), (result) => summarizeSessionHostRecord(result));
|
|
43098
43521
|
return { success: true, record: record2 };
|
|
43099
43522
|
}
|
|
43100
43523
|
case "session_host_prune_duplicate_sessions": {
|
|
43101
43524
|
if (!this.deps.sessionHostControl) return { success: false, error: "Session host control unavailable" };
|
|
43102
|
-
const result = await this.deps.sessionHostControl.pruneDuplicateSessions({
|
|
43525
|
+
const result = await this.traceSessionHostAction("session_host_prune_duplicate_sessions", args, () => this.deps.sessionHostControl.pruneDuplicateSessions({
|
|
43103
43526
|
providerType: typeof args?.providerType === "string" ? args.providerType : void 0,
|
|
43104
43527
|
workspace: typeof args?.workspace === "string" ? args.workspace : void 0,
|
|
43105
43528
|
dryRun: args?.dryRun === true
|
|
43106
|
-
});
|
|
43529
|
+
}), (value) => summarizeSessionHostPruneResult(value));
|
|
43107
43530
|
return { success: true, result };
|
|
43108
43531
|
}
|
|
43109
43532
|
case "session_host_acquire_write": {
|
|
@@ -43113,12 +43536,15 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43113
43536
|
const ownerType = args?.ownerType === "agent" ? "agent" : "user";
|
|
43114
43537
|
if (!sessionId) return { success: false, error: "sessionId required" };
|
|
43115
43538
|
if (!clientId) return { success: false, error: "clientId required" };
|
|
43116
|
-
const record2 = await this.deps.sessionHostControl.acquireWrite({
|
|
43539
|
+
const record2 = await this.traceSessionHostAction("session_host_acquire_write", args, () => this.deps.sessionHostControl.acquireWrite({
|
|
43117
43540
|
sessionId,
|
|
43118
43541
|
clientId,
|
|
43119
43542
|
ownerType,
|
|
43120
43543
|
force: args?.force !== false
|
|
43121
|
-
})
|
|
43544
|
+
}), (result) => ({
|
|
43545
|
+
...summarizeSessionHostRecord(result),
|
|
43546
|
+
ownerType
|
|
43547
|
+
}));
|
|
43122
43548
|
return { success: true, record: record2 };
|
|
43123
43549
|
}
|
|
43124
43550
|
case "session_host_release_write": {
|
|
@@ -43127,7 +43553,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43127
43553
|
const clientId = typeof args?.clientId === "string" ? args.clientId : "";
|
|
43128
43554
|
if (!sessionId) return { success: false, error: "sessionId required" };
|
|
43129
43555
|
if (!clientId) return { success: false, error: "clientId required" };
|
|
43130
|
-
const record2 = await this.deps.sessionHostControl.releaseWrite({
|
|
43556
|
+
const record2 = await this.traceSessionHostAction("session_host_release_write", args, () => this.deps.sessionHostControl.releaseWrite({
|
|
43557
|
+
sessionId,
|
|
43558
|
+
clientId
|
|
43559
|
+
}), (result) => summarizeSessionHostRecord(result));
|
|
43131
43560
|
return { success: true, record: record2 };
|
|
43132
43561
|
}
|
|
43133
43562
|
case "list_saved_sessions": {
|
|
@@ -43160,7 +43589,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43160
43589
|
kind: saved?.kind || recent?.kind || kind,
|
|
43161
43590
|
title: saved?.title || recent?.title || session.sessionTitle || session.preview || providerType,
|
|
43162
43591
|
workspace: saved?.workspace || recent?.workspace || session.workspace,
|
|
43163
|
-
|
|
43592
|
+
summaryMetadata: saved?.summaryMetadata || recent?.summaryMetadata,
|
|
43164
43593
|
preview: session.preview,
|
|
43165
43594
|
messageCount: session.messageCount,
|
|
43166
43595
|
firstMessageAt: session.firstMessageAt,
|
|
@@ -43597,7 +44026,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43597
44026
|
const ideSummary = ideStates.map((s15) => {
|
|
43598
44027
|
const msgs = s15.activeChat?.messages?.length || 0;
|
|
43599
44028
|
const exts = s15.extensions.length;
|
|
43600
|
-
return `${s15.type}(${s15.status},${msgs}msg,${exts}ext
|
|
44029
|
+
return `${s15.type}(${s15.status},${msgs}msg,${exts}ext)`;
|
|
43601
44030
|
}).join(", ");
|
|
43602
44031
|
const cliSummary = cliStates.map((s15) => `${s15.type}(${s15.status})`).join(", ");
|
|
43603
44032
|
const acpSummary = acpStates.map((s15) => `${s15.type}(${s15.status})`).join(", ");
|
|
@@ -43659,9 +44088,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43659
44088
|
workspace: session.workspace ?? null,
|
|
43660
44089
|
title: session.title,
|
|
43661
44090
|
cdpConnected: session.cdpConnected,
|
|
43662
|
-
|
|
43663
|
-
currentPlan: session.currentPlan,
|
|
43664
|
-
currentAutoApprove: session.currentAutoApprove
|
|
44091
|
+
summaryMetadata: session.summaryMetadata
|
|
43665
44092
|
})),
|
|
43666
44093
|
p2p: payload.p2p,
|
|
43667
44094
|
timestamp: now
|
|
@@ -43821,15 +44248,18 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43821
44248
|
status: data.status || "idle",
|
|
43822
44249
|
messages: data.messages || [],
|
|
43823
44250
|
inputContent: data.inputContent || "",
|
|
43824
|
-
model: data.model,
|
|
43825
|
-
mode: data.mode,
|
|
43826
44251
|
activeModal: data.activeModal
|
|
43827
44252
|
};
|
|
43828
44253
|
if (typeof data.title === "string" && data.title.trim()) {
|
|
43829
44254
|
state.title = data.title.trim();
|
|
43830
44255
|
}
|
|
43831
44256
|
const controlValues = extractProviderControlValues(this.provider.controls, data);
|
|
43832
|
-
|
|
44257
|
+
const surface = resolveProviderStateSurface({
|
|
44258
|
+
controlValues,
|
|
44259
|
+
summaryMetadata: data.summaryMetadata
|
|
44260
|
+
});
|
|
44261
|
+
if (surface.controlValues) state.controlValues = surface.controlValues;
|
|
44262
|
+
if (surface.summaryMetadata) state.summaryMetadata = surface.summaryMetadata;
|
|
43833
44263
|
const effects = normalizeProviderEffects(data);
|
|
43834
44264
|
if (effects.length > 0) state.effects = effects;
|
|
43835
44265
|
if (state.messages.length > 0) {
|
|
@@ -44101,7 +44531,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44101
44531
|
const evaluate = (expr, timeout) => cdp.evaluateInSessionFrame(agent.cdpSessionId, expr, timeout);
|
|
44102
44532
|
const state = await agent.adapter.readChat(evaluate);
|
|
44103
44533
|
const stateError = this.getStateError(state);
|
|
44104
|
-
|
|
44534
|
+
const selectedModelValue = typeof state.controlValues?.model === "string" ? state.controlValues.model : "";
|
|
44535
|
+
LOG2.debug("AgentStream", `[AgentStream] readChat(${type}) result: status=${state.status} msgs=${state.messages?.length || 0} model=${selectedModelValue}${state.status === "error" ? " error=" + JSON.stringify(stateError) : ""}`);
|
|
44105
44536
|
if (state.status === "error" && this.isRecoverableSessionError(stateError)) {
|
|
44106
44537
|
throw new Error(stateError);
|
|
44107
44538
|
}
|
|
@@ -44445,9 +44876,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44445
44876
|
messages: stream.messages || [],
|
|
44446
44877
|
status: stream.status || "idle",
|
|
44447
44878
|
activeModal: stream.activeModal || null,
|
|
44448
|
-
model: stream.model || void 0,
|
|
44449
|
-
mode: stream.mode || void 0,
|
|
44450
44879
|
controlValues: stream.controlValues || void 0,
|
|
44880
|
+
summaryMetadata: stream.summaryMetadata || void 0,
|
|
44451
44881
|
effects: stream.effects || void 0,
|
|
44452
44882
|
sessionId: stream.sessionId || stream.instanceId || void 0,
|
|
44453
44883
|
title: stream.title || stream.agentName || void 0,
|
|
@@ -44975,7 +45405,11 @@ module.exports.setMode = (params) => {
|
|
|
44975
45405
|
* 5. Approval dialog detection (buttons, modal)
|
|
44976
45406
|
* 6. Input field selector
|
|
44977
45407
|
*
|
|
44978
|
-
*
|
|
45408
|
+
* Preferred live-state surface:
|
|
45409
|
+
* - controlValues: explicit current control selections (model/mode/etc.)
|
|
45410
|
+
* - summaryMetadata: compact always-visible metadata for dashboard/recent views
|
|
45411
|
+
* Legacy top-level model/mode output is no longer the preferred shape.
|
|
45412
|
+
* \u2192 { id, status, title, messages[], inputContent, activeModal, controlValues?, summaryMetadata? }
|
|
44979
45413
|
*/
|
|
44980
45414
|
(() => {
|
|
44981
45415
|
try {
|
|
@@ -45003,6 +45437,9 @@ module.exports.setMode = (params) => {
|
|
|
45003
45437
|
messages,
|
|
45004
45438
|
inputContent,
|
|
45005
45439
|
activeModal,
|
|
45440
|
+
// TODO: Return explicit selections when available, e.g.
|
|
45441
|
+
// controlValues: { model: selectedModel, mode: selectedMode },
|
|
45442
|
+
// summaryMetadata: { items: [{ id: 'model', value: selectedModelLabel || selectedModel, shortValue: selectedModel, order: 10 }] },
|
|
45006
45443
|
});
|
|
45007
45444
|
} catch(e) {
|
|
45008
45445
|
return JSON.stringify({ id: '', status: 'error', messages: [], error: e.message });
|
|
@@ -46737,7 +47174,6 @@ async (params) => {
|
|
|
46737
47174
|
lastMessage: s15.activeChat?.messages?.slice(-1)[0] || null,
|
|
46738
47175
|
activeModal: s15.activeChat?.activeModal || null,
|
|
46739
47176
|
pendingEvents: s15.pendingEvents || [],
|
|
46740
|
-
currentModel: s15.currentModel,
|
|
46741
47177
|
settings: s15.settings
|
|
46742
47178
|
}));
|
|
46743
47179
|
ctx.json(res, 200, { instances: result, count: result.length });
|
|
@@ -47892,7 +48328,7 @@ async (params) => {
|
|
|
47892
48328
|
lines.push("## Required Return Format");
|
|
47893
48329
|
lines.push("| Function | Return JSON |");
|
|
47894
48330
|
lines.push("|---|---|");
|
|
47895
|
-
lines.push("| readChat | `{ id, status, title, messages: [{role, content, index, kind?, meta?}], inputContent, activeModal }` \u2014 optional `kind`: standard, thought, tool, terminal;
|
|
48331
|
+
lines.push("| readChat | `{ id, status, title, messages: [{role, content, index, kind?, meta?}], inputContent, activeModal, controlValues?, summaryMetadata? }` \u2014 optional `kind`: standard, thought, tool, terminal; prefer explicit `controlValues` for current selections and `summaryMetadata` for compact always-visible UI metadata |");
|
|
47896
48332
|
lines.push("| sendMessage | `{ sent: false, needsTypeAndSend: true, selector }` |");
|
|
47897
48333
|
lines.push("| resolveAction | `{ resolved: true/false, clicked? }` |");
|
|
47898
48334
|
lines.push("| listSessions | `{ sessions: [{ id, title, active, index }] }` |");
|
|
@@ -49525,7 +49961,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
49525
49961
|
lines.push("## Required Return Format");
|
|
49526
49962
|
lines.push("| Function | Return JSON |");
|
|
49527
49963
|
lines.push("|---|---|");
|
|
49528
|
-
lines.push("| readChat | `{ id, status, title, messages: [{role, content, index, kind?, meta?}], inputContent, activeModal }` \u2014 optional `kind`: standard, thought, tool, terminal;
|
|
49964
|
+
lines.push("| readChat | `{ id, status, title, messages: [{role, content, index, kind?, meta?}], inputContent, activeModal, controlValues?, summaryMetadata? }` \u2014 optional `kind`: standard, thought, tool, terminal; prefer explicit `controlValues` for current selections and `summaryMetadata` for compact always-visible UI metadata |");
|
|
49529
49965
|
lines.push("| sendMessage | `{ sent: false, needsTypeAndSend: true, selector }` |");
|
|
49530
49966
|
lines.push("| resolveAction | `{ resolved: true/false, clicked? }` |");
|
|
49531
49967
|
lines.push("| listSessions | `{ sessions: [{ id, title, active, index }] }` |");
|
|
@@ -50422,59 +50858,6 @@ data: ${JSON.stringify(msg.data)}
|
|
|
50422
50858
|
});
|
|
50423
50859
|
}
|
|
50424
50860
|
}
|
|
50425
|
-
var LIVE_LIFECYCLES = /* @__PURE__ */ new Set(["starting", "running", "stopping", "interrupted"]);
|
|
50426
|
-
function isSessionHostLiveRuntime(record2) {
|
|
50427
|
-
const lifecycle = String(record2?.lifecycle || "").trim();
|
|
50428
|
-
return LIVE_LIFECYCLES.has(lifecycle);
|
|
50429
|
-
}
|
|
50430
|
-
function getSessionHostRecoveryLabel(meta3) {
|
|
50431
|
-
const recoveryState = typeof meta3?.runtimeRecoveryState === "string" ? String(meta3.runtimeRecoveryState).trim() : "";
|
|
50432
|
-
if (!recoveryState) return null;
|
|
50433
|
-
if (recoveryState === "auto_resumed") return "restored after restart";
|
|
50434
|
-
if (recoveryState === "resume_failed") return "restore failed";
|
|
50435
|
-
if (recoveryState === "host_restart_interrupted") return "host restart interrupted";
|
|
50436
|
-
if (recoveryState === "orphan_snapshot") return "snapshot recovered";
|
|
50437
|
-
return recoveryState.replace(/_/g, " ");
|
|
50438
|
-
}
|
|
50439
|
-
function isSessionHostRecoverySnapshot(record2) {
|
|
50440
|
-
if (!record2) return false;
|
|
50441
|
-
if (isSessionHostLiveRuntime(record2)) return false;
|
|
50442
|
-
const lifecycle = String(record2.lifecycle || "").trim();
|
|
50443
|
-
if (lifecycle && lifecycle !== "stopped" && lifecycle !== "failed") {
|
|
50444
|
-
return false;
|
|
50445
|
-
}
|
|
50446
|
-
const meta3 = record2.meta || void 0;
|
|
50447
|
-
if (meta3?.restoredFromStorage === true) return true;
|
|
50448
|
-
return getSessionHostRecoveryLabel(meta3) !== null;
|
|
50449
|
-
}
|
|
50450
|
-
function getSessionHostSurfaceKind(record2) {
|
|
50451
|
-
if (isSessionHostLiveRuntime(record2)) return "live_runtime";
|
|
50452
|
-
if (isSessionHostRecoverySnapshot(record2)) return "recovery_snapshot";
|
|
50453
|
-
return "inactive_record";
|
|
50454
|
-
}
|
|
50455
|
-
function partitionSessionHostRecords(records) {
|
|
50456
|
-
const liveRuntimes = [];
|
|
50457
|
-
const recoverySnapshots = [];
|
|
50458
|
-
const inactiveRecords = [];
|
|
50459
|
-
for (const record2 of records) {
|
|
50460
|
-
const kind = getSessionHostSurfaceKind(record2);
|
|
50461
|
-
if (kind === "live_runtime") {
|
|
50462
|
-
liveRuntimes.push(record2);
|
|
50463
|
-
} else if (kind === "recovery_snapshot") {
|
|
50464
|
-
recoverySnapshots.push(record2);
|
|
50465
|
-
} else {
|
|
50466
|
-
inactiveRecords.push(record2);
|
|
50467
|
-
}
|
|
50468
|
-
}
|
|
50469
|
-
return {
|
|
50470
|
-
liveRuntimes,
|
|
50471
|
-
recoverySnapshots,
|
|
50472
|
-
inactiveRecords
|
|
50473
|
-
};
|
|
50474
|
-
}
|
|
50475
|
-
function partitionSessionHostDiagnosticsSessions(records) {
|
|
50476
|
-
return partitionSessionHostRecords(records || []);
|
|
50477
|
-
}
|
|
50478
50861
|
function shouldAutoRestoreHostedSessionsOnStartup2(env = process.env) {
|
|
50479
50862
|
const raw = typeof env.ADHDEV_RESTORE_HOSTED_SESSIONS_ON_STARTUP === "string" ? env.ADHDEV_RESTORE_HOSTED_SESSIONS_ON_STARTUP.trim().toLowerCase() : "";
|
|
50480
50863
|
return raw === "1" || raw === "true" || raw === "yes";
|
|
@@ -52575,9 +52958,6 @@ var StandaloneServer = class {
|
|
|
52575
52958
|
status: session.status,
|
|
52576
52959
|
title: session.title,
|
|
52577
52960
|
cdpConnected: session.cdpConnected,
|
|
52578
|
-
currentModel: session.currentModel,
|
|
52579
|
-
currentPlan: session.currentPlan,
|
|
52580
|
-
currentAutoApprove: session.currentAutoApprove,
|
|
52581
52961
|
lastSeenAt: session.lastSeenAt,
|
|
52582
52962
|
unread: session.unread,
|
|
52583
52963
|
inboxBucket: session.inboxBucket,
|
|
@@ -52605,8 +52985,10 @@ var StandaloneServer = class {
|
|
|
52605
52985
|
return { success: false, error: "command type required" };
|
|
52606
52986
|
}
|
|
52607
52987
|
const result = await this.components.router.execute(type, args, "standalone");
|
|
52608
|
-
if (type.startsWith("workspace_") || type.startsWith("session_host_"))
|
|
52609
|
-
|
|
52988
|
+
if (type === "invoke_provider_script" || type.startsWith("workspace_") || type.startsWith("session_host_")) {
|
|
52989
|
+
this.scheduleBroadcastStatus();
|
|
52990
|
+
}
|
|
52991
|
+
if (type === "invoke_provider_script" || type === "get_status_metadata" || type === "set_user_name" || type === "set_machine_nickname" || type.startsWith("workspace_") || type.startsWith("session_host_")) {
|
|
52610
52992
|
void this.flushWsDaemonMetadataSubscriptions();
|
|
52611
52993
|
}
|
|
52612
52994
|
if (type.startsWith("session_host_")) void this.flushWsSessionHostDiagnosticsSubscriptions();
|