@remnic/core 9.69.18 → 9.69.20

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 (98) hide show
  1. package/dist/access-admin-ops-surface.d.ts +1 -1
  2. package/dist/access-admin-ops-surface.js +4 -4
  3. package/dist/access-authorization-probe.d.ts +1 -1
  4. package/dist/access-authorization-probe.js +5 -5
  5. package/dist/access-boundary.d.ts +1 -1
  6. package/dist/access-boundary.js +4 -4
  7. package/dist/access-cli.js +16 -16
  8. package/dist/access-extraction-force-flush.d.ts +1 -1
  9. package/dist/access-extraction-force-flush.js +4 -4
  10. package/dist/access-http-lcm-compaction.d.ts +1 -1
  11. package/dist/access-http-lifecycle-flush.d.ts +1 -1
  12. package/dist/access-http-offline-stream.d.ts +1 -1
  13. package/dist/access-http-query.js +4 -4
  14. package/dist/access-http.d.ts +2 -2
  15. package/dist/access-http.js +13 -13
  16. package/dist/access-identity-continuity-surface.js +4 -4
  17. package/dist/access-lcm-surface.d.ts +1 -1
  18. package/dist/access-lcm-surface.js +4 -4
  19. package/dist/access-mcp.d.ts +1 -1
  20. package/dist/access-mcp.js +9 -9
  21. package/dist/access-namespace-preflight.js +4 -4
  22. package/dist/access-observe-write-surface.d.ts +1 -1
  23. package/dist/access-observe-write-surface.js +4 -4
  24. package/dist/access-offline-manifest.js +3 -3
  25. package/dist/access-operations-batch.js +5 -5
  26. package/dist/access-operations.d.ts +2 -2
  27. package/dist/access-operations.js +8 -8
  28. package/dist/access-recall-concurrency.d.ts +1 -1
  29. package/dist/access-recall-concurrency.js +4 -4
  30. package/dist/access-recall-response.d.ts +1 -1
  31. package/dist/access-recall-response.js +4 -4
  32. package/dist/access-recall-surface.d.ts +1 -1
  33. package/dist/access-recall-surface.js +4 -4
  34. package/dist/access-service-helpers.d.ts +1 -1
  35. package/dist/access-service.d.ts +1 -1
  36. package/dist/access-service.js +4 -4
  37. package/dist/access-surface-catalog.d.ts +1 -1
  38. package/dist/access-surface-catalog.js +6 -6
  39. package/dist/{chunk-PC7WNIRL.js → chunk-22YEAYMV.js} +7 -7
  40. package/dist/{chunk-SB4OBB7P.js → chunk-5RPMTFB6.js} +2 -2
  41. package/dist/{chunk-XJJLWTLW.js → chunk-7SHCAJR7.js} +2 -2
  42. package/dist/{chunk-WL5PR5YC.js → chunk-F5XGBC22.js} +2 -2
  43. package/dist/{chunk-EFCBJDYE.js → chunk-GDGHJDWY.js} +2 -2
  44. package/dist/{chunk-5SGOARQJ.js → chunk-IEX7SNFK.js} +2 -2
  45. package/dist/{chunk-2J4TIFBK.js → chunk-JKXBZKD5.js} +2 -2
  46. package/dist/{chunk-B2AGUKSS.js → chunk-NS5SICIH.js} +2 -2
  47. package/dist/{chunk-JIM4BIOC.js → chunk-PAAJWQH5.js} +4 -2
  48. package/dist/{chunk-JIM4BIOC.js.map → chunk-PAAJWQH5.js.map} +1 -1
  49. package/dist/{chunk-5MF4EGL5.js → chunk-PPJZMPUX.js} +4 -4
  50. package/dist/{chunk-AWF4CNYJ.js → chunk-RYZ2E2ZM.js} +2 -2
  51. package/dist/{chunk-IZZ7Q2RJ.js → chunk-TC3ZDFMD.js} +2 -2
  52. package/dist/{chunk-CVJMGVEW.js → chunk-TR5X2L4W.js} +4 -4
  53. package/dist/{chunk-L74A6NTI.js → chunk-UTPFI5CL.js} +3 -3
  54. package/dist/{chunk-JZ6EYAVP.js → chunk-W5EOTYOG.js} +2 -2
  55. package/dist/{chunk-CFKCFY4B.js → chunk-ZPMQXJJ3.js} +2 -2
  56. package/dist/{cli-DN9LpWf0.d.ts → cli-B_TaTEHW.d.ts} +1 -1
  57. package/dist/cli.d.ts +2 -2
  58. package/dist/cli.js +14 -14
  59. package/dist/deep-recall-http-glue.d.ts +1 -1
  60. package/dist/deep-recall-mcp-tools.d.ts +1 -1
  61. package/dist/external-wiki-access.d.ts +1 -1
  62. package/dist/external-wiki-access.js +5 -5
  63. package/dist/external-wiki-mcp-tools.d.ts +1 -1
  64. package/dist/index.d.ts +6 -6
  65. package/dist/index.js +16 -16
  66. package/dist/mcp-memory-inspector-app.d.ts +1 -1
  67. package/dist/memory-subject-cli.d.ts +1 -1
  68. package/dist/memory-subject.d.ts +1 -1
  69. package/dist/orchestrator.js +16 -16
  70. package/dist/{public-http-C1ht4oDJ.d.ts → public-http-DkQFZZkW.d.ts} +1 -1
  71. package/dist/reconcile/cursor.js +1 -1
  72. package/dist/reconcile/manifest.js +2 -2
  73. package/dist/reconcile/plan.js +1 -1
  74. package/dist/schemas.d.ts +42 -42
  75. package/dist/support-passport/index.d.ts +4 -4
  76. package/dist/support-passport/index.js +7 -7
  77. package/dist/transfer/types.d.ts +12 -12
  78. package/dist/who-knows-cli.d.ts +1 -1
  79. package/dist/who-knows.d.ts +1 -1
  80. package/package.json +2 -2
  81. package/src/reconcile/plan.test.ts +17 -0
  82. package/src/reconcile/plan.ts +6 -1
  83. package/dist/{access-service-CYdqPfpS.d.ts → access-service-DxE-bRvW.d.ts} +6 -6
  84. /package/dist/{chunk-PC7WNIRL.js.map → chunk-22YEAYMV.js.map} +0 -0
  85. /package/dist/{chunk-SB4OBB7P.js.map → chunk-5RPMTFB6.js.map} +0 -0
  86. /package/dist/{chunk-XJJLWTLW.js.map → chunk-7SHCAJR7.js.map} +0 -0
  87. /package/dist/{chunk-WL5PR5YC.js.map → chunk-F5XGBC22.js.map} +0 -0
  88. /package/dist/{chunk-EFCBJDYE.js.map → chunk-GDGHJDWY.js.map} +0 -0
  89. /package/dist/{chunk-5SGOARQJ.js.map → chunk-IEX7SNFK.js.map} +0 -0
  90. /package/dist/{chunk-2J4TIFBK.js.map → chunk-JKXBZKD5.js.map} +0 -0
  91. /package/dist/{chunk-B2AGUKSS.js.map → chunk-NS5SICIH.js.map} +0 -0
  92. /package/dist/{chunk-5MF4EGL5.js.map → chunk-PPJZMPUX.js.map} +0 -0
  93. /package/dist/{chunk-AWF4CNYJ.js.map → chunk-RYZ2E2ZM.js.map} +0 -0
  94. /package/dist/{chunk-IZZ7Q2RJ.js.map → chunk-TC3ZDFMD.js.map} +0 -0
  95. /package/dist/{chunk-CVJMGVEW.js.map → chunk-TR5X2L4W.js.map} +0 -0
  96. /package/dist/{chunk-L74A6NTI.js.map → chunk-UTPFI5CL.js.map} +0 -0
  97. /package/dist/{chunk-JZ6EYAVP.js.map → chunk-W5EOTYOG.js.map} +0 -0
  98. /package/dist/{chunk-CFKCFY4B.js.map → chunk-ZPMQXJJ3.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/reconcile/plan.ts"],"sourcesContent":["import { CENSUS_MAX_MTIME_MS, isCensusMtimeMs, isSha256Hex } from \"../census-validation.js\";\nimport { normalizeNamespaceIdentity } from \"../namespaces/identity.js\";\nimport { validateArchiveRelativePath } from \"../transfer/fs-utils.js\";\nimport type { OfflineSyncFileState } from \"../offline-sync.js\";\nimport { CONVERGE_CONFLICT_POLICIES, DEFAULT_CONVERGE_CONFLICT_POLICY } from \"../converge-config.js\";\nimport type { ConvergeConflictPolicy } from \"../types.js\";\nexport type ReconcileConflictPolicy = ConvergeConflictPolicy;\n\n/**\n * Bootstrap reconciliation planner for two peer daemons whose corpora have\n * already diverged (issue #2150).\n *\n * The offline-sync protocol assumes a satellite that shares a common base with\n * one daemon: every path it does not know about is a pull, and a conflict is\n * rare. Two long-lived daemons are the opposite case — each side holds months\n * of history the other never saw, both sides are authoritative, and there is\n * NO common base on the first run. That is a different decision problem, so it\n * gets its own planner rather than another mode flag inside `applyOfflineSync*`.\n *\n * This module is deliberately pure: it takes two file censuses and returns what\n * to do. No I/O, no transport, no clock. Everything that makes reconciliation\n * risky — which side wins, what counts as converged, what is reported — is\n * decided here where it can be exhaustively tested, and the transport layer is\n * left to carry out an already-settled plan.\n */\n\n/** Which way a path must move for the two corpora to agree. */\nexport type ReconcileAction = \"pull\" | \"push\" | \"identical\" | \"conflict\" | \"suppress\";\n\n/**\n * What the planner decided for a conflicting path.\n * `supersede-link` records that both revisions need durable preservation when\n * timestamps cannot safely select a winner. Apply must stop until transport\n * can assign distinct durable identities to both revisions.\n */\nexport type ReconcileResolution = \"local-wins\" | \"peer-wins\" | \"supersede-link\" | \"unresolved\";\n\nexport interface ReconcileSemanticFileState {\n path: string;\n sha256: string;\n}\n\nexport interface ReconcileSemanticAgreement {\n local: ReconcileSemanticFileState;\n peer: ReconcileSemanticFileState;\n}\n\nexport type ReconcileSemanticChange = \"unchanged\" | \"local_changed\" | \"peer_changed\" | \"both_modified\";\n\nexport interface ReconcilePlanEntry {\n path: string;\n namespace: string;\n action: ReconcileAction;\n /** Stable machine-readable cause, safe to assert on and to aggregate. */\n reason: ReconcileReason;\n localSha256?: string;\n peerSha256?: string;\n /** Present only when a prior converged run left a cursor covering this path. */\n baseSha256?: string;\n /** Set only when `action` is `conflict`. */\n resolution?: ReconcileResolution;\n /** Original revision time when conflict resolution propagates a deletion. */\n deletionMtimeMs?: number;\n /**\n * Which side holds the retracted revision. Set only when `action` is\n * `suppress`: with different digests on each side and only one retracted,\n * the entry would otherwise be identical either way and transport could\n * delete the live copy instead of the retracted one.\n */\n suppressSide?: \"local\" | \"peer\" | \"both\";\n /**\n * Real per-side identities for a cross-path semantic agreement. Synthetic\n * rows omit the top-level side digests because `path` cannot name both files.\n */\n semanticAgreement?: ReconcileSemanticAgreement;\n /** Each side's current digest compared with its own prior semantic digest. */\n semanticChange?: ReconcileSemanticChange;\n}\n\nexport type ReconcileReason =\n | \"peer_only\"\n | \"local_only\"\n /** Cursor showed only that side moved since agreement; both still hold the path. */\n | \"peer_changed\"\n | \"local_changed\"\n | \"same_content\"\n | \"semantic_duplicate\"\n | \"both_modified\"\n | \"peer_deleted\"\n | \"local_deleted\"\n /** Peer deleted it while this side edited it — the offline-sync delete/modify pair. */\n | \"local_modified_peer_deleted\"\n | \"local_deleted_peer_modified\"\n | \"tombstoned\";\n\nexport interface ReconcileNamespaceReport {\n namespace: string;\n pull: number;\n push: number;\n identical: number;\n conflict: number;\n /** Local retractions the peer must be told about before the pair agrees. */\n suppress: number;\n /**\n * Conflicts still needing an operator: those the policy declined to settle,\n * plus supersede links whose direction could not be determined.\n */\n unresolved: number;\n}\n\nexport interface ReconcilePlan {\n entries: ReconcilePlanEntry[];\n byNamespace: ReconcileNamespaceReport[];\n /**\n * True when the two corpora already agree — every shared path matches and\n * neither side holds a path the other lacks.\n *\n * This is the idempotency contract from #2150: running reconciliation against\n * an already-converged peer must be a no-op, and a caller can skip the whole\n * transfer phase on this flag alone.\n */\n converged: boolean;\n}\n\n/** Minimal shape the planner needs; `OfflineSyncFileState` satisfies it. */\nexport type ReconcileFileState = Pick<OfflineSyncFileState, \"path\" | \"sha256\"> &\n Partial<Pick<OfflineSyncFileState, \"mtimeMs\" | \"bytes\">>;\n\nexport interface ReconcileNamespaceInput {\n namespace: string;\n local: Iterable<ReconcileFileState>;\n peer: Iterable<ReconcileFileState>;\n /**\n * File states agreed at the end of the last converged run with THIS peer.\n * Absent on a bootstrap merge, which is why a path missing from one side is\n * read as \"never seen\" rather than \"deleted\".\n */\n base?: Iterable<ReconcileFileState>;\n /**\n * Revision timestamps for paths deleted locally since the base cursor.\n * A deletion is a revision and must carry a comparable time for\n * `newest-wins`; absence alone has no timestamp.\n */\n localDeletionMtimeMs?: ReadonlyMap<string, number>;\n /** Revision timestamps for paths deleted by the peer since the base cursor. */\n peerDeletionMtimeMs?: ReadonlyMap<string, number>;\n /**\n * Digests of FILES this side has retracted, in the same form as\n * `ReconcileFileState.sha256` — a hash of the serialized file.\n *\n * Deliberately NOT `TombstoneEntry.contentHash`, which hashes the canonical\n * raw fact text and therefore never equals a file digest (§13: one content\n * form, everywhere). Mapping retracted fact hashes onto the file digests that\n * carry them is the caller's job, because only the caller can read its own\n * corpus; handing this the wrong form would silently plan `pull` and\n * resurrect every retracted fact, so the parameter name states the form.\n */\n tombstonedFileSha256?: Iterable<string>;\n /**\n * Digests the PEER has retracted, same form.\n *\n * Without this a bootstrap merge cannot tell \"the peer never had it\" from\n * \"the peer deliberately retracted it\": the peer census simply omits both,\n * so a file we still hold is planned `push` and the peer's retraction is\n * undone. Reconciliation is symmetric, so retraction has to be too.\n *\n * SCOPE: these sets decide what happens to files that still EXIST on one\n * side. Sharing the retraction records themselves is not modelled here -\n * tombstones are corpus files (`state/tombstones.jsonl`), so they reconcile\n * as ordinary paths through this same plan. A digest both censuses have\n * already dropped therefore produces no entry, by design: there is no file\n * left to act on, and synthesizing a path-less entry would hand transport\n * something it cannot apply.\n */\n peerTombstonedFileSha256?: Iterable<string>;\n}\n\nexport interface ReconcileOptions {\n conflictPolicy?: ConvergeConflictPolicy;\n /**\n * Platform whose filesystem constraints the portability gates enforce\n * (trailing dot/space, Windows-invalid characters, reserved device names).\n * Defaults to the local platform: a POSIX planner may reason about\n * POSIX-origin paths that carry characters Windows cannot store, because\n * that plan will never be applied on a Windows participant. Injectable so\n * the Windows branches stay testable from any platform.\n */\n localPlatform?: NodeJS.Platform;\n /**\n * Platform of the PEER participant when known (advertised via the\n * offline-sync capabilities route). Push entries materialize on the peer,\n * so Windows path hazards apply when EITHER participant is win32.\n */\n peerPlatform?: string;\n}\n\n/**\n * A census the planner refuses to reason about.\n *\n * Dropping a malformed or contradictory record would let the planner return\n * `converged: true` for a corpus it could not actually read, and transport is\n * invited to skip everything on that flag — so bad input fails loudly instead\n * (§1/§39).\n */\nexport class ReconcilePlanInputError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ReconcilePlanInputError\";\n }\n}\n\n/** Shared with offline-sync's census validation (issue #2477): one acceptance set. */\n\n/**\n * Validate a census record's identity fields.\n *\n * The digest matters as much as the path: two records that both omit `sha256`\n * compare `undefined === undefined` and plan as `identical`, converging a\n * corpus the planner never actually read.\n */\nfunction assertCensusRecord(\n file: ReconcileFileState | undefined,\n side: string,\n namespace: string,\n platforms: readonly (string | undefined)[]\n): ReconcileFileState {\n const path = file?.path;\n if (typeof path !== \"string\" || path.length === 0) {\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} contains a record with no path`\n );\n }\n // Same boundary offline-sync applies to this field: a peer census is\n // untrusted input, and an absolute or traversal path would otherwise become\n // a transfer instruction pointing outside the corpus root.\n try {\n validateArchiveRelativePath(path, `reconcile: ${side} census for namespace ${namespace}`);\n } catch (err) {\n throw new ReconcilePlanInputError(err instanceof Error ? err.message : String(err));\n }\n assertPortablePathSegments(path, side, namespace, platforms);\n return {\n ...file,\n path,\n sha256: assertDigest(file?.sha256, `${side} census for namespace ${namespace} entry ${path}`),\n ...(file?.mtimeMs === undefined\n ? {}\n : { mtimeMs: assertMtimeMs(file.mtimeMs, `${side} census for namespace ${namespace} entry ${path}`) }),\n };\n}\n\n/**\n * `newest-wins` decides which corpus keeps its history from this number, so a\n * NaN, an Infinity or a value past the Date range must not pick the winner.\n *\n * Fractional values ARE valid: `fs.stat()` reports sub-millisecond mtimes on\n * common filesystems and offline-sync forwards them unrounded, so this matches\n * its `assertOfflineSyncMtimeMs` — non-negative finite within Date range — and\n * deliberately does not require an integer.\n */\nfunction assertMtimeMs(value: unknown, context: string): number {\n if (!isCensusMtimeMs(value)) {\n throw new ReconcilePlanInputError(\n `reconcile: ${context} has an out-of-range mtimeMs; expected a finite value between 0 and ${CENSUS_MAX_MTIME_MS}`\n );\n }\n return value;\n}\n\n/**\n * Digests are canonicalized to lowercase, exactly as offline-sync's\n * `assertSha256` does. Keeping the caller's spelling would make two forms of\n * one digest compare unequal, so identical files would plan `both_modified`\n * and tombstone lookups would silently miss.\n */\nfunction assertDigest(value: unknown, context: string): string {\n if (!isSha256Hex(value)) {\n throw new ReconcilePlanInputError(`reconcile: ${context} must carry a 64-character sha256 hex digest`);\n }\n return value.toLowerCase();\n}\n\nfunction isPlainObject(value: unknown): boolean {\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) return false;\n const proto: unknown = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n}\n\nfunction assertNamespace(namespace: unknown): string {\n if (typeof namespace !== \"string\" || namespace.length === 0) {\n throw new ReconcilePlanInputError(\"reconcile: every namespace input needs a non-empty namespace\");\n }\n // `team` and ` team ` are one namespace to the rest of core, so accepting\n // both here would slip two inputs past the duplicate check and let them plan\n // contradictory actions for the same path. Rejected rather than silently\n // rewritten, so the namespace on every entry is the caller's own string.\n if (LONE_SURROGATE.test(namespace)) {\n // `namespaceIdentityToken()` encodes through TextEncoder, so a lone\n // surrogate and a literal U+FFFD collapse to ONE storage identity while\n // comparing as two here - slipping both past the duplicate-namespace guard.\n throw new ReconcilePlanInputError(\n \"reconcile: namespace contains an unpaired surrogate; it would collide with another namespace on disk\"\n );\n }\n if (normalizeNamespaceIdentity(namespace) !== namespace) {\n throw new ReconcilePlanInputError(\n `reconcile: namespace ${JSON.stringify(namespace)} is not canonical; pass ${JSON.stringify(normalizeNamespaceIdentity(namespace))}`\n );\n }\n return namespace;\n}\n\nfunction assertIterable(value: unknown, side: string, namespace: string): Iterable<ReconcileFileState> {\n if (\n value === null ||\n typeof value !== \"object\" ||\n typeof (value as Iterable<ReconcileFileState>)[Symbol.iterator] !== \"function\"\n ) {\n throw new ReconcilePlanInputError(`reconcile: ${side} census for namespace ${namespace} must be iterable`);\n }\n return value as Iterable<ReconcileFileState>;\n}\n\n/**\n * Two paths that a participant's filesystem resolves to ONE file must not draw\n * separate push/pull work, or application order decides which revision\n * survives. Remnic is explicitly multi-platform, so all three aliasing rules\n * are folded together and a collision is rejected rather than raced:\n * case (macOS, Windows), Unicode normalization (macOS stores decomposed and\n * compares canonically), and Win32 trailing dots/spaces, which the Windows API\n * strips before touching disk.\n */\n// eslint-disable-next-line no-control-regex -- control characters are exactly what this rejects\nconst WIN32_INVALID_CHARS = /[<>:\"|?*\\u0000-\\u001f]/;\n// Windows treats the superscripts as their digits in COM/LPT device names.\nconst LONE_SURROGATE = /[\\ud800-\\udbff](?![\\udc00-\\udfff])|(?<![\\ud800-\\udbff])[\\udc00-\\udfff]/;\nconst WIN32_RESERVED_NAMES = /^(con|prn|aux|nul|(com|lpt)[1-9\\u00b9\\u00b2\\u00b3])$/i;\n\nfunction assertPortablePathSegments(\n path: string,\n side: string,\n namespace: string,\n platforms: readonly (string | undefined)[]\n): void {\n // Windows-only hazards (trailing dot/space stripping, invalid characters\n // like `:`, reserved device names) only constrain a plan whose LOCAL\n // participant would materialize those paths on Windows. POSIX-origin\n // corpora legitimately contain `:` (e.g. sqlite sidecar names), so the\n // gates are skipped for non-win32 planners. The lone-surrogate check is\n // UNCONDITIONAL: Node mangles unpaired surrogates identically everywhere,\n // which corrupts cross-platform path comparison itself.\n const isWindows = platforms.some((candidate) => candidate === \"win32\");\n for (const segment of path.split(\"/\")) {\n if (segment.length === 0) continue;\n if (isWindows && (segment.endsWith(\".\") || segment.endsWith(\" \"))) {\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} path ${path} has a segment ending in a dot or space; ` +\n \"Windows strips those and would alias it onto another file\"\n );\n }\n // `:` opens an alternate data stream, the rest cannot be created at all,\n // and a reserved device name resolves to hardware. A plan containing any of\n // them cannot be applied on a Windows participant.\n if (LONE_SURROGATE.test(segment)) {\n // Node encodes an unpaired surrogate as U+FFFD, so this path and a\n // literal U+FFFD path are one file on disk while comparing as distinct.\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} path ${path} contains an unpaired surrogate`\n );\n }\n if (isWindows && WIN32_INVALID_CHARS.test(segment)) {\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} path ${path} contains a character Windows cannot store`\n );\n }\n if (isWindows && WIN32_RESERVED_NAMES.test(segment.split(\".\")[0] ?? \"\")) {\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} path ${path} uses a reserved Windows device name`\n );\n }\n }\n}\n\nfunction assertNoPathAlias(seen: Map<string, string>, path: string, namespace: string): void {\n // NFC first: macOS stores decomposed names and compares canonically, so\n // `é` (U+00E9) and `é` (e + U+0301) are ONE file there. Then a FULL caseless\n // fold - upper-then-lower, which collapses forms a bare toLowerCase() keeps\n // apart, such as final sigma `ς` against `σ`. Lowercasing alone would leave\n // those distinct and the planner would emit both a push and a pull.\n // `ß` upper-folds to `ss` while `ẞ` folds to `ß`, so one more pass equalizes\n // the pair that a single upper-then-lower still leaves apart.\n const folded = path\n .normalize(\"NFC\")\n .toUpperCase()\n .toLowerCase()\n .replace(/\\u00df/g, \"ss\");\n const existing = seen.get(folded);\n if (existing !== undefined && existing !== path) {\n throw new ReconcilePlanInputError(\n `reconcile: namespace ${namespace} has aliasing paths (${existing}, ${path}); ` +\n \"they resolve to one file on a case-insensitive or Unicode-normalizing peer\"\n );\n }\n seen.set(folded, path);\n}\n\n/**\n * Duplicate paths are accepted only when they agree. Two digests for one path\n * make the plan depend on which record arrived last, which would break the\n * byte-stable ordering the convergence report relies on.\n */\nfunction rejectConflictingDuplicate(\n existing: { sha256: string; mtimeMs?: number } | undefined,\n incoming: { sha256: string; mtimeMs?: number },\n path: string,\n side: string,\n namespace: string\n): boolean {\n if (!existing) return false;\n if (existing.sha256 !== incoming.sha256) {\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} lists ${path} twice with different digests`\n );\n }\n // Same bytes but a different mtime is still ambiguous: `newest-wins` reads\n // that timestamp, so accepting the first arrival would let input order decide\n // the winner.\n if (existing.mtimeMs !== incoming.mtimeMs) {\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} lists ${path} twice with different mtimeMs`\n );\n }\n return true;\n}\n\nfunction indexByPath(\n files: Iterable<ReconcileFileState>,\n side: string,\n namespace: string,\n platforms: readonly (string | undefined)[]\n): Map<string, ReconcileFileState> {\n const index = new Map<string, ReconcileFileState>();\n for (const raw of files) {\n const file = assertCensusRecord(raw, side, namespace, platforms);\n if (rejectConflictingDuplicate(index.get(file.path), file, file.path, side, namespace)) continue;\n index.set(file.path, file);\n }\n return index;\n}\n\n/**\n * A bare string satisfies `Iterable<string>`, and `new Set(\"abc…\")` would split\n * it into 64 one-character members — every membership test then misses and each\n * retracted file is planned as `pull` and resurrected. Reject the scalar and\n * canonicalize every member.\n */\nfunction parseTombstonedDigests(\n value: Iterable<string> | undefined,\n namespace: string,\n field = \"tombstonedFileSha256\"\n): Set<string> {\n if (value === undefined) return new Set();\n if (typeof value === \"string\") {\n throw new ReconcilePlanInputError(\n `reconcile: ${field} for namespace ${namespace} must be a collection of digests, not a single string`\n );\n }\n if (value === null || typeof value !== \"object\" || typeof value[Symbol.iterator] !== \"function\") {\n // Otherwise the for...of below throws a raw TypeError and a caller handling\n // ReconcilePlanInputError cannot tell a bad request from a planner bug.\n throw new ReconcilePlanInputError(\n `reconcile: ${field} for namespace ${namespace} must be an iterable collection of digests`\n );\n }\n const digests = new Set<string>();\n for (const entry of value) {\n digests.add(assertDigest(entry, `${field} for namespace ${namespace}`));\n }\n return digests;\n}\n\n/**\n * Validate a census while keeping ONLY path -> digest.\n *\n * The base cursor is read for digests alone, so indexing full records and\n * compacting afterwards would hold a corpus-sized record map and its copy at\n * once - the peak this avoids.\n */\nfunction indexDigestsByPath(\n files: Iterable<ReconcileFileState>,\n side: string,\n namespace: string,\n platforms: readonly (string | undefined)[]\n): Map<string, string> {\n const index = new Map<string, string>();\n for (const raw of files) {\n const file = assertCensusRecord(raw, side, namespace, platforms);\n const existing = index.get(file.path);\n // One map, not a parallel `seen`: the base's own mtimeMs is never a\n // decision input (only the local and peer timestamps order a conflict), so\n // a duplicate that agrees on the digest is unambiguous here regardless of\n // its timestamp, and the digest alone is enough to detect a real clash.\n if (existing !== undefined) {\n if (existing !== file.sha256) {\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} lists ${file.path} twice with different digests`\n );\n }\n continue;\n }\n index.set(file.path, file.sha256);\n }\n return index;\n}\n\nfunction assertConflictPolicy(value: ConvergeConflictPolicy | undefined): ConvergeConflictPolicy {\n if (value === undefined) return DEFAULT_CONVERGE_CONFLICT_POLICY;\n if (!CONVERGE_CONFLICT_POLICIES.includes(value)) {\n throw new ReconcilePlanInputError(\n `reconcile: unknown conflictPolicy ${JSON.stringify(value)}; expected one of ${CONVERGE_CONFLICT_POLICIES.join(\", \")}`\n );\n }\n return value;\n}\n\n/**\n * Total ordering for plan entries (§12): namespace, then path. Both are unique\n * per entry, so equal keys are impossible and the comparator never has to\n * return 0 for distinct rows — the output is byte-identical across runs, which\n * is what makes a convergence report diffable. Cursor and manifest sort with\n * this same export; a local copy on either side is how ordering drifts (§2477).\n */\nexport function compareReconcilePlanEntries(a: ReconcilePlanEntry, b: ReconcilePlanEntry): number {\n if (a.namespace !== b.namespace) return a.namespace < b.namespace ? -1 : 1;\n if (a.path !== b.path) return a.path < b.path ? -1 : 1;\n return 0;\n}\n\n/**\n * Identity of a semantic-duplicate pair: the ordered (local, peer) path pair.\n * Cursor derivation and manifest collapse must key prior agreements with this\n * same export or a stored cursor stops matching the plan that wrote it.\n */\nexport function semanticAgreementKey(agreement: ReconcileSemanticAgreement): string {\n return `${agreement.local.path}\\0${agreement.peer.path}`;\n}\n\nfunction resolveConflict(\n policy: ConvergeConflictPolicy,\n localMtimeMs: number | undefined,\n peerMtimeMs: number | undefined,\n missingTimestampResolution: ReconcileResolution\n): ReconcileResolution {\n if (policy !== \"newest-wins\") return \"unresolved\";\n if (localMtimeMs === undefined || peerMtimeMs === undefined || localMtimeMs === peerMtimeMs) {\n return missingTimestampResolution;\n }\n return localMtimeMs > peerMtimeMs ? \"local-wins\" : \"peer-wins\";\n}\n\nfunction parseDeletionMtimes(\n value: ReadonlyMap<string, number> | undefined,\n side: string,\n namespace: string,\n platforms: readonly (string | undefined)[]\n): ReadonlyMap<string, number> {\n if (value === undefined) return new Map();\n if (!(value instanceof Map)) {\n throw new ReconcilePlanInputError(`reconcile: ${side} deletion mtimes for namespace ${namespace} must be a Map`);\n }\n const parsed = new Map<string, number>();\n for (const [path, mtimeMs] of value) {\n try {\n validateArchiveRelativePath(path, `reconcile: ${side} deletion mtimes for namespace ${namespace}`);\n } catch (err) {\n throw new ReconcilePlanInputError(err instanceof Error ? err.message : String(err));\n }\n assertPortablePathSegments(path, side, namespace, platforms);\n parsed.set(path, assertMtimeMs(mtimeMs, `${side} deletion for namespace ${namespace} entry ${path}`));\n }\n return parsed;\n}\n\n/**\n * Plan one namespace. Exposed for callers that stream namespaces one at a time.\n *\n * Residency is one peer index + a set of local paths + the entry list. The\n * local census is consumed as a stream and never materialized, so a 100k-file\n * corpus does not hold two full censuses at once — but this is NOT constant\n * memory, and a caller holding its own census arrays adds to that.\n */\nexport function planNamespaceReconciliation(\n input: ReconcileNamespaceInput,\n options: ReconcileOptions = {}\n): ReconcilePlanEntry[] {\n if (!isPlainObject(input)) {\n throw new ReconcilePlanInputError(\"reconcile: namespace input must be a plain object\");\n }\n if (!isPlainObject(options)) {\n // A Date, Map or RegExp passes a bare typeof check, exposes no\n // `conflictPolicy`, and would silently take the default policy - hiding a\n // malformed request behind `manual`.\n throw new ReconcilePlanInputError(\"reconcile: options must be a plain object\");\n }\n const namespace = assertNamespace(input.namespace);\n const policy = assertConflictPolicy(options.conflictPolicy);\n const localCensus = assertIterable(input.local, \"local\", namespace);\n const caseFold = new Map<string, string>();\n // Index the peer census only, then stream the local one against it, removing\n // each match as it is consumed. Peak residency is one index plus the entry\n // list rather than two full censuses (round 2, codex P2).\n const effectivePlatforms = [options.localPlatform ?? process.platform, options.peerPlatform];\n const peer = indexByPath(assertIterable(input.peer, \"peer\", namespace), \"peer\", namespace, effectivePlatforms);\n // Only `base.sha256` is ever read, so the base is compacted to path -> digest\n // instead of a second full record index (round 7, codex P2).\n // Only an ABSENT base means bootstrap. A null/invalid cursor silently read as\n // \"no prior agreement\" would turn a peer-side deletion into a push and\n // resurrect it.\n const base =\n input.base === undefined\n ? null\n : indexDigestsByPath(assertIterable(input.base, \"base\", namespace), \"base\", namespace, effectivePlatforms);\n const tombstoned = parseTombstonedDigests(input.tombstonedFileSha256, namespace);\n const peerTombstoned = parseTombstonedDigests(input.peerTombstonedFileSha256, namespace, \"peerTombstonedFileSha256\");\n const localDeletionMtimeMs = parseDeletionMtimes(input.localDeletionMtimeMs, \"local\", namespace, effectivePlatforms);\n const peerDeletionMtimeMs = parseDeletionMtimes(input.peerDeletionMtimeMs, \"peer\", namespace, effectivePlatforms);\n const entries: ReconcilePlanEntry[] = [];\n\n // Path -> digest only, never the file objects: enough to make the stream\n // idempotent and to catch contradictory duplicates without materializing the\n // second census.\n // Base paths participate in the collision check: a base `Facts/A.md` against\n // a local `facts/a.md` is the same delete/change ambiguity on a\n // case-insensitive participant.\n if (base) for (const basePath of base.keys()) assertNoPathAlias(caseFold, basePath, namespace);\n // Path -> decision-relevant fields only, never the whole record: enough to\n // make the stream idempotent and to catch contradictory duplicates without\n // materializing the second census.\n const seenLocal = new Map<string, { sha256: string; mtimeMs?: number }>();\n for (const rawLocal of localCensus) {\n const localFile = assertCensusRecord(rawLocal, \"local\", namespace, effectivePlatforms);\n const path = localFile.path;\n assertNoPathAlias(caseFold, path, namespace);\n const seen = seenLocal.get(path);\n if (seen !== undefined) {\n // Same rule the indexed censuses get: mtimeMs is decision-relevant under\n // `newest-wins`, so a duplicate that disagrees on it is ambiguous too.\n if (rejectConflictingDuplicate(seen, localFile, path, \"local\", namespace)) continue;\n }\n seenLocal.set(path, { sha256: localFile.sha256, mtimeMs: localFile.mtimeMs });\n const peerFile = peer.get(path);\n // Consumed: whatever remains in the index afterwards is peer-only.\n peer.delete(path);\n const baseSha256 = base?.get(path);\n // Retraction outranks every other decision for this path, on EITHER side.\n // Checked before hash comparison and conflict resolution: a retracted peer\n // revision reaching the conflict ladder can win under `newest-wins`, and a\n // retracted LOCAL revision would otherwise be pushed - which is also how a\n // suppression undoes itself on the next run, since the local copy survives\n // the peer-side delete (round 4).\n // Either side's retraction removes the copy that carries the digest, so a\n // peer retraction of something we still hold suppresses OUR copy rather\n // than pushing it back.\n const localRetracted = tombstoned.has(localFile.sha256) || peerTombstoned.has(localFile.sha256);\n const peerRetracted =\n peerFile !== undefined && (tombstoned.has(peerFile.sha256) || peerTombstoned.has(peerFile.sha256));\n if (localRetracted || peerRetracted) {\n entries.push({\n path,\n namespace,\n action: \"suppress\",\n reason: \"tombstoned\",\n localSha256: localFile.sha256,\n ...(peerFile ? { peerSha256: peerFile.sha256 } : {}),\n ...(baseSha256 === undefined ? {} : { baseSha256 }),\n suppressSide: localRetracted && peerRetracted ? \"both\" : localRetracted ? \"local\" : \"peer\",\n });\n continue;\n }\n if (!peerFile) {\n // Base PRESENCE is what proves a deletion, not equality with whatever the\n // surviving side now holds. If we also edited since the base, this is\n // delete-versus-modify: still a conflict, and pushing it would resurrect\n // a deliberate deletion. Without a base the peer simply never saw the\n // path, and a bootstrap merge must push — both sides hold unique data.\n if (baseSha256 !== undefined) {\n const peerDeletionMtime = peerDeletionMtimeMs.get(path);\n const resolution =\n baseSha256 === localFile.sha256\n ? \"unresolved\"\n : resolveConflict(policy, localFile.mtimeMs, peerDeletionMtime, \"unresolved\");\n entries.push({\n path,\n namespace,\n action: \"conflict\",\n reason: baseSha256 === localFile.sha256 ? \"peer_deleted\" : \"local_modified_peer_deleted\",\n localSha256: localFile.sha256,\n baseSha256,\n resolution,\n ...(resolution === \"peer-wins\" && peerDeletionMtime !== undefined\n ? { deletionMtimeMs: peerDeletionMtime }\n : {}),\n });\n continue;\n }\n entries.push({\n path,\n namespace,\n action: \"push\",\n reason: \"local_only\",\n localSha256: localFile.sha256,\n });\n continue;\n }\n if (peerFile.sha256 === localFile.sha256) {\n entries.push({\n path,\n namespace,\n action: \"identical\",\n reason: \"same_content\",\n localSha256: localFile.sha256,\n peerSha256: peerFile.sha256,\n ...(baseSha256 === undefined ? {} : { baseSha256 }),\n });\n continue;\n }\n // A base that matches one side turns a \"conflict\" into an ordinary\n // one-sided change: that side is the only one that moved since agreement.\n if (baseSha256 !== undefined && baseSha256 === localFile.sha256) {\n entries.push({\n path,\n namespace,\n action: \"pull\",\n reason: \"peer_changed\",\n localSha256: localFile.sha256,\n peerSha256: peerFile.sha256,\n baseSha256,\n });\n continue;\n }\n if (baseSha256 !== undefined && baseSha256 === peerFile.sha256) {\n entries.push({\n path,\n namespace,\n action: \"push\",\n reason: \"local_changed\",\n localSha256: localFile.sha256,\n peerSha256: peerFile.sha256,\n baseSha256,\n });\n continue;\n }\n const resolution = resolveConflict(policy, localFile.mtimeMs, peerFile.mtimeMs, \"supersede-link\");\n entries.push({\n path,\n namespace,\n action: \"conflict\",\n reason: \"both_modified\",\n localSha256: localFile.sha256,\n peerSha256: peerFile.sha256,\n ...(baseSha256 === undefined ? {} : { baseSha256 }),\n resolution,\n });\n }\n\n for (const [path, peerFile] of peer) {\n assertNoPathAlias(caseFold, path, namespace);\n const baseSha256 = base?.get(path);\n if (tombstoned.has(peerFile.sha256) || peerTombstoned.has(peerFile.sha256)) {\n // Retracted here on purpose, and the peer still serves it. Pulling it\n // back would undo the retraction; calling it `identical` would be worse,\n // because a converged plan lets transport skip everything and the peer\n // keeps serving the retracted fact forever. It is work: propagate the\n // tombstone.\n entries.push({\n path,\n namespace,\n action: \"suppress\",\n reason: \"tombstoned\",\n peerSha256: peerFile.sha256,\n ...(baseSha256 === undefined ? {} : { baseSha256 }),\n suppressSide: \"peer\",\n });\n continue;\n }\n if (baseSha256 !== undefined) {\n const localDeletionMtime = localDeletionMtimeMs.get(path);\n const resolution =\n baseSha256 === peerFile.sha256\n ? \"unresolved\"\n : resolveConflict(policy, localDeletionMtime, peerFile.mtimeMs, \"unresolved\");\n entries.push({\n path,\n namespace,\n action: \"conflict\",\n reason: baseSha256 === peerFile.sha256 ? \"local_deleted\" : \"local_deleted_peer_modified\",\n peerSha256: peerFile.sha256,\n baseSha256,\n resolution,\n ...(resolution === \"local-wins\" && localDeletionMtime !== undefined\n ? { deletionMtimeMs: localDeletionMtime }\n : {}),\n });\n continue;\n }\n entries.push({\n path,\n namespace,\n action: \"pull\",\n reason: \"peer_only\",\n peerSha256: peerFile.sha256,\n });\n }\n\n return entries.sort(compareReconcilePlanEntries);\n}\n\n/** Aggregate entries into the per-namespace convergence report (#2150). */\nexport function summarizeReconcilePlan(entries: readonly ReconcilePlanEntry[]): ReconcileNamespaceReport[] {\n const byNamespace = new Map<string, ReconcileNamespaceReport>();\n for (const entry of entries) {\n let report = byNamespace.get(entry.namespace);\n if (!report) {\n report = { namespace: entry.namespace, pull: 0, push: 0, identical: 0, conflict: 0, suppress: 0, unresolved: 0 };\n byNamespace.set(entry.namespace, report);\n }\n report[entry.action] += 1;\n const needsOperator = entry.resolution === \"unresolved\" || entry.resolution === \"supersede-link\";\n if (entry.action === \"conflict\" && needsOperator) report.unresolved += 1;\n }\n return [...byNamespace.values()].sort((a, b) =>\n a.namespace === b.namespace ? 0 : a.namespace < b.namespace ? -1 : 1\n );\n}\n\n/**\n * Plan a full reconciliation across namespaces.\n *\n * `converged` is an affirmative claim that nothing needs to move, so it is\n * derived from the entries rather than tracked alongside them: any action other\n * than `identical` disproves it.\n */\nexport function planReconciliation(\n namespaces: readonly ReconcileNamespaceInput[],\n options: ReconcileOptions = {}\n): ReconcilePlan {\n if (!Array.isArray(namespaces)) {\n throw new ReconcilePlanInputError(\"reconcile: planReconciliation expects an array of namespace inputs\");\n }\n // Validated here too: with an empty array the per-namespace path never runs,\n // and a malformed options envelope would return `converged` instead of\n // raising - the same call failing or succeeding based on list length.\n if (!isPlainObject(options)) {\n throw new ReconcilePlanInputError(\"reconcile: options must be a plain object\");\n }\n assertConflictPolicy(options.conflictPolicy);\n const entries: ReconcilePlanEntry[] = [];\n // Two inputs for one namespace are planned independently, so the same\n // (namespace, path) can draw contradictory actions - and because those\n // entries also sort equal, batch order would decide which revision survives.\n const seenNamespaces = new Set<string>();\n for (const namespace of namespaces) {\n const name = assertNamespace(namespace?.namespace);\n if (seenNamespaces.has(name)) {\n throw new ReconcilePlanInputError(\n `reconcile: namespace ${name} appears twice; merge its censuses before planning`\n );\n }\n seenNamespaces.add(name);\n entries.push(...planNamespaceReconciliation(namespace, options));\n }\n entries.sort(compareReconcilePlanEntries);\n return {\n entries,\n byNamespace: summarizeReconcilePlan(entries),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,MAAI,CAAC,MAAM,QAAQ,UAAU,GAAG;AAC9B,UAAM,IAAI,wBAAwB,oEAAoE;AAAA,EACxG;AAIA,MAAI,CAAC,cAAc,OAAO,GAAG;AAC3B,UAAM,IAAI,wBAAwB,2CAA2C;AAAA,EAC/E;AACA,uBAAqB,QAAQ,cAAc;AAC3C,QAAM,UAAgC,CAAC;AAIvC,QAAM,iBAAiB,oBAAI,IAAY;AACvC,aAAW,aAAa,YAAY;AAClC,UAAM,OAAO,gBAAgB,WAAW,SAAS;AACjD,QAAI,eAAe,IAAI,IAAI,GAAG;AAC5B,YAAM,IAAI;AAAA,QACR,wBAAwB,IAAI;AAAA,MAC9B;AAAA,IACF;AACA,mBAAe,IAAI,IAAI;AACvB,YAAQ,KAAK,GAAG,4BAA4B,WAAW,OAAO,CAAC;AAAA,EACjE;AACA,UAAQ,KAAK,2BAA2B;AACxC,SAAO;AAAA,IACL;AAAA,IACA,aAAa,uBAAuB,OAAO;AAAA,IAC3C,WAAW,QAAQ,MAAM,CAAC,UAAU,MAAM,WAAW,WAAW;AAAA,EAClE;AACF;","names":["resolution"]}
