@adhdev/daemon-core 0.9.82-rc.25 → 0.9.82-rc.26
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 +27 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -47
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/commands/router.ts +42 -58
package/package.json
CHANGED
package/src/commands/router.ts
CHANGED
|
@@ -137,60 +137,11 @@ function readGitSubmodules(value: unknown): GitSubmoduleStatus[] | undefined {
|
|
|
137
137
|
return submodules.length > 0 ? submodules : undefined;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
function
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
? cachedGit.conflictFiles.filter((value: unknown): value is string => typeof value === 'string')
|
|
146
|
-
: [];
|
|
147
|
-
const conflictCount = readNumberValue(cachedGit.conflicts) ?? conflictFiles.length;
|
|
148
|
-
const hasConflicts = readBooleanValue(cachedGit.hasConflicts) ?? conflictCount > 0;
|
|
149
|
-
const isGitRepo = readBooleanValue(cachedGit.isGitRepo);
|
|
150
|
-
if (isGitRepo !== undefined) {
|
|
151
|
-
const submodules = readGitSubmodules(cachedGit.submodules);
|
|
152
|
-
return {
|
|
153
|
-
workspace: readStringValue(cachedGit.workspace, node?.workspace) || '',
|
|
154
|
-
repoRoot: readStringValue(cachedGit.repoRoot, node?.repoRoot, node?.workspace) || null,
|
|
155
|
-
isGitRepo,
|
|
156
|
-
branch: readStringValue(cachedGit.branch) ?? null,
|
|
157
|
-
headCommit: readStringValue(cachedGit.headCommit) ?? null,
|
|
158
|
-
headMessage: readStringValue(cachedGit.headMessage) ?? null,
|
|
159
|
-
upstream: readStringValue(cachedGit.upstream) ?? null,
|
|
160
|
-
ahead: readNumberValue(cachedGit.ahead) ?? 0,
|
|
161
|
-
behind: readNumberValue(cachedGit.behind) ?? 0,
|
|
162
|
-
staged: readNumberValue(cachedGit.staged) ?? 0,
|
|
163
|
-
modified: readNumberValue(cachedGit.modified) ?? 0,
|
|
164
|
-
untracked: readNumberValue(cachedGit.untracked) ?? 0,
|
|
165
|
-
deleted: readNumberValue(cachedGit.deleted) ?? 0,
|
|
166
|
-
renamed: readNumberValue(cachedGit.renamed) ?? 0,
|
|
167
|
-
hasConflicts,
|
|
168
|
-
conflictFiles,
|
|
169
|
-
stashCount: readNumberValue(cachedGit.stashCount) ?? 0,
|
|
170
|
-
lastCheckedAt: readNumberValue(cachedGit.lastCheckedAt) ?? Date.now(),
|
|
171
|
-
...(submodules ? { submodules } : {}),
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const rawGit = readObjectRecord(node?.lastGit ?? node?.last_git);
|
|
177
|
-
const gitResult = readObjectRecord(rawGit.result);
|
|
178
|
-
const directStatus = readObjectRecord(rawGit.status);
|
|
179
|
-
const nestedStatus = readObjectRecord(gitResult.status);
|
|
180
|
-
const rawProbe = readObjectRecord(node?.lastProbe ?? node?.last_probe);
|
|
181
|
-
const probeGit = readObjectRecord(rawProbe.git);
|
|
182
|
-
const probeGitResult = readObjectRecord(probeGit.result);
|
|
183
|
-
const probeDirectStatus = readObjectRecord(probeGit.status);
|
|
184
|
-
const probeNestedStatus = readObjectRecord(probeGitResult.status);
|
|
185
|
-
const status = Object.keys(directStatus).length
|
|
186
|
-
? directStatus
|
|
187
|
-
: Object.keys(nestedStatus).length
|
|
188
|
-
? nestedStatus
|
|
189
|
-
: Object.keys(probeDirectStatus).length
|
|
190
|
-
? probeDirectStatus
|
|
191
|
-
: Object.keys(probeNestedStatus).length
|
|
192
|
-
? probeNestedStatus
|
|
193
|
-
: {};
|
|
140
|
+
function normalizeInlineMeshGitStatus(
|
|
141
|
+
status: Record<string, unknown>,
|
|
142
|
+
node: any,
|
|
143
|
+
options?: { lastCheckedAt?: number },
|
|
144
|
+
): Record<string, unknown> | undefined {
|
|
194
145
|
const isGitRepo = readBooleanValue(status.isGitRepo);
|
|
195
146
|
if (!Object.keys(status).length || isGitRepo === undefined) return undefined;
|
|
196
147
|
const conflictFiles = Array.isArray(status.conflictFiles)
|
|
@@ -217,11 +168,43 @@ function buildCachedInlineMeshGitStatus(node: any): Record<string, unknown> | un
|
|
|
217
168
|
hasConflicts,
|
|
218
169
|
conflictFiles,
|
|
219
170
|
stashCount: readNumberValue(status.stashCount) ?? 0,
|
|
220
|
-
lastCheckedAt: Date.now(),
|
|
171
|
+
lastCheckedAt: options?.lastCheckedAt ?? readNumberValue(status.lastCheckedAt) ?? Date.now(),
|
|
221
172
|
...(submodules ? { submodules } : {}),
|
|
222
173
|
};
|
|
223
174
|
}
|
|
224
175
|
|
|
176
|
+
function buildInlineMeshTransitGitStatus(node: any): Record<string, unknown> | undefined {
|
|
177
|
+
const rawGit = readObjectRecord(node?.lastGit ?? node?.last_git);
|
|
178
|
+
const gitResult = readObjectRecord(rawGit.result);
|
|
179
|
+
const directStatus = readObjectRecord(rawGit.status);
|
|
180
|
+
const nestedStatus = readObjectRecord(gitResult.status);
|
|
181
|
+
const rawProbe = readObjectRecord(node?.lastProbe ?? node?.last_probe);
|
|
182
|
+
const probeGit = readObjectRecord(rawProbe.git);
|
|
183
|
+
const probeGitResult = readObjectRecord(probeGit.result);
|
|
184
|
+
const probeDirectStatus = readObjectRecord(probeGit.status);
|
|
185
|
+
const probeNestedStatus = readObjectRecord(probeGitResult.status);
|
|
186
|
+
const status = Object.keys(directStatus).length
|
|
187
|
+
? directStatus
|
|
188
|
+
: Object.keys(nestedStatus).length
|
|
189
|
+
? nestedStatus
|
|
190
|
+
: Object.keys(probeDirectStatus).length
|
|
191
|
+
? probeDirectStatus
|
|
192
|
+
: Object.keys(probeNestedStatus).length
|
|
193
|
+
? probeNestedStatus
|
|
194
|
+
: {};
|
|
195
|
+
return normalizeInlineMeshGitStatus(status, node, { lastCheckedAt: Date.now() });
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function buildCachedInlineMeshGitStatus(node: any): Record<string, unknown> | undefined {
|
|
199
|
+
const liveGit = buildInlineMeshTransitGitStatus(node);
|
|
200
|
+
if (liveGit) return liveGit;
|
|
201
|
+
|
|
202
|
+
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
203
|
+
const cachedGit = readObjectRecord(cachedStatus.git);
|
|
204
|
+
if (!Object.keys(cachedGit).length) return undefined;
|
|
205
|
+
return normalizeInlineMeshGitStatus(cachedGit, node);
|
|
206
|
+
}
|
|
207
|
+
|
|
225
208
|
function shouldDiscardCachedInlineMeshStatus(node: any): boolean {
|
|
226
209
|
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
227
210
|
if (!Object.keys(cachedStatus).length) return false;
|
|
@@ -518,9 +501,10 @@ function collectLiveMeshSessionRecords(args: {
|
|
|
518
501
|
|
|
519
502
|
function applyCachedInlineMeshNodeStatus(status: Record<string, unknown>, node: any): boolean {
|
|
520
503
|
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
521
|
-
const
|
|
522
|
-
const
|
|
523
|
-
const
|
|
504
|
+
const liveGit = buildInlineMeshTransitGitStatus(node);
|
|
505
|
+
const git = liveGit ?? buildCachedInlineMeshGitStatus(node);
|
|
506
|
+
const error = liveGit ? undefined : readStringValue(cachedStatus.error, node?.error);
|
|
507
|
+
const health = liveGit ? undefined : readStringValue(cachedStatus.health, node?.health);
|
|
524
508
|
const machineStatus = readStringValue(cachedStatus.machineStatus, node?.machineStatus);
|
|
525
509
|
const lastSeenAt = toIsoTimestamp(cachedStatus.lastSeenAt ?? cachedStatus.last_seen_at ?? node?.lastSeenAt ?? node?.last_seen_at);
|
|
526
510
|
const updatedAt = toIsoTimestamp(cachedStatus.updatedAt ?? cachedStatus.updated_at ?? node?.updatedAt ?? node?.updated_at);
|