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.
Files changed (81) 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/lease-broker/entry.js +98 -0
  23. package/src/lease-broker/node-contracts.d.ts +63 -0
  24. package/src/lease-broker/protocol.js +236 -0
  25. package/src/lease-broker/server.js +399 -0
  26. package/src/lease-broker/state.js +425 -0
  27. package/src/lsp/tools.js +137 -27
  28. package/src/settings/index.js +2 -44
  29. package/src/settings/sections.js +2 -24
  30. package/src/shared/audit.js +6 -1
  31. package/src/todo-driver/index.js +1 -6
  32. package/src/worktree/cards.js +6 -21
  33. package/src/worktree/lane-core.js +1 -19
  34. package/src/worktree/lane-workflows.js +11 -32
  35. package/lib/client.edit-lock-maintenance.js +0 -592
  36. package/lib/client.edit-lock-panel.js +0 -405
  37. package/src/edit-lock/adapter.js +0 -57
  38. package/src/edit-lock/admin-ledger.js +0 -149
  39. package/src/edit-lock/admin-recovery.js +0 -151
  40. package/src/edit-lock/admission.js +0 -82
  41. package/src/edit-lock/binding-attestation.js +0 -29
  42. package/src/edit-lock/binding-guidance.js +0 -72
  43. package/src/edit-lock/binding-machine.js +0 -312
  44. package/src/edit-lock/call-context.js +0 -65
  45. package/src/edit-lock/derived-facts.js +0 -67
  46. package/src/edit-lock/domain.js +0 -165
  47. package/src/edit-lock/domains.js +0 -170
  48. package/src/edit-lock/host.js +0 -149
  49. package/src/edit-lock/incarnations.js +0 -150
  50. package/src/edit-lock/index.js +0 -1303
  51. package/src/edit-lock/inspect.js +0 -219
  52. package/src/edit-lock/lifecycle.js +0 -579
  53. package/src/edit-lock/limits.js +0 -61
  54. package/src/edit-lock/maintenance.js +0 -310
  55. package/src/edit-lock/manager.js +0 -875
  56. package/src/edit-lock/negotiation.js +0 -132
  57. package/src/edit-lock/operation-history.js +0 -214
  58. package/src/edit-lock/peer-client.js +0 -86
  59. package/src/edit-lock/peer-transport.js +0 -76
  60. package/src/edit-lock/peer.js +0 -87
  61. package/src/edit-lock/publisher.js +0 -191
  62. package/src/edit-lock/read-authority.js +0 -101
  63. package/src/edit-lock/recovery.js +0 -139
  64. package/src/edit-lock/remote.js +0 -362
  65. package/src/edit-lock/request-binding.js +0 -42
  66. package/src/edit-lock/request-data.js +0 -40
  67. package/src/edit-lock/reservation.js +0 -301
  68. package/src/edit-lock/reserved-runtime.js +0 -45
  69. package/src/edit-lock/resource-identity.js +0 -130
  70. package/src/edit-lock/runtime.js +0 -145
  71. package/src/edit-lock/settle.js +0 -144
  72. package/src/edit-lock/snapshot.js +0 -175
  73. package/src/edit-lock/stale-sweep.js +0 -120
  74. package/src/edit-lock/state.js +0 -462
  75. package/src/edit-lock/store.js +0 -327
  76. package/src/edit-lock/tool-scope.js +0 -29
  77. package/src/edit-lock/view.js +0 -170
  78. package/src/edit-lock/write-scopes.js +0 -48
  79. package/src/edit-lock/write-tool.js +0 -45
  80. package/src/shared/delegate-edit-lifecycle.js +0 -36
  81. package/src/worktree/authority.js +0 -56