1
+ {"version":3,"sources":["../src/reconcile/plan.ts"],"sourcesContent":["import { CENSUS_MAX_MTIME_MS, isCensusMtimeMs, isSha256Hex } from \"../census-validation.js\";\nimport { normalizeNamespaceIdentity } from \"../namespaces/identity.js\";\nimport { validateArchiveRelativePath } from \"../transfer/fs-utils.js\";\nimport type { OfflineSyncFileState } from \"../offline-sync.js\";\nimport { CONVERGE_CONFLICT_POLICIES, DEFAULT_CONVERGE_CONFLICT_POLICY } from \"../converge-config.js\";\nimport type { ConvergeConflictPolicy } from \"../types.js\";\nexport type ReconcileConflictPolicy = ConvergeConflictPolicy;\n\n/**\n * Bootstrap reconciliation planner for two peer daemons whose corpora have\n * already diverged (issue #2150).\n *\n * The offline-sync protocol assumes a satellite that shares a common base with\n * one daemon: every path it does not know about is a pull, and a conflict is\n * rare. Two long-lived daemons are the opposite case — each side holds months\n * of history the other never saw, both sides are authoritative, and there is\n * NO common base on the first run. That is a different decision problem, so it\n * gets its own planner rather than another mode flag inside `applyOfflineSync*`.\n *\n * This module is deliberately pure: it takes two file censuses and returns what\n * to do. No I/O, no transport, no clock. Everything that makes reconciliation\n * risky — which side wins, what counts as converged, what is reported — is\n * decided here where it can be exhaustively tested, and the transport layer is\n * left to carry out an already-settled plan.\n */\n\n/** Which way a path must move for the two corpora to agree. */\nexport type ReconcileAction = \"pull\" | \"push\" | \"identical\" | \"conflict\" | \"suppress\";\n\n/**\n * What the planner decided for a conflicting path.\n * `supersede-link` records that both revisions need durable preservation when\n * timestamps cannot safely select a winner. Apply must stop until transport\n * can assign distinct durable identities to both revisions.\n */\nexport type ReconcileResolution = \"local-wins\" | \"peer-wins\" | \"supersede-link\" | \"unresolved\";\n\nexport interface ReconcileSemanticFileState {\n path: string;\n sha256: string;\n}\n\nexport interface ReconcileSemanticAgreement {\n local: ReconcileSemanticFileState;\n peer: ReconcileSemanticFileState;\n}\n\nexport type ReconcileSemanticChange = \"unchanged\" | \"local_changed\" | \"peer_changed\" | \"both_modified\";\n\nexport interface ReconcilePlanEntry {\n path: string;\n namespace: string;\n action: ReconcileAction;\n /** Stable machine-readable cause, safe to assert on and to aggregate. */\n reason: ReconcileReason;\n localSha256?: string;\n peerSha256?: string;\n /** Present only when a prior converged run left a cursor covering this path. */\n baseSha256?: string;\n /** Set only when `action` is `conflict`. */\n resolution?: ReconcileResolution;\n /** Original revision time when conflict resolution propagates a deletion. */\n deletionMtimeMs?: number;\n /**\n * Which side holds the retracted revision. Set only when `action` is\n * `suppress`: with different digests on each side and only one retracted,\n * the entry would otherwise be identical either way and transport could\n * delete the live copy instead of the retracted one.\n */\n suppressSide?: \"local\" | \"peer\" | \"both\";\n /**\n * Real per-side identities for a cross-path semantic agreement. Synthetic\n * rows omit the top-level side digests because `path` cannot name both files.\n */\n semanticAgreement?: ReconcileSemanticAgreement;\n /** Each side's current digest compared with its own prior semantic digest. */\n semanticChange?: ReconcileSemanticChange;\n}\n\nexport type ReconcileReason =\n | \"peer_only\"\n | \"local_only\"\n /** Cursor showed only that side moved since agreement; both still hold the path. */\n | \"peer_changed\"\n | \"local_changed\"\n | \"same_content\"\n | \"semantic_duplicate\"\n | \"both_modified\"\n | \"peer_deleted\"\n | \"local_deleted\"\n /** Peer deleted it while this side edited it — the offline-sync delete/modify pair. */\n | \"local_modified_peer_deleted\"\n | \"local_deleted_peer_modified\"\n | \"tombstoned\";\n\nexport interface ReconcileNamespaceReport {\n namespace: string;\n pull: number;\n push: number;\n identical: number;\n conflict: number;\n /** Local retractions the peer must be told about before the pair agrees. */\n suppress: number;\n /**\n * Conflicts still needing an operator: those the policy declined to settle,\n * plus supersede links whose direction could not be determined.\n */\n unresolved: number;\n}\n\nexport interface ReconcilePlan {\n entries: ReconcilePlanEntry[];\n byNamespace: ReconcileNamespaceReport[];\n /**\n * True when the two corpora already agree — every shared path matches and\n * neither side holds a path the other lacks.\n *\n * This is the idempotency contract from #2150: running reconciliation against\n * an already-converged peer must be a no-op, and a caller can skip the whole\n * transfer phase on this flag alone.\n */\n converged: boolean;\n}\n\n/** Minimal shape the planner needs; `OfflineSyncFileState` satisfies it. */\nexport type ReconcileFileState = Pick<OfflineSyncFileState, \"path\" | \"sha256\"> &\n Partial<Pick<OfflineSyncFileState, \"mtimeMs\" | \"bytes\">>;\n\nexport interface ReconcileNamespaceInput {\n namespace: string;\n local: Iterable<ReconcileFileState>;\n peer: Iterable<ReconcileFileState>;\n /**\n * File states agreed at the end of the last converged run with THIS peer.\n * Absent on a bootstrap merge, which is why a path missing from one side is\n * read as \"never seen\" rather than \"deleted\".\n */\n base?: Iterable<ReconcileFileState>;\n /**\n * Revision timestamps for paths deleted locally since the base cursor.\n * A deletion is a revision and must carry a comparable time for\n * `newest-wins`; absence alone has no timestamp.\n */\n localDeletionMtimeMs?: ReadonlyMap<string, number>;\n /** Revision timestamps for paths deleted by the peer since the base cursor. */\n peerDeletionMtimeMs?: ReadonlyMap<string, number>;\n /**\n * Digests of FILES this side has retracted, in the same form as\n * `ReconcileFileState.sha256` — a hash of the serialized file.\n *\n * Deliberately NOT `TombstoneEntry.contentHash`, which hashes the canonical\n * raw fact text and therefore never equals a file digest (§13: one content\n * form, everywhere). Mapping retracted fact hashes onto the file digests that\n * carry them is the caller's job, because only the caller can read its own\n * corpus; handing this the wrong form would silently plan `pull` and\n * resurrect every retracted fact, so the parameter name states the form.\n */\n tombstonedFileSha256?: Iterable<string>;\n /**\n * Digests the PEER has retracted, same form.\n *\n * Without this a bootstrap merge cannot tell \"the peer never had it\" from\n * \"the peer deliberately retracted it\": the peer census simply omits both,\n * so a file we still hold is planned `push` and the peer's retraction is\n * undone. Reconciliation is symmetric, so retraction has to be too.\n *\n * SCOPE: these sets decide what happens to files that still EXIST on one\n * side. Sharing the retraction records themselves is not modelled here -\n * tombstones are corpus files (`state/tombstones.jsonl`), so they reconcile\n * as ordinary paths through this same plan. A digest both censuses have\n * already dropped therefore produces no entry, by design: there is no file\n * left to act on, and synthesizing a path-less entry would hand transport\n * something it cannot apply.\n */\n peerTombstonedFileSha256?: Iterable<string>;\n}\n\nexport interface ReconcileOptions {\n conflictPolicy?: ConvergeConflictPolicy;\n /**\n * Platform whose filesystem constraints the portability gates enforce\n * (trailing dot/space, Windows-invalid characters, reserved device names).\n * Defaults to the local platform: a POSIX planner may reason about\n * POSIX-origin paths that carry characters Windows cannot store, because\n * that plan will never be applied on a Windows participant. Injectable so\n * the Windows branches stay testable from any platform.\n */\n localPlatform?: NodeJS.Platform;\n /**\n * Platform of the PEER participant when known (advertised via the\n * offline-sync capabilities route). Push entries materialize on the peer,\n * so Windows path hazards apply when EITHER participant is win32.\n */\n peerPlatform?: string;\n}\n\n/**\n * A census the planner refuses to reason about.\n *\n * Dropping a malformed or contradictory record would let the planner return\n * `converged: true` for a corpus it could not actually read, and transport is\n * invited to skip everything on that flag — so bad input fails loudly instead\n * (§1/§39).\n */\nexport class ReconcilePlanInputError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ReconcilePlanInputError\";\n }\n}\n\n/** Shared with offline-sync's census validation (issue #2477): one acceptance set. */\n\n/**\n * Validate a census record's identity fields.\n *\n * The digest matters as much as the path: two records that both omit `sha256`\n * compare `undefined === undefined` and plan as `identical`, converging a\n * corpus the planner never actually read.\n */\nfunction assertCensusRecord(\n file: ReconcileFileState | undefined,\n side: string,\n namespace: string,\n platforms: readonly (string | undefined)[]\n): ReconcileFileState {\n const path = file?.path;\n if (typeof path !== \"string\" || path.length === 0) {\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} contains a record with no path`\n );\n }\n // Same boundary offline-sync applies to this field: a peer census is\n // untrusted input, and an absolute or traversal path would otherwise become\n // a transfer instruction pointing outside the corpus root.\n try {\n validateArchiveRelativePath(path, `reconcile: ${side} census for namespace ${namespace}`);\n } catch (err) {\n throw new ReconcilePlanInputError(err instanceof Error ? err.message : String(err));\n }\n assertPortablePathSegments(path, side, namespace, platforms);\n return {\n ...file,\n path,\n sha256: assertDigest(file?.sha256, `${side} census for namespace ${namespace} entry ${path}`),\n ...(file?.mtimeMs === undefined\n ? {}\n : { mtimeMs: assertMtimeMs(file.mtimeMs, `${side} census for namespace ${namespace} entry ${path}`) }),\n };\n}\n\n/**\n * `newest-wins` decides which corpus keeps its history from this number, so a\n * NaN, an Infinity or a value past the Date range must not pick the winner.\n *\n * Fractional values ARE valid: `fs.stat()` reports sub-millisecond mtimes on\n * common filesystems and offline-sync forwards them unrounded, so this matches\n * its `assertOfflineSyncMtimeMs` — non-negative finite within Date range — and\n * deliberately does not require an integer.\n */\nfunction assertMtimeMs(value: unknown, context: string): number {\n if (!isCensusMtimeMs(value)) {\n throw new ReconcilePlanInputError(\n `reconcile: ${context} has an out-of-range mtimeMs; expected a finite value between 0 and ${CENSUS_MAX_MTIME_MS}`\n );\n }\n return value;\n}\n\n/**\n * Digests are canonicalized to lowercase, exactly as offline-sync's\n * `assertSha256` does. Keeping the caller's spelling would make two forms of\n * one digest compare unequal, so identical files would plan `both_modified`\n * and tombstone lookups would silently miss.\n */\nfunction assertDigest(value: unknown, context: string): string {\n if (!isSha256Hex(value)) {\n throw new ReconcilePlanInputError(`reconcile: ${context} must carry a 64-character sha256 hex digest`);\n }\n return value.toLowerCase();\n}\n\nfunction isPlainObject(value: unknown): boolean {\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) return false;\n const proto: unknown = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n}\n\nfunction assertNamespace(namespace: unknown): string {\n if (typeof namespace !== \"string\" || namespace.length === 0) {\n throw new ReconcilePlanInputError(\"reconcile: every namespace input needs a non-empty namespace\");\n }\n // `team` and ` team ` are one namespace to the rest of core, so accepting\n // both here would slip two inputs past the duplicate check and let them plan\n // contradictory actions for the same path. Rejected rather than silently\n // rewritten, so the namespace on every entry is the caller's own string.\n if (LONE_SURROGATE.test(namespace)) {\n // `namespaceIdentityToken()` encodes through TextEncoder, so a lone\n // surrogate and a literal U+FFFD collapse to ONE storage identity while\n // comparing as two here - slipping both past the duplicate-namespace guard.\n throw new ReconcilePlanInputError(\n \"reconcile: namespace contains an unpaired surrogate; it would collide with another namespace on disk\"\n );\n }\n if (normalizeNamespaceIdentity(namespace) !== namespace) {\n throw new ReconcilePlanInputError(\n `reconcile: namespace ${JSON.stringify(namespace)} is not canonical; pass ${JSON.stringify(normalizeNamespaceIdentity(namespace))}`\n );\n }\n return namespace;\n}\n\nfunction assertIterable(value: unknown, side: string, namespace: string): Iterable<ReconcileFileState> {\n if (\n value === null ||\n typeof value !== \"object\" ||\n typeof (value as Iterable<ReconcileFileState>)[Symbol.iterator] !== \"function\"\n ) {\n throw new ReconcilePlanInputError(`reconcile: ${side} census for namespace ${namespace} must be iterable`);\n }\n return value as Iterable<ReconcileFileState>;\n}\n\n/**\n * Two paths that a participant's filesystem resolves to ONE file must not draw\n * separate push/pull work, or application order decides which revision\n * survives. Remnic is explicitly multi-platform, so all three aliasing rules\n * are folded together and a collision is rejected rather than raced:\n * case (macOS, Windows), Unicode normalization (macOS stores decomposed and\n * compares canonically), and Win32 trailing dots/spaces, which the Windows API\n * strips before touching disk.\n */\n// eslint-disable-next-line no-control-regex -- control characters are exactly what this rejects\nconst WIN32_INVALID_CHARS = /[<>:\"|?*\\u0000-\\u001f]/;\n// Windows treats the superscripts as their digits in COM/LPT device names.\nconst LONE_SURROGATE = /[\\ud800-\\udbff](?![\\udc00-\\udfff])|(?<![\\ud800-\\udbff])[\\udc00-\\udfff]/;\nconst WIN32_RESERVED_NAMES = /^(con|prn|aux|nul|(com|lpt)[1-9\\u00b9\\u00b2\\u00b3])$/i;\n\nfunction assertPortablePathSegments(\n path: string,\n side: string,\n namespace: string,\n platforms: readonly (string | undefined)[]\n): void {\n // Windows-only hazards (trailing dot/space stripping, invalid characters\n // like `:`, reserved device names) only constrain a plan whose LOCAL\n // participant would materialize those paths on Windows. POSIX-origin\n // corpora legitimately contain `:` (e.g. sqlite sidecar names), so the\n // gates are skipped for non-win32 planners. The lone-surrogate check is\n // UNCONDITIONAL: Node mangles unpaired surrogates identically everywhere,\n // which corrupts cross-platform path comparison itself.\n const isWindows = platforms.some((candidate) => candidate === \"win32\");\n for (const segment of path.split(\"/\")) {\n if (segment.length === 0) continue;\n if (isWindows && (segment.endsWith(\".\") || segment.endsWith(\" \"))) {\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} path ${path} has a segment ending in a dot or space; ` +\n \"Windows strips those and would alias it onto another file\"\n );\n }\n // `:` opens an alternate data stream, the rest cannot be created at all,\n // and a reserved device name resolves to hardware. A plan containing any of\n // them cannot be applied on a Windows participant.\n if (LONE_SURROGATE.test(segment)) {\n // Node encodes an unpaired surrogate as U+FFFD, so this path and a\n // literal U+FFFD path are one file on disk while comparing as distinct.\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} path ${path} contains an unpaired surrogate`\n );\n }\n if (isWindows && WIN32_INVALID_CHARS.test(segment)) {\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} path ${path} contains a character Windows cannot store`\n );\n }\n if (isWindows && WIN32_RESERVED_NAMES.test(segment.split(\".\")[0] ?? \"\")) {\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} path ${path} uses a reserved Windows device name`\n );\n }\n }\n}\n\nfunction assertNoPathAlias(seen: Map<string, string>, path: string, namespace: string): void {\n // NFC first: macOS stores decomposed names and compares canonically, so\n // `é` (U+00E9) and `é` (e + U+0301) are ONE file there. Then a FULL caseless\n // fold - upper-then-lower, which collapses forms a bare toLowerCase() keeps\n // apart, such as final sigma `ς` against `σ`. Lowercasing alone would leave\n // those distinct and the planner would emit both a push and a pull.\n // `ß` upper-folds to `ss` while `ẞ` folds to `ß`, so one more pass equalizes\n // the pair that a single upper-then-lower still leaves apart.\n const folded = path\n .normalize(\"NFC\")\n .toUpperCase()\n .toLowerCase()\n .replace(/\\u00df/g, \"ss\");\n const existing = seen.get(folded);\n if (existing !== undefined && existing !== path) {\n throw new ReconcilePlanInputError(\n `reconcile: namespace ${namespace} has aliasing paths (${existing}, ${path}); ` +\n \"they resolve to one file on a case-insensitive or Unicode-normalizing peer\"\n );\n }\n seen.set(folded, path);\n}\n\n/**\n * Duplicate paths are accepted only when they agree. Two digests for one path\n * make the plan depend on which record arrived last, which would break the\n * byte-stable ordering the convergence report relies on.\n */\nfunction rejectConflictingDuplicate(\n existing: { sha256: string; mtimeMs?: number } | undefined,\n incoming: { sha256: string; mtimeMs?: number },\n path: string,\n side: string,\n namespace: string\n): boolean {\n if (!existing) return false;\n if (existing.sha256 !== incoming.sha256) {\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} lists ${path} twice with different digests`\n );\n }\n // Same bytes but a different mtime is still ambiguous: `newest-wins` reads\n // that timestamp, so accepting the first arrival would let input order decide\n // the winner.\n if (existing.mtimeMs !== incoming.mtimeMs) {\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} lists ${path} twice with different mtimeMs`\n );\n }\n return true;\n}\n\nfunction indexByPath(\n files: Iterable<ReconcileFileState>,\n side: string,\n namespace: string,\n platforms: readonly (string | undefined)[]\n): Map<string, ReconcileFileState> {\n const index = new Map<string, ReconcileFileState>();\n for (const raw of files) {\n const file = assertCensusRecord(raw, side, namespace, platforms);\n if (rejectConflictingDuplicate(index.get(file.path), file, file.path, side, namespace)) continue;\n index.set(file.path, file);\n }\n return index;\n}\n\n/**\n * A bare string satisfies `Iterable<string>`, and `new Set(\"abc…\")` would split\n * it into 64 one-character members — every membership test then misses and each\n * retracted file is planned as `pull` and resurrected. Reject the scalar and\n * canonicalize every member.\n */\nfunction parseTombstonedDigests(\n value: Iterable<string> | undefined,\n namespace: string,\n field = \"tombstonedFileSha256\"\n): Set<string> {\n if (value === undefined) return new Set();\n if (typeof value === \"string\") {\n throw new ReconcilePlanInputError(\n `reconcile: ${field} for namespace ${namespace} must be a collection of digests, not a single string`\n );\n }\n if (value === null || typeof value !== \"object\" || typeof value[Symbol.iterator] !== \"function\") {\n // Otherwise the for...of below throws a raw TypeError and a caller handling\n // ReconcilePlanInputError cannot tell a bad request from a planner bug.\n throw new ReconcilePlanInputError(\n `reconcile: ${field} for namespace ${namespace} must be an iterable collection of digests`\n );\n }\n const digests = new Set<string>();\n for (const entry of value) {\n digests.add(assertDigest(entry, `${field} for namespace ${namespace}`));\n }\n return digests;\n}\n\n/**\n * Validate a census while keeping ONLY path -> digest.\n *\n * The base cursor is read for digests alone, so indexing full records and\n * compacting afterwards would hold a corpus-sized record map and its copy at\n * once - the peak this avoids.\n */\nfunction indexDigestsByPath(\n files: Iterable<ReconcileFileState>,\n side: string,\n namespace: string,\n platforms: readonly (string | undefined)[]\n): Map<string, string> {\n const index = new Map<string, string>();\n for (const raw of files) {\n const file = assertCensusRecord(raw, side, namespace, platforms);\n const existing = index.get(file.path);\n // One map, not a parallel `seen`: the base's own mtimeMs is never a\n // decision input (only the local and peer timestamps order a conflict), so\n // a duplicate that agrees on the digest is unambiguous here regardless of\n // its timestamp, and the digest alone is enough to detect a real clash.\n if (existing !== undefined) {\n if (existing !== file.sha256) {\n throw new ReconcilePlanInputError(\n `reconcile: ${side} census for namespace ${namespace} lists ${file.path} twice with different digests`\n );\n }\n continue;\n }\n index.set(file.path, file.sha256);\n }\n return index;\n}\n\nfunction assertConflictPolicy(value: ConvergeConflictPolicy | undefined): ConvergeConflictPolicy {\n if (value === undefined) return DEFAULT_CONVERGE_CONFLICT_POLICY;\n if (!CONVERGE_CONFLICT_POLICIES.includes(value)) {\n throw new ReconcilePlanInputError(\n `reconcile: unknown conflictPolicy ${JSON.stringify(value)}; expected one of ${CONVERGE_CONFLICT_POLICIES.join(\", \")}`\n );\n }\n return value;\n}\n\n/**\n * Total ordering for plan entries (§12): namespace, then path. Both are unique\n * per entry, so equal keys are impossible and the comparator never has to\n * return 0 for distinct rows — the output is byte-identical across runs, which\n * is what makes a convergence report diffable. Cursor and manifest sort with\n * this same export; a local copy on either side is how ordering drifts (§2477).\n */\nexport function compareReconcilePlanEntries(a: ReconcilePlanEntry, b: ReconcilePlanEntry): number {\n if (a.namespace !== b.namespace) return a.namespace < b.namespace ? -1 : 1;\n if (a.path !== b.path) return a.path < b.path ? -1 : 1;\n return 0;\n}\n\n/**\n * Identity of a semantic-duplicate pair: the ordered (local, peer) path pair.\n * Cursor derivation and manifest collapse must key prior agreements with this\n * same export or a stored cursor stops matching the plan that wrote it.\n */\nexport function semanticAgreementKey(agreement: ReconcileSemanticAgreement): string {\n return `${agreement.local.path}\\0${agreement.peer.path}`;\n}\n\nfunction resolveConflict(\n policy: ConvergeConflictPolicy,\n localMtimeMs: number | undefined,\n peerMtimeMs: number | undefined,\n missingTimestampResolution: ReconcileResolution\n): ReconcileResolution {\n if (policy !== \"newest-wins\") return \"unresolved\";\n if (localMtimeMs === undefined || peerMtimeMs === undefined || localMtimeMs === peerMtimeMs) {\n return missingTimestampResolution;\n }\n return localMtimeMs > peerMtimeMs ? \"local-wins\" : \"peer-wins\";\n}\n\nfunction parseDeletionMtimes(\n value: ReadonlyMap<string, number> | undefined,\n side: string,\n namespace: string,\n platforms: readonly (string | undefined)[]\n): ReadonlyMap<string, number> {\n if (value === undefined) return new Map();\n if (!(value instanceof Map)) {\n throw new ReconcilePlanInputError(`reconcile: ${side} deletion mtimes for namespace ${namespace} must be a Map`);\n }\n const parsed = new Map<string, number>();\n for (const [path, mtimeMs] of value) {\n try {\n validateArchiveRelativePath(path, `reconcile: ${side} deletion mtimes for namespace ${namespace}`);\n } catch (err) {\n throw new ReconcilePlanInputError(err instanceof Error ? err.message : String(err));\n }\n assertPortablePathSegments(path, side, namespace, platforms);\n parsed.set(path, assertMtimeMs(mtimeMs, `${side} deletion for namespace ${namespace} entry ${path}`));\n }\n return parsed;\n}\n\n/**\n * Plan one namespace. Exposed for callers that stream namespaces one at a time.\n *\n * Residency is one peer index + a set of local paths + the entry list. The\n * local census is consumed as a stream and never materialized, so a 100k-file\n * corpus does not hold two full censuses at once — but this is NOT constant\n * memory, and a caller holding its own census arrays adds to that.\n */\nexport function planNamespaceReconciliation(\n input: ReconcileNamespaceInput,\n options: ReconcileOptions = {}\n): ReconcilePlanEntry[] {\n if (!isPlainObject(input)) {\n throw new ReconcilePlanInputError(\"reconcile: namespace input must be a plain object\");\n }\n if (!isPlainObject(options)) {\n // A Date, Map or RegExp passes a bare typeof check, exposes no\n // `conflictPolicy`, and would silently take the default policy - hiding a\n // malformed request behind `manual`.\n throw new ReconcilePlanInputError(\"reconcile: options must be a plain object\");\n }\n const namespace = assertNamespace(input.namespace);\n const policy = assertConflictPolicy(options.conflictPolicy);\n const localCensus = assertIterable(input.local, \"local\", namespace);\n const caseFold = new Map<string, string>();\n // Index the peer census only, then stream the local one against it, removing\n // each match as it is consumed. Peak residency is one index plus the entry\n // list rather than two full censuses (round 2, codex P2).\n const effectivePlatforms = [options.localPlatform ?? process.platform, options.peerPlatform];\n const peer = indexByPath(assertIterable(input.peer, \"peer\", namespace), \"peer\", namespace, effectivePlatforms);\n // Only `base.sha256` is ever read, so the base is compacted to path -> digest\n // instead of a second full record index (round 7, codex P2).\n // Only an ABSENT base means bootstrap. A null/invalid cursor silently read as\n // \"no prior agreement\" would turn a peer-side deletion into a push and\n // resurrect it.\n const base =\n input.base === undefined\n ? null\n : indexDigestsByPath(assertIterable(input.base, \"base\", namespace), \"base\", namespace, effectivePlatforms);\n const tombstoned = parseTombstonedDigests(input.tombstonedFileSha256, namespace);\n const peerTombstoned = parseTombstonedDigests(input.peerTombstonedFileSha256, namespace, \"peerTombstonedFileSha256\");\n const localDeletionMtimeMs = parseDeletionMtimes(input.localDeletionMtimeMs, \"local\", namespace, effectivePlatforms);\n const peerDeletionMtimeMs = parseDeletionMtimes(input.peerDeletionMtimeMs, \"peer\", namespace, effectivePlatforms);\n const entries: ReconcilePlanEntry[] = [];\n\n // Path -> digest only, never the file objects: enough to make the stream\n // idempotent and to catch contradictory duplicates without materializing the\n // second census.\n // Base paths participate in the collision check: a base `Facts/A.md` against\n // a local `facts/a.md` is the same delete/change ambiguity on a\n // case-insensitive participant.\n if (base) for (const basePath of base.keys()) assertNoPathAlias(caseFold, basePath, namespace);\n // Path -> decision-relevant fields only, never the whole record: enough to\n // make the stream idempotent and to catch contradictory duplicates without\n // materializing the second census.\n const seenLocal = new Map<string, { sha256: string; mtimeMs?: number }>();\n for (const rawLocal of localCensus) {\n const localFile = assertCensusRecord(rawLocal, \"local\", namespace, effectivePlatforms);\n const path = localFile.path;\n assertNoPathAlias(caseFold, path, namespace);\n const seen = seenLocal.get(path);\n if (seen !== undefined) {\n // Same rule the indexed censuses get: mtimeMs is decision-relevant under\n // `newest-wins`, so a duplicate that disagrees on it is ambiguous too.\n if (rejectConflictingDuplicate(seen, localFile, path, \"local\", namespace)) continue;\n }\n seenLocal.set(path, { sha256: localFile.sha256, mtimeMs: localFile.mtimeMs });\n const peerFile = peer.get(path);\n // Consumed: whatever remains in the index afterwards is peer-only.\n peer.delete(path);\n const baseSha256 = base?.get(path);\n // Retraction outranks every other decision for this path, on EITHER side.\n // Checked before hash comparison and conflict resolution: a retracted peer\n // revision reaching the conflict ladder can win under `newest-wins`, and a\n // retracted LOCAL revision would otherwise be pushed - which is also how a\n // suppression undoes itself on the next run, since the local copy survives\n // the peer-side delete (round 4).\n // Either side's retraction removes the copy that carries the digest, so a\n // peer retraction of something we still hold suppresses OUR copy rather\n // than pushing it back.\n const localRetracted = tombstoned.has(localFile.sha256) || peerTombstoned.has(localFile.sha256);\n const peerRetracted =\n peerFile !== undefined && (tombstoned.has(peerFile.sha256) || peerTombstoned.has(peerFile.sha256));\n if (localRetracted || peerRetracted) {\n entries.push({\n path,\n namespace,\n action: \"suppress\",\n reason: \"tombstoned\",\n localSha256: localFile.sha256,\n ...(peerFile ? { peerSha256: peerFile.sha256 } : {}),\n ...(baseSha256 === undefined ? {} : { baseSha256 }),\n suppressSide: localRetracted && peerRetracted ? \"both\" : localRetracted ? \"local\" : \"peer\",\n });\n continue;\n }\n if (!peerFile) {\n // Base PRESENCE is what proves a deletion, not equality with whatever the\n // surviving side now holds. If we also edited since the base, this is\n // delete-versus-modify: still a conflict, and pushing it would resurrect\n // a deliberate deletion. Without a base the peer simply never saw the\n // path, and a bootstrap merge must push — both sides hold unique data.\n if (baseSha256 !== undefined) {\n const peerDeletionMtime = peerDeletionMtimeMs.get(path);\n const resolution =\n baseSha256 === localFile.sha256\n ? \"unresolved\"\n : resolveConflict(policy, localFile.mtimeMs, peerDeletionMtime, \"unresolved\");\n entries.push({\n path,\n namespace,\n action: \"conflict\",\n reason: baseSha256 === localFile.sha256 ? \"peer_deleted\" : \"local_modified_peer_deleted\",\n localSha256: localFile.sha256,\n baseSha256,\n resolution,\n ...(resolution === \"peer-wins\" && peerDeletionMtime !== undefined\n ? { deletionMtimeMs: peerDeletionMtime }\n : {}),\n });\n continue;\n }\n entries.push({\n path,\n namespace,\n action: \"push\",\n reason: \"local_only\",\n localSha256: localFile.sha256,\n });\n continue;\n }\n if (peerFile.sha256 === localFile.sha256) {\n entries.push({\n path,\n namespace,\n action: \"identical\",\n reason: \"same_content\",\n localSha256: localFile.sha256,\n peerSha256: peerFile.sha256,\n ...(baseSha256 === undefined ? {} : { baseSha256 }),\n });\n continue;\n }\n // A base that matches one side turns a \"conflict\" into an ordinary\n // one-sided change: that side is the only one that moved since agreement.\n if (baseSha256 !== undefined && baseSha256 === localFile.sha256) {\n entries.push({\n path,\n namespace,\n action: \"pull\",\n reason: \"peer_changed\",\n localSha256: localFile.sha256,\n peerSha256: peerFile.sha256,\n baseSha256,\n });\n continue;\n }\n if (baseSha256 !== undefined && baseSha256 === peerFile.sha256) {\n entries.push({\n path,\n namespace,\n action: \"push\",\n reason: \"local_changed\",\n localSha256: localFile.sha256,\n peerSha256: peerFile.sha256,\n baseSha256,\n });\n continue;\n }\n const resolution = resolveConflict(policy, localFile.mtimeMs, peerFile.mtimeMs, \"supersede-link\");\n entries.push({\n path,\n namespace,\n action: \"conflict\",\n reason: \"both_modified\",\n localSha256: localFile.sha256,\n peerSha256: peerFile.sha256,\n ...(baseSha256 === undefined ? {} : { baseSha256 }),\n resolution,\n });\n }\n\n for (const [path, peerFile] of peer) {\n assertNoPathAlias(caseFold, path, namespace);\n const baseSha256 = base?.get(path);\n if (tombstoned.has(peerFile.sha256) || peerTombstoned.has(peerFile.sha256)) {\n // Retracted here on purpose, and the peer still serves it. Pulling it\n // back would undo the retraction; calling it `identical` would be worse,\n // because a converged plan lets transport skip everything and the peer\n // keeps serving the retracted fact forever. It is work: propagate the\n // tombstone.\n entries.push({\n path,\n namespace,\n action: \"suppress\",\n reason: \"tombstoned\",\n peerSha256: peerFile.sha256,\n ...(baseSha256 === undefined ? {} : { baseSha256 }),\n suppressSide: \"peer\",\n });\n continue;\n }\n if (baseSha256 !== undefined) {\n const localDeletionMtime = localDeletionMtimeMs.get(path);\n const resolution =\n baseSha256 === peerFile.sha256\n ? \"unresolved\"\n : resolveConflict(policy, localDeletionMtime, peerFile.mtimeMs, \"unresolved\");\n entries.push({\n path,\n namespace,\n action: \"conflict\",\n reason: baseSha256 === peerFile.sha256 ? \"local_deleted\" : \"local_deleted_peer_modified\",\n peerSha256: peerFile.sha256,\n baseSha256,\n resolution,\n ...(resolution === \"local-wins\" && localDeletionMtime !== undefined\n ? { deletionMtimeMs: localDeletionMtime }\n : {}),\n });\n continue;\n }\n entries.push({\n path,\n namespace,\n action: \"pull\",\n reason: \"peer_only\",\n peerSha256: peerFile.sha256,\n });\n }\n\n return entries.sort(compareReconcilePlanEntries);\n}\n\n/** Aggregate entries into the per-namespace convergence report (#2150). */\nexport function summarizeReconcilePlan(entries: readonly ReconcilePlanEntry[]): ReconcileNamespaceReport[] {\n const byNamespace = new Map<string, ReconcileNamespaceReport>();\n for (const entry of entries) {\n let report = byNamespace.get(entry.namespace);\n if (!report) {\n report = { namespace: entry.namespace, pull: 0, push: 0, identical: 0, conflict: 0, suppress: 0, unresolved: 0 };\n byNamespace.set(entry.namespace, report);\n }\n report[entry.action] += 1;\n const needsOperator = entry.resolution === \"unresolved\" || entry.resolution === \"supersede-link\";\n if (entry.action === \"conflict\" && needsOperator) report.unresolved += 1;\n }\n return [...byNamespace.values()].sort((a, b) =>\n a.namespace === b.namespace ? 0 : a.namespace < b.namespace ? -1 : 1\n );\n}\n\n/**\n * Plan a full reconciliation across namespaces.\n *\n * `converged` is an affirmative claim that nothing needs to move, so it is\n * derived from the entries rather than tracked alongside them: any action other\n * than `identical` disproves it.\n */\nexport function planReconciliation(\n namespaces: readonly ReconcileNamespaceInput[],\n options: ReconcileOptions = {}\n): ReconcilePlan {\n if (!Array.isArray(namespaces)) {\n throw new ReconcilePlanInputError(\"reconcile: planReconciliation expects an array of namespace inputs\");\n }\n // Validated here too: with an empty array the per-namespace path never runs,\n // and a malformed options envelope would return `converged` instead of\n // raising - the same call failing or succeeding based on list length.\n if (!isPlainObject(options)) {\n throw new ReconcilePlanInputError(\"reconcile: options must be a plain object\");\n }\n assertConflictPolicy(options.conflictPolicy);\n const entries: ReconcilePlanEntry[] = [];\n // Two inputs for one namespace are planned independently, so the same\n // (namespace, path) can draw contradictory actions - and because those\n // entries also sort equal, batch order would decide which revision survives.\n const seenNamespaces = new Set<string>();\n for (const namespace of namespaces) {\n const name = assertNamespace(namespace?.namespace);\n if (seenNamespaces.has(name)) {\n throw new ReconcilePlanInputError(\n `reconcile: namespace ${name} appears twice; merge its censuses before planning`\n );\n }\n seenNamespaces.add(name);\n // Spread-push over a boot-scale namespace (~100k entries) exceeds the\n // call-stack argument limit (RangeError: Maximum call stack size exceeded)\n // — push per entry instead.\n for (const entry of planNamespaceReconciliation(namespace, options)) {\n entries.push(entry);\n }\n }\n entries.sort(compareReconcilePlanEntries);\n return {\n entries,\n byNamespace: summarizeReconcilePlan(entries),\n converged: entries.every((entry) => entry.action === \"identical\"),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4MO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EACjD,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAWA,SAAS,mBACP,MACA,MACA,WACA,WACoB;AACpB,QAAM,OAAO,MAAM;AACnB,MAAI,OAAO,SAAS,YAAY,KAAK,WAAW,GAAG;AACjD,UAAM,IAAI;AAAA,MACR,cAAc,IAAI,yBAAyB,SAAS;AAAA,IACtD;AAAA,EACF;AAIA,MAAI;AACF,gCAA4B,MAAM,cAAc,IAAI,yBAAyB,SAAS,EAAE;AAAA,EAC1F,SAAS,KAAK;AACZ,UAAM,IAAI,wBAAwB,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAAA,EACpF;AACA,6BAA2B,MAAM,MAAM,WAAW,SAAS;AAC3D,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA,QAAQ,aAAa,MAAM,QAAQ,GAAG,IAAI,yBAAyB,SAAS,UAAU,IAAI,EAAE;AAAA,IAC5F,GAAI,MAAM,YAAY,SAClB,CAAC,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212
  runTimelinePublishCli,
213
213
  screenCandidateFact,
214
214
  summarizeVaultPublish
215
- } from "./chunk-CVJMGVEW.js";
215
+ } from "./chunk-TR5X2L4W.js";
216
216
  import {
217
217
  RoutingRulesStore
218
218
  } from "./chunk-TBUEE7XF.js";
