weir-harness 1.2.2 → 2.0.0

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 (89) hide show
  1. package/cordis.patch.yml +7 -18
  2. package/lib/client.file-lease-badge.js +307 -0
  3. package/lib/client.js +20 -30
  4. package/lib/client.settings-page.js +10 -34
  5. package/package.json +2 -2
  6. package/src/capabilities/store/checked-contract.d.ts +2 -2
  7. package/src/capabilities/store/fs-adapter.js +2 -3
  8. package/src/context-guard/index.js +2 -2
  9. package/src/delegate/supervision-mount.js +5 -5
  10. package/src/delegate/tool.js +2 -10
  11. package/src/file-lease/client.js +1066 -0
  12. package/src/file-lease/index.js +30 -0
  13. package/src/file-lease/lineage.js +207 -0
  14. package/src/file-lease/node-contracts.d.ts +42 -0
  15. package/src/file-lease/plugin.js +789 -0
  16. package/src/file-lease/singleton.js +155 -0
  17. package/src/file-lease/spawn.js +62 -0
  18. package/src/file-lease/tools.js +459 -0
  19. package/src/file-lease/view.js +144 -0
  20. package/src/hashline-edit/index.js +76 -42
  21. package/src/hashline-edit/write-tool.js +90 -0
  22. package/src/intent-gate/matcher.js +27 -0
  23. package/src/lease-broker/entry.js +98 -0
  24. package/src/lease-broker/node-contracts.d.ts +63 -0
  25. package/src/lease-broker/protocol.js +236 -0
  26. package/src/lease-broker/server.js +399 -0
  27. package/src/lease-broker/state.js +425 -0
  28. package/src/lsp/admin.js +24 -13
  29. package/src/lsp/index.js +5 -2
  30. package/src/lsp/registry.js +83 -17
  31. package/src/lsp/tools.js +137 -27
  32. package/src/notify/commands.js +15 -2
  33. package/src/notify/index.js +48 -10
  34. package/src/notify/web-channel.js +26 -3
  35. package/src/process/index.js +11 -0
  36. package/src/settings/index.js +2 -44
  37. package/src/settings/sections.js +29 -28
  38. package/src/shared/audit.js +6 -1
  39. package/src/todo-driver/index.js +1 -6
  40. package/src/worktree/cards.js +6 -21
  41. package/src/worktree/lane-core.js +1 -19
  42. package/src/worktree/lane-workflows.js +11 -32
  43. package/lib/client.edit-lock-maintenance.js +0 -592
  44. package/lib/client.edit-lock-panel.js +0 -405
  45. package/src/edit-lock/adapter.js +0 -57
  46. package/src/edit-lock/admin-ledger.js +0 -149
  47. package/src/edit-lock/admin-recovery.js +0 -151
  48. package/src/edit-lock/admission.js +0 -82
  49. package/src/edit-lock/binding-attestation.js +0 -29
  50. package/src/edit-lock/binding-guidance.js +0 -72
  51. package/src/edit-lock/binding-machine.js +0 -312
  52. package/src/edit-lock/call-context.js +0 -65
  53. package/src/edit-lock/derived-facts.js +0 -67
  54. package/src/edit-lock/domain.js +0 -165
  55. package/src/edit-lock/domains.js +0 -170
  56. package/src/edit-lock/host.js +0 -149
  57. package/src/edit-lock/incarnations.js +0 -150
  58. package/src/edit-lock/index.js +0 -1303
  59. package/src/edit-lock/inspect.js +0 -219
  60. package/src/edit-lock/lifecycle.js +0 -579
  61. package/src/edit-lock/limits.js +0 -61
  62. package/src/edit-lock/maintenance.js +0 -310
  63. package/src/edit-lock/manager.js +0 -875
  64. package/src/edit-lock/negotiation.js +0 -132
  65. package/src/edit-lock/operation-history.js +0 -214
  66. package/src/edit-lock/peer-client.js +0 -86
  67. package/src/edit-lock/peer-transport.js +0 -76
  68. package/src/edit-lock/peer.js +0 -87
  69. package/src/edit-lock/publisher.js +0 -191
  70. package/src/edit-lock/read-authority.js +0 -101
  71. package/src/edit-lock/recovery.js +0 -139
  72. package/src/edit-lock/remote.js +0 -362
  73. package/src/edit-lock/request-binding.js +0 -42
  74. package/src/edit-lock/request-data.js +0 -40
  75. package/src/edit-lock/reservation.js +0 -301
  76. package/src/edit-lock/reserved-runtime.js +0 -45
  77. package/src/edit-lock/resource-identity.js +0 -130
  78. package/src/edit-lock/runtime.js +0 -145
  79. package/src/edit-lock/settle.js +0 -144
  80. package/src/edit-lock/snapshot.js +0 -175
  81. package/src/edit-lock/stale-sweep.js +0 -120
  82. package/src/edit-lock/state.js +0 -462
  83. package/src/edit-lock/store.js +0 -327
  84. package/src/edit-lock/tool-scope.js +0 -29
  85. package/src/edit-lock/view.js +0 -170
  86. package/src/edit-lock/write-scopes.js +0 -48
  87. package/src/edit-lock/write-tool.js +0 -45
  88. package/src/shared/delegate-edit-lifecycle.js +0 -36
  89. package/src/worktree/authority.js +0 -56
