instar 1.3.2013 → 1.3.2015

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.
Files changed (123) hide show
  1. package/dashboard/console/console.js +2 -0
  2. package/dashboard/console/nav-model.js +5 -2
  3. package/dashboard/console/needs-model.js +6 -0
  4. package/dashboard/console/repos-model.js +83 -0
  5. package/dashboard/console/repos.js +37 -0
  6. package/dist/commands/server.d.ts.map +1 -1
  7. package/dist/commands/server.js +91 -3
  8. package/dist/commands/server.js.map +1 -1
  9. package/dist/core/CoherenceJournal.d.ts +1 -1
  10. package/dist/core/CoherenceJournal.d.ts.map +1 -1
  11. package/dist/core/CoherenceJournal.js +10 -2
  12. package/dist/core/CoherenceJournal.js.map +1 -1
  13. package/dist/core/OwnedRepoReplicatedStore.d.ts +39 -0
  14. package/dist/core/OwnedRepoReplicatedStore.d.ts.map +1 -0
  15. package/dist/core/OwnedRepoReplicatedStore.js +104 -0
  16. package/dist/core/OwnedRepoReplicatedStore.js.map +1 -0
  17. package/dist/core/ReplicatedStoreReconcilerWiring.d.ts.map +1 -1
  18. package/dist/core/ReplicatedStoreReconcilerWiring.js +1 -0
  19. package/dist/core/ReplicatedStoreReconcilerWiring.js.map +1 -1
  20. package/dist/core/SafeGitExecutor.d.ts +5 -0
  21. package/dist/core/SafeGitExecutor.d.ts.map +1 -1
  22. package/dist/core/SafeGitExecutor.js +53 -1
  23. package/dist/core/SafeGitExecutor.js.map +1 -1
  24. package/dist/core/appConversationPool.d.ts +2 -0
  25. package/dist/core/appConversationPool.d.ts.map +1 -1
  26. package/dist/core/appConversationPool.js +1 -1
  27. package/dist/core/appConversationPool.js.map +1 -1
  28. package/dist/core/credentialLineMask.d.ts +53 -0
  29. package/dist/core/credentialLineMask.d.ts.map +1 -0
  30. package/dist/core/credentialLineMask.js +223 -0
  31. package/dist/core/credentialLineMask.js.map +1 -0
  32. package/dist/core/devGatedFeatures.d.ts.map +1 -1
  33. package/dist/core/devGatedFeatures.js +6 -0
  34. package/dist/core/devGatedFeatures.js.map +1 -1
  35. package/dist/core/outputCredentialScrub.d.ts +7 -0
  36. package/dist/core/outputCredentialScrub.d.ts.map +1 -1
  37. package/dist/core/outputCredentialScrub.js +27 -0
  38. package/dist/core/outputCredentialScrub.js.map +1 -1
  39. package/dist/core/transcriptCheckpoints.d.ts +7 -0
  40. package/dist/core/transcriptCheckpoints.d.ts.map +1 -1
  41. package/dist/core/transcriptCheckpoints.js +63 -2
  42. package/dist/core/transcriptCheckpoints.js.map +1 -1
  43. package/dist/data/standards-guard-index.json +1 -1
  44. package/dist/data/standards-guard-index.meta.json +2 -2
  45. package/dist/data/standards-registry.meta.json +1 -1
  46. package/dist/messaging/NotificationSelectivityGate.d.ts +12 -0
  47. package/dist/messaging/NotificationSelectivityGate.d.ts.map +1 -1
  48. package/dist/messaging/NotificationSelectivityGate.js +33 -8
  49. package/dist/messaging/NotificationSelectivityGate.js.map +1 -1
  50. package/dist/monitoring/DiskSteward.d.ts +2 -1
  51. package/dist/monitoring/DiskSteward.d.ts.map +1 -1
  52. package/dist/monitoring/DiskSteward.js +12 -2
  53. package/dist/monitoring/DiskSteward.js.map +1 -1
  54. package/dist/monitoring/DiskStewardPoster.d.ts +4 -0
  55. package/dist/monitoring/DiskStewardPoster.d.ts.map +1 -1
  56. package/dist/monitoring/DiskStewardPoster.js +15 -4
  57. package/dist/monitoring/DiskStewardPoster.js.map +1 -1
  58. package/dist/monitoring/diskSteward/wiring.d.ts +2 -0
  59. package/dist/monitoring/diskSteward/wiring.d.ts.map +1 -1
  60. package/dist/monitoring/diskSteward/wiring.js +1 -1
  61. package/dist/monitoring/diskSteward/wiring.js.map +1 -1
  62. package/dist/monitoring/ownedRepos/OwnedRepoRegistry.d.ts +179 -0
  63. package/dist/monitoring/ownedRepos/OwnedRepoRegistry.d.ts.map +1 -0
  64. package/dist/monitoring/ownedRepos/OwnedRepoRegistry.js +506 -0
  65. package/dist/monitoring/ownedRepos/OwnedRepoRegistry.js.map +1 -0
  66. package/dist/monitoring/ownedRepos/repoDiscovery.d.ts +40 -0
  67. package/dist/monitoring/ownedRepos/repoDiscovery.d.ts.map +1 -0
  68. package/dist/monitoring/ownedRepos/repoDiscovery.js +157 -0
  69. package/dist/monitoring/ownedRepos/repoDiscovery.js.map +1 -0
  70. package/dist/monitoring/ownedRepos/repoGit.d.ts +14 -0
  71. package/dist/monitoring/ownedRepos/repoGit.d.ts.map +1 -0
  72. package/dist/monitoring/ownedRepos/repoGit.js +57 -0
  73. package/dist/monitoring/ownedRepos/repoGit.js.map +1 -0
  74. package/dist/monitoring/ownedRepos/repoInspect.d.ts +54 -0
  75. package/dist/monitoring/ownedRepos/repoInspect.d.ts.map +1 -0
  76. package/dist/monitoring/ownedRepos/repoInspect.js +174 -0
  77. package/dist/monitoring/ownedRepos/repoInspect.js.map +1 -0
  78. package/dist/monitoring/ownedRepos/wiring.d.ts +54 -0
  79. package/dist/monitoring/ownedRepos/wiring.d.ts.map +1 -0
  80. package/dist/monitoring/ownedRepos/wiring.js +112 -0
  81. package/dist/monitoring/ownedRepos/wiring.js.map +1 -0
  82. package/dist/native/InstarWedgeCanary.app/Contents/MacOS/InstarWedgeCanary +0 -0
  83. package/dist/native/instar-desktop-host +0 -0
  84. package/dist/server/AgentServer.d.ts +2 -0
  85. package/dist/server/AgentServer.d.ts.map +1 -1
  86. package/dist/server/AgentServer.js +3 -0
  87. package/dist/server/AgentServer.js.map +1 -1
  88. package/dist/server/CapabilityIndex.d.ts.map +1 -1
  89. package/dist/server/CapabilityIndex.js +9 -0
  90. package/dist/server/CapabilityIndex.js.map +1 -1
  91. package/dist/server/diskStewardRoutes.js +2 -2
  92. package/dist/server/diskStewardRoutes.js.map +1 -1
  93. package/dist/server/inboundCredentialNotice.d.ts +3 -0
  94. package/dist/server/inboundCredentialNotice.d.ts.map +1 -1
  95. package/dist/server/inboundCredentialNotice.js +8 -1
  96. package/dist/server/inboundCredentialNotice.js.map +1 -1
  97. package/dist/server/mobileConversationRoutes.d.ts +5 -0
  98. package/dist/server/mobileConversationRoutes.d.ts.map +1 -1
  99. package/dist/server/mobileConversationRoutes.js +11 -2
  100. package/dist/server/mobileConversationRoutes.js.map +1 -1
  101. package/dist/server/needsRoutes.d.ts.map +1 -1
  102. package/dist/server/needsRoutes.js +2 -0
  103. package/dist/server/needsRoutes.js.map +1 -1
  104. package/dist/server/ownedRepoRoutes.d.ts +43 -0
  105. package/dist/server/ownedRepoRoutes.d.ts.map +1 -0
  106. package/dist/server/ownedRepoRoutes.js +72 -0
  107. package/dist/server/ownedRepoRoutes.js.map +1 -0
  108. package/dist/server/routes.d.ts +10 -0
  109. package/dist/server/routes.d.ts.map +1 -1
  110. package/dist/server/routes.js +58 -2
  111. package/dist/server/routes.js.map +1 -1
  112. package/package.json +1 -1
  113. package/src/data/awareness/no-data-loss.md +6 -0
  114. package/src/data/builtin-manifest.json +47 -47
  115. package/src/data/feature-ladders.json +1 -0
  116. package/src/data/standards-guard-index.json +1 -1
  117. package/src/data/standards-guard-index.meta.json +2 -2
  118. package/src/data/standards-registry.meta.json +1 -1
  119. package/src/data/state-coherence-registry.json +19 -0
  120. package/upgrades/1.3.2014.md +25 -0
  121. package/upgrades/1.3.2015.md +30 -0
  122. package/upgrades/side-effects/no-data-loss-repo-registry.md +178 -0
  123. package/upgrades/side-effects/sec164-credential-scrub-1c.md +55 -0