@@ -323,7 +323,7 @@ import {
323
323
  } from "./chunk-OGUKSLYZ.js";
324
324
  import {
325
325
  MeetingsInputError
326
- } from "./chunk-PC7WNIRL.js";
326
+ } from "./chunk-22YEAYMV.js";
327
327
  import {
328
328
  WearablesInputError,
329
329
  describeErrorForOperator
@@ -349,7 +349,7 @@ import {
349
349
  isTopLevelArchivePath,
350
350
  journalPath,
351
351
  writeJournalFile
352
- } from "./chunk-IZZ7Q2RJ.js";
352
+ } from "./chunk-TC3ZDFMD.js";
353
353
  import {
354
354
  importCapsule
355
355
  } from "./chunk-J2R275FN.js";
@@ -29709,4 +29709,4 @@ export {
29709
29709
  blendGraphExpandedRecallScore,
29710
29710
  Orchestrator
29711
29711
  };
29712
- //# sourceMappingURL=chunk-5MF4EGL5.js.map
29712
+ //# sourceMappingURL=chunk-PPJZMPUX.js.map
@@ -3,7 +3,7 @@ import {
3
3
  getOperation,
4
4
  operationRequiresAuthorizedNamespace,
5
5
  operationUsesPrincipalNamespace
6
- } from "./chunk-IZZ7Q2RJ.js";
6
+ } from "./chunk-TC3ZDFMD.js";
7
7
  import {
8
8
  assertOperationAuthorizationAllowed
9
9
  } from "./chunk-MZWSOLMT.js";
