@codyswann/lisa 5.1.7 → 5.2.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 (93) hide show
  1. package/all/copy-overwrite/scripts/lib/github-attestation-provider.mjs +15 -0
  2. package/all/copy-overwrite/scripts/lib/npm-update-allocate.mjs +32 -39
  3. package/all/copy-overwrite/scripts/lib/npm-update-authorization.mjs +12 -2
  4. package/all/copy-overwrite/scripts/lib/npm-update-checkpoint.mjs +10 -30
  5. package/all/copy-overwrite/scripts/lib/npm-update-execution-adapter.mjs +4 -1
  6. package/all/copy-overwrite/scripts/lib/npm-update-helper-graph.mjs +1 -1
  7. package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +4 -0
  8. package/all/copy-overwrite/scripts/lib/npm-update-hosted-hook.mjs +2 -1
  9. package/all/copy-overwrite/scripts/lib/npm-update-invariants.mjs +15 -1
  10. package/all/copy-overwrite/scripts/lib/npm-update-leaf-contract.mjs +41 -9
  11. package/all/copy-overwrite/scripts/lib/npm-update-leaf.mjs +23 -35
  12. package/all/copy-overwrite/scripts/lib/npm-update-policy.mjs +41 -6
  13. package/all/copy-overwrite/scripts/lib/npm-update-recovery.mjs +16 -3
  14. package/all/copy-overwrite/scripts/lib/npm-update-tracker-jira.mjs +300 -0
  15. package/all/copy-overwrite/scripts/lib/npm-update-tracker-linear.mjs +304 -0
  16. package/all/copy-overwrite/scripts/lib/npm-update-tracker-wire.mjs +298 -0
  17. package/all/copy-overwrite/scripts/lib/npm-update-tracker.mjs +179 -0
  18. package/all/copy-overwrite/scripts/lisa-npm-updater.mjs +16 -2
  19. package/all/copy-overwrite/scripts/lisa-work-item.mjs +1 -1
  20. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +62 -14
  21. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  22. package/dist/core/lisa-owned-hash-ledger.js +96 -0
  23. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  24. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  25. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  26. package/dist/core/upstream-evidence-manifest.js +55 -18
  27. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  28. package/package.json +4 -4
  29. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  30. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  31. package/plugins/lisa-agy/plugin.json +1 -1
  32. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  33. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  34. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  35. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  36. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  37. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  38. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  39. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  40. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  41. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  42. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  43. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  44. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  45. package/plugins/lisa-expo-agy/plugin.json +1 -1
  46. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  47. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  48. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  49. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  50. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  51. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  52. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  53. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  54. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  55. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  56. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  57. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  58. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  59. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  60. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  64. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  65. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  66. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  67. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  68. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  70. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  71. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  72. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  73. package/plugins/lisa-rails-agy/plugin.json +1 -1
  74. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  75. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  76. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  77. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  78. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  79. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  80. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  81. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  82. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  84. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  85. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  86. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  87. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  88. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  89. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  90. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  91. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  92. package/scripts/two-channel-couplings.json +1 -1
  93. package/typescript/copy-overwrite/.prettierignore +4 -0
@@ -154,6 +154,21 @@ export function verifyCurrentProvider(
154
154
  return providerOrigin(policy, descriptor, false, execute);
155
155
  }
156
156
 
157
+ /**
158
+ * The repository and live-run half of current authority, for a Jira or Linear
159
+ * host whose claim is proved by its own tracker adapter rather than GitHub.
160
+ */
161
+ export function verifyCurrentRun(
162
+ policy,
163
+ descriptor,
164
+ execute = boundedSpawnSync
165
+ ) {
166
+ const read = endpoint =>
167
+ ghJson(policy, [API, HOST_FLAG, PUBLIC_HOST, endpoint], execute);
168
+ repositoryState(read, policy, descriptor.parent);
169
+ return runState(read, policy, descriptor, false);
170
+ }
171
+
157
172
  /** Historical origin returns qualified provider chronology, never current authority. */
