@adhdev/daemon-standalone 0.9.82-rc.187 → 0.9.82-rc.188
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 +422 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-Bgt2DRUK.css +1 -0
- package/public/assets/index-Du2Maw3Y.js +105 -0
- package/public/index.html +2 -2
- package/vendor/mcp-server/index.js +9 -3
- package/vendor/mcp-server/index.js.map +1 -1
- package/public/assets/index-BAFIjFAU.js +0 -99
- package/public/assets/index-Du2W0r8n.css +0 -1
package/dist/index.js
CHANGED
|
@@ -35030,6 +35030,8 @@ var require_dist3 = __commonJS({
|
|
|
35030
35030
|
if (includeSubmodules) {
|
|
35031
35031
|
submodules = await getSubmoduleStatuses(repo, options);
|
|
35032
35032
|
}
|
|
35033
|
+
const submoduleDirty = (submodules || []).some((submodule) => submodule.dirty || submodule.outOfSync || !!submodule.error);
|
|
35034
|
+
const dirty = parsed.staged + parsed.modified + parsed.untracked + parsed.deleted + parsed.renamed > 0 || parsed.conflictFiles.length > 0 || stashCount > 0 || submoduleDirty;
|
|
35033
35035
|
return {
|
|
35034
35036
|
workspace: repo.workspace,
|
|
35035
35037
|
repoRoot: repo.repoRoot,
|
|
@@ -35048,6 +35050,7 @@ var require_dist3 = __commonJS({
|
|
|
35048
35050
|
untracked: parsed.untracked,
|
|
35049
35051
|
deleted: parsed.deleted,
|
|
35050
35052
|
renamed: parsed.renamed,
|
|
35053
|
+
dirty,
|
|
35051
35054
|
hasConflicts: parsed.conflictFiles.length > 0,
|
|
35052
35055
|
conflictFiles: parsed.conflictFiles,
|
|
35053
35056
|
stashCount,
|
|
@@ -35221,6 +35224,7 @@ var require_dist3 = __commonJS({
|
|
|
35221
35224
|
untracked: 0,
|
|
35222
35225
|
deleted: 0,
|
|
35223
35226
|
renamed: 0,
|
|
35227
|
+
dirty: false,
|
|
35224
35228
|
hasConflicts: false,
|
|
35225
35229
|
conflictFiles: [],
|
|
35226
35230
|
stashCount: 0,
|
|
@@ -35233,17 +35237,33 @@ var require_dist3 = __commonJS({
|
|
|
35233
35237
|
if (!repo.repoRoot) return [];
|
|
35234
35238
|
try {
|
|
35235
35239
|
const result = await runGit(repo, ["submodule", "status", "--recursive"], options);
|
|
35236
|
-
|
|
35240
|
+
const submodules = parseSubmoduleStatusOutput(result.stdout, repo.repoRoot, options.submoduleIgnorePaths);
|
|
35241
|
+
await Promise.all(submodules.map((submodule) => enrichSubmoduleWorktreeStatus(repo, submodule, options)));
|
|
35242
|
+
return submodules;
|
|
35237
35243
|
} catch {
|
|
35238
35244
|
return [];
|
|
35239
35245
|
}
|
|
35240
35246
|
}
|
|
35247
|
+
async function enrichSubmoduleWorktreeStatus(repo, submodule, options) {
|
|
35248
|
+
try {
|
|
35249
|
+
const result = await runGit(repo, ["status", "--porcelain=v2", "--branch"], {
|
|
35250
|
+
...options,
|
|
35251
|
+
cwd: submodule.repoPath
|
|
35252
|
+
});
|
|
35253
|
+
const parsed = parsePorcelainV2Status(result.stdout);
|
|
35254
|
+
const dirty = parsed.staged + parsed.modified + parsed.untracked + parsed.deleted + parsed.renamed > 0 || parsed.conflictFiles.length > 0;
|
|
35255
|
+
submodule.dirty = submodule.dirty || dirty;
|
|
35256
|
+
} catch (error48) {
|
|
35257
|
+
submodule.dirty = true;
|
|
35258
|
+
submodule.error = formatGitError(error48);
|
|
35259
|
+
}
|
|
35260
|
+
}
|
|
35241
35261
|
function parseSubmoduleStatusOutput(output, repoRoot, ignorePaths) {
|
|
35242
35262
|
const submodules = [];
|
|
35243
35263
|
const ignoreSet = new Set(ignorePaths || []);
|
|
35244
35264
|
for (const line of output.split("\n")) {
|
|
35245
35265
|
if (!line.trim()) continue;
|
|
35246
|
-
const match = line.match(/^([
|
|
35266
|
+
const match = line.match(/^([\-+U\s])([0-9a-f]{40})\s+(\S+)(?:\s+\(([^)]+)\))?/);
|
|
35247
35267
|
if (!match) continue;
|
|
35248
35268
|
const prefix = match[1];
|
|
35249
35269
|
const commit = match[2];
|
|
@@ -35253,8 +35273,8 @@ var require_dist3 = __commonJS({
|
|
|
35253
35273
|
path: path40,
|
|
35254
35274
|
commit,
|
|
35255
35275
|
repoPath: repoRoot + "/" + path40,
|
|
35256
|
-
dirty: prefix === "
|
|
35257
|
-
outOfSync: prefix === "-",
|
|
35276
|
+
dirty: prefix === "U",
|
|
35277
|
+
outOfSync: prefix === "-" || prefix === "+",
|
|
35258
35278
|
lastCheckedAt: Date.now()
|
|
35259
35279
|
});
|
|
35260
35280
|
}
|
|
@@ -40975,6 +40995,52 @@ Next step: ${nextStep}`;
|
|
|
40975
40995
|
properties: { mode: { const: "env_var" }, name: { type: "string" } }
|
|
40976
40996
|
}
|
|
40977
40997
|
]
|
|
40998
|
+
},
|
|
40999
|
+
delegatedWorkerIsolation: {
|
|
41000
|
+
description: "Provider-declared launch isolation for coordinator-spawned worker sessions. Keeps worker-only sessions from inheriting coordinator MCP/tools/config.",
|
|
41001
|
+
type: "object",
|
|
41002
|
+
additionalProperties: false,
|
|
41003
|
+
properties: {
|
|
41004
|
+
env: {
|
|
41005
|
+
type: "object",
|
|
41006
|
+
additionalProperties: false,
|
|
41007
|
+
properties: {
|
|
41008
|
+
unset: {
|
|
41009
|
+
type: "array",
|
|
41010
|
+
items: { type: "string", minLength: 1 }
|
|
41011
|
+
}
|
|
41012
|
+
}
|
|
41013
|
+
},
|
|
41014
|
+
args: {
|
|
41015
|
+
type: "array",
|
|
41016
|
+
items: {
|
|
41017
|
+
oneOf: [
|
|
41018
|
+
{
|
|
41019
|
+
type: "object",
|
|
41020
|
+
additionalProperties: false,
|
|
41021
|
+
required: ["mode", "flag"],
|
|
41022
|
+
properties: {
|
|
41023
|
+
mode: { const: "empty_mcp_config" },
|
|
41024
|
+
flag: { type: "string", minLength: 1 },
|
|
41025
|
+
strictFlag: { type: "string", minLength: 1 }
|
|
41026
|
+
}
|
|
41027
|
+
},
|
|
41028
|
+
{
|
|
41029
|
+
type: "object",
|
|
41030
|
+
additionalProperties: false,
|
|
41031
|
+
required: ["mode", "flag", "key", "value"],
|
|
41032
|
+
properties: {
|
|
41033
|
+
mode: { const: "config_override" },
|
|
41034
|
+
flag: { type: "string", minLength: 1 },
|
|
41035
|
+
key: { type: "string", minLength: 1 },
|
|
41036
|
+
value: { type: "string", minLength: 1 },
|
|
41037
|
+
dedupeKey: { type: "string", minLength: 1 }
|
|
41038
|
+
}
|
|
41039
|
+
}
|
|
41040
|
+
]
|
|
41041
|
+
}
|
|
41042
|
+
}
|
|
41043
|
+
}
|
|
40978
41044
|
}
|
|
40979
41045
|
}
|
|
40980
41046
|
},
|
|
@@ -46118,6 +46184,7 @@ ${lastSnapshot}`;
|
|
|
46118
46184
|
probeCdpPort: () => probeCdpPort,
|
|
46119
46185
|
queuePendingMeshCoordinatorEvent: () => queuePendingMeshCoordinatorEvent,
|
|
46120
46186
|
readAntigravityCliSession: () => readSession3,
|
|
46187
|
+
readCachedInlineMeshActiveSessionDetails: () => readCachedInlineMeshActiveSessionDetails2,
|
|
46121
46188
|
readChatHistory: () => readChatHistory,
|
|
46122
46189
|
readClaudeCliSession: () => readSession,
|
|
46123
46190
|
readCodexCliSession: () => readSession2,
|
|
@@ -47146,7 +47213,14 @@ ${lastSnapshot}`;
|
|
|
47146
47213
|
switch (command) {
|
|
47147
47214
|
case "git_status": {
|
|
47148
47215
|
if (!services.getStatus) return serviceNotImplemented(command);
|
|
47149
|
-
const
|
|
47216
|
+
const submoduleIgnorePaths = Array.isArray(args?.submoduleIgnorePaths) ? args.submoduleIgnorePaths.filter((value) => typeof value === "string" && value.trim().length > 0) : void 0;
|
|
47217
|
+
const statusParams = { workspace };
|
|
47218
|
+
const refreshUpstream = optionalBoolean(args?.refreshUpstream);
|
|
47219
|
+
const includeSubmodules = optionalBoolean(args?.includeSubmodules);
|
|
47220
|
+
if (refreshUpstream !== void 0) statusParams.refreshUpstream = refreshUpstream;
|
|
47221
|
+
if (includeSubmodules !== void 0) statusParams.includeSubmodules = includeSubmodules;
|
|
47222
|
+
if (submoduleIgnorePaths && submoduleIgnorePaths.length > 0) statusParams.submoduleIgnorePaths = submoduleIgnorePaths;
|
|
47223
|
+
const status = await runService(() => services.getStatus(statusParams));
|
|
47150
47224
|
return "success" in status ? status : { success: true, status };
|
|
47151
47225
|
}
|
|
47152
47226
|
case "git_diff_summary": {
|
|
@@ -47279,6 +47353,14 @@ ${lastSnapshot}`;
|
|
|
47279
47353
|
if (statusResult.hasConflicts) {
|
|
47280
47354
|
throw new GitCommandError("conflict", "Repository has conflicts \u2014 resolve before checkpointing");
|
|
47281
47355
|
}
|
|
47356
|
+
const dirtySubmodules = (statusResult.submodules || []).filter((submodule) => submodule.dirty);
|
|
47357
|
+
if (dirtySubmodules.length > 0) {
|
|
47358
|
+
const paths = dirtySubmodules.map((submodule) => submodule.path).join(", ");
|
|
47359
|
+
throw new GitCommandError(
|
|
47360
|
+
"dirty_index_required",
|
|
47361
|
+
`Repository has dirty submodules that must be checkpointed first: ${paths}. Checkpoint or commit each dirty submodule, then checkpoint this repository to record gitlink changes.`
|
|
47362
|
+
);
|
|
47363
|
+
}
|
|
47282
47364
|
const addArgs = includeUntracked ? ["-A"] : ["-u"];
|
|
47283
47365
|
await runGit(repo, ["add", ...addArgs], { cwd: repoRoot });
|
|
47284
47366
|
const fullMsg = `adhdev: checkpoint ${message}`;
|
|
@@ -56480,6 +56562,14 @@ ${effect.notification.body || ""}`.trim();
|
|
|
56480
56562
|
return String(message.content || "").trim().length > 0;
|
|
56481
56563
|
});
|
|
56482
56564
|
}
|
|
56565
|
+
function hasFinalVisibleAssistantMessage(messages) {
|
|
56566
|
+
if (!Array.isArray(messages)) return false;
|
|
56567
|
+
const visible = filterUserFacingChatMessages(messages);
|
|
56568
|
+
const last = visible[visible.length - 1];
|
|
56569
|
+
const role = typeof last?.role === "string" ? last.role.trim().toLowerCase() : "";
|
|
56570
|
+
const content = last ? flattenContent(last.content).trim() : "";
|
|
56571
|
+
return (role === "assistant" || role === "model") && content.length > 0;
|
|
56572
|
+
}
|
|
56483
56573
|
function shouldTrustCliAdapterTerminalStatus(parsedStatus, activeModal, adapter, adapterStatus) {
|
|
56484
56574
|
if (!isGeneratingLikeStatus(parsedStatus)) return false;
|
|
56485
56575
|
if (hasNonEmptyModalButtons(activeModal)) return false;
|
|
@@ -57334,6 +57424,18 @@ ${effect.notification.body || ""}`.trim();
|
|
|
57334
57424
|
});
|
|
57335
57425
|
}
|
|
57336
57426
|
}
|
|
57427
|
+
if (isGeneratingLikeStatus(selectedStatus) && selectedTranscriptAuthority === "provider" && !hasNonEmptyModalButtons(activeModal) && hasFinalVisibleAssistantMessage(selectedMessages)) {
|
|
57428
|
+
selectedStatus = "idle";
|
|
57429
|
+
selectedMessages = finalizeStreamingMessagesWhenIdle(selectedMessages, selectedStatus);
|
|
57430
|
+
messageSource = {
|
|
57431
|
+
...messageSource,
|
|
57432
|
+
statusReconciled: {
|
|
57433
|
+
from: returnedStatus,
|
|
57434
|
+
to: "idle",
|
|
57435
|
+
reason: "provider_native_final_assistant"
|
|
57436
|
+
}
|
|
57437
|
+
};
|
|
57438
|
+
}
|
|
57337
57439
|
LOG2.debug("Command", `[read_chat] cli-like parsed provider=${adapter.cliType} target=${String(args?.targetSessionId || "")} adapterStatus=${String(adapterStatus.status || "")} parsedStatus=${String(parsedRecord.status || "")} parsedMsgCount=${parsedRecord.messages.length} returnedMsgCount=${returnedMessages.length}`);
|
|
57338
57440
|
return buildReadChatCommandResult({
|
|
57339
57441
|
messages: selectedMessages,
|
|
@@ -60890,7 +60992,18 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
60890
60992
|
"additionalProperties": false,
|
|
60891
60993
|
"properties": {
|
|
60892
60994
|
"busy_hold_ms": { "type": "integer", "minimum": 0 },
|
|
60893
|
-
"startup_grace_ms": { "type": "integer", "minimum": 0 }
|
|
60995
|
+
"startup_grace_ms": { "type": "integer", "minimum": 0 },
|
|
60996
|
+
"completion_idle_after": {
|
|
60997
|
+
"type": "object",
|
|
60998
|
+
"additionalProperties": false,
|
|
60999
|
+
"required": ["regex", "hold_ms"],
|
|
61000
|
+
"properties": {
|
|
61001
|
+
"section": { "type": "string", "minLength": 1 },
|
|
61002
|
+
"regex": { "type": "string", "minLength": 1 },
|
|
61003
|
+
"flags": { "type": "string" },
|
|
61004
|
+
"hold_ms": { "type": "integer", "minimum": 0 }
|
|
61005
|
+
}
|
|
61006
|
+
}
|
|
60894
61007
|
}
|
|
60895
61008
|
}
|
|
60896
61009
|
},
|
|
@@ -61366,6 +61479,30 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61366
61479
|
const spec = typeof specBeforeSubmit === "number" && specBeforeSubmit > 0 ? specBeforeSubmit : 0;
|
|
61367
61480
|
return Math.max(spec, SUBMIT_DELAY_FLOOR_MS + linesBonus);
|
|
61368
61481
|
}
|
|
61482
|
+
function matchesCompletionIdleRule(spec, ev, screen) {
|
|
61483
|
+
const rule = spec.debounce?.completion_idle_after;
|
|
61484
|
+
if (!rule?.regex) return null;
|
|
61485
|
+
const haystack = rule.section ? ev.sections.find((section) => section.id === rule.section)?.text ?? "" : screen;
|
|
61486
|
+
if (!haystack) return null;
|
|
61487
|
+
try {
|
|
61488
|
+
const regex = new RegExp(rule.regex, rule.flags || "");
|
|
61489
|
+
const match = haystack.match(regex);
|
|
61490
|
+
return match?.[0] || null;
|
|
61491
|
+
} catch {
|
|
61492
|
+
return null;
|
|
61493
|
+
}
|
|
61494
|
+
}
|
|
61495
|
+
function matchesCompletionIdleTargetState(spec, ev, screen) {
|
|
61496
|
+
const target = spec.states.find((state) => state.id === spec.default_state) ?? spec.states.find((state) => state.id === "idle");
|
|
61497
|
+
if (!target?.when?.regex) return false;
|
|
61498
|
+
const haystack = target.when.section ? ev.sections.find((section) => section.id === target.when.section)?.text ?? "" : screen;
|
|
61499
|
+
if (!haystack) return false;
|
|
61500
|
+
try {
|
|
61501
|
+
return new RegExp(target.when.regex, target.when.flags || "i").test(haystack);
|
|
61502
|
+
} catch {
|
|
61503
|
+
return false;
|
|
61504
|
+
}
|
|
61505
|
+
}
|
|
61369
61506
|
var SpecDriver = class {
|
|
61370
61507
|
constructor(opts) {
|
|
61371
61508
|
this.opts = opts;
|
|
@@ -61405,6 +61542,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61405
61542
|
* because the evaluator already moved past busy by the time the hold
|
|
61406
61543
|
* kicks in. */
|
|
61407
61544
|
lastBusyState = null;
|
|
61545
|
+
completionIdleFirstSeenAt = 0;
|
|
61546
|
+
completionIdleKey = "";
|
|
61408
61547
|
/** Timer that re-runs evaluate() once the hold window expires. Needed
|
|
61409
61548
|
* because the PTY stops emitting once the agent finishes; without an
|
|
61410
61549
|
* explicit wake-up there's nothing to trigger the busy → idle
|
|
@@ -61528,10 +61667,40 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61528
61667
|
evState = this.lastBusyState ?? evState;
|
|
61529
61668
|
}
|
|
61530
61669
|
}
|
|
61670
|
+
const completionIdleRule = this.spec.debounce?.completion_idle_after;
|
|
61671
|
+
let busyWakeMs = busyHoldMs;
|
|
61672
|
+
if (evState.id === "busy" && completionIdleRule) {
|
|
61673
|
+
const completionKey = matchesCompletionIdleRule(this.spec, ev, screen);
|
|
61674
|
+
if (completionKey) {
|
|
61675
|
+
const now = Date.now();
|
|
61676
|
+
if (completionKey !== this.completionIdleKey) {
|
|
61677
|
+
this.completionIdleKey = completionKey;
|
|
61678
|
+
this.completionIdleFirstSeenAt = now;
|
|
61679
|
+
}
|
|
61680
|
+
const holdMs = Math.max(0, completionIdleRule.hold_ms || 0);
|
|
61681
|
+
const ageMs = now - this.completionIdleFirstSeenAt;
|
|
61682
|
+
if (ageMs >= holdMs) {
|
|
61683
|
+
if (matchesCompletionIdleTargetState(this.spec, ev, screen)) {
|
|
61684
|
+
const idle = this.spec.states.find((state) => state.id === this.spec.default_state) ?? this.spec.states.find((state) => state.id === "idle");
|
|
61685
|
+
evState = idle ? { id: idle.id, label: idle.label, title: null } : { id: "idle", label: "Ready", title: null };
|
|
61686
|
+
} else {
|
|
61687
|
+
busyWakeMs = Math.min(busyWakeMs, 1e3);
|
|
61688
|
+
}
|
|
61689
|
+
} else {
|
|
61690
|
+
busyWakeMs = Math.min(busyWakeMs, Math.max(holdMs - ageMs, 0));
|
|
61691
|
+
}
|
|
61692
|
+
} else {
|
|
61693
|
+
this.completionIdleKey = "";
|
|
61694
|
+
this.completionIdleFirstSeenAt = 0;
|
|
61695
|
+
}
|
|
61696
|
+
} else if (evState.id !== "busy") {
|
|
61697
|
+
this.completionIdleKey = "";
|
|
61698
|
+
this.completionIdleFirstSeenAt = 0;
|
|
61699
|
+
}
|
|
61531
61700
|
if (evState.id === "busy") {
|
|
61532
61701
|
this.lastBusyAt = Date.now();
|
|
61533
61702
|
this.lastBusyState = evState;
|
|
61534
|
-
this.scheduleBusyExpiry(
|
|
61703
|
+
this.scheduleBusyExpiry(busyWakeMs);
|
|
61535
61704
|
}
|
|
61536
61705
|
const changed = forceEmit || evState.id !== this.currentStateId || !shallowSameModal(ev, this.currentEval) || !shallowSameControls(ev, this.currentEval);
|
|
61537
61706
|
if (this.pickerInProgress) this.tryAdvancePicker(screen);
|
|
@@ -62424,6 +62593,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
62424
62593
|
historyWriter;
|
|
62425
62594
|
runtimeMessages = [];
|
|
62426
62595
|
lastPersistedHistoryMessages = [];
|
|
62596
|
+
lastAcknowledgedUserInputAt = 0;
|
|
62597
|
+
externalBusyIdleFingerprint = "";
|
|
62427
62598
|
lastNativeSourceCanonicalCheckAt = 0;
|
|
62428
62599
|
lastNativeSourceCanonicalCacheKey = void 0;
|
|
62429
62600
|
cachedSqliteDb = null;
|
|
@@ -62552,7 +62723,11 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
62552
62723
|
typeof adapterStatus?.providerSessionId === "string" ? adapterStatus.providerSessionId : ""
|
|
62553
62724
|
);
|
|
62554
62725
|
const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, Date.now());
|
|
62555
|
-
|
|
62726
|
+
let visibleStatus = parseErrorMessage || parsedStatus?.status === "error" ? "error" : autoApproveActive ? "generating" : adapterStatus.status;
|
|
62727
|
+
const externalNativeFinal = this.getExternalNativeFinalReconciliation(parsedStatus?.messages, adapterStatus);
|
|
62728
|
+
if (externalNativeFinal && isCliGeneratingLikeStatus(visibleStatus)) {
|
|
62729
|
+
visibleStatus = "idle";
|
|
62730
|
+
}
|
|
62556
62731
|
const runtime = this.adapter.getRuntimeMetadata();
|
|
62557
62732
|
this.maybeAppendRuntimeRecoveryMessage(runtime);
|
|
62558
62733
|
let parsedMessages = Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : [];
|
|
@@ -62714,7 +62889,22 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
62714
62889
|
};
|
|
62715
62890
|
}
|
|
62716
62891
|
updateSettings(newSettings) {
|
|
62717
|
-
|
|
62892
|
+
const runtimeMeshSettings = {};
|
|
62893
|
+
for (const key of [
|
|
62894
|
+
"meshNodeFor",
|
|
62895
|
+
"meshNodeId",
|
|
62896
|
+
"meshActiveTaskId",
|
|
62897
|
+
"meshCoordinatorFor",
|
|
62898
|
+
"meshCoordinatorDaemonId",
|
|
62899
|
+
"meshCoordinatorNodeId",
|
|
62900
|
+
"spawnedSessionVisibility",
|
|
62901
|
+
"launchedByCoordinator"
|
|
62902
|
+
]) {
|
|
62903
|
+
if (this.settings[key] !== void 0 && newSettings[key] === void 0) {
|
|
62904
|
+
runtimeMeshSettings[key] = this.settings[key];
|
|
62905
|
+
}
|
|
62906
|
+
}
|
|
62907
|
+
this.settings = { ...newSettings, ...runtimeMeshSettings };
|
|
62718
62908
|
this.adapter.updateRuntimeSettings?.(this.settings);
|
|
62719
62909
|
this.monitor.updateConfig({
|
|
62720
62910
|
approvalAlert: this.settings.approvalAlert !== false,
|
|
@@ -62805,6 +62995,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
62805
62995
|
const content = typeof input === "string" ? input.trim() : buildCliStructuredInputPrompt(input).trim();
|
|
62806
62996
|
if (!content) return;
|
|
62807
62997
|
const receivedAt = Date.now();
|
|
62998
|
+
this.lastAcknowledgedUserInputAt = receivedAt;
|
|
62999
|
+
this.externalBusyIdleFingerprint = "";
|
|
62808
63000
|
const dedupKey = `user_input_ack:${crypto4.createHash("sha256").update(`${this.instanceId}:${content}:${receivedAt}`).digest("hex").slice(0, 24)}`;
|
|
62809
63001
|
this.appendRuntimeMessage(buildChatMessage({
|
|
62810
63002
|
role: "user",
|
|
@@ -62953,6 +63145,50 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
62953
63145
|
const evidence = this.completionFinalAssistantEvidence(parsedMessages);
|
|
62954
63146
|
return extractFinalSummaryFromMessages(evidence.messages);
|
|
62955
63147
|
}
|
|
63148
|
+
externalNativeFinalFingerprint(evidence) {
|
|
63149
|
+
const messages = Array.isArray(evidence.messages) ? evidence.messages : [];
|
|
63150
|
+
const visibleMessages = messages.filter((message) => isUserFacingChatMessage(message));
|
|
63151
|
+
const lastVisible = visibleMessages[visibleMessages.length - 1];
|
|
63152
|
+
const content = lastVisible ? flattenContent(lastVisible.content).trim() : "";
|
|
63153
|
+
const receivedAt = lastVisible ? getMessageTime(lastVisible) : 0;
|
|
63154
|
+
const probe = this.lastExternalCompletionProbe;
|
|
63155
|
+
return crypto4.createHash("sha256").update([
|
|
63156
|
+
this.type,
|
|
63157
|
+
this.providerSessionId || "",
|
|
63158
|
+
probe?.sourcePath || "",
|
|
63159
|
+
String(probe?.sourceMtimeMs || 0),
|
|
63160
|
+
String(receivedAt || 0),
|
|
63161
|
+
content.slice(-500)
|
|
63162
|
+
].join("\0")).digest("hex").slice(0, 24);
|
|
63163
|
+
}
|
|
63164
|
+
getExternalNativeFinalReconciliation(parsedMessages, adapterStatus) {
|
|
63165
|
+
const rawStatus = typeof adapterStatus?.status === "string" ? adapterStatus.status.trim() : "";
|
|
63166
|
+
if (!isCliGeneratingLikeStatus(rawStatus)) return null;
|
|
63167
|
+
if (hasNonEmptyCliModalButtons(adapterStatus?.activeModal ?? adapterStatus?.modal)) return null;
|
|
63168
|
+
const evidence = this.completionFinalAssistantEvidence(parsedMessages);
|
|
63169
|
+
if (evidence.source !== "external-native" || !evidence.present) return null;
|
|
63170
|
+
const messages = Array.isArray(evidence.messages) ? evidence.messages : [];
|
|
63171
|
+
const visibleMessages = messages.filter((message) => isUserFacingChatMessage(message));
|
|
63172
|
+
const lastVisible = visibleMessages[visibleMessages.length - 1];
|
|
63173
|
+
const lastMessageAt = lastVisible ? getMessageTime(lastVisible) : 0;
|
|
63174
|
+
const sourceMtimeMs = Number(this.lastExternalCompletionProbe?.sourceMtimeMs || 0);
|
|
63175
|
+
const minEvidenceAt = Math.max(
|
|
63176
|
+
this.startedAt > 0 ? this.startedAt - 5e3 : 0,
|
|
63177
|
+
this.generatingStartedAt > 0 ? this.generatingStartedAt - 5e3 : 0,
|
|
63178
|
+
this.lastAcknowledgedUserInputAt > 0 ? this.lastAcknowledgedUserInputAt - 1e3 : 0
|
|
63179
|
+
);
|
|
63180
|
+
if (minEvidenceAt > 0 && lastMessageAt > 0 && lastMessageAt < minEvidenceAt && sourceMtimeMs < minEvidenceAt) {
|
|
63181
|
+
return null;
|
|
63182
|
+
}
|
|
63183
|
+
const finalSummary = extractFinalSummaryFromMessages(evidence.messages);
|
|
63184
|
+
if (!finalSummary) return null;
|
|
63185
|
+
const fingerprint = this.externalNativeFinalFingerprint(evidence);
|
|
63186
|
+
if (fingerprint === this.externalBusyIdleFingerprint) {
|
|
63187
|
+
return { fingerprint, finalSummary, evidence };
|
|
63188
|
+
}
|
|
63189
|
+
this.externalBusyIdleFingerprint = fingerprint;
|
|
63190
|
+
return { fingerprint, finalSummary, evidence };
|
|
63191
|
+
}
|
|
62956
63192
|
buildCompletedFinalizationDiagnostic(args) {
|
|
62957
63193
|
let parsed = null;
|
|
62958
63194
|
let parseError;
|
|
@@ -63023,17 +63259,18 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
63023
63259
|
if (typeof adapterAny?.responseBuffer === "string" && adapterAny.responseBuffer.trim()) return false;
|
|
63024
63260
|
return true;
|
|
63025
63261
|
}
|
|
63026
|
-
getCompletedFinalizationBlock(latestVisibleStatus, pending) {
|
|
63262
|
+
getCompletedFinalizationBlock(latestVisibleStatus, pending, opts) {
|
|
63027
63263
|
if (latestVisibleStatus !== "idle") return { reason: `status:${latestVisibleStatus}`, terminal: true };
|
|
63028
63264
|
const adapterAny = this.adapter;
|
|
63029
63265
|
const approvalResolvedIdle = pending.previousStatus === "waiting_approval";
|
|
63030
|
-
|
|
63266
|
+
const externalNativeFinal = opts?.externalNativeFinal || null;
|
|
63267
|
+
if (!approvalResolvedIdle && !externalNativeFinal) {
|
|
63031
63268
|
if (adapterAny?.isWaitingForResponse === true) return { reason: "adapter_waiting_for_response", terminal: true };
|
|
63032
63269
|
if (adapterAny?.currentTurnScope) return { reason: "adapter_turn_scope_active", terminal: true };
|
|
63033
63270
|
if (this.hasAdapterPendingResponse()) return { reason: "adapter_pending_response", terminal: true };
|
|
63034
63271
|
}
|
|
63035
63272
|
const partial2 = typeof this.adapter.getPartialResponse === "function" ? this.adapter.getPartialResponse() : "";
|
|
63036
|
-
if (typeof partial2 === "string" && partial2.trim()) return { reason: "partial_response_pending", terminal: true };
|
|
63273
|
+
if (!externalNativeFinal && typeof partial2 === "string" && partial2.trim()) return { reason: "partial_response_pending", terminal: true };
|
|
63037
63274
|
let parsed;
|
|
63038
63275
|
try {
|
|
63039
63276
|
parsed = this.adapter.getScriptParsedStatus();
|
|
@@ -63043,6 +63280,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
63043
63280
|
const parsedStatus = typeof parsed?.status === "string" ? parsed.status : "unknown";
|
|
63044
63281
|
if (parsedStatus !== "idle") {
|
|
63045
63282
|
const adapterStatus = this.adapter.getStatus({ allowParse: false });
|
|
63283
|
+
if (externalNativeFinal && isCliGeneratingLikeStatus(parsedStatus)) return null;
|
|
63046
63284
|
if (this.shouldSuppressStaleParsedBusyStatus(parsed, adapterStatus)) return null;
|
|
63047
63285
|
return { reason: `parsed_status:${parsedStatus}`, terminal: isCliGeneratingLikeStatus(parsedStatus) };
|
|
63048
63286
|
}
|
|
@@ -63095,14 +63333,15 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
63095
63333
|
}
|
|
63096
63334
|
const latestStatus = this.adapter.getStatus({ allowParse: false });
|
|
63097
63335
|
const latestAutoApproveActive = latestStatus.status === "waiting_approval" && this.shouldAutoApprove();
|
|
63098
|
-
const
|
|
63336
|
+
const externalNativeFinal = this.getExternalNativeFinalReconciliation(void 0, latestStatus);
|
|
63337
|
+
const latestVisibleStatus = externalNativeFinal && isCliGeneratingLikeStatus(latestStatus.status) ? "idle" : latestAutoApproveActive ? "generating" : latestStatus.status;
|
|
63099
63338
|
if (latestVisibleStatus !== "idle") {
|
|
63100
63339
|
LOG2.info("CLI", `[${this.type}] cancelled pending completed (resumed ${latestVisibleStatus})`);
|
|
63101
63340
|
this.completedDebouncePending = null;
|
|
63102
63341
|
this.completedDebounceTimer = null;
|
|
63103
63342
|
return;
|
|
63104
63343
|
}
|
|
63105
|
-
const block2 = this.getCompletedFinalizationBlock(latestVisibleStatus, pending);
|
|
63344
|
+
const block2 = this.getCompletedFinalizationBlock(latestVisibleStatus, pending, { externalNativeFinal });
|
|
63106
63345
|
if (block2) {
|
|
63107
63346
|
const blockReason = block2.reason;
|
|
63108
63347
|
const waitedMs = Date.now() - pending.firstObservedAt;
|
|
@@ -63143,7 +63382,18 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
63143
63382
|
chatTitle: pending.chatTitle,
|
|
63144
63383
|
duration: pending.duration,
|
|
63145
63384
|
timestamp: pending.timestamp,
|
|
63146
|
-
finalSummary: this.completionFinalSummary(this.adapter?.getScriptParsedStatus()?.messages)
|
|
63385
|
+
finalSummary: externalNativeFinal?.finalSummary || this.completionFinalSummary(this.adapter?.getScriptParsedStatus()?.messages),
|
|
63386
|
+
...externalNativeFinal ? {
|
|
63387
|
+
completionDiagnostic: {
|
|
63388
|
+
providerType: this.type,
|
|
63389
|
+
sessionId: this.instanceId,
|
|
63390
|
+
providerSessionId: this.providerSessionId || null,
|
|
63391
|
+
reconciliationReason: "external_native_final_assistant_while_adapter_busy",
|
|
63392
|
+
finalAssistantPresent: true,
|
|
63393
|
+
finalAssistantEvidenceSource: externalNativeFinal.evidence.source,
|
|
63394
|
+
externalFinalFingerprint: externalNativeFinal.fingerprint
|
|
63395
|
+
}
|
|
63396
|
+
} : {}
|
|
63147
63397
|
});
|
|
63148
63398
|
this.completedDebouncePending = null;
|
|
63149
63399
|
this.completedDebounceTimer = null;
|
|
@@ -63199,7 +63449,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
63199
63449
|
const parsedStatus = null;
|
|
63200
63450
|
const rawStatus = adapterStatus.status;
|
|
63201
63451
|
const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, now);
|
|
63202
|
-
const
|
|
63452
|
+
const externalNativeFinal = this.getExternalNativeFinalReconciliation(void 0, adapterStatus);
|
|
63453
|
+
const newStatus = externalNativeFinal && isCliGeneratingLikeStatus(rawStatus) ? "idle" : autoApproveActive ? "generating" : rawStatus;
|
|
63203
63454
|
const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
|
|
63204
63455
|
const chatTitle = `${this.provider.name} \xB7 ${dirName}`;
|
|
63205
63456
|
const partial2 = this.adapter.getPartialResponse();
|
|
@@ -65192,15 +65443,29 @@ ${rawInput}` : rawInput;
|
|
|
65192
65443
|
const fn = chalkApi?.[color];
|
|
65193
65444
|
return typeof fn === "function" ? fn(text) : text;
|
|
65194
65445
|
}
|
|
65195
|
-
var
|
|
65196
|
-
ADHDEV_INLINE_MESH
|
|
65197
|
-
ADHDEV_MCP_TRANSPORT
|
|
65198
|
-
ADHDEV_MESH_ID
|
|
65199
|
-
HERMES_EPHEMERAL_SYSTEM_PROMPT
|
|
65200
|
-
|
|
65446
|
+
var DEFAULT_COORDINATOR_DELEGATED_ENV_UNSETS = [
|
|
65447
|
+
"ADHDEV_INLINE_MESH",
|
|
65448
|
+
"ADHDEV_MCP_TRANSPORT",
|
|
65449
|
+
"ADHDEV_MESH_ID",
|
|
65450
|
+
"HERMES_EPHEMERAL_SYSTEM_PROMPT"
|
|
65451
|
+
];
|
|
65201
65452
|
function hasCliArg(args, flag) {
|
|
65202
65453
|
return args.some((arg) => arg === flag || arg.startsWith(`${flag}=`));
|
|
65203
65454
|
}
|
|
65455
|
+
function hasConfigOverride(args, key) {
|
|
65456
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
65457
|
+
const arg = args[index];
|
|
65458
|
+
const next = args[index + 1];
|
|
65459
|
+
if ((arg === "-c" || arg === "--config") && typeof next === "string") {
|
|
65460
|
+
if (next === key || next.startsWith(`${key}=`) || next.startsWith(`${key}.`)) return true;
|
|
65461
|
+
}
|
|
65462
|
+
if (arg.startsWith("--config=")) {
|
|
65463
|
+
const value = arg.slice("--config=".length);
|
|
65464
|
+
if (value === key || value.startsWith(`${key}=`) || value.startsWith(`${key}.`)) return true;
|
|
65465
|
+
}
|
|
65466
|
+
}
|
|
65467
|
+
return false;
|
|
65468
|
+
}
|
|
65204
65469
|
function ensureEmptyDelegatedMcpConfig(workspace) {
|
|
65205
65470
|
const baseDir = path23.join(os17.tmpdir(), "adhdev-delegated-agent-empty-mcp");
|
|
65206
65471
|
(0, import_fs12.mkdirSync)(baseDir, { recursive: true });
|
|
@@ -65210,11 +65475,30 @@ ${rawInput}` : rawInput;
|
|
|
65210
65475
|
return filePath;
|
|
65211
65476
|
}
|
|
65212
65477
|
function buildCoordinatorDelegatedCliLaunchOptions(input) {
|
|
65213
|
-
const cliType = String(input.cliType || "").trim();
|
|
65214
65478
|
const cliArgs = Array.isArray(input.cliArgs) ? [...input.cliArgs] : [];
|
|
65215
|
-
const env2 = { ...input.env || {}
|
|
65216
|
-
|
|
65217
|
-
|
|
65479
|
+
const env2 = { ...input.env || {} };
|
|
65480
|
+
const envUnsets = new Set(DEFAULT_COORDINATOR_DELEGATED_ENV_UNSETS);
|
|
65481
|
+
for (const key of input.isolation?.env?.unset || []) {
|
|
65482
|
+
if (typeof key === "string" && key.trim()) envUnsets.add(key.trim());
|
|
65483
|
+
}
|
|
65484
|
+
for (const key of envUnsets) env2[key] = "";
|
|
65485
|
+
for (const rule of input.isolation?.args || []) {
|
|
65486
|
+
if (!rule || typeof rule !== "object") continue;
|
|
65487
|
+
if (rule.mode === "empty_mcp_config") {
|
|
65488
|
+
if (rule.flag && !hasCliArg(cliArgs, rule.flag)) {
|
|
65489
|
+
cliArgs.unshift(rule.flag, ensureEmptyDelegatedMcpConfig(input.workspace));
|
|
65490
|
+
}
|
|
65491
|
+
if (rule.strictFlag && !hasCliArg(cliArgs, rule.strictFlag)) {
|
|
65492
|
+
cliArgs.unshift(rule.strictFlag);
|
|
65493
|
+
}
|
|
65494
|
+
continue;
|
|
65495
|
+
}
|
|
65496
|
+
if (rule.mode === "config_override") {
|
|
65497
|
+
const key = String(rule.dedupeKey || rule.key || "").trim();
|
|
65498
|
+
const flag = String(rule.flag || "").trim();
|
|
65499
|
+
if (!key || !flag || hasConfigOverride(cliArgs, key)) continue;
|
|
65500
|
+
cliArgs.unshift(flag, `${rule.key}=${rule.value}`);
|
|
65501
|
+
}
|
|
65218
65502
|
}
|
|
65219
65503
|
return { cliArgs, env: env2 };
|
|
65220
65504
|
}
|
|
@@ -65877,22 +66161,25 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
65877
66161
|
const dir = resolved.path;
|
|
65878
66162
|
const launchSource = resolved.source;
|
|
65879
66163
|
if (!cliType) throw new Error("cliType required");
|
|
66164
|
+
const providerType = this.providerLoader.resolveAlias(cliType);
|
|
66165
|
+
const provLookup = this.providerLoader.getMeta(providerType);
|
|
65880
66166
|
const settingsOverride = args?.settings && typeof args.settings === "object" ? args.settings : void 0;
|
|
65881
66167
|
const delegatedLaunch = settingsOverride?.launchedByCoordinator === true ? buildCoordinatorDelegatedCliLaunchOptions({
|
|
65882
66168
|
cliType,
|
|
65883
66169
|
workspace: dir,
|
|
65884
66170
|
cliArgs: args?.cliArgs,
|
|
65885
|
-
env: args?.env
|
|
66171
|
+
env: args?.env,
|
|
66172
|
+
isolation: provLookup?.meshCoordinator?.delegatedWorkerIsolation
|
|
65886
66173
|
}) : null;
|
|
65887
|
-
const
|
|
65888
|
-
const provTrust =
|
|
66174
|
+
const provMeta = provLookup;
|
|
66175
|
+
const provTrust = provMeta?._sourceTrust;
|
|
65889
66176
|
if (provTrust === "external-untrusted" && args?.confirmExternalUntrusted !== true) {
|
|
65890
66177
|
return {
|
|
65891
66178
|
success: false,
|
|
65892
66179
|
error: "untrusted_external_provider",
|
|
65893
66180
|
provider: {
|
|
65894
66181
|
type: provLookup?.type ?? cliType,
|
|
65895
|
-
sourceName:
|
|
66182
|
+
sourceName: provMeta?._sourceName ?? null,
|
|
65896
66183
|
trust: provTrust
|
|
65897
66184
|
},
|
|
65898
66185
|
hint: "Resend launch_cli with confirmExternalUntrusted=true after the user explicitly approves running JavaScript from this 3rd-party source."
|
|
@@ -66358,7 +66645,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
66358
66645
|
if (meshCoordinator.reason !== void 0 && (typeof meshCoordinator.reason !== "string" || !meshCoordinator.reason.trim())) {
|
|
66359
66646
|
errors.push("meshCoordinator.reason must be a non-empty string when provided");
|
|
66360
66647
|
}
|
|
66361
|
-
|
|
66648
|
+
validateMeshCoordinatorMcpConfig(meshCoordinator.mcpConfig, errors);
|
|
66649
|
+
validateMeshCoordinatorDelegatedWorkerIsolation(meshCoordinator.delegatedWorkerIsolation, errors);
|
|
66650
|
+
}
|
|
66651
|
+
function validateMeshCoordinatorMcpConfig(mcpConfig, errors) {
|
|
66362
66652
|
if (mcpConfig === void 0) return;
|
|
66363
66653
|
if (!mcpConfig || typeof mcpConfig !== "object" || Array.isArray(mcpConfig)) {
|
|
66364
66654
|
errors.push("meshCoordinator.mcpConfig must be an object");
|
|
@@ -66399,6 +66689,56 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
66399
66689
|
}
|
|
66400
66690
|
}
|
|
66401
66691
|
}
|
|
66692
|
+
function validateMeshCoordinatorDelegatedWorkerIsolation(raw, errors) {
|
|
66693
|
+
if (raw === void 0) return;
|
|
66694
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
66695
|
+
errors.push("meshCoordinator.delegatedWorkerIsolation must be an object");
|
|
66696
|
+
return;
|
|
66697
|
+
}
|
|
66698
|
+
const isolation = raw;
|
|
66699
|
+
const env2 = isolation.env;
|
|
66700
|
+
if (env2 !== void 0) {
|
|
66701
|
+
if (!env2 || typeof env2 !== "object" || Array.isArray(env2)) {
|
|
66702
|
+
errors.push("meshCoordinator.delegatedWorkerIsolation.env must be an object");
|
|
66703
|
+
} else {
|
|
66704
|
+
const unset = env2.unset;
|
|
66705
|
+
if (unset !== void 0 && (!Array.isArray(unset) || unset.some((key) => typeof key !== "string" || !key.trim()))) {
|
|
66706
|
+
errors.push("meshCoordinator.delegatedWorkerIsolation.env.unset must be an array of non-empty strings");
|
|
66707
|
+
}
|
|
66708
|
+
}
|
|
66709
|
+
}
|
|
66710
|
+
const args = isolation.args;
|
|
66711
|
+
if (args === void 0) return;
|
|
66712
|
+
if (!Array.isArray(args)) {
|
|
66713
|
+
errors.push("meshCoordinator.delegatedWorkerIsolation.args must be an array");
|
|
66714
|
+
return;
|
|
66715
|
+
}
|
|
66716
|
+
for (const [index, rule] of args.entries()) {
|
|
66717
|
+
const prefix = `meshCoordinator.delegatedWorkerIsolation.args[${index}]`;
|
|
66718
|
+
if (!rule || typeof rule !== "object" || Array.isArray(rule)) {
|
|
66719
|
+
errors.push(`${prefix} must be an object`);
|
|
66720
|
+
continue;
|
|
66721
|
+
}
|
|
66722
|
+
const item = rule;
|
|
66723
|
+
const mode = item.mode;
|
|
66724
|
+
if (mode !== "empty_mcp_config" && mode !== "config_override") {
|
|
66725
|
+
errors.push(`${prefix}.mode must be one of: empty_mcp_config, config_override`);
|
|
66726
|
+
continue;
|
|
66727
|
+
}
|
|
66728
|
+
for (const key of mode === "empty_mcp_config" ? ["flag"] : ["flag", "key", "value"]) {
|
|
66729
|
+
const value = item[key];
|
|
66730
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
66731
|
+
errors.push(`${prefix}.${key} must be a non-empty string`);
|
|
66732
|
+
}
|
|
66733
|
+
}
|
|
66734
|
+
for (const key of ["strictFlag", "dedupeKey"]) {
|
|
66735
|
+
const value = item[key];
|
|
66736
|
+
if (value !== void 0 && (typeof value !== "string" || !value.trim())) {
|
|
66737
|
+
errors.push(`${prefix}.${key} must be a non-empty string when provided`);
|
|
66738
|
+
}
|
|
66739
|
+
}
|
|
66740
|
+
}
|
|
66741
|
+
}
|
|
66402
66742
|
function validateControl(control, errors) {
|
|
66403
66743
|
if (!control || typeof control !== "object") {
|
|
66404
66744
|
errors.push("controls: each control must be an object");
|
|
@@ -71998,7 +72338,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
71998
72338
|
const sessionId = readStringValue(fallbackSession.id, fallbackSession.sessionId, fallbackSession.session_id, node?.activeSessionId, node?.active_session_id, node?.sessionId, node?.session_id);
|
|
71999
72339
|
return sessionId ? [sessionId] : [];
|
|
72000
72340
|
}
|
|
72001
|
-
function
|
|
72341
|
+
function readCachedInlineMeshActiveSessionDetails2(node) {
|
|
72002
72342
|
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
72003
72343
|
const activeSession = readObjectRecord(cachedStatus.activeSession);
|
|
72004
72344
|
const fallbackSession = Object.keys(activeSession).length ? activeSession : readObjectRecord(node?.activeSession ?? node?.active_session);
|
|
@@ -72024,9 +72364,14 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
72024
72364
|
node?.provider_type
|
|
72025
72365
|
),
|
|
72026
72366
|
state: readStringValue(fallbackSession.status, fallbackSession.state, fallbackSession.lifecycle),
|
|
72367
|
+
chatStatus: readStringValue(fallbackSession.chatStatus, fallbackSession.chat_status),
|
|
72027
72368
|
lifecycle: readStringValue(fallbackSession.lifecycle),
|
|
72028
72369
|
title: readStringValue(fallbackSession.title, fallbackSession.displayName, fallbackSession.display_name) ?? null,
|
|
72029
72370
|
workspace: readStringValue(fallbackSession.workspace, node?.workspace) ?? null,
|
|
72371
|
+
role: readStringValue(fallbackSession.role) ?? null,
|
|
72372
|
+
isSelfCoordinator: fallbackSession.isSelfCoordinator === true || fallbackSession.is_self_coordinator === true,
|
|
72373
|
+
createdAt: readStringValue(fallbackSession.createdAt, fallbackSession.created_at) ?? null,
|
|
72374
|
+
startedAt: readStringValue(fallbackSession.startedAt, fallbackSession.started_at) ?? null,
|
|
72030
72375
|
lastActivityAt: readStringValue(fallbackSession.lastActivityAt, fallbackSession.last_activity_at) ?? null,
|
|
72031
72376
|
recoveryState: readStringValue(fallbackSession.recoveryState, fallbackSession.recovery_state) ?? null,
|
|
72032
72377
|
isCached: true
|
|
@@ -72167,15 +72512,26 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
72167
72512
|
};
|
|
72168
72513
|
}
|
|
72169
72514
|
function summarizeMeshSessionRecord(record2) {
|
|
72515
|
+
const meta3 = readObjectRecord(record2?.meta);
|
|
72516
|
+
const isSelfCoordinator = Boolean(readStringValue(meta3.meshCoordinatorFor));
|
|
72517
|
+
const chatStatus = readStringValue(record2?.chatStatus, record2?.activeChat?.status, meta3.chatStatus, meta3.sessionStatus);
|
|
72518
|
+
const state = readLiveMeshSessionState(record2);
|
|
72519
|
+
const statusNote = isSelfCoordinator && (!chatStatus || chatStatus === "idle" || state === "idle") ? "Coordinator self status is sampled from the session host and may read idle while the coordinator is generating this response." : null;
|
|
72170
72520
|
return {
|
|
72171
72521
|
sessionId: readStringValue(record2?.sessionId) || "unknown",
|
|
72172
72522
|
providerType: readStringValue(record2?.providerType),
|
|
72173
|
-
state
|
|
72523
|
+
state,
|
|
72524
|
+
chatStatus,
|
|
72174
72525
|
lifecycle: readStringValue(record2?.lifecycle),
|
|
72175
72526
|
surfaceKind: getSessionHostSurfaceKind(record2),
|
|
72176
|
-
recoveryState: readStringValue(
|
|
72527
|
+
recoveryState: readStringValue(meta3.runtimeRecoveryState) ?? null,
|
|
72177
72528
|
workspace: readStringValue(record2?.workspace) ?? null,
|
|
72178
72529
|
title: readStringValue(record2?.displayName, record2?.workspaceLabel) ?? null,
|
|
72530
|
+
role: isSelfCoordinator ? "coordinator" : readStringValue(meta3.meshRole, meta3.role) ?? null,
|
|
72531
|
+
isSelfCoordinator,
|
|
72532
|
+
statusNote,
|
|
72533
|
+
createdAt: toIsoTimestamp(record2?.createdAt ?? record2?.created_at),
|
|
72534
|
+
startedAt: toIsoTimestamp(record2?.startedAt ?? record2?.started_at ?? record2?.spawnedAtMs ?? record2?.spawned_at_ms),
|
|
72179
72535
|
lastActivityAt: toIsoTimestamp(record2?.updatedAt ?? record2?.lastActivityAt ?? record2?.last_activity_at),
|
|
72180
72536
|
isCached: false
|
|
72181
72537
|
};
|
|
@@ -72277,7 +72633,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
72277
72633
|
const lastSeenAt = toIsoTimestamp(cachedStatus.lastSeenAt ?? cachedStatus.last_seen_at ?? node?.lastSeenAt ?? node?.last_seen_at);
|
|
72278
72634
|
const updatedAt = toIsoTimestamp(cachedStatus.updatedAt ?? cachedStatus.updated_at ?? node?.updatedAt ?? node?.updated_at);
|
|
72279
72635
|
const activeSessions = readCachedInlineMeshActiveSessions(node);
|
|
72280
|
-
const activeSessionDetails =
|
|
72636
|
+
const activeSessionDetails = readCachedInlineMeshActiveSessionDetails2(node);
|
|
72281
72637
|
if (!git && !error48 && !health && !machineStatus && !lastSeenAt && !updatedAt && activeSessions.length === 0) return false;
|
|
72282
72638
|
if (git) status.git = git;
|
|
72283
72639
|
if (error48) status.error = error48;
|
|
@@ -73199,6 +73555,15 @@ ${e?.stderr || ""}`
|
|
|
73199
73555
|
this.aggregateMeshStatusCache.set(meshId, { builtAt, snapshot: this.cloneJsonValue(next), queueRevision: getMeshQueueRevision(meshId) });
|
|
73200
73556
|
return next;
|
|
73201
73557
|
}
|
|
73558
|
+
getCachedInlineMeshNodes() {
|
|
73559
|
+
const nodes = [];
|
|
73560
|
+
for (const mesh of this.inlineMeshCache.values()) {
|
|
73561
|
+
if (Array.isArray(mesh?.nodes)) {
|
|
73562
|
+
nodes.push(...mesh.nodes);
|
|
73563
|
+
}
|
|
73564
|
+
}
|
|
73565
|
+
return nodes;
|
|
73566
|
+
}
|
|
73202
73567
|
getCachedInlineMesh(meshId, inlineMesh) {
|
|
73203
73568
|
if (inlineMesh && typeof inlineMesh === "object") {
|
|
73204
73569
|
return this.warmInlineMeshCache(meshId, inlineMesh);
|
|
@@ -73247,6 +73612,7 @@ ${e?.stderr || ""}`
|
|
|
73247
73612
|
}
|
|
73248
73613
|
invalidateAggregateMeshStatus(meshId) {
|
|
73249
73614
|
this.aggregateMeshStatusCache.delete(meshId);
|
|
73615
|
+
this.deps.onMeshStateChange?.(meshId);
|
|
73250
73616
|
}
|
|
73251
73617
|
async requireMeshHostMutationOwner(meshId, inlineMesh, operation) {
|
|
73252
73618
|
const meshRecord = await this.getMeshForCommand(meshId, inlineMesh, { preferInline: true });
|
|
@@ -84672,6 +85038,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84672
85038
|
},
|
|
84673
85039
|
onIdeConnected: () => poller?.start(),
|
|
84674
85040
|
onStatusChange: config2.onStatusChange,
|
|
85041
|
+
onMeshStateChange: config2.onMeshStateChange,
|
|
84675
85042
|
onPostChatCommand: config2.onPostChatCommand,
|
|
84676
85043
|
sessionHostControl: config2.sessionHostControl,
|
|
84677
85044
|
statusInstanceId: config2.statusInstanceId,
|
|
@@ -86013,6 +86380,9 @@ var SESSION_TARGET_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
86013
86380
|
"restart_session",
|
|
86014
86381
|
"agent_command"
|
|
86015
86382
|
]);
|
|
86383
|
+
function commandMayAffectMeshGraphStatus(type) {
|
|
86384
|
+
return type.startsWith("mesh_") || type === "add_mesh_node" || type === "update_mesh_node" || type === "remove_mesh_node" || type === "clone_mesh_node" || type === "trigger_mesh_queue" || type === "get_mesh_queue" || type === "launch_cli" || type === "stop_cli" || type === "restart_session";
|
|
86385
|
+
}
|
|
86016
86386
|
function standaloneIpcEnabled() {
|
|
86017
86387
|
const value = String(process.env.ADHDEV_STANDALONE_ENABLE_IPC || "").trim().toLowerCase();
|
|
86018
86388
|
return value === "1" || value === "true" || value === "yes";
|
|
@@ -87410,11 +87780,24 @@ var StandaloneServer = class {
|
|
|
87410
87780
|
state.seq += 1;
|
|
87411
87781
|
state.lastSentAt = now;
|
|
87412
87782
|
const cfgSnap = (0, import_daemon_core2.loadConfig)();
|
|
87783
|
+
const status = this.buildSharedSnapshot("metadata");
|
|
87784
|
+
const includeSessions = state.request.params.includeSessions === true;
|
|
87785
|
+
if (includeSessions) {
|
|
87786
|
+
if (this.components?.router) {
|
|
87787
|
+
const nodes = this.components.router.getCachedInlineMeshNodes();
|
|
87788
|
+
for (const node of nodes) {
|
|
87789
|
+
const meshSessions = (0, import_daemon_core2.readCachedInlineMeshActiveSessionDetails)(node);
|
|
87790
|
+
for (const session of meshSessions) {
|
|
87791
|
+
status.sessions.push(session);
|
|
87792
|
+
}
|
|
87793
|
+
}
|
|
87794
|
+
}
|
|
87795
|
+
}
|
|
87413
87796
|
return {
|
|
87414
87797
|
topic: "daemon.metadata",
|
|
87415
87798
|
key,
|
|
87416
87799
|
daemonId: `standalone_${cfgSnap.machineId || "standalone"}`,
|
|
87417
|
-
status
|
|
87800
|
+
status,
|
|
87418
87801
|
userName: cfgSnap.userName || void 0,
|
|
87419
87802
|
seq: state.seq,
|
|
87420
87803
|
timestamp: now
|
|
@@ -87589,10 +87972,11 @@ var StandaloneServer = class {
|
|
|
87589
87972
|
return { success: false, error: "command type required" };
|
|
87590
87973
|
}
|
|
87591
87974
|
const result = await this.components.router.execute(type, args, "standalone");
|
|
87592
|
-
|
|
87975
|
+
const affectsMeshGraphStatus = commandMayAffectMeshGraphStatus(type);
|
|
87976
|
+
if (type === "invoke_provider_script" || type.startsWith("workspace_") || type.startsWith("session_host_") || affectsMeshGraphStatus) {
|
|
87593
87977
|
this.scheduleBroadcastStatus();
|
|
87594
87978
|
}
|
|
87595
|
-
if (type === "invoke_provider_script" || type === "get_status_metadata" || type === "set_user_name" || type === "set_machine_nickname" || type.startsWith("workspace_") || type.startsWith("session_host_")) {
|
|
87979
|
+
if (type === "invoke_provider_script" || type === "get_status_metadata" || type === "set_user_name" || type === "set_machine_nickname" || type.startsWith("workspace_") || type.startsWith("session_host_") || affectsMeshGraphStatus) {
|
|
87596
87980
|
void this.flushWsDaemonMetadataSubscriptions();
|
|
87597
87981
|
}
|
|
87598
87982
|
if (type.startsWith("session_host_")) void this.flushWsSessionHostDiagnosticsSubscriptions();
|