@@ -60,4 +60,4 @@ export {
60
60
  authorizationProbeNamespaces,
61
61
  authorizationProbeRequiresPrincipalNamespace
62
62
  };
63
- //# sourceMappingURL=chunk-AWF4CNYJ.js.map
63
+ //# sourceMappingURL=chunk-RYZ2E2ZM.js.map
@@ -283,7 +283,7 @@ import {
283
283
  } from "./chunk-LVE64P5Y.js";
284
284
  import {
285
285
  createOfflineSyncManifestStream
286
- } from "./chunk-2J4TIFBK.js";
286
+ } from "./chunk-JKXBZKD5.js";
287
287
  import {
288
288
  offlineSyncStorageForSnapshot
289
289
  } from "./chunk-2OXIPF3A.js";
@@ -18381,4 +18381,4 @@ export {
18381
18381
  EngramAccessService,
18382
18382
  AccessAdminOpsSurface
18383
18383
  };
18384
- //# sourceMappingURL=chunk-IZZ7Q2RJ.js.map
18384
+ //# sourceMappingURL=chunk-TC3ZDFMD.js.map
@@ -206,7 +206,7 @@ import {
206
206
  import {
207
207
  EngramAccessHttpServer,
208
208
  MeetingsInputError
209
- } from "./chunk-PC7WNIRL.js";
209
+ } from "./chunk-22YEAYMV.js";
210
210
  import {
211
211
  WearablesInputError
212
212
  } from "./chunk-V7IZKJI3.js";
