@substrat-run/kernel 0.221.0 → 0.223.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 (86) hide show
  1. package/dist/app-environments.d.ts +123 -4
  2. package/dist/app-environments.d.ts.map +1 -1
  3. package/dist/app-environments.js +212 -6
  4. package/dist/app-environments.js.map +1 -1
  5. package/dist/broker-counts.d.ts +8 -30
  6. package/dist/broker-counts.d.ts.map +1 -1
  7. package/dist/broker-counts.js +41 -6
  8. package/dist/broker-counts.js.map +1 -1
  9. package/dist/broker-shadow.d.ts +3 -0
  10. package/dist/broker-shadow.d.ts.map +1 -1
  11. package/dist/broker-shadow.js +1 -0
  12. package/dist/broker-shadow.js.map +1 -1
  13. package/dist/broker-telemetry.d.ts +11 -0
  14. package/dist/broker-telemetry.d.ts.map +1 -1
  15. package/dist/broker-telemetry.js +5 -0
  16. package/dist/broker-telemetry.js.map +1 -1
  17. package/dist/carried-copy.d.ts.map +1 -1
  18. package/dist/carried-copy.js +3 -1
  19. package/dist/carried-copy.js.map +1 -1
  20. package/dist/credential-bound-fetch.d.ts +73 -0
  21. package/dist/credential-bound-fetch.d.ts.map +1 -0
  22. package/dist/credential-bound-fetch.js +241 -0
  23. package/dist/credential-bound-fetch.js.map +1 -0
  24. package/dist/delivery-broker.d.ts +24 -5
  25. package/dist/delivery-broker.d.ts.map +1 -1
  26. package/dist/delivery-broker.js +30 -7
  27. package/dist/delivery-broker.js.map +1 -1
  28. package/dist/delivery-contract.d.ts +47 -3
  29. package/dist/delivery-contract.d.ts.map +1 -1
  30. package/dist/delivery-contract.js +101 -1
  31. package/dist/delivery-contract.js.map +1 -1
  32. package/dist/dependent-erasure.d.ts +106 -0
  33. package/dist/dependent-erasure.d.ts.map +1 -0
  34. package/dist/dependent-erasure.js +150 -0
  35. package/dist/dependent-erasure.js.map +1 -0
  36. package/dist/directory-lake-keep.d.ts.map +1 -1
  37. package/dist/directory-lake-keep.js +7 -1
  38. package/dist/directory-lake-keep.js.map +1 -1
  39. package/dist/home-scope.d.ts +104 -0
  40. package/dist/home-scope.d.ts.map +1 -0
  41. package/dist/home-scope.js +127 -0
  42. package/dist/home-scope.js.map +1 -0
  43. package/dist/index.d.ts +15 -8
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +15 -7
  46. package/dist/index.js.map +1 -1
  47. package/dist/membership-executor.d.ts +5 -2
  48. package/dist/membership-executor.d.ts.map +1 -1
  49. package/dist/membership-executor.js +5 -1
  50. package/dist/membership-executor.js.map +1 -1
  51. package/dist/module-operations.d.ts +9 -0
  52. package/dist/module-operations.d.ts.map +1 -1
  53. package/dist/module-operations.js +22 -0
  54. package/dist/module-operations.js.map +1 -1
  55. package/dist/owned-reaps.d.ts +73 -0
  56. package/dist/owned-reaps.d.ts.map +1 -0
  57. package/dist/owned-reaps.js +71 -0
  58. package/dist/owned-reaps.js.map +1 -0
  59. package/dist/platform-sweep.d.ts +14 -1
  60. package/dist/platform-sweep.d.ts.map +1 -1
  61. package/dist/platform-sweep.js +117 -59
  62. package/dist/platform-sweep.js.map +1 -1
  63. package/dist/relay-intents.d.ts +38 -0
  64. package/dist/relay-intents.d.ts.map +1 -0
  65. package/dist/relay-intents.js +45 -0
  66. package/dist/relay-intents.js.map +1 -0
  67. package/dist/release-within-major.d.ts +54 -2
  68. package/dist/release-within-major.d.ts.map +1 -1
  69. package/dist/release-within-major.js +80 -6
  70. package/dist/release-within-major.js.map +1 -1
  71. package/dist/scope-copy-ledger.d.ts +5 -0
  72. package/dist/scope-copy-ledger.d.ts.map +1 -1
  73. package/dist/scope-copy-ledger.js +8 -0
  74. package/dist/scope-copy-ledger.js.map +1 -1
  75. package/dist/scope-host.d.ts +142 -6
  76. package/dist/scope-host.d.ts.map +1 -1
  77. package/dist/scope-host.js.map +1 -1
  78. package/dist/scope-types.d.ts +15 -0
  79. package/dist/scope-types.d.ts.map +1 -1
  80. package/dist/scope-types.js +19 -0
  81. package/dist/scope-types.js.map +1 -1
  82. package/dist/sealed-box.d.ts +12 -0
  83. package/dist/sealed-box.d.ts.map +1 -1
  84. package/dist/sealed-box.js +15 -0
  85. package/dist/sealed-box.js.map +1 -1
  86. package/package.json +2 -2
