instar 1.3.2014 → 1.3.2016

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 (105) 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 +88 -2
  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/DesktopHelperPermissionNotice.d.ts.map +1 -1
  14. package/dist/core/DesktopHelperPermissionNotice.js +3 -1
  15. package/dist/core/DesktopHelperPermissionNotice.js.map +1 -1
  16. package/dist/core/DesktopProbeReadiness.d.ts.map +1 -1
  17. package/dist/core/DesktopProbeReadiness.js +9 -4
  18. package/dist/core/DesktopProbeReadiness.js.map +1 -1
  19. package/dist/core/OwnedRepoReplicatedStore.d.ts +39 -0
  20. package/dist/core/OwnedRepoReplicatedStore.d.ts.map +1 -0
  21. package/dist/core/OwnedRepoReplicatedStore.js +104 -0
  22. package/dist/core/OwnedRepoReplicatedStore.js.map +1 -0
  23. package/dist/core/ReplicatedStoreReconcilerWiring.d.ts.map +1 -1
  24. package/dist/core/ReplicatedStoreReconcilerWiring.js +1 -0
  25. package/dist/core/ReplicatedStoreReconcilerWiring.js.map +1 -1
  26. package/dist/core/SafeGitExecutor.d.ts +5 -0
  27. package/dist/core/SafeGitExecutor.d.ts.map +1 -1
  28. package/dist/core/SafeGitExecutor.js +53 -1
  29. package/dist/core/SafeGitExecutor.js.map +1 -1
  30. package/dist/core/devGatedFeatures.d.ts.map +1 -1
  31. package/dist/core/devGatedFeatures.js +6 -0
  32. package/dist/core/devGatedFeatures.js.map +1 -1
  33. package/dist/data/standards-guard-index.json +1 -1
  34. package/dist/data/standards-guard-index.meta.json +2 -2
  35. package/dist/data/standards-registry.meta.json +1 -1
  36. package/dist/messaging/NotificationSelectivityGate.d.ts +12 -0
  37. package/dist/messaging/NotificationSelectivityGate.d.ts.map +1 -1
  38. package/dist/messaging/NotificationSelectivityGate.js +33 -8
  39. package/dist/messaging/NotificationSelectivityGate.js.map +1 -1
  40. package/dist/monitoring/DiskSteward.d.ts +2 -1
  41. package/dist/monitoring/DiskSteward.d.ts.map +1 -1
  42. package/dist/monitoring/DiskSteward.js +12 -2
  43. package/dist/monitoring/DiskSteward.js.map +1 -1
  44. package/dist/monitoring/DiskStewardPoster.d.ts +4 -0
  45. package/dist/monitoring/DiskStewardPoster.d.ts.map +1 -1
  46. package/dist/monitoring/DiskStewardPoster.js +15 -4
  47. package/dist/monitoring/DiskStewardPoster.js.map +1 -1
  48. package/dist/monitoring/diskSteward/wiring.d.ts +2 -0
  49. package/dist/monitoring/diskSteward/wiring.d.ts.map +1 -1
  50. package/dist/monitoring/diskSteward/wiring.js +1 -1
  51. package/dist/monitoring/diskSteward/wiring.js.map +1 -1
  52. package/dist/monitoring/ownedRepos/OwnedRepoRegistry.d.ts +179 -0
  53. package/dist/monitoring/ownedRepos/OwnedRepoRegistry.d.ts.map +1 -0
  54. package/dist/monitoring/ownedRepos/OwnedRepoRegistry.js +506 -0
  55. package/dist/monitoring/ownedRepos/OwnedRepoRegistry.js.map +1 -0
  56. package/dist/monitoring/ownedRepos/repoDiscovery.d.ts +40 -0
  57. package/dist/monitoring/ownedRepos/repoDiscovery.d.ts.map +1 -0
  58. package/dist/monitoring/ownedRepos/repoDiscovery.js +157 -0
  59. package/dist/monitoring/ownedRepos/repoDiscovery.js.map +1 -0
  60. package/dist/monitoring/ownedRepos/repoGit.d.ts +14 -0
  61. package/dist/monitoring/ownedRepos/repoGit.d.ts.map +1 -0
  62. package/dist/monitoring/ownedRepos/repoGit.js +57 -0
  63. package/dist/monitoring/ownedRepos/repoGit.js.map +1 -0
  64. package/dist/monitoring/ownedRepos/repoInspect.d.ts +54 -0
  65. package/dist/monitoring/ownedRepos/repoInspect.d.ts.map +1 -0
  66. package/dist/monitoring/ownedRepos/repoInspect.js +174 -0
  67. package/dist/monitoring/ownedRepos/repoInspect.js.map +1 -0
  68. package/dist/monitoring/ownedRepos/wiring.d.ts +54 -0
  69. package/dist/monitoring/ownedRepos/wiring.d.ts.map +1 -0
  70. package/dist/monitoring/ownedRepos/wiring.js +112 -0
  71. package/dist/monitoring/ownedRepos/wiring.js.map +1 -0
  72. package/dist/native/InstarWedgeCanary.app/Contents/MacOS/InstarWedgeCanary +0 -0
  73. package/dist/native/instar-desktop-host +0 -0
  74. package/dist/server/AgentServer.d.ts +2 -0
  75. package/dist/server/AgentServer.d.ts.map +1 -1
  76. package/dist/server/AgentServer.js +1 -0
  77. package/dist/server/AgentServer.js.map +1 -1
  78. package/dist/server/CapabilityIndex.d.ts.map +1 -1
  79. package/dist/server/CapabilityIndex.js +9 -0
  80. package/dist/server/CapabilityIndex.js.map +1 -1
  81. package/dist/server/diskStewardRoutes.js +2 -2
  82. package/dist/server/diskStewardRoutes.js.map +1 -1
  83. package/dist/server/needsRoutes.d.ts.map +1 -1
  84. package/dist/server/needsRoutes.js +2 -0
  85. package/dist/server/needsRoutes.js.map +1 -1
  86. package/dist/server/ownedRepoRoutes.d.ts +43 -0
  87. package/dist/server/ownedRepoRoutes.d.ts.map +1 -0
  88. package/dist/server/ownedRepoRoutes.js +72 -0
  89. package/dist/server/ownedRepoRoutes.js.map +1 -0
  90. package/dist/server/routes.d.ts +2 -0
  91. package/dist/server/routes.d.ts.map +1 -1
  92. package/dist/server/routes.js +2 -0
  93. package/dist/server/routes.js.map +1 -1
  94. package/package.json +1 -1
  95. package/src/data/awareness/no-data-loss.md +6 -0
  96. package/src/data/builtin-manifest.json +47 -47
  97. package/src/data/feature-ladders.json +1 -0
  98. package/src/data/standards-guard-index.json +1 -1
  99. package/src/data/standards-guard-index.meta.json +2 -2
  100. package/src/data/standards-registry.meta.json +1 -1
  101. package/src/data/state-coherence-registry.json +19 -0
  102. package/upgrades/1.3.2015.md +30 -0
  103. package/upgrades/1.3.2016.md +21 -0
  104. package/upgrades/side-effects/desktop-first-grant-wording.md +23 -0
  105. package/upgrades/side-effects/no-data-loss-repo-registry.md +178 -0