@@ -118,7 +118,7 @@ function apply(ctx, config = {}) {
118
118
  const request = state.request
119
119
  if (!live(agent) || request?.kind !== 'applied' || request.delivered) return
120
120
  fresh(agent)
121
- if (request.kind !== 'applied' || request.controller.signal.aborted || ctx.get?.('weirEditLock')?.blocksContinuation?.(agent)) {
121
+ if (request.kind !== 'applied' || request.controller.signal.aborted) {
122
122
  state.blocked = true
123
123
  request.delivered = true
124
124
  record(agent, request, 'resume-blocked')
@@ -197,7 +197,7 @@ function apply(ctx, config = {}) {
197
197
  if (decision.kind !== 'enter') return decision
198
198
  let resume
199
199
  const current = state.request
200
- if (current?.kind === 'applied' && !current.delivered && !signal?.aborted && !ctx.get?.('weirEditLock')?.blocksContinuation?.(agent)) {
200
+ if (current?.kind === 'applied' && !current.delivered && !signal?.aborted) {
201
201
  current.delivered = true
202
202
  current.detach?.(); current.detachMaintenance?.()
203
203
  resume = RESUME_AFTER_COMPACTION
@@ -10,7 +10,6 @@ import { auditFilePathOf, isTerminalStatus, readAuditTail, readChildFinalText }
10
10
  import { AUDIT_TYPES } from '../shared/audit.js'
11
11
  import { userTextMessage } from '../shared/user-message.js'
12
12
  import { contentText } from '../shared/content-text.js'
13
- import { withSupervisedEditResume, settleDelegateEditLifecycle } from '../shared/delegate-edit-lifecycle.js'
14
13
 
15
14
  /**
16
15
  * Mount the supervision subsystem on the plugin ctx.
@@ -81,8 +80,8 @@ export function mountSupervision({ ctx, audit, settings, supervisionNow, onChild
81
80
  sendTo: async (childId, text) => {
82
81
  await ctx.subagents.sendMessage(parent, childId, [{ type: 'text', text }], { signal: new AbortController().signal })
83
82
  },
84
- resumeTo: (childId, text) => withSupervisedEditResume(parent, childId, () =>
85
- ctx.subagents.sendMessage(parent, childId, [{ type: 'text', text }], { signal: new AbortController().signal })),
83
+ resumeTo: (childId, text) =>
84
+ ctx.subagents.sendMessage(parent, childId, [{ type: 'text', text }], { signal: new AbortController().signal }),
86
85
  interruptChild: (childId) => {
87
86
  ctx.subagents.interrupt(childId, { kind: 'ancestor', agent: parent })
88
87
  },
@@ -107,8 +106,9 @@ export function mountSupervision({ ctx, audit, settings, supervisionNow, onChild
107
106
  const runtime = runtimeFor(fact.childId)
108
107
  // No observed quiescence means no automatic handoff, including
109
108
  // a cold bookkeeping fact. Lane reconciliation owns that case.
110
- const disposition = settleDelegateEditLifecycle(parent, fact.childId, runtime.agent)
111
- void Promise.all([runtime.promise, disposition])
109
+ // Runtime quiescence is the ONLY gate: the retired Edit Lock
110
+ // disposition acknowledgement used to join here as well.
111
+ void runtime.promise
112
112
  .then(() => onChildSettled?.(fact.childId, parent))
113
113
  .catch(error => {
114
114
  const note = `child ${fact.childId}: terminal handoff failed; lane remains bound: ${error?.message ?? error}`
@@ -5,7 +5,6 @@ import { parseEscalation } from './escalate.js'
5
5
  import { continuableLane, oneShotLane, spawnGuardedChild, supervisedLane } from './spawn-adapter.js'
6
6
  import { WORKTREE_CODES } from '../worktree/errors.js'
7
7
  import { contentText } from '../shared/content-text.js'
8
- import { settleDelegateEditLifecycle } from '../shared/delegate-edit-lifecycle.js'
9
8
 
10
9
  export const DELEGATE_TOOL_NAME = 'delegate'
11
10
  export const BATCH_LIMIT = 16
@@ -319,16 +318,9 @@ async function spawnBackground(item, args, deps, exec) {
319
318
  return { job_id: jobId, label }
320
319
  }
321
320
 
322
- async function settledResult(started, parent) {
323
- try { return await started.result } finally {
324
- // subagent/end is emit, not an awaited barrier. Explicitly join the
325
- // incarnation's standard edit disposition before result/escalation/handoff.
326
- await settleDelegateEditLifecycle(parent, started.id, started.agent)
327
- }
328
- }
329
321
  /** Await one child, honoring the one-level ESCALATE contract. */
330
322
  async function withEscalation(started, item, deps, exec, binding = null) {
331
- const first = await settledResult(started, exec.agent)
323
+ const first = await started.result
332
324
  const text = contentText(first.output)
333
325
  const escalation = parseEscalation(text)
334
326
  if (!escalation) {
@@ -345,7 +337,7 @@ async function withEscalation(started, item, deps, exec, binding = null) {
345
337
  // The escalated respawn works in the same lane under the same binding (the
346
338
  // lane's bound child stays the first child; it settles once, after this).
347
339
  const respawned = await spawnGuardedChild({ target, prompt, parent: exec.agent, signal: exec.signal, label: `${laneLabel(target.label, binding)} (escalated)`, laneGuard: laneGuardOf(binding, deps, exec) }, oneShotLane(), deps)
348
- const second = await settledResult(respawned, exec.agent)
340
+ const second = await respawned.result
349
341
  return {
350
342
  id: respawned.id,
351
343
  status: second.stopReason,