@capybara-hq/kernel 0.1.0-rc.136 → 0.1.0-rc.138

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 (203) hide show
  1. package/dist/admin/audit-log.service.d.ts +96 -12
  2. package/dist/admin/audit-log.service.js +508 -44
  3. package/dist/admin/audit-targets.d.ts +17 -0
  4. package/dist/admin/audit-targets.js +84 -0
  5. package/dist/admin/audit.controller.d.ts +12 -9
  6. package/dist/admin/audit.controller.js +29 -8
  7. package/dist/admin/audit.schemas.d.ts +20 -4
  8. package/dist/admin/audit.schemas.js +42 -17
  9. package/dist/admin/extensions.controller.d.ts +5 -2
  10. package/dist/admin/extensions.controller.js +10 -1
  11. package/dist/admin/extensions.schemas.d.ts +4 -0
  12. package/dist/admin/extensions.schemas.js +9 -0
  13. package/dist/admin/health.service.d.ts +1 -1
  14. package/dist/admin/health.service.js +3 -3
  15. package/dist/agents/templates.js +3 -10
  16. package/dist/app.d.ts +3 -1
  17. package/dist/app.js +1 -0
  18. package/dist/automations/automations.service.js +4 -5
  19. package/dist/catalog/catalog-content.d.ts +6 -8
  20. package/dist/catalog/catalog-content.js +17 -22
  21. package/dist/catalog/catalog-items.d.ts +5 -10
  22. package/dist/catalog/catalog-items.js +27 -51
  23. package/dist/catalog/catalog-scope.service.d.ts +4 -2
  24. package/dist/catalog/catalog-scope.service.js +109 -145
  25. package/dist/catalog/catalog.module.js +7 -4
  26. package/dist/catalog/catalog.service.d.ts +10 -4
  27. package/dist/catalog/catalog.service.js +52 -10
  28. package/dist/catalog/cli.js +17 -0
  29. package/dist/catalog/component-promotion.js +8 -4
  30. package/dist/catalog/component-scope.service.d.ts +3 -1
  31. package/dist/catalog/component-scope.service.js +101 -140
  32. package/dist/catalog/component-state.d.ts +10 -8
  33. package/dist/catalog/component-state.js +42 -30
  34. package/dist/catalog/dependency-edges.d.ts +25 -0
  35. package/dist/catalog/dependency-edges.js +125 -0
  36. package/dist/catalog/effect-work.d.ts +27 -0
  37. package/dist/catalog/effect-work.js +151 -0
  38. package/dist/catalog/jobs.d.ts +4 -1
  39. package/dist/catalog/jobs.js +14 -4
  40. package/dist/catalog/org-catalog.service.d.ts +5 -1
  41. package/dist/catalog/org-catalog.service.js +101 -106
  42. package/dist/catalog/org-intent.d.ts +45 -0
  43. package/dist/catalog/org-intent.js +205 -0
  44. package/dist/catalog/owned-items.d.ts +6 -2
  45. package/dist/catalog/owned-items.js +27 -32
  46. package/dist/catalog/ownership.d.ts +2 -3
  47. package/dist/catalog/ownership.js +10 -28
  48. package/dist/catalog/platform-components.d.ts +3 -1
  49. package/dist/catalog/platform-components.js +9 -1
  50. package/dist/catalog/plugin-import.d.ts +4 -2
  51. package/dist/catalog/plugin-import.js +22 -21
  52. package/dist/catalog/plugin-install.d.ts +19 -54
  53. package/dist/catalog/plugin-install.js +221 -271
  54. package/dist/catalog/plugin-upgrade.d.ts +10 -5
  55. package/dist/catalog/plugin-upgrade.js +80 -67
  56. package/dist/catalog/request-rules.js +20 -8
  57. package/dist/catalog/scope-orgs.js +2 -7
  58. package/dist/catalog/scope-state.d.ts +6 -6
  59. package/dist/catalog/scope-state.js +24 -43
  60. package/dist/catalog/scope-sync-workers.d.ts +7 -11
  61. package/dist/catalog/scope-sync-workers.js +10 -26
  62. package/dist/catalog/scope-sync.d.ts +19 -116
  63. package/dist/catalog/scope-sync.js +228 -275
  64. package/dist/catalog/scope-writer.d.ts +87 -0
  65. package/dist/catalog/scope-writer.js +239 -0
  66. package/dist/catalog/template-connector-ensure.js +1 -1
  67. package/dist/catalog/unshare.js +9 -43
  68. package/dist/channels/connections.service.js +6 -6
  69. package/dist/channels/supervisor.js +3 -7
  70. package/dist/client/client-access.service.js +2 -12
  71. package/dist/config/schema.d.ts +6 -0
  72. package/dist/config/schema.js +32 -1
  73. package/dist/ctx/create-ctx.d.ts +2 -2
  74. package/dist/ctx/create-ctx.js +2 -60
  75. package/dist/ctx/guard-db.d.ts +6 -0
  76. package/dist/ctx/guard-db.js +55 -0
  77. package/dist/db/extension-handoff-schema.d.ts +1 -1
  78. package/dist/db/extension-handoff-schema.js +48 -10
  79. package/dist/db/extension-schema-transfer.js +5 -2
  80. package/dist/db/kernel-schema.d.ts +32 -6
  81. package/dist/device-access/host-services.d.ts +2 -2
  82. package/dist/device-access/host-services.js +5 -6
  83. package/dist/erasure/org-catalog.js +2 -2
  84. package/dist/erasure/org-rules.js +7 -0
  85. package/dist/extensions/admin-ops.d.ts +10 -6
  86. package/dist/extensions/admin-ops.js +53 -9
  87. package/dist/extensions/admin-view.d.ts +4 -1
  88. package/dist/extensions/admin-view.js +27 -14
  89. package/dist/extensions/bootstrap.d.ts +1 -1
  90. package/dist/extensions/bootstrap.js +6 -4
  91. package/dist/extensions/cli.js +1 -0
  92. package/dist/extensions/effective-config.js +1 -4
  93. package/dist/extensions/enabled.d.ts +183 -29
  94. package/dist/extensions/enabled.js +148 -62
  95. package/dist/extensions/host.d.ts +65 -45
  96. package/dist/extensions/host.js +446 -128
  97. package/dist/extensions/installs.d.ts +9 -0
  98. package/dist/extensions/installs.js +23 -0
  99. package/dist/extensions/isolated/admission.d.ts +10 -0
  100. package/dist/extensions/isolated/admission.js +206 -0
  101. package/dist/extensions/isolated/authorization.d.ts +45 -0
  102. package/dist/extensions/isolated/authorization.js +191 -0
  103. package/dist/extensions/isolated/broker.d.ts +15 -0
  104. package/dist/extensions/isolated/broker.js +471 -0
  105. package/dist/extensions/isolated/child-protocol.d.ts +84 -0
  106. package/dist/extensions/isolated/child-protocol.js +21 -0
  107. package/dist/extensions/isolated/child-registration.d.ts +22 -0
  108. package/dist/extensions/isolated/child-registration.js +152 -0
  109. package/dist/extensions/isolated/child-session.d.ts +6 -0
  110. package/dist/extensions/isolated/child-session.js +343 -0
  111. package/dist/extensions/isolated/child-streams.d.ts +4 -0
  112. package/dist/extensions/isolated/child-streams.js +142 -0
  113. package/dist/extensions/isolated/child.d.ts +1 -0
  114. package/dist/extensions/isolated/child.js +10 -0
  115. package/dist/extensions/isolated/configured-package.d.ts +15 -0
  116. package/dist/extensions/isolated/configured-package.js +73 -0
  117. package/dist/extensions/isolated/engine-binds.d.ts +9 -0
  118. package/dist/extensions/isolated/engine-binds.js +82 -0
  119. package/dist/extensions/isolated/engine-policy.d.ts +85 -0
  120. package/dist/extensions/isolated/engine-policy.js +75 -0
  121. package/dist/extensions/isolated/engine-proxy-main.d.ts +1 -0
  122. package/dist/extensions/isolated/engine-proxy-main.js +20 -0
  123. package/dist/extensions/isolated/engine-proxy.d.ts +7 -0
  124. package/dist/extensions/isolated/engine-proxy.js +408 -0
  125. package/dist/extensions/isolated/engine-vaults.d.ts +12 -0
  126. package/dist/extensions/isolated/engine-vaults.js +93 -0
  127. package/dist/extensions/isolated/lanes.d.ts +108 -0
  128. package/dist/extensions/isolated/lanes.js +726 -0
  129. package/dist/extensions/isolated/postgres-gate.d.ts +15 -0
  130. package/dist/extensions/isolated/postgres-gate.js +255 -0
  131. package/dist/extensions/isolated/revision.d.ts +32 -0
  132. package/dist/extensions/isolated/revision.js +359 -0
  133. package/dist/extensions/isolated/rpc-frame.d.ts +50 -0
  134. package/dist/extensions/isolated/rpc-frame.js +193 -0
  135. package/dist/extensions/isolated/rpc.d.ts +66 -0
  136. package/dist/extensions/isolated/rpc.js +314 -0
  137. package/dist/extensions/isolated/sandbox.d.ts +39 -0
  138. package/dist/extensions/isolated/sandbox.js +356 -0
  139. package/dist/extensions/isolated/tier.d.ts +6 -0
  140. package/dist/extensions/isolated/tier.js +45 -0
  141. package/dist/extensions/ledger.d.ts +1 -1
  142. package/dist/extensions/lifecycle-topics.d.ts +2 -0
  143. package/dist/extensions/lifecycle-topics.js +2 -0
  144. package/dist/extensions/lifecycle.d.ts +3 -1
  145. package/dist/extensions/lifecycle.js +53 -5
  146. package/dist/extensions/locks.d.ts +2 -0
  147. package/dist/extensions/locks.js +7 -0
  148. package/dist/extensions/org-config.d.ts +17 -27
  149. package/dist/extensions/org-config.js +114 -129
  150. package/dist/extensions/permission-view.d.ts +6 -1
  151. package/dist/extensions/plugin-guides.d.ts +5 -10
  152. package/dist/extensions/plugin-guides.js +18 -37
  153. package/dist/extensions/plugin-icons.d.ts +3 -21
  154. package/dist/extensions/plugin-icons.js +9 -44
  155. package/dist/extensions/plugin-items.d.ts +10 -30
  156. package/dist/extensions/plugin-items.js +32 -73
  157. package/dist/extensions/source-intent.d.ts +14 -0
  158. package/dist/extensions/source-intent.js +77 -0
  159. package/dist/inbox/platform-inbox.service.js +16 -27
  160. package/dist/index.d.ts +2 -1
  161. package/dist/index.js +2 -1
  162. package/dist/infra/database/database.module.js +6 -1
  163. package/dist/infra/database/kernel-db.d.ts +3 -1
  164. package/dist/infra/database/kernel-db.js +4 -0
  165. package/dist/infra/events/kernel-events.d.ts +4 -0
  166. package/dist/infra/outbox/registry.d.ts +3 -36
  167. package/dist/infra/outbox/registry.js +4 -49
  168. package/dist/infra/paging/paged-read.d.ts +56 -0
  169. package/dist/infra/paging/paged-read.js +78 -0
  170. package/dist/infra/queue/queue-names.d.ts +1 -1
  171. package/dist/infra/queue/queue-names.js +1 -1
  172. package/dist/kernel.d.ts +3 -2
  173. package/dist/kernel.js +21 -2
  174. package/dist/lifecycle/kernel-lifecycle.d.ts +3 -1
  175. package/dist/lifecycle/kernel-lifecycle.js +22 -12
  176. package/dist/lifecycle/tokens.d.ts +8 -0
  177. package/dist/lifecycle/tokens.js +2 -0
  178. package/dist/orgs/directory-sync.js +1 -4
  179. package/dist/orgs/org-lock.d.ts +3 -1
  180. package/dist/orgs/org-lock.js +3 -1
  181. package/dist/orgs/orgs.service.d.ts +3 -1
  182. package/dist/orgs/orgs.service.js +15 -8
  183. package/dist/overrides.d.ts +0 -3
  184. package/dist/overrides.js +0 -2
  185. package/dist/platform/ops/admin.ops.js +14 -3
  186. package/dist/platform/ops/extensions-admin.ops.js +20 -3
  187. package/dist/platform/ops/org-plugins.ops.js +5 -2
  188. package/dist/platform/ops/orgs.ops.js +13 -3
  189. package/dist/platform/ops/plugins.ops.js +11 -10
  190. package/dist/setup/setup-checks.service.js +3 -2
  191. package/dist/skills/usable.js +41 -30
  192. package/dist/themes/theme-state.js +3 -3
  193. package/dist/tools/registry.d.ts +2 -2
  194. package/dist/tools/registry.js +7 -3
  195. package/package.json +2 -2
  196. package/src/migrations/0228_extension_org_switches.sql +56 -0
  197. package/src/migrations/0229_catalog_dependency_edges.sql +17 -0
  198. package/src/migrations/0230_audit_filter_idx.sql +18 -0
  199. package/src/migrations/0231_plugin_effect_work.sql +171 -0
  200. package/dist/catalog/install-status.d.ts +0 -6
  201. package/dist/catalog/install-status.js +0 -6
  202. package/dist/catalog/scope-jobs.d.ts +0 -59
  203. package/dist/catalog/scope-jobs.js +0 -78
