@codyswann/lisa 5.5.0 → 5.7.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 (196) hide show
  1. package/all/copy-overwrite/scripts/lib/automation-provenance-local.mjs +26 -2
  2. package/all/copy-overwrite/scripts/lib/github-attestation-provider.mjs +68 -0
  3. package/all/copy-overwrite/scripts/lib/github-attestation-recovery.mjs +25 -10
  4. package/all/copy-overwrite/scripts/lib/github-attestation-verifier.mjs +4 -1
  5. package/all/copy-overwrite/scripts/lib/npm-update-allocate.mjs +1 -6
  6. package/all/copy-overwrite/scripts/lib/npm-update-authorization.mjs +25 -14
  7. package/all/copy-overwrite/scripts/lib/npm-update-cancel-origin.mjs +45 -11
  8. package/all/copy-overwrite/scripts/lib/npm-update-cancellation-proof.mjs +22 -11
  9. package/all/copy-overwrite/scripts/lib/npm-update-cancellation.mjs +29 -17
  10. package/all/copy-overwrite/scripts/lib/npm-update-controller-factory.mjs +19 -1
  11. package/all/copy-overwrite/scripts/lib/npm-update-gate.mjs +5 -0
  12. package/all/copy-overwrite/scripts/lib/npm-update-gh-requests.mjs +57 -30
  13. package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +1 -0
  14. package/all/copy-overwrite/scripts/lib/npm-update-leaf.mjs +6 -1
  15. package/all/copy-overwrite/scripts/lib/npm-update-policy.mjs +38 -0
  16. package/all/copy-overwrite/scripts/lib/npm-update-publication.mjs +21 -3
  17. package/all/copy-overwrite/scripts/lib/npm-update-publish.mjs +13 -1
  18. package/all/copy-overwrite/scripts/lib/npm-update-recovery.mjs +29 -4
  19. package/all/copy-overwrite/scripts/lib/npm-update-supersession.mjs +21 -7
  20. package/all/copy-overwrite/scripts/lib/npm-update-tracker-cancel.mjs +139 -0
  21. package/all/copy-overwrite/scripts/lib/npm-update-tracker-jira.mjs +149 -19
  22. package/all/copy-overwrite/scripts/lib/npm-update-tracker-linear.mjs +72 -17
  23. package/all/copy-overwrite/scripts/lib/npm-update-tracker-wire.mjs +102 -12
  24. package/all/copy-overwrite/scripts/lib/npm-update-tracker.mjs +91 -13
  25. package/all/copy-overwrite/scripts/lisa-automation-provenance.mjs +35 -8
  26. package/all/copy-overwrite/scripts/lisa-npm-updater.mjs +8 -5
  27. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +45 -26
  28. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  29. package/dist/core/lisa-owned-hash-ledger.js +122 -0
  30. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  31. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  32. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  33. package/dist/core/upstream-evidence-manifest.js +93 -42
  34. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  35. package/package.json +4 -4
  36. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  37. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  38. package/plugins/lisa/.codex-plugin/scripts/operator-id-kinds.mjs +17 -4
  39. package/plugins/lisa/.codex-plugin/scripts/ready-queue-order.mjs +62 -5
  40. package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/validate-config.mjs +75 -38
  41. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +23 -7
  42. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/references/runbook-template.md +1 -1
  43. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-cycle.mjs +4 -3
  44. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-human.mjs +12 -7
  45. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-orphans.mjs +3 -1
  46. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-runtime.mjs +1 -0
  47. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-usage.mjs +4 -3
  48. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/config.mjs +26 -0
  49. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/human-needed.mjs +1 -1
  50. package/plugins/lisa/.codex-plugin/skills/lisa-setup-session-manager/SKILL.md +7 -3
  51. package/plugins/lisa/rules/reference/config-resolution.md +3 -2
  52. package/plugins/lisa/scripts/operator-id-kinds.mjs +17 -4
  53. package/plugins/lisa/scripts/ready-queue-order.mjs +62 -5
  54. package/plugins/lisa/skills/lisa-secrets-access/scripts/validate-config.mjs +75 -38
  55. package/plugins/lisa/skills/lisa-session-manager/SKILL.md +23 -7
  56. package/plugins/lisa/skills/lisa-session-manager/references/runbook-template.md +1 -1
  57. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-cycle.mjs +4 -3
  58. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-human.mjs +12 -7
  59. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-orphans.mjs +3 -1
  60. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-runtime.mjs +1 -0
  61. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-usage.mjs +4 -3
  62. package/plugins/lisa/skills/lisa-session-manager/scripts/config.mjs +26 -0
  63. package/plugins/lisa/skills/lisa-session-manager/scripts/human-needed.mjs +1 -1
  64. package/plugins/lisa/skills/lisa-setup-session-manager/SKILL.md +7 -3
  65. package/plugins/lisa-agy/plugin.json +1 -1
  66. package/plugins/lisa-agy/scripts/operator-id-kinds.mjs +17 -4
  67. package/plugins/lisa-agy/scripts/ready-queue-order.mjs +62 -5
  68. package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/validate-config.mjs +75 -38
  69. package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +23 -7
  70. package/plugins/lisa-agy/skills/lisa-session-manager/references/runbook-template.md +1 -1
  71. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-cycle.mjs +4 -3
  72. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-human.mjs +12 -7
  73. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-orphans.mjs +3 -1
  74. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-runtime.mjs +1 -0
  75. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-usage.mjs +4 -3
  76. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/config.mjs +26 -0
  77. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/human-needed.mjs +1 -1
  78. package/plugins/lisa-agy/skills/lisa-setup-session-manager/SKILL.md +7 -3
  79. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  80. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  81. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  82. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  84. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  85. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  86. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  87. package/plugins/lisa-copilot/rules/reference/config-resolution.md +3 -2
  88. package/plugins/lisa-copilot/scripts/operator-id-kinds.mjs +17 -4
  89. package/plugins/lisa-copilot/scripts/ready-queue-order.mjs +62 -5
  90. package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/validate-config.mjs +75 -38
  91. package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +23 -7
  92. package/plugins/lisa-copilot/skills/lisa-session-manager/references/runbook-template.md +1 -1
  93. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-cycle.mjs +4 -3
  94. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-human.mjs +12 -7
  95. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-orphans.mjs +3 -1
  96. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-runtime.mjs +1 -0
  97. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-usage.mjs +4 -3
  98. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/config.mjs +26 -0
  99. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/human-needed.mjs +1 -1
  100. package/plugins/lisa-copilot/skills/lisa-setup-session-manager/SKILL.md +7 -3
  101. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  102. package/plugins/lisa-cursor/rules/config-resolution-reference.mdc +3 -2
  103. package/plugins/lisa-cursor/scripts/operator-id-kinds.mjs +17 -4
  104. package/plugins/lisa-cursor/scripts/ready-queue-order.mjs +62 -5
  105. package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/validate-config.mjs +75 -38
  106. package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +23 -7
  107. package/plugins/lisa-cursor/skills/lisa-session-manager/references/runbook-template.md +1 -1
  108. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-cycle.mjs +4 -3
  109. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-human.mjs +12 -7
  110. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-orphans.mjs +3 -1
  111. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-runtime.mjs +1 -0
  112. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-usage.mjs +4 -3
  113. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/config.mjs +26 -0
  114. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/human-needed.mjs +1 -1
  115. package/plugins/lisa-cursor/skills/lisa-setup-session-manager/SKILL.md +7 -3
  116. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  117. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  118. package/plugins/lisa-devin/rules/reference/config-resolution.md +3 -2
  119. package/plugins/lisa-devin/scripts/operator-id-kinds.mjs +17 -4
  120. package/plugins/lisa-devin/scripts/ready-queue-order.mjs +62 -5
  121. package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/validate-config.mjs +75 -38
  122. package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +23 -7
  123. package/plugins/lisa-devin/skills/lisa-session-manager/references/runbook-template.md +1 -1
  124. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-cycle.mjs +4 -3
  125. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-human.mjs +12 -7
  126. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-orphans.mjs +3 -1
  127. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-runtime.mjs +1 -0
  128. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-usage.mjs +4 -3
  129. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/config.mjs +26 -0
  130. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/human-needed.mjs +1 -1
  131. package/plugins/lisa-devin/skills/lisa-setup-session-manager/SKILL.md +7 -3
  132. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  133. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  134. package/plugins/lisa-expo-agy/plugin.json +1 -1
  135. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  136. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  137. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  138. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  139. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  140. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  141. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  142. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  143. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  144. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  145. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  146. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  147. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  148. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  149. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  150. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  151. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  152. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  153. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  154. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  155. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  156. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  157. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  158. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  159. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  160. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  161. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  162. package/plugins/lisa-rails-agy/plugin.json +1 -1
  163. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  164. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  165. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  166. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  167. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  168. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  169. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  170. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  171. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  172. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  173. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  174. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  175. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  176. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  177. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  178. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  179. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  180. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  181. package/plugins/src/base/rules/reference/config-resolution.md +3 -2
  182. package/plugins/src/base/scripts/operator-id-kinds.mjs +17 -4
  183. package/plugins/src/base/scripts/ready-queue-order.mjs +62 -5
  184. package/plugins/src/base/skills/lisa-secrets-access/scripts/validate-config.mjs +75 -38
  185. package/plugins/src/base/skills/lisa-session-manager/SKILL.md +23 -7
  186. package/plugins/src/base/skills/lisa-session-manager/references/runbook-template.md +1 -1
  187. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-cycle.mjs +4 -3
  188. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-human.mjs +12 -7
  189. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-orphans.mjs +3 -1
  190. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-runtime.mjs +1 -0
  191. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-usage.mjs +4 -3
  192. package/plugins/src/base/skills/lisa-session-manager/scripts/config.mjs +26 -0
  193. package/plugins/src/base/skills/lisa-session-manager/scripts/human-needed.mjs +1 -1
  194. package/plugins/src/base/skills/lisa-setup-session-manager/SKILL.md +7 -3
  195. package/scripts/two-channel-couplings.json +1 -1
  196. package/typescript/copy-overwrite/.prettierignore +1 -0