@@ -34,8 +34,11 @@
34
34
  * - **A release into an earlier major** (a head whose major is lower than the base's) is refused
35
35
  * with {@link EARLIER_MAJOR_RELEASE_REASON}. The channel names the newest major, so such a
36
36
  * promote would put older code on the newest major's script, under installs whose data has
37
- * moved past it. K-65 lets an earlier major take additive releases on its own script; that
38
- * door is not built yet, and until it is, an earlier major keeps serving what it serves.
37
+ * moved past it. K-65 lets an earlier major take additive releases on its own script, and that
38
+ * release names the major it goes to (`earlierMajor`, {@link earlierMajorReleaseTarget}): it
39
+ * never moves the channel, and is ranked against the version that major's script runs, by these
40
+ * same rules. A promote that names no major is refused rather than read as one, so rolling a new
41
+ * major back to the previous one never turns into a release into it.
39
42
  * - **A rollback** is a promote like any other: an older version over the current one, ranked by
40
43
  * the same rules. Rolling back what a release added removes it from the installs that already
41
44
  * use it, which ranks major, and is refused within the major.
@@ -160,6 +163,55 @@ export declare function supersededMajorsJson(input: {
160
163
  readonly nextRef: string;
161
164
  readonly supersede: SupersedeMajor;
162
165
  }): string;
166
+ /**
167
+ * The earlier major a release that names `major` goes to (K-65, #3539): the entry of
168
+ * `verticals.earlier_majors` it is served from, whose version every gate of the promote is judged
169
+ * against in place of the channel's. Refused (`conflict`, {@link EARLIER_MAJOR_RELEASE_REASON}),
170
+ * before anything is ranked or moves:
171
+ *
172
+ * - **where it cannot be served** on that major's script: a caller that does not serve in place
173
+ * (`servesMajors`), or a version with no archive script to serve from;
174
+ * - **a major that is not an earlier one still served**: the newest major is released by a promote
175
+ * that names none, and a major the app never had, or no longer serves, has no script to go to;
176
+ * - **a version in another major**, or one whose label is not semver: the label is the major.
177
+ *
178
+ * Nothing is judged at the major's end date, which K-65 does not decide: a release before or after
179
+ * it is admitted alike.
180
+ */
181
+ export declare function earlierMajorReleaseTarget(input: {
182
+ readonly vertical: string;
183
+ readonly earlierJson: string | null | undefined;
184
+ readonly major: number;
185
+ readonly head: {
186
+ readonly version: string;
187
+ readonly deploymentRef: string | null;
188
+ };
189
+ readonly servesMajors?: boolean;
190
+ }): EarlierMajor;
191
+ /**
192
+ * The `earlier_majors` column once a release into an earlier major has been served on its script
193
+ * (K-65, #3539): the entry for `major` names `next`'s version, class set and migration tag; its
194
+ * script, its supersede and its end are kept, and every other entry is untouched. Shared by both
195
+ * adapters, inside the unit that writes the row. A compare-and-set: refused (`precondition_failed`)
196
+ * when no entry is numbered `major`, when it runs another version, class set or tag than `expected`
197
+ * (the base the upload diffed its migration from), or when `next` names another script.
198
+ */
199
+ export declare function releasedEarlierMajorJson(input: {
200
+ readonly vertical: string;
201
+ readonly earlierJson: string | null | undefined;
202
+ readonly major: number;
203
+ readonly expected: {
204
+ readonly versionId: string;
205
+ readonly doClasses: readonly string[];
206
+ readonly migrationTag: string;
207
+ };
208
+ readonly next: {
209
+ readonly ref: string;
210
+ readonly versionId: string;
211
+ readonly doClasses: readonly string[];
212
+ readonly migrationTag: string;
213
+ };
214
+ }): string;
163
215
  /**
164
216
  * SQL for the version a scope's SERVING SCRIPT runs (K-65, #3539 part 2), over a scope row `s`
165
217
  * joined to its vertical `vr`: the earlier major's version when `s.serving_ref` is one of
@@ -1 +1 @@
1
- {"version":3,"file":"release-within-major.d.ts","sourceRoot":"","sources":["../src/release-within-major.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,OAAO,EAAoF,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAErK,wGAAwG;AACxG,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,E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AE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IACxH,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3I,GAAG,MAAM,CAgBT;AAED;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,QAE2C,CAAC;AAEnF,oGAAoG;AACpG,eAAO,MAAM,oBAAoB,iHAC+E,CAAC"}
@@ -34,8 +34,11 @@
34
34
  * - **A release into an earlier major** (a head whose major is lower than the base's) is refused
35
35
  * with {@link EARLIER_MAJOR_RELEASE_REASON}. The channel names the newest major, so such a
36
36
  * promote would put older code on the newest major's script, under installs whose data has
37
- * moved past it. K-65 lets an earlier major take additive releases on its own script; that
38
- * door is not built yet, and until it is, an earlier major keeps serving what it serves.
37
+ * moved past it. K-65 lets an earlier major take additive releases on its own script, and that
38
+ * release names the major it goes to (`earlierMajor`, {@link earlierMajorReleaseTarget}): it
39
+ * never moves the channel, and is ranked against the version that major's script runs, by these
40
+ * same rules. A promote that names no major is refused rather than read as one, so rolling a new
41
+ * major back to the previous one never turns into a release into it.
39
42
  * - **A rollback** is a promote like any other: an older version over the current one, ranked by
40
43
  * the same rules. Rolling back what a release added removes it from the installs that already
41
44
  * use it, which ranks major, and is refused within the major.
@@ -66,8 +69,11 @@ const NEW_MAJOR_UNSERVED = 'a new major of a listed app is not released until ea
66
69
  * door is not built yet.
67
70
  */
68
71
  export const EARLIER_MAJOR_RELEASE_REASON = 'earlier_major_release';
69
- /** The words only the earlier-major refusal carries, as {@link NEW_MAJOR_UNSERVED} is for its own. */
70
- const EARLIER_MAJOR_RELEASE = 'a release into an earlier major of a listed app is not served yet';
72
+ /**
73
+ * The words every earlier-major refusal carries, as {@link NEW_MAJOR_UNSERVED} is for its own: a
74
+ * promote over the newest major, and a release that names an earlier major it cannot go to.
75
+ */
76
+ const EARLIER_MAJOR_RELEASE = 'a release into an earlier major of a listed app goes only to a major still served on a script of its own';
71
77
  /** How many ranked-major changes a refusal names before it counts the rest. */
72
78
  const NAMED = 5;
73
79
  const SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
@@ -119,10 +125,14 @@ export function releaseWithinMajorRefusal(input) {
119
125
  `additive. No acknowledgement passes this refusal.`);
120
126
  }
121
127
  if (baseMajor !== null && headMajor !== null && headMajor < baseMajor) {
128
+ const door = servesMajors
129
+ ? ` To release it into major ${headMajor}, on that major's own script, name the major on the promote ` +
130
+ `(\`earlierMajor: ${headMajor}\`, \`substrat promote --earlier-major ${headMajor}\`).`
131
+ : '';
122
132
  return (`${subject} is refused: ${head.version} is in major ${headMajor}, earlier than major ${baseMajor} the channel ` +
123
133
  `serves, and ${EARLIER_MAJOR_RELEASE} (K-65, #3539). Promoted here it would put major ${headMajor}'s code on the ` +
124
- `script major ${baseMajor} is served from, under installs whose data has moved past it. Major ${headMajor} keeps ` +
125
- `serving what it serves. No acknowledgement passes this refusal.`);
134
+ `script major ${baseMajor} is served from, under installs whose data has moved past it.${door} ` +
135
+ `No acknowledgement passes this refusal.`);
126
136
  }
127
137
  const baseArtifacts = releaseArtifactsOf(base.manifestJson);
128
138
  if (!baseArtifacts)
@@ -269,6 +279,70 @@ export function supersededMajorsJson(input) {
269
279
  });