@@ -8,6 +8,8 @@ import { SuperAdminLock } from "../identity/super-admin.js";
8
8
  import { KernelConfigService } from "../infra/config/kernel-config.service.js";
9
9
  import { KernelDb } from "../infra/database/kernel-db.js";
10
10
  import { TransactionHost } from "../infra/database/transaction-host.js";
11
+ import { XactLock } from "../infra/database/xact-lock.js";
12
+ import { KernelEvents } from "../infra/events/kernel-events.js";
11
13
  import { LockService } from "../infra/lock/lock.service.js";
12
14
  import { OutboxService } from "../infra/outbox/outbox.service.js";
13
15
  import type { KernelLogger } from "../log.js";
@@ -133,7 +135,7 @@ export interface PlatformUpdatePreview {
133
135
  * The orgs where the scope sync owed with the update will install the plugin (plugin pages spec
134
136
  * §5.2.3): its scope wants it on there and the org has no live install (one that waited for
135
137
  * connector input before installs took none). `failing`: the scope sync's last attempt there
136
- * failed (an open `plugin_scope_sync_failures` row), `lastFailure` its message. Sorted by org
138
+ * failed (an `install_failed` effects row), `lastFailure` its message. Sorted by org
137
139
  * id. Hashed by org id and `failing` only. An owner's preview ({@link
138
140
  * PlatformPluginUpdater.previewForOwner}) drops both for orgs other than the owner.