158
173
  export function verifyHistoricalProvider(
159
174
  policy,
@@ -11,6 +11,11 @@ import { sha256 } from "./github-attestation-verifier.mjs";
11
11
  import { registryVersion } from "./npm-update-npm.mjs";
12
12
  import { discoverSupersession } from "./npm-update-supersession.mjs";
13
13
  import { canonicalJson } from "../lisa-automation-provenance.mjs";
14
+ import {
15
+ trackerOf,
16
+ trackerFor,
17
+ refuseUnlessGithub,
18
+ } from "./npm-update-tracker.mjs";
14
19
  import {
15
20
  buildDraft,
16
21
  qualityGates,
@@ -26,16 +31,14 @@ export async function filingEvidence(api, proposal, config, cwd) {
26
31
  { PATH: process.env.PATH, HOME: "/nonexistent", GIT_TERMINAL_PROMPT: "0" },
27
32
  proposal
28
33
  );
34
+ const tracker = trackerFor(api, proposal, config);
29
35
  await api.main(proposal.parent);
30
- const query = `repo:${proposal.repository} npm is:issue in:title,body`;
31
- const search = await api.request(
32
- `search/issues?q=${encodeURIComponent(query)}&per_page=100`
33
- );
36
+ const search = await tracker.relationships(proposal);
34
37
  required(
35
38
  !search.incomplete_results && search.total_count <= 100,
36
39
  "relationship search is incomplete or oversized"
37
40
  );
38
- for (const item of search.items) await api.issue(item.number);
41
+ for (const item of search.items) await tracker.issue(item.number);
39
42
  const history = await runProcess(
40
43
  "git",
41
44
  [
@@ -58,15 +61,13 @@ export async function filingEvidence(api, proposal, config, cwd) {
58
61
  const registry = [];
59
62
  for (const update of proposal.updates)
60
63
  registry.push(await registryVersion(update, proposal));
61
- const labels = (await api.list(`repos/${proposal.repository}/labels`)).map(
62
- label => label.name
63
- );
64
+ const labels = await tracker.vocabulary(proposal);
64
65
  return {
65
66
  history: {
66
67
  command: `git log ${proposal.parent} --max-count=20 -- ${historyPaths(proposal).join(" ")}`,
67
68
  result: history.stdout.toString() || "No matching history.",
68
69
  },
69
- search: { query, total: search.total_count },
70
+ search: { query: search.query, total: search.total_count },
70
71
  registry,
71
72
  labels,
72
73
  main: proposal.parent,
@@ -75,10 +76,11 @@ export async function filingEvidence(api, proposal, config, cwd) {
75
76
 
76
77
  /** Same selected versions are discovered before deriving a new parent-bound key. */
77
78
  export async function discoverPrior(api, proposal, context) {
78
- const query = `repo:${proposal.repository} "${proposal.selectionKey}" is:issue in:body`;
79
- const found = await api.request(
80
- `search/issues?q=${encodeURIComponent(query)}&per_page=100`
81
- );
79
+ // With a committed config, the adapter must be the configured one; never GitHub by default.
80
+ const tracker = context
81
+ ? trackerFor(api, proposal, context.config)
82
+ : trackerOf(api, proposal.repository);
83
+ const found = await tracker.searchPrior(proposal);
82
84
  required(
83
85
  found.incomplete_results === false &&
84
86
  Number.isSafeInteger(found.total_count) &&
@@ -88,9 +90,11 @@ export async function discoverPrior(api, proposal, context) {
88
90
  "prior selection search is incomplete or ambiguous"
89
91
  );
90
92
  if (!found.total_count) return { status: "new" };
91
- if (context && (found.total_count > 1 || found.items[0].state === "closed"))
93
+ if (context && (found.total_count > 1 || found.items[0].state === "closed")) {
94
+ refuseUnlessGithub(context.config, "supersession");
92
95
  return discoverSupersession(api, proposal, found.items, context);
93
- const issue = await api.issue(found.items[0].number);
96
+ }
97
+ const issue = await tracker.issue(found.items[0].number);
94
98
  required(
95
99
  issue.state === "open" &&
96
100
  !issue.pull_request &&
@@ -140,8 +144,9 @@ async function restoredAllocation({
140
144
  state.claims.length === 1 &&
141
145
  String(state.claims[0].id) === allocation.claimCommentId &&
142
146
  sha256(state.claims[0].body) === allocation.claimSha256 &&
143
- String(state.claims[0].user?.id) === api.policy.claimActorId &&
144
- state.claims[0].user?.type === "Bot",
147
+ (await trackerFor(api, policy, config).isManagedActor(
148
+ state.claims[0].user
149
+ )),
145
150
  "origin checkpoint current claim changed"
146
151
  );
147
152
  qualityGates(
@@ -164,6 +169,7 @@ async function restoredAllocation({
164
169
  async function ensureLabels({
165
170
  api,
166
171
  policy,
172
+ config,
167
173
  roles,
168
174
  currentEvidence,
169
175
  prior,
@@ -176,11 +182,7 @@ async function ensureLabels({
176
182
  roles.claimed,
177
183
  ]) {
178
184
  if (!currentEvidence.labels.includes(name)) {
179
- await api.request(`repos/${policy.repository}/labels`, "POST", {
180
- name,
181
- color: "ededed",
182
- description: "Managed dependency Task lifecycle",
183
- });
185
+ await trackerFor(api, policy, config).ensureRole(name);
184
186
  currentEvidence.labels.push(name);
185
187
  if (!prior.issue) evidence.labels = currentEvidence.labels;
186
188
  }
@@ -200,14 +202,8 @@ async function completeAllocation({
200
202
  }) {
201
203
  const draft = buildDraft(proposal, policy, config, evidence);
202
204
  const before = qualityGates(draft, proposal, policy, config, evidence);
203
- let issue =
204
- prior.issue ??
205
- (await api.request(`repos/${policy.repository}/issues`, "POST", {
206
- title: draft.title,
207
- body: draft.body,
208
- labels: draft.labels,
209
- assignees: draft.assignees,
210
- }));
205
+ const tracker = trackerFor(api, policy, config);
206
+ let issue = prior.issue ?? (await tracker.createLeaf(draft, proposal));
211
207
  const claimed = await claimLeaf(
212
208
  api,
213
209
  issue,
@@ -227,16 +223,12 @@ async function completeAllocation({
227
223
  config,
228
224
  evidence
229
225
  );
230
- const announcement = `[${policy.repository.split("/")[1]}] Fresh dependency Task ${policy.repository}#${issue.number} is assigned to ${policy.maintainer}. Proposal key: ${proposal.key}. Pre/post writer quality gates completed; ordinary gates and runtime evidence remain required.`;
226
+ const announcement = `[${policy.repository.split("/")[1]}] Fresh dependency Task ${tracker.ref(issue.number)} is assigned to ${policy.maintainer}. Proposal key: ${proposal.key}. Pre/post writer quality gates completed; ordinary gates and runtime evidence remain required.`;
231
227
  if (!issue.comments.some(comment => comment.body === announcement))
232
- await api.request(
233
- `repos/${policy.repository}/issues/${issue.number}/comments`,
234
- "POST",
235
- { body: announcement }
236
- );
228
+ await tracker.comment(issue.number, announcement);
237
229
  return {
238
230
  number: issue.number,
239
- workItem: `${policy.repository}#${issue.number}`,
231
+ workItem: tracker.ref(issue.number),
240
232
  claimCommentId: String(state.claims[0].id),
241
233
  claimSha256: sha256(CLAIM),
242
234
  draft,
@@ -257,15 +249,16 @@ export async function allocateLeaf({
257
249
  }) {
258
250
  let proposal = suppliedProposal;
259
251
  validateProposal(proposal, policy);
252
+ const tracker = trackerFor(api, policy, config);
260
253
  await api.main(proposal.parent);
261
254
  const prior = await discoverPrior(api, proposal, { cwd, config });
262
255
  if (prior.status === "stale-outstanding")
263
256
  return {
264
257
  status: prior.status,
265
258
  number: prior.issue.number,
266
- workItem: `${policy.repository}#${prior.issue.number}`,
259
+ workItem: tracker.ref(prior.issue.number),
267
260
  };
268
- await api.assignable(policy.maintainer);
261
+ await tracker.assignable(policy.maintainer);
269
262
  const currentEvidence = await filingEvidence(api, proposal, config, cwd);
270
263
  if (prior.supersession)
271
264
  currentEvidence.supersession = {
@@ -16,6 +16,10 @@ import { persistCheckpoint, recoveryRecord } from "./npm-update-recovery.mjs";
16
16
  export { recoveryRecord } from "./npm-update-recovery.mjs";
17
17
  import { verifyCurrentProvider } from "./github-attestation-verifier.mjs";
18
18
  import { verifyHistoricalProvider } from "./github-attestation-provider.mjs";
19
+ import {
20
+ refuseUnlessGithub,
21
+ verifySignedWorkItem,
22
+ } from "./npm-update-tracker.mjs";
19
23
  import {
20
24
  verifyHistoricalDescriptor,
21
25
  predictedCommit,
@@ -120,7 +124,8 @@ async function recoveryPreview({
120
124
  original.number,
121
125
  allocation.origin.payload,
122
126
  allocation.origin.digest,
123
- () => authorizeAllocation(api, proposal, original, policy, config)
127
+ () => authorizeAllocation(api, proposal, original, policy, config),
128
+ config
124
129
  );
125
130
  }
126
131
  const commit = predictedCommit(
@@ -158,7 +163,8 @@ async function originPreview({
158
163
  original.number,
159
164
  { version: 1, proposal, allocation: original, preview: null, bundle: "" },
160
165
  proposal.key,
161
- () => authorizeAllocation(api, proposal, original, policy, config)
166
+ () => authorizeAllocation(api, proposal, original, policy, config),
167
+ config
162
168
  );
163
169
  const preview = await descriptorFor({
164
170
  cwd,
@@ -195,6 +201,8 @@ export async function prepareAuthorization({
195
201
  let proposal = suppliedProposal;
196
202
  if (allocation.status === "stale-outstanding")
197
203
  return { mode: allocation.status, allocation };
204
+ // Resuming a signed origin re-verifies the claim's GitHub chronology (#4873).
205
+ if (allocation.origin) refuseUnlessGithub(config, "signed-origin recovery");
198
206
  const restored =
199
207
  allocation.origin?.payload.proposal ??
200
208
  allocation.originalProposal ??
@@ -225,6 +233,8 @@ export async function prepareAuthorization({
225
233
  const preview = allocation.origin
226
234
  ? await recoveryPreview(inputs)
227
235
  : await originPreview(inputs);
236
+ if (config.tracker !== "github")
237
+ verifySignedWorkItem(config, original, preview);
228
238
  writeJson(join(output, "preview.json"), preview);
229
239
  writeJson(join(output, "allocation.json"), original);
230
240
  const mode = allocation.origin ? "recovery" : "origin";
@@ -9,6 +9,7 @@
9
9
  import { canonicalJson } from "../lisa-automation-provenance.mjs";
10
10
  import { keys, required } from "./npm-update-contract.mjs";
11
11
  import { sha256 } from "./github-attestation-verifier.mjs";
12
+ import { trackerOf, trackerFor } from "./npm-update-tracker.mjs";
12
13
  import {
13
14
  checkpointPayloadBytes,
14
15
  encodeCheckpointBytes,
@@ -216,12 +217,14 @@ export async function persistCheckpoint(
216
217
  number,
217
218
  payload,
218
219
  digest,
219
- authorize
220
+ authorize,
221
+ config
220
222
  ) {
221
- const endpoint = `repos/${api.policy.repository}/issues/${number}/comments`;
222
- const issueUrl = `https://api.github.com/repos/${api.policy.repository}/issues/${number}`;
223
+ // GitHub keeps its original endpoint, scope check and readback inside the adapter.
224
+ // A caller holding the committed config proves the adapter is the configured one.
225
+ const tracker = config ? trackerFor(api, api.policy, config) : trackerOf(api);
223
226
  await authorize();
224
- let existing = await api.list(endpoint);
227
+ let existing = await tracker.comments(number);
225
228
  const bodies = writeBodies(payload, digest, existing);
226
229
  for (const body of bodies) {
227
230
  const selected = relevant(existing, digest);
@@ -236,7 +239,7 @@ export async function persistCheckpoint(
236
239
  // Existing exact bodies require no mutation. Missing bodies always renew live authority
237
240
  // and inventory first, including when completion is the sole remaining legacy write.
238
241
  await authorize();
239
- existing = await api.list(endpoint);
242
+ existing = await tracker.comments(number);
240
243
  const refreshed = relevant(existing, digest);
241
244
  required(
242
245
  new Set(refreshed).size === refreshed.length &&
@@ -253,32 +256,9 @@ export async function persistCheckpoint(
253
256
  "checkpoint chunks must read back before completion"
254
257
  );
255
258
  }
256
- if (!matches.length) {
257
- const created = await api.request(endpoint, "POST", { body });
258
- required(
259
- created.issue_url === issueUrl,
260
- "checkpoint write scope differs"
261
- );
262
- required(
263
- created.body === body &&
264
- Number.isSafeInteger(created.id) &&
265
- created.id > 0,
266
- "checkpoint write readback differs"
267
- );
268
- const read = await api.request(
269
- `repos/${api.policy.repository}/issues/comments/${created.id}`
270
- );
271
- required(
272
- read.issue_url === issueUrl,
273
- "checkpoint immediate readback scope differs"
274
- );
275
- required(
276
- read.id === created.id && read.body === body,
277
- "checkpoint immediate readback differs"
278
- );
279
- }
259
+ if (!matches.length) await tracker.durableComment(number, body);
280
260
  }
281
- const restored = decodeCheckpoint(await api.list(endpoint), digest);
261
+ const restored = decodeCheckpoint(await tracker.comments(number), digest);
282
262
  required(
283
263
  canonicalJson(restored) === canonicalJson(payload),
284
264
  "durable complete checkpoint differs"
@@ -70,7 +70,7 @@ function commandTool(context, command) {
70
70
  }
71
71
 
72
72
  /** Private instrumentation may be inherited only by authenticated canonical Node children. */
73
- function childEnvironment(options, contextFile, canonical) {
73
+ export function childEnvironment(options, contextFile, canonical) {
74
74
  const env = { ...(options.env ?? process.env) };
75
75
  required(
76
76
  !env.NODE_OPTIONS && !env.NODE_PATH,
@@ -79,6 +79,9 @@ function childEnvironment(options, contextFile, canonical) {
79
79
  delete env.LISA_NPM_DISPATCH_CONTEXT;
80
80
  delete env.GH_TOKEN;
81
81
  delete env.GITHUB_TOKEN;
82
+ // Tracker credentials (CodySwannGT/lisa#4859) never reach a nested tool either.
83
+ for (const name of Object.keys(env))
84
+ if (/^(?:JIRA_|ATLASSIAN_|LINEAR_API_KEY)/.test(name)) delete env[name];
82
85
  if (canonical) env.LISA_NPM_DISPATCH_CONTEXT = contextFile;
83
86
  return env;
84
87
  }
@@ -102,7 +102,7 @@ export function validateHelperManifest(manifest) {
102
102
  assert(manifest.version === 1, "unsupported helper graph version");
103
103
  const names = Object.keys(manifest.members ?? {});
104
104
  assert(
105
- names.length > 0 && names.length <= 128,
105
+ names.length > 0 && names.length <= 160,
106
106
  "helper member inventory is empty or unbounded"
107
107
  );
108
108
  for (const name of names) {
@@ -122,6 +122,10 @@ const PRODUCER = [
122
122
  "runtime-transport",
123
123
  "runtime",
124
124
  "tool-launcher",
125
+ "tracker",
126
+ "tracker-jira",
127
+ "tracker-linear",
128
+ "tracker-wire",
125
129
  "worker-environment",
126
130
  "worker-inspection",
127
131
  "worker-lifecycle",
@@ -113,7 +113,8 @@ export function tokenFreeHookEnvironment(source) {
113
113
  const env = { ...source };
114
114
  for (const name of Object.keys(env))
115
115
  if (
116
- /^(?:GH_TOKEN|GITHUB_TOKEN|ACTIONS_ID_TOKEN_|ACTIONS_RUNTIME_|LISA_NPM_DISPATCH_CONTEXT|NODE_OPTIONS|NODE_PATH)/.test(
116
+ // Tracker credentials (CodySwannGT/lisa#4859) are as private as the GitHub token.
117
+ /^(?:GH_TOKEN|GITHUB_TOKEN|ACTIONS_ID_TOKEN_|ACTIONS_RUNTIME_|LISA_NPM_DISPATCH_CONTEXT|NODE_OPTIONS|NODE_PATH|JIRA_|ATLASSIAN_|LINEAR_API_KEY)/.test(
117
118
  name
118
119
  )
119
120
  )
@@ -30,6 +30,7 @@ const stages = new Set([
30
30
  ]);
31
31
  const diagnostics = new WeakMap();
32
32
  const capturedErrors = new WeakMap();
33
+ const operatorSentences = new WeakMap();
33
34
  const providerPurposes = new Set([
34
35
  "repository",
35
36
  "main-reference",
@@ -302,7 +303,9 @@ export function publicFailure(error) {
302
303
  "reports=child-reported-nonauthoritative"
303
304
  );
304
305
  }
305
- return `npm updater failed: required policy, authorization, installation, gate or exact publication evidence was unavailable (${parts.join(" ")})`;
306
+ const line = `npm updater failed: required policy, authorization, installation, gate or exact publication evidence was unavailable (${parts.join(" ")})`;
307
+ const sentence = operatorSentences.get(error);
308
+ return sentence ? `${line}\n${sentence}` : line;
306
309
  }
307
310
 
308
311
  /** Only trusted static boundary reasons may leave a phase as a public diagnostic. */
@@ -312,6 +315,17 @@ export class UpdaterError extends Error {
312
315
  }
313
316
  }
314
317
 
318
+ /**
319
+ * A refusal the operator must act on carries one fixed plain-language sentence,
320
+ * registered here rather than read from an error property, so no provider
321
+ * payload or arbitrary exception text can ever reach the public diagnostic.
322
+ */
323
+ export function operatorRefusal(reason, sentence) {
324
+ const error = new UpdaterError(reason);
325
+ operatorSentences.set(error, sentence);
326
+ return error;
327
+ }
328
+
315
329
  /** Reject a boundary explicitly without printing untrusted candidate values. */
316
330
  export function required(ok, reason) {
317
331
  if (!ok) throw new UpdaterError(reason);
@@ -4,11 +4,16 @@
4
4
  /** Pure environment, lifecycle and fixed Task data cannot import live claim or quality orchestration. */
5
5
  import { canonicalJson } from "../lisa-automation-provenance.mjs";
6
6
  import { required } from "./npm-update-contract.mjs";
7
- import { trackerContract } from "../lisa-work-item.mjs";
7
+ import {
8
+ trackerContract,
9
+ deployBranchEnvironments,
10
+ } from "../lisa-work-item.mjs";
8
11
  import { directoryOf, npmPath } from "./automation-provenance-contract.mjs";
9
12
 
10
- /** Immutable host config, not candidate data or local aliases, chooses lifecycle. */
11
- export function leafRoles(config, repository) {
13
+ const TRACKER_NAMES = { github: "GitHub", jira: "Jira", linear: "Linear" };
14
+
15
+ /** GitHub keeps every original queue and ProjectV2 refusal; its blocked/human roles are labels. */
16
+ function githubRoles(config, repository) {
12
17
  required(
13
18
  config.tracker === "github" &&
14
19
  repository === `${config.github?.org}/${config.github?.repo}`,
@@ -25,6 +30,32 @@ export function leafRoles(config, repository) {
25
30
  "configured ProjectV2 coordination requires the ordinary writer"
26
31
  );
27
32
  const build = config.github.labels?.build ?? {};
33
+ return {
34
+ blocked: build.blocked ?? "status:blocked",
35
+ human: build.human_needed ?? "human-needed",
36
+ };
37
+ }
38
+
39
+ /** Jira and Linear block with a workflow status; a human hold is still a plain label. */
40
+ function vendorRoles(config, repository) {
41
+ required(
42
+ ["jira", "linear"].includes(config.tracker) &&
43
+ /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(repository ?? ""),
44
+ "configured tracker scope differs"
45
+ );
46
+ const workflow =
47
+ config.tracker === "jira"
48
+ ? config.jira?.workflow
49
+ : (config.linear?.workflow ?? config.linear?.labels?.build);
50
+ return { blocked: workflow?.blocked ?? "Blocked", human: "human-needed" };
51
+ }
52
+
53
+ /** Immutable host config, not candidate data or local aliases, chooses lifecycle. */
54
+ export function leafRoles(config, repository) {
55
+ const held =
56
+ config.tracker === "jira" || config.tracker === "linear"
57
+ ? vendorRoles(config, repository)
58
+ : githubRoles(config, repository);
28
59
  const contract = trackerContract(config);
29
60
  const targetEnvironment = environment(config);
30
61
  const terminal =
@@ -44,14 +75,14 @@ export function leafRoles(config, repository) {
44
75
  const later = contract.lifecycle.roles.filter(
45
76
  label =>
46
77
  label !== contract.lifecycle.ready &&
47
- label !== (build.blocked ?? "status:blocked") &&
78
+ label !== held.blocked &&
48
79
  !terminals.includes(label)
49
80
  );
50
81
  return {
51
82
  ready: contract.lifecycle.ready,
52
83
  claimed: contract.lifecycle.claimed,
53
- blocked: build.blocked ?? "status:blocked",
54
- human: build.human_needed ?? "human-needed",
84
+ blocked: held.blocked,
85
+ human: held.human,
55
86
  terminal,
56
87
  terminals,
57
88
  later,
@@ -67,7 +98,8 @@ export function environment(config) {
67
98
  matches.length <= 1,
68
99
  "main requires one unambiguous configured runtime environment"
69
100
  );
70
- const target = trackerContract(config).deployBranches.get("main");
101
+ // The same map trackerContract exposes for GitHub/Linear; Jira's contract has none.
102
+ const target = deployBranchEnvironments(config).get("main");
71
103
  required(target, "main has no configured runtime environment");
72
104
  return target;
73
105
  }
@@ -135,7 +167,7 @@ Derived from: Target Backend Environment ${env} via .lisa.config.json deploy.bra
135
167
 
136
168
  ## Sign-in Required
137
169
 
138
- GitHub Actions runtime token with explicitly reduced job permissions. Trusted maintainer: ${policy.maintainer}. No maintainer credential is used. Allocation alone may sign. Preparation and gates have no provider write or issuance authority.
170
+ GitHub Actions runtime token with explicitly reduced job permissions. Trusted maintainer: ${policy.maintainer}. No maintainer credential is used. Allocation alone may sign. Preparation and gates have no provider write or issuance authority.${config.tracker === "github" ? "" : ` Tracker writes use the configured ${TRACKER_NAMES[config.tracker]} API credential.`}
139
171
 
140
172
  ## Source Precedence
141
173
 
@@ -146,7 +178,7 @@ Business rules: this exact proposal and ordinary configured policy. Visual: exis
146
178
  Historical filing evidence, preserved from initial allocation. Current relationships and eligibility are checked again before each recovery.
147
179
  Git history command: ${evidence.history.command}
148
180
  Git history outcome: ${evidence.history.result}
149
- All-state GitHub query: ${evidence.search.query}
181
+ All-state ${TRACKER_NAMES[config.tracker]} query: ${evidence.search.query}
150
182
  Outcome: every matching record was loaded completely; unrelated work was preserved and exact proposal recovery was checked separately.
151
183
  Matches are read completely before allocating this deterministic proposal. No parent or PRD lineage is declared; this build-ready standalone Task is one leaf.${evidence.supersession ? `\nSupersedes cancelled proposal ${evidence.supersession.workItem}. Original proposal key: ${evidence.supersession.proposalKey}. Verified cancellation SHA256: ${evidence.supersession.cancellationSha256}. The previous claim, specification and checkpoint are preserved; this leaf has fresh parent-bound authority.` : ""}
152
184
 
@@ -17,6 +17,7 @@ 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
21
 
21
22
  /** Each transition rereads holds, ownership and the actual managed claim. */
22
23
  export async function claimLeaf(
@@ -29,7 +30,8 @@ export async function claimLeaf(
29
30
  evidence,
30
31
  roles
31
32
  ) {
32
- let issue = await api.issue(suppliedIssue.number);
33
+ const tracker = trackerFor(api, policy, config);
34
+ let issue = await tracker.issue(suppliedIssue.number);
33
35
  let state = await inspectLeaf(issue, draft, policy, config);
34
36
  qualityGates(
35
37
  { ...draft, title: issue.title, body: issue.body },
@@ -39,42 +41,22 @@ export async function claimLeaf(
39
41
  evidence
40
42
  );
41
43
  if (state.unassigned) {
42
- await api.assignable(policy.maintainer);
43
- await api.request(
44
- `repos/${policy.repository}/issues/${issue.number}/assignees`,
45
- "POST",
46
- { assignees: [policy.maintainer] }
47
- );
44
+ await tracker.assignable(policy.maintainer);
45
+ await tracker.assign(issue.number, policy.maintainer);
48
46
  }
49
- issue = await api.issue(issue.number);
47
+ issue = await tracker.issue(issue.number);
50
48
  state = await inspectLeaf(issue, draft, policy, config);
51
49
  required(!state.unassigned, "allocation lacks trusted maintainer ownership");
52
- if (!state.claimed) {
53
- const labels = issue.labels
54
- .map(label => label.name)
55
- .filter(name => name !== roles.ready);
56
- labels.push(roles.claimed);
57
- await api.request(
58
- `repos/${policy.repository}/issues/${issue.number}`,
59
- "PATCH",
60
- { labels }
61
- );
62
- }
63
- issue = await api.issue(issue.number);
50
+ if (!state.claimed) await tracker.transition(issue, roles);
51
+ issue = await tracker.issue(issue.number);
64
52
  state = await inspectLeaf(issue, draft, policy, config);
65
- if (!state.claims.length)
66
- await api.request(
67
- `repos/${policy.repository}/issues/${issue.number}/comments`,
68
- "POST",
69
- { body: CLAIM }
70
- );
71
- issue = await api.issue(issue.number);
53
+ if (!state.claims.length) await tracker.comment(issue.number, CLAIM);
54
+ issue = await tracker.issue(issue.number);
72
55
  state = await inspectLeaf(issue, draft, policy, config);
73
56
  required(
74
57
  state.claimed &&
75
58
  state.claims.length === 1 &&
76
- String(state.claims[0].user?.id) === api.policy.claimActorId &&
77
- state.claims[0].user?.type === "Bot",
59
+ (await tracker.isManagedActor(state.claims[0].user)),
78
60
  "actual managed claim identity differs"
79
61
  );
80
62
  return { issue, state };
@@ -122,8 +104,14 @@ async function inspectLeafFields(issue, draft, policy, config) {
122
104
  const hold = (await canonicalClassifier(config))({
123
105
  body: issue.body,
124
106
  labels,
125
- comments: issue.comments,
126
- trustedHumanActorIds: config.github.trustedHumanActorIds ?? [],
107
+ // Jira/Linear comments carry a classifier-only `prose` projection that keeps
108
+ // code boundaries; `body` stays the lossless managed-record form.
109
+ comments: issue.comments.map(comment =>
110
+ typeof comment.prose === "string"
111
+ ? { ...comment, body: comment.prose }
112
+ : comment
113
+ ),
114
+ trustedHumanActorIds: trustedHumanActorIds(config),
127
115
  humanNeededLabel: roles.human,
128
116
  });
129
117
  required(!hold.held, "current human hold is outstanding");
@@ -195,17 +183,17 @@ export async function authorizeAllocation(
195
183
  policy,
196
184
  config
197
185
  ) {
186
+ const tracker = trackerFor(api, policy, config);
198
187
  await api.main(proposal.parent);
199
- await api.assignable(policy.maintainer);
200
- const issue = await api.issue(allocation.number);
188
+ await tracker.assignable(policy.maintainer);
189
+ const issue = await tracker.issue(allocation.number);
201
190
  const state = await inspectLeaf(issue, allocation.draft, policy, config);
202
191
  required(
203
192
  state.claimed &&
204
193
  !state.unassigned &&
205
194
  state.claims.length === 1 &&
206
195
  String(state.claims[0].id) === allocation.claimCommentId &&
207
- String(state.claims[0].user?.id) === api.policy.claimActorId &&
208
- state.claims[0].user?.type === "Bot" &&
196
+ (await tracker.isManagedActor(state.claims[0].user)) &&
209
197
  sha256(state.claims[0].body) === allocation.claimSha256,
210
198
  "current proposal claim differs"
211
199
  );