@@ -29,6 +29,10 @@ const PHASES = [
29
29
  const ID = /^[1-9]\d*$/;
30
30
  const REPO = /^[A-Za-z0-9][A-Za-z0-9-]{0,38}\/[A-Za-z0-9_.-]{1,100}$/;
31
31
  const decimal = value => typeof value === "string" && ID.test(value);
32
+ /** A Jira/Linear subject (#4873): its key, an opaque claim id and a vendor maintainer id. */
33
+ const VENDOR_ITEM = /^[A-Z][A-Z0-9]{1,9}-[1-9]\d*$/;
34
+ const VENDOR_ID = /^[A-Za-z0-9][A-Za-z0-9:-]{0,127}$/;
35
+ const vendorOf = subject => Object.hasOwn(subject ?? {}, "workItem");
32
36
  const key = args => canonicalJson(args);
33
37
  const api = endpoint => ["api", "--hostname", "github.com", endpoint];
34
38
  import { recoveryPage } from "./npm-update-gh-grants.mjs";
@@ -50,7 +54,10 @@ function checkedSubject(subject) {
50
54
  "proofs",
51
55
  // Only a non-main target is named, so a main subject keeps its exact shape.
52
56
  ...optionalTargetFields(subject ?? {}),
57
+ // Only a Jira/Linear subject names its work item, so a GitHub subject keeps its exact shape.
58
+ ...(vendorOf(subject) ? ["workItem"] : []),
53
59
  ]);
