@capybara-hq/kernel 0.1.0-rc.121 → 0.1.0-rc.123

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 (230) hide show
  1. package/bootstrap.json +3 -3
  2. package/dist/background/finish.d.ts +5 -1
  3. package/dist/background/finish.js +29 -18
  4. package/dist/background/launch.d.ts +0 -5
  5. package/dist/background/launch.js +1 -6
  6. package/dist/background/managed.js +1 -4
  7. package/dist/background/poll.job.d.ts +3 -25
  8. package/dist/background/poll.job.js +20 -112
  9. package/dist/background/render.d.ts +2 -8
  10. package/dist/background/render.js +3 -17
  11. package/dist/background/stop.d.ts +15 -16
  12. package/dist/background/stop.js +39 -76
  13. package/dist/background/store.d.ts +17 -45
  14. package/dist/background/store.js +60 -94
  15. package/dist/background/tasks.service.d.ts +2 -5
  16. package/dist/background/tasks.service.js +9 -20
  17. package/dist/background/wake.js +3 -2
  18. package/dist/catalog/admin-catalog.controller.d.ts +2 -18
  19. package/dist/catalog/admin-catalog.controller.js +2 -28
  20. package/dist/catalog/catalog-content.d.ts +1 -5
  21. package/dist/catalog/catalog-items.d.ts +2 -6
  22. package/dist/catalog/catalog-items.js +5 -26
  23. package/dist/catalog/catalog-scope.service.d.ts +1 -121
  24. package/dist/catalog/catalog-scope.service.js +12 -552
  25. package/dist/catalog/catalog.service.d.ts +4 -15
  26. package/dist/catalog/catalog.service.js +7 -35
  27. package/dist/catalog/job-ids.d.ts +0 -18
  28. package/dist/catalog/job-ids.js +0 -20
  29. package/dist/catalog/marketplaces.service.d.ts +1 -1
  30. package/dist/catalog/org-catalog.service.js +6 -20
  31. package/dist/catalog/org-plugin-uploads.controller.d.ts +4 -19
  32. package/dist/catalog/org-plugin-uploads.controller.js +6 -34
  33. package/dist/catalog/org-plugin-uploads.d.ts +3 -10
  34. package/dist/catalog/org-plugin-uploads.js +4 -18
  35. package/dist/catalog/org-plugin-uploads.schemas.js +0 -1
  36. package/dist/catalog/owned-items.d.ts +6 -11
  37. package/dist/catalog/owned-items.js +10 -20
  38. package/dist/catalog/ownership.d.ts +3 -29
  39. package/dist/catalog/ownership.js +4 -54
  40. package/dist/catalog/platform-components.d.ts +5 -11
  41. package/dist/catalog/platform-components.js +8 -15
  42. package/dist/catalog/plugin-import.d.ts +3 -42
  43. package/dist/catalog/plugin-import.js +26 -195
  44. package/dist/catalog/plugin-install.js +1 -6
  45. package/dist/catalog/plugin-package.d.ts +1 -0
  46. package/dist/catalog/plugin-package.js +5 -0
  47. package/dist/catalog/plugin-upgrade.d.ts +3 -26
  48. package/dist/catalog/plugin-upgrade.js +20 -103
  49. package/dist/catalog/request-rules.js +4 -6
  50. package/dist/catalog/scope-sync.js +2 -4
  51. package/dist/catalog/scope.d.ts +2 -5
  52. package/dist/channels/jobs.d.ts +3 -3
  53. package/dist/channels/jobs.js +4 -3
  54. package/dist/channels/outbound.d.ts +1 -0
  55. package/dist/channels/outbound.js +32 -8
  56. package/dist/config/load.d.ts +0 -25
  57. package/dist/config/load.js +0 -57
  58. package/dist/config/schema.js +2 -3
  59. package/dist/conversations/attachments.service.js +3 -5
  60. package/dist/conversations/conversations.service.d.ts +3 -3
  61. package/dist/conversations/conversations.service.js +3 -3
  62. package/dist/conversations/job-org.d.ts +3 -0
  63. package/dist/conversations/job-org.js +11 -0
  64. package/dist/conversations/prompt-suggestions.d.ts +2 -7
  65. package/dist/conversations/prompt-suggestions.js +29 -27
  66. package/dist/conversations/titles.d.ts +3 -4
  67. package/dist/conversations/titles.js +19 -30
  68. package/dist/db/kernel-schema.d.ts +6 -16
  69. package/dist/db/pool.js +7 -2
  70. package/dist/devices/devices.controller.d.ts +0 -5
  71. package/dist/devices/devices.controller.js +2 -20
  72. package/dist/devices/devices.service.d.ts +1 -17
  73. package/dist/devices/devices.service.js +0 -22
  74. package/dist/errors.d.ts +1 -5
  75. package/dist/errors.js +1 -5
  76. package/dist/evals/judge.d.ts +3 -0
  77. package/dist/evals/judge.js +1 -1
  78. package/dist/evals/run-replay.d.ts +1 -1
  79. package/dist/evals/run-replay.js +26 -29
  80. package/dist/evals/step-replay.d.ts +3 -1
  81. package/dist/evals/step-replay.js +10 -1
  82. package/dist/evals/worker.d.ts +3 -1
  83. package/dist/evals/worker.js +53 -21
  84. package/dist/extensions/deployment-config-store.js +18 -14
  85. package/dist/extensions/effective-config.d.ts +1 -5
  86. package/dist/extensions/effective-config.js +1 -5
  87. package/dist/extensions/hooks.d.ts +3 -1
  88. package/dist/extensions/hooks.js +7 -2
  89. package/dist/extensions/installs.d.ts +2 -14
  90. package/dist/extensions/installs.js +10 -32
  91. package/dist/extensions/org-config.d.ts +3 -4
  92. package/dist/extensions/org-config.js +3 -4
  93. package/dist/extensions/plugin-guides.d.ts +0 -1
  94. package/dist/extensions/plugin-guides.js +0 -1
  95. package/dist/extensions/plugin-icons.d.ts +0 -1
  96. package/dist/extensions/plugin-icons.js +0 -3
  97. package/dist/files/blob-sweep.job.d.ts +2 -11
  98. package/dist/files/blob-sweep.job.js +7 -21
  99. package/dist/files/hash-job.d.ts +5 -15
  100. package/dist/files/hash-job.js +14 -33
  101. package/dist/files/library-jobs.module.d.ts +1 -6
  102. package/dist/files/library-jobs.module.js +3 -9
  103. package/dist/identity/api-tokens.js +54 -40
  104. package/dist/identity/auth.guard.js +2 -2
  105. package/dist/identity/sessions.js +7 -3
  106. package/dist/identity/settings.js +5 -21
  107. package/dist/inbox/inbox.service.d.ts +2 -3
  108. package/dist/inbox/org-notices.d.ts +0 -14
  109. package/dist/inbox/platform-inbox.service.d.ts +1 -8
  110. package/dist/inbox/platform-inbox.service.js +2 -6
  111. package/dist/inbox/platform-notices.d.ts +3 -3
  112. package/dist/index.d.ts +0 -4
  113. package/dist/index.js +0 -3
  114. package/dist/infra/database/database.module.js +2 -1
  115. package/dist/infra/database/org-scope.d.ts +5 -3
  116. package/dist/infra/database/org-scope.js +7 -1
  117. package/dist/infra/database/scoped-dialect.d.ts +3 -1
  118. package/dist/infra/database/scoped-dialect.js +17 -5
  119. package/dist/infra/events/kernel-events.d.ts +2 -0
  120. package/dist/infra/outbox/outbox.service.d.ts +2 -0
  121. package/dist/infra/outbox/outbox.service.js +10 -0
  122. package/dist/infra/outbox/registry.d.ts +0 -41
  123. package/dist/infra/outbox/registry.js +0 -37
  124. package/dist/models/embeddings.d.ts +0 -5
  125. package/dist/models/embeddings.js +28 -35
  126. package/dist/models/images.d.ts +3 -8
  127. package/dist/models/images.js +19 -37
  128. package/dist/models/purposes.d.ts +7 -2
  129. package/dist/models/purposes.js +16 -3
  130. package/dist/orgs/device-network-setting.d.ts +0 -44
  131. package/dist/orgs/device-network-setting.js +0 -83
  132. package/dist/orgs/invitations.service.js +34 -30
  133. package/dist/orgs/offboarding.d.ts +2 -2
  134. package/dist/orgs/offboarding.js +2 -2
  135. package/dist/orgs/orgs.service.d.ts +1 -1
  136. package/dist/orgs/orgs.service.js +19 -15
  137. package/dist/orgs/settings.service.d.ts +19 -14
  138. package/dist/orgs/settings.service.js +12 -37
  139. package/dist/platform/exclusions.js +0 -11
  140. package/dist/platform/ops/catalog-admin.ops.js +0 -8
  141. package/dist/platform/ops/devices.ops.js +0 -28
  142. package/dist/platform/ops/extensions-admin.ops.js +3 -3
  143. package/dist/platform/ops/inbox.ops.js +5 -22
  144. package/dist/platform/ops/org-plugins.ops.d.ts +1 -3
  145. package/dist/platform/ops/org-plugins.ops.js +11 -67
  146. package/dist/roles/worker.module.js +0 -9
  147. package/dist/runtime/hook-calls.d.ts +13 -6
  148. package/dist/runtime/hook-calls.js +26 -4
  149. package/dist/runtime/maintenance.d.ts +3 -12
  150. package/dist/runtime/maintenance.js +25 -55
  151. package/dist/runtime/model-call.d.ts +4 -2
  152. package/dist/runtime/model-call.js +59 -58
  153. package/dist/runtime/providers.d.ts +27 -1
  154. package/dist/runtime/providers.js +57 -0
  155. package/dist/runtime/run-jobs.d.ts +1 -1
  156. package/dist/runtime/run-processors.d.ts +3 -9
  157. package/dist/runtime/run-worker.d.ts +2 -0
  158. package/dist/runtime/run-worker.js +23 -8
  159. package/dist/runtime/subagents/deliveries.js +6 -1
  160. package/dist/runtime/subagents/dispatch.d.ts +3 -3
  161. package/dist/runtime/write-base.service.d.ts +2 -3
  162. package/dist/runtime/write-base.service.js +3 -5
  163. package/dist/sandbox/device-sandbox-settings.d.ts +38 -92
  164. package/dist/sandbox/device-sandbox-settings.js +19 -325
  165. package/dist/sandbox/jobs.d.ts +3 -14
  166. package/dist/sandbox/jobs.js +2 -20
  167. package/dist/sandbox/modes.d.ts +5 -45
  168. package/dist/sandbox/modes.js +3 -60
  169. package/dist/sandbox/operation-authority.js +0 -11
  170. package/dist/sandbox/operation-intents.d.ts +32 -9
  171. package/dist/sandbox/operation-intents.js +241 -32
  172. package/dist/sandbox/operation-intents.module.js +2 -1
  173. package/dist/sandbox/operation-reconcile.job.d.ts +9 -11
  174. package/dist/sandbox/operation-reconcile.job.js +119 -33
  175. package/dist/sandbox/operation-revoke.d.ts +20 -0
  176. package/dist/sandbox/operation-revoke.js +3 -0
  177. package/dist/sandbox/permission-ceiling-writes.d.ts +1 -2
  178. package/dist/sandbox/permission-ceiling-writes.js +3 -6
  179. package/dist/sandbox/permission-config-publication.d.ts +1 -28
  180. package/dist/sandbox/permission-config-publication.js +14 -211
  181. package/dist/sandbox/permission-facts.d.ts +4 -15
  182. package/dist/sandbox/permission-facts.js +7 -29
  183. package/dist/sandbox/permission-instance-writes.d.ts +1 -4
  184. package/dist/sandbox/permission-instance-writes.js +1 -55
  185. package/dist/sandbox/providers.d.ts +1 -6
  186. package/dist/sandbox/providers.js +1 -15
  187. package/dist/sandbox/review/classifier.js +12 -13
  188. package/dist/sandbox/sandbox.module.js +3 -6
  189. package/dist/sandbox/sandbox.service.d.ts +17 -123
  190. package/dist/sandbox/sandbox.service.js +239 -998
  191. package/dist/shares/liveness.d.ts +1 -2
  192. package/dist/shares/liveness.js +1 -2
  193. package/dist/shares/shares.module.d.ts +1 -2
  194. package/dist/shares/shares.module.js +2 -5
  195. package/dist/shares/shares.service.js +1 -2
  196. package/dist/tools/builtins/image/generate.js +7 -15
  197. package/dist/tools/builtins/sandbox/common.d.ts +0 -2
  198. package/dist/tools/builtins/sandbox/common.js +1 -27
  199. package/dist/tools/builtins/sandbox/task-list.js +10 -10
  200. package/dist/tools/builtins/sandbox/task-output.d.ts +3 -10
  201. package/dist/tools/builtins/sandbox/task-output.js +13 -83
  202. package/dist/tools/builtins/sandbox/task-stop.js +18 -22
  203. package/dist/tools/builtins/vision/read-image.js +9 -10
  204. package/dist/tools/builtins/web/extract.js +9 -10
  205. package/package.json +3 -3
  206. package/src/migrations/0206_retire_org_extension_uploads.sql +125 -0
  207. package/src/migrations/0207_confirm_device_instance_destruction.sql +25 -0
  208. package/src/migrations/0208_convert_stored_permission_settings.sql +189 -0
  209. package/dist/background/retire-legacy-tasks.job.d.ts +0 -57
  210. package/dist/background/retire-legacy-tasks.job.js +0 -149
  211. package/dist/catalog/owned-plugin-cleanup.d.ts +0 -47
  212. package/dist/catalog/owned-plugin-cleanup.js +0 -140
  213. package/dist/config/permission-migration.d.ts +0 -34
  214. package/dist/config/permission-migration.js +0 -115
  215. package/dist/devices/legacy-cleanup.job.d.ts +0 -34
  216. package/dist/devices/legacy-cleanup.job.js +0 -147
  217. package/dist/files/library-backfill.d.ts +0 -63
  218. package/dist/files/library-backfill.js +0 -143
  219. package/dist/infra/cli/permission-cutover.d.ts +0 -59
  220. package/dist/infra/cli/permission-cutover.js +0 -107
  221. package/dist/sandbox/cloud-permission-snapshot.d.ts +0 -159
  222. package/dist/sandbox/cloud-permission-snapshot.js +0 -430
  223. package/dist/sandbox/cloud-permission-snapshot.module.d.ts +0 -8
  224. package/dist/sandbox/cloud-permission-snapshot.module.js +0 -34
  225. package/dist/sandbox/legacy-retirement.d.ts +0 -284
  226. package/dist/sandbox/legacy-retirement.js +0 -1165
  227. package/dist/sandbox/legacy-retirement.module.d.ts +0 -8
  228. package/dist/sandbox/legacy-retirement.module.js +0 -25
  229. package/dist/shares/share-objects.d.ts +0 -47
  230. package/dist/shares/share-objects.js +0 -93