@@ -216,11 +216,11 @@ import {
216
216
  loadChatSession,
217
217
  processChatMessage,
218
218
  sessionBelongsToPrincipal
219
- } from "./chunk-EFCBJDYE.js";
219
+ } from "./chunk-GDGHJDWY.js";
220
220
  import {
221
221
  EngramAccessService,
222
222
  journalPath
223
- } from "./chunk-IZZ7Q2RJ.js";
223
+ } from "./chunk-TC3ZDFMD.js";
224
224
  import {
225
225
  WorkStorage
226
226
  } from "./chunk-GDB4J2H3.js";
@@ -9716,4 +9716,4 @@ export {
9716
9716
  listMemoryMarkdownFilePaths,
9717
9717
  registerCli
9718
9718
  };
9719
- //# sourceMappingURL=chunk-CVJMGVEW.js.map
9719
+ //# sourceMappingURL=chunk-TR5X2L4W.js.map
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-ZJWDWPX6.js";
13
13
  import {
14
14
  externalWikiSearchOperation
15
- } from "./chunk-B2AGUKSS.js";
15
+ } from "./chunk-NS5SICIH.js";
16
16
  import {
17
17
  memoryStoreRequestSchema
18
18
  } from "./chunk-I4Y6TBD7.js";
@@ -22,7 +22,7 @@ import {
22
22
  DELTA_SUBCOMMANDS,
23
23
  defineOperation,
24
24
  isCodegraphToolName
25
- } from "./chunk-IZZ7Q2RJ.js";
25
+ } from "./chunk-TC3ZDFMD.js";
26
26
  import {
27
27
  serializeMutations,
28
28
  withHeldFileLock
@@ -1909,4 +1909,4 @@ export {
1909
1909
  codegraphIngestTracesOperation,
1910
1910
  REGISTERED_OPERATIONS
1911
1911
  };
1912
- //# sourceMappingURL=chunk-L74A6NTI.js.map
1912
+ //# sourceMappingURL=chunk-UTPFI5CL.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SupportPassportError,
3
3
  getOperation
4
- } from "./chunk-IZZ7Q2RJ.js";
4
+ } from "./chunk-TC3ZDFMD.js";
5
5
  import {
6
6
  abortError,
7
7
  isAbortError
@@ -499,4 +499,4 @@ export {
499
499
  buildSupportPassportPublicRequestHandler,
500
500
  composeSupportPassportExternalRequestHandlers
501
501
  };
502
- //# sourceMappingURL=chunk-JZ6EYAVP.js.map
502
+ //# sourceMappingURL=chunk-W5EOTYOG.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SUPPORT_PASSPORT_DRAFT_MAX_CONTENT_CHARACTERS,
3
3
  SUPPORT_PASSPORT_DRAFT_MAX_MEMORIES
4
- } from "./chunk-IZZ7Q2RJ.js";
4
+ } from "./chunk-TC3ZDFMD.js";
5
5
  import {
6
6
  SUPPORT_PASSPORT_SOURCE_MEMORY_ID_MAX_LENGTH
7
7
  } from "./chunk-EEOUMG3J.js";