270
280
  return JSON.stringify([...earlier, entry]);
271
281
  }
282
+ /**
283
+ * The earlier major a release that names `major` goes to (K-65, #3539): the entry of
284
+ * `verticals.earlier_majors` it is served from, whose version every gate of the promote is judged
285
+ * against in place of the channel's. Refused (`conflict`, {@link EARLIER_MAJOR_RELEASE_REASON}),
286
+ * before anything is ranked or moves:
287
+ *
288
+ * - **where it cannot be served** on that major's script: a caller that does not serve in place
289
+ * (`servesMajors`), or a version with no archive script to serve from;
290
+ * - **a major that is not an earlier one still served**: the newest major is released by a promote
291
+ * that names none, and a major the app never had, or no longer serves, has no script to go to;
292
+ * - **a version in another major**, or one whose label is not semver: the label is the major.
293
+ *
294
+ * Nothing is judged at the major's end date, which K-65 does not decide: a release before or after
295
+ * it is admitted alike.
296
+ */
297
+ export function earlierMajorReleaseTarget(input) {
298
+ const { vertical, major, head } = input;
299
+ const refuse = (why) => substratError('conflict', `releasing ${head.version} into major ${major} of '${vertical}' is refused: ${why}, and ${EARLIER_MAJOR_RELEASE} ` +
300
+ `(K-65, #3539). No acknowledgement passes this refusal.`, { reason: EARLIER_MAJOR_RELEASE_REASON });
301
+ if (input.servesMajors !== true)
302
+ throw refuse('this promote does not serve a major from a script of its own');
303
+ if (!head.deploymentRef)
304
+ throw refuse(`version ${head.version} has no archive script to serve it from`);
305
+ const earlier = earlierMajorsOf(input.earlierJson);
306
+ const entry = earlier.find((m) => m.major === major);
307
+ if (!entry) {
308
+ const served = earlier.map((m) => m.major).join(', ');
309
+ throw refuse(served
310
+ ? `major ${major} is not an earlier major '${vertical}' still serves (it serves ${served} beside the newest)`
311
+ : `'${vertical}' serves no earlier major: a release into its newest major names none`);
312
+ }
313
+ const headMajor = majorOf(head.version);
314
+ if (headMajor !== major) {
315
+ throw refuse(headMajor === null
316
+ ? `the label '${head.version}' is not semver, so no major can be read from it`
317
+ : `${head.version} is in major ${headMajor}, not ${major}`);
318
+ }
319
+ return entry;
320
+ }
321
+ /**
322
+ * The `earlier_majors` column once a release into an earlier major has been served on its script
323
+ * (K-65, #3539): the entry for `major` names `next`'s version, class set and migration tag; its
324
+ * script, its supersede and its end are kept, and every other entry is untouched. Shared by both
325
+ * adapters, inside the unit that writes the row. A compare-and-set: refused (`precondition_failed`)
326
+ * when no entry is numbered `major`, when it runs another version, class set or tag than `expected`
327
+ * (the base the upload diffed its migration from), or when `next` names another script.
328
+ */
329
+ export function releasedEarlierMajorJson(input) {
330
+ const { vertical, major, expected, next } = input;
331
+ const refuse = (why) => substratError('precondition_failed', `the release into major ${major} of '${vertical}' cannot be recorded: ${why}`);
332
+ const earlier = earlierMajorsOf(input.earlierJson);
333
+ const at = earlier.findIndex((m) => m.major === major);
334
+ const entry = at < 0 ? undefined : earlier[at];
335
+ if (!entry)
336
+ throw refuse(`major ${major} is not an earlier major it serves`);
337
+ if (next.ref !== entry.ref)
338
+ throw refuse(`major ${major} is served from '${entry.ref}', not '${next.ref}'`);
339
+ const sameClasses = (a, b) => a.length === b.length && [...a].sort().every((c, i) => c === [...b].sort()[i]);
340
+ if (entry.versionId !== expected.versionId || entry.migrationTag !== expected.migrationTag || !sameClasses(entry.doClasses, expected.doClasses)) {
341
+ throw refuse(`its script's record changed since the release read it (now version ${entry.versionId}); promote again`);
342
+ }
343
+ const released = earlierMajor.parse({ ...entry, versionId: next.versionId, doClasses: [...next.doClasses], migrationTag: next.migrationTag });
344
+ return JSON.stringify(earlier.map((m, i) => (i === at ? released : m)));
345
+ }
272
346
  /**
273
347
  * SQL for the version a scope's SERVING SCRIPT runs (K-65, #3539 part 2), over a scope row `s`
274
348
  * joined to its vertical `vr`: the earlier major's version when `s.serving_ref` is one of
@@ -1 +1 @@
1
- {"version":3,"file":"release-within-major.js","sourceRoot":"","sources":["../src/release-within-major.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,aAAa,EAA4C,MAAM,yBAAyB,CAAC;AAuBrK,kGAAkG;AAClG,MAAM,CAAC,MAAM,4BAA4B,GAAG,uBAAu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,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GACrC,8FAA8F;IAC9F,gFAAgF,CAAC;AAEnF,oGAAoG;AACpG,MAAM,CAAC,MAAM,oBAAoB,GAC/B,8GAA8G,CAAC"}
@@ -45,6 +45,11 @@ export declare const PENDING_COPY_KEEP_ALIVE_SQL = "\n UPDATE scopes SET expire
45
45
  export declare const pendingCopyKeepAliveParams: (expiresAt: string | null, tenantId: string, scopeId: string, status: string, expectedExpiresAt: string | null, moveId: string, now: string) => (string | null)[];
46
46
  /** Pending entries whose lease ran out before `?` (or that never had one), oldest first, `LIMIT ?`. */
47
47
  export declare const COPY_EXPIRED_SQL = "\n SELECT tenant_id, scope_id, script_ref, move_id FROM scope_script_copies\n WHERE state = 'pending' AND (lease_until IS NULL OR lease_until <= ?)\n ORDER BY lease_until, tenant_id, scope_id, script_ref, move_id LIMIT ?";
48
+ /**
49
+ * K-69 (#3650): `COPY_EXPIRED_SQL` for one tenant, for the tenant's own alarm, so a tenant's claim
50
+ * never takes another tenant's entries. Params: now, tenantId, limit.
51
+ */
52
+ export declare const COPY_EXPIRED_FOR_TENANT_SQL = "\n SELECT tenant_id, scope_id, script_ref, move_id FROM scope_script_copies\n WHERE state = 'pending' AND (lease_until IS NULL OR lease_until <= ?) AND tenant_id = ?\n ORDER BY lease_until, tenant_id, scope_id, script_ref, move_id LIMIT ?";
48
53
  /** Claim one expired entry, re-checked in the write. Params: owner, leaseUntil, the key, now. */
