@adhdev/mesh-shared 1.0.58-rc.98 → 1.0.58

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/types.d.ts CHANGED
@@ -28,8 +28,8 @@ export interface GitSubmoduleStatus {
28
28
  dirty: boolean;
29
29
  /** Whether the submodule commit differs from what the parent repo expects */
30
30
  outOfSync: boolean;
31
- /** Last checked timestamp */
32
- lastCheckedAt: number;
31
+ /** Last checked timestamp. Absent when the source did not report one. */
32
+ lastCheckedAt?: number;
33
33
  /** Error message if submodule status could not be read */
34
34
  error?: string;
35
35
  }
@@ -85,7 +85,8 @@ export interface GitRepoStatus extends GitRepoIdentity {
85
85
  hasConflicts: boolean;
86
86
  conflictFiles: string[];
87
87
  stashCount: number;
88
- lastCheckedAt: number;
88
+ /** Absent when the source did not report a measurement time. */
89
+ lastCheckedAt?: number;
89
90
  /** Submodule statuses when auto-discover is enabled */
90
91
  submodules?: GitSubmoduleStatus[];
91
92
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/mesh-shared",
3
- "version": "1.0.58-rc.98",
3
+ "version": "1.0.58",
4
4
  "description": "ADHDev mesh-shared — pure mesh/git status normalizers shared by daemon-core and web-core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -46,8 +46,9 @@ export function readGitSubmodules(value: unknown, parentRepoRoot?: string): GitS
46
46
  commit,
47
47
  dirty: readBoolean(submodule.dirty) ?? false,
48
48
  outOfSync: readBoolean(submodule.outOfSync, submodule.out_of_sync) ?? false,
49
- lastCheckedAt: readNumber(submodule.lastCheckedAt, submodule.last_checked_at) ?? Date.now(),
50
49
  }
50
+ const lastCheckedAt = readNumber(submodule.lastCheckedAt, submodule.last_checked_at)
51
+ if (lastCheckedAt !== undefined) result.lastCheckedAt = lastCheckedAt
51
52
  if (repoPath) result.repoPath = repoPath
52
53
  const error = readString(submodule.error)
53
54
  if (error) result.error = error
@@ -105,6 +106,7 @@ export function normalizeGitStatus(
105
106
  const untracked = readNumber(status.untracked) ?? 0
106
107
  const deleted = readNumber(status.deleted) ?? 0
107
108
  const renamed = readNumber(status.renamed) ?? 0
109
+ const lastCheckedAt = options?.lastCheckedAt ?? readNumber(status.lastCheckedAt, status.last_checked_at)
108
110
  return {
109
111
  workspace: readString(status.workspace, node.workspace) || '',
110
112
  repoRoot: repoRoot ?? null,
@@ -127,7 +129,7 @@ export function normalizeGitStatus(
127
129
  hasConflicts,
128
130
  conflictFiles,
129
131
  stashCount: readNumber(status.stashCount, status.stash_count) ?? 0,
130
- lastCheckedAt: options?.lastCheckedAt ?? readNumber(status.lastCheckedAt, status.last_checked_at) ?? Date.now(),
132
+ ...(lastCheckedAt !== undefined ? { lastCheckedAt } : {}),
131
133
  ...(submodules ? { submodules } : {}),
132
134
  // Deploy-lag visibility: daemonBuildBehind is computed by the reporting
133
135
  // daemon's git probe (build commit vs workspace/submodule HEAD). It must
@@ -172,10 +174,9 @@ export function pickBestTransitGitStatus(node: JsonRecord, options?: { lastCheck
172
174
  const probeGitResult = readRecord(probeGit.result)
173
175
  const probeDirectStatus = readRecord(probeGit.status)
174
176
  const probeNestedStatus = readRecord(probeGitResult.status)
175
- const lastCheckedAt = options?.lastCheckedAt
176
177
  let best: { git: GitRepoStatus; score: number } | null = null
177
178
  for (const status of [directStatus, nestedStatus, probeDirectStatus, probeNestedStatus]) {
178
- const normalized = normalizeGitStatus(status, node, { lastCheckedAt: lastCheckedAt ?? Date.now() })
179
+ const normalized = normalizeGitStatus(status, node, options)
179
180
  if (!normalized) continue
180
181
  const score = scoreGitStatusCandidate(normalized)
181
182
  if (!best || score > best.score) best = { git: normalized, score }
package/src/types.ts CHANGED
@@ -41,8 +41,8 @@ export interface GitSubmoduleStatus {
41
41
  dirty: boolean
42
42
  /** Whether the submodule commit differs from what the parent repo expects */
43
43
  outOfSync: boolean
44
- /** Last checked timestamp */
45
- lastCheckedAt: number
44
+ /** Last checked timestamp. Absent when the source did not report one. */
45
+ lastCheckedAt?: number
46
46
  /** Error message if submodule status could not be read */
47
47
  error?: string
48
48
  }
@@ -100,7 +100,8 @@ export interface GitRepoStatus extends GitRepoIdentity {
100
100
  hasConflicts: boolean
101
101
  conflictFiles: string[]
102
102
  stashCount: number
103
- lastCheckedAt: number
103
+ /** Absent when the source did not report a measurement time. */
104
+ lastCheckedAt?: number
104
105
  /** Submodule statuses when auto-discover is enabled */
105
106
  submodules?: GitSubmoduleStatus[]
106
107
  /**