weir-harness 1.1.4 → 1.1.6

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 (57) hide show
  1. package/cordis.patch.yml +48 -87
  2. package/icon.svg +1 -0
  3. package/lib/client.capability-badge.js +16 -16
  4. package/lib/client.capability-manager.js +87 -36
  5. package/lib/client.capability-model.js +151 -31
  6. package/lib/client.capability-presets.js +187 -39
  7. package/lib/client.edit-lock-maintenance.js +27 -12
  8. package/lib/client.edit-lock-panel.js +52 -19
  9. package/lib/client.js +270 -12
  10. package/lib/client.settings-page.js +13 -8
  11. package/lib/client.worktree-model.js +20 -1
  12. package/lib/client.worktree-view.js +32 -9
  13. package/package.json +4 -2
  14. package/skills/deep-work/SKILL.md +7 -3
  15. package/src/blackboard/durable.js +199 -0
  16. package/src/blackboard/index.js +62 -42
  17. package/src/blackboard/kernel.js +20 -1
  18. package/src/blackboard/remote.js +36 -28
  19. package/src/blackboard/storage.js +238 -0
  20. package/src/capabilities/capability-remote.js +122 -69
  21. package/src/capabilities/preset-library.js +113 -87
  22. package/src/capabilities/read-payloads.js +21 -4
  23. package/src/capabilities/skill-selection-plugin.js +188 -168
  24. package/src/capabilities/skill-selection-provider.js +13 -0
  25. package/src/capabilities/store/enumerate.js +46 -0
  26. package/src/capabilities/store/store.js +86 -1
  27. package/src/context-guard/index.js +222 -117
  28. package/src/context-guard/pressure.js +12 -3
  29. package/src/context-guard/recovery.js +25 -0
  30. package/src/core/doctrine.js +3 -3
  31. package/src/delegate/group-coordinator.js +2 -1
  32. package/src/delegate/supervision-mount.js +41 -2
  33. package/src/delegate/tool.js +11 -3
  34. package/src/edit-lock/admin-ledger.js +42 -6
  35. package/src/edit-lock/admin-recovery.js +4 -2
  36. package/src/edit-lock/binding-attestation.js +29 -0
  37. package/src/edit-lock/binding-guidance.js +43 -0
  38. package/src/edit-lock/domain.js +20 -5
  39. package/src/edit-lock/host.js +3 -3
  40. package/src/edit-lock/index.js +268 -57
  41. package/src/edit-lock/lifecycle.js +106 -47
  42. package/src/edit-lock/maintenance.js +12 -3
  43. package/src/edit-lock/manager.js +8 -3
  44. package/src/edit-lock/peer.js +2 -0
  45. package/src/edit-lock/publisher.js +57 -1
  46. package/src/edit-lock/remote.js +120 -52
  47. package/src/edit-lock/runtime.js +8 -0
  48. package/src/edit-lock/view.js +27 -12
  49. package/src/settings/sections.js +30 -6
  50. package/src/shared/audit.js +6 -0
  51. package/src/shared/delegate-edit-lifecycle.js +36 -0
  52. package/src/todo-driver/index.js +16 -1
  53. package/src/worktree/cards.js +47 -3
  54. package/src/worktree/command.js +29 -5
  55. package/src/worktree/git.js +39 -5
  56. package/src/worktree/lanes.js +83 -25
  57. package/src/worktree/prompts.js +2 -1
