@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
@@ -9,7 +9,7 @@ import { endpointCredentialIssues } from "../tools/endpoint.js";
9
9
  import { gitLocationIdentity } from "./git-source.js";
10
10
  import { LIVE_INSTALL_STATUSES } from "./install-status.js";
11
11
  import { entryCompatible, entryContentChanged, entryDeprecated, sourceEffective, unimportable, } from "./marketplaces.service.js";
12
- import { ownerOf, ownersOf, PLATFORM_OWNER, packageOwner, pendingDigest, } from "./ownership.js";
12
+ import { ownerOf, ownersOf, PLATFORM_OWNER, packageOwner } from "./ownership.js";
13
13
  import { schemaHasPath } from "./schema-path.js";
14
14
  import { compareVersions, newestFirst, sameRelease, withBuild } from "./versions.js";
15
15
  /**
@@ -310,7 +310,7 @@ export async function writeCatalogVersion(db, w) {
310
310
  translation: w.translation != null ? JSON.stringify(w.translation) : null,
311
311
  license_text: w.licenseText ?? null,
312
312
  license_truncated: w.licenseTruncated === true,
313
- // an org's version is usable only once applied or confirmed (ruling P3-52)
313
+ // an org's version is usable only once applied (ruling P3-52)
314
314
  ...(w.keepLatest === true && { applied_at: null }),
315
315
  })
316
316
  .execute();
@@ -334,7 +334,7 @@ export async function writeCatalogVersion(db, w) {
334
334
  return { id, created };
335
335
  }
336
336
  /**
337
- * Records that `version` of the item was applied or confirmed (ruling P3-52), in the caller's
337
+ * Records that `version` of the item was applied (ruling P3-52), in the caller's
338
338
  * transaction: from then on it may serve other orgs and the generic update. Idempotent.
339
339
  */