60
+ const vendor = vendorOf(subject);
54
61
  required(
55
62
  PHASES.includes(subject.phase) &&
56
63
  REPO.test(subject.repository) &&
@@ -59,7 +66,13 @@ function checkedSubject(subject) {
59
66
  [".", ".."].includes(value.split("/")[1])
60
67
  ) &&
61
68
  decimal(subject.issue) &&
62
- decimal(subject.claim) &&
69
+ (vendor
70
+ ? VENDOR_ITEM.test(subject.workItem) &&
71
+ subject.workItem.endsWith(`-${subject.issue}`) &&
72
+ typeof subject.claim === "string" &&
73
+ VENDOR_ID.test(subject.claim) &&
74
+ subject.tracker === subject.repository
75
+ : decimal(subject.claim)) &&
63
76
  /^lisa\/npm-[a-f0-9]{64}$/.test(subject.branch) &&
64
77
  /^[a-f0-9]{40}$/.test(subject.parent),
65
78
  "invalid closed GH subject"
@@ -78,7 +91,9 @@ function checkedSubject(subject) {
78
91
  "invalid GH PR identity"
79
92
  );
80
93
  required(
81
- /^[A-Za-z0-9][A-Za-z0-9-]{0,38}$/.test(subject.maintainer) &&
94
+ (vendor ? VENDOR_ID : /^[A-Za-z0-9][A-Za-z0-9-]{0,38}$/).test(
95
+ subject.maintainer
96
+ ) &&
82
97
  Array.isArray(subject.proofs) &&
83
98
  subject.proofs.length <= 2 &&
84
99
  (subject.phase !== STAGE_PHASE || subject.proofs.length === 0),
@@ -97,21 +112,23 @@ function checkedSubject(subject) {
97
112
 
98
113
  /** Read families use the same literal constructors as the canonical shipped callers. */
99
114
  function ordinaryRequests(subject) {
100
- const records = [
101
- { kind: "plain", args: ["--version"] },
102
- {
103
- kind: "plain",
104
- args: githubIssueViewArgs(subject.tracker, subject.issue),
105
- },
106
- {
107
- kind: "hierarchy",
108
- args: githubHierarchyArgs(
109
- { repository: subject.tracker },
110
- subject.issue,
111
- null
112
- ),
113
- },
114
- ];
115
+ // A Jira/Linear item is never read through GitHub: only the code-host reads remain.
116
+ const records = [{ kind: "plain", args: ["--version"] }];
117
+ if (!vendorOf(subject))
118
+ records.push(
119
+ {
120
+ kind: "plain",
121
+ args: githubIssueViewArgs(subject.tracker, subject.issue),
122
+ },
123
+ {
124
+ kind: "hierarchy",
125
+ args: githubHierarchyArgs(
126
+ { repository: subject.tracker },
127
+ subject.issue,
128
+ null
129
+ ),
130
+ }
131
+ );
115
132
  if (subject.phase !== STAGE_PHASE)
116
133
  records.push({
117
134
  kind: "plain",
@@ -121,7 +138,7 @@ function ordinaryRequests(subject) {
121
138
  subject.repository
122
139
  ),
123
140
  });
124
- if (subject.phase === BACKLINK_PHASE)
141
+ if (subject.phase === BACKLINK_PHASE && !vendorOf(subject))
125
142
  records.push({
126
143
  kind: "comments",
127
144
  args: githubBacklinkListArgs(subject.tracker, subject.issue),
@@ -137,12 +154,18 @@ function proofRequests(subject) {
137
154
  `repos/${repository}`,
138
155
  `repos/${repository}/git/ref/heads/${targetBranch(subject)}`,
139
156
  `repos/${repository}/actions/runs/${subject.origin.runId}/attempts/${subject.origin.runAttempt}`,
140
- `repos/${subject.tracker}/issues/comments/${subject.claim}`,
157
+ // A Jira/Linear claim is proved by its adapter outside the hooks (#4873).
158
+ ...(vendorOf(subject)
159
+ ? []
160
+ : [`repos/${subject.tracker}/issues/comments/${subject.claim}`]),
141
161
  ];
162
+ // A Jira/Linear recovery reads no GitHub leaf or assignee: the adapter proves those (#4873).
142
163
  if (subject.recovery)
143
164
  endpoints.push(
144
165
  `repos/${repository}/actions/runs/${subject.recovery.runId}/attempts/${subject.recovery.runAttempt}`,
145
- `repos/${repository}/issues/${subject.issue}`,
166
+ ...(vendorOf(subject)
167
+ ? []
168
+ : [`repos/${repository}/issues/${subject.issue}`]),
146
169
  `repos/${repository}/git/matching-refs/heads/${subject.branch}`
147
170
  );
148
171
  const records = endpoints.map(endpoint => ({
@@ -152,16 +175,20 @@ function proofRequests(subject) {
152
175
  if (subject.recovery)
153
176
  records.push(
154
177
  { kind: "recovery-page", page: 1, args: recoveryPage(subject, 1) },
155
- {
156
- kind: "plain",
157
- args: [
158
- "api",
159
- "--hostname",
160
- "github.com",
161
- "--include",
162
- `repos/${repository}/assignees/${subject.maintainer}`,
163
- ],
164
- }
178
+ ...(vendorOf(subject)
179
+ ? []
180
+ : [
181
+ {
182
+ kind: "plain",
183
+ args: [
184
+ "api",
185
+ "--hostname",
186
+ "github.com",
187
+ "--include",
188
+ `repos/${repository}/assignees/${subject.maintainer}`,
189
+ ],
190
+ },
191
+ ])
165
192
  );
166
193
  for (const proof of subject.proofs)
167
194
  records.push(proofRequest(subject, proof));
@@ -133,6 +133,7 @@ const PRODUCER = [
133
133
  "tracker-jira",
134
134
  "tracker-linear",
135
135
  "tracker-wire",
136
+ "tracker-cancel",
136
137
  "worker-environment",
137
138
  "worker-inspection",
138
139
  "worker-lifecycle",
@@ -17,7 +17,11 @@ export {
17
17
  buildDraft,
18
18
  } from "./npm-update-leaf-contract.mjs";
19
19
  import { sha256 } from "./github-attestation-verifier.mjs";
20
- import { trackerFor, trustedHumanActorIds } from "./npm-update-tracker.mjs";
20
+ import {
21
+ trackerFor,
22
+ trustedHumanActorIds,
23
+ refuseUnreleasableHold,
24
+ } from "./npm-update-tracker.mjs";
21
25
 
22
26
  /** Each transition rereads holds, ownership and the actual managed claim. */
23
27
  export async function claimLeaf(
@@ -114,6 +118,7 @@ async function inspectLeafFields(issue, draft, policy, config) {
114
118
  trustedHumanActorIds: trustedHumanActorIds(config),
115
119
  humanNeededLabel: roles.human,
116
120
  });
121
+ refuseUnreleasableHold(config, hold.held);
117
122
  required(!hold.held, "current human hold is outstanding");
118
123
  required(
119
124
  issue.body === draft.body && issue.title === draft.title,
@@ -21,6 +21,42 @@ const MAINTAINER = {
21
21
  linear: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,
22
22
  };
23
23
  const KEY = /^[A-Z][A-Z0-9]{1,9}$/;
24
+ const VENDORS = new Set(["jira", "linear"]);
25
+
26
+ /**
27
+ * Who may cancel or supersede an update (#4873). A cancel is a manual GitHub
28
+ * workflow run, so it is authorized by a GitHub login with write or admin on the
29
+ * repository. GitHub hosts keep the maintainer's own login; a Jira/Linear
30
+ * maintainer is a tracker id, so those hosts name a GitHub `cancelOperator`.
31
+ * Absent, every cancel refuses with the key to set; nothing falls back to a
32
+ * wider group of repository writers.
33
+ * @param {object} config - Committed Lisa config.
34
+ * @param {object} policy - The validated npmUpdater entry.
35
+ * @returns {string} The GitHub login whose dispatch and permission authorize a cancel.
36
+ */
37
+ export function cancelOperatorOf(config, policy) {
38
+ if (!VENDORS.has(config.tracker)) return policy.maintainer;
39
+ if (typeof policy.cancelOperator !== "string")
40
+ throw operatorRefusal(
41
+ "npm updater cancel operator is not declared",
42
+ `npmUpdater.cancelOperator is not set in .lisa.config.json, so nobody is authorized to cancel or replace a ${config.tracker === "jira" ? "Jira" : "Linear"}-tracked npm update. Set it to the GitHub login of the person who may run the cancel workflow (they need write or admin on the repository). Nothing was changed.`
43
+ );
44
+ return policy.cancelOperator;
45
+ }
46
+
47
+ /** Only a Jira/Linear entry may name a cancel operator, and only as a GitHub login. */
48
+ function validateCancelOperator(value, config) {
49
+ if (!Object.hasOwn(value, "cancelOperator")) return;
50
+ required(
51
+ VENDORS.has(config.tracker),
52
+ "npmUpdater.cancelOperator applies only to Jira and Linear trackers"
53
+ );
54
+ required(
55
+ typeof value.cancelOperator === "string" &&
56
+ MAINTAINER.github.test(value.cancelOperator),
57
+ "npmUpdater.cancelOperator must be a GitHub login"
58
+ );
59
+ }
24
60
 
25
61
  /**
26
62
  * GitHub keeps its exact original check. Jira and Linear hosts still publish to
@@ -95,7 +131,9 @@ export function validatePolicy(value, config) {
95
131
  "packages",
96
132
  "lisaOwner",
97
133
  ...(Object.hasOwn(value ?? {}, "runtime") ? ["runtime"] : []),
134
+ ...(Object.hasOwn(value ?? {}, "cancelOperator") ? ["cancelOperator"] : []),
98
135
  ]);
136
+ validateCancelOperator(value, config);
99
137
  railsRuntime(value);
100
138
  required(
101
139
  value.version === 1 &&
@@ -12,7 +12,9 @@ import {
12
12
  sha256,
13
13
  verifyDescriptorAttestation,
14
14
  verifyCurrentProvider,
15
+ verifyCurrentRun,
15
16
  } from "./github-attestation-verifier.mjs";
17
+ import { vendorBacklink } from "./npm-update-tracker.mjs";
16
18
  import { canonicalJson } from "../lisa-automation-provenance.mjs";
17
19
  import { readJson, readBytes } from "./npm-update-process.mjs";
18
20
  import { existsSync } from "node:fs";
@@ -26,7 +28,8 @@ export function publicationProof(
26
28
  proposal,
27
29
  policy,
28
30
  issue,
29
- commit
31
+ commit,
32
+ claim
30
33
  ) {
31
34
  required(
32
35
  canonicalJson(readJson(proof.descriptor, 65_536)) ===
@@ -39,6 +42,9 @@ export function publicationProof(
39
42
  proof.recoveryBundle && existsSync(proof.recoveryBundle)
40
43
  );
41
44
  required(recovery === bundle, "partial publication recovery authority");
45
+ // A Jira/Linear claim (and its time) is proved by the adapter in publish
46
+ // authorize and passed in; GitHub keeps its own comment read (#4873).
47
+ required(!api.tracker || claim, "tracker claim proof is absent");
42
48
  if (recovery) {
43
49
  verifyRecoveryOrigin(
44
50
  api.policy,
@@ -53,11 +59,15 @@ export function publicationProof(
53
59
  commit: commit.sha,
54
60
  maintainer: policy.maintainer,
55
61
  recoverySha256: sha256(readBytes(proof.recovery, 65_536)),
62
+ ...(api.tracker ? { tracker: true, claim } : {}),
56
63
  }
57
64
  );
58
65
  } else {
59
66
  verifyDescriptorAttestation(api.policy, descriptor, proof, digest);
60
- verifyCurrentProvider(api.policy, descriptor);
67
+ (api.tracker ? verifyCurrentRun : verifyCurrentProvider)(
68
+ api.policy,
69
+ descriptor
70
+ );
61
71
  }
62
72
  }
63
73
 
@@ -104,6 +114,10 @@ export async function publicationBacklink(
104
114
  pr
105
115
  ) {
106
116
  await authorize();
117
+ // Jira/Linear: the adapter writes the managed backlink and reads it back exactly;
118
+ // the broker's helpers reach only GitHub (#4873).
119
+ if (api.tracker)
120
+ return vendorBacklink(api.tracker, allocation.number, pr.html_url);
107
121
  await api.workItem(
108
122
  cwd,
109
123
  ["backlink", "--ref", allocation.workItem, "--pr-url", pr.html_url],
@@ -173,7 +187,11 @@ export async function destinationSnapshot(api, proposal, allocation, commit) {
173
187
 
174
188
  /** The declaration is complete and the relationship waits for postmerge verification. */
175
189
  export function publicationBody(allocation) {
176
- const body = `${allocation.draft.body}\nWork-Item: ${allocation.workItem}\n\nRelates to https://github.com/${allocation.workItem.replace("#", "/issues/")}\n`;
190
+ // Only a GitHub issue has a github.com address; a Jira/Linear key is declared by its trailer alone.
191
+ const relates = allocation.workItem.includes("#")
192
+ ? `\nRelates to https://github.com/${allocation.workItem.replace("#", "/issues/")}\n`
193
+ : "";
194
+ const body = `${allocation.draft.body}\nWork-Item: ${allocation.workItem}\n${relates}`;
177
195
  const closing = [
178
196
  ...body.matchAll(/\b(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s+/gi),
179
197
  ];
@@ -16,6 +16,7 @@ import {
16
16
  import { runProcess } from "./npm-update-process.mjs";
17
17
  import { descriptorFor } from "./npm-update-gate.mjs";
18
18
  import { assertGateTransport } from "./npm-update-gate-hooks.mjs";
19
+ import { trackerPublishAuthority } from "./npm-update-tracker.mjs";
19
20
  import {
20
21
  publicationBody,
21
22
  publicationBacklink,
@@ -185,7 +186,18 @@ export async function publishProposal({
185
186
  config
186
187
  );
187
188
  await destinationSnapshot(api, proposal, allocation, commit.sha);
188
- publicationProof(api, descriptor, proof, proposal, policy, issue, commit);
189
+ // Jira/Linear: the claim, its sole owner and assignability come from the adapter (#4873).
190
+ const claim = await trackerPublishAuthority(api, descriptor, policy, issue);
191
+ publicationProof(
192
+ api,
193
+ descriptor,
194
+ proof,
195
+ proposal,
196
+ policy,
197
+ issue,
198
+ commit,
199
+ claim
200
+ );
189
201
  return issue;
190
202
  };
191
203
  await authorize();
@@ -24,7 +24,6 @@ import { targetField } from "./automation-provenance-contract.mjs";
24
24
  import { required, validateProposal } from "./npm-update-contract.mjs";
25
25
  import {
26
26
  trackerFor,
27
- refuseUnlessGithub,
28
27
  verifySignedWorkItem,
29
28
  proveTrackerProvider,
30
29
  } from "./npm-update-tracker.mjs";
@@ -128,7 +127,7 @@ export {
128
127
  } from "./npm-update-checkpoint.mjs";
129
128
 
130
129
  /** Renewal verifies fresh authority against every immutable original identity field. */
131
- function verifyRenewal({
130
+ async function verifyRenewal({
132
131
  api,
133
132
  preview,
134
133
  paths,
@@ -138,6 +137,22 @@ function verifyRenewal({
138
137
  policy,
139
138
  }) {
140
139
  const recovery = readJson(paths.recovery, 65_536);
140
+ // Jira/Linear: the adapter proves claim, sole owner and assignability; the
141
+ // code host proves repository, runs and destination (#4873).
142
+ const vendor = api.tracker
143
+ ? {
144
+ tracker: true,
145
+ claim: await api.tracker.proveClaim(preview.descriptor),
146
+ }
147
+ : {};
148
+ if (api.tracker) {
149
+ required(
150
+ issue.assignees.length === 1 &&
151
+ issue.assignees[0].login === policy.maintainer,
152
+ "current recovery leaf or owner differs"
153
+ );
154
+ await api.tracker.assignable(policy.maintainer);
155
+ }
141
156
  verifyRecoveryOrigin(
142
157
  api.policy,
143
158
  preview.descriptor,
@@ -151,6 +166,7 @@ function verifyRenewal({
151
166
  commit: predictedCommit(preview.descriptor, Buffer.from(preview.message)),
152
167
  maintainer: policy.maintainer,
153
168
  recoverySha256: sha256(readBytes(paths.recovery, 65_536)),
169
+ ...vendor,
154
170
  }
155
171
  );
156
172
  }
@@ -181,8 +197,17 @@ export async function finalizeAuthorization({
181
197
  );
182
198
  const mode = readJson(join(output, "authorization.json")).mode;
183
199
  if (mode === "recovery") {
184
- refuseUnlessGithub(config, "signed-origin recovery");
185
- verifyRenewal({ api, preview, paths, digest, proposal, issue, policy });
200
+ if (config.tracker !== "github")
201
+ verifySignedWorkItem(config, allocation, preview);
202
+ await verifyRenewal({
203
+ api,
204
+ preview,
205
+ paths,
206
+ digest,
207
+ proposal,
208
+ issue,
209
+ policy,
210
+ });
186
211
  } else {
187
212
  required(mode === "origin", "unknown authorization role");
188
213
  verifyDescriptorAttestation(api.policy, preview.descriptor, paths, digest);
@@ -12,6 +12,12 @@ import {
12
12
  import { join } from "node:path";
13
13
  import { writeFileSync } from "node:fs";
14
14
  import { writeJson, withPrivateRoot } from "./npm-update-process.mjs";
15
+ import { cancelOperatorOf } from "./npm-update-policy.mjs";
16
+ import {
17
+ managedActor,
18
+ trackerOf,
19
+ assertManagedClosure,
20
+ } from "./npm-update-tracker.mjs";
15
21
  import { sha256 } from "./github-attestation-verifier.mjs";
16
22
  import {
17
23
  completeCheckpoints,
@@ -123,6 +129,7 @@ function cancellationCheckpoint(issue) {
123
129
 
124
130
  /** Provider operator and official signature independently authenticate the complete historical subject. */
125
131
  async function verifyRecordedBundle(api, authority, checkpoint, record, issue) {
132
+ const managed = await managedActor(api);
126
133
  const run = await api.request(
127
134
  `repos/${record.repository}/actions/runs/${record.runId}/attempts/${record.runAttempt}`
128
135
  );
@@ -130,7 +137,14 @@ async function verifyRecordedBundle(api, authority, checkpoint, record, issue) {
130
137
  `repos/${record.repository}/collaborators/${record.maintainer}/permission`
131
138
  );
132
139
  assertRecordedOperator(run, permission, authority, record);
133
- assertOriginTransport(issue.comments, checkpoint.digest, authority, run);
140
+ assertOriginTransport(
141
+ issue.comments,
142
+ checkpoint.digest,
143
+ authority,
144
+ run,
145
+ Date.now(),
146
+ managed
147
+ );
134
148
  await withPrivateRoot(async root => {
135
149
  const paths = {
136
150
  cancellation: join(root, "cancellation.json"),
@@ -186,7 +200,8 @@ export async function recordedCancellation({
186
200
  "ghExecutable",
187
201
  "ghSha256",
188
202
  ].every(key => authority[key] === api.policy[key]) &&
189
- committed.maintainer === proposalPolicy(config, proposal).maintainer,
203
+ cancelOperatorOf(historical, committed) ===
204
+ cancelOperatorOf(config, proposalPolicy(config, proposal)),
190
205
  "recorded cancellation authority differs"
191
206
  );
192
207
  const replacement = validateProposal(checkpoint.payload.proposal, committed);
@@ -218,10 +233,9 @@ export async function recordedCancellation({
218
233
  await api.main(proposal.parent, proposal.target);
219
234
  await cancellationDestinationAbsent(api, record.oldProposalKey);
220
235
  if (issue.state === "closed")
221
- required(
222
- issue.state_reason === "not_planned" &&
223
- issue.closed_by?.type === "Bot" &&
224
- String(issue.closed_by.id) === api.policy.claimActorId,
236
+ await assertManagedClosure(
237
+ api,
238
+ issue,
225
239
  "closure is not the authenticated managed cancellation"
226
240
  );
227
241
  return checkpoint;
@@ -241,7 +255,7 @@ export async function discoverSupersession(
241
255
  const issues = [],
242
256
  records = new Map();
243
257
  for (const item of found) {
244
- const issue = await api.issue(item.number);
258
+ const issue = await trackerOf(api).issue(item.number);
245
259
  required(
246
260
  !issue.pull_request && typeof issue.body === "string",
247
261
  "foreign supersession issue"
@@ -0,0 +1,139 @@
1
+ // This file is managed by Lisa and IS replaced on each `lisa` run.
2
+ // Do not edit directly — durable changes belong upstream in Lisa.
3
+
4
+ /**
5
+ * @file npm-update-tracker-cancel.mjs
6
+ * @description Cancellation and supersession closure for Jira and Linear work items
7
+ * (CodySwannGT/lisa#4873). GitHub closes an issue as `not_planned` and proves the
8
+ * Bot closed it through `closed_by`; Jira moves the ticket to the configured
9
+ * canceled status and proves the author through the issue changelog, and Linear
10
+ * moves the issue to the canceled workflow state and proves the actor through the
11
+ * issue history. Either way, a closure the automation did not make never counts.
12
+ * @module npm-updater
13
+ */
14
+ import { required, operatorRefusal } from "./npm-update-invariants.mjs";
15
+
16
+ const PAGES = 20;
17
+ const HISTORY =
18
+ "query LisaNpmIssueHistory($id: String!, $after: String) { issue(id: $id) { history(first: 100, after: $after) { nodes { createdAt actor { id } toState { id type } } pageInfo { hasNextPage endCursor } } } }";
19
+
20
+ /**
21
+ * Where a cancelled or superseded item is moved, from the same workflow keys the
22
+ * lifecycle reads: Jira's `jira.workflow.canceled` (default "Won't Do"), and
23
+ * Linear's `linear.workflow.canceled` or, when unset, the team's one state of
24
+ * type `canceled` (null). Never a lifecycle role, so it cannot read as ready,
25
+ * claimed or done.
26
+ * @param {object} config - Committed Lisa config.
27
+ * @returns {string|null} The configured name, or null for Linear's type default.
28
+ */
29
+ export function canceledName(config) {
30
+ const workflow =
31
+ config.tracker === "jira"
32
+ ? config.jira?.workflow
33
+ : (config.linear?.workflow ?? config.linear?.labels?.build);
34
+ const configured = workflow?.canceled;
35
+ if (typeof configured === "string" && configured.trim())
36
+ return configured.trim();
37
+ return config.tracker === "jira" ? "Won't Do" : null;
38
+ }
39
+
40
+ /** Jira writes `+0000`; every timestamp the updater compares is normalized ISO-8601. */
41
+ export function isoTime(value) {
42
+ const parsed = Date.parse(
43
+ String(value ?? "").replace(/([+-]\d{2})(\d{2})$/, "$1:$2")
44
+ );
45
+ return Number.isFinite(parsed) ? new Date(parsed).toISOString() : undefined;
46
+ }
47
+
48
+ /** A closure by anyone but the automation identity is preserved, never adopted. */
49
+ function foreignClosure(ref) {
50
+ return operatorRefusal(
51
+ "closure is not the authenticated managed cancellation",
52
+ `${ref} was closed by someone other than the npm updater's automation account, so the updater will not treat it as its own cancellation. Reopen it, or handle this update by hand.`
53
+ );
54
+ }
55
+
56
+ /** Jira: one workflow transition into the configured canceled status. */
57
+ export function jiraCancel(jira, number) {
58
+ return jira.moveTo(number, jira.canceled);
59
+ }
60
+
61
+ /** Jira: the newest status change must be into the canceled status, by the automation account. */
62
+ export async function jiraAssertCancelled(jira, number) {
63
+ const changes = [];
64
+ for (let page = 0; page < PAGES; page++) {
65
+ const reply = await jira.call(
66
+ `/issue/${jira.ref(number)}/changelog?startAt=${page * 100}&maxResults=100`,
67
+ "issue"
68
+ );
69
+ required(Array.isArray(reply?.values), "provider page is not an array");
70
+ changes.push(...reply.values);
71
+ if (reply.isLast === true || !reply.values.length) break;
72
+ required(page < PAGES - 1, "provider pagination exceeded bound");
73
+ }
74
+ const moves = changes
75
+ .filter(entry => (entry.items ?? []).some(item => item.field === "status"))
76
+ .sort((left, right) =>
77
+ String(isoTime(left.created)).localeCompare(
78
+ String(isoTime(right.created))
79
+ )
80
+ );
81
+ const last = moves.at(-1);
82
+ const into = last?.items.filter(item => item.field === "status").at(-1);
83
+ required(
84
+ String(into?.toString ?? "").toLowerCase() === jira.canceled.toLowerCase(),
85
+ "cancellation closure readback differs"
86
+ );
87
+ if (last.author?.accountId !== (await jira.myself()))
88
+ throw foreignClosure(jira.ref(number));
89
+ }
90
+
91
+ /** Linear: the configured canceled state, else the team's one state of type `canceled`. */
92
+ export async function linearCanceledState(linear) {
93
+ const states = (await linear.team()).states.nodes;
94
+ const name = linear.canceled;
95
+ const matches = name
96
+ ? states.filter(state => state.name.toLowerCase() === name.toLowerCase())
97
+ : states.filter(state => state.type === "canceled");
98
+ required(
99
+ matches.length === 1 && matches[0].type === "canceled",
100
+ "configured Linear canceled state differs"
101
+ );
102
+ return matches[0];
103
+ }
104
+
105
+ /** Linear: one state update into the canceled state. */
106
+ export async function linearCancel(linear, number) {
107
+ await linear.update(number, {
108
+ stateId: (await linearCanceledState(linear)).id,
109
+ });
110
+ }
111
+
112
+ /** Linear: the newest state change must be into the canceled state, by the automation user. */
113
+ export async function linearAssertCancelled(linear, number) {
114
+ const canceled = await linearCanceledState(linear);
115
+ const entries = [];
116
+ let after = null;
117
+ for (let page = 0; page < PAGES; page++) {
118
+ const connection = (
119
+ await linear.graphql(HISTORY, { id: linear.ref(number), after }, "issue")
120
+ ).issue?.history;
121
+ required(Array.isArray(connection?.nodes), "provider page is not an array");
122
+ entries.push(...connection.nodes);
123
+ if (!connection.pageInfo?.hasNextPage) break;
124
+ required(page < PAGES - 1, "provider pagination exceeded bound");
125
+ after = connection.pageInfo.endCursor;
126
+ }
127
+ const last = entries
128
+ .filter(entry => entry.toState)
129
+ .sort((left, right) =>
130
+ String(left.createdAt).localeCompare(String(right.createdAt))
131
+ )
132
+ .at(-1);
133
+ required(
134
+ last?.toState?.id === canceled.id,
135
+ "cancellation closure readback differs"
136
+ );
137
+ if (last.actor?.id !== (await linear.viewer()))
138
+ throw foreignClosure(linear.ref(number));
139
+ }