@@ -7,12 +7,11 @@ import { SuperAdminLock } from "../identity/super-admin.js";
7
7
  import { KernelConfigService } from "../infra/config/kernel-config.service.js";
8
8
  import { KernelDb } from "../infra/database/kernel-db.js";
9
9
  import { TransactionHost } from "../infra/database/transaction-host.js";
10
- import { OutboxService } from "../infra/outbox/outbox.service.js";
11
10
  import { OrgLock } from "../orgs/org-lock.js";
12
11
  import type { TranslationReport } from "./claude/report.js";
13
12
  import { type GitLocation } from "./git-source.js";
14
13
  import { MarketplacesService } from "./marketplaces.service.js";
15
- import { type Owner } from "./ownership.js";
14
+ import type { Owner } from "./ownership.js";
16
15
  import { PluginImport, type PluginReview } from "./plugin-import.js";
17
16
  import type { PluginScope } from "./scope.js";
18
17
  /** Item policy (C22): allow (default for new imports) / needs_approval / disabled (no new installs; existing ones stay). */
@@ -52,10 +51,6 @@ export interface CatalogItemView {
52
51
  * shareable`, P3-1); false for platform items, which pass the gate anyway.
53
52
  */
54
53
  shareable: boolean;
55
- /** An org's upload carrying an extension waits for the super admin's confirmation (P3-9). */
56
- awaitingConfirmation: boolean;
57
- /** The org-uploaded version that waits for that confirmation (null: none). */
58
- pendingVersion: string | null;
59
54
  /** Orgs it is on in: orgs with a live plugin install of it (every org for a builtin plugin). */
60
55
  enabledOrgs: number;
61
56
  /**
@@ -257,8 +252,6 @@ export declare class CatalogService {
257
252
  private readonly marketplaces;
258
253
  /** Serializes a claim release with an install of that name still committing (F10). */
259
254
  private readonly installLock;
260
- /** A removed org-owned plugin's cleanup job, owed by the removal (transactional outbox §8.1). */
261
- private readonly outbox;
262
255
  /** The orgs whose connectors a delete switches off, locked before the item (ruling P3-50). */
263
256
  private readonly orgLock;
264
257
  readonly txHost: TransactionHost;
@@ -273,8 +266,6 @@ export declare class CatalogService {
273
266
  marketplaces: MarketplacesService,
274
267
  /** Serializes a claim release with an install of that name still committing (F10). */
275
268
  installLock: PluginInstallLock,
276
- /** A removed org-owned plugin's cleanup job, owed by the removal (transactional outbox §8.1). */
277
- outbox: Pick<OutboxService, "add">,
278
269
  /** The orgs whose connectors a delete switches off, locked before the item (ruling P3-50). */
279
270
  orgLock: OrgLock, txHost: TransactionHost);
280
271
  /** The kernel-schema handle of the current context (the transaction, else the pool). */
@@ -382,11 +373,9 @@ export declare class CatalogService {
382
373
  /**
383
374
  * The soft delete of {@link remove} in the caller's transaction, without its super admin check
384
375
  * (pre-flight F14: the super admin's remove and an owner's delete or an org deletion,
385
- * `OwnedItems.transferOrRemove`, share it): `deleted_at` set, a pending version cleared, the
386
- * extension name claim of a first upload still waiting released (ruling P3-37, F10), its themes
387
- * soft-deleted (refused with 409 `theme.platform_default` while one is the platform default),
388
- * pending requests cancelled, an org-owned item's cleanup job owed
389
- * (`owned-plugin-cleanup-<itemId>`), audit `catalog.removed` (`actor` null: the kernel). Returns
376
+ * `OwnedItems.transferOrRemove`, share it): sets `deleted_at` and soft-deletes its themes.
377
+ * The platform default theme prevents removal with 409 `theme.platform_default`.
378
+ * pending requests cancelled, and `catalog.removed` audited (`actor` null: the kernel). Returns
390
379
  * the removed item's name, or null when it is gone already.
391
380
  */
392
381
  removeIn(actor: string | null, itemId: string, opts?: ActorOpts & {
@@ -20,16 +20,13 @@ import { KernelConfigService } from "../infra/config/kernel-config.service.js";
20
20
  import { KernelDb } from "../infra/database/kernel-db.js";
21
21
  import { TransactionHost } from "../infra/database/transaction-host.js";
22
22
  import { Transactional } from "../infra/database/transactional.decorator.js";
23
- import { OutboxService } from "../infra/outbox/outbox.service.js";
24
23
  import { OrgLock } from "../orgs/org-lock.js";
25
24
  import { sameRepository } from "../packages/provenance.js";
26
25
  import { assertNotPlatformDefault } from "../themes/theme-usage.js";
27
26
  import { countInstalls, inAuthorOrder, itemConfirmations, itemScopeFacts, itemView, marketplaceLatest, versionUsable, } from "./catalog-items.js";
28
27
  import { expandGitUrl, GitSourceError, gitErrorDetails, normalGitPath, readGitTreeAndOids, resolveGitCommit, } from "./git-source.js";
29
- import { oweOwnedPluginCleanup } from "./job-ids.js";
30
28
  import { fetchMarketplaceArchive, marketplaceNetPolicy, marketplaceUrlProblem, } from "./marketplace-fetch.js";
31
29
  import { assertEntryNotDeprecated, entryCompatible, entrySourceHost, HOST_VERSIONS, hostAllowed, loadMarketplaceEntry, MarketplacesService, pluginNameFrom, } from "./marketplaces.service.js";
32
- import { releaseExtensionClaim } from "./ownership.js";
33
30
  import { switchOffItemConnectors } from "./plugin-connectors.js";
34
31
  import { PluginImport } from "./plugin-import.js";
35
32
  import { cancelPendingRequests } from "./request-rules.js";
@@ -103,7 +100,6 @@ let CatalogService = class CatalogService {
103
100
  pluginImport;
104
101
  marketplaces;
105
102
  installLock;
106
- outbox;
107
103
  orgLock;
108
104
  txHost;
109
105
  constructor(kdb,
@@ -117,8 +113,6 @@ let CatalogService = class CatalogService {
117
113
  marketplaces,
118
114
  /** Serializes a claim release with an install of that name still committing (F10). */
119
115
  installLock,
120
- /** A removed org-owned plugin's cleanup job, owed by the removal (transactional outbox §8.1). */
121
- outbox,
122
116
  /** The orgs whose connectors a delete switches off, locked before the item (ruling P3-50). */
123
117
  orgLock, txHost) {
124
118
  this.kdb = kdb;
@@ -129,7 +123,6 @@ let CatalogService = class CatalogService {
129
123
  this.pluginImport = pluginImport;
130
124
  this.marketplaces = marketplaces;
131
125
  this.installLock = installLock;
132
- this.outbox = outbox;
133
126
  this.orgLock = orgLock;
134
127
  this.txHost = txHost;
135
128
  }
@@ -411,7 +404,6 @@ let CatalogService = class CatalogService {
411
404
  "manifest",
412
405
  "source_format",
413
406
  "applied_at",
414
- "rejected_at",
415
407
  ])
416
408
  .where("item_id", "in", items.map((i) => i.id))
417
409
  .execute();
@@ -419,7 +411,7 @@ let CatalogService = class CatalogService {
419
411
  const byItem = new Map();
420
412
  for (const v of versions) {
421
413
  // a platform item offers only versions it may use (a transferred org item's rejected or
422
- // never-applied uploads stay out, ruling P3-52); an org item's pending ones show in 待确认
414
+ // never-applied uploads stay out, ruling P3-52)
423
415
  if (platformOwned.has(v.item_id) && !versionUsable(v))
424
416
  continue;
425
417
  const list = byItem.get(v.item_id) ?? [];
@@ -573,11 +565,9 @@ let CatalogService = class CatalogService {
573
565
  /**
574
566
  * The soft delete of {@link remove} in the caller's transaction, without its super admin check
575
567
  * (pre-flight F14: the super admin's remove and an owner's delete or an org deletion,
576
- * `OwnedItems.transferOrRemove`, share it): `deleted_at` set, a pending version cleared, the
577
- * extension name claim of a first upload still waiting released (ruling P3-37, F10), its themes
578
- * soft-deleted (refused with 409 `theme.platform_default` while one is the platform default),
579
- * pending requests cancelled, an org-owned item's cleanup job owed
580
- * (`owned-plugin-cleanup-<itemId>`), audit `catalog.removed` (`actor` null: the kernel). Returns
568
+ * `OwnedItems.transferOrRemove`, share it): sets `deleted_at` and soft-deletes its themes.
569
+ * The platform default theme prevents removal with 409 `theme.platform_default`.
570
+ * pending requests cancelled, and `catalog.removed` audited (`actor` null: the kernel). Returns
581
571
  * the removed item's name, or null when it is gone already.
582
572
  */
583
573
  async removeIn(actor, itemId, opts = {}) {
@@ -599,30 +589,13 @@ let CatalogService = class CatalogService {
599
589
  .set({
600
590
  deleted_at: now,
601
591
  updated_at: now,
602
- pending_version: null,
603
- pending_by: null,
604
- pending_at: null,
605
592
  })
606
593
  .where("id", "=", itemId)
607
594
  .where("deleted_at", "is", null)
608
- .returning(["name", "awaiting_confirmation", "package_name", "owner_org_id"])
595
+ .returning(["name", "owner_org_id"])
609
596
  .executeTakeFirst();
610
597
  if (!row)
611
598
  return null;
612
- // An org upload still waiting: free the name when nothing is installed under its claim
613
- // (ruling P3-37, pre-flight F10). Under the install lock, so an install a running confirmation
614
- // is committing is seen: that claim stays for its take-out or the cleanup job
615
- if (row.awaiting_confirmation && row.package_name !== null) {
616
- await this.installLock.lock(row.name);
617
- await releaseExtensionClaim(t, row.name, row.package_name);
618
- }
619
- // An org-owned plugin: its extension is taken out (and its name claim released) by the cleanup
620
- // job the removal owes, whoever removes it (the super admin, its owner, an org deletion). Also
621
- // while its first upload still waits: a confirmation may have committed its install and not
622
- // reached its take-out yet (the job is idempotent; nothing installed changes nothing)
623
- if (row.owner_org_id !== null) {
624
- await oweOwnedPluginCleanup(this.outbox, itemId);
625
- }
626
599
  // Its themes go with it (themes spec §6): nothing refers to a theme row (a theme picked by an
627
600
  // org or a person is an id that falls back once no live theme has it)
628
601
  await t
@@ -672,8 +645,7 @@ CatalogService = __decorate([
672
645
  __param(5, Inject(PluginImport)),
673
646
  __param(6, Inject(MarketplacesService)),
674
647
  __param(7, Inject(PluginInstallLock)),
675
- __param(8, Inject(OutboxService)),
676
- __param(9, Inject(OrgLock)),
677
- __param(10, Inject(TransactionHost))
648
+ __param(8, Inject(OrgLock)),
649
+ __param(9, Inject(TransactionHost))
678
650
  ], CatalogService);
679
651
  export { CatalogService };
@@ -1,4 +1,3 @@
1
- import type { OutboxService } from "../infra/outbox/outbox.service.js";
2
1
  /** The catalog's job names and ids (a leaf module: type imports only). */
3
2
  /**
4
3
  * Periodic marketplace refresh (C26), every `marketplaces.refreshIntervalMinutes` (a
@@ -39,20 +38,3 @@ export declare const TEMPLATE_CONNECTORS_SWEEP_CURSOR_KEY = "templateConnectorsS
39
38
  export declare const TEMPLATE_CONNECTOR_REFUSAL_WARNED_PREFIX = "cap:kernel:template-connector-warned:";
40
39
  /** How long a refusal stays warned about: a day, then it is warned about once more. */
41
40
  export declare const TEMPLATE_CONNECTOR_REFUSAL_WARNED_TTL_MS = 86400000;
42
- /**
43
- * The one-off job that takes out the extension of a removed org-owned plugin (spec §14, P3-20,
44
- * P3-21; `OwnedPluginCleanup.run`), on `cap-kernel-maintenance`.
45
- */
46
- export declare const OWNED_PLUGIN_CLEANUP_JOB = "owned-plugin-cleanup";
47
- /** The data of an {@link OWNED_PLUGIN_CLEANUP_JOB}. */
48
- export interface OwnedPluginCleanupData {
49
- itemId: string;
50
- }
51
- /** The cleanup job id of one removed item (no `:`: item ids are UUIDs). */
52
- export declare const ownedPluginCleanupJobId: (itemId: string) => string;
53
- /**
54
- * Owes the cleanup of removed item `itemId` in the transaction in context (transactional outbox
55
- * spec §8.1): the removal and its cleanup commit together. Platform work (no org: the owner org
56
- * may be the one being deleted). The job's options are its outbox registry entry's.
57
- */
58
- export declare function oweOwnedPluginCleanup(outbox: Pick<OutboxService, "add">, itemId: string): Promise<boolean>;
@@ -38,23 +38,3 @@ export const TEMPLATE_CONNECTORS_SWEEP_CURSOR_KEY = "templateConnectorsSweepCurs
38
38
  export const TEMPLATE_CONNECTOR_REFUSAL_WARNED_PREFIX = "cap:kernel:template-connector-warned:";
39
39
  /** How long a refusal stays warned about: a day, then it is warned about once more. */
40
40
  export const TEMPLATE_CONNECTOR_REFUSAL_WARNED_TTL_MS = 86_400_000;
41
- /**
42
- * The one-off job that takes out the extension of a removed org-owned plugin (spec §14, P3-20,
43
- * P3-21; `OwnedPluginCleanup.run`), on `cap-kernel-maintenance`.
44
- */
45
- export const OWNED_PLUGIN_CLEANUP_JOB = "owned-plugin-cleanup";
46
- /** The cleanup job id of one removed item (no `:`: item ids are UUIDs). */
47
- export const ownedPluginCleanupJobId = (itemId) => `${OWNED_PLUGIN_CLEANUP_JOB}-${itemId}`;
48
- /**
49
- * Owes the cleanup of removed item `itemId` in the transaction in context (transactional outbox
50
- * spec §8.1): the removal and its cleanup commit together. Platform work (no org: the owner org
51
- * may be the one being deleted). The job's options are its outbox registry entry's.
52
- */
53
- export function oweOwnedPluginCleanup(outbox, itemId) {
54
- return outbox.add({
55
- queue: "cap-kernel-maintenance",
56
- name: OWNED_PLUGIN_CLEANUP_JOB,
57
- jobId: ownedPluginCleanupJobId(itemId),
58
- data: { itemId },
59
- });
60
- }
@@ -208,7 +208,7 @@ export declare function headsToResolve(entries: readonly MarketplaceEntry[], imp
208
208
  /** The host versions (an entry's `minKernel` is judged against them). */
209
209
  export declare const HOST_VERSIONS: {
210
210
  readonly kernel: string;
211
- readonly sdk: "0.1.0-rc.95";
211
+ readonly sdk: "0.1.0-rc.96";
212
212
  };
213
213
  /** Whether this deployment satisfies the entry's `minKernel`. */
214
214
  export declare const entryCompatible: (e: Pick<MarketplaceEntry, "minKernel">) => boolean;
@@ -26,7 +26,7 @@ import { catalogHasIcon, findConnectorIn, orgTemplateView, readCatalogAgentTempl
26
26
  import { itemView, ownerOnlyFacts, versionUsable } from "./catalog-items.js";
27
27
  import { connectorTemplatesOn } from "./component-state.js";
28
28
  import { LIVE_INSTALL_STATUSES } from "./install-status.js";
29
- import { itemPendingError, ownerOf, ownersOf } from "./ownership.js";
29
+ import { ownerOf, ownersOf } from "./ownership.js";
30
30
  import { PluginInstaller, uninstallPreviewHash, upsertOrgSwitch, } from "./plugin-install.js";
31
31
  import { schemaPathTitle } from "./schema-path.js";
32
32
  import { requestable, switchable, visibleTo, wantedOn } from "./scope.js";
@@ -123,10 +123,8 @@ let OrgCatalogService = class OrgCatalogService {
123
123
  const inList = new Set(listed.map((r) => r.item_id));
124
124
  // Hidden `named` items (not listed, not shown to other orgs) are absent; shown ones are
125
125
  // `not_offered`
126
- // An org upload waiting for the super admin is its owner's only (ruling P3-9)
127
- const items = all.filter((i) => (!i.awaiting_confirmation || i.owner_org_id === orgId) &&
128
- (visibleTo({ scope: i.builtin ? "all" : i.scope }, inList.has(i.id)) ||
129
- requestable(i, inList.has(i.id))));
126
+ const items = all.filter((i) => visibleTo({ scope: i.builtin ? "all" : i.scope }, inList.has(i.id)) ||
127
+ requestable(i, inList.has(i.id)));
130
128
  if (items.length === 0)
131
129
  return [];
132
130
  const sw = new Map(switches.map((r) => [r.item_id, r.enabled]));
@@ -143,7 +141,6 @@ let OrgCatalogService = class OrgCatalogService {
143
141
  "object_prefix",
144
142
  "files",
145
143
  "applied_at",
146
- "rejected_at",
147
144
  ])
148
145
  .where("item_id", "in", ids)
149
146
  .execute(),
@@ -191,7 +188,7 @@ let OrgCatalogService = class OrgCatalogService {
191
188
  const vs = versions.filter((v) => v.item_id === i.id &&
192
189
  (i.owner_org_id === orgId ||
193
190
  (versionUsable(v) && (i.owner_org_id === null || v.version === i.latest_version))));
194
- const { installs: _installs, marketplaceId: _source, latestMarketplaceVersion: _latest, newerInMarketplace: _newer, scopeOrgs: _scopeOrgs, enabledOrgs: _enabledOrgs, offCount: _offCount, pending: _pending, shownToOthers: _shown, awaitingConfirmation, pendingVersion, ...view } = itemView(i, vs, 0, undefined, ownerOnlyFacts(ownerOf(i.owner_org_id, owners)));
191
+ const { installs: _installs, marketplaceId: _source, latestMarketplaceVersion: _latest, newerInMarketplace: _newer, scopeOrgs: _scopeOrgs, enabledOrgs: _enabledOrgs, offCount: _offCount, pending: _pending, shownToOthers: _shown, ...view } = itemView(i, vs, 0, undefined, ownerOnlyFacts(ownerOf(i.owner_org_id, owners)));
195
192
  const latest = vs.find((v) => v.version === i.latest_version);
196
193
  const a = pluginInstalls.find((x) => x.item_id === i.id);
197
194
  const scope = i.builtin ? "all" : i.scope;
@@ -205,9 +202,7 @@ let OrgCatalogService = class OrgCatalogService {
205
202
  const configInvalid = async () => extName !== undefined &&
206
203
  loaded.has(extName) &&
207
204
  !(await this.effective.get(orgId, extName)).ok;
208
- if (i.awaiting_confirmation)
209
- state = "awaiting_confirmation";
210
- else if (i.disabled) {
205
+ if (i.disabled) {
211
206
  state = "unavailable";
212
207
  reason = "plugin_disabled";
213
208
  }
@@ -234,13 +229,11 @@ let OrgCatalogService = class OrgCatalogService {
234
229
  }
235
230
  out.push({
236
231
  ...view,
237
- // A pending upload is the owner's business only (other orgs never learn of it)
238
- ...(i.owner_org_id === orgId && { awaitingConfirmation, pendingVersion }),
239
232
  scope,
240
233
  builtin: i.builtin,
241
234
  state,
242
235
  ...(reason !== undefined && { reason }),
243
- switchable: state !== "not_offered" && state !== "awaiting_confirmation" && switchable(i),
236
+ switchable: state !== "not_offered" && switchable(i),
244
237
  notDeployed: latest !== undefined && undeployed.has(i.id),
245
238
  installed: a
246
239
  ? {
@@ -472,13 +465,6 @@ let OrgCatalogService = class OrgCatalogService {
472
465
  .executeTakeFirst();
473
466
  if (!item)
474
467
  throw itemNotFound();
475
- // An org upload waiting for the super admin: absent for other orgs, not switchable by its
476
- // owner (ruling P3-9)
477
- if (item.awaiting_confirmation) {
478
- if (item.owner_org_id !== orgId)
479
- throw itemNotFound();
480
- throw itemPendingError(item.name);
481
- }
482
468
  const listed = await this.db
483
469
  .selectFrom("catalog_item_scope_orgs")
484
470
  .select("item_id")
@@ -1,7 +1,6 @@
1
1
  import type { z } from "zod";
2
2
  import { type Principal } from "../identity/principal.js";
3
3
  import { type OrgContext } from "../orgs/org.guard.js";
4
- import { CatalogScopeService } from "./catalog-scope.service.js";
5
4
  import { OrgPluginUploads, type OrgUploadResult, type OrgUploadReview } from "./org-plugin-uploads.js";
6
5
  import { OrgUploadConfirmBody as ConfirmBody, OrgOwnedDeleteBody as DeleteBody, OrgOwnedPluginParams as OwnedParams, OrgOwnedShareableBody as ShareableBody, OrgUploadStagingParams as StagingParams } from "./org-plugin-uploads.schemas.js";
7
6
  import { type OwnedDeletePreview, OwnedItems } from "./owned-items.js";
@@ -16,7 +15,7 @@ export declare class OrgPluginUploadsController {
16
15
  /**
17
16
  * Prepares an upload (the tgz as the raw body, `application/octet-stream`, at most
18
17
  * `packages.maxBytes`): `{ stagingId, review, update }`, the staging kept 24 hours for this org.
19
- * The checks of the platform import, plus: `customSkills` = deny with skills or agent templates,
18
+ * Code is refused (403 `catalog.org_upload_code`). The checks of the platform import, plus: `customSkills` = deny with skills or agent templates,
20
19
  * or `customConnectors` = deny with connector templates -> 403 `catalog.custom_disabled`
21
20
  * (ruling P3-15'); a name live for another owner -> 409 `plugin.name_taken` (details
22
21
  * `[{ owner }]`); a dependency the org cannot use -> 409 `plugin.dependency_unavailable`
@@ -30,26 +29,19 @@ export declare class OrgPluginUploadsController {
30
29
  /**
31
30
  * Confirms the org's staged upload (201 `{ item, outcome }`): a new item owned by the org, scope
32
31
  * `named: [org]`, not shown to other orgs, `shareable` as sent (default false), installed in the
33
- * org by the scope sync (`installed`); a new version of its own item (`updated`). The checks of
34
- * prepare run again under the item name's lock (the first confirm of a name wins). A package
35
- * with an extension waits for the super admin (`pending`, ruling P3-10): stored, its extension
36
- * name claimed (another package's -> 409 `extension.name_conflict` naming the owner), nothing
37
- * installed or usable until confirmed in 待确认; a later upload replaces the pending version
38
- * (P3-11). A version without an extension for an item whose first version still waits replaces
39
- * that upload and is installed at once (`installed`).
32
+ * org by the scope sync (`installed`); a new version of its own item (`updated`).
40
33
  */
41
34
  confirm(principal: Principal, org: OrgContext, params: z.infer<typeof StagingParams>, body: z.infer<typeof ConfirmBody>): Promise<OrgUploadResult>;
42
35
  }
43
36
  /**
44
37
  * The org's own plugins (`/api/v1/orgs/:orgId/owned-plugins/*`, spec §14, P3-17 to P3-19): the
45
- * owner org's admin withdraws a pending upload, toggles 可共享 and deletes the plugin after a
38
+ * owner org's admin changes sharing and deletes the plugin after a
46
39
  * preview. Another org's or a platform plugin -> 404. Writes re-check the org admin under the org
47
40
  * row lock.
48
41
  */
49
42
  export declare class OrgOwnedPluginsController {
50
- private readonly scope;
51
43
  private readonly owned;
52
- constructor(scope: CatalogScopeService, owned: OwnedItems);
44
+ constructor(owned: OwnedItems);
53
45
  /**
54
46
  * Sets 可共享 (ruling P3-2: the plugin and its component rows in one transaction; turning it
55
47
  * off keeps the orgs already associated and hides it from new ones, ruling P3-25). 204.
@@ -67,11 +59,4 @@ export declare class OrgOwnedPluginsController {
67
59
  * 409 `catalog.preview_stale`. 204.
68
60
  */
69
61
  delete(principal: Principal, org: OrgContext, params: z.infer<typeof OwnedParams>, body: z.infer<typeof DeleteBody>): Promise<void>;
70
- /**
71
- * Withdraws the org's pending upload of the plugin (ruling P3-10, no notice): a first version
72
- * is removed (its name free again), a new version's pending state cleared (the platform version
73
- * keeps running). Another org's or a platform plugin -> 404; nothing pending -> 409
74
- * `extension.not_pending`. 204.
75
- */
76
- withdraw(principal: Principal, org: OrgContext, params: z.infer<typeof OwnedParams>): Promise<void>;
77
62
  }
@@ -7,13 +7,12 @@ 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 { Controller, Delete, Get, HttpCode, Inject, Post, Put, Req } from "@nestjs/common";
10
+ import { Controller, Get, HttpCode, Inject, Post, Put, Req } from "@nestjs/common";
11
11
  import { ApiError } from "../errors.js";
12
12
  import { CurrentPrincipal, patTokenId, requireUser, } from "../identity/principal.js";
13
13
  import { createZodDto } from "../infra/validation/create-zod-dto.js";
14
14
  import { ZBody, ZParam } from "../infra/validation/zod-params.js";
15
15
  import { CurrentOrg, OrgAction } from "../orgs/org.guard.js";
16
- import { CatalogScopeService } from "./catalog-scope.service.js";
17
16
  import { OrgPluginUploads, } from "./org-plugin-uploads.js";
18
17
  import { OrgUploadConfirmBody as ConfirmBody, OrgOwnedDeleteBody as DeleteBody, OrgOwnedPluginParams as OwnedParams, OrgOwnedShareableBody as ShareableBody, OrgUploadStagingParams as StagingParams, } from "./org-plugin-uploads.schemas.js";
19
18
  import { OwnedItems } from "./owned-items.js";
@@ -44,7 +43,7 @@ let OrgPluginUploadsController = class OrgPluginUploadsController {
44
43
  /**
45
44
  * Prepares an upload (the tgz as the raw body, `application/octet-stream`, at most
46
45
  * `packages.maxBytes`): `{ stagingId, review, update }`, the staging kept 24 hours for this org.
47
- * The checks of the platform import, plus: `customSkills` = deny with skills or agent templates,
46
+ * Code is refused (403 `catalog.org_upload_code`). The checks of the platform import, plus: `customSkills` = deny with skills or agent templates,
48
47
  * or `customConnectors` = deny with connector templates -> 403 `catalog.custom_disabled`
49
48
  * (ruling P3-15'); a name live for another owner -> 409 `plugin.name_taken` (details
50
49
  * `[{ owner }]`); a dependency the org cannot use -> 409 `plugin.dependency_unavailable`
@@ -65,13 +64,7 @@ let OrgPluginUploadsController = class OrgPluginUploadsController {
65
64
  /**
66
65
  * Confirms the org's staged upload (201 `{ item, outcome }`): a new item owned by the org, scope
67
66
  * `named: [org]`, not shown to other orgs, `shareable` as sent (default false), installed in the
68
- * org by the scope sync (`installed`); a new version of its own item (`updated`). The checks of
69
- * prepare run again under the item name's lock (the first confirm of a name wins). A package
70
- * with an extension waits for the super admin (`pending`, ruling P3-10): stored, its extension
71
- * name claimed (another package's -> 409 `extension.name_conflict` naming the owner), nothing
72
- * installed or usable until confirmed in 待确认; a later upload replaces the pending version
73
- * (P3-11). A version without an extension for an item whose first version still waits replaces
74
- * that upload and is installed at once (`installed`).
67
+ * org by the scope sync (`installed`); a new version of its own item (`updated`).
75
68
  */
76
69
  confirm(principal, org, params, body) {
77
70
  const actor = requireUser(principal);
@@ -111,15 +104,13 @@ OrgPluginUploadsController = __decorate([
111
104
  export { OrgPluginUploadsController };
112
105
  /**
113
106
  * The org's own plugins (`/api/v1/orgs/:orgId/owned-plugins/*`, spec §14, P3-17 to P3-19): the
114
- * owner org's admin withdraws a pending upload, toggles 可共享 and deletes the plugin after a
107
+ * owner org's admin changes sharing and deletes the plugin after a
115
108
  * preview. Another org's or a platform plugin -> 404. Writes re-check the org admin under the org
116
109
  * row lock.
117
110
  */
118
111
  let OrgOwnedPluginsController = class OrgOwnedPluginsController {
119
- scope;
120
112
  owned;
121
- constructor(scope, owned) {
122
- this.scope = scope;
113
+ constructor(owned) {
123
114
  this.owned = owned;
124
115
  }
125
116
  /**
@@ -147,16 +138,6 @@ let OrgOwnedPluginsController = class OrgOwnedPluginsController {
147
138
  const actor = requireUser(principal);
148
139
  await this.owned.delete(org.orgId, actor.account.id, params.id, body.previewHash, actorOpts(actor));
149
140
  }
150
- /**
151
- * Withdraws the org's pending upload of the plugin (ruling P3-10, no notice): a first version
152
- * is removed (its name free again), a new version's pending state cleared (the platform version
153
- * keeps running). Another org's or a platform plugin -> 404; nothing pending -> 409
154
- * `extension.not_pending`. 204.
155
- */
156
- async withdraw(principal, org, params) {
157
- const actor = requireUser(principal);
158
- await this.scope.withdraw(org.orgId, actor.account.id, params.id, actorOpts(actor));
159
- }
160
141
  };
161
142
  __decorate([
162
143
  Put(":id/shareable"),
@@ -183,17 +164,8 @@ __decorate([
183
164
  __param(2, ZParam(OrgOwnedPluginParamsDto)),
184
165
  __param(3, ZBody(OrgOwnedDeleteBodyDto))
185
166
  ], OrgOwnedPluginsController.prototype, "delete", null);
186
- __decorate([
187
- Delete(":id/pending"),
188
- HttpCode(204),
189
- OrgAction("catalog.upload"),
190
- __param(0, CurrentPrincipal()),
191
- __param(1, CurrentOrg()),
192
- __param(2, ZParam(OrgOwnedPluginParamsDto))
193
- ], OrgOwnedPluginsController.prototype, "withdraw", null);
194
167
  OrgOwnedPluginsController = __decorate([
195
168
  Controller("api/v1/orgs/:orgId/owned-plugins"),
196
- __param(0, Inject(CatalogScopeService)),
197
- __param(1, Inject(OwnedItems))
169
+ __param(0, Inject(OwnedItems))
198
170
  ], OrgOwnedPluginsController);
199
171
  export { OrgOwnedPluginsController };
@@ -1,4 +1,3 @@
1
- import type { SingleProviderNote } from "../extensions/single-provider.js";
2
1
  import type { ActorOpts, CatalogItemView } from "./catalog.service.js";
3
2
  import { PluginImport, type PluginReview } from "./plugin-import.js";
4
3
  import { PlatformPluginUpdater, type PlatformUpdatePreview } from "./plugin-upgrade.js";
@@ -12,26 +11,20 @@ export interface OrgUploadReview {
12
11
  review: PluginReview;
13
12
  /**
14
13
  * The platform update a new version of the org's own plugin without an extension applies at
15
- * once (ruling P3-12); null for a first upload and for a version with an extension (it waits for
16
- * the super admin, plan Task 6).
14
+ * once (ruling P3-12); null for a first upload.
17
15
  */
18
16
  update: PlatformUpdatePreview | null;
19
17
  }
20
18
  /**
21
19
  * What a confirmed org upload did: `installed` (a new item, installed in the owner org by the scope
22
- * sync), `pending` (waiting for the super admin: an extension, plan Task 6), `updated` (a new
20
+ * sync), or `updated` (a new
23
21
  * version of the org's own item, applied through the platform updater).
24
22
  */
25
- export type OrgUploadOutcome = "installed" | "pending" | "updated";
23
+ export type OrgUploadOutcome = "installed" | "updated";
26
24
  /** An org upload's confirmation. */
27
25
  export interface OrgUploadResult {
28
26
  item: CatalogItemView;
29
27
  outcome: OrgUploadOutcome;
30
- /**
31
- * The update installed the plugin's extension but left it disabled (a single-provider extension
32
- * point another enabled extension holds; `PlatformUpdateResult.extensionLeftDisabled`).
33
- */
34
- extensionLeftDisabled?: SingleProviderNote;
35
28
  }
36
29
  /** The hash an org confirms a new version with: the review's and the update's (P3-12). */
37
30
  export declare function ownerUpdateHash(reviewHash: string, diffHash: string): string;
@@ -56,15 +56,12 @@ let OrgPluginUploads = class OrgPluginUploads {
56
56
  */
57
57
  async confirm(actor, orgId, stagingId, input, opts = {}) {
58
58
  const st = await this.pluginImport.stagedTarget(stagingId, { orgId });
59
- if (!appliesAtOnce(st)) {
59
+ if (!st.existing) {
60
60
  const r = await this.pluginImport.confirm(actor, stagingId, input, {
61
61
  ...opts,
62
62
  owner: { orgId },
63
63
  });
64
- // A version waiting for the super admin is synced by their confirmation (P3-10)
65
- if (r.pending)
66
- return { item: r.item, outcome: "pending" };
67
- return { item: r.item, outcome: r.firstVersion ? "installed" : "updated" };
64
+ return { item: r.item, outcome: r.created ? "installed" : "updated" };
68
65
  }
69
66
  // The one hash covers the review and the update (P3-12): both recomputed now
70
67
  const preview = await this.updater.previewForOwner(orgId, st.itemId, st.version, st.target);
@@ -78,19 +75,16 @@ let OrgPluginUploads = class OrgPluginUploads {
78
75
  updateFollows: true,
79
76
  }, { ...opts, owner: { orgId } });
80
77
  // The version is committed; a failed update leaves it imported (uploading it again retries)
81
- const u = await this.updater.updateAsOwner(orgId, actor, r.item.id, st.version, preview.diffHash, opts);
78
+ await this.updater.updateAsOwner(orgId, actor, r.item.id, st.version, preview.diffHash, opts);
82
79
  return {
83
80
  item: await this.pluginImport.view(r.item.id),
84
81
  outcome: "updated",
85
- ...(u.extensionLeftDisabled !== undefined && {
86
- extensionLeftDisabled: u.extensionLeftDisabled,
87
- }),
88
82
  };
89
83
  }
90
84
  /** The review with the update preview of a new version and the combined hash (P3-12). */
91
85
  async withUpdate(orgId, stagingId, review) {
92
86
  const st = await this.pluginImport.stagedTarget(stagingId, { orgId });
93
- if (!appliesAtOnce(st))
87
+ if (!st.existing)
94
88
  return { stagingId, review, update: null };
95
89
  const update = await this.updater.previewForOwner(orgId, st.itemId, st.version, st.target);
96
90
  return {
@@ -106,11 +100,3 @@ OrgPluginUploads = __decorate([
106
100
  __param(1, Inject(PlatformPluginUpdater))
107
101
  ], OrgPluginUploads);
108
102
  export { OrgPluginUploads };
109
- /**
110
- * A new version of the org's own plugin without an extension: applied at once through the
111
- * platform updater (P3-12). Not while the item's first version still waits for the super admin:
112
- * such an upload replaces that first version instead (`PluginImport.commit`, plan Task 6).
113
- */
114
- function appliesAtOnce(st) {
115
- return st.existing && !st.extension && !st.awaiting;
116
- }
@@ -28,5 +28,4 @@ export const ORG_PLUGIN_UPLOAD_ROUTES = [
28
28
  params: OrgOwnedPluginParams,
29
29
  body: OrgOwnedDeleteBody,
30
30
  },
31
- { route: "DELETE /api/v1/orgs/:orgId/owned-plugins/:id/pending", params: OrgOwnedPluginParams },
32
31
  ];
@@ -125,7 +125,7 @@ export declare class OwnedItems {
125
125
  /**
126
126
  * The owner leaves its item, in the caller's transaction (P3-19, P3-20; pre-flight F14, F15).
127
127
  * Another live org uses it ({@link orgsUsing}) -> `transferred`: the item and its components
128
- * become platform-owned, a pending version is cleared, `shown_to_others` is turned off when the
128
+ * become platform-owned, `shown_to_others` is turned off when the
129
129
  * owner had not made it shareable (no exposure the owner switched off), the former owner leaves
130
130
  * the list and its switches (an `all` scope, the item's or a component's own, is narrowed to
131
131
  * `named` = the orgs using it, ruling P3-39; an `optional` item stays `optional`, ruling P3-40:
@@ -134,23 +134,18 @@ export declare class OwnedItems {
134
134
  * directly rather than through the guarded scope writer (ruling P3-27); platform notice
135
135
  * `ownership_transferred`, audit `catalog.ownership_transferred`, the scope sync owed with it
136
136
  * (it uninstalls the former owner's install). Otherwise -> `removed`: the soft delete of
137
- * `catalog.remove` ({@link CatalogService.removeIn}, which owes the cleanup job
138
- * `owned-plugin-cleanup-<itemId>` that takes its extension out); an owner delete
137
+ * `catalog.remove` ({@link CatalogService.removeIn}); an owner delete
139
138
  * (`owner_deleted`) also uninstalls it in the owner org through the normal uninstall, keeping the
140
- * connectors it created as the org's own (ruling P3-41). A first upload still waiting is never
141
- * transferred. A gone or platform item -> 404.
139
+ * connectors it created as the org's own (ruling P3-41). A gone or platform item -> 404.
142
140
  */
143
141
  transferOrRemove(ref: OwnedRef, reason: OwnerLeaveReason, actor: string | null, opts?: ActorOpts): Promise<"transferred" | "removed">;
144
142
  /**
145
143
  * An org is deleted (P3-20), in `OrgsService.softDeleteIn`'s transaction (PG writes only; the
146
144
  * org row is already marked deleted, so it counts as no user): the org's live plugins and the
147
145
  * platform skills and agent templates it promoted (ruling P3-3) are locked `FOR UPDATE`, then
148
- * each goes through {@link transferOrRemove} with reason `org_deleted`. A first upload still
149
- * waiting is removed and its extension name released here (nothing is installed under it,
150
- * pre-flight F10); a pending new version of a transferred plugin is cleared; a removed plugin's
151
- * extension is taken out by the cleanup job the deletion owes. The org's unpromoted rows (its own
152
- * skills, copies, installs) are left: they go with the org as before. Must not inject
153
- * `OrgsService` (it calls this).
146
+ * each goes through {@link transferOrRemove} with reason `org_deleted`. Unpromoted rows
147
+ * (the org’s own skills, copies and installs) are left for org deletion.
148
+ * `OrgsService` calls this method, so do not inject it here.
154
149
  */
155
150
  onOrgDeleted(orgId: string, actor: string | null, opts?: ActorOpts): Promise<{
156
151
  transferred: number;