@@ -1,56 +0,0 @@
1
- // Read-only Edit Lock authority residue probe for lane cleanup/abandon
2
- // (edit-lock-autonomous-recovery, design D5): a bounded read of the
3
- // management domain's committed snapshot — no runtime open, no reservation,
4
- // no mutation. Residue = the lane's owner session still has unresolved
5
- // operations (prepared/publishing/unknown) or locks in the image. Every
6
- // failure mode (missing/unreadable/corrupt/oversized authority) is a silent
7
- // "no residue": the check feeds a warning, it is never a gate.
8
- import { closeSync, constants, fstatSync, openSync, readSync } from 'node:fs'
9
- import { join } from 'node:path'
10
- import { parseSnapshot } from '../edit-lock/snapshot.js'
11
-
12
- /** Same ceiling the maintenance inspector enforces (16 MiB). */
13
- const MAX_SNAPSHOT_BYTES = 16 * 1024 * 1024
14
-
15
- /**
16
- * @typedef {{ operations: number, locks: number }} AuthorityResidue
17
- */
18
-
19
- /**
20
- * Read-only residue check of the Edit Lock authority under `root` for one
21
- * session. Returns null when there is no residue OR when the authority
22
- * cannot be read or validated — a failed check never blocks cleanup.
23
- * @param {string} root - canonical management root (the repo's mainRoot)
24
- * @param {string | null | undefined} sessionId - the lane's ownerSession
25
- * @returns {AuthorityResidue | null}
26
- */
27
- export function authorityResidue(root, sessionId) {
28
- if (typeof root !== 'string' || !root || typeof sessionId !== 'string' || !sessionId) return null
29
- try {
30
- const path = join(root, '.weir', 'edit-lock', 'snapshot.json')
31
- const fd = openSync(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0))
32
- /** @type {Buffer} */
33
- let bytes
34
- try {
35
- const stat = fstatSync(fd)
36
- if (!stat.isFile() || stat.size > MAX_SNAPSHOT_BYTES) return null
37
- bytes = Buffer.alloc(stat.size)
38
- let length = 0
39
- while (length < bytes.length) {
40
- const count = readSync(fd, bytes, length, bytes.length - length, length)
41
- if (count === 0) break
42
- length += count
43
- }
44
- if (length !== bytes.length) return null
45
- } finally {
46
- closeSync(fd)
47
- }
48
- const { state } = parseSnapshot(bytes, root)
49
- const operations = state.operations.filter((op) => op?.sessionId === sessionId
50
- && (op?.phase === 'prepared' || op?.phase === 'publishing' || op?.phase === 'unknown')).length
51
- const locks = state.locks.filter((lock) => lock?.owner === sessionId).length
52
- return operations === 0 && locks === 0 ? null : { operations, locks }
53
- } catch {
54
- return null
55
- }
56
- }