@@ -60,7 +60,7 @@ window.__ModuleLoader__.load({
60
60
  background: "var(--dsw-alias-bg-overlay)",
61
61
  border: "1px solid var(--dsw-alias-border-l2)",
62
62
  borderRadius: "var(--dsw-radius-md, 8px)",
63
- boxShadow: "0 6px 24px rgba(0,0,0,0.18)",
63
+ boxShadow: "0 6px 24px var(--dsw-alias-border-l2)",
64
64
  padding: "10px 12px",
65
65
  color: "var(--dsw-alias-label-primary)",
66
66
  fontSize: "12px",
@@ -68,7 +68,7 @@ window.__ModuleLoader__.load({
68
68
  };
69
69
  const mutedStyle = { color: "var(--dsw-alias-label-secondary)" };
70
70
  const errorStyle = { color: "var(--dsw-alias-state-error-primary)", marginTop: "6px" };
71
- const rowStyle = { display: "flex", alignItems: "center", gap: "8px", padding: "4px 0", borderTop: "1px solid var(--dsw-alias-border-l2)" };
71
+ const rowStyle = { display: "flex", flexWrap: "wrap", alignItems: "center", gap: "8px" };
72
72
  const nameStyle = { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", fontFamily: "var(--dsw-font-markdown-code-block-font-family, ui-monospace, monospace)" };
73
73
  const dot = (state) => jsx("span", { "aria-hidden": true, style: { display: "inline-block", width: "7px", height: "7px", borderRadius: "50%", background: dotColor[state], flex: "none" } });
74
74
  /** Clock time for a reservation expiry, in the user's locale. */
@@ -84,10 +84,11 @@ window.__ModuleLoader__.load({
84
84
  }
85
85
  /** The one primary action of a state, or null when nothing is needed. */
86
86
  function primaryOf(state, view) {
87
+ if (state === "unavailable" && view.bindingFailure?.code === "binding-duplicate" && view.bindingFailure.retryable === true && view.bindingFailure.inFlight !== true) return { verb: "retry", label: "editLockRetry" };
87
88
  // Continue editing is one human action: restore authority, then confirm the
88
89
  // retained files (each through the ordinary per-file check).
89
90
  // confirm --all only when something waits, so no empty "Confirmed 0 of 0" is recorded.
90
- if (state === "stopped") return { verbs: view.files.some((file) => file.mine && file.status === "user-interrupted") ? ["resume", "confirm --all"] : ["resume"], label: "editLockResume" };
91
+ if (state === "stopped" || state === "revoked") return { verbs: view.files.some((file) => file.mine && file.status === "user-interrupted") ? ["resume", "confirm --all"] : ["resume"], label: "editLockResume" };
91
92
  if (state === "confirm") return { verb: "confirm --all", label: "editLockConfirmAll" };
92
93
  if (state === "holding" && view.ownCount > 0) return { verbs: view.files.filter((file) => file.mine && file.action === "release").map(rowCommand), label: "editLockReleaseAll" };
93
94
  return null;
@@ -107,7 +108,11 @@ window.__ModuleLoader__.load({
107
108
  const [details, setDetails] = react.useState(false);
108
109
  const refresh = () => Promise.resolve(props.fetchView?.()).then(
109
110
  (next) => { if (next) setView(next); },
110
- (reason) => setError(reason instanceof Error ? reason.message : String(reason))
111
+ (reason) => {
112
+ const message = reason instanceof Error ? reason.message : String(reason);
113
+ setError(message);
114
+ setView({ state: "unavailable", reason: message, files: [] });
115
+ }
111
116
  );
112
117
  react.useEffect(() => {
113
118
  if (!sessionId) {
@@ -175,6 +180,7 @@ window.__ModuleLoader__.load({
175
180
  }, key);
176
181
  const summary = (() => {
177
182
  if (!view) return t("editLockLoading");
183
+ if (state === "unavailable" && view.bindingFailure?.inFlight === true) return t("editLockRetryPending");
178
184
  if (state === "unavailable" && view.reason) return t("editLockState_failed");
179
185
  const base = t(`editLockState_${state}`);
180
186
  if (state === "holding" && view.hold) return `${base} ${t("editLockHoldUntil").replace("{time}", clock(view.hold.until))}`;
@@ -187,43 +193,70 @@ window.__ModuleLoader__.load({
187
193
  const primary = view && !cold ? primaryOf(state, view) : null;
188
194
  const files = view?.files ?? [];
189
195
  const canRevoke = !cold && state !== "stopped" && state !== "unavailable" && state !== "revoked";
196
+ // Structured binding refusals have localized guidance; retain the complete
197
+ // diagnostic on demand, even when no session technical view exists yet.
198
+ const bindingRefusal = state === "unavailable" && view?.bindingFailure?.code === "binding-duplicate";
199
+ const detailReason = bindingRefusal ? view.reason : null;
200
+ const hasDetails = Boolean(view?.technical || detailReason);
201
+ // Only the exact reason (or the command's fixed wrapper) is redundant.
202
+ // Never infer failure identity or retry eligibility from prose.
203
+ const duplicateError = detailReason && (error === detailReason || error === `edit-lock: ${detailReason}`);
190
204
  const children = [
191
205
  jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
192
206
  dot(state),
193
207
  jsx("span", { style: { flex: 1, fontWeight: 600 }, "data-weir-edit-lock-summary": "", children: summary }),
194
208
  jsx("button", { type: "button", style: linkStyle, disabled: pending, onClick: () => refresh(), "data-weir-edit-lock-action": "refresh", title: t("editLockRefresh"), children: "\u21bb" })
195
209
  ] }, "head"),
196
- view?.reason ? jsx("div", { style: { ...errorStyle, wordBreak: "break-word" }, "data-weir-edit-lock-reason": "", children: view.reason }, "reason") : null,
197
- state === "revoked" ? jsx("div", { style: { ...mutedStyle, marginTop: "4px" }, "data-weir-edit-lock-revoked": "", children: t("editLockRevokedHint") }, "revoked") : null,
210
+ view?.reason && !bindingRefusal ? jsx("div", { style: { ...errorStyle, wordBreak: "break-word" }, "data-weir-edit-lock-reason": "", children: view.reason }, "reason") : null,
211
+ view?.bindingFailure ? jsx("div", { style: mutedStyle, "data-weir-edit-lock-binding": "", children: t(`editLockBinding_${view.bindingFailure.holderKind ?? "unknown"}`) }, "binding") : null,
212
+ state === "revoked" && !cold ? jsx("div", { style: { ...mutedStyle, marginTop: "4px" }, "data-weir-edit-lock-revoked": "", children: t("editLockRevokedHint") }, "revoked") : null,
213
+ cold && state === "revoked" ? jsx("div", { style: { ...mutedStyle, marginTop: "4px" }, "data-weir-edit-lock-cold": "", children: t(view.autoResume === false ? "editLockColdRevokedManual" : "editLockColdRevokedAuto") }, "cold") : null,
198
214
  cold && state === "stopped" ? jsx("div", { style: { ...mutedStyle, marginTop: "4px" }, "data-weir-edit-lock-cold": "", children: t(view.autoResume === false ? "editLockColdResumeManual" : "editLockColdResumeAuto") }, "cold") : null,
199
- view?.recovery ? jsx("div", { style: { ...mutedStyle, marginTop: "4px" }, children: t("editLockRecovery").replace("{n}", String(view.recovery.attempts)) }, "recovery") : null,
215
+ // Usage is historical; only the live driver's explicit deadline signals a pause.
216
+ // Follow-up locale keys: editLockCleanupOnly, editLockRecoveryUsage,
217
+ // editLockPauseUsageHint. Template-layer fallback stays English.
218
+ view?.cleanupOnly ? jsx("div", { style: { ...mutedStyle, marginTop: "4px" }, "data-weir-edit-lock-cleanup": "", children: t("editLockCleanupOnly") }, "cleanup") : null,
219
+ // Follow-up locale key: editLockPausedUntil, with {time}. Absolute clock,
220
+ // not a countdown or a promise to release locks/restore editing at expiry.
221
+ !cold && state === "attention" && view?.cleanupOnly && Number.isFinite(view.pausedUntil) && view.pausedUntil > Date.now() ? jsx("div", { style: { ...mutedStyle, marginTop: "4px" }, "data-weir-edit-lock-paused-until": "", children: t("editLockPausedUntil").replace("{time}", clock(view.pausedUntil)) }, "paused-until") : null,
222
+ view?.recovery ? jsx("div", { style: { ...mutedStyle, marginTop: "4px" }, "data-weir-edit-lock-recovery": "", children: t("editLockRecoveryUsage").replace("{attempts}", String(view.recovery.attempts)).replace("{elapsed}", String(view.recovery.elapsedSeconds)).replace("{pause}", String(view.recovery.pauseMinutes)) }, "recovery") : null,
223
+ view?.recovery?.pauseMinutes > 0 ? jsx("div", { style: { ...mutedStyle, marginTop: "4px" }, "data-weir-edit-lock-pause": "", children: t("editLockPauseUsageHint") }, "pause") : null,
200
224
  primary ? jsx("div", { style: { marginTop: "8px" }, children: action("primary", t(primary.label), () => run(primary.verbs ?? primary.verb), primaryStyle) }, "primary") : null,
201
225
  files.length ? jsx("div", { style: { marginTop: "8px" }, "data-weir-edit-lock-files": "", children: files.map((file) => jsxs("div", {
202
- style: rowStyle,
226
+ style: { padding: "4px 0", borderTop: "1px solid var(--dsw-alias-border-l2)" },
203
227
  "data-weir-edit-lock-file": file.detail.path,
204
228
  children: [
205
- jsx("span", { style: nameStyle, title: file.detail.path, children: file.name }),
206
- jsx("span", { style: mutedStyle, children: file.mine ? t(`editLockStatus_${file.status}`) : t("editLockOwnerOther") }),
207
- cold || !rowCommand(file) ? null
208
- : file.action === "unlock" && armedUnlock !== file.detail.path
209
- ? action(`arm-unlock:${file.detail.path}`, t("editLockRow_unlock"), () => setArmedUnlock(file.detail.path))
210
- : action(`${file.action}:${file.detail.path}`, t(file.action === "unlock" ? "editLockRow_unlockConfirm" : `editLockRow_${file.action}`), () => run(rowCommand(file)), file.action === "unlock" ? dangerStyle : buttonStyle)
229
+ jsxs("div", { style: rowStyle, children: [
230
+ jsx("span", { style: nameStyle, title: file.detail.path, children: file.name }),
231
+ jsx("span", { style: mutedStyle, children: file.mine ? t(`editLockStatus_${file.status}`) : `${t("editLockOwnerOther")} · ${t(`editLockStatus_${file.status}`)}` }),
232
+ cold || !rowCommand(file) ? null
233
+ : file.action === "unlock" && armedUnlock !== file.detail.path
234
+ ? action(`arm-unlock:${file.detail.path}`, t("editLockRow_unlock"), () => setArmedUnlock(file.detail.path))
235
+ : action(`${file.action}:${file.detail.path}`, t(file.action === "unlock" ? "editLockRow_unlockConfirm" : `editLockRow_${file.action}`), () => run(rowCommand(file)), file.action === "unlock" ? dangerStyle : buttonStyle)
236
+ ] }),
237
+ file.reason ? jsx("div", { style: { ...mutedStyle, overflowWrap: "anywhere" }, "data-weir-edit-lock-file-reason": file.detail.path, children: file.reason }) : null
211
238
  ]
212
239
  }, file.detail.path)) }, "files") : null,
213
- error ? jsx("div", { style: errorStyle, "data-weir-edit-lock-error": "", children: error }, "error") : null,
240
+ // Follow-up locale key: editLockOwnershipHint. Outcomes remain in the
241
+ // adjacent tool result; lock rows do not establish a publication result.
242
+ files.length ? jsx("div", { style: { ...mutedStyle, marginTop: "6px" }, "data-weir-edit-lock-ownership-hint": "", children: t("editLockOwnershipHint") }, "ownership-hint") : null,
243
+ error && !duplicateError ? jsx("div", { style: errorStyle, "data-weir-edit-lock-error": "", children: error }, "error") : null,
214
244
  jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px", marginTop: "10px" }, children: [
215
245
  canRevoke ? (armedRevoke
216
246
  ? action("stop", t("editLockRevokeConfirm"), () => run("stop"), dangerStyle)
217
247
  : jsx("button", { type: "button", style: linkStyle, disabled: pending, onClick: () => setArmedRevoke(true), "data-weir-edit-lock-action": "arm-stop", children: t("editLockStop") })) : null,
218
248
  jsx("span", { style: { flex: 1 } }),
219
- view?.technical ? jsx("button", { type: "button", style: linkStyle, onClick: () => setDetails(!details), "data-weir-edit-lock-action": "details", children: t("editLockDetails") }) : null
249
+ hasDetails ? jsx("button", { type: "button", style: linkStyle, onClick: () => setDetails(!details), "aria-expanded": details, "data-weir-edit-lock-action": "details", children: t("editLockDetails") }) : null
220
250
  ] }, "foot"),
221
- details && view?.technical ? jsx("pre", {
251
+ details && hasDetails ? jsx("pre", {
222
252
  style: { ...mutedStyle, whiteSpace: "pre-wrap", wordBreak: "break-all", margin: "6px 0 0", fontFamily: "var(--dsw-font-markdown-code-block-font-family, ui-monospace, monospace)" },
223
253
  "data-weir-edit-lock-details": "",
224
254
  children: [
225
- `session ${view.technical.sessionId} \u00b7 epoch ${view.technical.executionEpoch ?? "-"}`,
226
- `root ${view.technical.root ?? "-"} (${view.technical.mode ?? "-"})`,
255
+ ...(detailReason ? [detailReason] : []),
256
+ ...(view?.technical ? [
257
+ `session ${view.technical.sessionId} \u00b7 epoch ${view.technical.executionEpoch ?? "-"}`,
258
+ `root ${view.technical.root ?? "-"} (${view.technical.mode ?? "-"})`
259
+ ] : []),
227
260
  ...files.map((file) => `${file.detail.path} \u00b7 ${file.detail.owner} \u00b7 generation ${file.detail.generation}${file.reason ? ` \u00b7 ${file.reason}` : ""}`)
228
261
  ].join("\n")
229
262
  }, "details") : null