49
54
  export declare const COPY_CLAIM_SQL = "\n UPDATE scope_script_copies SET lease_owner = ?, lease_until = ?\n WHERE tenant_id = ? AND scope_id = ? AND script_ref = ? AND move_id = ?\n AND state = 'pending' AND (lease_until IS NULL OR lease_until <= ?)";
50
55
  /** The move id every backfilled entry carries (#1722), which names it as one in a listing. */
@@ -1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d,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,wFAAwF;AACxF,eAAO,MAAM,yBAAyB,6FACsD,CAAC;AAE7F,eAAO,MAAM,iBAAiB,MAAO,kBAAkB,KAAG,eAUxD,CAAC"}
@@ -73,6 +73,14 @@ export const COPY_EXPIRED_SQL = `
73
73
  SELECT tenant_id, scope_id, script_ref, move_id FROM scope_script_copies
74
74
  WHERE state = 'pending' AND (lease_until IS NULL OR lease_until <= ?)
75
75
  ORDER BY lease_until, tenant_id, scope_id, script_ref, move_id LIMIT ?`;
76
+ /**
77
+ * K-69 (#3650): `COPY_EXPIRED_SQL` for one tenant, for the tenant's own alarm, so a tenant's claim
78
+ * never takes another tenant's entries. Params: now, tenantId, limit.
79
+ */
80
+ export const COPY_EXPIRED_FOR_TENANT_SQL = `
81
+ SELECT tenant_id, scope_id, script_ref, move_id FROM scope_script_copies
82
+ WHERE state = 'pending' AND (lease_until IS NULL OR lease_until <= ?) AND tenant_id = ?
83
+ ORDER BY lease_until, tenant_id, scope_id, script_ref, move_id LIMIT ?`;
76
84
  /** Claim one expired entry, re-checked in the write. Params: owner, leaseUntil, the key, now. */