@@ -343,4 +343,4 @@ export {
343
343
  parseSupportPassportModelJob,
344
344
  SupportPassportModelBridge
345
345
  };
346
- //# sourceMappingURL=chunk-CFKCFY4B.js.map
346
+ //# sourceMappingURL=chunk-ZPMQXJJ3.js.map
@@ -5,7 +5,7 @@ import { M as MemoryFile, m as MemoryFrontmatter, w as MemoryStatus, a9 as Behav
5
5
  import { C as ConversationIndexCoordinator, T as TierMigrationCoordinator, O as Orchestrator } from './orchestrator-DeqaPGT5.js';
6
6
  import { S as StorageManager } from './storage-BcFd1lN_.js';
7
7
  import { TrustZoneDemoSeedResult, TrustZoneName, TrustZonePromotionResult, TrustZoneStoreStatus } from './trust-zones.js';
8
- import { f as EngramAccessService } from './access-service-CYdqPfpS.js';
8
+ import { f as EngramAccessService } from './access-service-DxE-bRvW.js';
9
9
  import { Writable, Readable } from 'node:stream';
10
10
  import { ResolveSecretRefFn } from './resolve-auth-token.js';
11
11
  import { CausalTrajectoryStoreStatus } from './causal-trajectory.js';
package/dist/cli.d.ts CHANGED
@@ -5,8 +5,8 @@ import './types-BRg3tMyp.js';
5
5
  import './orchestrator-DeqaPGT5.js';
6
6
  import './storage-BcFd1lN_.js';
7
7
  import './trust-zones.js';
8
- export { c as AccessHttpServeCliCommandOptions, d as ArchiveObservationsCliCommandOptions, e as AuditMemoryCliCommandOptions, B as BulkImportCliCommandOptions, C as CliApi, g as CliCommand, h as CliProgram, i as CompatCliCommandOptions, j as ConnectorsRunCliOutputOptions, k as ConversationIndexHealthCliOrchestrator, D as DashboardStartCliCommandOptions, l as DedupeCandidate, E as ExactDedupePlan, G as GraphHealthCliCommandOptions, M as MemoryActionAuditCliCommandOptions, m as MemoryActionAuditCliNamespaceSummary, n as MemoryActionAuditCliReport, o as MemoryGovernanceCliCommandOptions, q as MemoryGovernanceReportCliCommandOptions, s as MemoryGovernanceRestoreCliCommandOptions, t as MemoryReviewDispositionCliCommandOptions, u as MemoryTimelineCliCommandOptions, v as MigrateCliOrchestrator, w as MigrateCliReport, x as MigrateObservationsCliCommandOptions, P as PolicyDiffCliReport, y as PolicyDiffEntry, z as PolicyRollbackCliReport, F as PolicyStatusCliReport, H as PolicyTuningCliOrchestrator, R as RebuildMemoryLifecycleLedgerCliCommandOptions, I as RebuildMemoryProjectionCliCommandOptions, J as RebuildObservationsCliCommandOptions, K as RepairMemoryProjectionCliCommandOptions, L as ReplayCliCommandOptions, N as ReplayCliOrchestrator, O as RouteCliCommandOptions, S as SessionIntegrityCliCommandOptions, Q as SessionRepairCliCommandOptions, T as TailscaleStatusCliCommandOptions, U as TailscaleSyncCliCommandOptions, V as TierMigrateCliAdapter, W as TierMigrateCoordinatorCliAdapter, X as TierMigrateLegacyCliAdapter, Y as TierStatusCliAdapter, Z as TierStatusCoordinatorCliAdapter, _ as TierStatusLegacyCliAdapter, $ as TrainingExportCliCommandOptions, a0 as VerifyMemoryProjectionCliCommandOptions, a1 as WebDavServeCliCommandOptions, a2 as WorkProjectCliCommandOptions, a3 as WorkTaskCliCommandOptions, a4 as emitConnectorsRunCliResult, a5 as filterNormalMemorySearchResults, a6 as hasDestructivePurgeFailures, a7 as isNormalRetrievalVisibleMemory, a8 as listMemoryMarkdownFilePaths, a9 as parseDurationToMs, aa as parseStrictCliDate, ab as planAggressiveDuplicateDeletions, ac as planExactDuplicateDeletions, ad as registerCli, ae as resolveAccessPrincipalOverride, af as resolveMemoryDirForNamespace, ag as runAbstractionNodeStatusCliCommand, ah as runAccessHttpServeCliCommand, ai as runAccessHttpStatusCliCommand, aj as runAccessHttpStopCliCommand, ak as runAccessMcpServeCliCommand, al as runArchiveObservationsCliCommand, r as runAuditMemoryCliCommand, am as runBenchmarkBaselineReportCliCommand, an as runBenchmarkBaselineSnapshotCliCommand, ao as runBenchmarkCiGateCliCommand, ap as runBenchmarkImportCliCommand, aq as runBenchmarkStatusCliCommand, ar as runBenchmarkStoredBaselineCiGateCliCommand, as as runBenchmarkValidateCliCommand, b as runBulkImportCliCommand, at as runCausalTrajectoryStatusCliCommand, au as runCommitmentLifecycleCliCommand, av as runCommitmentRecordCliCommand, aw as runCommitmentSetStateCliCommand, ax as runCommitmentStatusCliCommand, ay as runCompatCliCommand, az as runCompoundingPromoteCliCommand, aA as runConversationIndexHealthCliCommand, aB as runConversationIndexInspectCliCommand, aC as runConversationIndexRebuildCliCommand, aD as runCueAnchorStatusCliCommand, aE as runDashboardStartCliCommand, aF as runDashboardStatusCliCommand, aG as runDashboardStopCliCommand, aH as runGraphHealthCliCommand, aI as runHarmonicSearchCliCommand, aJ as runMemoryActionAuditCliCommand, aK as runMemoryGovernanceCliCommand, aL as runMemoryGovernanceReportCliCommand, aM as runMemoryGovernanceRestoreCliCommand, aN as runMemoryReviewDispositionCliCommand, aO as runMemoryTimelineCliCommand, aP as runMigrateNormalizeFrontmatterCliCommand, aQ as runMigrateObservationsCliCommand, aR as runMigrateRechunkCliCommand, aS as runMigrateReextractCliCommand, aT as runMigrateRescoreImportanceCliCommand, aU as runObjectiveStateStatusCliCommand, aV as runPolicyDiffCliCommand, aW as runPolicyRollbackCliCommand, aX as runPolicyStatusCliCommand, aY as runRebuildMemoryLifecycleLedgerCliCommand, aZ as runRebuildMemoryProjectionCliCommand, a_ as runRebuildObservationsCliCommand, a$ as runRepairMemoryProjectionCliCommand, b0 as runReplayCliCommand, b1 as runResumeBundleBuildCliCommand, b2 as runResumeBundleRecordCliCommand, b3 as runResumeBundleStatusCliCommand, b4 as runRouteCliCommand, b5 as runSemanticRulePromoteCliCommand, b6 as runSemanticRuleVerifyCliCommand, b7 as runSessionCheckCliCommand, b8 as runSessionRepairCliCommand, b9 as runTailscaleStatusCliCommand, ba as runTailscaleSyncCliCommand, bb as runTierMigrateCliCommand, bc as runTierStatusCliCommand, bd as runTrainingExportCliCommand, be as runTrustZoneDemoSeedCliCommand, bf as runTrustZonePromoteCliCommand, bg as runTrustZoneStatusCliCommand, bh as runUtilityLearningCliCommand, bi as runUtilityLearningStatusCliCommand, bj as runUtilityTelemetryRecordCliCommand, bk as runUtilityTelemetryStatusCliCommand, bl as runVerifiedRecallSearchCliCommand, bm as runVerifyMemoryProjectionCliCommand, bn as runWebDavServeCliCommand, bo as runWebDavStopCliCommand, bp as runWorkProductRecallSearchCliCommand, bq as runWorkProductRecordCliCommand, br as runWorkProductStatusCliCommand, bs as runWorkProjectCliCommand, bt as runWorkTaskCliCommand } from './cli-DN9LpWf0.js';
9
- import './access-service-CYdqPfpS.js';
8
+ export { c as AccessHttpServeCliCommandOptions, d as ArchiveObservationsCliCommandOptions, e as AuditMemoryCliCommandOptions, B as BulkImportCliCommandOptions, C as CliApi, g as CliCommand, h as CliProgram, i as CompatCliCommandOptions, j as ConnectorsRunCliOutputOptions, k as ConversationIndexHealthCliOrchestrator, D as DashboardStartCliCommandOptions, l as DedupeCandidate, E as ExactDedupePlan, G as GraphHealthCliCommandOptions, M as MemoryActionAuditCliCommandOptions, m as MemoryActionAuditCliNamespaceSummary, n as MemoryActionAuditCliReport, o as MemoryGovernanceCliCommandOptions, q as MemoryGovernanceReportCliCommandOptions, s as MemoryGovernanceRestoreCliCommandOptions, t as MemoryReviewDispositionCliCommandOptions, u as MemoryTimelineCliCommandOptions, v as MigrateCliOrchestrator, w as MigrateCliReport, x as MigrateObservationsCliCommandOptions, P as PolicyDiffCliReport, y as PolicyDiffEntry, z as PolicyRollbackCliReport, F as PolicyStatusCliReport, H as PolicyTuningCliOrchestrator, R as RebuildMemoryLifecycleLedgerCliCommandOptions, I as RebuildMemoryProjectionCliCommandOptions, J as RebuildObservationsCliCommandOptions, K as RepairMemoryProjectionCliCommandOptions, L as ReplayCliCommandOptions, N as ReplayCliOrchestrator, O as RouteCliCommandOptions, S as SessionIntegrityCliCommandOptions, Q as SessionRepairCliCommandOptions, T as TailscaleStatusCliCommandOptions, U as TailscaleSyncCliCommandOptions, V as TierMigrateCliAdapter, W as TierMigrateCoordinatorCliAdapter, X as TierMigrateLegacyCliAdapter, Y as TierStatusCliAdapter, Z as TierStatusCoordinatorCliAdapter, _ as TierStatusLegacyCliAdapter, $ as TrainingExportCliCommandOptions, a0 as VerifyMemoryProjectionCliCommandOptions, a1 as WebDavServeCliCommandOptions, a2 as WorkProjectCliCommandOptions, a3 as WorkTaskCliCommandOptions, a4 as emitConnectorsRunCliResult, a5 as filterNormalMemorySearchResults, a6 as hasDestructivePurgeFailures, a7 as isNormalRetrievalVisibleMemory, a8 as listMemoryMarkdownFilePaths, a9 as parseDurationToMs, aa as parseStrictCliDate, ab as planAggressiveDuplicateDeletions, ac as planExactDuplicateDeletions, ad as registerCli, ae as resolveAccessPrincipalOverride, af as resolveMemoryDirForNamespace, ag as runAbstractionNodeStatusCliCommand, ah as runAccessHttpServeCliCommand, ai as runAccessHttpStatusCliCommand, aj as runAccessHttpStopCliCommand, ak as runAccessMcpServeCliCommand, al as runArchiveObservationsCliCommand, r as runAuditMemoryCliCommand, am as runBenchmarkBaselineReportCliCommand, an as runBenchmarkBaselineSnapshotCliCommand, ao as runBenchmarkCiGateCliCommand, ap as runBenchmarkImportCliCommand, aq as runBenchmarkStatusCliCommand, ar as runBenchmarkStoredBaselineCiGateCliCommand, as as runBenchmarkValidateCliCommand, b as runBulkImportCliCommand, at as runCausalTrajectoryStatusCliCommand, au as runCommitmentLifecycleCliCommand, av as runCommitmentRecordCliCommand, aw as runCommitmentSetStateCliCommand, ax as runCommitmentStatusCliCommand, ay as runCompatCliCommand, az as runCompoundingPromoteCliCommand, aA as runConversationIndexHealthCliCommand, aB as runConversationIndexInspectCliCommand, aC as runConversationIndexRebuildCliCommand, aD as runCueAnchorStatusCliCommand, aE as runDashboardStartCliCommand, aF as runDashboardStatusCliCommand, aG as runDashboardStopCliCommand, aH as runGraphHealthCliCommand, aI as runHarmonicSearchCliCommand, aJ as runMemoryActionAuditCliCommand, aK as runMemoryGovernanceCliCommand, aL as runMemoryGovernanceReportCliCommand, aM as runMemoryGovernanceRestoreCliCommand, aN as runMemoryReviewDispositionCliCommand, aO as runMemoryTimelineCliCommand, aP as runMigrateNormalizeFrontmatterCliCommand, aQ as runMigrateObservationsCliCommand, aR as runMigrateRechunkCliCommand, aS as runMigrateReextractCliCommand, aT as runMigrateRescoreImportanceCliCommand, aU as runObjectiveStateStatusCliCommand, aV as runPolicyDiffCliCommand, aW as runPolicyRollbackCliCommand, aX as runPolicyStatusCliCommand, aY as runRebuildMemoryLifecycleLedgerCliCommand, aZ as runRebuildMemoryProjectionCliCommand, a_ as runRebuildObservationsCliCommand, a$ as runRepairMemoryProjectionCliCommand, b0 as runReplayCliCommand, b1 as runResumeBundleBuildCliCommand, b2 as runResumeBundleRecordCliCommand, b3 as runResumeBundleStatusCliCommand, b4 as runRouteCliCommand, b5 as runSemanticRulePromoteCliCommand, b6 as runSemanticRuleVerifyCliCommand, b7 as runSessionCheckCliCommand, b8 as runSessionRepairCliCommand, b9 as runTailscaleStatusCliCommand, ba as runTailscaleSyncCliCommand, bb as runTierMigrateCliCommand, bc as runTierStatusCliCommand, bd as runTrainingExportCliCommand, be as runTrustZoneDemoSeedCliCommand, bf as runTrustZonePromoteCliCommand, bg as runTrustZoneStatusCliCommand, bh as runUtilityLearningCliCommand, bi as runUtilityLearningStatusCliCommand, bj as runUtilityTelemetryRecordCliCommand, bk as runUtilityTelemetryStatusCliCommand, bl as runVerifiedRecallSearchCliCommand, bm as runVerifyMemoryProjectionCliCommand, bn as runWebDavServeCliCommand, bo as runWebDavStopCliCommand, bp as runWorkProductRecallSearchCliCommand, bq as runWorkProductRecordCliCommand, br as runWorkProductStatusCliCommand, bs as runWorkProjectCliCommand, bt as runWorkTaskCliCommand } from './cli-B_TaTEHW.js';
9
+ import './access-service-DxE-bRvW.js';
10
10
  import 'node:stream';
11
11
  import './resolve-auth-token.js';
12
12
  import './causal-trajectory.js';
package/dist/cli.js CHANGED
@@ -91,7 +91,7 @@ import {
91
91
  runWorkProductStatusCliCommand,
92
92
  runWorkProjectCliCommand,
93
93
  runWorkTaskCliCommand
94
- } from "./chunk-CVJMGVEW.js";
94
+ } from "./chunk-TR5X2L4W.js";
95
95
  import "./chunk-MMACM5G2.js";