340
340
  export async function markVersionApplied(db, itemId, version) {
@@ -348,10 +348,10 @@ export async function markVersionApplied(db, itemId, version) {
348
348
  }
349
349
  /**
350
350
  * Whether a version may serve other orgs, dependency resolution and the generic update (ruling
351
- * P3-52): applied or confirmed, and never rejected, whoever owns the item now.
351
+ * P3-52): applied, whoever owns the item now.
352
352
  */
353
353
  export function versionUsable(v) {
354
- return v.applied_at !== null && v.rejected_at === null;
354
+ return v.applied_at !== null;
355
355
  }
356
356
  /**
357
357
  * An extension name belongs to the npm package that first installed it (`extension_name_owners`,
@@ -518,25 +518,6 @@ const NO_FACTS = ownerOnlyFacts(PLATFORM_OWNER);
518
518
  */
519
519
  export async function itemConfirmations(admin, items, versions) {
520
520
  const out = new Map();
521
- // An org-owned item waits only while an upload of it does (rulings P3-9, P3-10): the digest of
522
- // that version's package (P3-11); nothing else of an org's item is the super admin's to confirm
523
- for (const i of items) {
524
- if (i.owner_org_id === null)
525
- continue;
526
- const sha = i.pending_version === null
527
- ? null
528
- : ((versions.get(i.id) ?? []).find((v) => v.version === i.pending_version)
529
- ?.extension_sha256 ?? null);
530
- if (sha === null) {
531
- out.set(i.id, { pending: false, permissionsHash: null });
532
- continue;
533
- }
534
- const hash = await admin.packageReviewHash(sha);
535
- out.set(i.id, {
536
- pending: true,
537
- permissionsHash: hash === null ? null : pendingDigest(sha, hash),
538
- });
539
- }
540
521
  const withExtension = items.flatMap((i) => {
541
522
  if (i.owner_org_id !== null)
542
523
  return [];
@@ -671,8 +652,6 @@ export function itemView(i, versions, installs = 0, marketplace = { latest: null
671
652
  shownToOthers: i.shown_to_others,
672
653
  owner: facts.owner,
673
654
  shareable: i.shareable,
674
- awaitingConfirmation: i.awaiting_confirmation,
675
- pendingVersion: i.pending_version,
676
655
  enabledOrgs: facts.enabledOrgs,
677
656
  offCount: facts.offCount,
678
657
  pending: facts.pending,
@@ -1,21 +1,14 @@
1
1
  import { ApiError } from "../errors.js";
2
2
  import { ExtensionAdminOps } from "../extensions/admin-ops.js";
3
3
  import { ExtensionAdmin } from "../extensions/admin-view.js";
4
- import { PluginInstallLock } from "../extensions/locks.js";
5
4
  import { SuperAdminLock } from "../identity/super-admin.js";
6
5
  import { KernelDb } from "../infra/database/kernel-db.js";
7
6
  import { TransactionHost } from "../infra/database/transaction-host.js";
8
- import { OutboxService } from "../infra/outbox/outbox.service.js";
9
- import type { KernelLogger } from "../log.js";
10
- import { OrgLock } from "../orgs/org-lock.js";
11
7
  import { type ThemePreview } from "../themes/theme-usage.js";
12
8
  import { type ActorOpts, type CatalogItemView, CatalogService } from "./catalog.service.js";
13
9
  import { type ComponentKind } from "./component-state.js";
14
- import { CatalogItemLock } from "./locks.js";
15
- import { PlatformComponents } from "./platform-components.js";
16
10
  import { type PluginConfirmResult, PluginImport } from "./plugin-import.js";
17
11
  import { PluginInstaller } from "./plugin-install.js";
18
- import { PlatformPluginUpdater } from "./plugin-upgrade.js";
19
12
  import { type PluginScope } from "./scope.js";
20
13
  import { PluginScopeSync } from "./scope-sync.js";
21
14
  /**
@@ -98,34 +91,12 @@ export declare class CatalogScopeService {
98
91
  private readonly adminLock;
99
92
  private readonly catalog;
100
93
  private readonly pluginImport;
101
- /** A confirmed first version's platform components (written in the confirming commit). */
102
- private readonly platform;
103
- /** The import's item name lock, taken by the confirming commit before the item row. */
104
- private readonly itemLock;
105
94
  private readonly installer;
106
95
  private readonly extensions;
107
96
  private readonly ops;
108
97
  private readonly sync;
109
- private readonly updater;
110
- /** The owner org's lock: an org admin withdrawing its pending upload (ruling P3-10). */
111
- private readonly orgLock;
112
- /** The per-name install lock a reject / withdraw releases the name claim under (M1). */
113
- private readonly installLock;
114
- /** Owes the scope syncs and the removed org plugin's cleanup (P3-21, pre-flight F9). */
115
- private readonly outbox;
116
- private readonly log;
117
98
  readonly txHost: TransactionHost;
118
- constructor(kdb: KernelDb, adminLock: SuperAdminLock, catalog: CatalogService, pluginImport: PluginImport,
119
- /** A confirmed first version's platform components (written in the confirming commit). */
120
- platform: PlatformComponents,
121
- /** The import's item name lock, taken by the confirming commit before the item row. */
122
- itemLock: CatalogItemLock, installer: PluginInstaller, extensions: ExtensionAdmin, ops: ExtensionAdminOps, sync: PluginScopeSync, updater: PlatformPluginUpdater,
123
- /** The owner org's lock: an org admin withdrawing its pending upload (ruling P3-10). */
124
- orgLock: OrgLock,
125
- /** The per-name install lock a reject / withdraw releases the name claim under (M1). */
126
- installLock: PluginInstallLock,
127
- /** Owes the scope syncs and the removed org plugin's cleanup (P3-21, pre-flight F9). */
128
- outbox: Pick<OutboxService, "add">, log: KernelLogger, txHost: TransactionHost);
99
+ constructor(kdb: KernelDb, adminLock: SuperAdminLock, catalog: CatalogService, pluginImport: PluginImport, installer: PluginInstaller, extensions: ExtensionAdmin, ops: ExtensionAdminOps, sync: PluginScopeSync, txHost: TransactionHost);
129
100
  private get db();
130
101
  /**
131
102
  * Confirms a staged import ({@link PluginImport.confirm}: installs and enables the extension,
@@ -141,99 +112,8 @@ export declare class CatalogScopeService {
141
112
  * store from the import). Nothing waiting (a covered snapshot a person approved already, an item
142
113
  * without an extension) -> 409 `extension.not_pending`. The item's scope sync is owed by the
143
114
  * approval of an enabled extension, or by the enable.
144
- *
145
- * An org-owned item is confirmed only while an upload of it waits (ruling P3-10, see
146
- * {@link confirmOrgUpload}); otherwise -> 409 `extension.not_pending`.
147
115
  */
148
116
  confirmPermissions(actor: string, itemId: string, permissionsHash: string, opts?: ActorOpts): Promise<CatalogItemView>;
149
- /**
150
- * The super admin's confirmation of an org upload's pending version (rulings P3-10, P3-11,
151
- * P3-21): `permissionsHash` must be the digest of that version's package ({@link pendingDigest};
152
- * another -> 409 `extension.approval_stale`, also for a version a later upload replaced); no
153
- * pending version (withdrawn, rejected, replaced by one without an extension) -> 409
154
- * `extension.not_pending`.
155
- *
156
- * A first version: its platform components planned and their files copied (keyed by content),
157
- * its extension installed, its permissions approved, enabled, then (one transaction) the item
158
- * stops waiting, its platform component rows are written and the owner is told
159
- * (`upload_confirmed`) and the scope sync is owed in that commit. Each step re-reads
160
- * the item under its row lock: removed meanwhile -> 409 `catalog.item_removed`, the pending
161
- * version replaced -> `extension.approval_stale`; the extension this confirmation installed is
162
- * then taken out again. A new version: the platform update to it
163
- * ({@link PlatformPluginUpdater.updateToPending}, which installs or upgrades the extension,
164
- * clears the pending state, tells the owner and the orgs using a shared plugin), then its
165
- * permissions approved.
166
- */
167
- private confirmOrgUpload;
168
- /**
169
- * {@link confirmOrgUpload} under the item lock.
170
- */
171
- private confirmLocked;
172
- /** The item is live and its first version confirmed (no longer awaiting). */
173
- private confirmed;
174
- /**
175
- * The error a failed confirmation step answers with: 409 `catalog.item_removed` when the item is
176
- * gone or soft-deleted by now, whichever step failed (the removal's cleanup job may take the
177
- * extension out under the confirmation, so a step answers `extension.not_found`), the original
178
- * error logged; else (or when the item cannot be read) the original error.
179
- */
180
- private removalOr;
181
- /** Clears the pending state of a version an earlier confirmation applied already. */
182
- private clearPending;
183
- /**
184
- * Puts a confirmed new version's pending state back after its approval failed (ruling P3-37):
185
- * the version applied, its permissions still waiting, 待确认 shows it again. Not when another
186
- * upload is pending meanwhile.
187
- */
188
- private restorePending;
189
- /** Approves the permissions of the installed package `sha` (already covered: nothing to do). */
190
- private approvePackage;
191
- /**
192
- * An extension a confirmation installed whose item was removed or replaced meanwhile is taken
193
- * out again (disabled, uninstalled; P3-21), and the name claim released when the item is gone
194
- * (ruling P3-37), in one transaction ({@link takeOutIn}). Inline (a failure is logged): when the
195
- * take-out fails, a removed item's cleanup job (`owned-plugin-cleanup-<itemId>`, idempotent) is
196
- * owed instead, so the job retries it (pre-flight F9). That owe is the last resort: when it
197
- * fails too (PG unavailable) nothing retries the take-out, and it is logged as an error.
198
- */
199
- private takeOut;
200
- /**
201
- * {@link takeOut}'s transaction, in the global lock order (ruling P3-50): the super admin lock,
202
- * the item row, then the extension's install lock (taken by the disable): disabled,
203
- * uninstalled, and the name claim released when the item is gone.
204
- */
205
- private takeOutIn;
206
- /**
207
- * Owes the cleanup of a removed item; a live item owes nothing (a removal committing later owes
208
- * its own).
209
- */
210
- private oweCleanupIfGone;
211
- /** The item is still live and pending with `version` (row lock), else 409 (P3-21). */
212
- private stillPending;
213
- /** {@link stillPending} in the caller's transaction; returns the owner org. */
214
- private pendingRow;
215
- /**
216
- * A confirmed first version: the item stops waiting, its platform component rows are written
217
- * from `components` (a component changed since they were planned -> 409
218
- * `extension.approval_stale`: confirm again), the owner is told (`upload_confirmed`). The
219
- * import's item name lock before the item row, as an import's commit takes them (ruling P3-50).
220
- */
221
- private finishFirstVersion;
222
- /**
223
- * The super admin rejects an org upload's pending version (ruling P3-10, `reason` shown to the
224
- * owner in `upload_rejected`): a first version is removed (soft delete, its requests
225
- * cancelled), a new version's pending state cleared (the version stays imported, never applied);
226
- * the extension name claim is released when nothing is installed under it (pre-flight F10).
227
- * Nothing pending, or a platform-owned item (pre-flight F11) -> 409 `extension.not_pending`.
228
- */
229
- reject(actor: string, itemId: string, reason: string | null, opts?: ActorOpts): Promise<void>;
230
- /**
231
- * The owner org withdraws its pending upload (ruling P3-10): as {@link reject}, without a
232
- * notice. Another org's or a platform item -> 404; nothing pending -> 409
233
- * `extension.not_pending`.
234
- */
235
- withdraw(orgId: string, actor: string, itemId: string, opts?: ActorOpts): Promise<void>;
236
- private dropPending;
237
117
  /** The preview of a scope change or a disable (nothing written). */
238
118
  preview(itemId: string, target: ScopeTarget): Promise<ScopePreview>;
239
119
  /** Changes the scope after its preview (`scopeHash`); returns the item. */