@capybara-hq/kernel 0.1.0-rc.142 → 0.1.0-rc.144

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 (238) hide show
  1. package/dist/admin/admin-agents.controller.d.ts +3 -5
  2. package/dist/admin/admin-agents.controller.js +1 -1
  3. package/dist/admin/admin-connectors.controller.d.ts +3 -5
  4. package/dist/admin/admin-connectors.controller.js +1 -1
  5. package/dist/admin/admin-items.schemas.d.ts +6 -6
  6. package/dist/admin/admin-items.schemas.js +5 -9
  7. package/dist/admin/admin.controller.d.ts +18 -12
  8. package/dist/admin/admin.controller.js +29 -15
  9. package/dist/admin/admin.schemas.d.ts +12 -3
  10. package/dist/admin/admin.schemas.js +17 -6
  11. package/dist/agents/admin-agents.d.ts +10 -8
  12. package/dist/agents/admin-agents.js +13 -9
  13. package/dist/agents/agents.module.js +3 -0
  14. package/dist/agents/agents.service.js +1 -1
  15. package/dist/agents/org-templates.d.ts +3 -1
  16. package/dist/agents/org-templates.js +7 -3
  17. package/dist/agents/pending-connector-requests.d.ts +10 -4
  18. package/dist/agents/pending-connector-requests.js +29 -7
  19. package/dist/automations/automations.controller.d.ts +9 -5
  20. package/dist/automations/automations.controller.js +21 -4
  21. package/dist/automations/automations.schemas.d.ts +19 -0
  22. package/dist/automations/automations.schemas.js +9 -0
  23. package/dist/automations/automations.service.d.ts +25 -8
  24. package/dist/automations/automations.service.js +40 -34
  25. package/dist/automations/events/acceptance.d.ts +6 -1
  26. package/dist/automations/events/acceptance.js +30 -11
  27. package/dist/automations/store.d.ts +17 -0
  28. package/dist/automations/store.js +35 -0
  29. package/dist/catalog/admin-catalog.controller.d.ts +64 -2
  30. package/dist/catalog/admin-catalog.controller.js +17 -0
  31. package/dist/catalog/catalog-import.module.js +3 -0
  32. package/dist/catalog/catalog-scope.service.d.ts +3 -1
  33. package/dist/catalog/catalog-scope.service.js +11 -7
  34. package/dist/catalog/catalog.module.js +3 -0
  35. package/dist/catalog/catalog.service.d.ts +3 -1
  36. package/dist/catalog/catalog.service.js +8 -4
  37. package/dist/catalog/cli.js +2 -2
  38. package/dist/catalog/component-promotion.d.ts +3 -1
  39. package/dist/catalog/component-promotion.js +7 -3
  40. package/dist/catalog/component-scope.service.d.ts +3 -1
  41. package/dist/catalog/component-scope.service.js +7 -3
  42. package/dist/catalog/enable-requests.d.ts +10 -8
  43. package/dist/catalog/enable-requests.js +40 -21
  44. package/dist/catalog/marketplaces.service.d.ts +1 -1
  45. package/dist/catalog/owned-items.d.ts +3 -1
  46. package/dist/catalog/owned-items.js +13 -9
  47. package/dist/catalog/platform-components.d.ts +6 -1
  48. package/dist/catalog/platform-components.js +9 -3
  49. package/dist/catalog/plugin-connectors.d.ts +8 -4
  50. package/dist/catalog/plugin-connectors.js +12 -6
  51. package/dist/catalog/plugin-import.d.ts +3 -1
  52. package/dist/catalog/plugin-import.js +14 -5
  53. package/dist/catalog/plugin-install.d.ts +3 -1
  54. package/dist/catalog/plugin-install.js +8 -4
  55. package/dist/catalog/plugin-package.js +2 -1
  56. package/dist/catalog/plugin-upgrade.d.ts +3 -1
  57. package/dist/catalog/plugin-upgrade.js +8 -4
  58. package/dist/catalog/request-hints.d.ts +19 -0
  59. package/dist/catalog/request-hints.js +34 -0
  60. package/dist/catalog/request-rules.d.ts +9 -5
  61. package/dist/catalog/request-rules.js +16 -9
  62. package/dist/catalog/requests.service.d.ts +3 -1
  63. package/dist/catalog/requests.service.js +28 -9
  64. package/dist/catalog/scope-orgs.d.ts +2 -1
  65. package/dist/catalog/scope-orgs.js +2 -2
  66. package/dist/catalog/scope-sync.d.ts +3 -1
  67. package/dist/catalog/scope-sync.js +12 -2
  68. package/dist/catalog/scope-writer.d.ts +6 -3
  69. package/dist/catalog/scope-writer.js +28 -10
  70. package/dist/catalog/unshare.d.ts +3 -2
  71. package/dist/catalog/unshare.js +4 -4
  72. package/dist/client/client-access.service.js +29 -1
  73. package/dist/config/schema.d.ts +12 -0
  74. package/dist/config/schema.js +56 -0
  75. package/dist/ctx/create-ctx.d.ts +2 -19
  76. package/dist/ctx/create-ctx.js +3 -93
  77. package/dist/ctx/durable-relay.d.ts +2 -5
  78. package/dist/ctx/durable-relay.js +56 -29
  79. package/dist/db/extension-handoff-schema.js +5 -0
  80. package/dist/db/kernel-schema.d.ts +74 -0
  81. package/dist/db/migrator.js +36 -0
  82. package/dist/erasure/account-batches.js +2 -0
  83. package/dist/erasure/account-residual.js +1 -0
  84. package/dist/erasure/org-catalog.js +8 -3
  85. package/dist/erasure/org-rules.js +1 -0
  86. package/dist/evals/evals.schemas.d.ts +15 -5
  87. package/dist/evals/evals.schemas.js +17 -10
  88. package/dist/evals/runs.controller.d.ts +4 -12
  89. package/dist/evals/runs.controller.js +14 -11
  90. package/dist/evals/runs.service.d.ts +29 -25
  91. package/dist/evals/runs.service.js +73 -61
  92. package/dist/evals/trajectory.controller.d.ts +10 -6
  93. package/dist/evals/trajectory.controller.js +11 -4
  94. package/dist/evals/trajectory.service.d.ts +17 -9
  95. package/dist/evals/trajectory.service.js +52 -35
  96. package/dist/extensions/admin-ops.d.ts +6 -1
  97. package/dist/extensions/admin-ops.js +21 -7
  98. package/dist/extensions/blobs.d.ts +2 -0
  99. package/dist/extensions/blobs.js +11 -0
  100. package/dist/extensions/deployment-config.d.ts +6 -1
  101. package/dist/extensions/deployment-config.js +13 -2
  102. package/dist/extensions/enabled.d.ts +5 -0
  103. package/dist/extensions/extensions.module.js +3 -0
  104. package/dist/extensions/grant-epoch.d.ts +108 -0
  105. package/dist/extensions/grant-epoch.js +214 -0
  106. package/dist/extensions/host.d.ts +29 -9
  107. package/dist/extensions/host.js +148 -42
  108. package/dist/extensions/instance.d.ts +3 -3
  109. package/dist/extensions/instance.js +1 -1
  110. package/dist/extensions/isolated/authorization.d.ts +54 -2
  111. package/dist/extensions/isolated/authorization.js +148 -35
  112. package/dist/extensions/isolated/child-session.js +0 -1
  113. package/dist/extensions/isolated/revision.js +1 -1
  114. package/dist/extensions/org-config.d.ts +3 -1
  115. package/dist/extensions/org-config.js +13 -4
  116. package/dist/extensions/org-overrides.d.ts +6 -1
  117. package/dist/extensions/org-overrides.js +13 -2
  118. package/dist/extensions/package-digest.job.d.ts +34 -0
  119. package/dist/extensions/package-digest.job.js +121 -0
  120. package/dist/extensions/package.js +10 -6
  121. package/dist/extensions/permission-set.d.ts +14 -78
  122. package/dist/extensions/permission-set.js +17 -143
  123. package/dist/extensions/permission-view.d.ts +13 -1
  124. package/dist/extensions/permission-view.js +20 -0
  125. package/dist/extensions/registry.js +4 -1
  126. package/dist/extensions/resolve.d.ts +7 -8
  127. package/dist/extensions/resolve.js +7 -8
  128. package/dist/extensions/revision-approvals.d.ts +167 -0
  129. package/dist/extensions/revision-approvals.js +353 -0
  130. package/dist/extensions/revision-grants.d.ts +197 -0
  131. package/dist/extensions/revision-grants.js +584 -0
  132. package/dist/extensions/state.module.js +12 -1
  133. package/dist/identity/accounts.d.ts +10 -4
  134. package/dist/identity/accounts.js +18 -5
  135. package/dist/inbox/inbox-items.service.d.ts +6 -1
  136. package/dist/inbox/inbox-items.service.js +29 -10
  137. package/dist/inbox/inbox.module.js +3 -0
  138. package/dist/inbox/inbox.service.d.ts +3 -1
  139. package/dist/inbox/inbox.service.js +9 -2
  140. package/dist/inbox/org-notices.d.ts +4 -3
  141. package/dist/inbox/org-notices.js +9 -6
  142. package/dist/inbox/platform-inbox.service.d.ts +3 -1
  143. package/dist/inbox/platform-inbox.service.js +11 -3
  144. package/dist/inbox/platform-notices.d.ts +3 -2
  145. package/dist/inbox/platform-notices.js +10 -4
  146. package/dist/infra/config/kernel-config.service.js +4 -1
  147. package/dist/infra/database/extension-effect-key-lock.js +7 -0
  148. package/dist/infra/paging/paged-read.d.ts +34 -4
  149. package/dist/infra/paging/paged-read.js +38 -1
  150. package/dist/invalidation/audiences.d.ts +32 -0
  151. package/dist/invalidation/audiences.js +43 -0
  152. package/dist/invalidation/hints.d.ts +6 -0
  153. package/dist/invalidation/hints.js +7 -1
  154. package/dist/invalidation/invalidation-hints.d.ts +12 -1
  155. package/dist/invalidation/invalidation-hints.js +46 -5
  156. package/dist/invalidation/invalidation-hints.module.d.ts +2 -0
  157. package/dist/invalidation/invalidation-hints.module.js +4 -1
  158. package/dist/invalidation/me-stream.d.ts +1 -11
  159. package/dist/invalidation/me-stream.js +12 -41
  160. package/dist/invalidation/org-intent-bridge.d.ts +18 -0
  161. package/dist/invalidation/org-intent-bridge.js +46 -0
  162. package/dist/models/enablement.d.ts +3 -1
  163. package/dist/models/enablement.js +25 -5
  164. package/dist/orgs/invitations.controller.d.ts +4 -7
  165. package/dist/orgs/invitations.controller.js +8 -5
  166. package/dist/orgs/invitations.service.d.ts +17 -3
  167. package/dist/orgs/invitations.service.js +35 -13
  168. package/dist/orgs/members.service.d.ts +35 -0
  169. package/dist/orgs/members.service.js +52 -3
  170. package/dist/orgs/offboarding.d.ts +3 -1
  171. package/dist/orgs/offboarding.js +7 -3
  172. package/dist/orgs/orgs.controller.d.ts +11 -4
  173. package/dist/orgs/orgs.controller.js +25 -5
  174. package/dist/orgs/orgs.module.js +3 -0
  175. package/dist/orgs/orgs.schemas.d.ts +14 -0
  176. package/dist/orgs/orgs.schemas.js +19 -2
  177. package/dist/orgs/orgs.service.d.ts +24 -2
  178. package/dist/orgs/orgs.service.js +47 -4
  179. package/dist/orgs/security-settings.service.d.ts +14 -6
  180. package/dist/orgs/security-settings.service.js +18 -13
  181. package/dist/orgs/settings.controller.d.ts +7 -4
  182. package/dist/platform/exclusions.js +15 -0
  183. package/dist/platform/ops/accounts.ops.js +7 -16
  184. package/dist/platform/ops/admin-items.ops.js +7 -7
  185. package/dist/platform/ops/automations.ops.js +6 -4
  186. package/dist/platform/ops/evals.ops.js +30 -15
  187. package/dist/platform/ops/org-settings.ops.js +2 -2
  188. package/dist/platform/ops/orgs.ops.js +44 -27
  189. package/dist/push/delivery.d.ts +3 -1
  190. package/dist/push/delivery.js +7 -3
  191. package/dist/push/push-processor.js +8 -1
  192. package/dist/roles/worker.module.js +3 -0
  193. package/dist/runtime/step-log.d.ts +1 -1
  194. package/dist/runtime/step-log.js +5 -4
  195. package/dist/runtime/stream-limit.d.ts +13 -0
  196. package/dist/runtime/stream-limit.js +40 -0
  197. package/dist/runtime/stream.controller.d.ts +2 -0
  198. package/dist/runtime/stream.controller.js +2 -0
  199. package/dist/runtime/stream.d.ts +1 -0
  200. package/dist/runtime/stream.js +15 -6
  201. package/dist/sandbox/permission-authority.module.js +6 -1
  202. package/dist/sandbox/permission-transitions.d.ts +3 -1
  203. package/dist/sandbox/permission-transitions.js +17 -2
  204. package/dist/setup/kernel-checks.d.ts +3 -3
  205. package/dist/setup/kernel-checks.js +4 -4
  206. package/dist/setup/setup-check-registry.d.ts +16 -5
  207. package/dist/setup/setup-check-registry.js +11 -3
  208. package/dist/setup/setup-checks.service.d.ts +1 -2
  209. package/dist/setup/setup-checks.service.js +7 -6
  210. package/dist/skills/agent-skills.service.d.ts +6 -1
  211. package/dist/skills/agent-skills.service.js +12 -3
  212. package/dist/skills/changes.service.d.ts +6 -1
  213. package/dist/skills/changes.service.js +11 -3
  214. package/dist/skills/conversation-catalog.d.ts +3 -0
  215. package/dist/skills/conversation-catalog.js +2 -0
  216. package/dist/skills/skills.module.js +3 -0
  217. package/dist/skills/skills.service.d.ts +3 -1
  218. package/dist/skills/skills.service.js +8 -4
  219. package/dist/tools/admin-connectors.d.ts +10 -8
  220. package/dist/tools/admin-connectors.js +12 -10
  221. package/dist/tools/approvals.service.d.ts +12 -1
  222. package/dist/tools/approvals.service.js +36 -9
  223. package/dist/tools/builtins/automations.d.ts +1 -1
  224. package/dist/tools/builtins/automations.js +1 -1
  225. package/dist/tools/connectors.service.d.ts +3 -1
  226. package/dist/tools/connectors.service.js +29 -7
  227. package/dist/tools/tools.module.js +3 -0
  228. package/dist/ui/admin-ui.controller.d.ts +3 -1
  229. package/dist/ui/admin-ui.controller.js +3 -1
  230. package/dist/ui/ui-stream.d.ts +2 -0
  231. package/dist/ui/ui-stream.js +20 -6
  232. package/dist/ui/views.controller.d.ts +4 -2
  233. package/dist/ui/views.controller.js +4 -2
  234. package/package.json +3 -3
  235. package/src/migrations/0234_extension_grant_epoch.sql +141 -0
  236. package/src/migrations/0235_extension_revision_grants.sql +166 -0
  237. package/src/migrations/0236_paged_table_idx.sql +33 -0
  238. package/src/migrations/0237_extension_handoff_health.sql +18 -0