96
96
  import "./chunk-54BGIBCR.js";
97
97
  import "./chunk-H4CKS5B2.js";
@@ -181,7 +181,7 @@ import "./chunk-JI7U6AS3.js";
181
181
  import "./chunk-PIG4WJFQ.js";
182
182
  import "./chunk-KFZY2OFH.js";
183
183
  import "./chunk-B32WYRXX.js";
184
- import "./chunk-PC7WNIRL.js";
184
+ import "./chunk-22YEAYMV.js";
185
185
  import "./chunk-V7IZKJI3.js";
186
186
  import "./chunk-SEDEKFYQ.js";
187
187
  import "./chunk-2QSZNTDO.js";
@@ -193,21 +193,21 @@ import "./chunk-J64TK33U.js";
193
193
  import "./chunk-7RXCMVFQ.js";
194
194
  import "./chunk-3HSRWJTC.js";
195
195
  import "./chunk-ZEBRENA6.js";
196
- import "./chunk-5SGOARQJ.js";
197
- import "./chunk-JZ6EYAVP.js";
198
- import "./chunk-EFCBJDYE.js";
196
+ import "./chunk-IEX7SNFK.js";
197
+ import "./chunk-W5EOTYOG.js";
198
+ import "./chunk-GDGHJDWY.js";
199
199
  import "./chunk-EAARGPWI.js";
