adhdev 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/cli/index.js +851 -202
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +608 -198
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -419,6 +419,73 @@ var init_workspaces = __esm({
|
|
|
419
419
|
}
|
|
420
420
|
});
|
|
421
421
|
|
|
422
|
+
// ../../oss/packages/daemon-core/src/providers/summary-metadata.ts
|
|
423
|
+
function normalizeSummaryItem(item) {
|
|
424
|
+
if (!item || typeof item !== "object") return null;
|
|
425
|
+
const id = String(item.id || "").trim();
|
|
426
|
+
const value = String(item.value || "").trim();
|
|
427
|
+
if (!id || !value) return null;
|
|
428
|
+
const normalized = {
|
|
429
|
+
id,
|
|
430
|
+
value
|
|
431
|
+
};
|
|
432
|
+
if (typeof item.label === "string" && item.label.trim()) normalized.label = item.label.trim();
|
|
433
|
+
if (typeof item.shortValue === "string" && item.shortValue.trim()) normalized.shortValue = item.shortValue.trim();
|
|
434
|
+
if (typeof item.icon === "string" && item.icon.trim()) normalized.icon = item.icon.trim();
|
|
435
|
+
if (typeof item.order === "number" && Number.isFinite(item.order)) normalized.order = item.order;
|
|
436
|
+
return normalized;
|
|
437
|
+
}
|
|
438
|
+
function normalizeProviderSummaryMetadata(summary) {
|
|
439
|
+
if (!summary || !Array.isArray(summary.items)) return void 0;
|
|
440
|
+
const items = summary.items.map((item) => normalizeSummaryItem(item)).filter((item) => !!item).sort((left2, right2) => {
|
|
441
|
+
const orderDiff = (left2.order ?? Number.MAX_SAFE_INTEGER) - (right2.order ?? Number.MAX_SAFE_INTEGER);
|
|
442
|
+
if (orderDiff !== 0) return orderDiff;
|
|
443
|
+
return left2.id.localeCompare(right2.id);
|
|
444
|
+
});
|
|
445
|
+
return items.length > 0 ? { items } : void 0;
|
|
446
|
+
}
|
|
447
|
+
function buildProviderSummaryMetadata(items) {
|
|
448
|
+
return normalizeProviderSummaryMetadata({ items: items.filter(Boolean) });
|
|
449
|
+
}
|
|
450
|
+
function buildLegacyModelModeSummaryMetadata(params) {
|
|
451
|
+
return buildProviderSummaryMetadata([
|
|
452
|
+
params.model ? {
|
|
453
|
+
id: "model",
|
|
454
|
+
label: "Model",
|
|
455
|
+
value: String(params.modelLabel || params.model).trim(),
|
|
456
|
+
shortValue: String(params.model).trim(),
|
|
457
|
+
order: 10
|
|
458
|
+
} : null,
|
|
459
|
+
params.mode ? {
|
|
460
|
+
id: "mode",
|
|
461
|
+
label: "Mode",
|
|
462
|
+
value: String(params.modeLabel || params.mode).trim(),
|
|
463
|
+
shortValue: String(params.mode).trim(),
|
|
464
|
+
order: 20
|
|
465
|
+
} : null
|
|
466
|
+
]);
|
|
467
|
+
}
|
|
468
|
+
function resolveProviderStateSummaryMetadata(params) {
|
|
469
|
+
const explicit = normalizeProviderSummaryMetadata(params.summaryMetadata);
|
|
470
|
+
if (explicit) return explicit;
|
|
471
|
+
const model = typeof params.controlValues?.model === "string" ? params.controlValues.model : void 0;
|
|
472
|
+
const mode = typeof params.controlValues?.mode === "string" ? params.controlValues.mode : void 0;
|
|
473
|
+
return buildLegacyModelModeSummaryMetadata({
|
|
474
|
+
model,
|
|
475
|
+
mode,
|
|
476
|
+
modelLabel: params.modelLabel,
|
|
477
|
+
modeLabel: params.modeLabel
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
function normalizePersistedSummaryMetadata(params) {
|
|
481
|
+
return normalizeProviderSummaryMetadata(params.summaryMetadata);
|
|
482
|
+
}
|
|
483
|
+
var init_summary_metadata = __esm({
|
|
484
|
+
"../../oss/packages/daemon-core/src/providers/summary-metadata.ts"() {
|
|
485
|
+
"use strict";
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
|
|
422
489
|
// ../../oss/packages/daemon-core/src/config/recent-activity.ts
|
|
423
490
|
function normalizeWorkspace(workspace) {
|
|
424
491
|
if (!workspace) return "";
|
|
@@ -442,6 +509,9 @@ function appendRecentActivity(state, entry) {
|
|
|
442
509
|
const nextEntry = {
|
|
443
510
|
...entry,
|
|
444
511
|
workspace: entry.workspace ? normalizeWorkspace(entry.workspace) : void 0,
|
|
512
|
+
summaryMetadata: normalizePersistedSummaryMetadata({
|
|
513
|
+
summaryMetadata: entry.summaryMetadata
|
|
514
|
+
}),
|
|
445
515
|
id: buildRecentActivityKeyForEntry(entry),
|
|
446
516
|
lastUsedAt: entry.lastUsedAt || Date.now()
|
|
447
517
|
};
|
|
@@ -452,7 +522,12 @@ function appendRecentActivity(state, entry) {
|
|
|
452
522
|
};
|
|
453
523
|
}
|
|
454
524
|
function getRecentActivity(state, limit = 20) {
|
|
455
|
-
return [...state.recentActivity || []].
|
|
525
|
+
return [...state.recentActivity || []].map((entry) => ({
|
|
526
|
+
...entry,
|
|
527
|
+
summaryMetadata: normalizePersistedSummaryMetadata({
|
|
528
|
+
summaryMetadata: entry.summaryMetadata
|
|
529
|
+
})
|
|
530
|
+
})).sort((a, b) => b.lastUsedAt - a.lastUsedAt).slice(0, limit);
|
|
456
531
|
}
|
|
457
532
|
function getSessionSeenAt(state, sessionId) {
|
|
458
533
|
return state.sessionReads?.[sessionId] || 0;
|
|
@@ -483,6 +558,7 @@ var init_recent_activity = __esm({
|
|
|
483
558
|
"use strict";
|
|
484
559
|
path2 = __toESM(require("path"));
|
|
485
560
|
init_workspaces();
|
|
561
|
+
init_summary_metadata();
|
|
486
562
|
MAX_ACTIVITY = 30;
|
|
487
563
|
}
|
|
488
564
|
});
|
|
@@ -511,7 +587,9 @@ function upsertSavedProviderSession(state, entry) {
|
|
|
511
587
|
providerName: entry.providerName,
|
|
512
588
|
providerSessionId,
|
|
513
589
|
workspace: entry.workspace ? normalizeWorkspace2(entry.workspace) : void 0,
|
|
514
|
-
|
|
590
|
+
summaryMetadata: normalizePersistedSummaryMetadata({
|
|
591
|
+
summaryMetadata: entry.summaryMetadata
|
|
592
|
+
}),
|
|
515
593
|
title: entry.title,
|
|
516
594
|
createdAt: existing?.createdAt || entry.createdAt || Date.now(),
|
|
517
595
|
lastUsedAt: entry.lastUsedAt || Date.now()
|
|
@@ -527,7 +605,12 @@ function getSavedProviderSessions(state, filters) {
|
|
|
527
605
|
if (filters?.providerType && entry.providerType !== filters.providerType) return false;
|
|
528
606
|
if (filters?.kind && entry.kind !== filters.kind) return false;
|
|
529
607
|
return true;
|
|
530
|
-
}).
|
|
608
|
+
}).map((entry) => ({
|
|
609
|
+
...entry,
|
|
610
|
+
summaryMetadata: normalizePersistedSummaryMetadata({
|
|
611
|
+
summaryMetadata: entry.summaryMetadata
|
|
612
|
+
})
|
|
613
|
+
})).sort((a, b) => b.lastUsedAt - a.lastUsedAt);
|
|
531
614
|
}
|
|
532
615
|
var path3, MAX_SAVED_SESSIONS;
|
|
533
616
|
var init_saved_sessions = __esm({
|
|
@@ -535,6 +618,7 @@ var init_saved_sessions = __esm({
|
|
|
535
618
|
"use strict";
|
|
536
619
|
path3 = __toESM(require("path"));
|
|
537
620
|
init_workspaces();
|
|
621
|
+
init_summary_metadata();
|
|
538
622
|
MAX_SAVED_SESSIONS = 500;
|
|
539
623
|
}
|
|
540
624
|
});
|
|
@@ -2547,8 +2631,6 @@ function extractProviderControlValues(controls, data) {
|
|
|
2547
2631
|
if (rawValue === void 0 || rawValue === null) continue;
|
|
2548
2632
|
values[ctrl.id] = normalizeControlValue(rawValue);
|
|
2549
2633
|
}
|
|
2550
|
-
if (data.model !== void 0 && values.model === void 0) values.model = normalizeControlValue(data.model);
|
|
2551
|
-
if (data.mode !== void 0 && values.mode === void 0) values.mode = normalizeControlValue(data.mode);
|
|
2552
2634
|
return Object.keys(values).length > 0 ? values : void 0;
|
|
2553
2635
|
}
|
|
2554
2636
|
function normalizeProviderEffects(data) {
|
|
@@ -2650,7 +2732,7 @@ function normalizeControlOption(option) {
|
|
|
2650
2732
|
}
|
|
2651
2733
|
if (!option || typeof option !== "object") return null;
|
|
2652
2734
|
const record2 = option;
|
|
2653
|
-
const value = typeof record2.value === "string" ? record2.value : typeof record2.id === "string" ? record2.id : null;
|
|
2735
|
+
const value = typeof record2.value === "string" ? record2.value : typeof record2.id === "string" ? record2.id : typeof record2.name === "string" ? record2.name : null;
|
|
2654
2736
|
if (!value) return null;
|
|
2655
2737
|
const label = typeof record2.label === "string" ? record2.label : typeof record2.name === "string" ? record2.name : value;
|
|
2656
2738
|
const normalized = { value, label };
|
|
@@ -3196,6 +3278,68 @@ var init_chat_history = __esm({
|
|
|
3196
3278
|
}
|
|
3197
3279
|
});
|
|
3198
3280
|
|
|
3281
|
+
// ../../oss/packages/daemon-core/src/providers/provider-patch-state.ts
|
|
3282
|
+
function isControlValue(value) {
|
|
3283
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
3284
|
+
}
|
|
3285
|
+
function asControlValueMap(value) {
|
|
3286
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
3287
|
+
const result = {};
|
|
3288
|
+
for (const [entryKey, entryValue] of Object.entries(value)) {
|
|
3289
|
+
if (isControlValue(entryValue)) result[entryKey] = entryValue;
|
|
3290
|
+
}
|
|
3291
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
3292
|
+
}
|
|
3293
|
+
function getLegacyModelModeValues(data) {
|
|
3294
|
+
if (!data || typeof data !== "object") return void 0;
|
|
3295
|
+
const legacy = {};
|
|
3296
|
+
if (typeof data.model === "string" && data.model.trim()) legacy.model = data.model.trim();
|
|
3297
|
+
if (typeof data.mode === "string" && data.mode.trim()) legacy.mode = data.mode.trim();
|
|
3298
|
+
return Object.keys(legacy).length > 0 ? legacy : void 0;
|
|
3299
|
+
}
|
|
3300
|
+
function mergeProviderPatchState(params) {
|
|
3301
|
+
const {
|
|
3302
|
+
providerControls,
|
|
3303
|
+
data,
|
|
3304
|
+
currentControlValues,
|
|
3305
|
+
currentSummaryMetadata,
|
|
3306
|
+
mergeWithCurrent = true
|
|
3307
|
+
} = params;
|
|
3308
|
+
const sources = [
|
|
3309
|
+
mergeWithCurrent ? asControlValueMap(currentControlValues) : void 0,
|
|
3310
|
+
asControlValueMap(data?.controlValues),
|
|
3311
|
+
asControlValueMap(extractProviderControlValues(providerControls, data)),
|
|
3312
|
+
getLegacyModelModeValues(data)
|
|
3313
|
+
];
|
|
3314
|
+
const controlValues = Object.assign({}, ...sources.filter(Boolean));
|
|
3315
|
+
return {
|
|
3316
|
+
controlValues,
|
|
3317
|
+
summaryMetadata: data?.summaryMetadata !== void 0 ? data.summaryMetadata : currentSummaryMetadata
|
|
3318
|
+
};
|
|
3319
|
+
}
|
|
3320
|
+
function normalizeProviderStateControlValues(controlValues) {
|
|
3321
|
+
return controlValues && Object.keys(controlValues).length > 0 ? controlValues : void 0;
|
|
3322
|
+
}
|
|
3323
|
+
function resolveProviderStateSurface(params) {
|
|
3324
|
+
const controlValues = normalizeProviderStateControlValues(params.controlValues);
|
|
3325
|
+
return {
|
|
3326
|
+
controlValues,
|
|
3327
|
+
summaryMetadata: resolveProviderStateSummaryMetadata({
|
|
3328
|
+
summaryMetadata: params.summaryMetadata,
|
|
3329
|
+
controlValues,
|
|
3330
|
+
modelLabel: params.modelLabel,
|
|
3331
|
+
modeLabel: params.modeLabel
|
|
3332
|
+
})
|
|
3333
|
+
};
|
|
3334
|
+
}
|
|
3335
|
+
var init_provider_patch_state = __esm({
|
|
3336
|
+
"../../oss/packages/daemon-core/src/providers/provider-patch-state.ts"() {
|
|
3337
|
+
"use strict";
|
|
3338
|
+
init_control_effects();
|
|
3339
|
+
init_summary_metadata();
|
|
3340
|
+
}
|
|
3341
|
+
});
|
|
3342
|
+
|
|
3199
3343
|
// ../../oss/packages/daemon-core/src/providers/extension-provider-instance.ts
|
|
3200
3344
|
var ExtensionProviderInstance;
|
|
3201
3345
|
var init_extension_provider_instance = __esm({
|
|
@@ -3204,6 +3348,7 @@ var init_extension_provider_instance = __esm({
|
|
|
3204
3348
|
init_status_monitor();
|
|
3205
3349
|
init_control_effects();
|
|
3206
3350
|
init_chat_history();
|
|
3351
|
+
init_provider_patch_state();
|
|
3207
3352
|
ExtensionProviderInstance = class {
|
|
3208
3353
|
type;
|
|
3209
3354
|
category = "extension";
|
|
@@ -3217,9 +3362,8 @@ var init_extension_provider_instance = __esm({
|
|
|
3217
3362
|
messages = [];
|
|
3218
3363
|
prevMessageHashes = /* @__PURE__ */ new Map();
|
|
3219
3364
|
activeModal = null;
|
|
3220
|
-
currentModel = "";
|
|
3221
|
-
currentMode = "";
|
|
3222
3365
|
controlValues = {};
|
|
3366
|
+
summaryMetadata = void 0;
|
|
3223
3367
|
appliedEffectKeys = /* @__PURE__ */ new Set();
|
|
3224
3368
|
runtimeMessages = [];
|
|
3225
3369
|
lastAgentStatus = "idle";
|
|
@@ -3254,6 +3398,10 @@ var init_extension_provider_instance = __esm({
|
|
|
3254
3398
|
if (!this.context?.cdp?.isConnected) return;
|
|
3255
3399
|
}
|
|
3256
3400
|
getState() {
|
|
3401
|
+
const surface = resolveProviderStateSurface({
|
|
3402
|
+
summaryMetadata: this.summaryMetadata,
|
|
3403
|
+
controlValues: this.controlValues
|
|
3404
|
+
});
|
|
3257
3405
|
return {
|
|
3258
3406
|
type: this.type,
|
|
3259
3407
|
name: this.provider.name,
|
|
@@ -3267,10 +3415,9 @@ var init_extension_provider_instance = __esm({
|
|
|
3267
3415
|
activeModal: this.activeModal,
|
|
3268
3416
|
inputContent: ""
|
|
3269
3417
|
} : null,
|
|
3270
|
-
|
|
3271
|
-
currentPlan: this.currentMode || void 0,
|
|
3272
|
-
controlValues: this.controlValues,
|
|
3418
|
+
controlValues: surface.controlValues,
|
|
3273
3419
|
providerControls: this.provider.controls,
|
|
3420
|
+
summaryMetadata: surface.summaryMetadata,
|
|
3274
3421
|
agentStreams: this.agentStreams,
|
|
3275
3422
|
instanceId: this.instanceId,
|
|
3276
3423
|
lastUpdated: Date.now(),
|
|
@@ -3283,10 +3430,14 @@ var init_extension_provider_instance = __esm({
|
|
|
3283
3430
|
if (data?.streams) this.agentStreams = data.streams;
|
|
3284
3431
|
if (data?.messages) this.messages = this.assignReceivedAt(data.messages);
|
|
3285
3432
|
if (data?.activeModal !== void 0) this.activeModal = data.activeModal;
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3433
|
+
const patchedState = mergeProviderPatchState({
|
|
3434
|
+
providerControls: this.provider.controls,
|
|
3435
|
+
data,
|
|
3436
|
+
currentControlValues: this.controlValues,
|
|
3437
|
+
currentSummaryMetadata: this.summaryMetadata
|
|
3438
|
+
});
|
|
3439
|
+
this.controlValues = patchedState.controlValues;
|
|
3440
|
+
this.summaryMetadata = patchedState.summaryMetadata;
|
|
3290
3441
|
if (typeof data?.sessionId === "string" && data.sessionId.trim()) this.chatId = data.sessionId;
|
|
3291
3442
|
if (typeof data?.title === "string" && data.title.trim()) this.chatTitle = data.title;
|
|
3292
3443
|
if (typeof data?.agentName === "string" && data.agentName.trim()) this.agentName = data.agentName;
|
|
@@ -3387,8 +3538,14 @@ var init_extension_provider_instance = __esm({
|
|
|
3387
3538
|
}
|
|
3388
3539
|
applyProviderResponse(data, options) {
|
|
3389
3540
|
if (!data || typeof data !== "object") return;
|
|
3390
|
-
const
|
|
3391
|
-
|
|
3541
|
+
const patchedState = mergeProviderPatchState({
|
|
3542
|
+
providerControls: this.provider.controls,
|
|
3543
|
+
data,
|
|
3544
|
+
currentControlValues: this.controlValues,
|
|
3545
|
+
currentSummaryMetadata: this.summaryMetadata
|
|
3546
|
+
});
|
|
3547
|
+
this.controlValues = patchedState.controlValues;
|
|
3548
|
+
this.summaryMetadata = patchedState.summaryMetadata;
|
|
3392
3549
|
const effects = normalizeProviderEffects(data);
|
|
3393
3550
|
for (const effect of effects) {
|
|
3394
3551
|
const effectWhen = effect.when || "immediate";
|
|
@@ -3538,8 +3695,6 @@ ${effect.notification.body || ""}`.trim();
|
|
|
3538
3695
|
this.messages = [];
|
|
3539
3696
|
this.prevMessageHashes.clear();
|
|
3540
3697
|
this.activeModal = null;
|
|
3541
|
-
this.currentModel = "";
|
|
3542
|
-
this.currentMode = "";
|
|
3543
3698
|
this.controlValues = {};
|
|
3544
3699
|
this.currentStatus = "idle";
|
|
3545
3700
|
this.chatId = null;
|
|
@@ -3619,6 +3774,7 @@ var init_ide_provider_instance = __esm({
|
|
|
3619
3774
|
init_logger();
|
|
3620
3775
|
init_control_effects();
|
|
3621
3776
|
init_approval_utils();
|
|
3777
|
+
init_provider_patch_state();
|
|
3622
3778
|
IdeProviderInstance = class {
|
|
3623
3779
|
type;
|
|
3624
3780
|
category = "ide";
|
|
@@ -3691,6 +3847,10 @@ var init_ide_provider_instance = __esm({
|
|
|
3691
3847
|
for (const ext of this.extensions.values()) {
|
|
3692
3848
|
extensionStates.push(ext.getState());
|
|
3693
3849
|
}
|
|
3850
|
+
const surface = resolveProviderStateSurface({
|
|
3851
|
+
summaryMetadata: this.cachedChat?.summaryMetadata,
|
|
3852
|
+
controlValues: this.cachedChat?.controlValues
|
|
3853
|
+
});
|
|
3694
3854
|
return {
|
|
3695
3855
|
type: this.type,
|
|
3696
3856
|
name: this.provider.name,
|
|
@@ -3707,11 +3867,9 @@ var init_ide_provider_instance = __esm({
|
|
|
3707
3867
|
workspace: this.workspace || null,
|
|
3708
3868
|
extensions: extensionStates,
|
|
3709
3869
|
cdpConnected: cdp?.isConnected || false,
|
|
3710
|
-
|
|
3711
|
-
currentPlan: this.cachedChat?.mode || void 0,
|
|
3712
|
-
currentAutoApprove: this.cachedChat?.autoApprove || void 0,
|
|
3713
|
-
controlValues: this.cachedChat?.controlValues || void 0,
|
|
3870
|
+
controlValues: surface.controlValues,
|
|
3714
3871
|
providerControls: this.provider.controls,
|
|
3872
|
+
summaryMetadata: surface.summaryMetadata,
|
|
3715
3873
|
instanceId: this.instanceId,
|
|
3716
3874
|
lastUpdated: Date.now(),
|
|
3717
3875
|
settings: this.settings,
|
|
@@ -3883,8 +4041,13 @@ var init_ide_provider_instance = __esm({
|
|
|
3883
4041
|
chat.messages = messages.filter((m) => !hiddenKinds.has(m.kind || ""));
|
|
3884
4042
|
}
|
|
3885
4043
|
}
|
|
3886
|
-
const
|
|
3887
|
-
|
|
4044
|
+
const patchedState = mergeProviderPatchState({
|
|
4045
|
+
providerControls: this.provider.controls,
|
|
4046
|
+
data: chat,
|
|
4047
|
+
mergeWithCurrent: false
|
|
4048
|
+
});
|
|
4049
|
+
chat.controlValues = Object.keys(patchedState.controlValues).length > 0 ? patchedState.controlValues : void 0;
|
|
4050
|
+
chat.summaryMetadata = patchedState.summaryMetadata;
|
|
3888
4051
|
this.cachedChat = { ...chat, activeModal };
|
|
3889
4052
|
this.detectAgentTransitions(chat, now);
|
|
3890
4053
|
const persistedMessages = chat.messages || messages;
|
|
@@ -3971,14 +4134,18 @@ var init_ide_provider_instance = __esm({
|
|
|
3971
4134
|
}
|
|
3972
4135
|
applyProviderResponse(data, options) {
|
|
3973
4136
|
if (!data || typeof data !== "object") return;
|
|
3974
|
-
const
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
4137
|
+
const patchedState = mergeProviderPatchState({
|
|
4138
|
+
providerControls: this.provider.controls,
|
|
4139
|
+
data,
|
|
4140
|
+
currentControlValues: this.cachedChat?.controlValues,
|
|
4141
|
+
currentSummaryMetadata: this.cachedChat?.summaryMetadata
|
|
4142
|
+
});
|
|
4143
|
+
this.cachedChat = {
|
|
4144
|
+
...this.cachedChat || {},
|
|
4145
|
+
...data,
|
|
4146
|
+
controlValues: Object.keys(patchedState.controlValues).length > 0 ? patchedState.controlValues : void 0,
|
|
4147
|
+
summaryMetadata: patchedState.summaryMetadata
|
|
4148
|
+
};
|
|
3982
4149
|
const effects = normalizeProviderEffects(data);
|
|
3983
4150
|
for (const effect of effects) {
|
|
3984
4151
|
const effectWhen = effect.when || "immediate";
|
|
@@ -4751,6 +4918,8 @@ function isCdpConnected(cdpManagers, key) {
|
|
|
4751
4918
|
function buildIdeWorkspaceSession(state, cdpManagers, options) {
|
|
4752
4919
|
const profile = options.profile || "full";
|
|
4753
4920
|
const activeChat = normalizeActiveChatData(state.activeChat, getActiveChatOptions(profile));
|
|
4921
|
+
const summaryMetadata = normalizeProviderSummaryMetadata(state.summaryMetadata);
|
|
4922
|
+
const controlValues = normalizeProviderStateControlValues(state.controlValues);
|
|
4754
4923
|
const includeSessionMetadata = shouldIncludeSessionMetadata(profile);
|
|
4755
4924
|
const includeSessionControls = shouldIncludeSessionControls(profile);
|
|
4756
4925
|
const title = activeChat?.title || state.name;
|
|
@@ -4767,13 +4936,11 @@ function buildIdeWorkspaceSession(state, cdpManagers, options) {
|
|
|
4767
4936
|
title,
|
|
4768
4937
|
...includeSessionMetadata && { workspace: state.workspace || null },
|
|
4769
4938
|
activeChat,
|
|
4939
|
+
...summaryMetadata && { summaryMetadata },
|
|
4770
4940
|
...includeSessionMetadata && { capabilities: IDE_SESSION_CAPABILITIES },
|
|
4771
4941
|
cdpConnected: state.cdpConnected ?? isCdpConnected(cdpManagers, state.type),
|
|
4772
|
-
currentModel: state.currentModel,
|
|
4773
|
-
currentPlan: state.currentPlan,
|
|
4774
|
-
currentAutoApprove: state.currentAutoApprove,
|
|
4775
4942
|
...includeSessionControls && {
|
|
4776
|
-
controlValues
|
|
4943
|
+
...controlValues && { controlValues },
|
|
4777
4944
|
providerControls: state.providerControls
|
|
4778
4945
|
},
|
|
4779
4946
|
errorMessage: state.errorMessage,
|
|
@@ -4784,6 +4951,8 @@ function buildIdeWorkspaceSession(state, cdpManagers, options) {
|
|
|
4784
4951
|
function buildExtensionAgentSession(parent, ext, options) {
|
|
4785
4952
|
const profile = options.profile || "full";
|
|
4786
4953
|
const activeChat = normalizeActiveChatData(ext.activeChat, getActiveChatOptions(profile));
|
|
4954
|
+
const summaryMetadata = normalizeProviderSummaryMetadata(ext.summaryMetadata);
|
|
4955
|
+
const controlValues = normalizeProviderStateControlValues(ext.controlValues);
|
|
4787
4956
|
const includeSessionMetadata = shouldIncludeSessionMetadata(profile);
|
|
4788
4957
|
const includeSessionControls = shouldIncludeSessionControls(profile);
|
|
4789
4958
|
return {
|
|
@@ -4799,11 +4968,10 @@ function buildExtensionAgentSession(parent, ext, options) {
|
|
|
4799
4968
|
title: activeChat?.title || ext.name,
|
|
4800
4969
|
...includeSessionMetadata && { workspace: parent.workspace || null },
|
|
4801
4970
|
activeChat,
|
|
4971
|
+
...summaryMetadata && { summaryMetadata },
|
|
4802
4972
|
...includeSessionMetadata && { capabilities: EXTENSION_SESSION_CAPABILITIES },
|
|
4803
|
-
currentModel: ext.currentModel,
|
|
4804
|
-
currentPlan: ext.currentPlan,
|
|
4805
4973
|
...includeSessionControls && {
|
|
4806
|
-
controlValues
|
|
4974
|
+
...controlValues && { controlValues },
|
|
4807
4975
|
providerControls: ext.providerControls
|
|
4808
4976
|
},
|
|
4809
4977
|
errorMessage: ext.errorMessage,
|
|
@@ -4814,6 +4982,8 @@ function buildExtensionAgentSession(parent, ext, options) {
|
|
|
4814
4982
|
function buildCliSession(state, options) {
|
|
4815
4983
|
const profile = options.profile || "full";
|
|
4816
4984
|
const activeChat = normalizeActiveChatData(state.activeChat, getActiveChatOptions(profile));
|
|
4985
|
+
const summaryMetadata = normalizeProviderSummaryMetadata(state.summaryMetadata);
|
|
4986
|
+
const controlValues = normalizeProviderStateControlValues(state.controlValues);
|
|
4817
4987
|
const includeSessionMetadata = shouldIncludeSessionMetadata(profile);
|
|
4818
4988
|
const includeRuntimeMetadata = shouldIncludeRuntimeMetadata(profile);
|
|
4819
4989
|
const includeSessionControls = shouldIncludeSessionControls(profile);
|
|
@@ -4840,11 +5010,12 @@ function buildCliSession(state, options) {
|
|
|
4840
5010
|
mode: state.mode,
|
|
4841
5011
|
resume: state.resume,
|
|
4842
5012
|
activeChat,
|
|
5013
|
+
...summaryMetadata && { summaryMetadata },
|
|
4843
5014
|
...includeSessionMetadata && {
|
|
4844
5015
|
capabilities: state.mode === "terminal" ? PTY_SESSION_CAPABILITIES : CLI_CHAT_SESSION_CAPABILITIES
|
|
4845
5016
|
},
|
|
4846
5017
|
...includeSessionControls && {
|
|
4847
|
-
controlValues
|
|
5018
|
+
...controlValues && { controlValues },
|
|
4848
5019
|
providerControls: state.providerControls
|
|
4849
5020
|
},
|
|
4850
5021
|
errorMessage: state.errorMessage,
|
|
@@ -4855,6 +5026,8 @@ function buildCliSession(state, options) {
|
|
|
4855
5026
|
function buildAcpSession(state, options) {
|
|
4856
5027
|
const profile = options.profile || "full";
|
|
4857
5028
|
const activeChat = normalizeActiveChatData(state.activeChat, getActiveChatOptions(profile));
|
|
5029
|
+
const summaryMetadata = normalizeProviderSummaryMetadata(state.summaryMetadata);
|
|
5030
|
+
const controlValues = normalizeProviderStateControlValues(state.controlValues);
|
|
4858
5031
|
const includeSessionMetadata = shouldIncludeSessionMetadata(profile);
|
|
4859
5032
|
const includeSessionControls = shouldIncludeSessionControls(profile);
|
|
4860
5033
|
return {
|
|
@@ -4870,13 +5043,10 @@ function buildAcpSession(state, options) {
|
|
|
4870
5043
|
title: activeChat?.title || state.name,
|
|
4871
5044
|
...includeSessionMetadata && { workspace: state.workspace || null },
|
|
4872
5045
|
activeChat,
|
|
5046
|
+
...summaryMetadata && { summaryMetadata },
|
|
4873
5047
|
...includeSessionMetadata && { capabilities: ACP_SESSION_CAPABILITIES },
|
|
4874
|
-
currentModel: state.currentModel,
|
|
4875
|
-
currentPlan: state.currentPlan,
|
|
4876
5048
|
...includeSessionControls && {
|
|
4877
|
-
|
|
4878
|
-
acpModes: state.acpModes,
|
|
4879
|
-
controlValues: state.controlValues,
|
|
5049
|
+
...controlValues && { controlValues },
|
|
4880
5050
|
providerControls: state.providerControls
|
|
4881
5051
|
},
|
|
4882
5052
|
errorMessage: state.errorMessage,
|
|
@@ -4916,6 +5086,8 @@ var init_builders = __esm({
|
|
|
4916
5086
|
"../../oss/packages/daemon-core/src/status/builders.ts"() {
|
|
4917
5087
|
"use strict";
|
|
4918
5088
|
init_normalize();
|
|
5089
|
+
init_provider_patch_state();
|
|
5090
|
+
init_summary_metadata();
|
|
4919
5091
|
IDE_SESSION_CAPABILITIES = [
|
|
4920
5092
|
"read_chat",
|
|
4921
5093
|
"send_message",
|
|
@@ -7031,8 +7203,17 @@ async function handleSetProviderSourceConfig(h, args) {
|
|
|
7031
7203
|
);
|
|
7032
7204
|
return { success: true, reloaded: true, ...sourceConfig };
|
|
7033
7205
|
}
|
|
7034
|
-
function normalizeProviderScriptArgs(args) {
|
|
7206
|
+
function normalizeProviderScriptArgs(args, scriptName) {
|
|
7035
7207
|
const normalizedArgs = { ...args || {} };
|
|
7208
|
+
const normalizedScriptName = String(scriptName || "").toLowerCase();
|
|
7209
|
+
if (Object.prototype.hasOwnProperty.call(normalizedArgs, "value")) {
|
|
7210
|
+
if (normalizedArgs.model === void 0 && (normalizedScriptName === "setmodel" || normalizedScriptName === "setmodelgui" || normalizedScriptName === "webviewsetmodel")) {
|
|
7211
|
+
normalizedArgs.model = normalizedArgs.value;
|
|
7212
|
+
}
|
|
7213
|
+
if (normalizedArgs.mode === void 0 && (normalizedScriptName === "setmode" || normalizedScriptName === "webviewsetmode")) {
|
|
7214
|
+
normalizedArgs.mode = normalizedArgs.value;
|
|
7215
|
+
}
|
|
7216
|
+
}
|
|
7036
7217
|
for (const key of ["mode", "model", "message", "action", "button", "text", "sessionId", "value"]) {
|
|
7037
7218
|
if (key in normalizedArgs && !(key.toUpperCase() in normalizedArgs)) {
|
|
7038
7219
|
normalizedArgs[key.toUpperCase()] = normalizedArgs[key];
|
|
@@ -7078,7 +7259,7 @@ async function executeProviderScript(h, args, scriptName) {
|
|
|
7078
7259
|
if (!provider.scripts?.[actualScriptName]) {
|
|
7079
7260
|
return { success: false, error: `Script '${actualScriptName}' not available for ${resolvedProviderType}` };
|
|
7080
7261
|
}
|
|
7081
|
-
const normalizedArgs = normalizeProviderScriptArgs(args);
|
|
7262
|
+
const normalizedArgs = normalizeProviderScriptArgs(args, actualScriptName);
|
|
7082
7263
|
if (provider.category === "cli") {
|
|
7083
7264
|
const adapter = h.getCliAdapter(args?.targetSessionId || resolvedProviderType);
|
|
7084
7265
|
if (!adapter?.invokeScript) {
|
|
@@ -9564,6 +9745,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
9564
9745
|
static MAX_TRACE_ENTRIES = 250;
|
|
9565
9746
|
providerResolutionMeta;
|
|
9566
9747
|
static IDLE_FINISH_CONFIRM_MS = 2e3;
|
|
9748
|
+
static HERMES_IDLE_FINISH_CONFIRM_MS = 5e3;
|
|
9567
9749
|
static STATUS_ACTIVITY_HOLD_MS = 2e3;
|
|
9568
9750
|
static FINISH_RETRY_DELAY_MS = 300;
|
|
9569
9751
|
static MAX_FINISH_RETRIES = 2;
|
|
@@ -9571,6 +9753,12 @@ var init_provider_cli_adapter = __esm({
|
|
|
9571
9753
|
this.messages = [...this.committedMessages];
|
|
9572
9754
|
this.structuredMessages = [...this.committedMessages];
|
|
9573
9755
|
}
|
|
9756
|
+
getIdleFinishConfirmMs() {
|
|
9757
|
+
return this.cliType === "hermes-cli" ? _ProviderCliAdapter.HERMES_IDLE_FINISH_CONFIRM_MS : _ProviderCliAdapter.IDLE_FINISH_CONFIRM_MS;
|
|
9758
|
+
}
|
|
9759
|
+
getStatusActivityHoldMs() {
|
|
9760
|
+
return this.cliType === "hermes-cli" ? _ProviderCliAdapter.HERMES_IDLE_FINISH_CONFIRM_MS : _ProviderCliAdapter.STATUS_ACTIVITY_HOLD_MS;
|
|
9761
|
+
}
|
|
9574
9762
|
setStatus(status, trigger) {
|
|
9575
9763
|
const prev = this.currentStatus;
|
|
9576
9764
|
if (prev === status) return;
|
|
@@ -9593,6 +9781,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
9593
9781
|
}
|
|
9594
9782
|
armIdleFinishCandidate(assistantLength) {
|
|
9595
9783
|
const now = Date.now();
|
|
9784
|
+
const idleFinishConfirmMs = this.getIdleFinishConfirmMs();
|
|
9596
9785
|
this.idleFinishCandidate = {
|
|
9597
9786
|
armedAt: now,
|
|
9598
9787
|
lastOutputAt: this.lastOutputAt,
|
|
@@ -9601,7 +9790,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
9601
9790
|
assistantLength
|
|
9602
9791
|
};
|
|
9603
9792
|
this.recordTrace("idle_candidate_armed", {
|
|
9604
|
-
confirmMs:
|
|
9793
|
+
confirmMs: idleFinishConfirmMs,
|
|
9605
9794
|
candidate: this.idleFinishCandidate,
|
|
9606
9795
|
...buildCliTraceParseSnapshot({
|
|
9607
9796
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
@@ -9616,7 +9805,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
9616
9805
|
this.settleTimer = null;
|
|
9617
9806
|
this.settledBuffer = this.recentOutputBuffer;
|
|
9618
9807
|
this.evaluateSettled();
|
|
9619
|
-
},
|
|
9808
|
+
}, idleFinishConfirmMs);
|
|
9620
9809
|
}
|
|
9621
9810
|
recordTrace(type, payload = {}) {
|
|
9622
9811
|
const entry = {
|
|
@@ -9995,7 +10184,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
9995
10184
|
hasRecentInteractiveActivity(now) {
|
|
9996
10185
|
const quietForMs = this.lastNonEmptyOutputAt ? now - this.lastNonEmptyOutputAt : Number.MAX_SAFE_INTEGER;
|
|
9997
10186
|
const screenStableMs = this.lastScreenChangeAt ? now - this.lastScreenChangeAt : Number.MAX_SAFE_INTEGER;
|
|
9998
|
-
|
|
10187
|
+
const holdMs = this.getStatusActivityHoldMs();
|
|
10188
|
+
return quietForMs < holdMs || screenStableMs < holdMs;
|
|
9999
10189
|
}
|
|
10000
10190
|
getStartupConfirmationModal(screenText) {
|
|
10001
10191
|
const text = sanitizeTerminalText(String(screenText || ""));
|
|
@@ -10147,6 +10337,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
10147
10337
|
clearPendingScriptStatus();
|
|
10148
10338
|
}
|
|
10149
10339
|
const recentInteractiveActivity = this.hasRecentInteractiveActivity(now);
|
|
10340
|
+
const statusActivityHoldMs = this.getStatusActivityHoldMs();
|
|
10150
10341
|
const shouldHoldGenerating = scriptStatus === "idle" && this.isWaitingForResponse && !modal && recentInteractiveActivity;
|
|
10151
10342
|
if (shouldHoldGenerating) {
|
|
10152
10343
|
this.clearIdleFinishCandidate("hold_generating_recent_activity");
|
|
@@ -10162,7 +10353,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
10162
10353
|
recentInteractiveActivity,
|
|
10163
10354
|
lastNonEmptyOutputAt: this.lastNonEmptyOutputAt,
|
|
10164
10355
|
lastScreenChangeAt: this.lastScreenChangeAt,
|
|
10165
|
-
holdMs:
|
|
10356
|
+
holdMs: statusActivityHoldMs,
|
|
10166
10357
|
...buildCliTraceParseSnapshot({
|
|
10167
10358
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
10168
10359
|
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
@@ -10251,11 +10442,12 @@ var init_provider_cli_adapter = __esm({
|
|
|
10251
10442
|
const screenStableMs = this.lastScreenChangeAt ? now - this.lastScreenChangeAt : 0;
|
|
10252
10443
|
const hasAssistantTurn = !!lastParsedAssistant;
|
|
10253
10444
|
const assistantLength = lastParsedAssistant?.content?.length || 0;
|
|
10254
|
-
const
|
|
10255
|
-
const
|
|
10445
|
+
const idleFinishConfirmMs = this.getIdleFinishConfirmMs();
|
|
10446
|
+
const idleQuietThresholdMs = Math.max(idleFinishConfirmMs, this.timeouts.outputSettle);
|
|
10447
|
+
const idleStableThresholdMs = idleFinishConfirmMs;
|
|
10256
10448
|
const idleReady = visibleIdlePrompt && !modal && hasAssistantTurn && quietForMs >= idleQuietThresholdMs && screenStableMs >= idleStableThresholdMs;
|
|
10257
10449
|
const candidate = this.idleFinishCandidate;
|
|
10258
|
-
const candidateQuiet = !!candidate && candidate.responseEpoch === this.responseEpoch && candidate.lastOutputAt === this.lastOutputAt && candidate.lastScreenChangeAt === this.lastScreenChangeAt && assistantLength >= candidate.assistantLength && now - candidate.armedAt >=
|
|
10450
|
+
const candidateQuiet = !!candidate && candidate.responseEpoch === this.responseEpoch && candidate.lastOutputAt === this.lastOutputAt && candidate.lastScreenChangeAt === this.lastScreenChangeAt && assistantLength >= candidate.assistantLength && now - candidate.armedAt >= idleFinishConfirmMs;
|
|
10259
10451
|
const canFinishImmediately = idleReady && candidateQuiet;
|
|
10260
10452
|
this.recordTrace("idle_decision", {
|
|
10261
10453
|
visibleIdlePrompt,
|
|
@@ -10267,7 +10459,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
10267
10459
|
idleQuietThresholdMs,
|
|
10268
10460
|
idleStableThresholdMs,
|
|
10269
10461
|
idleReady,
|
|
10270
|
-
idleFinishConfirmMs
|
|
10462
|
+
idleFinishConfirmMs,
|
|
10271
10463
|
idleFinishCandidate: candidate,
|
|
10272
10464
|
candidateQuiet,
|
|
10273
10465
|
canFinishImmediately,
|
|
@@ -11213,6 +11405,7 @@ var init_cli_provider_instance = __esm({
|
|
|
11213
11405
|
init_control_effects();
|
|
11214
11406
|
init_approval_utils();
|
|
11215
11407
|
init_cli_script_results();
|
|
11408
|
+
init_provider_patch_state();
|
|
11216
11409
|
CachedDatabaseSync = null;
|
|
11217
11410
|
CliProviderInstance = class {
|
|
11218
11411
|
constructor(provider, workingDir, cliArgs = [], instanceId, transportFactory, options) {
|
|
@@ -11242,6 +11435,7 @@ var init_cli_provider_instance = __esm({
|
|
|
11242
11435
|
generatingDebouncePending = null;
|
|
11243
11436
|
lastApprovalEventAt = 0;
|
|
11244
11437
|
controlValues = {};
|
|
11438
|
+
summaryMetadata = void 0;
|
|
11245
11439
|
appliedEffectKeys = /* @__PURE__ */ new Set();
|
|
11246
11440
|
historyWriter;
|
|
11247
11441
|
runtimeMessages = [];
|
|
@@ -11384,13 +11578,7 @@ var init_cli_provider_instance = __esm({
|
|
|
11384
11578
|
if (historyMessageCount !== null) {
|
|
11385
11579
|
parsedMessages = historyMessageCount > 0 ? parsedMessages.slice(-historyMessageCount) : [];
|
|
11386
11580
|
}
|
|
11387
|
-
const controlValues = extractProviderControlValues(this.provider.controls, parsedStatus);
|
|
11388
|
-
if (controlValues) {
|
|
11389
|
-
this.controlValues = { ...this.controlValues, ...controlValues };
|
|
11390
|
-
}
|
|
11391
11581
|
const mergedMessages = this.mergeConversationMessages(parsedMessages);
|
|
11392
|
-
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;
|
|
11393
|
-
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;
|
|
11394
11582
|
const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
|
|
11395
11583
|
if (parsedMessages.length > 0) {
|
|
11396
11584
|
const shouldSkipReplayPersist = this.suppressIdleHistoryReplay && adapterStatus.status === "idle" && parsedStatus?.status === "idle";
|
|
@@ -11412,6 +11600,10 @@ var init_cli_provider_instance = __esm({
|
|
|
11412
11600
|
}
|
|
11413
11601
|
}
|
|
11414
11602
|
this.applyProviderResponse(parsedStatus, { phase: "immediate" });
|
|
11603
|
+
const surface = resolveProviderStateSurface({
|
|
11604
|
+
summaryMetadata: this.summaryMetadata,
|
|
11605
|
+
controlValues: this.controlValues
|
|
11606
|
+
});
|
|
11415
11607
|
return {
|
|
11416
11608
|
type: this.type,
|
|
11417
11609
|
name: this.provider.name,
|
|
@@ -11427,8 +11619,6 @@ var init_cli_provider_instance = __esm({
|
|
|
11427
11619
|
inputContent: ""
|
|
11428
11620
|
},
|
|
11429
11621
|
workspace: this.workingDir,
|
|
11430
|
-
currentModel,
|
|
11431
|
-
currentPlan,
|
|
11432
11622
|
instanceId: this.instanceId,
|
|
11433
11623
|
providerSessionId: this.providerSessionId,
|
|
11434
11624
|
lastUpdated: Date.now(),
|
|
@@ -11443,8 +11633,9 @@ var init_cli_provider_instance = __esm({
|
|
|
11443
11633
|
attachedClients: runtime.attachedClients || []
|
|
11444
11634
|
} : void 0,
|
|
11445
11635
|
resume: this.provider.resume,
|
|
11446
|
-
controlValues:
|
|
11447
|
-
providerControls: this.provider.controls
|
|
11636
|
+
controlValues: surface.controlValues,
|
|
11637
|
+
providerControls: this.provider.controls,
|
|
11638
|
+
summaryMetadata: surface.summaryMetadata
|
|
11448
11639
|
};
|
|
11449
11640
|
}
|
|
11450
11641
|
setPresentationMode(mode) {
|
|
@@ -11648,10 +11839,14 @@ var init_cli_provider_instance = __esm({
|
|
|
11648
11839
|
this.suppressIdleHistoryReplay = false;
|
|
11649
11840
|
this.adapter.clearHistory();
|
|
11650
11841
|
}
|
|
11651
|
-
const
|
|
11652
|
-
|
|
11653
|
-
|
|
11654
|
-
|
|
11842
|
+
const patchedState = mergeProviderPatchState({
|
|
11843
|
+
providerControls: this.provider.controls,
|
|
11844
|
+
data,
|
|
11845
|
+
currentControlValues: this.controlValues,
|
|
11846
|
+
currentSummaryMetadata: this.summaryMetadata
|
|
11847
|
+
});
|
|
11848
|
+
this.controlValues = patchedState.controlValues;
|
|
11849
|
+
this.summaryMetadata = patchedState.summaryMetadata;
|
|
11655
11850
|
const effects = normalizeProviderEffects(data);
|
|
11656
11851
|
for (const effect of effects) {
|
|
11657
11852
|
const effectWhen = effect.when || "immediate";
|
|
@@ -28298,6 +28493,7 @@ var init_acp_provider_instance = __esm({
|
|
|
28298
28493
|
init_acp();
|
|
28299
28494
|
init_contracts();
|
|
28300
28495
|
init_status_monitor();
|
|
28496
|
+
init_summary_metadata();
|
|
28301
28497
|
init_logger();
|
|
28302
28498
|
AcpProviderInstance = class {
|
|
28303
28499
|
constructor(provider, workingDir, cliArgs = []) {
|
|
@@ -28326,8 +28522,7 @@ var init_acp_provider_instance = __esm({
|
|
|
28326
28522
|
lastStatus = "starting";
|
|
28327
28523
|
generatingStartedAt = 0;
|
|
28328
28524
|
agentCapabilities = {};
|
|
28329
|
-
|
|
28330
|
-
currentMode;
|
|
28525
|
+
currentSelections = {};
|
|
28331
28526
|
activeToolCalls = [];
|
|
28332
28527
|
stopReason = null;
|
|
28333
28528
|
partialContent = "";
|
|
@@ -28407,8 +28602,6 @@ var init_acp_provider_instance = __esm({
|
|
|
28407
28602
|
inputContent: ""
|
|
28408
28603
|
},
|
|
28409
28604
|
workspace: this.workingDir,
|
|
28410
|
-
currentModel: this.currentModel,
|
|
28411
|
-
currentPlan: this.currentMode,
|
|
28412
28605
|
instanceId: this.instanceId,
|
|
28413
28606
|
lastUpdated: Date.now(),
|
|
28414
28607
|
settings: this.settings,
|
|
@@ -28419,11 +28612,9 @@ var init_acp_provider_instance = __esm({
|
|
|
28419
28612
|
// Error details for dashboard display
|
|
28420
28613
|
errorMessage: this.errorMessage || void 0,
|
|
28421
28614
|
errorReason: this.errorReason || void 0,
|
|
28422
|
-
controlValues:
|
|
28423
|
-
|
|
28424
|
-
|
|
28425
|
-
},
|
|
28426
|
-
providerControls: this.provider.controls
|
|
28615
|
+
controlValues: this.getSelectionControlValues(),
|
|
28616
|
+
providerControls: this.provider.controls,
|
|
28617
|
+
summaryMetadata: this.buildSelectionSummaryMetadata()
|
|
28427
28618
|
};
|
|
28428
28619
|
}
|
|
28429
28620
|
onEvent(event, data) {
|
|
@@ -28457,6 +28648,54 @@ var init_acp_provider_instance = __esm({
|
|
|
28457
28648
|
getInstanceId() {
|
|
28458
28649
|
return this.instanceId;
|
|
28459
28650
|
}
|
|
28651
|
+
resolveConfigOptionLabel(category, value) {
|
|
28652
|
+
if (!value) return void 0;
|
|
28653
|
+
const option = this.configOptions.find((entry) => entry.category === category);
|
|
28654
|
+
return option?.options.find((candidate) => candidate.value === value)?.name || value;
|
|
28655
|
+
}
|
|
28656
|
+
resolveModeLabel(modeId) {
|
|
28657
|
+
if (!modeId) return void 0;
|
|
28658
|
+
return this.availableModes.find((mode) => mode.id === modeId)?.name || modeId;
|
|
28659
|
+
}
|
|
28660
|
+
getCurrentSelection(category) {
|
|
28661
|
+
return this.currentSelections[category];
|
|
28662
|
+
}
|
|
28663
|
+
setCurrentSelection(category, value) {
|
|
28664
|
+
const normalized = typeof value === "string" ? value.trim() : "";
|
|
28665
|
+
if (normalized) {
|
|
28666
|
+
this.currentSelections[category] = normalized;
|
|
28667
|
+
return;
|
|
28668
|
+
}
|
|
28669
|
+
delete this.currentSelections[category];
|
|
28670
|
+
}
|
|
28671
|
+
getSelectionControlValues() {
|
|
28672
|
+
const model = this.getCurrentSelection("model");
|
|
28673
|
+
const mode = this.getCurrentSelection("mode");
|
|
28674
|
+
return {
|
|
28675
|
+
...model ? { model } : {},
|
|
28676
|
+
...mode ? { mode } : {}
|
|
28677
|
+
};
|
|
28678
|
+
}
|
|
28679
|
+
resolveSelectionLabel(category, value) {
|
|
28680
|
+
if (!value) return void 0;
|
|
28681
|
+
const configLabel = this.resolveConfigOptionLabel(category, value);
|
|
28682
|
+
if (configLabel && configLabel !== value) return configLabel;
|
|
28683
|
+
if (category === "mode") {
|
|
28684
|
+
const modeLabel = this.resolveModeLabel(value);
|
|
28685
|
+
if (modeLabel) return modeLabel;
|
|
28686
|
+
}
|
|
28687
|
+
return configLabel || value;
|
|
28688
|
+
}
|
|
28689
|
+
buildSelectionSummaryMetadata() {
|
|
28690
|
+
const model = this.getCurrentSelection("model");
|
|
28691
|
+
const mode = this.getCurrentSelection("mode");
|
|
28692
|
+
return buildLegacyModelModeSummaryMetadata({
|
|
28693
|
+
model,
|
|
28694
|
+
mode,
|
|
28695
|
+
modelLabel: this.resolveSelectionLabel("model", model),
|
|
28696
|
+
modeLabel: this.resolveSelectionLabel("mode", mode)
|
|
28697
|
+
});
|
|
28698
|
+
}
|
|
28460
28699
|
// ─── ACP Config Options & Modes ─────────────────────
|
|
28461
28700
|
parseConfigOptions(raw) {
|
|
28462
28701
|
if (!Array.isArray(raw)) return;
|
|
@@ -28488,12 +28727,14 @@ var init_acp_provider_instance = __esm({
|
|
|
28488
28727
|
}
|
|
28489
28728
|
}
|
|
28490
28729
|
this.configOptions.push({ category, configId, currentValue, options: flatOptions });
|
|
28491
|
-
if (category === "model"
|
|
28730
|
+
if (category === "model" || category === "mode") {
|
|
28731
|
+
this.setCurrentSelection(category, currentValue);
|
|
28732
|
+
}
|
|
28492
28733
|
}
|
|
28493
28734
|
}
|
|
28494
28735
|
parseModes(raw) {
|
|
28495
28736
|
if (!raw) return;
|
|
28496
|
-
|
|
28737
|
+
this.setCurrentSelection("mode", raw.currentModeId);
|
|
28497
28738
|
if (Array.isArray(raw.availableModes)) {
|
|
28498
28739
|
this.availableModes = raw.availableModes.map((m) => ({
|
|
28499
28740
|
id: m.id,
|
|
@@ -28512,8 +28753,7 @@ var init_acp_provider_instance = __esm({
|
|
|
28512
28753
|
if (this.useStaticConfig) {
|
|
28513
28754
|
opt.currentValue = value;
|
|
28514
28755
|
this.selectedConfig[opt.configId] = value;
|
|
28515
|
-
if (category === "model") this.
|
|
28516
|
-
if (category === "mode") this.currentMode = value;
|
|
28756
|
+
if (category === "model" || category === "mode") this.setCurrentSelection(category, value);
|
|
28517
28757
|
this.log.info(`[${this.type}] Static config ${category} set to: ${value} \u2014 restarting agent`);
|
|
28518
28758
|
await this.restartWithNewConfig();
|
|
28519
28759
|
return;
|
|
@@ -28531,7 +28771,7 @@ var init_acp_provider_instance = __esm({
|
|
|
28531
28771
|
value
|
|
28532
28772
|
});
|
|
28533
28773
|
opt.currentValue = value;
|
|
28534
|
-
if (category === "model") this.
|
|
28774
|
+
if (category === "model" || category === "mode") this.setCurrentSelection(category, value);
|
|
28535
28775
|
if (result?.configOptions) this.parseConfigOptions(result.configOptions);
|
|
28536
28776
|
this.log.info(`[${this.type}] Config ${category} set to: ${value} | response: ${JSON.stringify(result)?.slice(0, 300)}`);
|
|
28537
28777
|
} catch (e) {
|
|
@@ -28547,7 +28787,7 @@ var init_acp_provider_instance = __esm({
|
|
|
28547
28787
|
opt.currentValue = modeId;
|
|
28548
28788
|
this.selectedConfig[opt.configId] = modeId;
|
|
28549
28789
|
}
|
|
28550
|
-
this.
|
|
28790
|
+
this.setCurrentSelection("mode", modeId);
|
|
28551
28791
|
this.log.info(`[${this.type}] Static mode set to: ${modeId} \u2014 restarting agent`);
|
|
28552
28792
|
await this.restartWithNewConfig();
|
|
28553
28793
|
return;
|
|
@@ -28562,7 +28802,7 @@ var init_acp_provider_instance = __esm({
|
|
|
28562
28802
|
sessionId: this.sessionId,
|
|
28563
28803
|
modeId
|
|
28564
28804
|
});
|
|
28565
|
-
this.
|
|
28805
|
+
this.setCurrentSelection("mode", modeId);
|
|
28566
28806
|
this.log.info(`[${this.type}] Mode set to: ${modeId}`);
|
|
28567
28807
|
} catch (e) {
|
|
28568
28808
|
const message = e?.message || "Unknown ACP mode error";
|
|
@@ -28820,8 +29060,8 @@ var init_acp_provider_instance = __esm({
|
|
|
28820
29060
|
if (result?.modes) this.log.debug(`[${this.type}] modes: ${JSON.stringify(result.modes).slice(0, 300)}`);
|
|
28821
29061
|
this.parseConfigOptions(result?.configOptions);
|
|
28822
29062
|
this.parseModes(result?.modes);
|
|
28823
|
-
if (!this.
|
|
28824
|
-
this.
|
|
29063
|
+
if (!this.getCurrentSelection("model") && result?.models?.currentModelId) {
|
|
29064
|
+
this.setCurrentSelection("model", result.models.currentModelId);
|
|
28825
29065
|
}
|
|
28826
29066
|
if (this.configOptions.length === 0 && this.provider.staticConfigOptions?.length) {
|
|
28827
29067
|
this.useStaticConfig = true;
|
|
@@ -28835,13 +29075,16 @@ var init_acp_provider_instance = __esm({
|
|
|
28835
29075
|
});
|
|
28836
29076
|
if (defaultVal) {
|
|
28837
29077
|
this.selectedConfig[sc.configId] = defaultVal;
|
|
28838
|
-
if (sc.category === "model"
|
|
28839
|
-
|
|
29078
|
+
if (sc.category === "model" || sc.category === "mode") {
|
|
29079
|
+
this.setCurrentSelection(sc.category, defaultVal);
|
|
29080
|
+
}
|
|
28840
29081
|
}
|
|
28841
29082
|
}
|
|
28842
29083
|
this.log.info(`[${this.type}] Using static configOptions (${this.configOptions.length} options)`);
|
|
28843
29084
|
}
|
|
28844
|
-
|
|
29085
|
+
const currentModel = this.getCurrentSelection("model");
|
|
29086
|
+
const currentMode = this.getCurrentSelection("mode");
|
|
29087
|
+
this.log.info(`[${this.type}] Session created: ${this.sessionId}${currentModel ? ` (model: ${currentModel})` : ""}${currentMode ? ` (mode: ${currentMode})` : ""}`);
|
|
28845
29088
|
if (this.configOptions.length > 0) {
|
|
28846
29089
|
this.log.info(`[${this.type}] Config options: ${this.configOptions.map((c) => `${c.category}(${c.options.length})`).join(", ")}`);
|
|
28847
29090
|
}
|
|
@@ -29016,7 +29259,7 @@ var init_acp_provider_instance = __esm({
|
|
|
29016
29259
|
break;
|
|
29017
29260
|
}
|
|
29018
29261
|
case "current_mode_update": {
|
|
29019
|
-
this.
|
|
29262
|
+
this.setCurrentSelection("mode", update.currentModeId);
|
|
29020
29263
|
break;
|
|
29021
29264
|
}
|
|
29022
29265
|
case "config_option_update": {
|
|
@@ -29089,7 +29332,7 @@ var init_acp_provider_instance = __esm({
|
|
|
29089
29332
|
this.detectStatusTransition();
|
|
29090
29333
|
}
|
|
29091
29334
|
if (params.model) {
|
|
29092
|
-
this.
|
|
29335
|
+
this.setCurrentSelection("model", params.model);
|
|
29093
29336
|
}
|
|
29094
29337
|
}
|
|
29095
29338
|
/** Map SDK ToolCallStatus to internal status */
|
|
@@ -29371,6 +29614,7 @@ var init_cli_manager = __esm({
|
|
|
29371
29614
|
init_workspaces();
|
|
29372
29615
|
init_recent_activity();
|
|
29373
29616
|
init_saved_sessions();
|
|
29617
|
+
init_summary_metadata();
|
|
29374
29618
|
init_cli_provider_instance();
|
|
29375
29619
|
init_acp_provider_instance();
|
|
29376
29620
|
init_contracts();
|
|
@@ -29402,7 +29646,11 @@ var init_cli_manager = __esm({
|
|
|
29402
29646
|
}
|
|
29403
29647
|
persistRecentActivity(entry) {
|
|
29404
29648
|
try {
|
|
29405
|
-
|
|
29649
|
+
const summaryMetadata = normalizeProviderSummaryMetadata(entry.summaryMetadata);
|
|
29650
|
+
let nextState = appendRecentActivity(loadState(), {
|
|
29651
|
+
...entry,
|
|
29652
|
+
summaryMetadata
|
|
29653
|
+
});
|
|
29406
29654
|
if (entry.providerSessionId && (entry.kind === "cli" || entry.kind === "acp")) {
|
|
29407
29655
|
nextState = upsertSavedProviderSession(nextState, {
|
|
29408
29656
|
kind: entry.kind,
|
|
@@ -29410,7 +29658,7 @@ var init_cli_manager = __esm({
|
|
|
29410
29658
|
providerName: entry.providerName,
|
|
29411
29659
|
providerSessionId: entry.providerSessionId,
|
|
29412
29660
|
workspace: entry.workspace,
|
|
29413
|
-
|
|
29661
|
+
summaryMetadata,
|
|
29414
29662
|
title: entry.title
|
|
29415
29663
|
});
|
|
29416
29664
|
}
|
|
@@ -29600,7 +29848,7 @@ ${installInfo}`
|
|
|
29600
29848
|
providerType: normalizedType,
|
|
29601
29849
|
providerName: provider.displayName || provider.name || normalizedType,
|
|
29602
29850
|
workspace: resolvedDir,
|
|
29603
|
-
|
|
29851
|
+
summaryMetadata: buildLegacyModelModeSummaryMetadata({ model: initialModel }),
|
|
29604
29852
|
sessionId,
|
|
29605
29853
|
title: provider.displayName || provider.name || normalizedType
|
|
29606
29854
|
});
|
|
@@ -29702,7 +29950,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
29702
29950
|
providerName: provider?.displayName || provider?.name || normalizedType,
|
|
29703
29951
|
providerSessionId: sessionBinding.providerSessionId,
|
|
29704
29952
|
workspace: resolvedDir,
|
|
29705
|
-
|
|
29953
|
+
summaryMetadata: buildLegacyModelModeSummaryMetadata({ model: initialModel }),
|
|
29706
29954
|
sessionId: key,
|
|
29707
29955
|
title: provider?.displayName || provider?.name || normalizedType
|
|
29708
29956
|
});
|
|
@@ -33635,7 +33883,90 @@ var init_command_log = __esm({
|
|
|
33635
33883
|
}
|
|
33636
33884
|
});
|
|
33637
33885
|
|
|
33886
|
+
// ../../oss/packages/daemon-core/src/session-host/runtime-surface.ts
|
|
33887
|
+
function isSessionHostLiveRuntime(record2) {
|
|
33888
|
+
const lifecycle = String(record2?.lifecycle || "").trim();
|
|
33889
|
+
return LIVE_LIFECYCLES.has(lifecycle);
|
|
33890
|
+
}
|
|
33891
|
+
function getSessionHostRecoveryLabel(meta3) {
|
|
33892
|
+
const recoveryState = typeof meta3?.runtimeRecoveryState === "string" ? String(meta3.runtimeRecoveryState).trim() : "";
|
|
33893
|
+
if (!recoveryState) return null;
|
|
33894
|
+
if (recoveryState === "auto_resumed") return "restored after restart";
|
|
33895
|
+
if (recoveryState === "resume_failed") return "restore failed";
|
|
33896
|
+
if (recoveryState === "host_restart_interrupted") return "host restart interrupted";
|
|
33897
|
+
if (recoveryState === "orphan_snapshot") return "snapshot recovered";
|
|
33898
|
+
return recoveryState.replace(/_/g, " ");
|
|
33899
|
+
}
|
|
33900
|
+
function isSessionHostRecoverySnapshot(record2) {
|
|
33901
|
+
if (!record2) return false;
|
|
33902
|
+
if (isSessionHostLiveRuntime(record2)) return false;
|
|
33903
|
+
const lifecycle = String(record2.lifecycle || "").trim();
|
|
33904
|
+
if (lifecycle && lifecycle !== "stopped" && lifecycle !== "failed") {
|
|
33905
|
+
return false;
|
|
33906
|
+
}
|
|
33907
|
+
const meta3 = record2.meta || void 0;
|
|
33908
|
+
if (meta3?.restoredFromStorage === true) return true;
|
|
33909
|
+
return getSessionHostRecoveryLabel(meta3) !== null;
|
|
33910
|
+
}
|
|
33911
|
+
function getSessionHostSurfaceKind(record2) {
|
|
33912
|
+
if (isSessionHostLiveRuntime(record2)) return "live_runtime";
|
|
33913
|
+
if (isSessionHostRecoverySnapshot(record2)) return "recovery_snapshot";
|
|
33914
|
+
return "inactive_record";
|
|
33915
|
+
}
|
|
33916
|
+
function partitionSessionHostRecords(records) {
|
|
33917
|
+
const liveRuntimes = [];
|
|
33918
|
+
const recoverySnapshots = [];
|
|
33919
|
+
const inactiveRecords = [];
|
|
33920
|
+
for (const record2 of records) {
|
|
33921
|
+
const kind = getSessionHostSurfaceKind(record2);
|
|
33922
|
+
if (kind === "live_runtime") {
|
|
33923
|
+
liveRuntimes.push(record2);
|
|
33924
|
+
} else if (kind === "recovery_snapshot") {
|
|
33925
|
+
recoverySnapshots.push(record2);
|
|
33926
|
+
} else {
|
|
33927
|
+
inactiveRecords.push(record2);
|
|
33928
|
+
}
|
|
33929
|
+
}
|
|
33930
|
+
return {
|
|
33931
|
+
liveRuntimes,
|
|
33932
|
+
recoverySnapshots,
|
|
33933
|
+
inactiveRecords
|
|
33934
|
+
};
|
|
33935
|
+
}
|
|
33936
|
+
function partitionSessionHostDiagnosticsSessions(records) {
|
|
33937
|
+
return partitionSessionHostRecords(records || []);
|
|
33938
|
+
}
|
|
33939
|
+
var LIVE_LIFECYCLES;
|
|
33940
|
+
var init_runtime_surface = __esm({
|
|
33941
|
+
"../../oss/packages/daemon-core/src/session-host/runtime-surface.ts"() {
|
|
33942
|
+
"use strict";
|
|
33943
|
+
LIVE_LIFECYCLES = /* @__PURE__ */ new Set(["starting", "running", "stopping", "interrupted"]);
|
|
33944
|
+
}
|
|
33945
|
+
});
|
|
33946
|
+
|
|
33638
33947
|
// ../../oss/packages/daemon-core/src/status/snapshot.ts
|
|
33948
|
+
function buildRecentReadDebugSignature(snapshot) {
|
|
33949
|
+
return [
|
|
33950
|
+
snapshot.providerType,
|
|
33951
|
+
snapshot.status,
|
|
33952
|
+
snapshot.inboxBucket,
|
|
33953
|
+
snapshot.unread ? "1" : "0",
|
|
33954
|
+
String(snapshot.lastSeenAt),
|
|
33955
|
+
snapshot.completionMarker,
|
|
33956
|
+
snapshot.seenCompletionMarker,
|
|
33957
|
+
String(snapshot.lastUpdated),
|
|
33958
|
+
String(snapshot.lastUsedAt),
|
|
33959
|
+
snapshot.lastRole,
|
|
33960
|
+
String(snapshot.messageUpdatedAt)
|
|
33961
|
+
].join("|");
|
|
33962
|
+
}
|
|
33963
|
+
function shouldEmitRecentReadDebugLog(cache, snapshot) {
|
|
33964
|
+
const nextSignature = buildRecentReadDebugSignature(snapshot);
|
|
33965
|
+
const previousSignature = cache.get(snapshot.sessionId);
|
|
33966
|
+
if (previousSignature === nextSignature) return false;
|
|
33967
|
+
cache.set(snapshot.sessionId, nextSignature);
|
|
33968
|
+
return true;
|
|
33969
|
+
}
|
|
33639
33970
|
function buildDetectedIdeInfos(detectedIdes, cdpManagers) {
|
|
33640
33971
|
return detectedIdes.filter((ide) => ide.installed !== false).map((ide) => ({
|
|
33641
33972
|
id: ide.id,
|
|
@@ -33787,7 +34118,7 @@ function buildRecentLaunches(recentActivity) {
|
|
|
33787
34118
|
providerSessionId: item.providerSessionId,
|
|
33788
34119
|
title: item.title || item.providerName,
|
|
33789
34120
|
workspace: item.workspace,
|
|
33790
|
-
|
|
34121
|
+
summaryMetadata: item.summaryMetadata,
|
|
33791
34122
|
lastLaunchedAt: item.lastUsedAt
|
|
33792
34123
|
})).sort((a, b) => b.lastLaunchedAt - a.lastLaunchedAt).slice(0, 12);
|
|
33793
34124
|
}
|
|
@@ -33828,9 +34159,24 @@ function buildStatusSnapshot(options) {
|
|
|
33828
34159
|
session.unread = unread;
|
|
33829
34160
|
session.inboxBucket = inboxBucket;
|
|
33830
34161
|
if (READ_DEBUG_ENABLED && (session.unread || session.inboxBucket !== "idle" || session.providerType.includes("codex"))) {
|
|
34162
|
+
const recentReadSnapshot = {
|
|
34163
|
+
sessionId: session.id,
|
|
34164
|
+
providerType: session.providerType,
|
|
34165
|
+
status: String(session.status || ""),
|
|
34166
|
+
inboxBucket,
|
|
34167
|
+
unread,
|
|
34168
|
+
lastSeenAt,
|
|
34169
|
+
completionMarker: completionMarker || "-",
|
|
34170
|
+
seenCompletionMarker: seenCompletionMarker || "-",
|
|
34171
|
+
lastUpdated: Number(session.lastUpdated || 0),
|
|
34172
|
+
lastUsedAt,
|
|
34173
|
+
lastRole: getLastMessageRole(sourceSession),
|
|
34174
|
+
messageUpdatedAt: getSessionMessageUpdatedAt(sourceSession)
|
|
34175
|
+
};
|
|
34176
|
+
if (!shouldEmitRecentReadDebugLog(recentReadDebugSignatureBySession, recentReadSnapshot)) continue;
|
|
33831
34177
|
LOG.info(
|
|
33832
34178
|
"RecentRead",
|
|
33833
|
-
`snapshot session id=${
|
|
34179
|
+
`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}`
|
|
33834
34180
|
);
|
|
33835
34181
|
}
|
|
33836
34182
|
const lastDisplayMessage = getLastDisplayMessage(sourceSession);
|
|
@@ -33863,7 +34209,7 @@ function buildStatusSnapshot(options) {
|
|
|
33863
34209
|
}
|
|
33864
34210
|
};
|
|
33865
34211
|
}
|
|
33866
|
-
var os18, READ_DEBUG_ENABLED;
|
|
34212
|
+
var os18, READ_DEBUG_ENABLED, recentReadDebugSignatureBySession;
|
|
33867
34213
|
var init_snapshot = __esm({
|
|
33868
34214
|
"../../oss/packages/daemon-core/src/status/snapshot.ts"() {
|
|
33869
34215
|
"use strict";
|
|
@@ -33877,6 +34223,7 @@ var init_snapshot = __esm({
|
|
|
33877
34223
|
init_logger();
|
|
33878
34224
|
init_builders();
|
|
33879
34225
|
READ_DEBUG_ENABLED = process.argv.includes("--dev") || process.env.ADHDEV_READ_DEBUG === "1";
|
|
34226
|
+
recentReadDebugSignatureBySession = /* @__PURE__ */ new Map();
|
|
33880
34227
|
}
|
|
33881
34228
|
});
|
|
33882
34229
|
|
|
@@ -34118,6 +34465,49 @@ function toHostedCliRuntimeDescriptor(record2) {
|
|
|
34118
34465
|
providerSessionId: typeof record2.meta?.providerSessionId === "string" ? String(record2.meta.providerSessionId) : void 0
|
|
34119
34466
|
};
|
|
34120
34467
|
}
|
|
34468
|
+
function getWriteConflictOwnerClientId(error48) {
|
|
34469
|
+
const message = typeof error48 === "string" ? error48 : error48 instanceof Error ? error48.message : "";
|
|
34470
|
+
const match = /^Write owned by\s+(.+)$/.exec(message.trim());
|
|
34471
|
+
return match?.[1]?.trim() || void 0;
|
|
34472
|
+
}
|
|
34473
|
+
function summarizeSessionHostRecord(result) {
|
|
34474
|
+
if (!result || typeof result !== "object") return {};
|
|
34475
|
+
const record2 = result;
|
|
34476
|
+
return {
|
|
34477
|
+
runtimeKey: typeof record2.runtimeKey === "string" ? record2.runtimeKey : void 0,
|
|
34478
|
+
lifecycle: typeof record2.lifecycle === "string" ? record2.lifecycle : void 0,
|
|
34479
|
+
surfaceKind: getSessionHostSurfaceKind(record2),
|
|
34480
|
+
attachedClientCount: Array.isArray(record2.attachedClients) ? record2.attachedClients.length : void 0,
|
|
34481
|
+
hasWriteOwner: !!record2.writeOwner,
|
|
34482
|
+
writeOwnerClientId: typeof record2.writeOwner?.clientId === "string" ? record2.writeOwner.clientId : void 0
|
|
34483
|
+
};
|
|
34484
|
+
}
|
|
34485
|
+
function summarizeSessionHostRecords(result) {
|
|
34486
|
+
const records = Array.isArray(result) ? result : [];
|
|
34487
|
+
const groups = partitionSessionHostRecords(records);
|
|
34488
|
+
return {
|
|
34489
|
+
sessionCount: records.length,
|
|
34490
|
+
liveRuntimeCount: groups.liveRuntimes.length,
|
|
34491
|
+
recoverySnapshotCount: groups.recoverySnapshots.length,
|
|
34492
|
+
inactiveRecordCount: groups.inactiveRecords.length
|
|
34493
|
+
};
|
|
34494
|
+
}
|
|
34495
|
+
function summarizeSessionHostDiagnostics(result) {
|
|
34496
|
+
const diagnostics = result && typeof result === "object" ? result : {};
|
|
34497
|
+
const sessions = Array.isArray(diagnostics.sessions) ? diagnostics.sessions : [];
|
|
34498
|
+
return {
|
|
34499
|
+
runtimeCount: typeof diagnostics.runtimeCount === "number" ? diagnostics.runtimeCount : void 0,
|
|
34500
|
+
...summarizeSessionHostRecords(sessions)
|
|
34501
|
+
};
|
|
34502
|
+
}
|
|
34503
|
+
function summarizeSessionHostPruneResult(result) {
|
|
34504
|
+
const value = result && typeof result === "object" ? result : {};
|
|
34505
|
+
return {
|
|
34506
|
+
duplicateGroupCount: typeof value.duplicateGroupCount === "number" ? value.duplicateGroupCount : void 0,
|
|
34507
|
+
prunedCount: Array.isArray(value.prunedSessionIds) ? value.prunedSessionIds.length : void 0,
|
|
34508
|
+
keptCount: Array.isArray(value.keptSessionIds) ? value.keptSessionIds.length : void 0
|
|
34509
|
+
};
|
|
34510
|
+
}
|
|
34121
34511
|
var fs9, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter;
|
|
34122
34512
|
var init_router = __esm({
|
|
34123
34513
|
"../../oss/packages/daemon-core/src/commands/router.ts"() {
|
|
@@ -34137,6 +34527,7 @@ var init_router = __esm({
|
|
|
34137
34527
|
init_command_log();
|
|
34138
34528
|
init_logger();
|
|
34139
34529
|
init_debug_trace();
|
|
34530
|
+
init_runtime_surface();
|
|
34140
34531
|
init_builders();
|
|
34141
34532
|
init_snapshot();
|
|
34142
34533
|
init_snapshot();
|
|
@@ -34155,6 +34546,56 @@ var init_router = __esm({
|
|
|
34155
34546
|
constructor(deps) {
|
|
34156
34547
|
this.deps = deps;
|
|
34157
34548
|
}
|
|
34549
|
+
async traceSessionHostAction(action, args, run, summarizeResult) {
|
|
34550
|
+
const interactionId = typeof args?._interactionId === "string" ? args._interactionId : void 0;
|
|
34551
|
+
const sessionId = typeof args?.sessionId === "string" ? args.sessionId : void 0;
|
|
34552
|
+
const requestedPayload = { action };
|
|
34553
|
+
if (sessionId) requestedPayload.sessionId = sessionId;
|
|
34554
|
+
if (typeof args?.clientId === "string") requestedPayload.clientId = args.clientId;
|
|
34555
|
+
if (typeof args?.signal === "string") requestedPayload.signal = args.signal;
|
|
34556
|
+
if (typeof args?.providerType === "string") requestedPayload.providerType = args.providerType;
|
|
34557
|
+
if (typeof args?.workspace === "string") requestedPayload.workspace = args.workspace;
|
|
34558
|
+
if (typeof args?.dryRun === "boolean") requestedPayload.dryRun = args.dryRun;
|
|
34559
|
+
recordDebugTrace({
|
|
34560
|
+
interactionId,
|
|
34561
|
+
category: "session_host",
|
|
34562
|
+
stage: "action_requested",
|
|
34563
|
+
level: "info",
|
|
34564
|
+
sessionId,
|
|
34565
|
+
payload: requestedPayload
|
|
34566
|
+
});
|
|
34567
|
+
try {
|
|
34568
|
+
const result = await run();
|
|
34569
|
+
recordDebugTrace({
|
|
34570
|
+
interactionId,
|
|
34571
|
+
category: "session_host",
|
|
34572
|
+
stage: "action_result",
|
|
34573
|
+
level: "info",
|
|
34574
|
+
sessionId,
|
|
34575
|
+
payload: {
|
|
34576
|
+
...requestedPayload,
|
|
34577
|
+
success: true,
|
|
34578
|
+
...summarizeResult ? summarizeResult(result) : {}
|
|
34579
|
+
}
|
|
34580
|
+
});
|
|
34581
|
+
return result;
|
|
34582
|
+
} catch (error48) {
|
|
34583
|
+
recordDebugTrace({
|
|
34584
|
+
interactionId,
|
|
34585
|
+
category: "session_host",
|
|
34586
|
+
stage: "action_failed",
|
|
34587
|
+
level: "error",
|
|
34588
|
+
sessionId,
|
|
34589
|
+
payload: {
|
|
34590
|
+
...requestedPayload,
|
|
34591
|
+
error: error48?.message || String(error48),
|
|
34592
|
+
failureKind: getWriteConflictOwnerClientId(error48) ? "write_conflict" : "request_failed",
|
|
34593
|
+
conflictOwnerClientId: getWriteConflictOwnerClientId(error48)
|
|
34594
|
+
}
|
|
34595
|
+
});
|
|
34596
|
+
throw error48;
|
|
34597
|
+
}
|
|
34598
|
+
}
|
|
34158
34599
|
/**
|
|
34159
34600
|
* Unified command routing.
|
|
34160
34601
|
* Returns result for all commands:
|
|
@@ -34264,44 +34705,60 @@ var init_router = __esm({
|
|
|
34264
34705
|
}
|
|
34265
34706
|
case "session_host_get_diagnostics": {
|
|
34266
34707
|
if (!this.deps.sessionHostControl) return { success: false, error: "Session host control unavailable" };
|
|
34267
|
-
const diagnostics = await this.deps.sessionHostControl.getDiagnostics({
|
|
34708
|
+
const diagnostics = await this.traceSessionHostAction("session_host_get_diagnostics", args, () => this.deps.sessionHostControl.getDiagnostics({
|
|
34268
34709
|
includeSessions: args?.includeSessions !== false,
|
|
34269
34710
|
limit: Number(args?.limit) || void 0
|
|
34270
|
-
})
|
|
34711
|
+
}), (result) => ({
|
|
34712
|
+
includeSessions: args?.includeSessions !== false,
|
|
34713
|
+
limit: Number(args?.limit) || void 0,
|
|
34714
|
+
...summarizeSessionHostDiagnostics(result)
|
|
34715
|
+
}));
|
|
34271
34716
|
return { success: true, diagnostics };
|
|
34272
34717
|
}
|
|
34273
34718
|
case "session_host_list_sessions": {
|
|
34274
34719
|
if (!this.deps.sessionHostControl) return { success: false, error: "Session host control unavailable" };
|
|
34275
|
-
const sessions = await this.deps.sessionHostControl.listSessions();
|
|
34720
|
+
const sessions = await this.traceSessionHostAction("session_host_list_sessions", args, () => this.deps.sessionHostControl.listSessions(), (records) => summarizeSessionHostRecords(records));
|
|
34276
34721
|
return { success: true, sessions };
|
|
34277
34722
|
}
|
|
34278
34723
|
case "session_host_stop_session": {
|
|
34279
34724
|
if (!this.deps.sessionHostControl) return { success: false, error: "Session host control unavailable" };
|
|
34280
34725
|
const sessionId = typeof args?.sessionId === "string" ? args.sessionId : "";
|
|
34281
34726
|
if (!sessionId) return { success: false, error: "sessionId required" };
|
|
34282
|
-
const record2 = await this.deps.sessionHostControl.stopSession(sessionId);
|
|
34727
|
+
const record2 = await this.traceSessionHostAction("session_host_stop_session", args, () => this.deps.sessionHostControl.stopSession(sessionId), (result) => summarizeSessionHostRecord(result));
|
|
34283
34728
|
return { success: true, record: record2 };
|
|
34284
34729
|
}
|
|
34285
34730
|
case "session_host_resume_session": {
|
|
34286
34731
|
if (!this.deps.sessionHostControl) return { success: false, error: "Session host control unavailable" };
|
|
34287
34732
|
const sessionId = typeof args?.sessionId === "string" ? args.sessionId : "";
|
|
34288
34733
|
if (!sessionId) return { success: false, error: "sessionId required" };
|
|
34289
|
-
const record2 = await this.
|
|
34290
|
-
|
|
34291
|
-
|
|
34292
|
-
|
|
34293
|
-
|
|
34734
|
+
const record2 = await this.traceSessionHostAction("session_host_resume_session", args, async () => {
|
|
34735
|
+
const nextRecord = await this.deps.sessionHostControl.resumeSession(sessionId);
|
|
34736
|
+
const hosted = toHostedCliRuntimeDescriptor(nextRecord);
|
|
34737
|
+
if (hosted) {
|
|
34738
|
+
await this.deps.cliManager.restoreHostedSessions([hosted]);
|
|
34739
|
+
}
|
|
34740
|
+
return nextRecord;
|
|
34741
|
+
}, (result) => ({
|
|
34742
|
+
...summarizeSessionHostRecord(result),
|
|
34743
|
+
restoredHostedSession: !!toHostedCliRuntimeDescriptor(result)
|
|
34744
|
+
}));
|
|
34294
34745
|
return { success: true, record: record2 };
|
|
34295
34746
|
}
|
|
34296
34747
|
case "session_host_restart_session": {
|
|
34297
34748
|
if (!this.deps.sessionHostControl) return { success: false, error: "Session host control unavailable" };
|
|
34298
34749
|
const sessionId = typeof args?.sessionId === "string" ? args.sessionId : "";
|
|
34299
34750
|
if (!sessionId) return { success: false, error: "sessionId required" };
|
|
34300
|
-
const record2 = await this.
|
|
34301
|
-
|
|
34302
|
-
|
|
34303
|
-
|
|
34304
|
-
|
|
34751
|
+
const record2 = await this.traceSessionHostAction("session_host_restart_session", args, async () => {
|
|
34752
|
+
const nextRecord = await this.deps.sessionHostControl.restartSession(sessionId);
|
|
34753
|
+
const hosted = toHostedCliRuntimeDescriptor(nextRecord);
|
|
34754
|
+
if (hosted) {
|
|
34755
|
+
await this.deps.cliManager.restoreHostedSessions([hosted]);
|
|
34756
|
+
}
|
|
34757
|
+
return nextRecord;
|
|
34758
|
+
}, (result) => ({
|
|
34759
|
+
...summarizeSessionHostRecord(result),
|
|
34760
|
+
restoredHostedSession: !!toHostedCliRuntimeDescriptor(result)
|
|
34761
|
+
}));
|
|
34305
34762
|
return { success: true, record: record2 };
|
|
34306
34763
|
}
|
|
34307
34764
|
case "session_host_send_signal": {
|
|
@@ -34310,7 +34767,7 @@ var init_router = __esm({
|
|
|
34310
34767
|
const signal = typeof args?.signal === "string" ? args.signal : "";
|
|
34311
34768
|
if (!sessionId) return { success: false, error: "sessionId required" };
|
|
34312
34769
|
if (!signal) return { success: false, error: "signal required" };
|
|
34313
|
-
const record2 = await this.deps.sessionHostControl.sendSignal(sessionId, signal);
|
|
34770
|
+
const record2 = await this.traceSessionHostAction("session_host_send_signal", args, () => this.deps.sessionHostControl.sendSignal(sessionId, signal), (result) => summarizeSessionHostRecord(result));
|
|
34314
34771
|
return { success: true, record: record2 };
|
|
34315
34772
|
}
|
|
34316
34773
|
case "session_host_force_detach_client": {
|
|
@@ -34319,16 +34776,16 @@ var init_router = __esm({
|
|
|
34319
34776
|
const clientId = typeof args?.clientId === "string" ? args.clientId : "";
|
|
34320
34777
|
if (!sessionId) return { success: false, error: "sessionId required" };
|
|
34321
34778
|
if (!clientId) return { success: false, error: "clientId required" };
|
|
34322
|
-
const record2 = await this.deps.sessionHostControl.forceDetachClient(sessionId, clientId);
|
|
34779
|
+
const record2 = await this.traceSessionHostAction("session_host_force_detach_client", args, () => this.deps.sessionHostControl.forceDetachClient(sessionId, clientId), (result) => summarizeSessionHostRecord(result));
|
|
34323
34780
|
return { success: true, record: record2 };
|
|
34324
34781
|
}
|
|
34325
34782
|
case "session_host_prune_duplicate_sessions": {
|
|
34326
34783
|
if (!this.deps.sessionHostControl) return { success: false, error: "Session host control unavailable" };
|
|
34327
|
-
const result = await this.deps.sessionHostControl.pruneDuplicateSessions({
|
|
34784
|
+
const result = await this.traceSessionHostAction("session_host_prune_duplicate_sessions", args, () => this.deps.sessionHostControl.pruneDuplicateSessions({
|
|
34328
34785
|
providerType: typeof args?.providerType === "string" ? args.providerType : void 0,
|
|
34329
34786
|
workspace: typeof args?.workspace === "string" ? args.workspace : void 0,
|
|
34330
34787
|
dryRun: args?.dryRun === true
|
|
34331
|
-
});
|
|
34788
|
+
}), (value) => summarizeSessionHostPruneResult(value));
|
|
34332
34789
|
return { success: true, result };
|
|
34333
34790
|
}
|
|
34334
34791
|
case "session_host_acquire_write": {
|
|
@@ -34338,12 +34795,15 @@ var init_router = __esm({
|
|
|
34338
34795
|
const ownerType = args?.ownerType === "agent" ? "agent" : "user";
|
|
34339
34796
|
if (!sessionId) return { success: false, error: "sessionId required" };
|
|
34340
34797
|
if (!clientId) return { success: false, error: "clientId required" };
|
|
34341
|
-
const record2 = await this.deps.sessionHostControl.acquireWrite({
|
|
34798
|
+
const record2 = await this.traceSessionHostAction("session_host_acquire_write", args, () => this.deps.sessionHostControl.acquireWrite({
|
|
34342
34799
|
sessionId,
|
|
34343
34800
|
clientId,
|
|
34344
34801
|
ownerType,
|
|
34345
34802
|
force: args?.force !== false
|
|
34346
|
-
})
|
|
34803
|
+
}), (result) => ({
|
|
34804
|
+
...summarizeSessionHostRecord(result),
|
|
34805
|
+
ownerType
|
|
34806
|
+
}));
|
|
34347
34807
|
return { success: true, record: record2 };
|
|
34348
34808
|
}
|
|
34349
34809
|
case "session_host_release_write": {
|
|
@@ -34352,7 +34812,10 @@ var init_router = __esm({
|
|
|
34352
34812
|
const clientId = typeof args?.clientId === "string" ? args.clientId : "";
|
|
34353
34813
|
if (!sessionId) return { success: false, error: "sessionId required" };
|
|
34354
34814
|
if (!clientId) return { success: false, error: "clientId required" };
|
|
34355
|
-
const record2 = await this.deps.sessionHostControl.releaseWrite({
|
|
34815
|
+
const record2 = await this.traceSessionHostAction("session_host_release_write", args, () => this.deps.sessionHostControl.releaseWrite({
|
|
34816
|
+
sessionId,
|
|
34817
|
+
clientId
|
|
34818
|
+
}), (result) => summarizeSessionHostRecord(result));
|
|
34356
34819
|
return { success: true, record: record2 };
|
|
34357
34820
|
}
|
|
34358
34821
|
case "list_saved_sessions": {
|
|
@@ -34385,7 +34848,7 @@ var init_router = __esm({
|
|
|
34385
34848
|
kind: saved?.kind || recent?.kind || kind,
|
|
34386
34849
|
title: saved?.title || recent?.title || session.sessionTitle || session.preview || providerType,
|
|
34387
34850
|
workspace: saved?.workspace || recent?.workspace || session.workspace,
|
|
34388
|
-
|
|
34851
|
+
summaryMetadata: saved?.summaryMetadata || recent?.summaryMetadata,
|
|
34389
34852
|
preview: session.preview,
|
|
34390
34853
|
messageCount: session.messageCount,
|
|
34391
34854
|
firstMessageAt: session.firstMessageAt,
|
|
@@ -34832,7 +35295,7 @@ var init_reporter = __esm({
|
|
|
34832
35295
|
const ideSummary = ideStates.map((s) => {
|
|
34833
35296
|
const msgs = s.activeChat?.messages?.length || 0;
|
|
34834
35297
|
const exts = s.extensions.length;
|
|
34835
|
-
return `${s.type}(${s.status},${msgs}msg,${exts}ext
|
|
35298
|
+
return `${s.type}(${s.status},${msgs}msg,${exts}ext)`;
|
|
34836
35299
|
}).join(", ");
|
|
34837
35300
|
const cliSummary = cliStates.map((s) => `${s.type}(${s.status})`).join(", ");
|
|
34838
35301
|
const acpSummary = acpStates.map((s) => `${s.type}(${s.status})`).join(", ");
|
|
@@ -34894,9 +35357,7 @@ var init_reporter = __esm({
|
|
|
34894
35357
|
workspace: session.workspace ?? null,
|
|
34895
35358
|
title: session.title,
|
|
34896
35359
|
cdpConnected: session.cdpConnected,
|
|
34897
|
-
|
|
34898
|
-
currentPlan: session.currentPlan,
|
|
34899
|
-
currentAutoApprove: session.currentAutoApprove
|
|
35360
|
+
summaryMetadata: session.summaryMetadata
|
|
34900
35361
|
})),
|
|
34901
35362
|
p2p: payload.p2p,
|
|
34902
35363
|
timestamp: now
|
|
@@ -34961,6 +35422,7 @@ var init_provider_adapter = __esm({
|
|
|
34961
35422
|
"../../oss/packages/daemon-core/src/agent-stream/provider-adapter.ts"() {
|
|
34962
35423
|
"use strict";
|
|
34963
35424
|
init_control_effects();
|
|
35425
|
+
init_provider_patch_state();
|
|
34964
35426
|
ProviderStreamAdapter = class {
|
|
34965
35427
|
agentType;
|
|
34966
35428
|
agentName;
|
|
@@ -35072,15 +35534,18 @@ var init_provider_adapter = __esm({
|
|
|
35072
35534
|
status: data.status || "idle",
|
|
35073
35535
|
messages: data.messages || [],
|
|
35074
35536
|
inputContent: data.inputContent || "",
|
|
35075
|
-
model: data.model,
|
|
35076
|
-
mode: data.mode,
|
|
35077
35537
|
activeModal: data.activeModal
|
|
35078
35538
|
};
|
|
35079
35539
|
if (typeof data.title === "string" && data.title.trim()) {
|
|
35080
35540
|
state.title = data.title.trim();
|
|
35081
35541
|
}
|
|
35082
35542
|
const controlValues = extractProviderControlValues(this.provider.controls, data);
|
|
35083
|
-
|
|
35543
|
+
const surface = resolveProviderStateSurface({
|
|
35544
|
+
controlValues,
|
|
35545
|
+
summaryMetadata: data.summaryMetadata
|
|
35546
|
+
});
|
|
35547
|
+
if (surface.controlValues) state.controlValues = surface.controlValues;
|
|
35548
|
+
if (surface.summaryMetadata) state.summaryMetadata = surface.summaryMetadata;
|
|
35084
35549
|
const effects = normalizeProviderEffects(data);
|
|
35085
35550
|
if (effects.length > 0) state.effects = effects;
|
|
35086
35551
|
if (state.messages.length > 0) {
|
|
@@ -35361,7 +35826,8 @@ var init_manager2 = __esm({
|
|
|
35361
35826
|
const evaluate = (expr, timeout) => cdp.evaluateInSessionFrame(agent.cdpSessionId, expr, timeout);
|
|
35362
35827
|
const state = await agent.adapter.readChat(evaluate);
|
|
35363
35828
|
const stateError = this.getStateError(state);
|
|
35364
|
-
|
|
35829
|
+
const selectedModelValue = typeof state.controlValues?.model === "string" ? state.controlValues.model : "";
|
|
35830
|
+
LOG.debug("AgentStream", `[AgentStream] readChat(${type}) result: status=${state.status} msgs=${state.messages?.length || 0} model=${selectedModelValue}${state.status === "error" ? " error=" + JSON.stringify(stateError) : ""}`);
|
|
35365
35831
|
if (state.status === "error" && this.isRecoverableSessionError(stateError)) {
|
|
35366
35832
|
throw new Error(stateError);
|
|
35367
35833
|
}
|
|
@@ -35738,9 +36204,8 @@ function forwardAgentStreamsToIdeInstance(instanceManager, ideType, streams) {
|
|
|
35738
36204
|
messages: stream.messages || [],
|
|
35739
36205
|
status: stream.status || "idle",
|
|
35740
36206
|
activeModal: stream.activeModal || null,
|
|
35741
|
-
model: stream.model || void 0,
|
|
35742
|
-
mode: stream.mode || void 0,
|
|
35743
36207
|
controlValues: stream.controlValues || void 0,
|
|
36208
|
+
summaryMetadata: stream.summaryMetadata || void 0,
|
|
35744
36209
|
effects: stream.effects || void 0,
|
|
35745
36210
|
sessionId: stream.sessionId || stream.instanceId || void 0,
|
|
35746
36211
|
title: stream.title || stream.agentName || void 0,
|
|
@@ -36287,7 +36752,11 @@ module.exports.setMode = (params) => {
|
|
|
36287
36752
|
* 5. Approval dialog detection (buttons, modal)
|
|
36288
36753
|
* 6. Input field selector
|
|
36289
36754
|
*
|
|
36290
|
-
*
|
|
36755
|
+
* Preferred live-state surface:
|
|
36756
|
+
* - controlValues: explicit current control selections (model/mode/etc.)
|
|
36757
|
+
* - summaryMetadata: compact always-visible metadata for dashboard/recent views
|
|
36758
|
+
* Legacy top-level model/mode output is no longer the preferred shape.
|
|
36759
|
+
* \u2192 { id, status, title, messages[], inputContent, activeModal, controlValues?, summaryMetadata? }
|
|
36291
36760
|
*/
|
|
36292
36761
|
(() => {
|
|
36293
36762
|
try {
|
|
@@ -36315,6 +36784,9 @@ module.exports.setMode = (params) => {
|
|
|
36315
36784
|
messages,
|
|
36316
36785
|
inputContent,
|
|
36317
36786
|
activeModal,
|
|
36787
|
+
// TODO: Return explicit selections when available, e.g.
|
|
36788
|
+
// controlValues: { model: selectedModel, mode: selectedMode },
|
|
36789
|
+
// summaryMetadata: { items: [{ id: 'model', value: selectedModelLabel || selectedModel, shortValue: selectedModel, order: 10 }] },
|
|
36318
36790
|
});
|
|
36319
36791
|
} catch(e) {
|
|
36320
36792
|
return JSON.stringify({ id: '', status: 'error', messages: [], error: e.message });
|
|
@@ -38061,7 +38533,6 @@ async function handleCliStatus(ctx, _req, res) {
|
|
|
38061
38533
|
lastMessage: s.activeChat?.messages?.slice(-1)[0] || null,
|
|
38062
38534
|
activeModal: s.activeChat?.activeModal || null,
|
|
38063
38535
|
pendingEvents: s.pendingEvents || [],
|
|
38064
|
-
currentModel: s.currentModel,
|
|
38065
38536
|
settings: s.settings
|
|
38066
38537
|
}));
|
|
38067
38538
|
ctx.json(res, 200, { instances: result, count: result.length });
|
|
@@ -39223,7 +39694,7 @@ function buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domCon
|
|
|
39223
39694
|
lines.push("## Required Return Format");
|
|
39224
39695
|
lines.push("| Function | Return JSON |");
|
|
39225
39696
|
lines.push("|---|---|");
|
|
39226
|
-
lines.push("| readChat | `{ id, status, title, messages: [{role, content, index, kind?, meta?}], inputContent, activeModal }` \u2014 optional `kind`: standard, thought, tool, terminal;
|
|
39697
|
+
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 |");
|
|
39227
39698
|
lines.push("| sendMessage | `{ sent: false, needsTypeAndSend: true, selector }` |");
|
|
39228
39699
|
lines.push("| resolveAction | `{ resolved: true/false, clicked? }` |");
|
|
39229
39700
|
lines.push("| listSessions | `{ sessions: [{ id, title, active, index }] }` |");
|
|
@@ -40886,7 +41357,7 @@ var init_dev_server = __esm({
|
|
|
40886
41357
|
lines.push("## Required Return Format");
|
|
40887
41358
|
lines.push("| Function | Return JSON |");
|
|
40888
41359
|
lines.push("|---|---|");
|
|
40889
|
-
lines.push("| readChat | `{ id, status, title, messages: [{role, content, index, kind?, meta?}], inputContent, activeModal }` \u2014 optional `kind`: standard, thought, tool, terminal;
|
|
41360
|
+
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 |");
|
|
40890
41361
|
lines.push("| sendMessage | `{ sent: false, needsTypeAndSend: true, selector }` |");
|
|
40891
41362
|
lines.push("| resolveAction | `{ resolved: true/false, clicked? }` |");
|
|
40892
41363
|
lines.push("| listSessions | `{ sessions: [{ id, title, active, index }] }` |");
|
|
@@ -41808,67 +42279,6 @@ var init_runtime_support = __esm({
|
|
|
41808
42279
|
}
|
|
41809
42280
|
});
|
|
41810
42281
|
|
|
41811
|
-
// ../../oss/packages/daemon-core/src/session-host/runtime-surface.ts
|
|
41812
|
-
function isSessionHostLiveRuntime(record2) {
|
|
41813
|
-
const lifecycle = String(record2?.lifecycle || "").trim();
|
|
41814
|
-
return LIVE_LIFECYCLES.has(lifecycle);
|
|
41815
|
-
}
|
|
41816
|
-
function getSessionHostRecoveryLabel(meta3) {
|
|
41817
|
-
const recoveryState = typeof meta3?.runtimeRecoveryState === "string" ? String(meta3.runtimeRecoveryState).trim() : "";
|
|
41818
|
-
if (!recoveryState) return null;
|
|
41819
|
-
if (recoveryState === "auto_resumed") return "restored after restart";
|
|
41820
|
-
if (recoveryState === "resume_failed") return "restore failed";
|
|
41821
|
-
if (recoveryState === "host_restart_interrupted") return "host restart interrupted";
|
|
41822
|
-
if (recoveryState === "orphan_snapshot") return "snapshot recovered";
|
|
41823
|
-
return recoveryState.replace(/_/g, " ");
|
|
41824
|
-
}
|
|
41825
|
-
function isSessionHostRecoverySnapshot(record2) {
|
|
41826
|
-
if (!record2) return false;
|
|
41827
|
-
if (isSessionHostLiveRuntime(record2)) return false;
|
|
41828
|
-
const lifecycle = String(record2.lifecycle || "").trim();
|
|
41829
|
-
if (lifecycle && lifecycle !== "stopped" && lifecycle !== "failed") {
|
|
41830
|
-
return false;
|
|
41831
|
-
}
|
|
41832
|
-
const meta3 = record2.meta || void 0;
|
|
41833
|
-
if (meta3?.restoredFromStorage === true) return true;
|
|
41834
|
-
return getSessionHostRecoveryLabel(meta3) !== null;
|
|
41835
|
-
}
|
|
41836
|
-
function getSessionHostSurfaceKind(record2) {
|
|
41837
|
-
if (isSessionHostLiveRuntime(record2)) return "live_runtime";
|
|
41838
|
-
if (isSessionHostRecoverySnapshot(record2)) return "recovery_snapshot";
|
|
41839
|
-
return "inactive_record";
|
|
41840
|
-
}
|
|
41841
|
-
function partitionSessionHostRecords(records) {
|
|
41842
|
-
const liveRuntimes = [];
|
|
41843
|
-
const recoverySnapshots = [];
|
|
41844
|
-
const inactiveRecords = [];
|
|
41845
|
-
for (const record2 of records) {
|
|
41846
|
-
const kind = getSessionHostSurfaceKind(record2);
|
|
41847
|
-
if (kind === "live_runtime") {
|
|
41848
|
-
liveRuntimes.push(record2);
|
|
41849
|
-
} else if (kind === "recovery_snapshot") {
|
|
41850
|
-
recoverySnapshots.push(record2);
|
|
41851
|
-
} else {
|
|
41852
|
-
inactiveRecords.push(record2);
|
|
41853
|
-
}
|
|
41854
|
-
}
|
|
41855
|
-
return {
|
|
41856
|
-
liveRuntimes,
|
|
41857
|
-
recoverySnapshots,
|
|
41858
|
-
inactiveRecords
|
|
41859
|
-
};
|
|
41860
|
-
}
|
|
41861
|
-
function partitionSessionHostDiagnosticsSessions(records) {
|
|
41862
|
-
return partitionSessionHostRecords(records || []);
|
|
41863
|
-
}
|
|
41864
|
-
var LIVE_LIFECYCLES;
|
|
41865
|
-
var init_runtime_surface = __esm({
|
|
41866
|
-
"../../oss/packages/daemon-core/src/session-host/runtime-surface.ts"() {
|
|
41867
|
-
"use strict";
|
|
41868
|
-
LIVE_LIFECYCLES = /* @__PURE__ */ new Set(["starting", "running", "stopping", "interrupted"]);
|
|
41869
|
-
}
|
|
41870
|
-
});
|
|
41871
|
-
|
|
41872
42282
|
// ../../oss/packages/daemon-core/src/session-host/startup-restore-policy.js
|
|
41873
42283
|
function shouldAutoRestoreHostedSessionsOnStartup(env3 = process.env) {
|
|
41874
42284
|
const raw = typeof env3.ADHDEV_RESTORE_HOSTED_SESSIONS_ON_STARTUP === "string" ? env3.ADHDEV_RESTORE_HOSTED_SESSIONS_ON_STARTUP.trim().toLowerCase() : "";
|
|
@@ -51843,7 +52253,7 @@ var init_adhdev_daemon = __esm({
|
|
|
51843
52253
|
import_ws3 = require("ws");
|
|
51844
52254
|
init_source2();
|
|
51845
52255
|
init_version();
|
|
51846
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.
|
|
52256
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.60" });
|
|
51847
52257
|
ACTIVE_CHAT_POLL_STATUSES = /* @__PURE__ */ new Set([
|
|
51848
52258
|
"generating",
|
|
51849
52259
|
"waiting_approval",
|