@@ -18,6 +18,7 @@ import { NEED_SOURCES, surfacedNeeds } from './needs-model.js';
18
18
  import { renderPromises, topicLink } from './promises.js';
19
19
  import { renderMachines } from './machines.js';
20
20
  import { renderMachineCare } from './machine-care.js';
21
+ import { renderRepos } from './repos.js';
21
22
  import { renderHealth } from './health.js';
22
23
  import { renderAccounts } from './accounts.js';
23
24
  import { renderMessages } from './messages.js';
@@ -753,6 +754,7 @@ const NATIVE = {
753
754
  'work/documents': renderDocuments,
754
755
  'capacity/machines': renderMachines,
755
756
  'capacity/machine-care': renderMachineCare,
757
+ 'capacity/repos': renderRepos,
756
758
  'capacity/health': renderHealth,
757
759
  'capacity/accounts': renderAccounts,
758
760
  'capacity/costs': renderCosts,
@@ -58,6 +58,7 @@ export const GROUPS = [
58
58
  tabs: [
59
59
  { id: 'machines', label: 'Machines', icon: 'server', desc: 'Each machine’s health, which one leads, and how they reach each other.' },
60
60
  { id: 'machine-care', label: 'Machine care', icon: 'heart', desc: 'Weekly clean restarts: sign a machine up, skip one, change the hours, or restart it now.' },
61
+ { id: 'repos', label: 'Repositories', icon: 'folder', desc: 'Every repository I work in, on every machine, and whether its work has a copy anywhere else.' },
61
62
  { id: 'systems', label: 'Health', icon: 'heart', desc: 'Whether each of my subsystems is working.' },
62
63
  { id: 'subscriptions', label: 'Accounts', icon: 'key', desc: 'Subscriptions and sign-ins: usage left before reset, and fixing a sign-in from your phone.' },
63
64
  { id: 'resources', label: 'Resource usage', icon: 'cpu', desc: 'CPU and memory for the server and every session.' },
@@ -107,7 +108,7 @@ export function allTabIds() {
107
108
 
108
109
  /** Features rebuilt natively in the console, by legacy tab id. */
109
110
  /** Tiles with no legacy dashboard tab: new pages are built in the console only. */
110
- export const CONSOLE_ONLY_TABS = ['reach', 'chats', 'context', 'work-board', 'documents', 'machine-care'];
111
+ export const CONSOLE_ONLY_TABS = ['reach', 'chats', 'context', 'work-board', 'documents', 'machine-care', 'repos'];
111
112
 
112
113
  export const NATIVE_PAGES = {
113
114
  commitments: '#/work/promises',
@@ -123,6 +124,7 @@ export const NATIVE_PAGES = {
123
124
  blockers: '#/work/plans?s=in-the-way',
124
125
  machines: '#/capacity/machines',
125
126
  'machine-care': '#/capacity/machine-care',
127
+ repos: '#/capacity/repos',
126
128
  systems: '#/capacity/health',
127
129
  subscriptions: '#/capacity/accounts',
128
130
  spend: '#/capacity/costs',
@@ -187,6 +189,7 @@ export const PHONE_PAGE_ALIASES = {
187
189
  pace: 'work/pace',
188
190
  machines: 'capacity/machines',
189
191
  'machine-care': 'capacity/machine-care',
192
+ repos: 'capacity/repos',
190
193
  health: 'capacity/health',
191
194
  accounts: 'capacity/accounts',
192
195
  costs: 'capacity/costs',
@@ -262,7 +265,7 @@ export function doorOf(path) {
262
265
  export const NATIVE_PATHS = [
263
266
  'work/conversations', 'work/promises', 'work/plans', 'work/plans/in-the-way', 'work/schedule', 'work/development',
264
267
  'work/maturation', 'work/ideas', 'work/board', 'work/sessions', 'work/chats', 'work/documents',
265
- 'capacity/machines', 'capacity/machine-care', 'capacity/health', 'capacity/accounts', 'capacity/costs',
268
+ 'capacity/machines', 'capacity/machine-care', 'capacity/repos', 'capacity/health', 'capacity/accounts', 'capacity/costs',
266
269
  'people/messages', 'people/notifications', 'people/agents', 'people/reach', 'people/mandates', 'people/secrets',
267
270
  'settings/allowed', 'settings/learned', 'settings/inside', 'settings/files', 'settings/context',
268
271
  ];
@@ -15,6 +15,7 @@ import { healthNeedRows } from './health-model.js';
15
15
  import { proposalsNeedingVerdict, buildPending } from './learned-model.js';
16
16
  import { contextNeeds } from './context-model.js';
17
17
  import { workBoardNeedRows } from './work-model.js';
18
+ import { repoNeedRows, REPOS_READ } from './repos-model.js';
18
19
 
19
20
  // warning-path: inline
20
21
  const row = (key, main, sub, href, refs = []) => ({ key: `need:${key}`, main, sub: sub || '', tone: 'attn', refs, action: { kind: 'href', href } });
@@ -104,6 +105,11 @@ export const NEED_SOURCES = [
104
105
  // First, so a real problem leads the Needs-you list. Only what affects the person. Internal notes stay on the Health page and never raise this count.
105
106
  { id: 'health', page: 'capacity/health', reads: { issues: '/mobile/health-issues' },
106
107
  rows: ({ issues }) => { const rows = healthNeedRows(issues); return rows === null ? UNREADABLE : rows.map((r) => row(`health:${r.key}`, r.title, r.detail, r.href)); } },
108
+ // Work that exists on only one machine (no-data-loss-on-machine-death.md §1.4): a repository with no remote, or
109
+ // unpushed work past the grace window. One row per machine per kind. 503 = the registry is off here = nothing waiting.
110
+ { id: 'repos', page: 'capacity/repos', reads: { repos: REPOS_READ },
111
+ // warning-path: inline
112
+ rows: ({ repos }) => { const rows = repoNeedRows(repos); return rows === null ? UNREADABLE : rows.map((r) => ({ ...row(r.key, r.main, r.sub, r.href, r.refs), tone: r.kind === 'unknown' ? 'unknown' : 'bad' })); } },
107
113
  { id: 'merging', page: 'work/development', reads: { watcher: '/green-pr-automerge' },
108
114
  rows: ({ watcher }, now) => {
109
115
  if (agentOwnedStop(watcher.data)) return []; // the agent releases this itself; the page still shows it
@@ -0,0 +1,83 @@
1
+ // The Repositories page model (docs/specs/no-data-loss-on-machine-death.md §1.4, §1.7). Pure: it reads
2
+ // nothing itself and touches no DOM. One answer (GET /repos?scope=pool) feeds both this page and the
3
+ // Needs-you list (needs-model.js), so the two cannot disagree.
4
+
5
+ import { sourceState } from './development-model.js';
6
+
7
+ export const REPOS_PAGE = '#/capacity/repos';
8
+ export const REPOS_READ = '/repos?scope=pool';
9
+
10
+ const KIND_ORDER = { 'no-remote': 0, unpushed: 1, unknown: 2 };
11
+
12
+ /** What to ask the agent for one defect: plain words, carried in the ask link. */
13
+ export function defectAsk(d) {
14
+ if (!d || typeof d !== 'object') return '';
15
+ if (d.kind === 'no-remote') return `Make sure these repositories on ${d.machineName} have a copy off that machine: ${(d.repos || []).slice(0, 5).join(', ')}`;
16
+ if (d.kind === 'unpushed') return `Copy the unpushed branches on ${d.machineName} somewhere off that machine`;
17
+ return `Why can't you check the repositories on ${d.machineName}?`;
18
+ }
19
+
20
+ export function askHref(d) {
21
+ return `#/work/sessions?ask=${encodeURIComponent(defectAsk(d))}`;
22
+ }
23
+
24
+ function validDefect(d) {
25
+ return d && typeof d === 'object' && typeof d.key === 'string' && /^repos:(no-remote|unpushed|unknown):/.test(d.key)
26
+ && typeof d.title === 'string' && typeof d.machineId === 'string';
27
+ }
28
+
29
+ /**
30
+ * Needs-you rows: one per defect (aggregated per machine per kind on the server). A 503 = the
31
+ * registry is switched off here = nothing waiting; any other failure or a 200 of the wrong shape
32
+ * is unreadable (null), never "nothing waiting".
33
+ */
34
+ export function repoNeedRows(res) {
35
+ if (!res) return null;
36
+ if (!res.ok) return sourceState(res) === 'off' ? [] : null;
37
+ const d = res.data;
38
+ if (!d || typeof d !== 'object' || !Array.isArray(d.defects)) return null;
39
+ return d.defects.filter(validDefect)
40
+ .sort((a, b) => (KIND_ORDER[a.kind] ?? 9) - (KIND_ORDER[b.kind] ?? 9))
41
+ .map((x) => ({ key: x.key, machineName: typeof x.machineName === 'string' ? x.machineName : '', main: x.title, sub: typeof x.detail === 'string' ? x.detail : '', kind: x.kind, href: `${REPOS_PAGE}?s=${encodeURIComponent(x.key)}`, refs: Array.isArray(x.repos) ? x.repos.slice(0, 8).map(String) : [] }));
42
+ }
43
+
44
+ function repoLine(r) {
45
+ const parts = [];
46
+ if (r.state === 'unknown') return 'Could not read it.';
47
+ const remotes = Array.isArray(r.remotes) ? r.remotes.filter((x) => x && x.offMachine) : [];
48
+ parts.push(remotes.length ? `Copied to ${remotes.map((x) => [x.host, x.ownerAccount].filter(Boolean).join('/')).join(', ')}` : 'No copy anywhere else (no remote)');
49
+ const sc = r.singleCopy || {};
50
+ if (sc.branches > 0) parts.push(`${sc.approximate ? 'about ' : ''}${sc.branches} branch${sc.branches === 1 ? '' : 'es'} only here`);
51
+ else if (sc.commits > 0) parts.push(`${sc.approximate ? 'about ' : ''}${sc.commits} commit${sc.commits === 1 ? '' : 's'} only here`);
52
+ const u = r.uncommitted;
53
+ if (u && typeof u === 'object' && u.files > 0) parts.push(`${u.files} uncommitted file${u.files === 1 ? '' : 's'}`);
54
+ else if (u === true) parts.push('uncommitted changes');
55
+ return `${parts.join(' · ')}.`;
56
+ }
57
+
58
+ /** The page: defects first, then each machine's repositories (single-copy first). */
59
+ export function buildReposPage(res) {
60
+ if (!res || !res.ok) {
61
+ if (res && sourceState(res) === 'off') return { ok: false, off: true, reason: 'The repository list is switched off on this agent.' };
62
+ return { ok: false, reason: (res && res.reason) ? `I couldn’t read the repository list: ${res.reason}.` : 'I couldn’t read the repository list.' };
63
+ }
64
+ const d = res.data;
65
+ if (!d || typeof d !== 'object' || !Array.isArray(d.defects)) return { ok: false, reason: 'The repository list came back in a shape I can’t read.' };
66
+ const needs = repoNeedRows(res) || [];
67
+ const machines = (Array.isArray(d.machines) ? d.machines : [{ machineId: d.machineId, machineName: d.machineName, source: 'self', repos: d.repos || [] }])
68
+ .filter((m) => m && typeof m === 'object')
69
+ .map((m) => ({
70
+ id: String(m.machineId || ''),
71
+ name: String(m.machineName || m.machineId || 'a machine'),
72
+ source: m.source,
73
+ note: m.source === 'unknown' ? 'I couldn’t reach it and have nothing it shared, so I can’t say what is there.' : m.source === 'replicated' ? 'Unreachable just now: this is what it last shared.' : m.error === 'switched-off' ? 'The repository list is switched off there.' : '',
74
+ repos: (Array.isArray(m.repos) ? m.repos : []).filter((r) => r && typeof r.displayPath === 'string')
75
+ // warning-exempt: a listing line; the defect it belongs to leads the page as a need card with its ask link
76
+ .map((r) => ({ path: r.displayPath, line: repoLine(r), alone: !r.hasOffMachineRemote || (r.singleCopy && r.singleCopy.commits > 0), tone: r.state === 'unknown' ? 'unknown' : (!r.hasOffMachineRemote || r.pastGrace) ? 'attn' : 'ok' }))
77
+ .sort((a, b) => Number(b.alone) - Number(a.alone) || a.path.localeCompare(b.path)),
78
+ }));
79
+ const total = machines.reduce((n, m) => n + m.repos.length, 0);
80
+ const headline = needs.length ? (needs.length === 1 ? needs[0].main : `${needs.length} things need copying off a machine`) : total ? 'Every repository has a copy somewhere else' : 'No repositories found yet';
81
+ // warning-exempt: the headline restates the need cards that lead the page, and each card carries its ask link
82
+ return { ok: true, headline, tone: needs.length ? 'attn' : 'ok', needs, machines, total, scan: d.scan || null };
83
+ }
@@ -0,0 +1,37 @@
1
+ // Repositories page (docs/specs/no-data-loss-on-machine-death.md §1.7): every repository the agent works in,
2
+ // on every machine, and whether its work exists anywhere else. What needs the owner leads the page. Read-only:
3
+ // nothing here changes a repository; the one action asks the agent. Every value goes through textContent.
4
+
5
+ import { buildReposPage, askHref, REPOS_READ } from './repos-model.js';
6
+ import { el, setKids, pageHead, note, cantTell, firstPaint, markNeed, arrivalScroll } from './ui.js';
7
+
8
+ const EYEBROW = 'Capacity · Repositories';
9
+ const wantKey = () => new URLSearchParams((location.hash.split('?')[1] || '')).get('s');
10
+
11
+ function needCard(n) {
12
+ return markNeed(el('section', { class: 'need-card', 'data-focus-key': n.key },
13
+ el('h2', { class: 'need-title', text: n.main }),
14
+ n.sub ? el('p', { class: 'need-line', text: n.sub }) : null,
15
+ el('div', { class: 'confirm-row' }, el('a', { class: 'btn-primary btn-inline', href: askHref({ kind: n.kind, machineName: n.machineName, repos: n.refs, key: n.key }), text: 'Ask the agent to copy it off the machine' }))), 'repos');
16
+ }
17
+
18
+ export async function renderRepos(main, ctx) {
19
+ firstPaint(main, el('section', { class: 'hero page-hero' }, el('div', { class: 'eyebrow', text: EYEBROW }), el('h1', { class: 'page-title skeleton', text: 'Loading repositories' })));
20
+ const res = await ctx.get(REPOS_READ, 15000);
21
+ const page = buildReposPage(res);
22
+ if (!page.ok) { setKids(main, pageHead({ eyebrow: EYEBROW, headline: 'Repositories', tone: 'muted' }), cantTell(page.reason)); return; }
23
+ const machines = page.machines.map((m) => el('details', { class: 'list-section', open: page.machines.length === 1 || null },
24
+ el('summary', { class: 'eyebrow', text: `${m.name} · ${m.repos.length} repositor${m.repos.length === 1 ? 'y' : 'ies'}` }),
25
+ m.note ? note(m.note) : null,
26
+ m.repos.map((r) => el('div', { class: 'card', 'data-state': r.tone },
27
+ el('div', { class: 'row-title', text: r.path }),
28
+ el('p', { class: 'card-line', text: r.line })))));
29
+ setKids(main,
30
+ pageHead({ noAsk: true, eyebrow: EYEBROW, headline: page.headline, tone: page.tone, sub: 'Work that exists on only one machine is lost if that machine is. This lists every repository I work in and whether it has a copy anywhere else.' }),
31
+ page.needs.map(needCard),
32
+ machines,
33
+ page.scan && page.scan.state !== 'complete' ? note('I haven’t finished looking through every folder yet, so this list may grow.') : null,
34
+ );
35
+ const want = wantKey();
36
+ if (want) arrivalScroll(main.querySelector(`[data-focus-key="${CSS.escape(want)}"]`), { key: want });
37
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAsMA,OAAO,EAAE,cAAc,EAAwD,MAAM,2BAA2B,CAAC;AAkBjH,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AA8BjG,OAAO,EAAE,WAAW,EAAiC,MAAM,0BAA0B,CAAC;AAMtF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAsM7D,OAAO,KAAK,EAAW,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAWtD,gGAAgG;AAChG,eAAO,MAAM,0BAA0B,QAAgC,CAAC;AAkHxE;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,C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C,CAuDzE;AA+BD,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA0E5E"}
@@ -4327,6 +4327,7 @@ async function wireDiskSteward(h) {
4327
4327
  // The poster wraps every send in its own notification envelope (DiskStewardPoster.ts);
4328
4328
  // this only hands it the adapter's send.
4329
4329
  sendToTopic: telegram ? telegram.sendToTopic.bind(telegram) : undefined,
4330
+ ownerQuietedDisk: () => telegram?.selectivity?.ownerQuieted('disk-steward') === true,
4330
4331
  });
4331
4332
  diskSteward.start(_dsInterval);
4332
4333
  // A multi-machine holder ensures the topic at boot, so a standby with a low disk always has one to adopt.
@@ -4371,6 +4372,70 @@ async function wireDiskSteward(h) {
4371
4372
  return undefined;
4372
4373
  }
4373
4374
  }
4375
+ /**
4376
+ * The owned-repository registry (docs/specs/no-data-loss-on-machine-death.md increment 1): every
4377
+ * repository this agent works in on this machine, its remotes, single-copy work and age, read-only.
4378
+ * Switch: `noDataLoss.repos.enabled` (development-agent gate). A construction failure disables it for
4379
+ * this boot only, reported as a degradation. Kept out of startServer (control-flow size limit).
4380
+ */
4381
+ async function wireOwnedRepos(h) {
4382
+ const { config } = h;
4383
+ try {
4384
+ const { createOwnedRepos, ownedReposEnabled } = await import('../monitoring/ownedRepos/wiring.js');
4385
+ if (!ownedReposEnabled(config))
4386
+ return undefined;
4387
+ const { OWNED_REPO_STORE_KEY, deriveOwnedRepoRecordKey, buildOwnedRepoRecordData } = await import('../core/OwnedRepoReplicatedStore.js');
4388
+ const { loadRegistry } = await import('../core/AgentRegistry.js');
4389
+ const idMgr = h.coordinator.managers.identityManager;
4390
+ const machineName = (id) => {
4391
+ let nick;
4392
+ try {
4393
+ nick = idMgr.getActiveMachines().find((m) => m.machineId === id)?.entry.nickname;
4394
+ }
4395
+ catch {
4396
+ nick = undefined;
4397
+ } // @silent-fallback-ok — fall back to the host name
4398
+ return (nick && nick.trim()) || (id === h.machineId ? os.hostname().replace(/\.local$/, '') : id.slice(0, 12));
4399
+ };
4400
+ const handle = createOwnedRepos({
4401
+ config: config,
4402
+ stateDir: config.stateDir,
4403
+ machineId: h.machineId,
4404
+ machineName: () => machineName(h.machineId),
4405
+ peers: () => {
4406
+ const withUrl = (_resolvePeerUrls?.() ?? []).map((p) => ({
4407
+ machineId: p.machineId, name: machineName(p.machineId), url: p.url ?? null,
4408
+ allowed: !!p.url && isPeerUrlAllowedForCredentials({ url: p.url, kind: p.kind }, config.multiMachine?.peerUrlAllowlist).ok,
4409
+ }));
4410
+ // A pool machine with no known URL is still listed (named unknown, or read from its records), never left out.
4411
+ const seen = new Set(withUrl.map((p) => p.machineId));
4412
+ const rest = (_listPoolMachines?.() ?? []).filter((m) => m.machineId !== h.machineId && !seen.has(m.machineId)).map((m) => ({ machineId: m.machineId, name: machineName(m.machineId), url: null, allowed: false }));
4413
+ return [...withUrl, ...rest];
4414
+ },
4415
+ authToken: config.authToken,
4416
+ atRisk: () => { const l = h.diskLevel(); return l === 'warn' || l === 'escalate'; },
4417
+ emit: h.emitter ? (rec) => { h.emitter.emit(OWNED_REPO_STORE_KEY, deriveOwnedRepoRecordKey(rec.machineId, rec.repoId), buildOwnedRepoRecordData(rec)); } : undefined,
4418
+ loadReplicas: h.peerStreams ? () => [...h.peerStreams.loadAllOriginRecords(OWNED_REPO_STORE_KEY).values()].flat().map((r) => ({ origin: r.origin, data: r.data })) : undefined,
4419
+ agentHomes: () => loadRegistry().entries.map((e) => e.path).filter((x) => typeof x === 'string'),
4420
+ hookEvents: h.hookEvents,
4421
+ });
4422
+ handle.start();
4423
+ console.log(pc.green(' Owned-repository registry enabled (read-only: lists this machine\'s repositories and their single-copy work)'));
4424
+ return () => handle.routeDeps();
4425
+ }
4426
+ catch (err) {
4427
+ const reason = err instanceof Error ? err.message : String(err);
4428
+ console.error(` Owned-repository registry failed to start: ${reason}`);
4429
+ DegradationReporter.getInstance().report({
4430
+ feature: 'OwnedRepoRegistry',
4431
+ primary: 'every repository the agent works in is listed with its remote status and any work that exists only on this machine',
4432
+ fallback: 'no repository registry on this machine for this boot; GET /repos answers 503',
4433
+ reason,
4434
+ impact: 'a repository whose only copy is on this machine is not listed or reported until the next restart',
4435
+ });
4436
+ return undefined;
4437
+ }
4438
+ }
4374
4439
  async function ensureAgentUpdatesTopic(telegram, state) {
4375
4440
  const existingTopicId = state.get('agent-updates-topic');
4376
4441
  if (existingTopicId) {
@@ -5723,6 +5788,10 @@ export async function startServer(options) {
5723
5788
  // whenever native app conversations are on, so a signed record can be checked on any machine).
5724
5789
  const { DEVICE_KEY_LEDGER_KIND_REGISTRATION } = await import('../core/MobileDeviceKeyLedgerReplicatedStore.js');
5725
5790
  replicatedKindRegistry.register(DEVICE_KEY_LEDGER_KIND_REGISTRATION);
5791
+ // docs/specs/no-data-loss-on-machine-death.md §1.2 — the `owned-repo` kind: each machine's repositories and
5792
+ // whether their work exists anywhere else, so a survivor can name a dead machine's single-copy work.
5793
+ const { OWNED_REPO_KIND_REGISTRATION } = await import('../core/OwnedRepoReplicatedStore.js');
5794
+ replicatedKindRegistry.register(OWNED_REPO_KIND_REGISTRATION);
5726
5795
  // WS2.3 (ws23-relationships-userregistry-security) — register the SECOND concrete
5727
5796
  // replicated kind, `relationship-record`, onto the registry: the FIRST PII kind.
5728
5797
  // Dual-registry's dynamic half (the static half is CoherenceJournal.JOURNAL_KINDS,
@@ -6161,6 +6230,7 @@ export async function startServer(options) {
6161
6230
  const { customProjectAppsEnabled: _customProjectAppsEnabledFn } = await import('../server/ProjectAppSandbox.js');
6162
6231
  const _projectAppsCustomOn = _projectAppsOn && _customProjectAppsEnabledFn(config);
6163
6232
  const _suggestionDecisionsOn = !!coherenceJournal && _stateSyncStoresBase?.conversationGraphSuggestions?.enabled !== false;
6233
+ const _ownedRepoOn = !!coherenceJournal && resolveDevAgentGate(config.noDataLoss?.repos?.enabled, config) && _stateSyncStoresBase?.ownedRepo?.enabled !== false;
6164
6234
  // Telegram topic names (docs/specs/topic-name-replication.md): on wherever the journal runs; `enabled: false` is the kill switch.
6165
6235
  _telegramTopicNamesOn = !!coherenceJournal && _stateSyncStoresBase?.telegramTopicNames?.enabled !== false;
6166
6236
  const _stateSyncStoresResolved = (() => {
@@ -6209,9 +6279,13 @@ export async function startServer(options) {
6209
6279
  // decisions are the agent's, so the store is on wherever the journal runs; `enabled: false` is the kill switch.
6210
6280
  if (_suggestionDecisionsOn)
6211
6281
  s = { ...s, conversationGraphSuggestions: { enabled: true } };
6282
+ // Owned-repository registry (docs/specs/no-data-loss-on-machine-death.md §1.8): the records follow
6283
+ // `noDataLoss.repos.enabled` (development-agent gate); `ownedRepo.enabled: false` is the kill switch.
6284
+ if (_ownedRepoOn)
6285
+ s = { ...s, ownedRepo: { enabled: true } };
6212
6286
  if (_telegramTopicNamesOn)
6213
6287
  s = { ...s, telegramTopicNames: { enabled: true } };
6214
- return s.failureCallout?.enabled || _recommendedServicesOn || _appNativeOn || _accountFollowMeEnabled || _pinReplicateEnabled || _workBoardOn || _projectAppsOn || _trustJourneyStoreOn || _suggestionDecisionsOn || _telegramTopicNamesOn || _staleOwnerReleaseResolved || _chiefOfStaffStoreOn || _stateSyncStoresBase ? s : _stateSyncStoresBase;
6288
+ return _ownedRepoOn || s.failureCallout?.enabled || _recommendedServicesOn || _appNativeOn || _accountFollowMeEnabled || _pinReplicateEnabled || _workBoardOn || _projectAppsOn || _trustJourneyStoreOn || _suggestionDecisionsOn || _telegramTopicNamesOn || _staleOwnerReleaseResolved || _chiefOfStaffStoreOn || _stateSyncStoresBase ? s : _stateSyncStoresBase;
6215
6289
  })();
6216
6290
  // WS2 send-side: the generic journal-backed record emitter (the concrete emitter
6217
6291
  // the per-store managers' emit hooks call). Needs the journal sink, the HLC clock,
@@ -25974,6 +26048,18 @@ export async function startServer(options) {
25974
26048
  }
25975
26049
  // ── DiskSteward (docs/specs/disk-steward.md) — wired in wireDiskSteward below ──
25976
26050
  const _diskStewardRoutes = await wireDiskSteward({ config, state, coordinator, telegram, liveConfig, guardRegistry });
26051
+ // ── Owned-repository registry (docs/specs/no-data-loss-on-machine-death.md increment 1) ──
26052
+ const _ownedRepoRoutes = await wireOwnedRepos({
26053
+ config, coordinator,
26054
+ machineId: cjOwnMachineId ?? coordinator.identity?.machineId ?? `m_host_${os.hostname()}`,
26055
+ emitter: replicatedRecordEmitter, peerStreams: replicatedPeerStreamReader, hookEvents: hookEventReceiver,
26056
+ diskLevel: () => { try {
26057
+ return _diskStewardRoutes?.()?.steward.status().level ?? null;
26058
+ }
26059
+ catch {
26060
+ return null;
26061
+ } }, // @silent-fallback-ok — no disk reading means the normal grace window
26062
+ });
25977
26063
  // identity-security piece 2b: the owner record on this machine (src/core/ownerRecordWiring.ts).
25978
26064
  ownerRecordWiring.wireOwnerRecordStore(config, coordinator.managers.identityManager);
25979
26065
  // ── ExternalHogSentinel (external-hog zombie auto-kill sentinel, CMT-1901) ──
@@ -36949,7 +37035,7 @@ export async function startServer(options) {
36949
37035
  const server = new AgentServer({ config, trustAccountPath: _trustJourneyRuntime ?? undefined, getConversationGraphDelegation, conversationGraphDelegationRemoteRuntime: conversationGraphRemoteDelegationRuntime, conversationGraphDelegationRuntime, conversationGraphReplicationRuntime: conversationGraphDefault ? undefined : conversationGraphReplicationRuntime ?? undefined, conversationGraphDefault, reachablePeople: _reachablePeople ?? undefined, ecosystemLedger: _ecosystemLedger ?? undefined, recommendedServicesLedger: _recommendedServicesLedger ?? undefined, singleInstanceLock, agentIdentity: _agentIdentityDeps, terminateSessionAuthority: terminateWithAuthority, subscriptionEmailBinding: credentialLocationLedger, subscriptionEmailBarrier, subscriptionIdentityOracle, sessionManager, llmQueue: sharedLlmQueue, state, scheduler, telegram, telegramOrigin: telegramOriginBoot?.runtime, relationships, feedback, feedbackAnomalyDetector, dispatches, updateChecker, autoUpdater, autoDispatcher, quotaTracker, quotaManager, publisher, viewer, jobAnomalySendAutomationReply: sendAutomationReply, mobilePairingAutomationReply: (topicId, body, logicalSendId, opts) => postOriginAutomationReply({ service: telegramOriginBoot?.runtime.service, port: config.port, authToken: config.authToken ?? '', producerId: 'mobile-pairing-outcome', topicId, body, author: deterministicAutomationAuthor(), logicalSendId, headers: opts.headers, signal: opts.signal }), tunnel, evolution, watchdog, topicMemory, triageNurse, projectMapper, cartographerRoots: cartographerRoots ?? undefined, coherenceGate: scopeVerifier, contextHierarchy, canonicalState, operationGate, sentinel, adaptiveTrust, memoryMonitor, orphanReaper, coherenceMonitor, commitmentTracker, subscriptionPool, accountFollowMePeerViews: async () => { const nickById = new Map((_listPoolMachines?.() ?? []).map((m) => [m.machineId, verifiedEntityName(m.machineId, m.nickname) ?? ''])); let peers = (_resolvePeerUrls?.() ?? []).map((p) => ({ machineId: p.machineId, nickname: nickById.get(p.machineId) ?? '', url: p.url })); if (peers.length === 0) {
36950
37036
  peers = (_listPoolMachines?.() ?? []).filter((m) => m.machineId !== _meshSelfId && !!m.lastKnownUrl).map((m) => ({ machineId: m.machineId, nickname: verifiedEntityName(m.machineId, m.nickname) ?? '', url: m.lastKnownUrl }));
36951
37037
  } if (peers.length === 0)
36952
- return []; const { fetchPeerSubscriptionViews } = await import('../core/fetchPeerSubscriptionViews.js'); return fetchPeerSubscriptionViews({ peers: () => peers, fetchImpl: fetch, authToken: config.authToken ?? '' }); }, quotaPoller, quotaAwareScheduler: _quotaAwareScheduler ?? undefined, proactiveSwapMonitor: _proactiveSwapMonitor ?? undefined, usageWallRescue: _usageWallRescue ?? undefined, inUseAccountResolver, enrollmentWizard, accountFollowMeRevocation, credentialRepointing, semanticMemory, activitySentinel, rateLimitSentinel, releaseReadinessSentinel: releaseReadinessSentinel ?? undefined, greenPrAutoMerger: greenPrAutoMerger ?? undefined, localVerify: localVerifyService ?? undefined, localVerifyStatus: localVerifyStatus ?? undefined, guardLatchStore: guardLatchStore ?? undefined, agentStopSurfacer: agentStopSurfacer ?? undefined, messageRouter, summarySentinel, spawnManager, systemReviewer, capabilityMapper, selfKnowledgeTree, coverageAuditor, topicResumeMap: _topicResumeMap ?? undefined, topicProfile: _topicProfileCtx ?? undefined, sessionRefresh: _sessionRefresh ?? undefined, autonomyManager, trustElevationTracker, autonomousEvolution, coordinator: coordinator.enabled ? coordinator : undefined, meshBindActive: coordinator.managers.identityManager.hasIdentity() && config.multiMachine?.meshTransport?.enabled !== false, localSigningKeyPem, leaseTransport, peerEndpointRecorder, getSelfMeshEndpoints, onLeasePullRequest: () => leaseCoordinatorRef?.currentLease() ?? null, liveTailReceiver, handoffWireTransport, onHandoffBegin, onHandoffInitiate: handoffInitiate, handoffInProgress: handoffSentinelInProgress, messageLedger, currentInboundByTopic, replyMarkerTransport, onReplyMarker: messageLedger ? (marker) => { const m = marker; messageLedger.applyRemoteReplyMarker(m.dedupeKey, { platform: m.platform, replyIdempotencyKey: m.replyIdempotencyKey, epoch: m.epoch, topic: m.topic ?? null }); } : undefined, whatsapp: whatsappAdapter, slack: slackAdapter, imessage: imessageAdapter, conversationRegistry, conversationBindAuth, appConversations: _appConversationService ?? undefined, readMarkers: _readMarkerStore ?? undefined, conversationListPins: _listPinStore ?? undefined, conversationGraphSuggestionDecisions: _suggestionDecisions?.store ?? undefined, readMarkersHlcNowMs: replicatedHlcClock ? (() => replicatedHlcClock.current().physical) : undefined, slackInboundDispatch: () => _slackInboundDispatch, conversationFollowThrough, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, conversationStore, threadLog, threadMessageRecorder, warrantsReplyGate, collaborationSurfacer, peerHomebaseRelay, threadResumeMap, topicLinkageHandler: topicLinkageHandler ?? undefined, threadlineRelayClient, pairingInvites: threadlinePairingInvites, getLastRelayEvent: threadlineGetLastRelayEvent, a2aRelayForward: _a2aRelayForwardCtx ?? undefined, threadlineReplyWaiters, threadlineMcpHttp, ownerApprovedActionStore, ownerApprovedActionPending, memoryPrivacy: _memoryPrivacyWired ?? undefined, listenerManager: listenerManager ?? undefined, a2aDeliveryTracker: a2aDeliveryTracker ?? undefined, requiredAck: _requiredAckService ?? undefined, relayVerdictCounters: threadlineRelayClient ? (() => ({ ...threadlineRelayClient.relayVerdictCounters, expiredMismatchIgnored: a2aDeliveryTracker?.expiredMismatchIgnored ?? 0 })) : undefined, inboundIdLedger: _inboundIdLedger ?? undefined, inboundIdLedgerDaemonDeferred: () => _inboundIdLedgerDaemonDeferred, responseReviewGate, reviewCanaryBattery, messagingToneGate, outboundDedupGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, completionEvaluator, unifiedTrust, liveConfig, sharedStateLedger, ledgerSessionRegistry, worktreeManager, oidcEnrolledRepos: parallelDevConfig?.oidcEnrolledRepos, initiativeTracker, projectRoundRunner, projectDriftChecker, machineHeartbeat, machinePoolRegistry, ropeHealthMonitor, writeAdmission: writeAdmission ?? undefined, getInboundQueue: () => _inboundQueue, getMachineCoherence: () => _machineCoherenceSentinel, getSingleMachineFailoverGap: () => _singleMachineFailoverGap, getMissingLoginSession: () => _missingLoginSession, getSessionPoolFailoverRunner: () => _sessionPoolFailoverRunnerDriver?.status() ?? null, sessionPoolPromotionActivation: _sessionPoolPromotionActivation, meshRpcDispatcher, deliverA2aToMachine: _deliverA2aToMachine ?? undefined, workingSetPullCoordinator, workingSetArtifactManager, orchestratorPoller, commitmentReplicaStore, preferenceReplicaStore, replicatedRecordEmitter, replicatedStoreReconciler, conflictStore, rollbackUnmerge, droppedOriginRegistry, preferencesUnionReader, jevMemoryPicker, forwardCommitmentMutate, sessionOwnershipRegistry, sendDrain: _sendDrain ?? undefined, isOwnerUnroutable: (m) => _isOwnerUnroutable?.(m) ?? false, claimTopicOwnershipOnSpawn: (topicId) => _claimOwnershipForAutonomousSpawn ? _claimOwnershipForAutonomousSpawn(topicId) : 'unwired', topicPinStore: _topicPinStore ?? undefined, topicPinSkewQuarantine: _topicPinSkewQuarantine ?? undefined, topicPinFoldView: _topicPinFoldView ?? undefined, ownershipReconciler: _ownershipReconciler ?? undefined, staleOwnerEngine: _staleOwnerEngine ?? undefined, duplicateReconciler: _duplicateReconciler ?? undefined, ownerDarkLadder: _ownerDarkLadder ?? undefined, spawnAdmission: _spawnAdmission ?? undefined, judgmentProvenance: _judgmentProvenance ?? undefined, leaseHandback: _leaseHandbackCtx ?? undefined, streamTicketStore: _streamTicketStore ?? undefined, poolStreamAllowRemoteInput: config.dashboard?.poolStream?.allowRemoteInput ?? false, poolStreamConnector: _poolStreamConnector ?? undefined, secretSync: _secretSyncHandle ?? undefined, meshSelfId: _meshSelfId ?? undefined, resolveRouterUrl: _resolveRouterUrl ?? undefined, resolvePeerUrls: _resolvePeerUrls ?? undefined, meshSignedRead: _meshSignedRead ?? undefined, transcriptCopies: _transcriptCopies ?? undefined, transcriptCheckpointTick: _transcriptCheckpointTick ?? undefined, recordRopeResult: _recordRopeResult ?? undefined, guardRegistry, listPoolMachines: _listPoolMachines ?? undefined, deliverMandateToMachine: _deliverMandateToMachine ?? undefined, passkeyRevokeOutbox: _passkeyRevokeOutbox ? () => _passkeyRevokeOutbox : undefined, passkeyPeerOnline: _passkeyPeerOnline, passkeyPoolReader: _passkeyPoolReader ? () => _passkeyPoolReader : undefined, passkeyProofBrowser: async (profileDir) => { const { ChromeCdpReloginBrowser } = await import('../core/ChromeCdpReloginBrowser.js'); return new ChromeCdpReloginBrowser({ userDataDir: profileDir, passkeyMode: true, headless: true, launchTimeoutMs: 30_000, operationTimeoutMs: 20_000 }); }, poolLink: _poolLink ?? undefined, poolPollCache: _poolPollCache ?? undefined, sessionPoolE2EResultStore, proxyCoordinator, topicIntentStore, topicIntentArcCheck, usherSignalStore, intelligence: sharedIntelligence ?? undefined, telegramBridgeConfig, telegramBridge: telegramBridge ?? undefined, threadlineObservability, briefDeps, workingMemory, taskFlowRegistry, threadlineFlowBridge, sessionReaper, agentWorktreeReaper, diskSteward: _diskStewardRoutes, ownerRecord: ownerRecordWiring.ownerRecordRouteDeps, workBoard: () => _workBoardRuntime, workBoardLate: _workBoardLate, externalHogSentinel, orphanedWorkSentinel, mcpProcessReaper, codexArmSessionSweeper, geminiLoopRunner, sleepController, agentActivityState, reapLog, resumeQueue, resumeDrainer, autonomousLivenessReconciler, chiefOfStaffLoop: _cosLoop ?? undefined, chiefOfStaffProtocol: _cosProtocol ?? undefined, projectAppsRuntime: () => _projectAppsRuntime, projectAppSandbox: () => _projectAppSandbox, projectAppCustom: () => _projectAppCustom, enforcedTerminationStatus: () => enforcedTerminationWatchdog?.guardStatus() ?? null, prHandLease: prHandLease ?? undefined, standDownRegistry: _standDownRegistry ?? undefined, standDownAudit: _standDownAudit ?? undefined, foldHolds: _foldHolds ?? undefined, contextBudgetSentinel: _contextBudgetSentinel ?? undefined, operatorStopRecorder: recordOperatorStop, sleepWakeDetector, unjustifiedStopGate, stopGateDb, stopNotifier, liveTestGate, liveTestGateMode, liveTestRunnerCtx, chunkBuilder: _chunkBuilder ?? undefined, h3Builder: _h3Builder ?? undefined, contextLayers: _contextLayers ?? undefined });
37038
+ return []; const { fetchPeerSubscriptionViews } = await import('../core/fetchPeerSubscriptionViews.js'); return fetchPeerSubscriptionViews({ peers: () => peers, fetchImpl: fetch, authToken: config.authToken ?? '' }); }, quotaPoller, quotaAwareScheduler: _quotaAwareScheduler ?? undefined, proactiveSwapMonitor: _proactiveSwapMonitor ?? undefined, usageWallRescue: _usageWallRescue ?? undefined, inUseAccountResolver, enrollmentWizard, accountFollowMeRevocation, credentialRepointing, semanticMemory, activitySentinel, rateLimitSentinel, releaseReadinessSentinel: releaseReadinessSentinel ?? undefined, greenPrAutoMerger: greenPrAutoMerger ?? undefined, localVerify: localVerifyService ?? undefined, localVerifyStatus: localVerifyStatus ?? undefined, guardLatchStore: guardLatchStore ?? undefined, agentStopSurfacer: agentStopSurfacer ?? undefined, messageRouter, summarySentinel, spawnManager, systemReviewer, capabilityMapper, selfKnowledgeTree, coverageAuditor, topicResumeMap: _topicResumeMap ?? undefined, topicProfile: _topicProfileCtx ?? undefined, sessionRefresh: _sessionRefresh ?? undefined, autonomyManager, trustElevationTracker, autonomousEvolution, coordinator: coordinator.enabled ? coordinator : undefined, meshBindActive: coordinator.managers.identityManager.hasIdentity() && config.multiMachine?.meshTransport?.enabled !== false, localSigningKeyPem, leaseTransport, peerEndpointRecorder, getSelfMeshEndpoints, onLeasePullRequest: () => leaseCoordinatorRef?.currentLease() ?? null, liveTailReceiver, handoffWireTransport, onHandoffBegin, onHandoffInitiate: handoffInitiate, handoffInProgress: handoffSentinelInProgress, messageLedger, currentInboundByTopic, replyMarkerTransport, onReplyMarker: messageLedger ? (marker) => { const m = marker; messageLedger.applyRemoteReplyMarker(m.dedupeKey, { platform: m.platform, replyIdempotencyKey: m.replyIdempotencyKey, epoch: m.epoch, topic: m.topic ?? null }); } : undefined, whatsapp: whatsappAdapter, slack: slackAdapter, imessage: imessageAdapter, conversationRegistry, conversationBindAuth, appConversations: _appConversationService ?? undefined, readMarkers: _readMarkerStore ?? undefined, conversationListPins: _listPinStore ?? undefined, conversationGraphSuggestionDecisions: _suggestionDecisions?.store ?? undefined, readMarkersHlcNowMs: replicatedHlcClock ? (() => replicatedHlcClock.current().physical) : undefined, slackInboundDispatch: () => _slackInboundDispatch, conversationFollowThrough, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, conversationStore, threadLog, threadMessageRecorder, warrantsReplyGate, collaborationSurfacer, peerHomebaseRelay, threadResumeMap, topicLinkageHandler: topicLinkageHandler ?? undefined, threadlineRelayClient, pairingInvites: threadlinePairingInvites, getLastRelayEvent: threadlineGetLastRelayEvent, a2aRelayForward: _a2aRelayForwardCtx ?? undefined, threadlineReplyWaiters, threadlineMcpHttp, ownerApprovedActionStore, ownerApprovedActionPending, memoryPrivacy: _memoryPrivacyWired ?? undefined, listenerManager: listenerManager ?? undefined, a2aDeliveryTracker: a2aDeliveryTracker ?? undefined, requiredAck: _requiredAckService ?? undefined, relayVerdictCounters: threadlineRelayClient ? (() => ({ ...threadlineRelayClient.relayVerdictCounters, expiredMismatchIgnored: a2aDeliveryTracker?.expiredMismatchIgnored ?? 0 })) : undefined, inboundIdLedger: _inboundIdLedger ?? undefined, inboundIdLedgerDaemonDeferred: () => _inboundIdLedgerDaemonDeferred, responseReviewGate, reviewCanaryBattery, messagingToneGate, outboundDedupGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, completionEvaluator, unifiedTrust, liveConfig, sharedStateLedger, ledgerSessionRegistry, worktreeManager, oidcEnrolledRepos: parallelDevConfig?.oidcEnrolledRepos, initiativeTracker, projectRoundRunner, projectDriftChecker, machineHeartbeat, machinePoolRegistry, ropeHealthMonitor, writeAdmission: writeAdmission ?? undefined, getInboundQueue: () => _inboundQueue, getMachineCoherence: () => _machineCoherenceSentinel, getSingleMachineFailoverGap: () => _singleMachineFailoverGap, getMissingLoginSession: () => _missingLoginSession, getSessionPoolFailoverRunner: () => _sessionPoolFailoverRunnerDriver?.status() ?? null, sessionPoolPromotionActivation: _sessionPoolPromotionActivation, meshRpcDispatcher, deliverA2aToMachine: _deliverA2aToMachine ?? undefined, workingSetPullCoordinator, workingSetArtifactManager, orchestratorPoller, commitmentReplicaStore, preferenceReplicaStore, replicatedRecordEmitter, replicatedStoreReconciler, conflictStore, rollbackUnmerge, droppedOriginRegistry, preferencesUnionReader, jevMemoryPicker, forwardCommitmentMutate, sessionOwnershipRegistry, sendDrain: _sendDrain ?? undefined, isOwnerUnroutable: (m) => _isOwnerUnroutable?.(m) ?? false, claimTopicOwnershipOnSpawn: (topicId) => _claimOwnershipForAutonomousSpawn ? _claimOwnershipForAutonomousSpawn(topicId) : 'unwired', topicPinStore: _topicPinStore ?? undefined, topicPinSkewQuarantine: _topicPinSkewQuarantine ?? undefined, topicPinFoldView: _topicPinFoldView ?? undefined, ownershipReconciler: _ownershipReconciler ?? undefined, staleOwnerEngine: _staleOwnerEngine ?? undefined, duplicateReconciler: _duplicateReconciler ?? undefined, ownerDarkLadder: _ownerDarkLadder ?? undefined, spawnAdmission: _spawnAdmission ?? undefined, judgmentProvenance: _judgmentProvenance ?? undefined, leaseHandback: _leaseHandbackCtx ?? undefined, streamTicketStore: _streamTicketStore ?? undefined, poolStreamAllowRemoteInput: config.dashboard?.poolStream?.allowRemoteInput ?? false, poolStreamConnector: _poolStreamConnector ?? undefined, secretSync: _secretSyncHandle ?? undefined, meshSelfId: _meshSelfId ?? undefined, resolveRouterUrl: _resolveRouterUrl ?? undefined, resolvePeerUrls: _resolvePeerUrls ?? undefined, meshSignedRead: _meshSignedRead ?? undefined, transcriptCopies: _transcriptCopies ?? undefined, transcriptCheckpointTick: _transcriptCheckpointTick ?? undefined, recordRopeResult: _recordRopeResult ?? undefined, guardRegistry, listPoolMachines: _listPoolMachines ?? undefined, deliverMandateToMachine: _deliverMandateToMachine ?? undefined, passkeyRevokeOutbox: _passkeyRevokeOutbox ? () => _passkeyRevokeOutbox : undefined, passkeyPeerOnline: _passkeyPeerOnline, passkeyPoolReader: _passkeyPoolReader ? () => _passkeyPoolReader : undefined, passkeyProofBrowser: async (profileDir) => { const { ChromeCdpReloginBrowser } = await import('../core/ChromeCdpReloginBrowser.js'); return new ChromeCdpReloginBrowser({ userDataDir: profileDir, passkeyMode: true, headless: true, launchTimeoutMs: 30_000, operationTimeoutMs: 20_000 }); }, poolLink: _poolLink ?? undefined, poolPollCache: _poolPollCache ?? undefined, sessionPoolE2EResultStore, proxyCoordinator, topicIntentStore, topicIntentArcCheck, usherSignalStore, intelligence: sharedIntelligence ?? undefined, telegramBridgeConfig, telegramBridge: telegramBridge ?? undefined, threadlineObservability, briefDeps, workingMemory, taskFlowRegistry, threadlineFlowBridge, sessionReaper, agentWorktreeReaper, diskSteward: _diskStewardRoutes, ownedRepos: _ownedRepoRoutes, ownerRecord: ownerRecordWiring.ownerRecordRouteDeps, workBoard: () => _workBoardRuntime, workBoardLate: _workBoardLate, externalHogSentinel, orphanedWorkSentinel, mcpProcessReaper, codexArmSessionSweeper, geminiLoopRunner, sleepController, agentActivityState, reapLog, resumeQueue, resumeDrainer, autonomousLivenessReconciler, chiefOfStaffLoop: _cosLoop ?? undefined, chiefOfStaffProtocol: _cosProtocol ?? undefined, projectAppsRuntime: () => _projectAppsRuntime, projectAppSandbox: () => _projectAppSandbox, projectAppCustom: () => _projectAppCustom, enforcedTerminationStatus: () => enforcedTerminationWatchdog?.guardStatus() ?? null, prHandLease: prHandLease ?? undefined, standDownRegistry: _standDownRegistry ?? undefined, standDownAudit: _standDownAudit ?? undefined, foldHolds: _foldHolds ?? undefined, contextBudgetSentinel: _contextBudgetSentinel ?? undefined, operatorStopRecorder: recordOperatorStop, sleepWakeDetector, unjustifiedStopGate, stopGateDb, stopNotifier, liveTestGate, liveTestGateMode, liveTestRunnerCtx, chunkBuilder: _chunkBuilder ?? undefined, h3Builder: _h3Builder ?? undefined, contextLayers: _contextLayers ?? undefined });
36953
37039
  if (_pendingCompactionEvidence)
36954
37040
  featureEvidence.record('multiMachine.coherenceJournal.replication.compaction', _pendingCompactionEvidence);
36955
37041
  // ── Context budget Phase 2: the shadow fold runner (docs/specs/context-budget-layered-summaries.md §16 step 3) ──