omp-conductor 0.19.5 → 0.19.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/REFERENCE.md CHANGED
@@ -848,6 +848,22 @@ the queue label is refused with `file-lane-unparseable` and an actionable
848
848
  message, because promoting beside overlapping work on a section that plainly
849
849
  tried to declare is the exact gap the interlock exists to close.
850
850
 
851
+ Since #1036, a promotion also checks a contract. When the issue carries a
852
+ durable `promotable` grooming verdict (the store's grooming row, written by
853
+ the to-spec batch), adding the queue label first recovers that verdict's strict
854
+ payload and requires its `PROMOTABLE` result, then compares the lane admission
855
+ would enforce against the verdict's `fileLane` as deduplicated,
856
+ order-independent path sets — exact in both directions, so a missing path
857
+ refuses exactly like an extra one, and an order-only difference promotes. Any
858
+ disagreement refuses with `promotion-brief-mismatch`, naming both sets; so
859
+ does evidence behind a `promotable` row that does not recover as a strict
860
+ PROMOTABLE result, and an issue unreadable at promotion time behind such a
861
+ row. The durable verdict is what made the issue dispatchable, so the gate
862
+ fails closed before any tracker mutation or daemon wake — but it never edits
863
+ the issue itself: the remediation is applying the verdict's `proposedBrief`
864
+ to the issue (its `## Exact write lane` included), then adding the label
865
+ again. An issue without a `promotable` row promotes exactly as before.
866
+
851
867
  #### What status shows
852
868
 
853
869
  `status` renders the two lifecycle kinds as two blocks, because "a branch is
@@ -3099,7 +3115,7 @@ daemon, across a process boundary, not in a prompt the model can rewrite.
3099
3115
  | `conductor_pr_status` | worker or orchestrator | Read-only — nothing to gate. A worker reads only its own run's PR; an orchestrator may name any syntactically valid PR URL, open, merged, or closed, and gets its live state and head (checks are reported when available; a merged or closed PR reports its state instead of an `expected OPEN` refusal). |
3100
3116
  | `conductor_pr_update_branch` | orchestrator, or the worker owning the run | The PR belongs to this project and is open. A worker may only name its own run's PR. |
