weir-harness 1.2.3 → 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.
- package/cordis.patch.yml +7 -18
- package/lib/client.file-lease-badge.js +307 -0
- package/lib/client.js +20 -30
- package/lib/client.settings-page.js +10 -34
- package/package.json +2 -2
- package/src/capabilities/store/checked-contract.d.ts +2 -2
- package/src/capabilities/store/fs-adapter.js +2 -3
- package/src/context-guard/index.js +2 -2
- package/src/delegate/supervision-mount.js +5 -5
- package/src/delegate/tool.js +2 -10
- package/src/file-lease/client.js +1066 -0
- package/src/file-lease/index.js +30 -0
- package/src/file-lease/lineage.js +207 -0
- package/src/file-lease/node-contracts.d.ts +42 -0
- package/src/file-lease/plugin.js +789 -0
- package/src/file-lease/singleton.js +155 -0
- package/src/file-lease/spawn.js +62 -0
- package/src/file-lease/tools.js +459 -0
- package/src/file-lease/view.js +144 -0
- package/src/hashline-edit/index.js +76 -42
- package/src/hashline-edit/write-tool.js +90 -0
- package/src/lease-broker/entry.js +98 -0
- package/src/lease-broker/node-contracts.d.ts +63 -0
- package/src/lease-broker/protocol.js +236 -0
- package/src/lease-broker/server.js +399 -0
- package/src/lease-broker/state.js +425 -0
- package/src/lsp/tools.js +137 -27
- package/src/settings/index.js +2 -44
- package/src/settings/sections.js +2 -24
- package/src/shared/audit.js +6 -1
- package/src/todo-driver/index.js +1 -6
- package/src/worktree/cards.js +6 -21
- package/src/worktree/lane-core.js +1 -19
- package/src/worktree/lane-workflows.js +11 -32
- package/lib/client.edit-lock-maintenance.js +0 -592
- package/lib/client.edit-lock-panel.js +0 -405
- package/src/edit-lock/adapter.js +0 -57
- package/src/edit-lock/admin-ledger.js +0 -149
- package/src/edit-lock/admin-recovery.js +0 -151
- package/src/edit-lock/admission.js +0 -82
- package/src/edit-lock/binding-attestation.js +0 -29
- package/src/edit-lock/binding-guidance.js +0 -72
- package/src/edit-lock/binding-machine.js +0 -312
- package/src/edit-lock/call-context.js +0 -65
- package/src/edit-lock/derived-facts.js +0 -67
- package/src/edit-lock/domain.js +0 -165
- package/src/edit-lock/domains.js +0 -170
- package/src/edit-lock/host.js +0 -149
- package/src/edit-lock/incarnations.js +0 -150
- package/src/edit-lock/index.js +0 -1303
- package/src/edit-lock/inspect.js +0 -219
- package/src/edit-lock/lifecycle.js +0 -579
- package/src/edit-lock/limits.js +0 -61
- package/src/edit-lock/maintenance.js +0 -310
- package/src/edit-lock/manager.js +0 -875
- package/src/edit-lock/negotiation.js +0 -132
- package/src/edit-lock/operation-history.js +0 -214
- package/src/edit-lock/peer-client.js +0 -86
- package/src/edit-lock/peer-transport.js +0 -76
- package/src/edit-lock/peer.js +0 -87
- package/src/edit-lock/publisher.js +0 -191
- package/src/edit-lock/read-authority.js +0 -101
- package/src/edit-lock/recovery.js +0 -139
- package/src/edit-lock/remote.js +0 -362
- package/src/edit-lock/request-binding.js +0 -42
- package/src/edit-lock/request-data.js +0 -40
- package/src/edit-lock/reservation.js +0 -301
- package/src/edit-lock/reserved-runtime.js +0 -45
- package/src/edit-lock/resource-identity.js +0 -130
- package/src/edit-lock/runtime.js +0 -145
- package/src/edit-lock/settle.js +0 -144
- package/src/edit-lock/snapshot.js +0 -175
- package/src/edit-lock/stale-sweep.js +0 -120
- package/src/edit-lock/state.js +0 -462
- package/src/edit-lock/store.js +0 -327
- package/src/edit-lock/tool-scope.js +0 -29
- package/src/edit-lock/view.js +0 -170
- package/src/edit-lock/write-scopes.js +0 -48
- package/src/edit-lock/write-tool.js +0 -45
- package/src/shared/delegate-edit-lifecycle.js +0 -36
- 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
|
-
}
|