@adhdev/daemon-standalone 0.9.82-rc.6 → 0.9.82-rc.8
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 +172 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-UQ7bnB6f.css +1 -0
- package/public/assets/index-rt5QK8HH.js +98 -0
- package/public/index.html +2 -2
- package/public/assets/index-B8fg8KB1.css +0 -1
- package/public/assets/index-BG1OOql2.js +0 -98
package/dist/index.js
CHANGED
|
@@ -45903,26 +45903,127 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
45903
45903
|
...submodules ? { submodules } : {}
|
|
45904
45904
|
};
|
|
45905
45905
|
}
|
|
45906
|
+
function hasGitWorktreeChanges(git) {
|
|
45907
|
+
if (!git) return false;
|
|
45908
|
+
return Number(git.staged || 0) + Number(git.modified || 0) + Number(git.untracked || 0) + Number(git.deleted || 0) + Number(git.renamed || 0) > 0;
|
|
45909
|
+
}
|
|
45910
|
+
function getGitSubmoduleDriftState(git) {
|
|
45911
|
+
const submodules = Array.isArray(git?.submodules) ? git.submodules : [];
|
|
45912
|
+
let dirty = false;
|
|
45913
|
+
let outOfSync = false;
|
|
45914
|
+
for (const entry of submodules) {
|
|
45915
|
+
const submodule = readObjectRecord(entry);
|
|
45916
|
+
if (readBooleanValue(submodule.dirty) === true) dirty = true;
|
|
45917
|
+
if (readBooleanValue(submodule.outOfSync) === true || !!readStringValue(submodule.error)) outOfSync = true;
|
|
45918
|
+
}
|
|
45919
|
+
return { dirty, outOfSync };
|
|
45920
|
+
}
|
|
45921
|
+
function deriveMeshNodeHealthFromGit(git) {
|
|
45922
|
+
if (!git || readBooleanValue(git.isGitRepo) === false) return "degraded";
|
|
45923
|
+
const branch = readStringValue(git.branch);
|
|
45924
|
+
if (!branch) return "degraded";
|
|
45925
|
+
const submoduleDrift = getGitSubmoduleDriftState(git);
|
|
45926
|
+
if (submoduleDrift.outOfSync) return "degraded";
|
|
45927
|
+
if (submoduleDrift.dirty || hasGitWorktreeChanges(git)) return "dirty";
|
|
45928
|
+
return "online";
|
|
45929
|
+
}
|
|
45930
|
+
function readCachedInlineMeshActiveSessions(node) {
|
|
45931
|
+
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
45932
|
+
const activeSession = readObjectRecord(cachedStatus.activeSession);
|
|
45933
|
+
const fallbackSession = Object.keys(activeSession).length ? activeSession : readObjectRecord(node?.activeSession ?? node?.active_session);
|
|
45934
|
+
const sessionId = readStringValue(fallbackSession.id, fallbackSession.sessionId, fallbackSession.session_id, node?.activeSessionId, node?.active_session_id, node?.sessionId, node?.session_id);
|
|
45935
|
+
return sessionId ? [sessionId] : [];
|
|
45936
|
+
}
|
|
45937
|
+
function readCachedInlineMeshActiveSessionDetails(node) {
|
|
45938
|
+
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
45939
|
+
const activeSession = readObjectRecord(cachedStatus.activeSession);
|
|
45940
|
+
const fallbackSession = Object.keys(activeSession).length ? activeSession : readObjectRecord(node?.activeSession ?? node?.active_session);
|
|
45941
|
+
const sessionId = readStringValue(
|
|
45942
|
+
fallbackSession.id,
|
|
45943
|
+
fallbackSession.sessionId,
|
|
45944
|
+
fallbackSession.session_id,
|
|
45945
|
+
node?.activeSessionId,
|
|
45946
|
+
node?.active_session_id,
|
|
45947
|
+
node?.sessionId,
|
|
45948
|
+
node?.session_id
|
|
45949
|
+
);
|
|
45950
|
+
if (!sessionId) return [];
|
|
45951
|
+
return [{
|
|
45952
|
+
sessionId,
|
|
45953
|
+
providerType: readStringValue(
|
|
45954
|
+
fallbackSession.providerType,
|
|
45955
|
+
fallbackSession.provider_type,
|
|
45956
|
+
fallbackSession.cliType,
|
|
45957
|
+
fallbackSession.cli_type,
|
|
45958
|
+
fallbackSession.provider,
|
|
45959
|
+
node?.providerType,
|
|
45960
|
+
node?.provider_type
|
|
45961
|
+
),
|
|
45962
|
+
state: readStringValue(fallbackSession.status, fallbackSession.state, fallbackSession.lifecycle),
|
|
45963
|
+
lifecycle: readStringValue(fallbackSession.lifecycle),
|
|
45964
|
+
title: readStringValue(fallbackSession.title, fallbackSession.displayName, fallbackSession.display_name) ?? null,
|
|
45965
|
+
workspace: readStringValue(fallbackSession.workspace, node?.workspace) ?? null,
|
|
45966
|
+
lastActivityAt: readStringValue(fallbackSession.lastActivityAt, fallbackSession.last_activity_at) ?? null,
|
|
45967
|
+
recoveryState: readStringValue(fallbackSession.recoveryState, fallbackSession.recovery_state) ?? null,
|
|
45968
|
+
isCached: true
|
|
45969
|
+
}];
|
|
45970
|
+
}
|
|
45971
|
+
function readLiveMeshSessionState(record2) {
|
|
45972
|
+
return readStringValue(
|
|
45973
|
+
record2?.meta?.sessionStatus,
|
|
45974
|
+
record2?.meta?.status,
|
|
45975
|
+
record2?.meta?.providerStatus,
|
|
45976
|
+
record2?.status,
|
|
45977
|
+
record2?.state,
|
|
45978
|
+
record2?.lifecycle
|
|
45979
|
+
);
|
|
45980
|
+
}
|
|
45981
|
+
function toIsoTimestamp(value) {
|
|
45982
|
+
if (typeof value === "number" && Number.isFinite(value)) return new Date(value).toISOString();
|
|
45983
|
+
const stringValue = readStringValue(value);
|
|
45984
|
+
return stringValue || null;
|
|
45985
|
+
}
|
|
45986
|
+
function summarizeMeshSessionRecord(record2) {
|
|
45987
|
+
return {
|
|
45988
|
+
sessionId: readStringValue(record2?.sessionId) || "unknown",
|
|
45989
|
+
providerType: readStringValue(record2?.providerType),
|
|
45990
|
+
state: readLiveMeshSessionState(record2),
|
|
45991
|
+
lifecycle: readStringValue(record2?.lifecycle),
|
|
45992
|
+
surfaceKind: getSessionHostSurfaceKind(record2),
|
|
45993
|
+
recoveryState: readStringValue(record2?.meta?.runtimeRecoveryState) ?? null,
|
|
45994
|
+
workspace: readStringValue(record2?.workspace) ?? null,
|
|
45995
|
+
title: readStringValue(record2?.displayName, record2?.workspaceLabel) ?? null,
|
|
45996
|
+
lastActivityAt: toIsoTimestamp(record2?.updatedAt ?? record2?.lastActivityAt ?? record2?.last_activity_at),
|
|
45997
|
+
isCached: false
|
|
45998
|
+
};
|
|
45999
|
+
}
|
|
45906
46000
|
function applyCachedInlineMeshNodeStatus(status, node) {
|
|
45907
46001
|
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
45908
46002
|
const git = buildCachedInlineMeshGitStatus(node);
|
|
45909
46003
|
const error48 = readStringValue(cachedStatus.error, node?.error);
|
|
45910
46004
|
const health = readStringValue(cachedStatus.health, node?.health);
|
|
45911
46005
|
const machineStatus = readStringValue(cachedStatus.machineStatus, node?.machineStatus);
|
|
45912
|
-
|
|
45913
|
-
|
|
46006
|
+
const lastSeenAt = toIsoTimestamp(cachedStatus.lastSeenAt ?? cachedStatus.last_seen_at ?? node?.lastSeenAt ?? node?.last_seen_at);
|
|
46007
|
+
const updatedAt = toIsoTimestamp(cachedStatus.updatedAt ?? cachedStatus.updated_at ?? node?.updatedAt ?? node?.updated_at);
|
|
46008
|
+
const activeSessions = readCachedInlineMeshActiveSessions(node);
|
|
46009
|
+
const activeSessionDetails = readCachedInlineMeshActiveSessionDetails(node);
|
|
46010
|
+
if (!git && !error48 && !health && !machineStatus && !lastSeenAt && !updatedAt && activeSessions.length === 0) return false;
|
|
45914
46011
|
if (git) status.git = git;
|
|
45915
46012
|
if (error48) status.error = error48;
|
|
46013
|
+
if (machineStatus) status.machineStatus = machineStatus;
|
|
46014
|
+
if (lastSeenAt) status.lastSeenAt = lastSeenAt;
|
|
46015
|
+
if (updatedAt) status.updatedAt = updatedAt;
|
|
46016
|
+
if (activeSessions.length > 0) status.activeSessions = activeSessions;
|
|
46017
|
+
if (activeSessionDetails.length > 0) status.activeSessionDetails = activeSessionDetails;
|
|
45916
46018
|
if (health) {
|
|
45917
46019
|
status.health = health;
|
|
45918
46020
|
return true;
|
|
45919
46021
|
}
|
|
45920
46022
|
if (git) {
|
|
45921
|
-
|
|
45922
|
-
status.health = git.isGitRepo === false ? "degraded" : dirty ? "dirty" : "online";
|
|
46023
|
+
status.health = deriveMeshNodeHealthFromGit(git);
|
|
45923
46024
|
return true;
|
|
45924
46025
|
}
|
|
45925
|
-
return
|
|
46026
|
+
return activeSessions.length > 0 || !!machineStatus || !!lastSeenAt || !!updatedAt;
|
|
45926
46027
|
}
|
|
45927
46028
|
async function resolveProviderTypeFromPriority(args) {
|
|
45928
46029
|
if (!args.providerPriority.length) {
|
|
@@ -48162,23 +48263,81 @@ ${block}`);
|
|
|
48162
48263
|
const { readLedgerEntries: readLedgerEntries2, getLedgerSummary: getLedgerSummary2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
48163
48264
|
const ledgerEntries = readLedgerEntries2(meshId, { tail: 20 });
|
|
48164
48265
|
const ledgerSummary = getLedgerSummary2(meshId);
|
|
48266
|
+
const sessionHostRecords = this.deps.sessionHostControl?.listSessions ? await this.deps.sessionHostControl.listSessions().catch(() => []) : [];
|
|
48267
|
+
const liveMeshSessions = partitionSessionHostRecords(Array.isArray(sessionHostRecords) ? sessionHostRecords : []).liveRuntimes;
|
|
48268
|
+
const localMachineId = loadConfig2().machineId || "";
|
|
48269
|
+
const inlineCoordinatorNodeId = meshRecord?.inline && Array.isArray(mesh.nodes) ? readStringValue(mesh.nodes[0]?.id, mesh.nodes[0]?.nodeId) : void 0;
|
|
48270
|
+
const refreshedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
48165
48271
|
const nodeStatuses = [];
|
|
48166
|
-
for (const node of mesh.nodes || []) {
|
|
48272
|
+
for (const [nodeIndex, node] of (mesh.nodes || []).entries()) {
|
|
48273
|
+
const nodeId = String(node.id || node.nodeId || "");
|
|
48274
|
+
const daemonId = readStringValue(node.daemonId);
|
|
48275
|
+
const providerPriority = readProviderPriorityFromPolicy(node.policy);
|
|
48276
|
+
const isSelfNode = Boolean(
|
|
48277
|
+
nodeId && inlineCoordinatorNodeId && nodeId === inlineCoordinatorNodeId
|
|
48278
|
+
) || Boolean(
|
|
48279
|
+
daemonId && (daemonId === localMachineId || daemonId === this.deps.statusInstanceId)
|
|
48280
|
+
) || Boolean(meshRecord?.inline && nodeIndex === 0);
|
|
48167
48281
|
const status = {
|
|
48168
|
-
nodeId
|
|
48282
|
+
nodeId,
|
|
48169
48283
|
machineLabel: node.machineLabel || node.id || node.nodeId,
|
|
48170
48284
|
workspace: node.workspace,
|
|
48171
48285
|
repoRoot: node.repoRoot,
|
|
48172
48286
|
isLocalWorktree: node.isLocalWorktree,
|
|
48173
48287
|
worktreeBranch: node.worktreeBranch,
|
|
48174
|
-
daemonId
|
|
48288
|
+
daemonId,
|
|
48175
48289
|
machineId: node.machineId,
|
|
48290
|
+
machineStatus: node.machineStatus,
|
|
48176
48291
|
health: "unknown",
|
|
48177
48292
|
providers: node.providers || [],
|
|
48178
|
-
|
|
48293
|
+
providerPriority,
|
|
48294
|
+
activeSessions: [],
|
|
48295
|
+
activeSessionDetails: [],
|
|
48296
|
+
launchReady: false
|
|
48179
48297
|
};
|
|
48298
|
+
if (isSelfNode) {
|
|
48299
|
+
status.connection = {
|
|
48300
|
+
perspective: "selected_coordinator",
|
|
48301
|
+
source: "mesh_peer_status",
|
|
48302
|
+
state: "self",
|
|
48303
|
+
transport: "local",
|
|
48304
|
+
reported: true,
|
|
48305
|
+
reason: "Selected coordinator daemon",
|
|
48306
|
+
lastStateChangeAt: refreshedAt
|
|
48307
|
+
};
|
|
48308
|
+
} else if (daemonId) {
|
|
48309
|
+
const connection = this.deps.getMeshPeerConnectionStatus?.(daemonId);
|
|
48310
|
+
status.connection = connection ?? {
|
|
48311
|
+
perspective: "selected_coordinator",
|
|
48312
|
+
source: "not_reported",
|
|
48313
|
+
state: "unknown",
|
|
48314
|
+
transport: "unknown",
|
|
48315
|
+
reported: false,
|
|
48316
|
+
reason: "No live mesh peer telemetry reported by the selected coordinator yet."
|
|
48317
|
+
};
|
|
48318
|
+
} else {
|
|
48319
|
+
status.connection = {
|
|
48320
|
+
perspective: "selected_coordinator",
|
|
48321
|
+
source: "not_reported",
|
|
48322
|
+
state: "unknown",
|
|
48323
|
+
transport: "unknown",
|
|
48324
|
+
reported: false,
|
|
48325
|
+
reason: "Node has no daemon id, so mesh transport cannot be reported from the selected coordinator."
|
|
48326
|
+
};
|
|
48327
|
+
}
|
|
48328
|
+
const matchedLiveSessionRecords = liveMeshSessions.filter((record2) => this.sessionMatchesMeshNode(record2, node, nodeId));
|
|
48329
|
+
if (matchedLiveSessionRecords.length > 0) {
|
|
48330
|
+
const sessionIds = matchedLiveSessionRecords.map((record2) => typeof record2?.sessionId === "string" ? record2.sessionId : "").filter(Boolean);
|
|
48331
|
+
const providerTypes = matchedLiveSessionRecords.map((record2) => readStringValue(record2?.providerType)).filter(Boolean);
|
|
48332
|
+
status.activeSessions = sessionIds;
|
|
48333
|
+
status.activeSessionDetails = matchedLiveSessionRecords.map(summarizeMeshSessionRecord);
|
|
48334
|
+
if (providerTypes.length > 0) {
|
|
48335
|
+
status.providers = Array.from(/* @__PURE__ */ new Set([...Array.isArray(status.providers) ? status.providers : [], ...providerTypes]));
|
|
48336
|
+
}
|
|
48337
|
+
}
|
|
48180
48338
|
if (node.workspace && typeof node.workspace === "string") {
|
|
48181
48339
|
if (!fs10.existsSync(node.workspace) && applyCachedInlineMeshNodeStatus(status, node)) {
|
|
48340
|
+
status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || isSelfNode);
|
|
48182
48341
|
nodeStatuses.push(status);
|
|
48183
48342
|
continue;
|
|
48184
48343
|
}
|
|
@@ -48186,8 +48345,7 @@ ${block}`);
|
|
|
48186
48345
|
const gitStatus = await getGitRepoStatus(node.workspace, { timeoutMs: 1e4 });
|
|
48187
48346
|
status.git = gitStatus;
|
|
48188
48347
|
if (gitStatus.isGitRepo) {
|
|
48189
|
-
|
|
48190
|
-
status.health = gitStatus.branch ? dirty ? "dirty" : "online" : "degraded";
|
|
48348
|
+
status.health = deriveMeshNodeHealthFromGit(gitStatus);
|
|
48191
48349
|
} else {
|
|
48192
48350
|
status.health = "degraded";
|
|
48193
48351
|
if (gitStatus.error && !status.error) status.error = gitStatus.error;
|
|
@@ -48200,6 +48358,7 @@ ${block}`);
|
|
|
48200
48358
|
} else {
|
|
48201
48359
|
applyCachedInlineMeshNodeStatus(status, node);
|
|
48202
48360
|
}
|
|
48361
|
+
status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || isSelfNode);
|
|
48203
48362
|
nodeStatuses.push(status);
|
|
48204
48363
|
}
|
|
48205
48364
|
return {
|
|
@@ -48208,6 +48367,7 @@ ${block}`);
|
|
|
48208
48367
|
meshName: mesh.name,
|
|
48209
48368
|
repoIdentity: mesh.repoIdentity,
|
|
48210
48369
|
defaultBranch: mesh.defaultBranch,
|
|
48370
|
+
refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
48211
48371
|
nodes: nodeStatuses,
|
|
48212
48372
|
queue: { tasks: queue, summary: queueSummary },
|
|
48213
48373
|
ledger: { entries: ledgerEntries, summary: ledgerSummary }
|
|
@@ -56083,6 +56243,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
56083
56243
|
sessionHostControl: config2.sessionHostControl,
|
|
56084
56244
|
statusInstanceId: config2.statusInstanceId,
|
|
56085
56245
|
statusVersion: config2.statusVersion,
|
|
56246
|
+
getMeshPeerConnectionStatus: config2.getMeshPeerConnectionStatus,
|
|
56086
56247
|
getCdpLogFn: config2.getCdpLogFn || ((ideType) => LOG2.forComponent(`CDP:${ideType}`).asLogFn())
|
|
56087
56248
|
});
|
|
56088
56249
|
poller = new AgentStreamPoller({
|