139
141
  */
@@ -247,6 +249,8 @@ export type UpdateTarget = VersionRow;
247
249
  export declare class PlatformPluginUpdater {
248
250
  private readonly kdb;
249
251
  readonly txHost: TransactionHost;
252
+ private readonly xactLock;
253
+ private readonly events;
250
254
  private readonly adminLock;
251
255
  private readonly itemLock;
252
256
  private readonly orgLock;
@@ -267,7 +271,7 @@ export declare class PlatformPluginUpdater {
267
271
  private readonly guides;
268
272
  /** Owes the template connector ensure of the orgs with a deferred connector (ruling R27). */
269
273
  private readonly outbox;
270
- constructor(kdb: KernelDb, txHost: TransactionHost, adminLock: SuperAdminLock, itemLock: CatalogItemLock, orgLock: OrgLock, locks: LockService, storage: StorageService, registry: ExtensionRegistry, ops: ExtensionAdminOps,
274
+ constructor(kdb: KernelDb, txHost: TransactionHost, xactLock: XactLock, events: KernelEvents, adminLock: SuperAdminLock, itemLock: CatalogItemLock, orgLock: OrgLock, locks: LockService, storage: StorageService, registry: ExtensionRegistry, ops: ExtensionAdminOps,
271
275
  /** Reads the target's extension package (its permissions, for `needsApproval`). */
272
276
  blobs: ExtensionBlobs, config: KernelConfigService, platform: PlatformComponents,
273
277
  /** Template dependencies (the deployed connector kinds). */
@@ -413,12 +417,13 @@ export declare class PlatformPluginUpdater {
413
417
  private themesLost;
414
418
  /**
415
419
  * {@link PlatformUpdatePreview.scopeInstalls}: the live orgs without a live install (`onOrgs`
416
- * are those with one) whose scope wants the plugin on, as the scope sync decides it
417
- * (`wantedOn`). None for a builtin plugin (on everywhere without an install) or one not usable.
420
+ * are those with one) that owe setup under the scope worker's intent predicate.
421
+ * Builtin or unavailable plugins have no org setup plan.
418
422
  */
419
423
  private scopeInstallsOf;
420
- /** The orgs where the plugin is on: a live install (builtin: every live org). */
421
424
  private pluginOrgs;
425
+ /** Applied org resources that the platform update must move with the catalog version. */
426
+ private appliedPluginOrgs;
422
427
  private liveOrgs;
423
428
  }
424
429
  export {};
@@ -26,10 +26,13 @@ import { audit } from "../identity/audit.js";
26
26
  import { SuperAdminLock } from "../identity/super-admin.js";
27
27
  import { notifySharedUpdate } from "../inbox/org-notices.js";
28
28
  import { KernelConfigService } from "../infra/config/kernel-config.service.js";
29
+ import { afterCommit } from "../infra/database/after-commit.js";
29
30
  import { KernelDb } from "../infra/database/kernel-db.js";
30
31
  import { asPlatform, withOrgScope } from "../infra/database/org-scope.js";
31
32
  import { TransactionHost } from "../infra/database/transaction-host.js";
32
33
  import { Transactional } from "../infra/database/transactional.decorator.js";
34
+ import { XactLock } from "../infra/database/xact-lock.js";
35
+ import { KernelEvents } from "../infra/events/kernel-events.js";
33
36
  import { LockService } from "../infra/lock/lock.service.js";
34
37
  import { OutboxService } from "../infra/outbox/outbox.service.js";
35
38
  import { KERNEL_LOGGER } from "../infra/tokens.js";
@@ -45,15 +48,16 @@ import { dirDigest, getPath, readCatalogAgentTemplates, readCatalogTemplates, re
45
48
  import { markVersionApplied, versionUsable } from "./catalog-items.js";
46
49
  import { agentsUsing, clashingOrgSkills, clashingPlatformSkills, componentOn, connectorsMadeFrom, connectorTemplatesOn, listedIn, loadComponents, loadScopeState, pluginFactsOf, switchOf, themeIdClashes, } from "./component-state.js";
47
50
  import { credentialKey } from "./credential-key.js";
48
- import { LIVE_INSTALL_STATUSES } from "./install-status.js";
51
+ import { refreshCatalogDependencyEdges } from "./dependency-edges.js";
52
+ import { EFFECT_CANDIDATES_LOCK } from "./effect-work.js";
49
53
  import { CatalogItemLock } from "./locks.js";
50
54
  import { requireMarketplacePublisher } from "./marketplace-fetch.js";
55
+ import { orgPluginEffectIntent, orgUsable } from "./org-intent.js";
51
56
  import { isUsable } from "./ownership.js";
52
57
  import { PlanStale, PlatformComponents } from "./platform-components.js";
53
58
  import { catalogSkillNames, PluginInstaller } from "./plugin-install.js";
54
59
  import { assertDeclarativeUpload } from "./plugin-package.js";
55
60
  import { OFFICIAL_MARKETPLACE_ID, officialPublisherProofMode } from "./publisher-policy.js";
56
- import { wantedOn } from "./scope.js";
57
61
  import { PluginScopeSync } from "./scope-sync.js";
58
62
  import { oweTemplateConnectors } from "./template-connector-jobs.js";
59
63
  import { compareVersions, satisfiesRange } from "./versions.js";
@@ -127,6 +131,8 @@ const filesDigest = (row) => skillFilesDigest(row.files.map((f) => ({ path: f.pa
127
131
  let PlatformPluginUpdater = class PlatformPluginUpdater {
128
132
  kdb;
129
133
  txHost;
134
+ xactLock;
135
+ events;
130
136
  adminLock;
131
137
  itemLock;
132
138
  orgLock;
@@ -143,7 +149,7 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
143
149
  log;
144
150
  guides;
145
151
  outbox;
146
- constructor(kdb, txHost, adminLock, itemLock, orgLock, locks, storage, registry, ops,
152
+ constructor(kdb, txHost, xactLock, events, adminLock, itemLock, orgLock, locks, storage, registry, ops,
147
153
  /** Reads the target's extension package (its permissions, for `needsApproval`). */
148
154
  blobs, config, platform,
149
155
  /** Template dependencies (the deployed connector kinds). */
@@ -154,6 +160,8 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
154
160
  outbox) {
155
161
  this.kdb = kdb;
156
162
  this.txHost = txHost;
163
+ this.xactLock = xactLock;
164
+ this.events = events;
157
165
  this.adminLock = adminLock;
158
166
  this.itemLock = itemLock;
159
167
  this.orgLock = orgLock;
@@ -438,22 +446,15 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
438
446
  // An owner update was authorized at its start: the put-back is not checked again
439
447
  const back = opsOwner && { ...opsOwner, rollback: true };
440
448
  try {
441
- if (ext.sha256 === null) {
442
- // Removed by this update: the previous package reinstalled (as it was)
443
- await this.ops.install(checked.name, ext.previous, actor, opts.actorTokenId, {
444
- catalogItemId: itemId,
449
+ if (ext.previous !== null) {
450
+ const { source, sha256, catalog_item_id } = ext.previous;
451
+ await this.ops.install(checked.name, sha256, actor, opts.actorTokenId, {
452
+ ...(source === "catalog" && catalog_item_id && { catalogItemId: catalog_item_id }),
453
+ ...(source === "bootstrap" && { bootstrap: true }),
445
454
  ...(back && { owner: back }),
446
455
  });
447
- if (removedEnabled)
448
- await this.ops.enable(checked.name, actor, opts.actorTokenId, back);
449
- }
450
- else if (ext.previous !== null) {
451
- await this.ops.install(checked.name, ext.previous, actor, opts.actorTokenId, {
452
- ...(back && { owner: back }),
453
- });
454
- // The install left the enabled extension disabled (a held single-provider point): the
455
- // previous version, which did not provide it, runs again
456
- if (leftDisabled !== undefined) {
456
+ // Restore the serving state after a removal or a single-provider conflict.
457
+ if (removedEnabled || leftDisabled !== undefined) {
457
458
  await this.ops.enable(checked.name, actor, opts.actorTokenId, back);
458
459
  }
459
460
  }
@@ -539,6 +540,7 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
539
540
  if (owner !== undefined && actor === null) {
540
541
  throw new Error("an owner update needs the acting account");
541
542
  }
543
+ await this.xactLock.lock(EFFECT_CANDIDATES_LOCK);
542
544
  // null: the kernel itself (the bootstrap step), no super admin to re-check
543
545
  if (owner === undefined && actor !== null)
544
546
  await this.adminLock.lockAndAuthorize(actor);
@@ -590,9 +592,12 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
590
592
  }
591
593
  // Removals (spec §7.3): kept while agents use it; otherwise soft-deleted
592
594
  const now = sql `now()`;
595
+ let removedConnectorTemplate = false;
593
596
  for (const c of diff.components) {
594
597
  if (c.change !== "removed" || c.id === null || c.kept !== undefined)
595
598
  continue;
599
+ if (c.kind === "connector_template")
600
+ removedConnectorTemplate = true;
596
601
  const table = c.kind === "skill"
597
602
  ? "platform_skills"
598
603
  : c.kind === "agent_template"
@@ -670,9 +675,9 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
670
675
  // current at its commit, PluginInstaller.markInstalled)
671
676
  await t
672
677
  .updateTable("plugin_installs")
673
- .set({ version: diff.to.version, error: null })
678
+ .set({ version: diff.to.version })
674
679
  .where("item_id", "=", itemId)
675
- .where("status", "in", [...LIVE_INSTALL_STATUSES])
680
+ .where("version", "is not", null)
676
681
  .execute();
677
682
  if (owner !== undefined) {
678
683
  // An org's version becomes its latest once applied
@@ -683,6 +688,10 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
683
688
  .execute();
684
689
  await markVersionApplied(t, itemId, diff.to.version);
685
690
  }
691
+ await refreshCatalogDependencyEdges(t);
692
+ if (removedConnectorTemplate) {
693
+ afterCommit(() => this.events.emit("catalog.org-intent-changed", {}));
694
+ }
686
695
  // The orgs using a shared org-owned plugin are told, one notice per plugin (a platform-owned
687
696
  // plugin tells nobody); a plugin never synced before has no version to come from
688
697
  if (diff.from !== null) {
@@ -767,7 +776,7 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
767
776
  const connectorId = await this.connectors.createDeferredIn(c.orgId, null, ci, {
768
777
  auditDetail: { via: "platform_update" },
769
778
  });
770
- await this.installer.recordTemplateConnectorIn(c.orgId, itemId, connectorId, c.templateId, LIVE_INSTALL_STATUSES);
779
+ await this.installer.recordTemplateConnectorIn(c.orgId, itemId, connectorId, c.templateId);
771
780
  }
772
781
  /**
773
782
  * Computes an update (see the class comment). `target`: the target read from an org's staging
@@ -1094,8 +1103,8 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
1094
1103
  pinnedOrgs: [],
1095
1104
  });
1096
1105
  }
1097
- // The orgs where the plugin is on (a live install; builtin: every org)
1098
- const onOrgs = await this.pluginOrgs(itemId, item.builtin);
1106
+ const onOrgs = await this.pluginOrgs(itemId);
1107
+ const appliedOrgs = item.builtin ? onOrgs : await this.appliedPluginOrgs(itemId);
1099
1108
  if (extension)
1100
1109
  extension = { ...extension, orgs: onOrgs };
1101
1110
  // Rule 10: an added skill must not take a name already used where the plugin is on
@@ -1233,7 +1242,7 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
1233
1242
  .execute()).map((r) => r.org_id))
1234
1243
  : undefined;
1235
1244
  const ids = [...flipped.keys()].sort();
1236
- for (const orgId of onOrgs) {
1245
+ for (const orgId of appliedOrgs) {
1237
1246
  if (listedOrgs !== undefined && !listedOrgs.has(orgId))
1238
1247
  continue;
1239
1248
  // a template the org already has a live connector from (one a switch-off kept) needs none
@@ -1318,7 +1327,11 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
1318
1327
  }
1319
1328
  }
1320
1329
  }
1321
- const scopeInstalls = await this.scopeInstallsOf(item, onOrgs);
1330
+ const toManifest = to.manifest;
1331
+ const expectsSetup = toManifest.extension !== undefined ||
1332
+ (toManifest.connectorTemplates?.length ?? 0) > 0 ||
1333
+ (toManifest.dependencies?.length ?? 0) > 0;
1334
+ const scopeInstalls = expectsSetup ? await this.scopeInstallsOf(item, appliedOrgs) : [];
1322
1335
  const connectorOrgs = [...byOrg.values()]
1323
1336
  .map((e) => ({
1324
1337
  ...e,
@@ -1414,7 +1427,7 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
1414
1427
  const want = to.manifest.extension;
1415
1428
  const row = await this.db
1416
1429
  .selectFrom("extension_installs")
1417
- .select(["sha256", "version"])
1430
+ .select(["sha256", "version", "source", "catalog_item_id"])
1418
1431
  .where("name", "=", name)
1419
1432
  .executeTakeFirst();
1420
1433
  // Only an extension declared in the startup config runs without an install record; one this
@@ -1423,7 +1436,7 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
1423
1436
  const loaded = declared ? this.registry.manifests().find((m) => m.name === name) : undefined;
1424
1437
  if (!want) {
1425
1438
  if (allowRemove && from?.manifest.extension && row && !declared) {
1426
- return { from: row.version, to: null, sha256: null, previous: row.sha256 };
1439
+ return { from: row.version, to: null, sha256: null, previous: row };
1427
1440
  }
1428
1441
  if (from?.manifest.extension && (row || declared)) {
1429
1442
  throw targetInvalid(`Version ${to.version} of plugin ${name} has no extension, but the deployment runs it; uninstall the extension first`, [{ reason: "extension_removed", version: to.version }]);
@@ -1448,7 +1461,7 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
1448
1461
  from: row?.version ?? null,
1449
1462
  to: want.manifest.version,
1450
1463
  sha256: to.extension_sha256,
1451
- previous: row?.sha256 ?? null,
1464
+ previous: row ?? null,
1452
1465
  };
1453
1466
  }
1454
1467
  /**
@@ -1579,41 +1592,31 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
1579
1592
  }
1580
1593
  /**
1581
1594
  * {@link PlatformUpdatePreview.scopeInstalls}: the live orgs without a live install (`onOrgs`
1582
- * are those with one) whose scope wants the plugin on, as the scope sync decides it
1583
- * (`wantedOn`). None for a builtin plugin (on everywhere without an install) or one not usable.
1595
+ * are those with one) that owe setup under the scope worker's intent predicate.
1596
+ * Builtin or unavailable plugins have no org setup plan.
1584
1597
  */
1585
1598
  async scopeInstallsOf(item, onOrgs) {
1586
1599
  if (item.builtin || !isUsable(item))
1587
1600
  return [];
1588
- const [orgs, listed, switches, failures] = await Promise.all([
1601
+ const [orgs, failures] = await Promise.all([
1589
1602
  this.db
1590
1603
  .selectFrom("orgs")
1591
1604
  .select(["id", "name"])
1592
1605
  .where("deleted_at", "is", null)
1606
+ .where(({ ref }) => orgPluginEffectIntent(this.db, ref("orgs.id"), item.id))
1593
1607
  .orderBy("id")
1594
1608
  .execute(),
1595
1609
  this.db
1596
- .selectFrom("catalog_item_scope_orgs")
1597
- .select("org_id")
1598
- .where("item_id", "=", item.id)
1599
- .execute(),
1600
- this.db
1601
- .selectFrom("catalog_item_org_switches")
1602
- .select(["org_id", "enabled"])
1603
- .where("item_id", "=", item.id)
1604
- .execute(),
1605
- this.db
1606
- .selectFrom("plugin_scope_sync_failures")
1607
- .select(["org_id", "message"])
1610
+ .selectFrom("plugin_installs")
1611
+ .select(["org_id", "error"])
1612
+ .where("status", "=", "install_failed")
1608
1613
  .where("item_id", "=", item.id)
1609
1614
  .execute(),
1610
1615
  ]);
1611
- const failed = new Map(failures.map((r) => [r.org_id, r.message]));
1616
+ const failed = new Map(failures.map((r) => [r.org_id, r.error?.message]));
1612
1617
  const on = new Set(onOrgs);
1613
- const inList = new Set(listed.map((r) => r.org_id));
1614
- const sw = new Map(switches.map((r) => [r.org_id, r.enabled]));
1615
1618
  return orgs
1616
- .filter((o) => !on.has(o.id) && wantedOn(item, inList.has(o.id), sw.get(o.id) ?? null))
1619
+ .filter((o) => !on.has(o.id))
1617
1620
  .map((o) => {
1618
1621
  const lastFailure = failed.get(o.id);
1619
1622
  return {
@@ -1623,17 +1626,25 @@ let PlatformPluginUpdater = class PlatformPluginUpdater {
1623
1626
  };
1624
1627
  });
1625
1628
  }
1626
- /** The orgs where the plugin is on: a live install (builtin: every live org). */
1627
- async pluginOrgs(itemId, builtin) {
1628
- if (builtin)
1629
- return this.liveOrgs();
1629
+ async pluginOrgs(itemId) {
1630
+ const rows = await this.db
1631
+ .selectFrom("orgs")
1632
+ .select("id")
1633
+ .where("deleted_at", "is", null)
1634
+ .where(({ ref }) => orgUsable(this.db, ref("orgs.id"), itemId))
1635
+ .orderBy("id")
1636
+ .execute();
1637
+ return rows.map((row) => row.id);
1638
+ }
1639
+ /** Applied org resources that the platform update must move with the catalog version. */
1640
+ async appliedPluginOrgs(itemId) {
1630
1641
  const rows = await this.db
1631
1642
  .selectFrom("plugin_installs as a")
1632
1643
  .innerJoin("orgs as o", "o.id", "a.org_id")
1633
1644
  .select("a.org_id")
1634
1645
  .distinct()
1635
1646
  .where("a.item_id", "=", itemId)
1636
- .where("a.status", "in", [...LIVE_INSTALL_STATUSES])
1647
+ .where("a.version", "is not", null)
1637
1648
  .where("o.deleted_at", "is", null)
1638
1649
  .orderBy("a.org_id")
1639
1650
  .execute();
@@ -1665,22 +1676,24 @@ PlatformPluginUpdater = __decorate([
1665
1676
  ,
1666
1677
  __param(0, Inject(KernelDb)),
1667
1678
  __param(1, Inject(TransactionHost)),
1668
- __param(2, Inject(SuperAdminLock)),
1669
- __param(3, Inject(CatalogItemLock)),
1670
- __param(4, Inject(OrgLock)),
1671
- __param(5, Inject(LockService)),
1672
- __param(6, Inject(StorageService)),
1673
- __param(7, Inject(ExtensionRegistry)),
1674
- __param(8, Inject(ExtensionAdminOps)),
1675
- __param(9, Inject(ExtensionBlobs)),
1676
- __param(10, Inject(KernelConfigService)),
1677
- __param(11, Inject(PlatformComponents)),
1678
- __param(12, Inject(PluginInstaller)),
1679
- __param(13, Inject(ConnectorsService)),
1680
- __param(14, Inject(PluginScopeSync)),
1681
- __param(15, Inject(KERNEL_LOGGER)),
1682
- __param(16, Inject(PluginGuides)),
1683
- __param(17, Inject(OutboxService))
1679
+ __param(2, Inject(XactLock)),
1680
+ __param(3, Inject(KernelEvents)),
1681
+ __param(4, Inject(SuperAdminLock)),
1682
+ __param(5, Inject(CatalogItemLock)),
1683
+ __param(6, Inject(OrgLock)),
1684
+ __param(7, Inject(LockService)),
1685
+ __param(8, Inject(StorageService)),
1686
+ __param(9, Inject(ExtensionRegistry)),
1687
+ __param(10, Inject(ExtensionAdminOps)),
1688
+ __param(11, Inject(ExtensionBlobs)),
1689
+ __param(12, Inject(KernelConfigService)),
1690
+ __param(13, Inject(PlatformComponents)),
1691
+ __param(14, Inject(PluginInstaller)),
1692
+ __param(15, Inject(ConnectorsService)),
1693
+ __param(16, Inject(PluginScopeSync)),
1694
+ __param(17, Inject(KERNEL_LOGGER)),
1695
+ __param(18, Inject(PluginGuides)),
1696
+ __param(19, Inject(OutboxService))
1684
1697
  ], PlatformPluginUpdater);
1685
1698
  export { PlatformPluginUpdater };
1686
1699
  /** The preview of a diff (without `guideChanges`, which reads PG). */
@@ -1,5 +1,6 @@
1
1
  import { sql } from "kysely";
2
2
  import { ApiError } from "../errors.js";
3
+ import { extensionSourcesQuery } from "../extensions/plugin-items.js";
3
4
  import { audit } from "../identity/audit.js";
4
5
  import { isUsable } from "./ownership.js";
5
6
  import { visibleTo } from "./scope.js";
@@ -95,19 +96,30 @@ export function pluginItemDisabled(names) {
95
96
  */
96
97
  export async function assertPluginSourcesInstallable(t, orgId, plugin) {
97
98
  const rows = await t
98
- .selectFrom("extension_catalog_sources as s")
99
- .innerJoin("catalog_items as i", "i.id", "s.item_id")
100
- .select(["i.id", "i.disabled", "i.scope", "i.builtin"])
101
- .where("s.plugin", "=", plugin)
102
- .where("i.deleted_at", "is", null)
99
+ .selectFrom(extensionSourcesQuery(t, plugin).as("source"))
100
+ .innerJoin("catalog_items as i", "i.id", "source.item_id")
101
+ .select([
102
+ "i.id",
103
+ "i.disabled",
104
+ "i.scope",
105
+ "i.builtin",
106
+ "i.deleted_at",
107
+ "i.owner_org_id",
108
+ "i.shareable",
109
+ ])
103
110
  .orderBy("i.id")
104
111
  .forShare("i")
105
112
  .execute();
106
- if (rows.some((r) => r.disabled))
113
+ const live = rows.filter((row) => row.deleted_at === null);
114
+ if (live.some((row) => row.disabled))
107
115
  throw itemDisabled();
108
- for (const r of rows)
109
- if (!(await offeredTo(t, orgId, r)))
116
+ if (rows.length > 0 && live.length === 0)
117
+ throw notOffered();
118
+ for (const row of live) {
119
+ if ((row.owner_org_id !== null && row.owner_org_id !== orgId && !row.shareable) ||
120
+ !(await offeredTo(t, orgId, row)))
110
121
  throw notOffered();
122
+ }
111
123
  }
112
124
  /**
113
125
  * Cancels catalog requests still pending in the caller's transaction (`db` is its handle; when the
@@ -2,6 +2,7 @@ import { sql } from "kysely";
2
2
  import { audit } from "../identity/audit.js";
3
3
  import { notifyItemShared } from "../inbox/org-notices.js";
4
4
  import { assertShareable, shareGate } from "./ownership.js";
5
+ import { addNamedPluginOrg } from "./scope-writer.js";
5
6
  /**
6
7
  * Adds one org to a `named` item's list in the caller's transaction (the caller holds the item row
7
8
  * `FOR UPDATE`): audits `catalog.scope_changed` the way a scope change
@@ -25,13 +26,7 @@ export async function addScopeOrg(db, actor, item, orgId, opts = {}) {
25
26
  return false;
26
27
  assertShareable(item);
27
28
  }
28
- const added = await db
29
- .insertInto("catalog_item_scope_orgs")
30
- .values({ item_id: item.id, org_id: orgId })
31
- .onConflict((oc) => oc.doNothing())
32
- .returning("org_id")
33
- .executeTakeFirst();
34
- if (added === undefined)
29
+ if (!(await addNamedPluginOrg(db, item.id, orgId)))
35
30
  return false;
36
31
  await db
37
32
  .updateTable("catalog_items")
@@ -1,10 +1,10 @@
1
1
  import type { KernelSchemaDb } from "../db/kernel-schema.js";
2
- /**
3
- * Whether the item's own scope wants it on in the org (`wantedOn` over the item's scope, builtin
4
- * and disabled flags, the org's list membership and its switch), read through `db` (the caller's
5
- * transaction under the org row lock, or the pool). A deleted or missing item is not wanted.
6
- */
2
+ /** Whether the item's own scope wants it on in the org, independent of dependencies. */
7
3
  export declare function wantedByScope(db: KernelSchemaDb, orgId: string, itemId: string): Promise<boolean>;
4
+ /** The committed plugin intent, including any authorized dependency root. */
5
+ export declare function pluginUsable(db: KernelSchemaDb, orgId: string, itemId: string): Promise<boolean>;
6
+ /** Direct intent still owes an effect attempt when a blocked dependency denies execution. */
7
+ export declare function pluginEffectsWanted(db: KernelSchemaDb, orgId: string, itemId: string): Promise<boolean>;
8
8
  /**
9
9
  * A scope sync install (`via: "scope"`) found, under the org row lock, that the item is no longer
10
10
  * wanted in the org (a person switched it off, or the scope changed, after the sync's decision):
@@ -32,4 +32,4 @@ export declare class ScopeStillWanted extends Error {
32
32
  * orgs, through the share gate). A hidden `named` item outside its list is left out, so nothing
33
33
  * reveals it to the org.
34
34
  */
35
- export declare function itemsSeenBy(db: KernelSchemaDb, orgId: string, itemIds: readonly string[]): Promise<Set<string>>;
35
+ export declare function itemsSeenBy(db: KernelSchemaDb, orgId: string, itemIds: readonly string[], view?: "catalog" | "offered"): Promise<Set<string>>;
@@ -1,32 +1,24 @@
1
- import { requestable, visibleTo, wantedOn } from "./scope.js";
2
- /**
3
- * Whether the item's own scope wants it on in the org (`wantedOn` over the item's scope, builtin
4
- * and disabled flags, the org's list membership and its switch), read through `db` (the caller's
5
- * transaction under the org row lock, or the pool). A deleted or missing item is not wanted.
6
- */
1
+ import { orgPluginDirectIntent, orgPluginEffectIntent, orgSees, orgUsable } from "./org-intent.js";
2
+ /** Whether the item's own scope wants it on in the org, independent of dependencies. */
7
3
  export async function wantedByScope(db, orgId, itemId) {
8
- const item = await db
9
- .selectFrom("catalog_items")
10
- .select(["scope", "builtin", "disabled"])
11
- .where("id", "=", itemId)
12
- .where("deleted_at", "is", null)
13
- .executeTakeFirst();
14
- if (!item)
15
- return false;
16
- // one after the other: `db` may be a transaction's single connection
17
- const listed = await db
18
- .selectFrom("catalog_item_scope_orgs")
19
- .select("item_id")
20
- .where("item_id", "=", itemId)
21
- .where("org_id", "=", orgId)
4
+ const item = await orgPluginDirectIntent(db, orgId)
5
+ .where("item.id", "=", itemId)
22
6
  .executeTakeFirst();
23
- const sw = await db
24
- .selectFrom("catalog_item_org_switches")
25
- .select("enabled")
26
- .where("item_id", "=", itemId)
27
- .where("org_id", "=", orgId)
28
- .executeTakeFirst();
29
- return wantedOn(item, listed !== undefined, sw?.enabled ?? null);
7
+ return item?.directIntent === true;
8
+ }
9
+ /** The committed plugin intent, including any authorized dependency root. */
10
+ export async function pluginUsable(db, orgId, itemId) {
11
+ const row = await db
12
+ .selectNoFrom(orgUsable(db, orgId, itemId).as("usable"))
13
+ .executeTakeFirstOrThrow();
14
+ return row.usable;
15
+ }
16
+ /** Direct intent still owes an effect attempt when a blocked dependency denies execution. */
17
+ export async function pluginEffectsWanted(db, orgId, itemId) {
18
+ const row = await db
19
+ .selectNoFrom(orgPluginEffectIntent(db, orgId, itemId).as("wanted"))
20
+ .executeTakeFirstOrThrow();
21
+ return row.wanted;
30
22
  }
31
23
  /**
32
24
  * A scope sync install (`via: "scope"`) found, under the org row lock, that the item is no longer
@@ -65,23 +57,12 @@ export class ScopeStillWanted extends Error {
65
57
  * orgs, through the share gate). A hidden `named` item outside its list is left out, so nothing
66
58
  * reveals it to the org.
67
59
  */
68
- export async function itemsSeenBy(db, orgId, itemIds) {
60
+ export async function itemsSeenBy(db, orgId, itemIds, view = "catalog") {
69
61
  if (itemIds.length === 0)
70
62
  return new Set();
71
- const items = await db
72
- .selectFrom("catalog_items")
73
- .select(["id", "scope", "builtin", "shown_to_others", "owner_org_id", "shareable"])
74
- .where("id", "in", [...itemIds])
75
- .where("deleted_at", "is", null)
63
+ const items = await orgSees(db, orgId, true, view)
64
+ .select("item.id")
65
+ .where("item.id", "in", [...itemIds])
76
66
  .execute();
77
- const listed = new Set((await db
78
- .selectFrom("catalog_item_scope_orgs")
79
- .select("item_id")
80
- .where("org_id", "=", orgId)
81
- .where("item_id", "in", [...itemIds])
82
- .execute()).map((r) => r.item_id));
83
- return new Set(items
84
- .filter((i) => visibleTo({ scope: i.builtin ? "all" : i.scope }, listed.has(i.id)) ||
85
- requestable(i, listed.has(i.id)))
86
- .map((i) => i.id));
67
+ return new Set(items.map((item) => item.id));
87
68
  }
@@ -1,24 +1,20 @@
1
1
  import { WorkerHost } from "@nestjs/bullmq";
2
2
  import type { Job, Worker } from "bullmq";
3
3
  import type { KernelLogger } from "../log.js";
4
- import { PluginScopeSync, type ScopeJob } from "./scope-sync.js";
5
- /**
6
- * The consumer of {@link PLUGIN_SCOPE_QUEUE}: {@link PluginScopeSync} runs the `scope-item`,
7
- * `scope-item-chunk` and `scope-org` jobs the outbox delivers (any other name fails the job). A
8
- * chunk or org job with a pair whose extension this replica has not loaded yet throws, so BullMQ
9
- * retries it with the registry's backoff; its last attempt installs anyway.
10
- */
11
- export declare class PluginScopeSyncProcessor extends WorkerHost<Worker<ScopeJob>> {
4
+ import { type EffectJob } from "./effect-work.js";
5
+ import { PluginScopeSync } from "./scope-sync.js";
6
+ /** Runs one generation of effects for one org and item. */
7
+ export declare class PluginScopeSyncProcessor extends WorkerHost<Worker<EffectJob>> {
12
8
  private readonly sync;
13
9
  private readonly log;
14
10
  private readonly stopping;
15
- constructor(sync: PluginScopeSync, log: Pick<KernelLogger, "error" | "warn">);
16
- process(job: Job<ScopeJob>): Promise<void>;
11
+ constructor(sync: PluginScopeSync, log: Pick<KernelLogger, "error">);
12
+ process(job: Job<EffectJob>): Promise<void>;
17
13
  /** Starts consuming (worker role, after the extensions loaded; built with `autorun: false`). */
18
14
  start(): void;
19
15
  /** Stops between pairs and closes the worker. */
20
16
  close(): Promise<void>;
21
- failed(job: Job<ScopeJob> | undefined, err: Error): void;
17
+ failed(job: Job<EffectJob> | undefined, err: Error): void;
22
18
  error(err: Error): void;
23
19
  }
24
20
  /**
@@ -13,13 +13,9 @@ import { configuredProcessor } from "../infra/queue/configured-processor.js";
13
13
  import { runJob } from "../infra/queue/run-job.js";
14
14
  import { KERNEL_LOGGER } from "../infra/tokens.js";
15
15
  import { CatalogModule } from "./catalog.module.js";
16
- import { PLUGIN_SCOPE_CONCURRENCY, PLUGIN_SCOPE_QUEUE, PluginScopeSync, SCOPE_CHUNK_JOB, SCOPE_ITEM_JOB, SCOPE_ORG_JOB, ScopeSyncDeferred, } from "./scope-sync.js";
17
- /**
18
- * The consumer of {@link PLUGIN_SCOPE_QUEUE}: {@link PluginScopeSync} runs the `scope-item`,
19
- * `scope-item-chunk` and `scope-org` jobs the outbox delivers (any other name fails the job). A
20
- * chunk or org job with a pair whose extension this replica has not loaded yet throws, so BullMQ
21
- * retries it with the registry's backoff; its last attempt installs anyway.
22
- */
16
+ import { PLUGIN_EFFECT_JOB, PLUGIN_EFFECT_QUEUE } from "./effect-work.js";
17
+ import { PLUGIN_SCOPE_CONCURRENCY, PluginScopeSync } from "./scope-sync.js";
18
+ /** Runs one generation of effects for one org and item. */
23
19
  let PluginScopeSyncProcessor = class PluginScopeSyncProcessor extends WorkerHost {
24
20
  sync;
25
21
  log;
@@ -30,20 +26,12 @@ let PluginScopeSyncProcessor = class PluginScopeSyncProcessor extends WorkerHost
30
26
  this.log = log;
31
27
  }
32
28
  process(job) {
33
- return runJob(PLUGIN_SCOPE_QUEUE, job, () => {
34
- if (![SCOPE_ITEM_JOB, SCOPE_CHUNK_JOB, SCOPE_ORG_JOB].includes(job.name)) {
35
- throw new Error(`unknown plugin scope job ${job.name}`);
36
- }
29
+ return runJob(PLUGIN_EFFECT_QUEUE, job, () => {
30
+ if (job.name !== PLUGIN_EFFECT_JOB)
31
+ throw new Error(`unknown plugin effect job ${job.name}`);
37
32
  if (job.id === undefined)
38
- throw new Error("a plugin scope job has no id");
39
- return this.sync.process(job.data, {
40
- jobId: job.id,
41
- finalAttempt: job.attemptsMade + 1 >= (job.opts.attempts ?? 1),
42
- signal: this.stopping.signal,
43
- });
44
- }, {
45
- // an item or chunk job spans the orgs of a platform item; an org job carries its orgId
46
- platform: "plugin scope sync of a platform item",
33
+ throw new Error("a plugin effect job has no id");
34
+ return this.sync.process(job.data, job.id, this.stopping.signal);
47
35
  });
48
36
  }
49
37
  /** Starts consuming (worker role, after the extensions loaded; built with `autorun: false`). */
@@ -57,11 +45,7 @@ let PluginScopeSyncProcessor = class PluginScopeSyncProcessor extends WorkerHost
57
45
  }
58
46
  failed(job, err) {
59
47
  const meta = { name: job?.name, jobId: job?.id, attempt: job?.attemptsMade, err };
60
- // waiting for a replica to load an extension is expected: retried with the backoff
61
- if (err instanceof ScopeSyncDeferred)
62
- this.log.warn("plugin scope job deferred", meta);
63
- else
64
- this.log.error("plugin scope job failed", meta);
48
+ this.log.error("plugin effect job failed", meta);
65
49
  }
66
50
  error(err) {
67
51
  this.log.error("plugin scope worker error", { err });
@@ -90,7 +74,7 @@ PluginScopeWorkersModule = __decorate([
90
74
  Module({
91
75
  imports: [CatalogModule],
92
76
  providers: [
93
- configuredProcessor(PluginScopeSyncProcessor, PLUGIN_SCOPE_QUEUE, {
77
+ configuredProcessor(PluginScopeSyncProcessor, PLUGIN_EFFECT_QUEUE, {
94
78
  concurrency: PLUGIN_SCOPE_CONCURRENCY,
95
79
  }),
96
80
  ],