200
200
  import "./chunk-A5KNZSNA.js";
201
201
  import "./chunk-HUSTM6PU.js";
202
202
  import "./chunk-D24OXEPB.js";
203
- import "./chunk-L74A6NTI.js";
203
+ import "./chunk-UTPFI5CL.js";
204
204
  import "./chunk-HOUST5UX.js";
205
- import "./chunk-WL5PR5YC.js";
205
+ import "./chunk-F5XGBC22.js";
206
206
  import "./chunk-ZJWDWPX6.js";
207
- import "./chunk-B2AGUKSS.js";
207
+ import "./chunk-NS5SICIH.js";
208
208
  import "./chunk-7T4TOGMS.js";
209
209
  import "./chunk-7YQ6ESEA.js";
210
- import "./chunk-XJJLWTLW.js";
210
+ import "./chunk-7SHCAJR7.js";
211
211
  import "./chunk-C2JCVZWX.js";
212
212
  import "./chunk-EQWEIIKQ.js";
213
213
  import "./chunk-JTWZKNUH.js";
@@ -225,8 +225,8 @@ import "./chunk-SRT6SHVZ.js";
225
225
  import "./chunk-TIDEL77O.js";
226
226
  import "./chunk-GZ3R6XOE.js";
227
227
  import "./chunk-CK5KOVHW.js";
228
- import "./chunk-AWF4CNYJ.js";
229
- import "./chunk-IZZ7Q2RJ.js";
228
+ import "./chunk-RYZ2E2ZM.js";
229
+ import "./chunk-TC3ZDFMD.js";
230
230
  import "./chunk-GDASG7NC.js";
231
231
  import "./chunk-GDB4J2H3.js";
232
232
  import "./chunk-J2R275FN.js";
@@ -391,9 +391,9 @@ import "./chunk-3QL24R5Y.js";
391
391
  import "./chunk-ZN7SMKAK.js";
392
392
  import "./chunk-LNEWDF2A.js";
393
393
  import "./chunk-LVE64P5Y.js";
394
- import "./chunk-2J4TIFBK.js";
395
- import "./chunk-SB4OBB7P.js";
396
- import "./chunk-JIM4BIOC.js";
394
+ import "./chunk-JKXBZKD5.js";
395
+ import "./chunk-5RPMTFB6.js";
396
+ import "./chunk-PAAJWQH5.js";
397
397
  import "./chunk-2OXIPF3A.js";
398
398
  import "./chunk-EGALNSZ4.js";
399
399
  import "./chunk-J6A3CX5N.js";
@@ -1,5 +1,5 @@
1
1
  import { IncomingMessage, ServerResponse } from 'node:http';
2
- import { f as EngramAccessService } from './access-service-CYdqPfpS.js';
2
+ import { f as EngramAccessService } from './access-service-DxE-bRvW.js';
3
3
  import './types-BRg3tMyp.js';
4
4
  import './message-parts/index.js';
5
5
  import './bounded-jsonl-state.js';
@@ -1,4 +1,4 @@
1
- import { K as McpTool } from './access-service-CYdqPfpS.js';
1
+ import { K as McpTool } from './access-service-DxE-bRvW.js';
2
2
  import './types-BRg3tMyp.js';
3
3
  import './message-parts/index.js';
4
4
  import './bounded-jsonl-state.js';
@@ -1,4 +1,4 @@
1
- import { B as BoundOperation } from './access-service-CYdqPfpS.js';
1
+ import { B as BoundOperation } from './access-service-DxE-bRvW.js';
2
2
  import { ExternalWikiSearchResult, ExternalWikiSearchInput } from './external-wiki-search.js';
3
3
  import './types-BRg3tMyp.js';
4
4
  import './message-parts/index.js';
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  externalWikiSearchOperation
3
- } from "./chunk-B2AGUKSS.js";
3
+ } from "./chunk-NS5SICIH.js";
4
4
  import "./chunk-7T4TOGMS.js";
5
5
  import "./chunk-7YQ6ESEA.js";
6
- import "./chunk-IZZ7Q2RJ.js";
6
+ import "./chunk-TC3ZDFMD.js";
7
7
  import "./chunk-GDASG7NC.js";
8
8
  import "./chunk-GDB4J2H3.js";
9
9
  import "./chunk-J2R275FN.js";
@@ -168,9 +168,9 @@ import "./chunk-3QL24R5Y.js";
168
168
  import "./chunk-ZN7SMKAK.js";
169
169
  import "./chunk-LNEWDF2A.js";
170
170
  import "./chunk-LVE64P5Y.js";
171
- import "./chunk-2J4TIFBK.js";
172
- import "./chunk-SB4OBB7P.js";
173
- import "./chunk-JIM4BIOC.js";
171
+ import "./chunk-JKXBZKD5.js";
172
+ import "./chunk-5RPMTFB6.js";
173
+ import "./chunk-PAAJWQH5.js";
174
174
  import "./chunk-2OXIPF3A.js";
175
175
  import "./chunk-EGALNSZ4.js";
176
176
  import "./chunk-J6A3CX5N.js";
@@ -1,4 +1,4 @@
1
- import { K as McpTool } from './access-service-CYdqPfpS.js';
1
+ import { K as McpTool } from './access-service-DxE-bRvW.js';
2
2
  import './types-BRg3tMyp.js';
3
3
  import './message-parts/index.js';
4
4
  import './bounded-jsonl-state.js';