3101
3117
  | `conductor_pr_merge` | **orchestrator only** | Ordinarily, `authority.merge` equals the caller. A hand-edited `recoveryMerges` entry may instead authorize one exact unrecorded PR/head/reason while held. In both paths, while the project has an [active release composition](#the-active-release-composition-850), the PR must be named in it or carry an explicit operator override; then `headSha` equals the live head *at execution time*; checks are green at that same SHA; no [review evidence](#the-exact-head-review-gate-888) stands at that head without a recorded `conductor_pr_review_clear`; the project route and migration chain are valid; the project's single merge slot is free. |
3102
- | `conductor_label` | **orchestrator only** | The label is in the project's own vocabulary. Lifecycle labels stay the daemon's. Adding the queue label echoes the parsed [file lane](#the-file-lane-declaration), or refuses with `file-lane-unparseable` when a clearly delimited write-lane section parsed nothing — it never claims fail-open beside a declaration that was actually attempted. |
3118
+ | `conductor_label` | **orchestrator only** | The label is in the project's own vocabulary. Lifecycle labels stay the daemon's. Adding the queue label echoes the parsed [file lane](#the-file-lane-declaration), or refuses with `file-lane-unparseable` when a clearly delimited write-lane section parsed nothing — it never claims fail-open beside a declaration that was actually attempted. When the issue carries a durable `promotable` grooming verdict, adding the queue label also verifies the current brief against that verdict before any mutation: a brief that disagrees with the verdict's `fileLane` (or evidence that no longer recovers as a strict PROMOTABLE result) refuses with `promotion-brief-mismatch` — apply the verdict's `proposedBrief`, then re-add ([the file-lane declaration](#the-file-lane-declaration)). |
3103
3119
  | `conductor_release` | **orchestrator only** | `authority.release` equals the caller; the per-shape grant permits it; the artefact or environment was declared; the release preconditions hold; the `reason` is in the closed enum. `version-bump-pr` creates or re-validates one deterministic version-only PR and, on a later call, merges only its exact green head through the project's single merge slot. |
3104
3120
  | `conductor_install` | **orchestrator only** | Gated like a release act: the `install` shape defaults to `human` and a grant is what moves it. The daemon refuses a version npm does not expose with a full `gitHead`, refuses while another install is still in flight, and otherwise starts a detached transient unit that pauses, drains, installs the CLI/omp plugin/Herdr plugin and reloads — outside this session and the daemon. The unit never declares its own success; the first tick after the restart verifies and reports through the durable outbox. |
3105
3121
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omp-conductor",
3
- "version": "0.19.5",
3
+ "version": "0.19.7",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "A 24/7 dispatcher that takes ready GitHub issues to green, mergeable PRs using omp coding sessions, with tiered escalation first to an orchestrator session and then to a human.",
package/src/cli.ts CHANGED
@@ -32,6 +32,7 @@ import { reportCommand } from "./commands/report.ts";
32
32
  import { releaseCompositionCommand } from "./commands/release-composition.ts";
33
33
  import { restartCommand } from "./commands/restart.ts";
34
34
  import { restoreDbCommand } from "./commands/restore-db.ts";
35
+ import { snapshotDbCommand } from "./commands/snapshot-db.ts";
35
36
  import { resumeCommand } from "./commands/resume.ts";
36
37
  import { setupCommand } from "./commands/setup.ts";
37
38
  import { startCommand } from "./commands/start.ts";
@@ -300,6 +301,7 @@ export function commandHandlers(ctx: CommandContext): Record<string, CommandHand
300
301
  intake: () => intakeCommand(ctx),
301
302
  friction: () => frictionCommand(ctx),
302
303
  "restore-db": () => restoreDbCommand(ctx),
304
+ "snapshot-db": () => snapshotDbCommand(ctx),
303
305
  resume: () => resumeCommand(ctx),
304
306
  "brief-upgrade": () => briefUpgradeCommand(ctx),
305
307
  help: () => helpCommand(USAGE),
@@ -6,10 +6,11 @@ export const COMMAND_DETAILS = ` setup interview, then write config.json, th
6
6
  the project already exists, a chooser of which area to amend. Naming
7
7
  an area positionally skips that chooser and amends only that area:
8
8
  ${AMEND_AREA_IDS.join(", ")}.
9
- upgrade update the Bun-global CLI, omp plugin, Herdr recovery plugin, and
10
- brief as one pinned release. Pauses only new claims, drains live
11
- workers, reloads, verifies twice, and restores the prior dispatch
12
- state. Run it from a shell outside the target Herdr session.
9
+ upgrade discover the installed CLI package root, then update it with the omp
10
+ plugin, Herdr recovery plugin, and brief as one pinned release.
11
+ Pauses only new claims, drains live workers, reloads, verifies twice,
12
+ and restores the prior dispatch state. Run it from a shell outside
13
+ the target Herdr session.
13
14
  --bootstrap SHA --source PATH installs an exact commit instead of a
14
15
  published version, for when the installed conductor is what is
15
16
  broken: the source must be a checkout AT that sha, the package's own
@@ -66,6 +67,10 @@ export const COMMAND_DETAILS = ` setup interview, then write config.json, th
66
67
  --probe-telegram sends through the report transport. Exit code 0
67
68
  only when nothing failed; --json prints the stable CI shape. Run
68
69
  it after install and after every upgrade.
70
+ snapshot-db
71
+ publish a transaction-consistent conductor.db snapshot with SQLite
72
+ VACUUM INTO, record it in the durable event ledger, and apply the
73
+ daemon cadence's bounded retention. Safe while the daemon writes.
69
74
  restore-db
70
75
  put conductor.db back to a restorable snapshot, replacing the live
71
76
  file and dropping stale -wal/-shm sidecars. Refuses while a daemon
@@ -153,6 +158,9 @@ export const COMMAND_DETAILS = ` setup interview, then write config.json, th
153
158
  sending now and holding, exactly as for a daemon escalation. An
154
159
  identical retry is refused only while the earlier handoff is still
155
160
  undelivered, and admitted again once it lands (#453).
161
+ report withdraw removes only an unsent pending report or unassigned
162
+ held notice, requires a reason, preserves an audit row, and refuses
163
+ sending/delivered/failed/already-withdrawn handoffs.
156
164
  message deliver one direct Telegram message to this project's own chat and
157
165
  forum topic, resolved from config rather than from whichever chat
158
166
  last wrote to the session. This is how a locally injected tick
@@ -180,10 +188,12 @@ export const COMMAND_DETAILS = ` setup interview, then write config.json, th
180
188
  watch set a condition or carry note for the orchestrator itself, with no
181
189
  human in the loop — the same no-sleep surface \`decision open
182
190
  --resolves-when\` used to serve, given its own verb so it never renders
183
- as a question put to the operator. \`--resolves-when\` attaches a
184
- condition the daemon checks for you; a met watch wakes the next tick
185
- with its note, exactly as a met question does, but it is listed under
186
- its own heading and never under "Open operator decisions", and it has
191
+ as a question put to the operator. The running daemon checks a
192
+ \`--resolves-when\` condition; an armed or ungated heartbeat wakes the
193
+ orchestrator tick when one is met. With no daemon the durable row is
194
+ unmonitored. With ticks disarmed the condition may still be marked met,
195
+ but no tick can be woken until the heartbeat returns. It is listed
196
+ under its own heading, never under "Open operator decisions", and has
187
197
  no seven-day expiry. \`watch list\` shows open watches; \`watch
188
198
  withdraw <id>\` ends one with a recorded reason — the verb that
189
199
  creates a watch is the verb that ends it (watches are decision rows,
@@ -202,6 +202,17 @@ export const COMMAND_MANIFEST: readonly CommandManifestEntry[] = [
202
202
  toggle("--probe-telegram", "send the self-identified Telegram health probe"),
203
203
  ],
204
204
  },
205
+ {
206
+ name: "snapshot-db",
207
+ description: "publish a transaction-consistent conductor.db snapshot",
208
+ scope: "host",
209
+ usage: ["snapshot-db"],
210
+ flags: [],
211
+ details:
212
+ "Publish one transaction-consistent conductor.db snapshot using SQLite VACUUM INTO, " +
213
+ "record the action in every configured project's durable event ledger, and apply the " +
214
+ "daemon cadence's bounded retention. Safe while the daemon is writing.",
215
+ },
205
216
  {
206
217
  name: "restore-db",
207
218
  description: "restore conductor.db from a safe snapshot",
@@ -403,14 +414,18 @@ export const COMMAND_MANIFEST: readonly CommandManifestEntry[] = [
403
414
  scope: "project",
404
415
  usage: [
405
416
  "report --text TEXT [--kind material|digest|tier2|decision-needed|fleet-stopped|confirmed-failure] [--events IDS] [--notices IDS] [--project NAME]",
417
+ "report withdraw <id> --reason TEXT [--project NAME]",
406
418
  ],
419
+ subcommands: [{ name: "withdraw", description: "withdraw an unsent report or held notice" }],
407
420
  flags: [
408
421
  value("--text", "rendered report text"),
409
422
  value("--kind", "material, digest, or escalation category"),
410
423
  value("--events", "comma-separated event ledger ids"),
411
424
  value("--notices", "comma-separated notice ledger ids"),
425
+ value("--reason", "why a pending handoff is obsolete"),
412
426
  project(),
413
427
  ],
428
+ positionals: [{ name: "action" }, { name: "id" }],
414
429
  },
415
430
  {
416
431
  name: "message",
@@ -460,11 +475,13 @@ export const COMMAND_MANIFEST: readonly CommandManifestEntry[] = [
460
475
  "watch list [--project NAME] [--json]",
461
476
  "watch withdraw <id> [--reason TEXT] [--project NAME]",
462
477
  ],
463
- details: `add records a row the daemon checks for you and the next tick reads, with no
464
- operator answer needed. list shows open watches, oldest first. withdraw ends
465
- one with a recorded reason the verb that creates a watch is the verb that
466
- ends it. A watch whose PR condition can no longer be observed (the PR merged
467
- or closed first) is withdrawn by the daemon itself.`,
478
+ details: `add records a durable row with no operator answer needed. The running daemon
479
+ checks conditions; an armed or ungated heartbeat wakes the orchestrator tick when one is met.
480
+ With no daemon the row is unmonitored. With ticks disarmed the daemon may still mark a
481
+ condition met, but no tick can be woken until the heartbeat returns. list shows open watches,
482
+ oldest first. withdraw ends one with a recorded reason — the verb that creates a watch is the
483
+ verb that ends it. A watch whose PR condition can no longer be observed (the PR merged or
484
+ closed first) is withdrawn by the daemon itself.`,
468
485
  subcommands: [
469
486
  { name: "add", description: "record a watch" },
470
487
  { name: "list", description: "list open watches" },
@@ -104,6 +104,7 @@ export const COMMAND_SCOPES: Readonly<Record<string, CommandScope>> = {
104
104
  daemon: "host",
105
105
  restart: "host",
106
106
  "restore-db": "host",
107
+ "snapshot-db": "host",
107
108
  start: "host",
108
109
  upgrade: "host",
109
110
  "upgrade-install": "host",
@@ -22,7 +22,70 @@ import {
22
22
  type ReportKind,
23
23
  } from "../types.ts";
24
24
 
25
+ async function withdrawHandoff(ctx: CommandContext): Promise<void> {
26
+ const id = ctx.argv[2];
27
+ const reason = ctx.flag("reason")?.trim();
28
+ if (id === undefined || id.startsWith("--")) {
29
+ process.stderr.write("omp-conductor: report withdraw needs the report or held-notice id\n");
30
+ process.exit(2);
31
+ }
32
+ if (reason === undefined || reason.length === 0 || reason.startsWith("--")) {
33
+ process.stderr.write("omp-conductor: report withdraw needs --reason with why the handoff is obsolete\n");
34
+ process.exit(2);
35
+ }
36
+ for (let i = 3; i < ctx.argv.length; i++) {
37
+ const token = ctx.argv[i];
38
+ if (token === "--project" || token === "--reason") {
39
+ i += 1;
40
+ continue;
41
+ }
42
+ if (token?.startsWith("--project=") || token?.startsWith("--reason=")) continue;
43
+ process.stderr.write(`omp-conductor: report withdraw: unexpected argument "${token ?? ""}"\n`);
44
+ process.exit(2);
45
+ }
46
+ const sessionRole = process.env[SESSION_ROLE_ENV];
47
+ if (sessionRole === "worker") {
48
+ process.stderr.write("omp-conductor: report withdraw is an operator/orchestrator action, not a worker action\n");
49
+ process.exit(3);
50
+ }
51
+ const project = findProject(loadConfig(), ctx.projectFlag);
52
+ const inHerdrPane =
53
+ process.env["HERDR_ENV"] !== undefined && process.env["HERDR_ENV"] !== "";
54
+ const actor = sessionRole ?? (inHerdrPane ? "orchestrator" : "operator");
55
+ const store = openStore(dbPath());
56
+ try {
57
+ const result = store.withdrawHandoff(
58
+ id,
59
+ project.name,
60
+ actor,
61
+ reason,
62
+ Date.now(),
63
+ );
64
+ if (result.kind === "not-found") {
65
+ process.stderr.write(`omp-conductor: no report or held notice ${id} for ${project.name}\n`);
66
+ process.exit(1);
67
+ }
68
+ if (result.kind === "refused") {
69
+ process.stderr.write(
70
+ `omp-conductor: cannot withdraw ${result.target} ${id}: state is ${result.state}; ` +
71
+ "only an unsent pending report or unassigned held notice may be withdrawn\n",
72
+ );
73
+ process.exit(1);
74
+ }
75
+ process.stdout.write(
76
+ `${result.withdrawal.target} ${id} withdrawn for ${project.name} — ${reason}\n`,
77
+ );
78
+ } finally {
79
+ store.close();
80
+ }
81
+ }
82
+
83
+
25
84
  export async function reportCommand(ctx: CommandContext): Promise<void> {
85
+ if (ctx.argv[1] === "withdraw") {
86
+ await withdrawHandoff(ctx);
87
+ return;
88
+ }
26
89
  const rawText = ctx.flag("text");
27
90
  const body = rawText?.trim();
28
91
  if (body === undefined || body.length === 0 || rawText?.startsWith("--") === true) {
@@ -128,7 +128,7 @@ export async function restoreDbCommand(ctx: CommandContext): Promise<void> {
128
128
  const snapshot = requested === undefined ? newestSnapshot(snapDir) : resolve(requested);
129
129
  if (snapshot === undefined) {
130
130
  throw new Error(
131
- `no conductor.db snapshot in ${snapDir} — take one (the snapshot primitive) or pass an explicit snapshot path`,
131
+ `no conductor.db snapshot in ${snapDir} — run \`omp-conductor snapshot-db\` or pass an explicit snapshot path`,
132
132
  );
133
133
  }
134
134
  if (!existsSync(snapshot)) {
@@ -0,0 +1,67 @@
1
+ /** `snapshot-db` — publish one transaction-consistent conductor.db snapshot. */
2
+
3
+ import type { CommandContext } from "./context.ts";
4
+ import { dbBackupDirFor, loadConfig } from "../config.ts";
5
+ import type { Store } from "../types.ts";
6
+ import {
7
+ DB_SNAPSHOT_RETENTION,
8
+ dbPath,
9
+ openStore,
10
+ pruneDbSnapshots,
11
+ snapshotDb,
12
+ } from "../store.ts";
13
+
14
+ export async function snapshotDbCommand(ctx: CommandContext): Promise<void> {
15
+ if (ctx.projectFlag !== undefined) {
16
+ process.stderr.write("omp-conductor: snapshot-db does not take a project — the store is host-wide\n");
17
+ process.exit(2);
18
+ }
19
+ if (ctx.argv.length > 1) {
20
+ process.stderr.write(`omp-conductor: snapshot-db: unexpected argument "${ctx.argv[1]}"\n`);
21
+ process.exit(2);
22
+ }
23
+
24
+ const cfg = loadConfig();
25
+ const directory = dbBackupDirFor(cfg);
26
+ const published = snapshotDb(dbPath(), directory);
27
+ // Publication is already durable. Print its path before secondary accounting
28
+ // so a ledger/prune failure cannot turn success into an invisible file.
29
+ process.stdout.write(`snapshot published: ${published}\n`);
30
+
31
+ let store: Store | undefined;
32
+ try {
33
+ const opened = openStore(dbPath());
34
+ store = opened;
35
+ const now = Date.now();
36
+ const eventIds = cfg.projects.map((project) =>
37
+ opened.recordMaterialEvent({
38
+ project: project.name,
39
+ category: "db-snapshot",
40
+ summary: "published manual conductor.db snapshot",
41
+ evidence: published,
42
+ occurredAt: now,
43
+ recordedAt: now,
44
+ }).id,
45
+ );
46
+ process.stdout.write(`ledger events recorded: ${eventIds.join(", ")}\n`);
47
+ } catch (err) {
48
+ process.stderr.write(
49
+ `warning: snapshot published, but its ledger event could not be recorded: ${
50
+ err instanceof Error ? err.message : String(err)
51
+ }\n`,
52
+ );
53
+ } finally {
54
+ store?.close();
55
+ }
56
+
57
+ try {
58
+ const pruned = pruneDbSnapshots(directory, DB_SNAPSHOT_RETENTION);
59
+ process.stdout.write(`retention ${DB_SNAPSHOT_RETENTION} (${pruned} pruned)\n`);
60
+ } catch (err) {
61
+ process.stderr.write(
62
+ `warning: snapshot published, but retention pruning failed: ${
63
+ err instanceof Error ? err.message : String(err)
64
+ }\n`,
65
+ );
66
+ }
67
+ }
@@ -22,7 +22,7 @@ const result = await runDetachedUpgrade({
22
22
  });
23
23
  process.stdout.write(
24
24
  `install complete — awaiting first-tick verification:\n` +
25
- ` Bun-global CLI omp-conductor@${result.version}\n` +
25
+ ` omp-conductor CLI omp-conductor@${result.version}\n` +
26
26
  ` omp plugin omp-conductor@${result.version}\n` +
27
27
  ` Herdr plugin herdr-conductor@${result.gitHead}\n` +
28
28
  ` orchestrator brief managed ORCHESTRATOR.md floor current; POLICY.md preserved\n` +
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `upgrade` — update the Bun-global CLI, omp plugin, Herdr recovery plugin and brief as one pinned release.
2
+ * `upgrade` — update the discovered CLI package, omp plugin, Herdr recovery plugin and brief as one pinned release.
3
3
  *
4
4
  * Moved out of cli.ts's switch by the per-verb module split (#462);
5
5
  * only the case wrapper, the injected `ctx` lookups and the imports
@@ -33,7 +33,7 @@ const result = await upgradeConductor({
33
33
  const spec = sha === undefined ? `omp-conductor@${result.version}` : `${result.version} @ ${result.gitHead.slice(0, 12)}`;
34
34
  process.stdout.write(
35
35
  `${result.alreadyCurrent ? "already current" : sha === undefined ? "upgrade complete" : "bootstrap complete"}:\n` +
36
- ` Bun-global CLI ${spec}\n` +
36
+ ` omp-conductor CLI ${spec}\n` +
37
37
  ` omp plugin ${spec}\n` +
38
38
  ` Herdr plugin herdr-conductor@${result.gitHead}\n` +
39
39
  ` orchestrator brief managed ORCHESTRATOR.md floor current; POLICY.md preserved\n` +
@@ -59,6 +59,7 @@ try {
59
59
  const reply = await handleVerbCall(
60
60
  {
61
61
  project: () => findProject(loadConfig(), project.name),
62
+ projects: () => loadConfig().projects,
62
63
  store,
63
64
  tracker: makeTracker(project),
64
65
  actions: githubVerbActions(project),
@@ -21,6 +21,7 @@
21
21
  import type { CommandContext } from "./context.ts";
22
22
  import { findProject, loadConfig } from "../config.ts";
23
23
  import { CONDITION_FORMS, parseCondition } from "../decisions.ts";
24
+ import { watchMonitoringForProject } from "../fleet.ts";
24
25
  import { shellQuote } from "../shell.ts";
25
26
  import { dbPath, openStore } from "../store.ts";
26
27
 
@@ -94,7 +95,12 @@ export async function watchCommand(ctx: CommandContext): Promise<void> {
94
95
  ...(condition === undefined ? {} : { condition }),
95
96
  at: Date.now(),
96
97
  });
97
- const wake = condition === undefined ? "read by the next tick" : "the daemon wakes the next tick when it is met";
98
+ const monitoring = watchMonitoringForProject(project.name);
99
+ const wake = monitoring.monitored
100
+ ? condition === undefined
101
+ ? "read by the next tick"
102
+ : "the daemon checks it and wakes the next available tick when it is met"
103
+ : `durable but currently unmonitored (${monitoring.reason}); it becomes wake-capable automatically when the daemon and heartbeat are active`;
98
104
  // The verb that ends the row names the project it was created in: this
99
105
  // command is copied, and on a host with several projects the bare form is
100
106
  // ambiguous (#810).
@@ -107,6 +113,7 @@ export async function watchCommand(ctx: CommandContext): Promise<void> {
107
113
  if (sub === "list" || sub === undefined) {
108
114
  assertKnownWatchArgs(ctx, "list", 2);
109
115
  const open = store.openDecisions(project.name).filter((d) => d.kind === "watch");
116
+ const monitoring = watchMonitoringForProject(project.name);
110
117
  const now = Date.now();
111
118
  const watches = open.map((d) => ({
112
119
  id: d.id,
@@ -116,13 +123,18 @@ export async function watchCommand(ctx: CommandContext): Promise<void> {
116
123
  note: d.question,
117
124
  }));
118
125
  if (ctx.argv.includes("--json")) {
119
- process.stdout.write(`${JSON.stringify({ project: project.name, watches }, null, 2)}\n`);
126
+ process.stdout.write(`${JSON.stringify({ project: project.name, monitoring, watches }, null, 2)}\n`);
120
127
  return;
121
128
  }
122
129
  if (watches.length === 0) {
123
130
  process.stdout.write("no watches\n");
124
131
  return;
125
132
  }
133
+ process.stdout.write(
134
+ monitoring.monitored
135
+ ? "watch monitoring: active\n"
136
+ : `watch monitoring: durable, unmonitored (${monitoring.reason})\n`,
137
+ );
126
138
  for (const watch of watches) {
127
139
  process.stdout.write(
128
140
  `${watch.id} ${watch.ageHours}h blocks:${watch.blocks ?? "-"} ` +
package/src/config.ts CHANGED
@@ -320,6 +320,23 @@ export function resolveReleaseGrants(p: ProjectConfig): ResolvedGrants {
320
320
  return grants;
321
321
  }
322
322
 
323
+ /** The one install holder shared by every project on this host, or the
324
+ * per-project evidence explaining why no shared holder exists (#1018). */
325
+ export function resolveSharedInstallAuthority(projects: readonly ProjectConfig[]): {
326
+ holder?: ResolvedGrants["install"];
327
+ entries: readonly { project: string; holder: ResolvedGrants["install"] }[];
328
+ } {
329
+ const entries = projects.map((project) => ({
330
+ project: project.name,
331
+ holder: resolveReleaseGrants(project).install,
332
+ }));
333
+ const holders = new Set(entries.map((entry) => entry.holder));
334
+ return {
335
+ ...(holders.size === 1 ? { holder: entries[0]!.holder } : {}),
336
+ entries,
337
+ };
338
+ }
339
+
323
340
  /**
324
341
  * The gating conditions for one project, complete (#129).
325
342
  *