@@ -9,6 +9,7 @@ import { componentLocked, componentOffered, componentOn, componentPluginOn, list
9
9
  import { currentEnableDecision } from "./enable-decision.js";
10
10
  import { decodeModelId, readEnableDetail, sameTarget, targetKey, } from "./enable-targets.js";
11
11
  import { orgPluginDirectIntent, orgSees, orgUsable } from "./org-intent.js";
12
+ import { publishRequestHints } from "./request-hints.js";
12
13
  import { requestable } from "./scope.js";
13
14
  /** Builds a {@link ModelListing} from `ProviderRegistry.catalog(orgId)`. */
14
15
  export function modelListingOf(catalog) {
@@ -454,9 +455,10 @@ const usableNow = (r) => r !== undefined && !r.ok && r.on === true;
454
455
  * the requester's subject is usable (a `cancelReason: "target_changed"` cancellation otherwise),
455
456
  * and each follower's own outcome is recorded in `detail.followers` for their notice. Audits
456
457
  * each row under its own id. Returns the outcome of every row it settled (rows kept pending under
457
- * `reconcile` are absent).
458
+ * `reconcile` are absent). Every row it writes publishes `requests` after the commit
459
+ * ({@link publishRequestHints}: its requester, its followers, the org's admins).
458
460
  */
459
- export async function settleRequestRows(db, orgId, rows, mode, settlerOf) {
461
+ export async function settleRequestRows(db, hints, orgId, rows, mode, settlerOf) {
460
462
  const out = new Map();
461
463
  const parsed = rows.flatMap((r) => {
462
464
  const d = readEnableDetail(r.detail);
@@ -467,6 +469,8 @@ export async function settleRequestRows(db, orgId, rows, mode, settlerOf) {
467
469
  ...(p.d.followers ?? []).map((f) => f.subject),
468
470
  ]);
469
471
  const resolved = await resolveSubjects(db, orgId, subjects, true);
472
+ const written = [];
473
+ const dropped = [];
470
474
  const outcomeOf = (subject, target) => (mode.kind === "on" && sameTarget(subject, mode.target) && sameTarget(target, mode.target)) ||
471
475
  usableNow(resolved.get(targetKey(subject)))
472
476
  ? "approved"
@@ -484,12 +488,17 @@ export async function settleRequestRows(db, orgId, rows, mode, settlerOf) {
484
488
  });
485
489
  if (kept.length !== followers.length) {
486
490
  const raw = (row.detail ?? {});
487
- await db
491
+ const w = await db
488
492
  .updateTable("catalog_requests")
489
493
  .set({ detail: JSON.stringify({ ...raw, followers: kept }) })
490
494
  .where("id", "=", row.id)
491
495
  .where("org_id", "=", orgId)
492
- .execute();
496
+ .returning(["org_id", "requested_by", "kind", "detail"])
497
+ .executeTakeFirst();
498
+ if (w !== undefined)
499
+ written.push(w);
500
+ // a follower who stopped following no longer sees the request
501
+ dropped.push(...followers.filter((f) => !kept.includes(f)).map((f) => f.accountId));
493
502
  }
494
503
  continue;
495
504
  }
@@ -507,7 +516,7 @@ export async function settleRequestRows(db, orgId, rows, mode, settlerOf) {
507
516
  }),
508
517
  };
509
518
  const s = settlerOf(row.id);
510
- await db
519
+ const w = await db
511
520
  .updateTable("catalog_requests")
512
521
  .set({
513
522
  status: outcome === "approved" ? "approved" : "cancelled",
@@ -517,7 +526,10 @@ export async function settleRequestRows(db, orgId, rows, mode, settlerOf) {
517
526
  })
518
527
  .where("id", "=", row.id)
519
528
  .where("org_id", "=", orgId)
520
- .execute();
529
+ .returning(["org_id", "requested_by", "kind", "detail"])
530
+ .executeTakeFirst();
531
+ if (w !== undefined)
532
+ written.push(w);
521
533
  await audit(db, {
522
534
  actorAccountId: s.actor,
523
535
  ...(s.actorTokenId !== undefined && { actorTokenId: s.actorTokenId }),
@@ -534,6 +546,7 @@ export async function settleRequestRows(db, orgId, rows, mode, settlerOf) {
534
546
  });
535
547
  out.set(row.id, outcome);
536
548
  }
549
+ publishRequestHints(hints, written, dropped);
537
550
  return out;
538
551
  }
539
552
  /** An audit detail without a `requestId` (it names the request the writer was called for). */
@@ -556,7 +569,7 @@ function ownDetail(detail) {
556
569
  * switched back on) and `ConnectorsService` (a connector set active, by an org admin, the platform
557
570
  * or a plugin switch-on).
558
571
  */
559
- export async function settleEnableRequests(db, orgId, target, actor, opts = {}) {
572
+ export async function settleEnableRequests(db, hints, orgId, target, actor, opts = {}) {
560
573
  if (opts.settle === false)
561
574
  return [];
562
575
  const decision = currentEnableDecision();
@@ -591,7 +604,7 @@ export async function settleEnableRequests(db, orgId, target, actor, opts = {})
591
604
  if (deciding !== undefined && rows.some((r) => r.id === deciding.requestId)) {
592
605
  deciding.settled = true;
593
606
  }
594
- const settled = await settleRequestRows(db, orgId, rows, { kind: "on", target }, (id) => id === deciding?.requestId
607
+ const settled = await settleRequestRows(db, hints, orgId, rows, { kind: "on", target }, (id) => id === deciding?.requestId
595
608
  ? {
596
609
  actor: deciding.actor,
597
610
  actorTokenId: deciding.actorTokenId,
@@ -604,8 +617,11 @@ export async function settleEnableRequests(db, orgId, target, actor, opts = {})
604
617
  });
605
618
  return [...settled.keys()];
606
619
  }
607
- /** Cancels the pending enable requests `where` selects in the org (rows the caller chose). */
608
- async function cancelEnableWhere(db, orgId, where, actor, reason) {
620
+ /**
621
+ * Cancels the pending enable requests `where` selects in the org (rows the caller chose); the
622
+ * cancelled rows publish `requests` after the commit ({@link publishRequestHints}).
623
+ */
624
+ async function cancelEnableWhere(db, hints, orgId, where, actor, reason) {
609
625
  // rows locked in id order first, as settlement and reconciliation lock them (no deadlock)
610
626
  const locked = await db
611
627
  .selectFrom("catalog_requests")
@@ -632,8 +648,9 @@ async function cancelEnableWhere(db, orgId, where, actor, reason) {
632
648
  })
633
649
  .where("org_id", "=", orgId)
634
650
  .where("id", "in", locked.map((r) => r.id))
635
- .returning(["id", "detail"])
651
+ .returning(["id", "org_id", "requested_by", "kind", "detail"])
636
652
  .execute();
653
+ publishRequestHints(hints, rows);
637
654
  for (const r of rows) {
638
655
  await audit(db, {
639
656
  actorAccountId: actor,
@@ -650,16 +667,16 @@ async function cancelEnableWhere(db, orgId, where, actor, reason) {
650
667
  * are stale (the plugin is their owning switch now) and are cancelled with
651
668
  * `cancelReason: "target_changed"`. Called by `ScopeWriter.setOrgSwitch` (plugin off).
652
669
  */
653
- export function cancelEnableRequestsOfBundle(db, orgId, itemId, actor) {
654
- return cancelEnableWhere(db, orgId, sql `detail ->> 'bundle' = ${itemId}`, actor, "target_changed");
670
+ export function cancelEnableRequestsOfBundle(db, hints, orgId, itemId, actor) {
671
+ return cancelEnableWhere(db, hints, orgId, sql `detail ->> 'bundle' = ${itemId}`, actor, "target_changed");
655
672
  }
656
673
  /**
657
674
  * A model provider extension was switched off in the org, in the writer's transaction: pending
658
675
  * requests for its models are stale (the extension is their owning switch now). Called by
659
676
  * `OrgExtensionConfigs` (extension off).
660
677
  */
661
- export function cancelEnableRequestsOfProvider(db, orgId, provider, actor) {
662
- return cancelEnableWhere(db, orgId,
678
+ export function cancelEnableRequestsOfProvider(db, hints, orgId, provider, actor) {
679
+ return cancelEnableWhere(db, hints, orgId,
663
680
  // a prefix match of the canonical tuple: never parses another row's id (nothing can throw)
664
681
  sql `detail -> 'target' ->> 'kind' = 'model' AND starts_with(detail -> 'target' ->> 'id', '[' || to_jsonb(${provider}::text)::text || ',')`, actor, "target_changed");
665
682
  }
@@ -668,15 +685,15 @@ export function cancelEnableRequestsOfProvider(db, orgId, provider, actor) {
668
685
  * switch now) or removed (`connector_removed`, no notice), in the writer's transaction: pending
669
686
  * requests for it are cancelled. Called by `ConnectorsService.disableWithPluginIn` and `removeIn`.
670
687
  */
671
- export function cancelEnableRequestsOfConnector(db, orgId, connectorId, actor, reason) {
672
- return cancelEnableWhere(db, orgId, sql `detail -> 'target' ->> 'kind' = 'connector' AND detail -> 'target' ->> 'id' = ${connectorId}`, actor, reason);
688
+ export function cancelEnableRequestsOfConnector(db, hints, orgId, connectorId, actor, reason) {
689
+ return cancelEnableWhere(db, hints, orgId, sql `detail -> 'target' ->> 'kind' = 'connector' AND detail -> 'target' ->> 'id' = ${connectorId}`, actor, reason);
673
690
  }
674
691
  /**
675
692
  * The platform disabled models of a provider, in its transaction: every org's pending requests
676
693
  * for them (as target or subject) are cancelled; the model is hidden from the orgs, so no "ask
677
694
  * again" notice. Called by `ModelEnablement.setPlatform`.
678
695
  */
679
- export async function cancelEnableRequestsOfPlatformModels(db, provider, models, actor) {
696
+ export async function cancelEnableRequestsOfPlatformModels(db, hints, provider, models, actor) {
680
697
  if (models.length === 0)
681
698
  return;
682
699
  const ids = models.map((m) => JSON.stringify([provider, m]));
@@ -702,10 +719,12 @@ export async function cancelEnableRequestsOfPlatformModels(db, provider, models,
702
719
  .updateTable("catalog_requests")
703
720
  .set({ status: "cancelled", decided_by: actor, decided_at: sql `now()` })
704
721
  .where("id", "in", locked.map((r) => r.id))
705
- .returning(["id", "org_id", "detail"])
722
+ .returning(["id", "org_id", "requested_by", "kind", "detail"])
706
723
  .execute();
707
724
  return found;
708
725
  });
726
+ // the cancelled rows' requesters, followers and orgs' admins (the orgs the rows name)
727
+ publishRequestHints(hints, rows);
709
728
  for (const r of rows) {
710
729
  await withOrgScope(r.org_id, () => audit(db, {
711
730
  actorAccountId: actor,
@@ -729,7 +748,7 @@ export async function cancelEnableRequestsOfPlatformModels(db, provider, models,
729
748
  * cancels it with `cancelReason: "target_changed"`. Called by `writeScope` (every scope write),
730
749
  * `ScopeWriter.setDisabled` and the unshare paths.
731
750
  */
732
- export async function reconcileEnableRequestsOf(db, subject, actor) {
751
+ export async function reconcileEnableRequestsOf(db, hints, subject, actor) {
733
752
  if (subject.kind === "theme")
734
753
  return;
735
754
  const kind = subject.kind;
@@ -757,7 +776,7 @@ export async function reconcileEnableRequestsOf(db, subject, actor) {
757
776
  byOrg.set(r.org_id, [...(byOrg.get(r.org_id) ?? []), r]);
758
777
  for (const [orgId, list] of byOrg) {
759
778
  // each org's requests are checked and written in that org's scope
760
- await withOrgScope(orgId, () => settleRequestRows(db, orgId, list, { kind: "reconcile" }, () => ({ actor })));
779
+ await withOrgScope(orgId, () => settleRequestRows(db, hints, orgId, list, { kind: "reconcile" }, () => ({ actor })));
761
780
  }
762
781
  }
763
782
  /** Whether the request's subject is its target (a legacy row without a subject counts as one). */
@@ -209,7 +209,7 @@ export declare function headsToResolve(entries: readonly MarketplaceEntry[], imp
209
209
  /** The host versions (an entry's `minKernel` is judged against them). */
210
210
  export declare const HOST_VERSIONS: {
211
211
  readonly kernel: string;
212
- readonly sdk: "0.1.0-rc.101";
212
+ readonly sdk: "0.1.0-rc.102";
213
213
  };
214
214
  /** Whether this deployment satisfies the entry's `minKernel`. */
215
215
  export declare const entryCompatible: (e: Pick<MarketplaceEntry, "minKernel">) => boolean;
@@ -2,6 +2,7 @@ import { KernelDb } from "../infra/database/kernel-db.js";
2
2
  import { TransactionHost } from "../infra/database/transaction-host.js";
3
3
  import { XactLock } from "../infra/database/xact-lock.js";
4
4
  import { KernelEvents } from "../infra/events/kernel-events.js";
5
+ import type { HintPublisher } from "../invalidation/audiences.js";
5
6
  import type { KernelLogger } from "../log.js";
6
7
  import { OrgLock } from "../orgs/org-lock.js";
7
8
  import { SkillsService } from "../skills/skills.service.js";
@@ -50,11 +51,12 @@ export declare class OwnedItems {
50
51
  readonly txHost: TransactionHost;
51
52
  private readonly xactLock;
52
53
  private readonly events;
54
+ private readonly hints;
53
55
  constructor(kdb: KernelDb, orgLock: OrgLock, catalog: CatalogService, scope: CatalogScopeService,
54
56
  /** The owner org's own uninstall of a removed plugin (ruling P3-41). */
55
57
  installer: PluginInstaller,
56
58
  /** The owner's org skill row, soft-deleted after its promoted platform row leaves it. */
57
- skills: SkillsService, log: KernelLogger, txHost: TransactionHost, xactLock: XactLock, events: KernelEvents);
59
+ skills: SkillsService, log: KernelLogger, txHost: TransactionHost, xactLock: XactLock, events: KernelEvents, hints: HintPublisher);
58
60
  private get db();
59
61
  /**
60
62
  * The owner org's 可共享 flag of its item, written on the item and (a plugin) every component
@@ -28,6 +28,7 @@ import { Transactional } from "../infra/database/transactional.decorator.js";
28
28
  import { XactLock } from "../infra/database/xact-lock.js";
29
29
  import { KernelEvents } from "../infra/events/kernel-events.js";
30
30
  import { KERNEL_LOGGER } from "../infra/tokens.js";
31
+ import { InvalidationHints } from "../invalidation/invalidation-hints.js";
31
32
  import { OrgLock } from "../orgs/org-lock.js";
32
33
  import { SkillsService } from "../skills/skills.service.js";
33
34
  import { assertNotPlatformDefault } from "../themes/theme-usage.js";
@@ -86,11 +87,12 @@ let OwnedItems = class OwnedItems {
86
87
  txHost;
87
88
  xactLock;
88
89
  events;
90
+ hints;
89
91
  constructor(kdb, orgLock, catalog, scope,
90
92
  /** The owner org's own uninstall of a removed plugin (ruling P3-41). */
91
93
  installer,
92
94
  /** The owner's org skill row, soft-deleted after its promoted platform row leaves it. */
93
- skills, log, txHost, xactLock, events) {
95
+ skills, log, txHost, xactLock, events, hints) {
94
96
  this.kdb = kdb;
95
97
  this.orgLock = orgLock;
96
98
  this.catalog = catalog;
@@ -101,6 +103,7 @@ let OwnedItems = class OwnedItems {
101
103
  this.txHost = txHost;
102
104
  this.xactLock = xactLock;
103
105
  this.events = events;
106
+ this.hints = hints;
104
107
  }
105
108
  get db() {
106
109
  return this.kdb.db;
@@ -164,8 +167,8 @@ let OwnedItems = class OwnedItems {
164
167
  .where("id", "=", c.id)
165
168
  .execute();
166
169
  if (!shareable) {
167
- await narrowComponentOnUnshare(this.db, actor, c);
168
- await reconcileEnableRequestsOf(this.db, { kind, id: c.id }, actor);
170
+ await narrowComponentOnUnshare(this.db, this.hints, actor, c);
171
+ await reconcileEnableRequestsOf(this.db, this.hints, { kind, id: c.id }, actor);
169
172
  }
170
173
  }
171
174
  }
@@ -443,7 +446,7 @@ let OwnedItems = class OwnedItems {
443
446
  if (item.scope === "all") {
444
447
  // org-filter: deployment-wide rewrite of the transferred item's named list.
445
448
  await asPlatform("replace the transferred plugin's named scope", async () => {
446
- await writeScope(t, {
449
+ await writeScope(t, this.hints, {
447
450
  kind: "plugin",
448
451
  id: item.id,
449
452
  scope: "named",
@@ -458,7 +461,7 @@ let OwnedItems = class OwnedItems {
458
461
  .where("org_id", "=", owner)
459
462
  .execute();
460
463
  // the former owner's named entry went: its pending enable requests are checked again
461
- await reconcileEnableRequestsOf(t, { kind: "plugin", id: item.id }, actor);
464
+ await reconcileEnableRequestsOf(t, this.hints, { kind: "plugin", id: item.id }, actor);
462
465
  }
463
466
  await t
464
467
  .deleteFrom("catalog_item_org_switches")
@@ -506,7 +509,7 @@ let OwnedItems = class OwnedItems {
506
509
  .select(["id", "name"])
507
510
  .where("id", "=", owner)
508
511
  .executeTakeFirst();
509
- await addPlatformNotice(t, "ownership_transferred", {
512
+ await addPlatformNotice(t, this.hints, "ownership_transferred", {
510
513
  ref,
511
514
  name: item.name,
512
515
  fromOrg: from ?? { id: owner, name: owner },
@@ -643,7 +646,7 @@ let OwnedItems = class OwnedItems {
643
646
  .select(["id", "name"])
644
647
  .where("id", "=", owner)
645
648
  .executeTakeFirst();
646
- await addPlatformNotice(t, "ownership_transferred", {
649
+ await addPlatformNotice(t, this.hints, "ownership_transferred", {
647
650
  ref,
648
651
  name: c.name,
649
652
  fromOrg: from ?? { id: owner, name: owner },
@@ -684,7 +687,7 @@ let OwnedItems = class OwnedItems {
684
687
  /** Replaces a transferred component's named list in the transfer's transaction. */
685
688
  async replaceComponentScope(kind, id, orgs) {
686
689
  // org-filter: deployment-wide rewrite of the transferred component's named list.
687
- await asPlatform("replace the transferred component's named scope", () => writeScope(this.db, { kind, id, scopeMode: "own", scope: "named", orgs }));
690
+ await asPlatform("replace the transferred component's named scope", () => writeScope(this.db, this.hints, { kind, id, scopeMode: "own", scope: "named", orgs }));
688
691
  }
689
692
  /**
690
693
  * The owner org's live install of a removed plugin, uninstalled in the caller's transaction
@@ -781,6 +784,7 @@ OwnedItems = __decorate([
781
784
  __param(6, Inject(KERNEL_LOGGER)),
782
785
  __param(7, Inject(TransactionHost)),
783
786
  __param(8, Inject(XactLock)),
784
- __param(9, Inject(KernelEvents))
787
+ __param(9, Inject(KernelEvents)),
788
+ __param(10, Inject(InvalidationHints))
785
789
  ], OwnedItems);
786
790
  export { OwnedItems };
@@ -2,6 +2,7 @@ import { type AgentTemplate, type ConnectorTemplateFile, type ParsedTheme, type
2
2
  import type { SkillManifest, SourceFormat } from "../db/kernel-schema.js";
3
3
  import { KernelDb } from "../infra/database/kernel-db.js";
4
4
  import { TransactionHost } from "../infra/database/transaction-host.js";
5
+ import type { HintPublisher } from "../invalidation/audiences.js";
5
6
  import type { KernelLogger } from "../log.js";
6
7
  import { type SkillPackageFile } from "../skills/package.js";
7
8
  import { type PrefixedStorage, StorageService } from "../storage/storage.service.js";
@@ -176,9 +177,13 @@ export declare class PlatformComponents {
176
177
  private readonly itemLock;
177
178
  private readonly log;
178
179
  readonly txHost: TransactionHost;
180
+ /** The connectors a re-import relinks publish `capabilities` to their orgs. */
181
+ private readonly hints;
179
182
  /** Where the files are read and written (the kernel's object storage; the CLI's own). */
180
183
  private files;
181
- constructor(kdb: KernelDb, storage: StorageService, itemLock: CatalogItemLock, log: KernelLogger, txHost: TransactionHost);
184
+ constructor(kdb: KernelDb, storage: StorageService, itemLock: CatalogItemLock, log: KernelLogger, txHost: TransactionHost,
185
+ /** The connectors a re-import relinks publish `capabilities` to their orgs. */
186
+ hints: HintPublisher);
182
187
  private get db();
183
188
  initializeDependencyEdges(): Promise<void>;
184
189
  /** CLI only (see `PluginImport.useCliStorage`): files go to the object store the CLI set up. */
@@ -22,6 +22,7 @@ import { KernelDb } from "../infra/database/kernel-db.js";
22
22
  import { TransactionHost } from "../infra/database/transaction-host.js";
23
23
  import { Transactional } from "../infra/database/transactional.decorator.js";
24
24
  import { KERNEL_LOGGER } from "../infra/tokens.js";
25
+ import { InvalidationHints } from "../invalidation/invalidation-hints.js";
25
26
  import { packagePath } from "../packages/tgz.js";
26
27
  import { readSkillPackage, skillManifest } from "../skills/package.js";
27
28
  import { StorageService } from "../storage/storage.service.js";
@@ -67,13 +68,17 @@ let PlatformComponents = class PlatformComponents {
67
68
  itemLock;
68
69
  log;
69
70
  txHost;
71
+ hints;
70
72
  /** Where the files are read and written (the kernel's object storage; the CLI's own). */
71
73
  files;
72
- constructor(kdb, storage, itemLock, log, txHost) {
74
+ constructor(kdb, storage, itemLock, log, txHost,
75
+ /** The connectors a re-import relinks publish `capabilities` to their orgs. */
76
+ hints) {
73
77
  this.kdb = kdb;
74
78
  this.itemLock = itemLock;
75
79
  this.log = log;
76
80
  this.txHost = txHost;
81
+ this.hints = hints;
77
82
  this.files = storage;
78
83
  }
79
84
  get db() {
@@ -753,7 +758,7 @@ let PlatformComponents = class PlatformComponents {
753
758
  // made move to this one, and its installs take them back (spec §5 rule 8). Their orgs are
754
759
  // not locked: nothing else writes a deleted plugin's connectors but their org's admins,
755
760
  // whose row locks this waits for without holding anything they need
756
- await relinkDeletedItemConnectors(t, {
761
+ await relinkDeletedItemConnectors(t, this.hints, {
757
762
  itemId: plan.itemId,
758
763
  name: plan.plugin,
759
764
  ownerOrgId,
@@ -857,7 +862,8 @@ PlatformComponents = __decorate([
857
862
  __param(1, Inject(StorageService)),
858
863
  __param(2, Inject(CatalogItemLock)),
859
864
  __param(3, Inject(KERNEL_LOGGER)),
860
- __param(4, Inject(TransactionHost))
865
+ __param(4, Inject(TransactionHost)),
866
+ __param(5, Inject(InvalidationHints))
861
867
  ], PlatformComponents);
862
868
  export { PlatformComponents };
863
869
  /** An org's own item it promoted (ruling P3-3): owned by an org, from no plugin. */
@@ -1,4 +1,5 @@
1
1
  import type { KernelSchemaDb } from "../db/kernel-schema.js";
2
+ import { type HintPublisher } from "../invalidation/audiences.js";
2
3
  /**
3
4
  * The update that switches a connector off with plugin `itemId`: status `disabled`, and the marker
4
5
  * set only on a connector that was active, so switching the plugin back on re-enables exactly what
@@ -14,18 +15,21 @@ export declare function pluginSwitchOff(itemId: string): {
14
15
  * Switches off, in the caller's transaction, every live connector in any org made from one of the
15
16
  * item's connector templates ({@link pluginSwitchOff}): the super admin's delete of the item
16
17
  * (`CatalogService.removeIn`). The caller holds the orgs' row locks where it can (the global lock
17
- * order puts them before the item). Returns how many connectors it touched.
18
+ * order puts them before the item). Each org whose connectors it touched gets `capabilities` after
19
+ * the commit (the orgs the update returns). Returns how many connectors it touched.
18
20
  */
19
- export declare function switchOffItemConnectors(db: KernelSchemaDb, itemId: string): Promise<number>;
21
+ export declare function switchOffItemConnectors(db: KernelSchemaDb, hints: HintPublisher, itemId: string): Promise<number>;
20
22
  /**
21
23
  * When a plugin is imported again after its delete (a new catalog item of the same name and
22
24
  * owner), the live connectors that the deleted items' connector template `templateId` made move to
23
25
  * the new item's template `newTemplateId`: their template, item and version links point at the new
24
26
  * item, and a marker of a deleted item's switch-off becomes the new item's, so the new item's
25
27
  * install takes them back and re-enables them exactly as switching the plugin back on does (one an
26
- * org admin disabled by hand stays off). In the caller's transaction, under the item lock.
28
+ * org admin disabled by hand stays off). In the caller's transaction, under the item lock. Each
29
+ * org whose connectors moved gets `capabilities` after the commit (its connector list names the
30
+ * new plugin).
27
31
  */
28
- export declare function relinkDeletedItemConnectors(db: KernelSchemaDb, to: {
32
+ export declare function relinkDeletedItemConnectors(db: KernelSchemaDb, hints: HintPublisher, to: {
29
33
  itemId: string;
30
34
  name: string;
31
35
  ownerOrgId: string | null;
@@ -1,4 +1,5 @@
1
1
  import { sql } from "kysely";
2
+ import { publishCapabilities } from "../invalidation/audiences.js";
2
3
  // The connectors a plugin's connector templates made, switched off and on with the plugin (spec §5
3
4
  // rule 8): an org's uninstall or switch-off (`ConnectorsService.disableWithPluginIn`), the super
4
5
  // admin's delete of the plugin ({@link switchOffItemConnectors}) and an import of the same plugin
@@ -21,9 +22,10 @@ export function pluginSwitchOff(itemId) {
21
22
  * Switches off, in the caller's transaction, every live connector in any org made from one of the
22
23
  * item's connector templates ({@link pluginSwitchOff}): the super admin's delete of the item
23
24
  * (`CatalogService.removeIn`). The caller holds the orgs' row locks where it can (the global lock
24
- * order puts them before the item). Returns how many connectors it touched.
25
+ * order puts them before the item). Each org whose connectors it touched gets `capabilities` after
26
+ * the commit (the orgs the update returns). Returns how many connectors it touched.
25
27
  */
26
- export async function switchOffItemConnectors(db, itemId) {
28
+ export async function switchOffItemConnectors(db, hints, itemId) {
27
29
  // org-filter: the delete of a catalog item switches off its template connectors in every org
28
30
  // by design (spec §5 rule 8), keyed by the item's own template ids
29
31
  const rows = await db
@@ -34,8 +36,9 @@ export async function switchOffItemConnectors(db, itemId) {
34
36
  .selectFrom("platform_connector_templates")
35
37
  .select("id")
36
38
  .where("catalog_item_id", "=", itemId))
37
- .returning("id")
39
+ .returning(["id", "org_id"])
38
40
  .execute();
41
+ publishCapabilities(hints, rows.map((r) => r.org_id));
39
42
  return rows.length;
40
43
  }
41
44
  /**
@@ -44,9 +47,11 @@ export async function switchOffItemConnectors(db, itemId) {
44
47
  * the new item's template `newTemplateId`: their template, item and version links point at the new
45
48
  * item, and a marker of a deleted item's switch-off becomes the new item's, so the new item's
46
49
  * install takes them back and re-enables them exactly as switching the plugin back on does (one an
47
- * org admin disabled by hand stays off). In the caller's transaction, under the item lock.
50
+ * org admin disabled by hand stays off). In the caller's transaction, under the item lock. Each
51
+ * org whose connectors moved gets `capabilities` after the commit (its connector list names the
52
+ * new plugin).
48
53
  */
49
- export async function relinkDeletedItemConnectors(db, to) {
54
+ export async function relinkDeletedItemConnectors(db, hints, to) {
50
55
  // The deleted items of this plugin (its name, the same owner) and their template `templateId`
51
56
  const old = await db
52
57
  .selectFrom("platform_connector_templates as t")
@@ -75,7 +80,8 @@ export async function relinkDeletedItemConnectors(db, to) {
75
80
  })
76
81
  .where("deleted_at", "is", null)
77
82
  .where("platform_template_id", "in", old.map((r) => r.id))
78
- .returning("id")
83
+ .returning(["id", "org_id"])
79
84
  .execute();
85
+ publishCapabilities(hints, rows.map((r) => r.org_id));
80
86
  return rows.length;
81
87
  }
@@ -17,6 +17,7 @@ import { KernelDb } from "../infra/database/kernel-db.js";
17
17
  import { TransactionHost } from "../infra/database/transaction-host.js";
18
18
  import { XactLock } from "../infra/database/xact-lock.js";
19
19
  import { OutboxService } from "../infra/outbox/outbox.service.js";
20
+ import type { HintPublisher } from "../invalidation/audiences.js";
20
21
  import type { KernelLogger } from "../log.js";
21
22
  import { OrgLock } from "../orgs/org-lock.js";
22
23
  import type { ProvenanceResult } from "../packages/provenance.js";
@@ -427,6 +428,7 @@ export declare class PluginImport {
427
428
  private readonly platform;
428
429
  /** The item's scope sync, owed by the confirm's commit when it deploys no extension. */
429
430
  private readonly outbox;
431
+ private readonly hints;
430
432
  /** Where plugin files go (the kernel's object storage; the CLI's own, see {@link useCliStorage}). */
431
433
  private files;
432
434
  /**
@@ -447,7 +449,7 @@ export declare class PluginImport {
447
449
  /** The platform rows of a new item's components, written in the confirm's transaction. */
448
450
  platform: PlatformComponents,
449
451
  /** The item's scope sync, owed by the confirm's commit when it deploys no extension. */
450
- outbox: Pick<OutboxService, "add" | "addMany">);
452
+ outbox: Pick<OutboxService, "add" | "addMany">, hints: HintPublisher);
451
453
  /** The kernel-schema handle of the current context (the transaction, else the pool). */
452
454
  private get db();
453
455
  /**
@@ -37,6 +37,7 @@ import { Transactional } from "../infra/database/transactional.decorator.js";
37
37
  import { XactLock } from "../infra/database/xact-lock.js";
38
38
  import { OutboxService } from "../infra/outbox/outbox.service.js";
39
39
  import { KERNEL_LOGGER } from "../infra/tokens.js";
40
+ import { InvalidationHints } from "../invalidation/invalidation-hints.js";
40
41
  import { OrgLock } from "../orgs/org-lock.js";
41
42
  import { sha512Hex } from "../packages/provenance.js";
42
43
  import { packagePath, packPackageTgz } from "../packages/tgz.js";
@@ -168,6 +169,7 @@ let PluginImport = class PluginImport {
168
169
  xactLock;
169
170
  platform;
170
171
  outbox;
172
+ hints;
171
173
  /** Where plugin files go (the kernel's object storage; the CLI's own, see {@link useCliStorage}). */
172
174
  files;
173
175
  /**
@@ -188,7 +190,7 @@ let PluginImport = class PluginImport {
188
190
  /** The platform rows of a new item's components, written in the confirm's transaction. */
189
191
  platform,
190
192
  /** The item's scope sync, owed by the confirm's commit when it deploys no extension. */
191
- outbox) {
193
+ outbox, hints) {
192
194
  this.kdb = kdb;
193
195
  this.adminLock = adminLock;
194
196
  this.orgLock = orgLock;
@@ -207,6 +209,7 @@ let PluginImport = class PluginImport {
207
209
  this.xactLock = xactLock;
208
210
  this.platform = platform;
209
211
  this.outbox = outbox;
212
+ this.hints = hints;
210
213
  this.files = storage;
211
214
  }
212
215
  /** The kernel-schema handle of the current context (the transaction, else the pool). */
@@ -1004,7 +1007,12 @@ let PluginImport = class PluginImport {
1004
1007
  .where("id", "=", itemId)
1005
1008
  .execute();
1006
1009
  }
1007
- await writeScope(t, { kind: "plugin", id: itemId, scope: scope.scope, orgs: scope.orgs });
1010
+ await writeScope(t, this.hints, {
1011
+ kind: "plugin",
1012
+ id: itemId,
1013
+ scope: scope.scope,
1014
+ orgs: scope.orgs,
1015
+ });
1008
1016
  }
1009
1017
  // The org requests this staging answers resolve with the confirm; on an item that existed
1010
1018
  // already (imported meanwhile) a `named` scope gains their orgs. An org-owned item held back by
@@ -1021,10 +1029,10 @@ let PluginImport = class PluginImport {
1021
1029
  if (item !== undefined && !shareGate(item) && (await hasImportRequests(t, stagingId))) {
1022
1030
  assertShareable(item);
1023
1031
  }
1024
- const requestOrgs = await resolveImportRequests(t, stagingId, itemId, actor, opts);
1032
+ const requestOrgs = await resolveImportRequests(t, this.hints, stagingId, itemId, actor, opts);
1025
1033
  if (item !== undefined) {
1026
1034
  for (const org of requestOrgs)
1027
- await addScopeOrg(t, actor, item, org, opts);
1035
+ await addScopeOrg(t, this.hints, actor, item, org, opts);
1028
1036
  }
1029
1037
  if (owner !== undefined && created)
1030
1038
  await markVersionApplied(t, itemId, staged.version);
@@ -1647,7 +1655,8 @@ PluginImport = __decorate([
1647
1655
  __param(15, Inject(TransactionHost)),
1648
1656
  __param(16, Inject(XactLock)),
1649
1657
  __param(17, Inject(PlatformComponents)),
1650
- __param(18, Inject(OutboxService))
1658
+ __param(18, Inject(OutboxService)),
1659
+ __param(19, Inject(InvalidationHints))
1651
1660
  ], PluginImport);
1652
1661
  export { PluginImport };
1653
1662
  /**
@@ -5,6 +5,7 @@ import { ExtensionRegistry } from "../extensions/registry.js";
5
5
  import { KernelDb } from "../infra/database/kernel-db.js";
6
6
  import { TransactionHost } from "../infra/database/transaction-host.js";
7
7
  import { OutboxService } from "../infra/outbox/outbox.service.js";
8
+ import type { HintPublisher } from "../invalidation/audiences.js";
8
9
  import { OrgLock } from "../orgs/org-lock.js";
9
10
  import type { OrgAction } from "../orgs/roles.js";
10
11
  import { type SkillConflict, SkillsService } from "../skills/skills.service.js";
@@ -267,6 +268,7 @@ export declare class PluginInstaller {
267
268
  /** Owes the template connector ensure of an install's commit (`markInstalled`). */
268
269
  private readonly outbox;
269
270
  readonly txHost: TransactionHost;
271
+ private readonly hints;
270
272
  constructor(kdb: KernelDb,
271
273
  /** The org row lock (orgs/org-lock.ts): joins the caller's transaction. */
272
274
  orgLock: OrgLock, storage: StorageService,
@@ -275,7 +277,7 @@ export declare class PluginInstaller {
275
277
  /** Org connectors: installs create, upgrade and remove them. */
276
278
  connectors: ConnectorsService,
277
279
  /** Owes the template connector ensure of an install's commit (`markInstalled`). */
278
- outbox: Pick<OutboxService, "add">, txHost: TransactionHost);
280
+ outbox: Pick<OutboxService, "add">, txHost: TransactionHost, hints: HintPublisher);
279
281
  /** The kernel-schema handle of the current context (the transaction, else the pool). */
280
282
  private get db();
281
283
  /**
@@ -22,6 +22,7 @@ import { KernelDb } from "../infra/database/kernel-db.js";
22
22
  import { TransactionHost } from "../infra/database/transaction-host.js";
23
23
  import { Transactional } from "../infra/database/transactional.decorator.js";
24
24
  import { OutboxService } from "../infra/outbox/outbox.service.js";
25
+ import { InvalidationHints } from "../invalidation/invalidation-hints.js";
25
26
  import { OrgLock } from "../orgs/org-lock.js";
26
27
  import { packagePath } from "../packages/tgz.js";
27
28
  import { SkillsService, skillConflictError, skillConflicts, } from "../skills/skills.service.js";
@@ -270,6 +271,7 @@ let PluginInstaller = class PluginInstaller {
270
271
  connectors;
271
272
  outbox;
272
273
  txHost;
274
+ hints;
273
275
  constructor(kdb,
274
276
  /** The org row lock (orgs/org-lock.ts): joins the caller's transaction. */
275
277
  orgLock, storage,
@@ -278,7 +280,7 @@ let PluginInstaller = class PluginInstaller {
278
280
  /** Org connectors: installs create, upgrade and remove them. */
279
281
  connectors,
280
282
  /** Owes the template connector ensure of an install's commit (`markInstalled`). */
281
- outbox, txHost) {
283
+ outbox, txHost, hints) {
282
284
  this.kdb = kdb;
283
285
  this.orgLock = orgLock;
284
286
  this.storage = storage;
@@ -289,6 +291,7 @@ let PluginInstaller = class PluginInstaller {
289
291
  this.connectors = connectors;
290
292
  this.outbox = outbox;
291
293
  this.txHost = txHost;
294
+ this.hints = hints;
292
295
  }
293
296
  /** The kernel-schema handle of the current context (the transaction, else the pool). */
294
297
  get db() {
@@ -872,7 +875,7 @@ let PluginInstaller = class PluginInstaller {
872
875
  }
873
876
  if (!appliesOrgEffects(plan)) {
874
877
  if (ctx.parent === undefined) {
875
- await resolveRequestsByInstall(t, orgId, itemId, actor, opts);
878
+ await resolveRequestsByInstall(t, this.hints, orgId, itemId, actor, opts);
876
879
  if (ctx.switchOn === true) {
877
880
  await audit(t, {
878
881
  actorAccountId: actor,
@@ -938,7 +941,7 @@ let PluginInstaller = class PluginInstaller {
938
941
  if (updated.numUpdatedRows === 0n) {
939
942
  throw new ApiError("plugin.install_not_found", "The install record was cleaned up as stale while the install was running");
940
943
  }
941
- await resolveRequestsByInstall(t, orgId, itemId, actor, opts);
944
+ await resolveRequestsByInstall(t, this.hints, orgId, itemId, actor, opts);
942
945
  // The org's choice of connector templates is written with the install too: the chosen ones on,
943
946
  // the ones left out off (they stay available on the connectors page)
944
947
  for (const sw of ctx.via === "scope" ? [] : plan.templateSwitches) {
@@ -1980,7 +1983,8 @@ PluginInstaller = __decorate([
1980
1983
  __param(6, Inject(ScopeWriter)),
1981
1984
  __param(7, Inject(ConnectorsService)),
1982
1985
  __param(8, Inject(OutboxService)),
1983
- __param(9, Inject(TransactionHost))
1986
+ __param(9, Inject(TransactionHost)),
1987
+ __param(10, Inject(InvalidationHints))
1984
1988
  ], PluginInstaller);
1985
1989
  export { PluginInstaller };
1986
1990
  /**