@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
@@ -1,4 +1,4 @@
1
- import type { SuggestedAppearance } from "@capybara-hq/plugin-sdk";
1
+ import { type PluginManifest, type SuggestedAppearance } from "@capybara-hq/plugin-sdk";
2
2
  import type { FastifyReply } from "fastify";
3
3
  import { z } from "zod";
4
4
  import { type ClientBuildSummary, ClientBuilds } from "../client/client-builds.service.js";
@@ -32,6 +32,67 @@ declare const ConfirmPermissionsBody: z.ZodObject<{
32
32
  * disable (previewed, then confirmed with `scopeHash`), delete. Writes re-check the super admin inside the service's lock and are
33
33
  * audited.
34
34
  */
35
+ /** Keep the catalog UI on normalized declaration values while artifacts retain authoring rows. */
36
+ declare function catalogManifestForDisplay(manifest: PluginManifest): {
37
+ $schema?: string;
38
+ schemaVersion: 1;
39
+ name: string;
40
+ version: string;
41
+ publisher: string;
42
+ description: import("@capybara-hq/plugin-sdk").PluginDescription;
43
+ displayName?: import("@capybara-hq/plugin-sdk").LocalizedName;
44
+ icon?: string;
45
+ license?: string;
46
+ homepage?: string;
47
+ dependencies?: import("@capybara-hq/plugin-sdk").PluginDependency[];
48
+ skills?: import("@capybara-hq/plugin-sdk").PluginSkillRef[];
49
+ connectorTemplates?: import("@capybara-hq/plugin-sdk").PluginConnectorTemplateRef[];
50
+ agents?: import("@capybara-hq/plugin-sdk").PluginAgentRef[];
51
+ themes?: import("@capybara-hq/plugin-sdk").PluginThemeRef[];
52
+ setupGuides?: import("@capybara-hq/plugin-sdk").PluginSetupGuide[];
53
+ suggestedAppearance?: SuggestedAppearance;
54
+ } | {
55
+ $schema?: string;
56
+ schemaVersion: 1;
57
+ name: string;
58
+ version: string;
59
+ publisher: string;
60
+ description: import("@capybara-hq/plugin-sdk").PluginDescription;
61
+ displayName?: import("@capybara-hq/plugin-sdk").LocalizedName;
62
+ icon?: string;
63
+ license?: string;
64
+ homepage?: string;
65
+ dependencies?: import("@capybara-hq/plugin-sdk").PluginDependency[];
66
+ skills?: import("@capybara-hq/plugin-sdk").PluginSkillRef[];
67
+ connectorTemplates?: import("@capybara-hq/plugin-sdk").PluginConnectorTemplateRef[];
68
+ agents?: import("@capybara-hq/plugin-sdk").PluginAgentRef[];
69
+ themes?: import("@capybara-hq/plugin-sdk").PluginThemeRef[];
70
+ setupGuides?: import("@capybara-hq/plugin-sdk").PluginSetupGuide[];
71
+ suggestedAppearance?: SuggestedAppearance;
72
+ extension: {
73
+ entry: string;
74
+ migrations?: string;
75
+ ui?: string;
76
+ configSchemas?: {
77
+ deployment?: import("@capybara-hq/plugin-sdk").JsonSchema;
78
+ };
79
+ client?: import("@capybara-hq/plugin-sdk").PluginClientSection;
80
+ manifest: {
81
+ name: string;
82
+ version: string;
83
+ sdk: string;
84
+ tables?: import("@capybara-hq/plugin-sdk").PermissionDeclaration<string>[];
85
+ ui?: import("@capybara-hq/plugin-sdk").ExtensionManifest["ui"];
86
+ config: {
87
+ deployment: import("@capybara-hq/plugin-sdk").StaticConfigField[];
88
+ };
89
+ provides: string[];
90
+ requires: string[];
91
+ optional: string[];
92
+ permissions: import("@capybara-hq/plugin-sdk").ExtensionPermissions;
93
+ };
94
+ };
95
+ };
35
96
  export declare class AdminCatalogController {
36
97
  private readonly catalog;
37
98
  private readonly pluginImport;
@@ -141,7 +202,8 @@ export declare class AdminCatalogController {
141
202
  * §5.4). Unknown -> 404 `catalog.item_not_found`.
142
203
  */
143
204
  get(id: string): Promise<Omit<CatalogItemDetail, "versions"> & {
144
- versions: (CatalogItemDetail["versions"][number] & {
205
+ versions: (Omit<CatalogItemDetail["versions"][number], "manifest"> & {
206
+ manifest: ReturnType<typeof catalogManifestForDisplay>;
145
207
  client: ClientBuildSummary | null;
146
208
  })[];
147
209
  hasIcon: boolean;
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __param = (this && this.__param) || function (paramIndex, decorator) {
8
8
  return function (target, key) { decorator(target, key, paramIndex); }
9
9
  };
10
+ import { staticPermissionDeclarations, } from "@capybara-hq/plugin-sdk";
10
11
  import { Controller, Delete, Get, HttpCode, Inject, Param, Post, Put, Req, Res, } from "@nestjs/common";
11
12
  import { z } from "zod";
12
13
  import { ClientBuilds } from "../client/client-builds.service.js";
@@ -73,6 +74,21 @@ class AppearanceApplyBodyDto extends createZodDto(AppearanceApplyBody, "Appearan
73
74
  * disable (previewed, then confirmed with `scopeHash`), delete. Writes re-check the super admin inside the service's lock and are
74
75
  * audited.
75
76
  */
77
+ /** Keep the catalog UI on normalized declaration values while artifacts retain authoring rows. */
78
+ function catalogManifestForDisplay(manifest) {
79
+ const section = manifest.extension;
80
+ const { extension: _extension, ...rest } = manifest;
81
+ if (!section)
82
+ return rest;
83
+ const { provides, requires, optional, permissions } = staticPermissionDeclarations(section.manifest);
84
+ return {
85
+ ...rest,
86
+ extension: {
87
+ ...section,
88
+ manifest: { ...section.manifest, provides, requires, optional, permissions },
89
+ },
90
+ };
91
+ }
76
92
  let AdminCatalogController = class AdminCatalogController {
77
93
  catalog;
78
94
  pluginImport;
@@ -225,6 +241,7 @@ let AdminCatalogController = class AdminCatalogController {
225
241
  ...detail,
226
242
  versions: detail.versions.map((v) => ({
227
243
  ...v,
244
+ manifest: catalogManifestForDisplay(v.manifest),
228
245
  client: v.extensionSha256 === null ? null : (builds.get(v.extensionSha256) ?? null),
229
246
  })),
230
247
  hasIcon,
@@ -8,6 +8,7 @@ import { Module } from "@nestjs/common";
8
8
  import { ClientModule } from "../client/client.module.js";
9
9
  import { ExtensionsModule } from "../extensions/extensions.module.js";
10
10
  import { SuperAdminLockModule } from "../identity/super-admin.js";
11
+ import { InvalidationHintsModule } from "../invalidation/invalidation-hints.module.js";
11
12
  import { OrgLockModule } from "../orgs/org-lock.js";
12
13
  import { StorageModule } from "../storage/storage.module.js";
13
14
  import { CatalogService } from "./catalog.service.js";
@@ -28,6 +29,8 @@ let CatalogImportModule = class CatalogImportModule {
28
29
  CatalogImportModule = __decorate([
29
30
  Module({
30
31
  imports: [
32
+ // invalidation hints its writers publish after their commit
33
+ InvalidationHintsModule,
31
34
  ExtensionsModule,
32
35
  SuperAdminLockModule,
33
36
  // an org upload re-checks the owner org's admin (`PluginImport`, ruling P3-7)
@@ -4,6 +4,7 @@ import { ExtensionAdmin } from "../extensions/admin-view.js";
4
4
  import { SuperAdminLock } from "../identity/super-admin.js";
5
5
  import { KernelDb } from "../infra/database/kernel-db.js";
6
6
  import { TransactionHost } from "../infra/database/transaction-host.js";
7
+ import type { HintPublisher } from "../invalidation/audiences.js";
7
8
  import { type ThemePreview } from "../themes/theme-usage.js";
8
9
  import { type ActorOpts, type CatalogItemView, CatalogService } from "./catalog.service.js";
9
10
  import { type ComponentKind } from "./component-state.js";
@@ -98,7 +99,8 @@ export declare class CatalogScopeService {
98
99
  private readonly ops;
99
100
  private readonly sync;
100
101
  readonly txHost: TransactionHost;
101
- constructor(kdb: KernelDb, adminLock: SuperAdminLock, scopeWriter: ScopeWriter, catalog: CatalogService, pluginImport: PluginImport, installer: PluginInstaller, extensions: ExtensionAdmin, ops: ExtensionAdminOps, sync: PluginScopeSync, txHost: TransactionHost);
102
+ private readonly hints;
103
+ constructor(kdb: KernelDb, adminLock: SuperAdminLock, scopeWriter: ScopeWriter, catalog: CatalogService, pluginImport: PluginImport, installer: PluginInstaller, extensions: ExtensionAdmin, ops: ExtensionAdminOps, sync: PluginScopeSync, txHost: TransactionHost, hints: HintPublisher);
102
104
  private get db();
103
105
  /**
104
106
  * Confirms a staged import ({@link PluginImport.confirm}: installs and enables the extension,
@@ -19,6 +19,7 @@ import { notifyItemShared } from "../inbox/org-notices.js";
19
19
  import { KernelDb } from "../infra/database/kernel-db.js";
20
20
  import { TransactionHost } from "../infra/database/transaction-host.js";
21
21
  import { Transactional } from "../infra/database/transactional.decorator.js";
22
+ import { InvalidationHints } from "../invalidation/invalidation-hints.js";
22
23
  import { assertNotPlatformDefault, themesPreview, } from "../themes/theme-usage.js";
23
24
  import { CatalogService } from "./catalog.service.js";
24
25
  import { assertOrgsExist } from "./catalog-items.js";
@@ -94,7 +95,8 @@ let CatalogScopeService = class CatalogScopeService {
94
95
  ops;
95
96
  sync;
96
97
  txHost;
97
- constructor(kdb, adminLock, scopeWriter, catalog, pluginImport, installer, extensions, ops, sync, txHost) {
98
+ hints;
99
+ constructor(kdb, adminLock, scopeWriter, catalog, pluginImport, installer, extensions, ops, sync, txHost, hints) {
98
100
  this.kdb = kdb;
99
101
  this.adminLock = adminLock;
100
102
  this.scopeWriter = scopeWriter;
@@ -105,6 +107,7 @@ let CatalogScopeService = class CatalogScopeService {
105
107
  this.ops = ops;
106
108
  this.sync = sync;
107
109
  this.txHost = txHost;
110
+ this.hints = hints;
108
111
  }
109
112
  get db() {
110
113
  return this.kdb.db;
@@ -273,7 +276,7 @@ let CatalogScopeService = class CatalogScopeService {
273
276
  });
274
277
  const shared = newlySharedWith({ scope: item.scope, orgs: from }, t);
275
278
  if (shared === "all_orgs" || shared.length > 0) {
276
- await notifyItemShared(this.db, item.owner_org_id, { kind: "plugin", id: itemId }, item.name, shared);
279
+ await notifyItemShared(this.db, this.hints, item.owner_org_id, { kind: "plugin", id: itemId }, item.name, shared);
277
280
  }
278
281
  await audit(this.db, {
279
282
  actorAccountId: actor,
@@ -362,14 +365,14 @@ let CatalogScopeService = class CatalogScopeService {
362
365
  }
363
366
  if (shareable)
364
367
  return;
365
- const narrowed = await narrowItemOnUnshare(this.db, actor, item);
368
+ const narrowed = await narrowItemOnUnshare(this.db, this.hints, actor, item);
366
369
  for (const kind of COMPONENT_KINDS) {
367
370
  for (const c of await loadComponents(this.db, kind, { itemId, forUpdate: true })) {
368
- await narrowComponentOnUnshare(this.db, actor, c);
371
+ await narrowComponentOnUnshare(this.db, this.hints, actor, c);
369
372
  }
370
373
  }
371
374
  // other orgs' pending enable requests for it (the share gate hides it from them now)
372
- await reconcileEnableRequestsOf(this.db, { kind: "plugin", id: itemId }, actor);
375
+ await reconcileEnableRequestsOf(this.db, this.hints, { kind: "plugin", id: itemId }, actor);
373
376
  if (narrowed)
374
377
  await this.enqueue(itemId);
375
378
  this.scopeWriter.refreshIsolatedOrgIntent();
@@ -382,7 +385,7 @@ let CatalogScopeService = class CatalogScopeService {
382
385
  */
383
386
  async addOrg(actor, itemId, orgId, opts = {}) {
384
387
  const item = await this.item(itemId, true);
385
- const changed = await addScopeOrg(this.db, actor, item, orgId, opts);
388
+ const changed = await addScopeOrg(this.db, this.hints, actor, item, orgId, opts);
386
389
  if (changed)
387
390
  await this.enqueue(itemId);
388
391
  return changed;
@@ -688,6 +691,7 @@ CatalogScopeService = __decorate([
688
691
  __param(6, Inject(ExtensionAdmin)),
689
692
  __param(7, Inject(ExtensionAdminOps)),
690
693
  __param(8, Inject(PluginScopeSync)),
691
- __param(9, Inject(TransactionHost))
694
+ __param(9, Inject(TransactionHost)),
695
+ __param(10, Inject(InvalidationHints))
692
696
  ], CatalogScopeService);
693
697
  export { CatalogScopeService };
@@ -9,6 +9,7 @@ import { ExtensionsModule } from "../extensions/extensions.module.js";
9
9
  import { ExtensionRegistryModule } from "../extensions/registry.js";
10
10
  import { SuperAdminLockModule } from "../identity/super-admin.js";
11
11
  import { QueueModule } from "../infra/queue/queue.module.js";
12
+ import { InvalidationHintsModule } from "../invalidation/invalidation-hints.module.js";
12
13
  import { ModelEnablementModule } from "../models/enablement.js";
13
14
  import { OrgLockModule } from "../orgs/org-lock.js";
14
15
  import { OrgSettingsModule } from "../orgs/settings.service.js";
@@ -50,6 +51,8 @@ let CatalogModule = class CatalogModule {
50
51
  CatalogModule = __decorate([
51
52
  Module({
52
53
  imports: [
54
+ // invalidation hints its writers publish after their commit
55
+ InvalidationHintsModule,
53
56
  CatalogImportModule,
54
57
  ExtensionsModule,
55
58
  SuperAdminLockModule,
@@ -10,6 +10,7 @@ import { TransactionHost } from "../infra/database/transaction-host.js";
10
10
  import { XactLock } from "../infra/database/xact-lock.js";
11
11
  import { KernelEvents } from "../infra/events/kernel-events.js";
12
12
  import { OutboxService } from "../infra/outbox/outbox.service.js";
13
+ import type { HintPublisher } from "../invalidation/audiences.js";
13
14
  import { OrgLock } from "../orgs/org-lock.js";
14
15
  import type { OfficialPublisherProof } from "../packages/official-publisher.js";
15
16
  import type { TranslationReport } from "./claude/report.js";
@@ -263,6 +264,7 @@ export declare class CatalogService {
263
264
  private readonly xactLock;
264
265
  private readonly outbox;
265
266
  private readonly events;
267
+ private readonly hints;
266
268
  constructor(kdb: KernelDb,
267
269
  /** The super admin lock (identity/super-admin.ts): joins the caller's transaction. */
268
270
  adminLock: SuperAdminLock, config: KernelConfigService, installs: ExtensionInstalls,
@@ -275,7 +277,7 @@ export declare class CatalogService {
275
277
  /** Serializes a claim release with an install of that name still committing (F10). */
276
278
  installLock: PluginInstallLock,
277
279
  /** The orgs whose connectors a delete switches off, locked before the item (ruling P3-50). */
278
- orgLock: OrgLock, txHost: TransactionHost, xactLock: XactLock, outbox: OutboxService, events: KernelEvents);
280
+ orgLock: OrgLock, txHost: TransactionHost, xactLock: XactLock, outbox: OutboxService, events: KernelEvents, hints: HintPublisher);
279
281
  /** The kernel-schema handle of the current context (the transaction, else the pool). */
280
282
  private get db();
281
283
  /** Downloads a marketplace archive source, verified against its integrity. */
@@ -26,6 +26,7 @@ import { Transactional } from "../infra/database/transactional.decorator.js";
26
26
  import { XactLock } from "../infra/database/xact-lock.js";
27
27
  import { KernelEvents } from "../infra/events/kernel-events.js";
28
28
  import { OutboxService } from "../infra/outbox/outbox.service.js";
29
+ import { InvalidationHints } from "../invalidation/invalidation-hints.js";
29
30
  import { OrgLock } from "../orgs/org-lock.js";
30
31
  import { sameRepository } from "../packages/provenance.js";
31
32
  import { assertNotPlatformDefault } from "../themes/theme-usage.js";
@@ -114,6 +115,7 @@ let CatalogService = class CatalogService {
114
115
  xactLock;
115
116
  outbox;
116
117
  events;
118
+ hints;
117
119
  constructor(kdb,
118
120
  /** The super admin lock (identity/super-admin.ts): joins the caller's transaction. */
119
121
  adminLock, config, installs,
@@ -126,7 +128,7 @@ let CatalogService = class CatalogService {
126
128
  /** Serializes a claim release with an install of that name still committing (F10). */
127
129
  installLock,
128
130
  /** The orgs whose connectors a delete switches off, locked before the item (ruling P3-50). */
129
- orgLock, txHost, xactLock, outbox, events) {
131
+ orgLock, txHost, xactLock, outbox, events, hints) {
130
132
  this.kdb = kdb;
131
133
  this.adminLock = adminLock;
132
134
  this.config = config;
@@ -140,6 +142,7 @@ let CatalogService = class CatalogService {
140
142
  this.xactLock = xactLock;
141
143
  this.outbox = outbox;
142
144
  this.events = events;
145
+ this.hints = hints;
143
146
  }
144
147
  /** The kernel-schema handle of the current context (the transaction, else the pool). */
145
148
  get db() {
@@ -665,9 +668,9 @@ let CatalogService = class CatalogService {
665
668
  // new item, whose install switches them back on (`relinkDeletedItemConnectors`). The super
666
669
  // admin's delete locked their orgs first; an owner's delete or an org deletion removes an
667
670
  // item no other org uses (P3-19), so its connectors are the owner org's, already locked
668
- await switchOffItemConnectors(t, itemId);
671
+ await switchOffItemConnectors(t, this.hints, itemId);
669
672
  // Pending requests for a deleted item are pointless: cancel them in the same transaction
670
- await cancelPendingRequests(t, { itemId }, actor, "item_removed", opts);
673
+ await cancelPendingRequests(t, this.hints, { itemId }, actor, "item_removed", opts);
671
674
  await audit(t, {
672
675
  actorAccountId: actor,
673
676
  ...(opts.actorTokenId !== undefined && { actorTokenId: opts.actorTokenId }),
@@ -711,6 +714,7 @@ CatalogService = __decorate([
711
714
  __param(9, Inject(TransactionHost)),
712
715
  __param(10, Inject(XactLock)),
713
716
  __param(11, Inject(OutboxService)),
714
- __param(12, Inject(KernelEvents))
717
+ __param(12, Inject(KernelEvents)),
718
+ __param(13, Inject(InvalidationHints))
715
719
  ], CatalogService);
716
720
  export { CatalogService };
@@ -1,7 +1,7 @@
1
1
  import { mkdtemp, rm } from "node:fs/promises";
2
2
  import { tmpdir } from "node:os";
3
3
  import { join } from "node:path";
4
- import { OBJECT_STORE_EXTENSION_POINT, } from "@capybara-hq/plugin-sdk";
4
+ import { extensionPointRefs, OBJECT_STORE_EXTENSION_POINT, } from "@capybara-hq/plugin-sdk";
5
5
  import { ClientBuilds } from "../client/client-builds.service.js";
6
6
  import { ApiError } from "../errors.js";
7
7
  import { planApprovals, snapshotCovers } from "../extensions/approvals.js";
@@ -34,7 +34,7 @@ export async function loadCliObjectStore(cli, log, syncDir) {
34
34
  const providers = cli.inspected.filter((p) => p.manifest.provides.includes(OBJECT_STORE_EXTENSION_POINT));
35
35
  const declared = new Set(cli.inspected.map((p) => p.manifest.name));
36
36
  const installed = (await cli.installs.desired()).filter((d) => !declared.has(d.name) &&
37
- (d.section.manifest?.provides ?? []).includes(OBJECT_STORE_EXTENSION_POINT));
37
+ extensionPointRefs(d.section.manifest?.provides ?? []).includes(OBJECT_STORE_EXTENSION_POINT));
38
38
  if (providers.length === 0 && installed.length === 0) {
39
39
  return { store: undefined, reason: "no object-store extension is declared or installed" };
40
40
  }
@@ -2,6 +2,7 @@ import type { KernelSchemaDb } from "../db/kernel-schema.js";
2
2
  import { ApiError } from "../errors.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 { StorageService } from "../storage/storage.service.js";
6
7
  /** The kinds an org owns as rows of its own (connector templates have none). */
7
8
  export type PromotableKind = "skill" | "agent_template";
@@ -60,9 +61,10 @@ export declare class ComponentPromotion {
60
61
  /** Where files are read and written (the kernel's object storage). */
61
62
  private readonly files;
62
63
  readonly txHost: TransactionHost;
64
+ private readonly hints;
63
65
  constructor(kdb: KernelDb,
64
66
  /** Where files are read and written (the kernel's object storage). */
65
- files: StorageService, txHost: TransactionHost);
67
+ files: StorageService, txHost: TransactionHost, hints: HintPublisher);
66
68
  private get db();
67
69
  /**
68
70
  * The live org row `id` of `kind` (an org-scope skill, an agent template) of a live org, when it
@@ -24,6 +24,7 @@ import { audit } from "../identity/audit.js";
24
24
  import { KernelDb } from "../infra/database/kernel-db.js";
25
25
  import { TransactionHost } from "../infra/database/transaction-host.js";
26
26
  import { Transactional } from "../infra/database/transactional.decorator.js";
27
+ import { InvalidationHints } from "../invalidation/invalidation-hints.js";
27
28
  import { StorageService } from "../storage/storage.service.js";
28
29
  import { putCatalogFiles } from "./catalog-items.js";
29
30
  import { platformSkillPrefix, uniqueVersionPrefix } from "./platform-components.js";
@@ -53,12 +54,14 @@ let ComponentPromotion = class ComponentPromotion {
53
54
  kdb;
54
55
  files;
55
56
  txHost;
57
+ hints;
56
58
  constructor(kdb,
57
59
  /** Where files are read and written (the kernel's object storage). */
58
- files, txHost) {
60
+ files, txHost, hints) {
59
61
  this.kdb = kdb;
60
62
  this.files = files;
61
63
  this.txHost = txHost;
64
+ this.hints = hints;
62
65
  }
63
66
  get db() {
64
67
  return this.kdb.db;
@@ -250,7 +253,7 @@ let ComponentPromotion = class ComponentPromotion {
250
253
  .where("org_id", "=", row.orgId)
251
254
  .execute();
252
255
  }
253
- await writeScope(this.db, {
256
+ await writeScope(this.db, this.hints, {
254
257
  kind: p.kind,
255
258
  id: p.platformId,
256
259
  scopeMode: "own",
@@ -299,7 +302,8 @@ ComponentPromotion = __decorate([
299
302
  Injectable(),
300
303
  __param(0, Inject(KernelDb)),
301
304
  __param(1, Inject(StorageService)),
302
- __param(2, Inject(TransactionHost))
305
+ __param(2, Inject(TransactionHost)),
306
+ __param(3, Inject(InvalidationHints))
303
307
  ], ComponentPromotion);
304
308
  export { ComponentPromotion };
305
309
  /** {@link ComponentPromotion.orgRow} through `db` (readers outside the provider). */
@@ -4,6 +4,7 @@ import { PluginGuides } from "../extensions/plugin-guides.js";
4
4
  import { SuperAdminLock } from "../identity/super-admin.js";
5
5
  import { KernelDb } from "../infra/database/kernel-db.js";
6
6
  import { TransactionHost } from "../infra/database/transaction-host.js";
7
+ import type { HintPublisher } from "../invalidation/audiences.js";
7
8
  import { OrgLock } from "../orgs/org-lock.js";
8
9
  import type { OrgRole } from "../orgs/roles.js";
9
10
  import { type ThemeSwatch } from "../themes/theme-state.js";
@@ -259,6 +260,7 @@ export declare class ComponentScopeService {
259
260
  private readonly guides;
260
261
  /** A connector template switched on where its plugin is installed gets its connector. */
261
262
  private readonly installer;
263
+ private readonly hints;
262
264
  constructor(kdb: KernelDb, adminLock: SuperAdminLock, scopeWriter: ScopeWriter,
263
265
  /** The org row lock (orgs/org-lock.ts): joins the caller's transaction. */
264
266
  orgLock: OrgLock,
@@ -267,7 +269,7 @@ export declare class ComponentScopeService {
267
269
  /** The connector templates' setup guides (the org list's `guide`). */
268
270
  guides: Pick<PluginGuides, "templateGuides">,
269
271
  /** A connector template switched on where its plugin is installed gets its connector. */
270
- installer: PluginInstaller);
272
+ installer: PluginInstaller, hints: HintPublisher);
271
273
  private get db();
272
274
  /**
273
275
  * What the admin routes act on (ruling P3-23): the platform component `id`, an org row the org
@@ -19,6 +19,7 @@ import { notifyItemShared } from "../inbox/org-notices.js";
19
19
  import { KernelDb } from "../infra/database/kernel-db.js";
20
20
  import { TransactionHost } from "../infra/database/transaction-host.js";
21
21
  import { Transactional } from "../infra/database/transactional.decorator.js";
22
+ import { InvalidationHints } from "../invalidation/invalidation-hints.js";
22
23
  import { OrgLock } from "../orgs/org-lock.js";
23
24
  import { themeDefinitions, themeSwatches } from "../themes/theme-state.js";
24
25
  import { assertNotPlatformDefault, platformDefaultThemeId, themesPreview, } from "../themes/theme-usage.js";
@@ -131,6 +132,7 @@ let ComponentScopeService = class ComponentScopeService {
131
132
  txHost;
132
133
  guides;
133
134
  installer;
135
+ hints;
134
136
  constructor(kdb, adminLock, scopeWriter,
135
137
  /** The org row lock (orgs/org-lock.ts): joins the caller's transaction. */
136
138
  orgLock,
@@ -139,7 +141,7 @@ let ComponentScopeService = class ComponentScopeService {
139
141
  /** The connector templates' setup guides (the org list's `guide`). */
140
142
  guides,
141
143
  /** A connector template switched on where its plugin is installed gets its connector. */
142
- installer) {
144
+ installer, hints) {
143
145
  this.kdb = kdb;
144
146
  this.adminLock = adminLock;
145
147
  this.scopeWriter = scopeWriter;
@@ -148,6 +150,7 @@ let ComponentScopeService = class ComponentScopeService {
148
150
  this.txHost = txHost;
149
151
  this.guides = guides;
150
152
  this.installer = installer;
153
+ this.hints = hints;
151
154
  }
152
155
  get db() {
153
156
  return this.kdb.db;
@@ -701,7 +704,7 @@ let ComponentScopeService = class ComponentScopeService {
701
704
  if (t.scopeMode === "own" && kind !== "connector_template" && kind !== "theme") {
702
705
  const shared = newlySharedWith(before, t);
703
706
  if (shared === "all_orgs" || shared.length > 0) {
704
- await notifyItemShared(this.db, c.ownerOrgId, { kind, id }, c.name, shared);
707
+ await notifyItemShared(this.db, this.hints, c.ownerOrgId, { kind, id }, c.name, shared);
705
708
  }
706
709
  }
707
710
  await audit(this.db, {
@@ -1085,7 +1088,8 @@ ComponentScopeService = __decorate([
1085
1088
  __param(4, Inject(ComponentPromotion)),
1086
1089
  __param(5, Inject(TransactionHost)),
1087
1090
  __param(6, Inject(PluginGuides)),
1088
- __param(7, Inject(PluginInstaller))
1091
+ __param(7, Inject(PluginInstaller)),
1092
+ __param(8, Inject(InvalidationHints))
1089
1093
  ], ComponentScopeService);
1090
1094
  export { ComponentScopeService };
1091
1095
  /** Whether `c` is the platform default theme `uiTheme` (locked on in every org, themes spec §7). */
@@ -1,5 +1,6 @@
1
1
  import type { KernelSchemaDb } from "../db/kernel-schema.js";
2
2
  import { ApiError } from "../errors.js";
3
+ import type { HintPublisher } from "../invalidation/audiences.js";
3
4
  import { type OrgRole } from "../orgs/roles.js";
4
5
  import { type ComponentKind } from "./component-state.js";
5
6
  import { type EnableTarget } from "./enable-targets.js";
@@ -118,9 +119,10 @@ interface Settler {
118
119
  * the requester's subject is usable (a `cancelReason: "target_changed"` cancellation otherwise),
119
120
  * and each follower's own outcome is recorded in `detail.followers` for their notice. Audits
120
121
  * each row under its own id. Returns the outcome of every row it settled (rows kept pending under
121
- * `reconcile` are absent).
122
+ * `reconcile` are absent). Every row it writes publishes `requests` after the commit
123
+ * ({@link publishRequestHints}: its requester, its followers, the org's admins).
122
124
  */
123
- export declare function settleRequestRows(db: KernelSchemaDb, orgId: string, rows: readonly {
125
+ export declare function settleRequestRows(db: KernelSchemaDb, hints: HintPublisher, orgId: string, rows: readonly {
124
126
  id: string;
125
127
  detail: unknown;
126
128
  item_id?: string | null;
@@ -140,7 +142,7 @@ export declare function settleRequestRows(db: KernelSchemaDb, orgId: string, row
140
142
  * switched back on) and `ConnectorsService` (a connector set active, by an org admin, the platform
141
143
  * or a plugin switch-on).
142
144
  */
143
- export declare function settleEnableRequests(db: KernelSchemaDb, orgId: string, target: EnableTarget, actor: string | null, opts?: RequestActorOpts & {
145
+ export declare function settleEnableRequests(db: KernelSchemaDb, hints: HintPublisher, orgId: string, target: EnableTarget, actor: string | null, opts?: RequestActorOpts & {
144
146
  settle?: boolean;
145
147
  }): Promise<string[]>;
146
148
  /**
@@ -149,25 +151,25 @@ export declare function settleEnableRequests(db: KernelSchemaDb, orgId: string,
149
151
  * are stale (the plugin is their owning switch now) and are cancelled with
150
152
  * `cancelReason: "target_changed"`. Called by `ScopeWriter.setOrgSwitch` (plugin off).
151
153
  */
152
- export declare function cancelEnableRequestsOfBundle(db: KernelSchemaDb, orgId: string, itemId: string, actor: string | null): Promise<void>;
154
+ export declare function cancelEnableRequestsOfBundle(db: KernelSchemaDb, hints: HintPublisher, orgId: string, itemId: string, actor: string | null): Promise<void>;
153
155
  /**
154
156
  * A model provider extension was switched off in the org, in the writer's transaction: pending
155
157
  * requests for its models are stale (the extension is their owning switch now). Called by
156
158
  * `OrgExtensionConfigs` (extension off).
157
159
  */
158
- export declare function cancelEnableRequestsOfProvider(db: KernelSchemaDb, orgId: string, provider: string, actor: string | null): Promise<void>;
160
+ export declare function cancelEnableRequestsOfProvider(db: KernelSchemaDb, hints: HintPublisher, orgId: string, provider: string, actor: string | null): Promise<void>;
159
161
  /**
160
162
  * A connector was disabled by its plugin's switch-off (`target_changed`: the plugin is its owning
161
163
  * switch now) or removed (`connector_removed`, no notice), in the writer's transaction: pending
162
164
  * requests for it are cancelled. Called by `ConnectorsService.disableWithPluginIn` and `removeIn`.
163
165
  */
164
- export declare function cancelEnableRequestsOfConnector(db: KernelSchemaDb, orgId: string, connectorId: string, actor: string | null, reason: "target_changed" | "connector_removed"): Promise<void>;
166
+ export declare function cancelEnableRequestsOfConnector(db: KernelSchemaDb, hints: HintPublisher, orgId: string, connectorId: string, actor: string | null, reason: "target_changed" | "connector_removed"): Promise<void>;
165
167
  /**
166
168
  * The platform disabled models of a provider, in its transaction: every org's pending requests
167
169
  * for them (as target or subject) are cancelled; the model is hidden from the orgs, so no "ask
168
170
  * again" notice. Called by `ModelEnablement.setPlatform`.
169
171
  */
170
- export declare function cancelEnableRequestsOfPlatformModels(db: KernelSchemaDb, provider: string, models: readonly string[], actor: string | null): Promise<void>;
172
+ export declare function cancelEnableRequestsOfPlatformModels(db: KernelSchemaDb, hints: HintPublisher, provider: string, models: readonly string[], actor: string | null): Promise<void>;
171
173
  /**
172
174
  * The platform changed a plugin's or a component's scope, share or disabled flag, in its
173
175
  * transaction: the pending enable requests of every org that target it, or that need the plugin
@@ -177,7 +179,7 @@ export declare function cancelEnableRequestsOfPlatformModels(db: KernelSchemaDb,
177
179
  * cancels it with `cancelReason: "target_changed"`. Called by `writeScope` (every scope write),
178
180
  * `ScopeWriter.setDisabled` and the unshare paths.
179
181
  */
180
- export declare function reconcileEnableRequestsOf(db: KernelSchemaDb, subject: {
182
+ export declare function reconcileEnableRequestsOf(db: KernelSchemaDb, hints: HintPublisher, subject: {
181
183
  kind: "plugin" | ComponentKind;
182
184
  id: string;
183
185
  }, actor: string | null): Promise<void>;