77
85
  export const COPY_CLAIM_SQL = `
78
86
  UPDATE scope_script_copies SET lease_owner = ?, lease_until = ?
@@ -1 +1 @@
1
- {"version":3,"file":"scope-copy-ledger.js","sourceRoot":"","sources":["../src/scope-copy-ledger.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AAEH,8FAA8F;AAC9F,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;+DAMuB,CAAC;AAEhE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAkC,EAAE,GAAW,EAAY,EAAE,CAC9F,CAAC,OAAO,CAAC,MAAM,E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jC,OAAO,EAAE,CAAC,CAAC,QAAmB;IAC9B,SAAS,EAAE,CAAC,CAAC,UAAU;IACvB,MAAM,EAAE,CAAC,CAAC,OAAO;IACjB,KAAK,EAAE,CAAC,CAAC,KAAiC;IAC1C,SAAS,EAAE,CAAC,CAAC,UAAU;IACvB,QAAQ,EAAE,CAAC,CAAC,QAAQ;IACpB,IAAI,EAAE,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;IACrE,UAAU,EAAE,CAAC,CAAC,WAAW;CAC1B,CAAC,CAAC"}
@@ -9,7 +9,7 @@ import type { VerticalScopeStore } from './vertical-scope-stores.js';
9
9
  import type { DeploymentWireAuthFilter, DeploymentWireAuthInput, WireWalkAudit } from './deployment-wire-auth.js';
10
10
  import type { StoreDriverApprovalRecord, StoreDriverHoldMode, StoreDriverRebuildFailure, StoreDriverRebuildRecord, StoreDriverReleaseRecord, StoreDriverRevokeWalkRecord, StoreDriverRolloutAction, StoreDriverRolloutRecord, StoreDriverRolloutState, StoreDriverRolloutTarget, StoreDriverState } from './store-driver-releases.js';
11
11
  import type { SubjectRedactionCounts } from './subject-redaction.js';
12
- import type { OnBehalfOf, ExportReadInput, ExportedBatch, ImportBatch, ImportedEvent, ImportResult, ImportState, ImportCursorMove, ImportCursorMoved, AdminAction, BecomeCapabilityInput, CapabilityExchange, CapabilityExchangeOptions, CapabilityFilter, CapabilityId, CapabilityPage, MintedCapability, ListPage, ConnectLink, ConnectLinkConsume, ConnectLinkFilter, ConnectLinkKey, ConsumeConnectLinkInput, MintConnectLinkInput, Connection, ConnectionFilter, ConnectionId, ConnectionGrant, ConnectionRevoke, ConnectionGrantRecord, ConnectionSecret, CreateConnectionInput, OpenConnection, ProjectedConnectionGrant, ProjectedConnectionKey, AccessLogEntry, DelegatedReadRecord, OwnerTransferAudit, MemberChangeAudit, PeerBindingAudit, ConnectionBindingAudit, CopyMarkAudit, OrphanSweepAudit, DeliveryRedriveAudit, BrokerDeadLetterAudit, BindHostnameInput, AdminLogEntry, OpsFailureEntry, PlatformRequestDrainTotalsEntry, SweepRunEntry, SweepRunKind, SweepRunOutcome, ModelUsageEntry, ModelUsageSummary, MarkupRow, MarkupRowInput, CapabilityGrant, CreateTenantInput, Decision, Instant, DomainEvent, DomainEventInput, PlatformRequestInput, PlatformRequestId, PlatformRequestEntry, PlatformRequestFilter, PlatformRequestStatus, PlatformRequestFailure, PlatformOutcomeEvent, EntitlementGrant, EntitlementGrantInput, EntitlementView, MeterReading, MeterDay, MeterDayTake, StaleScope, StaleScopeTake, VerticalOwnerPeriod, ScopeStorageSample, StorageGauge, RequestDay, RequestRollupDay, CostDay, EntityRef, IdentityLink, IdentityPool, Jurisdiction, ModuleId, ModuleManifest, ScheduleSpec, SystemGrant, PeerGrantsStatusEntry, SystemGrantsStatusEntry, SystemSwitchRecord, SystemSwitch, SystemSwitchResult, PeerCoverage, PeerSwitch, PeerSwitchResult, VerticalCaller, VerticalResolution, PeerBinding, AppEnvironment, EnvironmentServing, PeerInstanceResolution, CreateOrgInput, Node, Org, OrgId, OrgMembership, PermissionKey, PlatformActorId, ChannelName, ExportBreak, ChannelHistoryEntry, DnsRecord, HostnameBinding, HostnameStatus, PromotionAcknowledgement, BindAcknowledgement, PublishVersionInput, RegisterVerticalInput, VerticalServingState, DeploymentWireAuth, RouteTarget, DirectoryDump, DirectoryCopyByReference, DirectoryDumpPage, ScopeDumpTable, IdentityMembership, PrincipalId, ResolvedIdentity, RoleAssignment, RoleDefinition, QueryScopeInput, ReadScopeTableInput, Scope, ScopeDump, ScopeDumpInput, SubjectShredReceipt, SubjectReadPage, SubjectReadRequest, SubjectAccessReceipt, ScopeQueryResult, ScopeId, ScopeStatus, ScopeTable, DenialFilter, DenialSummary, RefusalFilter, RefusalRecord, PermissionDenial, Coverage, BeginImpersonationInput, ImpersonationFilter, ImpersonationSession, ImpersonationSessionId, ScopeTablePage, StorageShape, Tenant, TenantId, TenantRole, TenantStoreHandle, AttachmentRecord, UploadLinkView, BlobStoreHandle, Visibility, Vertical, VerticalChannel, VerticalVersion, TenantStatus, Page, CountedPage, FreshnessSpec, EntityHistoryInput, EventFacetInput, EventCauseInput, EventEffectsInput, EffectsTree, InvocationEventsInput, InvocationEvents, DeadLettersInput, DeadLetter, LifecycleFlowInput, LifecycleFlowResult, OperationSeriesInput, OperationSeriesResult, CauseChain, EventFacetResult, HistoryEntry, ErrorCode, PlatformRequestFailureOrigin, IssueEntry, IssueStatus, IssueStatusInput, FindingEntry, FindingFilter, FindingRuleEntry, FindingRuleInput, FindingStatusInput, DeclaredMigration, CheckSubject, EntityGrantShape, NotedTransition, VerticalTraceSampling, StoreProof } from '@substrat-run/contracts';
12
+ import type { OnBehalfOf, ExportReadInput, ExportedBatch, ImportBatch, ImportedEvent, ImportResult, ImportState, ImportCursorMove, ImportCursorMoved, AdminAction, BecomeCapabilityInput, CapabilityExchange, CapabilityExchangeOptions, CapabilityFilter, CapabilityId, CapabilityPage, MintedCapability, ListPage, ConnectLink, ConnectLinkConsume, ConnectLinkFilter, ConnectLinkKey, ConsumeConnectLinkInput, MintConnectLinkInput, Connection, ConnectionFilter, ConnectionId, ConnectionGrant, ConnectionRevoke, ConnectionGrantRecord, ConnectionSecret, CreateConnectionInput, OpenConnection, ProjectedConnectionGrant, ProjectedConnectionKey, AccessLogEntry, DelegatedReadRecord, OwnerTransferAudit, MemberChangeAudit, PeerBindingAudit, ConnectionBindingAudit, CopyMarkAudit, OrphanSweepAudit, DeliveryRedriveAudit, BrokerDeadLetterAudit, BindHostnameInput, AdminLogEntry, OpsFailureEntry, PlatformRequestDrainTotalsEntry, SweepRunEntry, SweepRunKind, SweepRunOutcome, ModelUsageEntry, ModelUsageSummary, MarkupRow, MarkupRowInput, CapabilityGrant, CreateTenantInput, Decision, Instant, DomainEvent, DomainEventInput, PlatformRequestInput, PlatformRequestId, PlatformRequestEntry, PlatformRequestFilter, PlatformRequestStatus, PlatformRequestFailure, PlatformOutcomeEvent, EntitlementGrant, EntitlementGrantInput, EntitlementView, MeterReading, MeterDay, MeterDayTake, StaleScope, StaleScopeTake, VerticalOwnerPeriod, ScopeStorageSample, StorageGauge, RequestDay, RequestRollupDay, CostDay, EntityRef, IdentityLink, IdentityPool, Jurisdiction, ModuleId, ModuleManifest, ScheduleSpec, SystemGrant, PeerGrantsStatusEntry, SystemGrantsStatusEntry, SystemSwitchRecord, SystemSwitch, SystemSwitchResult, PeerCoverage, PeerSwitch, PeerSwitchResult, VerticalCaller, VerticalResolution, PeerBinding, AppEnvironment, EnvironmentServing, EnvironmentServeAcknowledgement, EnvironmentEffects, ConnectionReach, PeerInstanceResolution, CreateOrgInput, Node, Org, OrgId, OrgMembership, PermissionKey, PlatformActorId, ChannelName, ExportBreak, ChannelHistoryEntry, DnsRecord, HostnameBinding, HostnameStatus, PromotionAcknowledgement, BindAcknowledgement, PublishVersionInput, RegisterVerticalInput, VerticalServingState, DeploymentWireAuth, RouteTarget, DirectoryDump, DirectoryCopyByReference, DirectoryDumpPage, ScopeDumpTable, IdentityMembership, PrincipalId, ResolvedIdentity, RoleAssignment, RoleDefinition, QueryScopeInput, ReadScopeTableInput, Scope, ScopeDump, ScopeDumpInput, SubjectShredReceipt, DependentErasure, OwedDependentErasure, SubjectReadPage, SubjectReadRequest, SubjectAccessReceipt, ScopeQueryResult, ScopeId, ScopeStatus, ScopeTable, DenialFilter, DenialSummary, RefusalFilter, RefusalRecord, PermissionDenial, Coverage, BeginImpersonationInput, ImpersonationFilter, ImpersonationSession, ImpersonationSessionId, ScopeTablePage, StorageShape, Tenant, TenantId, TenantRole, TenantStoreHandle, AttachmentRecord, UploadLinkView, BlobStoreHandle, Visibility, Vertical, VerticalChannel, VerticalVersion, TenantStatus, Page, CountedPage, FreshnessSpec, EntityHistoryInput, EventFacetInput, EventCauseInput, EventEffectsInput, EffectsTree, InvocationEventsInput, InvocationEvents, DeadLettersInput, DeadLetter, LifecycleFlowInput, LifecycleFlowResult, OperationSeriesInput, OperationSeriesResult, CauseChain, EventFacetResult, HistoryEntry, ErrorCode, PlatformRequestFailureOrigin, IssueEntry, IssueStatus, IssueStatusInput, FindingEntry, FindingFilter, FindingRuleEntry, FindingRuleInput, FindingStatusInput, DeclaredMigration, CheckSubject, EntityGrantShape, NotedTransition, VerticalTraceSampling, StoreProof } from '@substrat-run/contracts';
13
13
  import type { ConnectionUseOutcome } from './connector-calls.js';
14
14
  import type { ScopeDelegation } from './delegation-ceiling.js';
15
15
  import type { ByteBody } from './byte-stream.js';
@@ -20,7 +20,7 @@ import type { LiveReadSurface } from './live-read.js';
20
20
  import type { CapabilityVerbs } from './capability.js';
21
21
  import type { AttachmentVerbs } from './upload-link.js';
22
22
  import type { AuditedOperationRef, AuditedOperationRow } from './audit-outcome.js';
23
- import { type EntityStateName } from '@substrat-run/contracts';
23
+ import { type EntityStateName, type z } from '@substrat-run/contracts';
24
24
  import type { BuildUsageInput, TenantBuildUsageFilter, TenantBuildUsageRow } from './build-usage.js';
25
25
  import type { ModelUsageFilter, ModelUsageInput, ModelUsagePricing, ModelUsageWindow, TenantModelUsageMeterFilter, TenantModelUsageMeterRow } from './model-usage.js';
26
26
  import type { FindingPruneReport } from './findings.js';
@@ -1451,8 +1451,15 @@ export interface ConnectorContext {
1451
1451
  * accident — the tenant and vertical are ambient, not arguments. Throws when
1452
1452
  * there is none: a connector that runs without a credential would otherwise
1453
1453
  * fail later, further from the cause.
1454
+ *
1455
+ * `own` (#3530 step 6) opens THIS scope's own connection of the provider (`openConnection`'s
1456
+ * owner selector) and never the tenant's: the dispatch a named environment given connections of
1457
+ * its own runs, so its effects go through a connection it owns and never production's. Throws when
1458
+ * the scope owns none. Absent, the tenant's is opened, as before.
1454
1459
  */
1455
- connection(provider: string): Promise<ScopedConnectorConnection>;
1460
+ connection(provider: string, options?: {
1461
+ own?: boolean;
1462
+ }): Promise<ScopedConnectorConnection>;
1456
1463
  }
1457
1464
  export type ConnectorHandler = (ctx: ConnectorContext, event: DomainEvent) => void | Promise<void>;
1458
1465
  /**
@@ -1635,6 +1642,25 @@ export interface ModuleRegistration<C extends readonly EventContract[] = []> {
1635
1642
  * (`module-erasure.ts`). Requires `manifest.erasure`, whose `tables` is that reach.
1636
1643
  */
1637
1644
  onSubjectErased?: OnSubjectErased;
1645
+ /**
1646
+ * The payloads of events this module emits from code rather than through an operation's
1647
+ * declared `emits` (#3367): a `ctx.emit` in a handler, a consumer or a helper, whose payload no
1648
+ * declaration states. One entry per (type, schemaVersion), each naming the Zod schema the
1649
+ * payload satisfies — the receiver's own parse where one exists, so the contract states what is
1650
+ * actually read. Each must be an entry of `manifest.events.emits`.
1651
+ *
1652
+ * Declarative only: the host never reads it, so nothing about how the event is emitted or
1653
+ * delivered changes. The generated AsyncAPI contract (`declaredPayloadsOf`) converts each
1654
+ * schema to the message's payload with the conversion an operation's `emits` goes through, and
1655
+ * refuses an entry the manifest does not emit.
1656
+ */
1657
+ emittedPayloads?: readonly EmittedPayload[];
1658
+ }
1659
+ /** The payload a module states for one event it emits from code (`ModuleRegistration.emittedPayloads`). */
1660
+ export interface EmittedPayload {
1661
+ readonly type: string;
1662
+ readonly schemaVersion: number;
1663
+ readonly payload: z.ZodType;
1638
1664
  }
1639
1665
  /**
1640
1666
  * Admin surface for enforcement input (design doc §4; control-plane.md §4.4).
@@ -2274,10 +2300,21 @@ export interface HostAdmin {
2274
2300
  * (the control-plane API's in-place serve). A new major of a listed app is refused without it,
2275
2301
  * and for an incoming version with no archive script (`deploymentRef` null), which no serve can
2276
2302
  * put on a script of its own.
2303
+ *
2304
+ * **`earlierMajor` (K-65, #3539) releases the version into that earlier major instead**, on the
2305
+ * script it is served from (`earlierMajorReleaseTarget`: prod only, a caller that `servesMajors`,
2306
+ * an archive script, an earlier major still served, a version labelled in it). Every gate above is
2307
+ * judged against the version that major's script runs, in place of the channel's: the K-65
2308
+ * ranking within the major, the #2178 strand gate over the installs on that script, the scope
2309
+ * types they hold, the review binding, both checkpoints and the export breaks. The channel does
2310
+ * not move and no timeline row is written: what moves is the earlier major's serving record, after
2311
+ * the caller's upload (`setVerticalServing`'s `earlierMajor`). The audited `promoteVersion` row
2312
+ * names the major, and lands only while that major's script still runs the version judged.
2277
2313
  */
2278
2314
  promoteVersion(actor: PlatformActorId, verticalSlug: string, channel: ChannelName, versionId: string, acknowledge?: PromotionAcknowledgement, options?: {
2279
2315
  unlistedOnly?: boolean;
2280
2316
  servesMajors?: boolean;
2317
+ earlierMajor?: number;
2281
2318
  }): Promise<void>;
2282
2319
  /**
2283
2320
  * Which installed consumers promoting `versionId` to `channel` would break (#1705 PR 3): the
@@ -2410,9 +2447,19 @@ export interface HostAdmin {
2410
2447
  * needs `expected` to be that state, non-null, on another ref; anything else is refused
2411
2448
  * (`precondition_failed`) and writes nothing. No install moves: every scope on the earlier
2412
2449
  * script stays there and runs what it ran, so the #2178 strand gate has nobody to judge.
2450
+ *
2451
+ * `earlierMajor` (K-65, #3539) records a release into that earlier major instead, served on its
2452
+ * own script: `state` is what that script now runs, and `expected` (required) what it ran, the
2453
+ * base the upload diffed its migration from. Only that major's entry of `earlierMajors` moves;
2454
+ * the current major's serving state is untouched. Its installs run the new version from this
2455
+ * moment, so it is judged as an in-place serve is, over them alone: the #2178 strand gate and the
2456
+ * scope types they hold. A compare-and-set (`releasedEarlierMajorJson`): refused
2457
+ * (`precondition_failed`) when the entry runs another version, class set or tag than `expected`,
2458
+ * or is served from another script than `state.ref`. Not combined with `supersede`.
2413
2459
  */
2414
2460
  setVerticalServing(actor: PlatformActorId, verticalSlug: string, state: VerticalServingState, expected?: VerticalServingState | null, opts?: {
2415
2461
  supersede?: SupersedeMajor;
2462
+ earlierMajor?: number;
2416
2463
  }): Promise<void>;
2417
2464
  /**
2418
2465
  * The pushed DeployManifest (JSON) of one version — what a serve rebuilds upload
@@ -2554,12 +2601,14 @@ export interface HostAdmin {
2554
2601
  * or a sweep that did), leasing each to `owner` until `leaseUntil`. An entry whose lease is
2555
2602
  * live is never returned, so a move still in flight keeps it; and a move whose lease ran out
2556
2603
  * can no longer confirm (`confirmMove`), so the claimant cannot lose a race to it.
2604
+ * K-69 (#3650): `tenantId` claims only that tenant's entries, for the tenant's own alarm.
2557
2605
  */
2558
2606
  claimExpiredScopeScriptCopies(actor: PlatformActorId, input: {
2559
2607
  now: string;
2560
2608
  leaseUntil: string;
2561
2609
  owner: string;
2562
2610
  limit: number;
2611
+ tenantId?: TenantId;
2563
2612
  }): Promise<ScopeScriptCopy[]>;
2564
2613
  /** Reserve a scope for script cleanup only when no copy move is in flight. The claim is a
2565
2614
  * column on the directory row, not a ledger entry: it refuses new moves and the conditional
@@ -2581,9 +2630,12 @@ export interface HostAdmin {
2581
2630
  * The scope must be archived, in the same read as the write, so an unarchive that got in first wins and
2582
2631
  * no store is fenced: `conflict`. `whileTenantDeleting` holds the tenant the same way. Asked again on a
2583
2632
  * scope already marked it answers as before, whatever its status, for a reap's retry.
2633
+ * Automatic reap cutoffs also check the current archive or deletion date in the same write.
2584
2634
  */
2585
2635
  markScopeStoresFenced(actor: PlatformActorId, tenantId: TenantId, scopeId: ScopeId, opts?: {
2586
2636
  whileTenantDeleting?: boolean;
2637
+ archivedBy?: string;
2638
+ deletingBy?: string;
2587
2639
  }): Promise<void>;
2588
2640
  /** When `markScopeStoresFenced` was asked for this scope, or null: never, or no such scope. */
2589
2641
  scopeStoresFencedAt(actor: PlatformActorId, tenantId: TenantId, scopeId: ScopeId): Promise<string | null>;
@@ -2781,6 +2833,14 @@ export interface HostAdmin {
2781
2833
  changed: boolean;
2782
2834
  previous: ScopeId | null;
2783
2835
  }>;
2836
+ /**
2837
+ * The home scope of (tenant, app, environment), or null when there is none. Production (the
2838
+ * default) answers the app's earliest live install in the tenant: primary, parentless and of type
2839
+ * `home`, earliest by when it was provisioned, so a tenant with several installs finds the same one
2840
+ * every time. A named environment answers the preview it is a name over, when that is of type
2841
+ * `home`. Nothing is stored for it. Recorded as an admin read.
2842
+ */
2843
+ homeScopeOf(actor: PlatformActorId, tenantId: TenantId, vertical: string, environment?: string): Promise<ScopeId | null>;
2784
2844
  /**
2785
2845
  * The app's environments in the tenant: production first, always (the tenant's installs, never
2786
2846
  * stored, so an app that runs today reads as production with no step), then each named one, a
@@ -2817,6 +2877,12 @@ export interface HostAdmin {
2817
2877
  * landed: compare-and-set on `expected` (the record the upload diffed from, null for the first
2818
2878
  * serve), refused with `precondition_failed` when the row moved since. `not_found` for a name that
2819
2879
  * is no environment; `conflict` for another script than the one it serves from. Audited.
2880
+ *
2881
+ * #3638 (D-83): refused (`conflict`, reason `environment_checkpoint`) when `next.versionId` changes
2882
+ * the permission digest or the migration digest against the version the environment serves (its own
2883
+ * script's, or before its first serve its preview's bound version) and `acknowledge` does not
2884
+ * acknowledge that change. Only this argument counts: a promote's acknowledgement, or one given to
2885
+ * another environment's serve, never does. The audit row records `acknowledged`, per environment.
2820
2886
  */
2821
2887
  setEnvironmentServing(actor: PlatformActorId, input: {
2822
2888
  tenantId: TenantId;
@@ -2824,7 +2890,9 @@ export interface HostAdmin {
2824
2890
  name: string;
2825
2891
  }, next: EnvironmentServing, expected: EnvironmentServing | null,
2826
2892
  /** The serve lease's claim: when given, the record lands only while that claim still holds it. */
2827
- claim?: string): Promise<void>;
2893
+ claim?: string,
2894
+ /** #3638: the checkpoints this serve acknowledges, in this environment alone. */
2895
+ acknowledge?: EnvironmentServeAcknowledgement): Promise<void>;
2828
2896
  /**
2829
2897
  * Take an environment's serve lease for `leaseMs` (#3530 step 4), so its serves run one at a time:
2830
2898
  * upload, record and bind. False while another live claim holds it; a lapsed one is taken over and
@@ -2842,6 +2910,27 @@ export interface HostAdmin {
2842
2910
  vertical: string;
2843
2911
  name: string;
2844
2912
  }, claim: string): Promise<void>;
2913
+ /**
2914
+ * Give a named environment connections of its own, or take that back (#3530 step 6): a choice a
2915
+ * person makes per environment. `prod` and a name that is no environment are `not_found`. Audited
2916
+ * when it changed; `changed: false` writes nothing. Taking it back moves no connection.
2917
+ */
2918
+ setEnvironmentEffects(actor: PlatformActorId, input: {
2919
+ tenantId: TenantId;
2920
+ vertical: string;
2921
+ name: string;
2922
+ }, effects: EnvironmentEffects): Promise<{
2923
+ changed: boolean;
2924
+ before: EnvironmentEffects;
2925
+ }>;
2926
+ /**
2927
+ * Which connections the scope's outside effects may go through (#3530 step 6, kernel
2928
+ * `connectionReachIn`): `all` for an install, `own` for the scope of a named environment given
2929
+ * connections of its own, `none` for everything else, a scope not on record or of another tenant
2930
+ * included. The rule every connection door asks. Not recorded as an access: it is the door's own
2931
+ * read, as `getScopeRecord` is.
2932
+ */
2933
+ connectionReach(actor: PlatformActorId, tenantId: TenantId, scopeId: ScopeId): Promise<ConnectionReach>;
2845
2934
  /**
2846
2935
  * Persist a tenant. Idempotent on the id — re-creating an existing tenant is a
2847
2936
  * no-op, not an error (control-plane.md §4.1). `status` starts `active` and
@@ -2882,7 +2971,9 @@ export interface HostAdmin {
2882
2971
  * then calls this to clear the directory. Idempotent: re-running after a partial
2883
2972
  * failure converges (the DELETEs and the status flip are all set-to-empty).
2884
2973
  */
2885
- reapTenant(actor: PlatformActorId, tenantId: TenantId): Promise<void>;
2974
+ reapTenant(actor: PlatformActorId, tenantId: TenantId, opts?: {
2975
+ deletingBy?: string;
2976
+ }): Promise<void>;
2886
2977
  /**
2887
2978
  * The tenant registry — the directory's inventory (control-plane.md §4.5 console
2888
2979
  * item 1). Ordered by tenant id (ULID = chronological); the cursor is a tenant id.
@@ -3621,6 +3712,26 @@ export interface HostAdmin {
3621
3712
  }>;
3622
3713
  /** Monotone directory fence against a carry from before subject erasure. */
3623
3714
  scopeErasureEpoch(actor: PlatformActorId, tenantId: TenantId, scopeId: ScopeId): Promise<number>;
3715
+ /**
3716
+ * K-63 (#3624): keep what an erasure did at the apps that take their people from the erased
3717
+ * person's master, in one transaction. An `erased` outcome settles the dependent (its ledger row
3718
+ * goes); an `outstanding` one is owed (its row is kept, with its attempts, its last error, and
3719
+ * when it is next due, from `nextDependentErasureAt`). Writes one `eraseAtDependents` admin row
3720
+ * with the outcomes as `after`. Optional so a host without the ledger still compiles; the
3721
+ * platform refuses to report dependents it cannot keep (`reachDependents`).
3722
+ */
3723
+ recordDependentErasures?(actor: PlatformActorId, tenantId: TenantId, subjectId: string, outcomes: readonly DependentErasure[]): Promise<void>;
3724
+ /**
3725
+ * K-63 (#3624): hold each dependent as owed an erasure, due now with no attempts, BEFORE the
3726
+ * master's erasure runs. A dependent already owed keeps its attempts and next try. Not audited:
3727
+ * the outcomes `recordDependentErasures` writes are, and this row is only the obligation.
3728
+ */
3729
+ holdDependentErasures?(actor: PlatformActorId, tenantId: TenantId, subjectId: string, dependents: readonly {
3730
+ vertical: string;
3731
+ scopeId: ScopeId;
3732
+ }[]): Promise<void>;
3733
+ /** K-63 (#3624): the owed dependent erasures due at `now`, oldest due first, at most `limit`. */
3734
+ dueDependentErasures?(actor: PlatformActorId, now: string, limit: number): Promise<OwedDependentErasure[]>;
3624
3735
  /** Finish an orchestrated erasure only after every script holding a copy has redacted it.
3625
3736
  * The copy count fences a move that was recorded after the coordinator listed scripts;
3626
3737
  * ledger rows are append-only, so a changed count means that inventory is stale. */
@@ -3783,8 +3894,13 @@ export interface HostAdmin {
3783
3894
  *
3784
3895
  * Minting is idempotent per connection, so this doubles as the back-fill for a
3785
3896
  * tenant whose connections all predate the keypair.
3897
+ *
3898
+ * `scopeId` (#3530 step 6) names the scope the keys are for. For the scope of a named environment
3899
+ * given connections of its own, its own connection's key replaces the tenant's for each provider it
3900
+ * owns one of (`sealingKeysForReach`). Any other scope, or none named, is answered the tenant's
3901
+ * keys alone, as before.
3786
3902
  */
3787
- connectionSealingKeys(tenantId: TenantId, vertical: string): Promise<ProjectedConnectionKey[]>;
3903
+ connectionSealingKeys(tenantId: TenantId, vertical: string, scopeId?: ScopeId): Promise<ProjectedConnectionKey[]>;
3788
3904
  /** Metadata only — never the credential, at any privilege level. */
3789
3905
  listConnections(actor: PlatformActorId, filter?: ConnectionFilter): Promise<Connection[]>;
3790
3906
  /**
@@ -4491,6 +4607,24 @@ export interface ProvisionScopeInput {
4491
4607
  * no request body carries it.
4492
4608
  */
4493
4609
  verticalSource?: 'input' | 'copy';
4610
+ /**
4611
+ * #3625 (K-64): this provision installs the app for the tenant, and so claims its home scope in
4612
+ * production. Set by the doors that install an app (the dashboard's, a manager's `provision-tenant`).
4613
+ * Refused (`conflict`), in the directory write's own unit, while the app has a live home scope in the
4614
+ * tenant (`secondHomeRefusal`). A provision without it is judged as before, so a sibling, a copy and
4615
+ * the scopes platform code and suites make are untouched.
4616
+ */
4617
+ install?: boolean;
4618
+ /**
4619
+ * #2993 (K-64): this provision is a SIBLING another scope of the app asked for beside itself (the
4620
+ * `provision-sibling` intent, the `POST /tenants/:tenantId/scopes` route), and so takes that scope's
4621
+ * type with no parent. For an app that declares scope types, a sibling of type `home` is a second
4622
+ * home scope by another door, and is refused (`conflict`) as a second install is, in the directory
4623
+ * write's own unit (`secondHomeRefusal`): a new scope there is a child of the home scope
4624
+ * (`provision-child`). An app that declares no types provisions its siblings as before, until D-83
4625
+ * settles several installs.
4626
+ */
4627
+ sibling?: boolean;
4494
4628
  storageShape?: StorageShape;
4495
4629
  jurisdiction?: Jurisdiction;
4496
4630
  /**
@@ -4737,6 +4871,8 @@ export interface ScopeFilter extends ListPage {
4737
4871
  /** One status or any of several — the console's All / Suspended / Archived tabs. */
4738
4872
  status?: ScopeStatus | ScopeStatus[];
4739
4873
  vertical?: string;
4874
+ /** #2995: the children of this scope only. A reap path lists those to reap before their parent. */
4875
+ parentScopeId?: ScopeId;
4740
4876
  }
4741
4877
  /**
4742
4878
  * A directory row that does not read as a `Scope`. Its ids as stored and the names of the