@@ -0,0 +1,506 @@
1
+ /**
2
+ * OwnedRepoRegistry — every repository this agent creates or works in on this machine,
3
+ * with its remote status, its single-copy work and its age (increment 1 of
4
+ * docs/specs/no-data-loss-on-machine-death.md: §1.1–1.4 and §1.7, read-only).
5
+ *
6
+ * Why: on 2026-11-20 the Instar Apple app source and the Android app source were both
7
+ * local-only repositories with no remote, and were lost with the Mac Studio. Nothing
8
+ * listed them, so nothing said they existed only there.
9
+ *
10
+ * READ-ONLY. It never fetches, pushes, creates a remote or touches a working tree: every
11
+ * git call is a read through `readGit` (no optional locks, no fsmonitor). Homing is
12
+ * increment 2. This is a SIGNAL producer (docs/signal-vs-authority.md): it lists and it
13
+ * reports defects to the Needs-you list; it blocks and changes nothing.
14
+ *
15
+ * Discovery, in order of reliability (§1.3): registration at birth (SafeGitExecutor's
16
+ * `init` / `clone` observer), session evidence (hook-event working directories, queued
17
+ * and drained at a bounded rate), and a budgeted scan of the agent home, the project-map
18
+ * roots and declared roots, with a durable resume cursor.
19
+ */
20
+ import crypto from 'node:crypto';
21
+ import fs from 'node:fs';
22
+ import path from 'node:path';
23
+ import { inspectRepo, repoIdFor } from './repoInspect.js';
24
+ import { enclosingRepoRoot, isAllowedRoot, isExcludedPath, runScan } from './repoDiscovery.js';
25
+ import { bucket } from '../../core/OwnedRepoReplicatedStore.js';
26
+ const HOUR = 3_600_000;
27
+ const DAY = 24 * HOUR;
28
+ /** Spec §Defaults. */
29
+ export const OWNED_REPO_DEFAULTS = {
30
+ graceMs: DAY,
31
+ atRiskGraceMs: HOUR,
32
+ scanBudgetMs: 60_000,
33
+ scanMaxEntries: 200_000,
34
+ candidatesPerTick: 20,
35
+ candidateQueueCap: 500,
36
+ inspectEveryMs: 15 * 60_000,
37
+ passEveryMs: 6 * HOUR,
38
+ /** A completed pass at least this often, or the roots are `unknown` (and past it, a defect). */
39
+ completedPassFloorMs: 7 * DAY,
40
+ /** No first completed pass this long after enabling is a defect of its own ("could not check"). */
41
+ firstPassDefectMs: DAY,
42
+ maxRepos: 2000,
43
+ maxBirths: 500,
44
+ maxKnown: 20_000,
45
+ maxQueue: 50_000,
46
+ emitMinIntervalMs: 5 * 60_000,
47
+ tombstoneMs: 90 * DAY,
48
+ };
49
+ function emptyState(now) {
50
+ return { v: 1, enabledSince: now, minted: {}, births: [], candidates: [], candidateOverflow: 0, scan: { queue: [], known: [], passStartedAt: null, lastCompletedPassAt: null, entriesThisPass: 0, unreadable: [] }, repos: {}, emitted: {} };
51
+ }
52
+ const iso = (t) => (typeof t === 'number' && Number.isFinite(t) ? new Date(t).toISOString() : null);
53
+ function age(ms) {
54
+ const h = Math.floor(ms / HOUR);
55
+ if (h < 48)
56
+ return `${Math.max(1, h)} hour${h === 1 ? '' : 's'}`;
57
+ const d = Math.floor(ms / DAY);
58
+ return `${d} days`;
59
+ }
60
+ export class OwnedRepoRegistry {
61
+ deps;
62
+ state;
63
+ busy = false;
64
+ seenDirs = new Set();
65
+ now;
66
+ constructor(deps) {
67
+ this.deps = deps;
68
+ this.now = deps.now ?? (() => Date.now());
69
+ this.state = this.load();
70
+ }
71
+ // ── discovery inputs ────────────────────────────────────────────────
72
+ /** Registration at birth: an Instar funnel created or cloned a repository at `p` (§1.3 path 1). */
73
+ noteBirth(p, via) {
74
+ const abs = path.resolve(p);
75
+ if (isExcludedPath(abs, this.deps.userHome))
76
+ return;
77
+ if (!this.state.births.some((b) => b.path === abs)) {
78
+ this.state.births.push({ path: abs, at: this.now(), via: via.slice(0, 80) });
79
+ if (this.state.births.length > OWNED_REPO_DEFAULTS.maxBirths)
80
+ this.state.births.splice(0, this.state.births.length - OWNED_REPO_DEFAULTS.maxBirths);
81
+ this.persist();
82
+ }
83
+ }
84
+ /** Session evidence: a session worked at `p` (a working directory or a tool path) (§1.3 path 2). */
85
+ noteSessionPath(p) {
86
+ if (typeof p !== 'string' || !p || !path.isAbsolute(p))
87
+ return;
88
+ const abs = path.resolve(p);
89
+ // Deduplicate by enclosing directory: a session touches many files in one place.
90
+ const dir = path.dirname(abs);
91
+ if (this.seenDirs.has(dir))
92
+ return;
93
+ this.seenDirs.add(dir);
94
+ if (this.seenDirs.size > 5000)
95
+ this.seenDirs.clear();
96
+ if (!isAllowedRoot(abs, this.deps.userHome, this.deps.declaredRoots()))
97
+ return;
98
+ // A path inside a repository already known (or a worktree of one) adds nothing: only new roots are queued.
99
+ const root = enclosingRepoRoot(abs, this.deps.userHome, this.deps.declaredRoots());
100
+ if (!root)
101
+ return;
102
+ const main = mainWorktreeRoot(root);
103
+ if (this.state.repos[main] && !this.state.repos[main].goneAt)
104
+ return;
105
+ if (this.state.candidates.some((c) => c.path === main))
106
+ return;
107
+ if (this.state.candidates.length >= OWNED_REPO_DEFAULTS.candidateQueueCap) {
108
+ this.state.candidateOverflow += 1;
109
+ this.state.candidateOverflowAt = this.now();
110
+ return;
111
+ }
112
+ this.state.candidates.push({ path: main, at: this.now() });
113
+ }
114
+ // ── the tick ────────────────────────────────────────────────────────
115
+ /** One bounded pass: drain candidates, continue the scan, re-inspect what is due. Never throws. */
116
+ async tick() {
117
+ if (this.busy)
118
+ return;
119
+ this.busy = true;
120
+ const started = this.now();
121
+ const deadline = Date.now() + OWNED_REPO_DEFAULTS.scanBudgetMs;
122
+ // Each tick forgets the directories it has seen, so a folder that has become a repository since is noticed again.
123
+ this.seenDirs.clear();
124
+ try {
125
+ this.drainCandidates();
126
+ for (const b of this.state.births)
127
+ this.addRepo(b.path, 'birth');
128
+ await this.scanStep(deadline);
129
+ await this.inspectDue(deadline);
130
+ this.sweepGone();
131
+ this.emitChanged();
132
+ this.persist();
133
+ const st = this.status();
134
+ this.deps.log?.({ event: 'tick', ms: this.now() - started, repos: st.counts.repos, noRemote: st.counts.noRemote, withSingleCopy: st.counts.withSingleCopy, unknown: st.counts.unknown, defects: st.defects.map((d) => d.kind), scan: st.scan.state });
135
+ }
136
+ catch (e) {
137
+ this.deps.log?.({ event: 'tick-failed', error: e instanceof Error ? e.message : String(e) });
138
+ }
139
+ finally {
140
+ this.busy = false;
141
+ }
142
+ }
143
+ drainCandidates() {
144
+ const take = this.state.candidates.splice(0, OWNED_REPO_DEFAULTS.candidatesPerTick);
145
+ for (const c of take) {
146
+ const root = enclosingRepoRoot(c.path, this.deps.userHome, this.deps.declaredRoots());
147
+ if (root)
148
+ this.addRepo(root, 'session');
149
+ }
150
+ }
151
+ scanRoots() {
152
+ const declared = this.deps.declaredRoots();
153
+ const out = new Set([path.resolve(this.deps.agentHome)]);
154
+ for (const r of [...this.deps.roots(), ...declared]) {
155
+ const abs = path.resolve(r);
156
+ if (isAllowedRoot(abs, this.deps.userHome, declared) && fs.existsSync(abs))
157
+ out.add(abs);
158
+ }
159
+ return [...out];
160
+ }
161
+ async scanStep(deadline) {
162
+ const s = this.state.scan;
163
+ const now = this.now();
164
+ if (!s.queue.length) {
165
+ if (s.lastCompletedPassAt !== null && now - s.lastCompletedPassAt < OWNED_REPO_DEFAULTS.passEveryMs)
166
+ return;
167
+ s.queue = this.scanRoots().reverse().map((p) => ({ kind: 'root', path: p }));
168
+ s.known = [];
169
+ s.passStartedAt = now;
170
+ s.entriesThisPass = 0;
171
+ s.unreadable = [];
172
+ s.droppedThisPass = 0;
173
+ }
174
+ const known = new Set(s.known);
175
+ for (const r of Object.values(this.state.repos))
176
+ if (!r.goneAt)
177
+ for (const w of r.inspection?.worktrees ?? [])
178
+ if (path.resolve(w) !== path.resolve(r.root))
179
+ known.add(path.resolve(w));
180
+ const budget = { deadline, maxEntries: OWNED_REPO_DEFAULTS.scanMaxEntries, entries: 0 };
181
+ const done = await runScan(s.queue, budget, {
182
+ git: this.deps.git,
183
+ userHome: this.deps.userHome,
184
+ known,
185
+ onRepo: (root) => this.addRepo(root, 'scan'),
186
+ onUnreadable: (dir, why) => { if (s.unreadable.length < 200)
187
+ s.unreadable.push({ dir, why: why.slice(0, 160) }); },
188
+ });
189
+ s.entriesThisPass += budget.entries;
190
+ s.known = [...known].slice(-OWNED_REPO_DEFAULTS.maxKnown);
191
+ if (s.queue.length > OWNED_REPO_DEFAULTS.maxQueue) {
192
+ // Drop the newest (deepest) folders, never the roots at the front, and remember the pass is not whole.
193
+ const dropped = s.queue.length - OWNED_REPO_DEFAULTS.maxQueue;
194
+ s.queue.splice(OWNED_REPO_DEFAULTS.maxQueue);
195
+ s.droppedThisPass = (s.droppedThisPass ?? 0) + dropped;
196
+ }
197
+ // A pass that had to drop folders is not a completed pass: its roots stay unknown until a whole pass finishes.
198
+ if (done) {
199
+ if (!s.droppedThisPass)
200
+ s.lastCompletedPassAt = this.now();
201
+ s.queue = [];
202
+ }
203
+ }
204
+ /** The class of a repository at `root` (§1.1), or null when it belongs to another agent. */
205
+ classify(root) {
206
+ const abs = path.resolve(root);
207
+ const home = path.resolve(this.deps.agentHome);
208
+ if (abs === home)
209
+ return 'owned';
210
+ for (const other of this.deps.otherAgentHomes()) {
211
+ const o = path.resolve(other);
212
+ if (o === home || home.startsWith(o + path.sep))
213
+ continue;
214
+ if (abs === o || abs.startsWith(o + path.sep))
215
+ return null;
216
+ }
217
+ if (this.state.births.some((b) => b.path === abs))
218
+ return 'owned';
219
+ return 'candidate';
220
+ }
221
+ addRepo(root, via) {
222
+ const abs = mainWorktreeRoot(path.resolve(root));
223
+ if (isExcludedPath(abs, this.deps.userHome) || !fs.existsSync(abs))
224
+ return;
225
+ const cls = this.classify(abs);
226
+ if (!cls)
227
+ return;
228
+ const existing = this.state.repos[abs];
229
+ if (existing) {
230
+ existing.class = cls;
231
+ if (existing.goneAt)
232
+ existing.goneAt = null;
233
+ if (via === 'birth' || abs === path.resolve(this.deps.agentHome))
234
+ existing.via = abs === path.resolve(this.deps.agentHome) ? 'home' : via;
235
+ return;
236
+ }
237
+ if (Object.keys(this.state.repos).length >= OWNED_REPO_DEFAULTS.maxRepos)
238
+ return;
239
+ this.state.repos[abs] = { root: abs, repoId: this.mintedId(abs), class: cls, via: abs === path.resolve(this.deps.agentHome) ? 'home' : via, firstSeenAt: this.now(), inspectedAt: null, inspection: null, goneAt: null };
240
+ }
241
+ displayPath(abs) {
242
+ const home = path.resolve(this.deps.userHome);
243
+ return abs.startsWith(home + path.sep) ? `~/${path.relative(home, abs)}` : abs;
244
+ }
245
+ mintedId(abs) {
246
+ if (!this.state.minted[abs])
247
+ this.state.minted[abs] = crypto.createHash('sha256').update(`minted\u0000${crypto.randomUUID()}`).digest('hex');
248
+ return this.state.minted[abs];
249
+ }
250
+ async inspectDue(deadline) {
251
+ const due = Object.values(this.state.repos)
252
+ .filter((r) => !r.goneAt && (r.inspectedAt === null || this.now() - r.inspectedAt >= OWNED_REPO_DEFAULTS.inspectEveryMs))
253
+ .sort((a, b) => (a.inspectedAt ?? 0) - (b.inspectedAt ?? 0));
254
+ const seenCommon = new Map();
255
+ for (const r of Object.values(this.state.repos))
256
+ if (!r.goneAt && r.inspection?.commonDir)
257
+ seenCommon.set(r.inspection.commonDir, r.root);
258
+ for (const r of due) {
259
+ if (Date.now() > deadline)
260
+ break;
261
+ if (!fs.existsSync(r.root)) {
262
+ r.goneAt = this.now();
263
+ continue;
264
+ }
265
+ const ins = await inspectRepo(r.root, this.deps.git, { deadline });
266
+ // One record per object store: a second root on the same store (a worktree found by another path) folds into the first.
267
+ const holder = ins.commonDir ? seenCommon.get(ins.commonDir) : undefined;
268
+ if (holder && holder !== r.root && this.state.repos[holder] && !this.state.repos[holder].goneAt) {
269
+ delete this.state.repos[r.root];
270
+ continue;
271
+ }
272
+ if (ins.commonDir)
273
+ seenCommon.set(ins.commonDir, r.root);
274
+ r.inspection = ins;
275
+ r.inspectedAt = this.now();
276
+ r.unknownSince = ins.state === 'unknown' ? (r.unknownSince ?? this.now()) : null;
277
+ if (ins.rootCommit) {
278
+ const id = repoIdFor(ins.rootCommit, this.displayPath(r.root));
279
+ // An empty repository's minted id gives way to the real one: tell peers the old record is gone.
280
+ if (id !== r.repoId && this.state.emitted[r.repoId] && this.deps.emit) {
281
+ try {
282
+ this.deps.emit({ ...this.replica(r), gone: true });
283
+ }
284
+ catch { /* @silent-fallback-ok — the old record ages out by retention */ }
285
+ delete this.state.emitted[r.repoId];
286
+ }
287
+ r.repoId = id;
288
+ }
289
+ }
290
+ }
291
+ sweepGone() {
292
+ for (const [k, r] of Object.entries(this.state.repos)) {
293
+ if (!r.goneAt && !fs.existsSync(r.root))
294
+ r.goneAt = this.now();
295
+ if (r.goneAt && this.now() - r.goneAt > OWNED_REPO_DEFAULTS.tombstoneMs) {
296
+ delete this.state.repos[k];
297
+ delete this.state.emitted[r.repoId];
298
+ }
299
+ }
300
+ }
301
+ // ── views ───────────────────────────────────────────────────────────
302
+ graceMs() {
303
+ let risky = false;
304
+ try {
305
+ risky = this.deps.atRisk?.() === true;
306
+ }
307
+ catch {
308
+ risky = false;
309
+ } // @silent-fallback-ok — no risk signal means the normal window
310
+ return risky ? OWNED_REPO_DEFAULTS.atRiskGraceMs : OWNED_REPO_DEFAULTS.graceMs;
311
+ }
312
+ pastGrace(r) {
313
+ const ins = r.inspection;
314
+ if (!ins || ins.state !== 'ok' || !ins.singleCopy.commits || ins.singleCopy.oldestAt === null)
315
+ return false;
316
+ return this.now() - ins.singleCopy.oldestAt >= this.graceMs();
317
+ }
318
+ view(r) {
319
+ const ins = r.inspection;
320
+ return {
321
+ repoId: r.repoId,
322
+ machineId: this.deps.machineId,
323
+ path: r.root,
324
+ displayPath: this.displayPath(r.root),
325
+ class: r.class,
326
+ via: r.via,
327
+ worktrees: ins?.worktrees.length ?? 0,
328
+ remotes: ins?.remotes ?? [],
329
+ hasOffMachineRemote: (ins?.remotes ?? []).some((x) => x.offMachine),
330
+ singleCopy: { commits: ins?.singleCopy.commits ?? 0, branches: ins?.singleCopy.branches ?? 0, oldestAt: iso(ins?.singleCopy.oldestAt), branchNames: ins?.singleCopy.branchNames ?? [] },
331
+ uncommitted: { worktrees: ins?.uncommitted.worktrees ?? 0, files: ins?.uncommitted.files ?? 0, bytes: ins?.uncommitted.bytes ?? 0, oldestAt: iso(ins?.uncommitted.oldestAt), complete: ins?.uncommitted.complete ?? false },
332
+ home: { mirror: null, remoteBackup: null },
333
+ state: ins ? ins.state : 'unknown',
334
+ ...(ins?.error ? { error: ins.error } : {}),
335
+ inspectedAt: iso(r.inspectedAt),
336
+ unknownSince: iso(r.unknownSince ?? (ins ? null : r.firstSeenAt)),
337
+ pastGrace: this.pastGrace(r),
338
+ };
339
+ }
340
+ replica(r) {
341
+ const v = this.view(r);
342
+ return {
343
+ repoId: r.repoId, machineId: this.deps.machineId, displayPath: v.displayPath, class: r.class,
344
+ remotes: v.remotes.slice(0, 20).map((x) => ({ name: x.name, host: x.host, ownerAccount: x.ownerAccount, offMachine: x.offMachine })),
345
+ singleCopy: v.singleCopy.commits > 0,
346
+ singleCopyCommitsBucket: bucket(v.singleCopy.commits),
347
+ singleCopyBranchesBucket: bucket(v.singleCopy.branches),
348
+ uncommitted: v.uncommitted.files > 0,
349
+ pastGrace: v.pastGrace,
350
+ state: v.state,
351
+ gone: r.goneAt !== null,
352
+ };
353
+ }
354
+ /** Emit records whose replicated fields changed: at once in the unsafe direction, else at most once per 5 min (§0). */
355
+ emitChanged() {
356
+ if (!this.deps.emit)
357
+ return;
358
+ for (const r of Object.values(this.state.repos)) {
359
+ if (!r.inspection && !r.goneAt)
360
+ continue;
361
+ const rep = this.replica(r);
362
+ const sig = JSON.stringify(rep);
363
+ const prev = this.state.emitted[r.repoId];
364
+ if (prev && prev.sig === sig)
365
+ continue;
366
+ const prevRep = prev ? JSON.parse(prev.sig) : null;
367
+ const unsafe = !prevRep || (rep.singleCopy && !prevRep.singleCopy) || (rep.gone && !prevRep.gone) || (rep.pastGrace && !prevRep.pastGrace) || (rep.state === 'unknown' && prevRep.state !== 'unknown');
368
+ if (!unsafe && prev && this.now() - prev.at < OWNED_REPO_DEFAULTS.emitMinIntervalMs)
369
+ continue;
370
+ try {
371
+ this.deps.emit(rep);
372
+ this.state.emitted[r.repoId] = { sig, at: this.now() };
373
+ }
374
+ catch (e) {
375
+ this.deps.log?.({ event: 'emit-failed', error: e instanceof Error ? e.message : String(e) });
376
+ }
377
+ }
378
+ }
379
+ status() {
380
+ const now = this.now();
381
+ const live = Object.values(this.state.repos).filter((r) => !r.goneAt);
382
+ const repos = live.map((r) => this.view(r)).sort((a, b) => a.displayPath.localeCompare(b.displayPath));
383
+ const s = this.state.scan;
384
+ return {
385
+ machineId: this.deps.machineId,
386
+ machineName: this.deps.machineName(),
387
+ generatedAt: new Date(now).toISOString(),
388
+ graceHours: Math.round(this.graceMs() / HOUR),
389
+ scan: {
390
+ state: s.queue.length ? (s.lastCompletedPassAt === null ? 'never-completed' : 'in-progress') : s.lastCompletedPassAt === null ? 'never-completed' : 'complete',
391
+ lastCompletedPassAt: iso(s.lastCompletedPassAt), passStartedAt: iso(s.passStartedAt), queued: s.queue.length,
392
+ entriesThisPass: s.entriesThisPass, unreadable: s.unreadable.length, roots: this.scanRoots().map((p) => this.displayPath(p)),
393
+ },
394
+ candidatesQueued: this.state.candidates.length,
395
+ candidateOverflow: this.state.candidateOverflow,
396
+ counts: {
397
+ repos: repos.length,
398
+ owned: repos.filter((r) => r.class === 'owned').length,
399
+ candidate: repos.filter((r) => r.class === 'candidate').length,
400
+ noRemote: repos.filter((r) => r.state === 'ok' && !r.hasOffMachineRemote).length,
401
+ withSingleCopy: repos.filter((r) => r.singleCopy.commits > 0).length,
402
+ unknown: repos.filter((r) => r.state === 'unknown').length,
403
+ },
404
+ repos,
405
+ defects: defectsFor(this.deps.machineId, this.deps.machineName(), repos, { now, enabledSince: this.state.enabledSince, lastCompletedPassAt: s.lastCompletedPassAt, candidateOverflowAt: this.state.candidateOverflowAt ?? null }),
406
+ };
407
+ }
408
+ // ── persistence ─────────────────────────────────────────────────────
409
+ load() {
410
+ try {
411
+ const raw = JSON.parse(fs.readFileSync(this.deps.stateFile, 'utf8'));
412
+ if (raw && raw.v === 1 && raw.repos && raw.scan)
413
+ return { ...emptyState(this.now()), ...raw, scan: { ...emptyState(this.now()).scan, ...raw.scan } };
414
+ }
415
+ catch { /* @silent-fallback-ok — no state yet (first run) or unreadable: start a fresh registry; the scan rebuilds it */ }
416
+ return emptyState(this.now());
417
+ }
418
+ persist() {
419
+ try {
420
+ fs.mkdirSync(path.dirname(this.deps.stateFile), { recursive: true });
421
+ const tmp = `${this.deps.stateFile}.next`;
422
+ /* state-registry: owned-repo-registry */
423
+ fs.writeFileSync(tmp, JSON.stringify(this.state));
424
+ fs.renameSync(tmp, this.deps.stateFile);
425
+ }
426
+ catch (e) {
427
+ this.deps.log?.({ event: 'persist-failed', error: e instanceof Error ? e.message : String(e) });
428
+ }
429
+ }
430
+ }
431
+ /**
432
+ * A linked worktree's `.git` is a file pointing into the main repository's `.git/worktrees/<name>`;
433
+ * the registry keeps one record per object store, under the main working root. Pure file reads.
434
+ */
435
+ export function mainWorktreeRoot(root) {
436
+ try {
437
+ const dotGit = path.join(root, '.git');
438
+ if (!fs.lstatSync(dotGit).isFile())
439
+ return root;
440
+ const m = /^gitdir:\s*(.+)$/m.exec(fs.readFileSync(dotGit, 'utf8').slice(0, 4096));
441
+ if (!m)
442
+ return root;
443
+ const gitdir = path.resolve(root, m[1].trim());
444
+ const common = fs.readFileSync(path.join(gitdir, 'commondir'), 'utf8').trim();
445
+ const commonDir = path.resolve(gitdir, common);
446
+ return path.basename(commonDir) === '.git' && fs.existsSync(path.dirname(commonDir)) ? path.dirname(commonDir) : root;
447
+ }
448
+ catch {
449
+ return root;
450
+ } // @silent-fallback-ok — not a linked worktree (or unreadable): keep the path as found
451
+ }
452
+ /**
453
+ * The aggregated defects for one machine (§1.4): one row per kind of problem, never one per
454
+ * repository or branch. Pure, so the pool read can apply it to a peer's repositories too.
455
+ */
456
+ export function defectsFor(machineId, machineName, repos, scan) {
457
+ const out = [];
458
+ const name = machineName || machineId.slice(0, 12);
459
+ const shortList = (xs) => (xs.length <= 3 ? xs.join(', ') : `${xs.slice(0, 3).join(', ')} and ${xs.length - 3} more`);
460
+ const oldest = (xs) => xs.map((r) => (r.singleCopy.oldestAt ? Date.parse(r.singleCopy.oldestAt) : NaN)).filter(Number.isFinite).sort((a, b) => a - b)[0] ?? null;
461
+ const noRemote = repos.filter((r) => r.state === 'ok' && !r.hasOffMachineRemote && r.pastGrace);
462
+ if (noRemote.length) {
463
+ const o = oldest(noRemote);
464
+ out.push({
465
+ key: `repos:no-remote:${machineId}`, kind: 'no-remote', machineId, machineName: name, count: noRemote.length,
466
+ repos: noRemote.map((r) => r.displayPath), oldestAt: o ? new Date(o).toISOString() : null,
467
+ title: `${noRemote.length === 1 ? 'A repository' : `${noRemote.length} repositories`} on ${name} exist${noRemote.length === 1 ? 's' : ''} only on that machine`,
468
+ detail: `${shortList(noRemote.map((r) => r.displayPath))} ${noRemote.length === 1 ? 'has' : 'have'} no copy anywhere else (no remote)${o ? `, oldest work ${age(scan.now - o)} old` : ''}. If ${name} is lost, this work is lost with it.`,
469
+ });
470
+ }
471
+ const unpushed = repos.filter((r) => r.state === 'ok' && r.hasOffMachineRemote && r.pastGrace && r.singleCopy.branches > 0);
472
+ if (unpushed.length) {
473
+ const branches = unpushed.reduce((n, r) => n + r.singleCopy.branches, 0);
474
+ const o = oldest(unpushed);
475
+ out.push({
476
+ key: `repos:unpushed:${machineId}`, kind: 'unpushed', machineId, machineName: name, count: branches,
477
+ repos: unpushed.map((r) => r.displayPath), oldestAt: o ? new Date(o).toISOString() : null,
478
+ title: `${branches} branch${branches === 1 ? '' : 'es'} on ${name} ${branches === 1 ? 'has' : 'have'} no copy anywhere else${o ? `, oldest ${age(scan.now - o)}` : ''}`,
479
+ detail: `Unpushed work in ${shortList(unpushed.map((r) => r.displayPath))}. It exists only on ${name}.`,
480
+ });
481
+ }
482
+ // Unknown is never healthy, but only unknown PAST the check's window is a defect (§0).
483
+ const unknown = repos.filter((r) => r.state === 'unknown' && (!r.unknownSince || scan.now - Date.parse(r.unknownSince) >= DAY));
484
+ const neverChecked = scan.lastCompletedPassAt === null && scan.now - scan.enabledSince >= OWNED_REPO_DEFAULTS.firstPassDefectMs;
485
+ const staleScan = scan.lastCompletedPassAt !== null && scan.now - scan.lastCompletedPassAt >= OWNED_REPO_DEFAULTS.completedPassFloorMs;
486
+ // Session evidence that overflowed its queue in the last day: places sessions worked that were not checked.
487
+ const overflowed = typeof scan.candidateOverflowAt === 'number' && scan.now - scan.candidateOverflowAt < DAY;
488
+ if (overflowed && !neverChecked && !staleScan && !unknown.length) {
489
+ out.push({
490
+ key: `repos:unknown:${machineId}`, kind: 'unknown', machineId, machineName: name, count: 0, repos: [], oldestAt: null,
491
+ title: `I could not check every place sessions worked on ${name}`,
492
+ detail: 'More new folders came up than I can check at once, so a repository outside my usual folders may not be listed yet. I keep working through them.',
493
+ });
494
+ }
495
+ if (neverChecked || staleScan || unknown.length) {
496
+ const since = scan.lastCompletedPassAt ?? scan.enabledSince;
497
+ out.push({
498
+ key: `repos:unknown:${machineId}`, kind: 'unknown', machineId, machineName: name, count: unknown.length,
499
+ repos: unknown.map((r) => r.displayPath), oldestAt: null,
500
+ title: neverChecked || staleScan ? `I could not finish checking the repositories on ${name} for ${age(scan.now - since)}` : `I could not read ${unknown.length === 1 ? 'a repository' : `${unknown.length} repositories`} on ${name}`,
501
+ detail: unknown.length ? `Not readable: ${shortList(unknown.map((r) => r.displayPath))}. Until I can read them I cannot say whether their work exists anywhere else.` : 'Until the check finishes I cannot say whether every repository there has a copy somewhere else.',
502
+ });
503
+ }
504
+ return out;
505
+ }
506
+ //# sourceMappingURL=OwnedRepoRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OwnedRepoRegistry.js","sourceRoot":"","sources":["../../../src/monitoring/ownedRepos/OwnedRepoRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAwC,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,OAAO,EAAiB,MAAM,oBAAoB,CAAC;AAC9G,OAAO,EAAE,MAAM,EAAyB,MAAM,wCAAwC,CAAC;AAEvF,MAAM,IAAI,GAAG,SAAS,CAAC;AACvB,MAAM,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC;AAEtB,sBAAsB;AACtB,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,OAAO,EAAE,GAAG;IACZ,aAAa,EAAE,IAAI;IACnB,YAAY,EAAE,MAAM;IACpB,cAAc,EAAE,OAAO;IACvB,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YAAY,IAAI,SAAS,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QAChD,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,IAAI,IAAI,CAAC,YAAY,CAAC;QAC5D,GAAG,CAAC,IAAI,CAAC;YACP,GAAG,EAAE,iBAAiB,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM;YACvG,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,IAAI;YACxD,KAAK,EAAE,YAAY,IAAI,SAAS,CAAC,CAAC,CAAC,mDAAmD,IAAI,QAAQ,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,oBAAoB,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,eAAe,OAAO,IAAI,EAAE;YACrO,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,+EAA+E,CAAC,CAAC,CAAC,iGAAiG;SAC1Q,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { GitReader } from './repoGit.js';
2
+ /** Directories that are regenerable (the reaper's own classes): pruned, never descended. */
3
+ export declare const REGENERABLE_DIR_NAMES: ReadonlySet<string>;
4
+ export type ScanItem = {
5
+ kind: 'root' | 'repo' | 'descend';
6
+ path: string;
7
+ };
8
+ /** Paths no discovery path may ever take (§1.3): peer copies, the drill, temp and scratch roots. */
9
+ export declare function isExcludedPath(p: string, userHome: string): boolean;
10
+ /** A discovery root is allowed only inside the user's home (never the home itself or above), or a declared root. */
11
+ export declare function isAllowedRoot(p: string, userHome: string, declared: readonly string[]): boolean;
12
+ /** The untracked and ignored directories git reports at a repository root (two queries). */
13
+ export declare function gitUntrackedDirs(repoRoot: string, git: GitReader): Promise<{
14
+ ok: boolean;
15
+ dirs: string[];
16
+ error?: string;
17
+ }>;
18
+ export interface ScanBudget {
19
+ deadline: number;
20
+ maxEntries: number;
21
+ entries: number;
22
+ }
23
+ export interface ScanContext {
24
+ git: GitReader;
25
+ userHome: string;
26
+ /** Worktree and repository paths already known (pruned from descent). */
27
+ known: Set<string>;
28
+ /** Called for each repository working root found. */
29
+ onRepo: (root: string) => void;
30
+ /** Directories that could not be read this pass (reported, never "no repositories"). */
31
+ onUnreadable: (dir: string, why: string) => void;
32
+ }
33
+ /**
34
+ * Process the work queue in place until it is empty or the budget runs out.
35
+ * Returns true when the queue emptied (the pass completed).
36
+ */
37
+ export declare function runScan(queue: ScanItem[], budget: ScanBudget, ctx: ScanContext): Promise<boolean>;
38
+ /** The repository root that encloses `p` (walking up, never above the allowed roots), or null. */
39
+ export declare function enclosingRepoRoot(p: string, userHome: string, declared: readonly string[]): string | null;
40
+ //# sourceMappingURL=repoDiscovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repoDiscovery.d.ts","sourceRoot":"","sources":["../../../src/monitoring/ownedRepos/repoDiscovery.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,4FAA4F;AAC5F,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAGpD,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3E,oGAAoG;AACpG,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,Q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