@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.
- package/bootstrap.json +3 -3
- package/dist/background/finish.d.ts +5 -1
- package/dist/background/finish.js +29 -18
- package/dist/background/launch.d.ts +0 -5
- package/dist/background/launch.js +1 -6
- package/dist/background/managed.js +1 -4
- package/dist/background/poll.job.d.ts +3 -25
- package/dist/background/poll.job.js +20 -112
- package/dist/background/render.d.ts +2 -8
- package/dist/background/render.js +3 -17
- package/dist/background/stop.d.ts +15 -16
- package/dist/background/stop.js +39 -76
- package/dist/background/store.d.ts +17 -45
- package/dist/background/store.js +60 -94
- package/dist/background/tasks.service.d.ts +2 -5
- package/dist/background/tasks.service.js +9 -20
- package/dist/background/wake.js +3 -2
- package/dist/catalog/admin-catalog.controller.d.ts +2 -18
- package/dist/catalog/admin-catalog.controller.js +2 -28
- package/dist/catalog/catalog-content.d.ts +1 -5
- package/dist/catalog/catalog-items.d.ts +2 -6
- package/dist/catalog/catalog-items.js +5 -26
- package/dist/catalog/catalog-scope.service.d.ts +1 -121
- package/dist/catalog/catalog-scope.service.js +12 -552
- package/dist/catalog/catalog.service.d.ts +4 -15
- package/dist/catalog/catalog.service.js +7 -35
- package/dist/catalog/job-ids.d.ts +0 -18
- package/dist/catalog/job-ids.js +0 -20
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-catalog.service.js +6 -20
- package/dist/catalog/org-plugin-uploads.controller.d.ts +4 -19
- package/dist/catalog/org-plugin-uploads.controller.js +6 -34
- package/dist/catalog/org-plugin-uploads.d.ts +3 -10
- package/dist/catalog/org-plugin-uploads.js +4 -18
- package/dist/catalog/org-plugin-uploads.schemas.js +0 -1
- package/dist/catalog/owned-items.d.ts +6 -11
- package/dist/catalog/owned-items.js +10 -20
- package/dist/catalog/ownership.d.ts +3 -29
- package/dist/catalog/ownership.js +4 -54
- package/dist/catalog/platform-components.d.ts +5 -11
- package/dist/catalog/platform-components.js +8 -15
- package/dist/catalog/plugin-import.d.ts +3 -42
- package/dist/catalog/plugin-import.js +26 -195
- package/dist/catalog/plugin-install.js +1 -6
- package/dist/catalog/plugin-package.d.ts +1 -0
- package/dist/catalog/plugin-package.js +5 -0
- package/dist/catalog/plugin-upgrade.d.ts +3 -26
- package/dist/catalog/plugin-upgrade.js +20 -103
- package/dist/catalog/request-rules.js +4 -6
- package/dist/catalog/scope-sync.js +2 -4
- package/dist/catalog/scope.d.ts +2 -5
- package/dist/channels/jobs.d.ts +3 -3
- package/dist/channels/jobs.js +4 -3
- package/dist/channels/outbound.d.ts +1 -0
- package/dist/channels/outbound.js +32 -8
- package/dist/config/load.d.ts +0 -25
- package/dist/config/load.js +0 -57
- package/dist/config/schema.js +2 -3
- package/dist/conversations/attachments.service.js +3 -5
- package/dist/conversations/conversations.service.d.ts +3 -3
- package/dist/conversations/conversations.service.js +3 -3
- package/dist/conversations/job-org.d.ts +3 -0
- package/dist/conversations/job-org.js +11 -0
- package/dist/conversations/prompt-suggestions.d.ts +2 -7
- package/dist/conversations/prompt-suggestions.js +29 -27
- package/dist/conversations/titles.d.ts +3 -4
- package/dist/conversations/titles.js +19 -30
- package/dist/db/kernel-schema.d.ts +6 -16
- package/dist/db/pool.js +7 -2
- package/dist/devices/devices.controller.d.ts +0 -5
- package/dist/devices/devices.controller.js +2 -20
- package/dist/devices/devices.service.d.ts +1 -17
- package/dist/devices/devices.service.js +0 -22
- package/dist/errors.d.ts +1 -5
- package/dist/errors.js +1 -5
- package/dist/evals/judge.d.ts +3 -0
- package/dist/evals/judge.js +1 -1
- package/dist/evals/run-replay.d.ts +1 -1
- package/dist/evals/run-replay.js +26 -29
- package/dist/evals/step-replay.d.ts +3 -1
- package/dist/evals/step-replay.js +10 -1
- package/dist/evals/worker.d.ts +3 -1
- package/dist/evals/worker.js +53 -21
- package/dist/extensions/deployment-config-store.js +18 -14
- package/dist/extensions/effective-config.d.ts +1 -5
- package/dist/extensions/effective-config.js +1 -5
- package/dist/extensions/hooks.d.ts +3 -1
- package/dist/extensions/hooks.js +7 -2
- package/dist/extensions/installs.d.ts +2 -14
- package/dist/extensions/installs.js +10 -32
- package/dist/extensions/org-config.d.ts +3 -4
- package/dist/extensions/org-config.js +3 -4
- package/dist/extensions/plugin-guides.d.ts +0 -1
- package/dist/extensions/plugin-guides.js +0 -1
- package/dist/extensions/plugin-icons.d.ts +0 -1
- package/dist/extensions/plugin-icons.js +0 -3
- package/dist/files/blob-sweep.job.d.ts +2 -11
- package/dist/files/blob-sweep.job.js +7 -21
- package/dist/files/hash-job.d.ts +5 -15
- package/dist/files/hash-job.js +14 -33
- package/dist/files/library-jobs.module.d.ts +1 -6
- package/dist/files/library-jobs.module.js +3 -9
- package/dist/identity/api-tokens.js +54 -40
- package/dist/identity/auth.guard.js +2 -2
- package/dist/identity/sessions.js +7 -3
- package/dist/identity/settings.js +5 -21
- package/dist/inbox/inbox.service.d.ts +2 -3
- package/dist/inbox/org-notices.d.ts +0 -14
- package/dist/inbox/platform-inbox.service.d.ts +1 -8
- package/dist/inbox/platform-inbox.service.js +2 -6
- package/dist/inbox/platform-notices.d.ts +3 -3
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -3
- package/dist/infra/database/database.module.js +2 -1
- package/dist/infra/database/org-scope.d.ts +5 -3
- package/dist/infra/database/org-scope.js +7 -1
- package/dist/infra/database/scoped-dialect.d.ts +3 -1
- package/dist/infra/database/scoped-dialect.js +17 -5
- package/dist/infra/events/kernel-events.d.ts +2 -0
- package/dist/infra/outbox/outbox.service.d.ts +2 -0
- package/dist/infra/outbox/outbox.service.js +10 -0
- package/dist/infra/outbox/registry.d.ts +0 -41
- package/dist/infra/outbox/registry.js +0 -37
- package/dist/models/embeddings.d.ts +0 -5
- package/dist/models/embeddings.js +28 -35
- package/dist/models/images.d.ts +3 -8
- package/dist/models/images.js +19 -37
- package/dist/models/purposes.d.ts +7 -2
- package/dist/models/purposes.js +16 -3
- package/dist/orgs/device-network-setting.d.ts +0 -44
- package/dist/orgs/device-network-setting.js +0 -83
- package/dist/orgs/invitations.service.js +34 -30
- package/dist/orgs/offboarding.d.ts +2 -2
- package/dist/orgs/offboarding.js +2 -2
- package/dist/orgs/orgs.service.d.ts +1 -1
- package/dist/orgs/orgs.service.js +19 -15
- package/dist/orgs/settings.service.d.ts +19 -14
- package/dist/orgs/settings.service.js +12 -37
- package/dist/platform/exclusions.js +0 -11
- package/dist/platform/ops/catalog-admin.ops.js +0 -8
- package/dist/platform/ops/devices.ops.js +0 -28
- package/dist/platform/ops/extensions-admin.ops.js +3 -3
- package/dist/platform/ops/inbox.ops.js +5 -22
- package/dist/platform/ops/org-plugins.ops.d.ts +1 -3
- package/dist/platform/ops/org-plugins.ops.js +11 -67
- package/dist/roles/worker.module.js +0 -9
- package/dist/runtime/hook-calls.d.ts +13 -6
- package/dist/runtime/hook-calls.js +26 -4
- package/dist/runtime/maintenance.d.ts +3 -12
- package/dist/runtime/maintenance.js +25 -55
- package/dist/runtime/model-call.d.ts +4 -2
- package/dist/runtime/model-call.js +59 -58
- package/dist/runtime/providers.d.ts +27 -1
- package/dist/runtime/providers.js +57 -0
- package/dist/runtime/run-jobs.d.ts +1 -1
- package/dist/runtime/run-processors.d.ts +3 -9
- package/dist/runtime/run-worker.d.ts +2 -0
- package/dist/runtime/run-worker.js +23 -8
- package/dist/runtime/subagents/deliveries.js +6 -1
- package/dist/runtime/subagents/dispatch.d.ts +3 -3
- package/dist/runtime/write-base.service.d.ts +2 -3
- package/dist/runtime/write-base.service.js +3 -5
- package/dist/sandbox/device-sandbox-settings.d.ts +38 -92
- package/dist/sandbox/device-sandbox-settings.js +19 -325
- package/dist/sandbox/jobs.d.ts +3 -14
- package/dist/sandbox/jobs.js +2 -20
- package/dist/sandbox/modes.d.ts +5 -45
- package/dist/sandbox/modes.js +3 -60
- package/dist/sandbox/operation-authority.js +0 -11
- package/dist/sandbox/operation-intents.d.ts +32 -9
- package/dist/sandbox/operation-intents.js +241 -32
- package/dist/sandbox/operation-intents.module.js +2 -1
- package/dist/sandbox/operation-reconcile.job.d.ts +9 -11
- package/dist/sandbox/operation-reconcile.job.js +119 -33
- package/dist/sandbox/operation-revoke.d.ts +20 -0
- package/dist/sandbox/operation-revoke.js +3 -0
- package/dist/sandbox/permission-ceiling-writes.d.ts +1 -2
- package/dist/sandbox/permission-ceiling-writes.js +3 -6
- package/dist/sandbox/permission-config-publication.d.ts +1 -28
- package/dist/sandbox/permission-config-publication.js +14 -211
- package/dist/sandbox/permission-facts.d.ts +4 -15
- package/dist/sandbox/permission-facts.js +7 -29
- package/dist/sandbox/permission-instance-writes.d.ts +1 -4
- package/dist/sandbox/permission-instance-writes.js +1 -55
- package/dist/sandbox/providers.d.ts +1 -6
- package/dist/sandbox/providers.js +1 -15
- package/dist/sandbox/review/classifier.js +12 -13
- package/dist/sandbox/sandbox.module.js +3 -6
- package/dist/sandbox/sandbox.service.d.ts +17 -123
- package/dist/sandbox/sandbox.service.js +239 -998
- package/dist/shares/liveness.d.ts +1 -2
- package/dist/shares/liveness.js +1 -2
- package/dist/shares/shares.module.d.ts +1 -2
- package/dist/shares/shares.module.js +2 -5
- package/dist/shares/shares.service.js +1 -2
- package/dist/tools/builtins/image/generate.js +7 -15
- package/dist/tools/builtins/sandbox/common.d.ts +0 -2
- package/dist/tools/builtins/sandbox/common.js +1 -27
- package/dist/tools/builtins/sandbox/task-list.js +10 -10
- package/dist/tools/builtins/sandbox/task-output.d.ts +3 -10
- package/dist/tools/builtins/sandbox/task-output.js +13 -83
- package/dist/tools/builtins/sandbox/task-stop.js +18 -22
- package/dist/tools/builtins/vision/read-image.js +9 -10
- package/dist/tools/builtins/web/extract.js +9 -10
- package/package.json +3 -3
- package/src/migrations/0206_retire_org_extension_uploads.sql +125 -0
- package/src/migrations/0207_confirm_device_instance_destruction.sql +25 -0
- package/src/migrations/0208_convert_stored_permission_settings.sql +189 -0
- package/dist/background/retire-legacy-tasks.job.d.ts +0 -57
- package/dist/background/retire-legacy-tasks.job.js +0 -149
- package/dist/catalog/owned-plugin-cleanup.d.ts +0 -47
- package/dist/catalog/owned-plugin-cleanup.js +0 -140
- package/dist/config/permission-migration.d.ts +0 -34
- package/dist/config/permission-migration.js +0 -115
- package/dist/devices/legacy-cleanup.job.d.ts +0 -34
- package/dist/devices/legacy-cleanup.job.js +0 -147
- package/dist/files/library-backfill.d.ts +0 -63
- package/dist/files/library-backfill.js +0 -143
- package/dist/infra/cli/permission-cutover.d.ts +0 -59
- package/dist/infra/cli/permission-cutover.js +0 -107
- package/dist/sandbox/cloud-permission-snapshot.d.ts +0 -159
- package/dist/sandbox/cloud-permission-snapshot.js +0 -430
- package/dist/sandbox/cloud-permission-snapshot.module.d.ts +0 -8
- package/dist/sandbox/cloud-permission-snapshot.module.js +0 -34
- package/dist/sandbox/legacy-retirement.d.ts +0 -284
- package/dist/sandbox/legacy-retirement.js +0 -1165
- package/dist/sandbox/legacy-retirement.module.d.ts +0 -8
- package/dist/sandbox/legacy-retirement.module.js +0 -25
- package/dist/shares/share-objects.d.ts +0 -47
- 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
|
|
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
|
|
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
|
|
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
|
|
351
|
+
* P3-52): applied, whoever owns the item now.
|
|
352
352
|
*/
|
|
353
353
|
export function versionUsable(v) {
|
|
354
|
-
return v.applied_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. */
|