@capybara-hq/kernel 0.1.0-rc.146 → 0.1.0-rc.147
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/dist/admin/extensions.controller.d.ts +0 -11
- package/dist/admin/extensions.controller.js +0 -28
- package/dist/admin/health.service.d.ts +25 -1
- package/dist/admin/health.service.js +50 -18
- package/dist/audit/full-access.d.ts +78 -0
- package/dist/audit/full-access.js +283 -0
- package/dist/automations/automations.service.d.ts +1 -0
- package/dist/automations/automations.service.js +3 -1
- package/dist/automations/calendar.js +3 -1
- package/dist/automations/grant-rules.d.ts +2 -1
- package/dist/automations/grant-rules.js +8 -1
- package/dist/automations/unattended.d.ts +13 -1
- package/dist/automations/unattended.js +13 -1
- package/dist/catalog/admin-catalog.controller.d.ts +8 -0
- package/dist/catalog/admin-catalog.controller.js +8 -2
- package/dist/catalog/admin-catalog.schemas.d.ts +10 -0
- package/dist/catalog/admin-catalog.schemas.js +8 -1
- package/dist/catalog/catalog-content.d.ts +6 -0
- package/dist/catalog/catalog-scope.service.d.ts +22 -2
- package/dist/catalog/catalog-scope.service.js +27 -3
- package/dist/catalog/catalog.service.js +19 -2
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-catalog.service.d.ts +8 -1
- package/dist/catalog/org-catalog.service.js +36 -3
- package/dist/catalog/platform-components.js +3 -2
- package/dist/catalog/platform-import-update.d.ts +2 -0
- package/dist/catalog/platform-import-update.js +8 -1
- package/dist/catalog/plugin-connectors.d.ts +11 -0
- package/dist/catalog/plugin-connectors.js +33 -0
- package/dist/catalog/plugin-import.d.ts +35 -15
- package/dist/catalog/plugin-import.js +110 -35
- package/dist/catalog/plugin-install.js +6 -0
- package/dist/catalog/provenance.d.ts +2 -0
- package/dist/catalog/provenance.js +5 -1
- package/dist/config/auto-approve.d.ts +16 -0
- package/dist/config/auto-approve.js +24 -0
- package/dist/config/capacity-presets.d.ts +243 -0
- package/dist/config/capacity-presets.js +195 -0
- package/dist/config/env.d.ts +2 -1
- package/dist/config/env.js +6 -1
- package/dist/config/load.js +15 -0
- package/dist/config/schema.d.ts +46 -9
- package/dist/config/schema.js +154 -30
- package/dist/ctx/net.d.ts +5 -1
- package/dist/ctx/net.js +62 -12
- package/dist/db/kernel-schema.d.ts +31 -0
- package/dist/db/migrator.js +0 -36
- package/dist/dial-in/routes.js +1 -1
- package/dist/erasure/org-batches.js +1 -6
- package/dist/erasure/org-catalog.js +6 -2
- package/dist/erasure/org-rules.js +1 -0
- package/dist/erasure/org-worker.js +0 -13
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +6 -0
- package/dist/extensions/admin-ops.d.ts +14 -1
- package/dist/extensions/admin-ops.js +30 -3
- package/dist/extensions/admin-view.d.ts +21 -1
- package/dist/extensions/admin-view.js +43 -0
- package/dist/extensions/bootstrap-packages.d.ts +5 -0
- package/dist/extensions/bootstrap-packages.js +1 -1
- package/dist/extensions/bootstrap-review.d.ts +251 -0
- package/dist/extensions/bootstrap-review.js +676 -0
- package/dist/extensions/bootstrap.d.ts +21 -1
- package/dist/extensions/bootstrap.js +72 -2
- package/dist/extensions/cli.d.ts +6 -0
- package/dist/extensions/cli.js +4 -0
- package/dist/extensions/enabled.d.ts +3 -0
- package/dist/extensions/extensions.module.js +9 -0
- package/dist/extensions/full-access-disclosure.d.ts +15 -0
- package/dist/extensions/full-access-disclosure.js +57 -0
- package/dist/extensions/grant-epoch.d.ts +5 -0
- package/dist/extensions/grant-epoch.js +9 -0
- package/dist/extensions/host.d.ts +71 -2
- package/dist/extensions/host.js +293 -27
- package/dist/extensions/installs.d.ts +18 -0
- package/dist/extensions/installs.js +28 -0
- package/dist/extensions/isolated/admission.d.ts +17 -2
- package/dist/extensions/isolated/admission.js +15 -7
- package/dist/extensions/isolated/authorization.d.ts +8 -2
- package/dist/extensions/isolated/authorization.js +11 -3
- package/dist/extensions/isolated/broker.d.ts +3 -0
- package/dist/extensions/isolated/broker.js +50 -14
- package/dist/extensions/isolated/configured-package.d.ts +5 -0
- package/dist/extensions/isolated/configured-package.js +2 -0
- package/dist/extensions/isolated/lanes.d.ts +44 -3
- package/dist/extensions/isolated/lanes.js +263 -80
- package/dist/extensions/isolated/metrics.d.ts +146 -0
- package/dist/extensions/isolated/metrics.js +304 -0
- package/dist/extensions/isolated/revision.d.ts +7 -1
- package/dist/extensions/isolated/revision.js +26 -5
- package/dist/extensions/isolated/rpc.d.ts +5 -0
- package/dist/extensions/isolated/rpc.js +7 -2
- package/dist/extensions/isolated/sandbox.d.ts +23 -0
- package/dist/extensions/isolated/sandbox.js +50 -0
- package/dist/extensions/isolated/status.d.ts +79 -0
- package/dist/extensions/isolated/status.js +216 -0
- package/dist/extensions/isolated/tier.d.ts +127 -2
- package/dist/extensions/isolated/tier.js +266 -7
- package/dist/extensions/isolated/usage.d.ts +134 -0
- package/dist/extensions/isolated/usage.js +322 -0
- package/dist/extensions/lifecycle.d.ts +42 -2
- package/dist/extensions/lifecycle.js +100 -4
- package/dist/extensions/org-config.js +11 -0
- package/dist/extensions/package.d.ts +14 -0
- package/dist/extensions/package.js +23 -0
- package/dist/extensions/permissions.controller.d.ts +35 -0
- package/dist/extensions/permissions.controller.js +98 -0
- package/dist/extensions/permissions.schemas.d.ts +288 -0
- package/dist/extensions/permissions.schemas.js +96 -0
- package/dist/extensions/permissions.service.d.ts +116 -0
- package/dist/extensions/permissions.service.js +428 -0
- package/dist/extensions/realm-retirement.d.ts +65 -0
- package/dist/extensions/realm-retirement.js +150 -0
- package/dist/extensions/revision-approvals.d.ts +58 -3
- package/dist/extensions/revision-approvals.js +135 -14
- package/dist/extensions/revision-review.d.ts +144 -0
- package/dist/extensions/revision-review.js +297 -0
- package/dist/extensions/revocation.js +3 -0
- package/dist/extensions/state.module.js +12 -0
- package/dist/git/run-end.d.ts +35 -7
- package/dist/git/run-end.js +87 -38
- package/dist/http/api.module.js +2 -0
- package/dist/identity/audit.d.ts +2 -1
- package/dist/identity/audit.js +4 -17
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/infra/config/kernel-config.service.d.ts +6 -0
- package/dist/infra/config/kernel-config.service.js +21 -0
- package/dist/infra/outbox/registry.d.ts +13 -0
- package/dist/infra/outbox/registry.js +8 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +25 -1
- package/dist/lifecycle/kernel-lifecycle.js +73 -18
- package/dist/net/private-endpoint-preflight.d.ts +159 -0
- package/dist/net/private-endpoint-preflight.js +417 -0
- package/dist/net/private-endpoints.d.ts +68 -0
- package/dist/net/private-endpoints.js +164 -0
- package/dist/net/public-address.d.ts +14 -0
- package/dist/net/public-address.js +15 -1
- package/dist/net/safe-fetch.d.ts +2 -1
- package/dist/net/safe-fetch.js +10 -3
- package/dist/overrides.d.ts +4 -0
- package/dist/overrides.js +2 -0
- package/dist/packages/official-publisher.d.ts +26 -1
- package/dist/packages/official-publisher.js +48 -1
- package/dist/packages/provenance.d.ts +11 -0
- package/dist/packages/provenance.js +24 -0
- package/dist/platform/exclusions.js +4 -4
- package/dist/platform/ops/automations.ops.js +1 -1
- package/dist/platform/ops/catalog-admin.ops.js +25 -4
- package/dist/platform/ops/extension-permissions.ops.d.ts +11 -0
- package/dist/platform/ops/extension-permissions.ops.js +159 -0
- package/dist/platform/platform-ops.module.d.ts +2 -1
- package/dist/platform/platform-ops.module.js +2 -0
- package/dist/platform/route-schemas.js +2 -0
- package/dist/retention/purge-batch.js +10 -14
- package/dist/runtime/maintenance.d.ts +4 -2
- package/dist/runtime/maintenance.js +16 -3
- package/dist/runtime/run-finish.d.ts +3 -3
- package/dist/runtime/run-finish.js +7 -3
- package/dist/sandbox/permission-availability.d.ts +17 -2
- package/dist/sandbox/permission-availability.js +22 -1
- package/dist/sandbox/permission-facts.js +7 -1
- package/dist/tools/builtins/sandbox/common.js +2 -0
- package/dist/tools/pipeline.d.ts +2 -1
- package/dist/tools/pipeline.js +7 -2
- package/package.json +4 -3
- package/src/migrations/0238_extension_usage.sql +40 -0
- package/src/migrations/0239_extension_replica_isolation.sql +28 -0
|
@@ -15,7 +15,8 @@ export interface GrantContext {
|
|
|
15
15
|
/**
|
|
16
16
|
* Why a tool can't be a task's grant, as a code the UI words: `forbidden` (the org's
|
|
17
17
|
* tool ceiling), `not_grantable` (by design: a Platform call that changes the agent's
|
|
18
|
-
* skills,
|
|
18
|
+
* skills, a call the command review held (`review:<class>`), or any other per-call key such as
|
|
19
|
+
* `Platform:<operation>`), `not_available` (not one of the agent's tools now), `needs_role` (a
|
|
19
20
|
* `requiredRole` above the creator's), `fixed_ask` (always asks a person). A network grant
|
|
20
21
|
* (`network:<host>`, {@link networkGrantRefusal}) adds `needs_admin` (outside the org's network
|
|
21
22
|
* allowlist: only an org admin can add the host) and `device_refuses` (the task's device cannot
|
|
@@ -3,7 +3,7 @@ import { GIT_REPO_MAX_CHARS } from "../conversations/events.js";
|
|
|
3
3
|
import { roleAtLeast } from "../orgs/roles.js";
|
|
4
4
|
import { orgAllows } from "../sandbox/network-grants.js";
|
|
5
5
|
import { isFixedAsk } from "../tools/fixed-ask.js";
|
|
6
|
-
import { changesAgentSkills } from "./unattended.js";
|
|
6
|
+
import { changesAgentSkills, isReviewHoldKey } from "./unattended.js";
|
|
7
7
|
/**
|
|
8
8
|
* Why `toolKey` cannot be one of a task's grants, or null when it can: the creator could approve
|
|
9
9
|
* it with scope `always` themselves (no `requiredRole` above their role, not a fixed ask), it is
|
|
@@ -13,6 +13,13 @@ import { changesAgentSkills } from "./unattended.js";
|
|
|
13
13
|
* undefined when the agent does not have it now.
|
|
14
14
|
*/
|
|
15
15
|
export function grantRefusalOf(toolKey, tool, ctx) {
|
|
16
|
+
// a call the command review held is decided per call by a person, never in advance (P-D3)
|
|
17
|
+
if (isReviewHoldKey(toolKey)) {
|
|
18
|
+
return {
|
|
19
|
+
code: "not_grantable",
|
|
20
|
+
message: `${toolKey} cannot be approved for an automation: a call the command review holds always needs a person's approval`,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
16
23
|
// a git push grant belongs to no tool (sandbox git credentials spec §7)
|
|
17
24
|
if (isGitGrantKey(toolKey))
|
|
18
25
|
return gitGrantRefusal(toolKey, ctx);
|
|
@@ -56,6 +56,17 @@ export declare const UNATTENDED_ELICITATION_NOTE = "[The app asked for user inpu
|
|
|
56
56
|
export declare const connectionGrantKey: (connectorSlug: string) => string;
|
|
57
57
|
/** The `missing_grants` entry of a refused network host (network ask-to-allow spec §8.1, §8.3). */
|
|
58
58
|
export declare const networkGrantKey: (host: string) => string;
|
|
59
|
+
/** The prefix of a {@link reviewHoldKey} entry. */
|
|
60
|
+
export declare const REVIEW_HOLD_PREFIX = "review:";
|
|
61
|
+
/**
|
|
62
|
+
* The `missing_grants` entry of a call the command review held in an unattended run, by its
|
|
63
|
+
* review class (`review:command`, `review:write`, `review:read`): no one could approve it. It is
|
|
64
|
+
* never a grant (a command ask is no task grant class, P-D3): it shows on the task run only, never
|
|
65
|
+
* as inbox attention, and `addGrants` refuses it.
|
|
66
|
+
*/
|
|
67
|
+
export declare const reviewHoldKey: (kind: "command" | "write" | "read") => string;
|
|
68
|
+
/** Whether a `missing_grants` entry is a {@link reviewHoldKey} entry. */
|
|
69
|
+
export declare const isReviewHoldKey: (key: string) => boolean;
|
|
59
70
|
/**
|
|
60
71
|
* What the tool policy knows of the automation run a kernel run serves (`PolicyContext`): the
|
|
61
72
|
* task (its grants), the task run (its `missing_grants`), whether it is a trial run (attended), and
|
|
@@ -93,7 +104,8 @@ export declare function taskGrantsRunOf(db: KernelSchemaDb, runId: string): Prom
|
|
|
93
104
|
orgId: string;
|
|
94
105
|
} | null>;
|
|
95
106
|
/**
|
|
96
|
-
* Appends a key to a task run's `missing_grants` (a tool key,
|
|
107
|
+
* Appends a key to a task run's `missing_grants` (a tool key, `connection:<slug>`,
|
|
108
|
+
* `network:<host>`, a git push key or a {@link reviewHoldKey} entry), once: one
|
|
97
109
|
* atomic update, so parallel calls of a run and of its sub-agents never lose or repeat a key.
|
|
98
110
|
*/
|
|
99
111
|
export declare function appendMissingGrant(db: KernelSchemaDb, taskRunId: string, key: string): Promise<void>;
|
|
@@ -111,6 +111,17 @@ export const UNATTENDED_ELICITATION_NOTE = "[The app asked for user input, but n
|
|
|
111
111
|
export const connectionGrantKey = (connectorSlug) => `connection:${connectorSlug}`;
|
|
112
112
|
/** The `missing_grants` entry of a refused network host (network ask-to-allow spec §8.1, §8.3). */
|
|
113
113
|
export const networkGrantKey = (host) => `network:${host}`;
|
|
114
|
+
/** The prefix of a {@link reviewHoldKey} entry. */
|
|
115
|
+
export const REVIEW_HOLD_PREFIX = "review:";
|
|
116
|
+
/**
|
|
117
|
+
* The `missing_grants` entry of a call the command review held in an unattended run, by its
|
|
118
|
+
* review class (`review:command`, `review:write`, `review:read`): no one could approve it. It is
|
|
119
|
+
* never a grant (a command ask is no task grant class, P-D3): it shows on the task run only, never
|
|
120
|
+
* as inbox attention, and `addGrants` refuses it.
|
|
121
|
+
*/
|
|
122
|
+
export const reviewHoldKey = (kind) => `${REVIEW_HOLD_PREFIX}${kind}`;
|
|
123
|
+
/** Whether a `missing_grants` entry is a {@link reviewHoldKey} entry. */
|
|
124
|
+
export const isReviewHoldKey = (key) => key.startsWith(REVIEW_HOLD_PREFIX);
|
|
114
125
|
/** An unattended run that is not a trial run: the §7 rules apply. */
|
|
115
126
|
export const unattendedRules = (u) => u !== null && u !== undefined && !u.trial;
|
|
116
127
|
/** In `fail` mode, an unattended run never waits for a person (§7). */
|
|
@@ -206,7 +217,8 @@ export async function taskGrantsRunOf(db, runId) {
|
|
|
206
217
|
return task ? { taskId: task.id, accountId: task.account_id, orgId: task.org_id } : null;
|
|
207
218
|
}
|
|
208
219
|
/**
|
|
209
|
-
* Appends a key to a task run's `missing_grants` (a tool key,
|
|
220
|
+
* Appends a key to a task run's `missing_grants` (a tool key, `connection:<slug>`,
|
|
221
|
+
* `network:<host>`, a git push key or a {@link reviewHoldKey} entry), once: one
|
|
210
222
|
* atomic update, so parallel calls of a run and of its sub-agents never lose or repeat a key.
|
|
211
223
|
*/
|
|
212
224
|
// org-filter: callers pass the task run id of the kernel run's own unattended context
|
|
@@ -22,6 +22,14 @@ declare const ConfirmBody: z.ZodObject<{
|
|
|
22
22
|
optional: "optional";
|
|
23
23
|
}>>;
|
|
24
24
|
orgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
+
fullAccessAcknowledgement: z.ZodOptional<z.ZodObject<{
|
|
26
|
+
reviewHash: z.ZodString;
|
|
27
|
+
realms: z.ZodArray<z.ZodEnum<{
|
|
28
|
+
browser: "browser";
|
|
29
|
+
device: "device";
|
|
30
|
+
server: "server";
|
|
31
|
+
}>>;
|
|
32
|
+
}, z.core.$strict>>;
|
|
25
33
|
}, z.core.$strict>;
|
|
26
34
|
declare const ConfirmPermissionsBody: z.ZodObject<{
|
|
27
35
|
permissionsHash: z.ZodString;
|
|
@@ -17,7 +17,7 @@ import { PluginIcons } from "../extensions/plugin-icons.js";
|
|
|
17
17
|
import { CurrentPrincipal, patTokenId, requireUser, SuperAdmin, } from "../identity/principal.js";
|
|
18
18
|
import { createZodDto } from "../infra/validation/create-zod-dto.js";
|
|
19
19
|
import { ZBody, ZQuery } from "../infra/validation/zod-params.js";
|
|
20
|
-
import { AdminCatalogGuideQuery, CatalogImportUpdateBody, CatalogItemsQuery, CatalogUpdateBody, CatalogUpdatePreviewBody, CatalogDisabledBody as DisabledBody, CatalogGitImportBody as GitBody, CatalogHash as Hash, CatalogNpmImportBody as NpmBody, CatalogScopeOrgs as Orgs, CatalogScope as Scope, CatalogScopeBody as ScopeBody, CatalogScopePreviewBody as ScopePreviewBody, CatalogShownBody as ShownBody, } from "./admin-catalog.schemas.js";
|
|
20
|
+
import { AdminCatalogGuideQuery, CatalogImportUpdateBody, CatalogItemsQuery, CatalogUpdateBody, CatalogUpdatePreviewBody, CatalogDisabledBody as DisabledBody, FullAccessAcknowledgementBody, CatalogGitImportBody as GitBody, CatalogHash as Hash, CatalogNpmImportBody as NpmBody, CatalogScopeOrgs as Orgs, CatalogScope as Scope, CatalogScopeBody as ScopeBody, CatalogScopePreviewBody as ScopePreviewBody, CatalogShownBody as ShownBody, } from "./admin-catalog.schemas.js";
|
|
21
21
|
import { AppearanceApplyBody } from "./appearance.schemas.js";
|
|
22
22
|
import { AppearanceService, suggestedAppearanceOf, } from "./appearance.service.js";
|
|
23
23
|
import { CatalogService, } from "./catalog.service.js";
|
|
@@ -33,6 +33,7 @@ const ConfirmBody = z
|
|
|
33
33
|
/** The new item's scope (default `optional`); `orgs` only with `named`. */
|
|
34
34
|
scope: Scope.optional(),
|
|
35
35
|
orgs: Orgs.optional(),
|
|
36
|
+
fullAccessAcknowledgement: FullAccessAcknowledgementBody.optional(),
|
|
36
37
|
})
|
|
37
38
|
.strict();
|
|
38
39
|
const ConfirmPermissionsBody = z.object({ permissionsHash: Hash }).strict();
|
|
@@ -183,6 +184,9 @@ let AdminCatalogController = class AdminCatalogController {
|
|
|
183
184
|
reviewHash: body.reviewHash,
|
|
184
185
|
...(body.scope !== undefined && { scope: body.scope }),
|
|
185
186
|
...(body.orgs !== undefined && { orgs: body.orgs }),
|
|
187
|
+
...(body.fullAccessAcknowledgement !== undefined && {
|
|
188
|
+
fullAccessAcknowledgement: body.fullAccessAcknowledgement,
|
|
189
|
+
}),
|
|
186
190
|
}, actorOpts(actor));
|
|
187
191
|
}
|
|
188
192
|
/**
|
|
@@ -308,7 +312,9 @@ let AdminCatalogController = class AdminCatalogController {
|
|
|
308
312
|
scope: body.scope,
|
|
309
313
|
scopeHash: body.scopeHash,
|
|
310
314
|
...(body.orgs !== undefined && { orgs: body.orgs }),
|
|
311
|
-
},
|
|
315
|
+
},
|
|
316
|
+
// a token write may only narrow (AGENTS.md "Platform tool"); widening is the web's
|
|
317
|
+
{ ...actorOpts(actor), onlyNarrows: patTokenId(actor) !== undefined });
|
|
312
318
|
}
|
|
313
319
|
/**
|
|
314
320
|
* Disables the plugin on the whole deployment (`scopeHash` of the `{ disabled: true }` preview
|
|
@@ -20,10 +20,20 @@ export declare const CatalogUpdateBody: z.ZodObject<{
|
|
|
20
20
|
version: z.ZodString;
|
|
21
21
|
diffHash: z.ZodString;
|
|
22
22
|
}, z.core.$strict>;
|
|
23
|
+
/** The per-realm full-access acknowledgement of a confirm (plan task 1.3d; shared with 1.4a). */
|
|
24
|
+
export { FullAccessAcknowledgementBody } from "../extensions/permissions.schemas.js";
|
|
23
25
|
/** `POST imports/:stagingId/update`: the import review's hash and the update preview's. */
|
|
24
26
|
export declare const CatalogImportUpdateBody: z.ZodObject<{
|
|
25
27
|
reviewHash: z.ZodString;
|
|
26
28
|
diffHash: z.ZodString;
|
|
29
|
+
fullAccessAcknowledgement: z.ZodOptional<z.ZodObject<{
|
|
30
|
+
reviewHash: z.ZodString;
|
|
31
|
+
realms: z.ZodArray<z.ZodEnum<{
|
|
32
|
+
browser: "browser";
|
|
33
|
+
device: "device";
|
|
34
|
+
server: "server";
|
|
35
|
+
}>>;
|
|
36
|
+
}, z.core.$strict>>;
|
|
27
37
|
}, z.core.$strict>;
|
|
28
38
|
/** `:id` as the routes take it (`@Param`). */
|
|
29
39
|
export declare const CatalogIdPathParams: z.ZodObject<{
|
|
@@ -13,9 +13,16 @@ export const CatalogUpdatePreviewBody = z.object({ version: CatalogVersion }).st
|
|
|
13
13
|
export const CatalogUpdateBody = z
|
|
14
14
|
.object({ version: CatalogVersion, diffHash: CatalogHash })
|
|
15
15
|
.strict();
|
|
16
|
+
/** The per-realm full-access acknowledgement of a confirm (plan task 1.3d; shared with 1.4a). */
|
|
17
|
+
export { FullAccessAcknowledgementBody } from "../extensions/permissions.schemas.js";
|
|
18
|
+
import { FullAccessAcknowledgementBody } from "../extensions/permissions.schemas.js";
|
|
16
19
|
/** `POST imports/:stagingId/update`: the import review's hash and the update preview's. */
|
|
17
20
|
export const CatalogImportUpdateBody = z
|
|
18
|
-
.object({
|
|
21
|
+
.object({
|
|
22
|
+
reviewHash: CatalogHash,
|
|
23
|
+
diffHash: CatalogHash,
|
|
24
|
+
fullAccessAcknowledgement: FullAccessAcknowledgementBody.optional(),
|
|
25
|
+
})
|
|
19
26
|
.strict();
|
|
20
27
|
/** `:id` as the routes take it (`@Param`). */
|
|
21
28
|
export const CatalogIdPathParams = z.object({ id: z.string().min(1) });
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type AgentTemplate, type Connector, type ConnectorTemplateFile, type ConnectorTemplateSpec, type LocalizedName, type ParsedTheme, type PluginManifest } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import type { KernelSchemaDb } from "../db/kernel-schema.js";
|
|
3
|
+
import type { FullAccessDisclosure } from "../extensions/permissions.schemas.js";
|
|
3
4
|
import type { ExtensionRegistry } from "../extensions/registry.js";
|
|
4
5
|
import type { ExtensionUnavailableReason } from "../extensions/unavailable.js";
|
|
5
6
|
import type { OrgLock } from "../orgs/org-lock.js";
|
|
@@ -131,6 +132,11 @@ export interface OrgCatalogDetail {
|
|
|
131
132
|
agents: string[];
|
|
132
133
|
/** Display details for agent templates with connector references, keyed by their paths in `agents`. */
|
|
133
134
|
agentConnectorNeeds?: Record<string, OrgCatalogAgentConnectorNeed[]>;
|
|
135
|
+
/**
|
|
136
|
+
* The plugin's full-access disclosure (`permissions.schemas.ts`): shown to the org's admins when
|
|
137
|
+
* its extension's approved revision runs with full access; null otherwise and for members.
|
|
138
|
+
*/
|
|
139
|
+
fullAccessDisclosure: FullAccessDisclosure | null;
|
|
134
140
|
}
|
|
135
141
|
/**
|
|
136
142
|
* A connector template as an org sees it (the install wizard and the upgrade preview's inputs):
|
|
@@ -1,6 +1,7 @@
|
|
|
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 { type ApprovalScope, ExtensionRevisionGrants } from "../extensions/revision-grants.js";
|
|
4
5
|
import { SuperAdminLock } from "../identity/super-admin.js";
|
|
5
6
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
6
7
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
@@ -65,6 +66,15 @@ export interface ScopePreview {
|
|
|
65
66
|
*/
|
|
66
67
|
themes?: ThemePreview[];
|
|
67
68
|
scopeHash: string;
|
|
69
|
+
/**
|
|
70
|
+
* The target scope reaches orgs the live grant of the plugin's approved extension revision was
|
|
71
|
+
* not approved for (plan task 1.4a): its approval scope; absent otherwise. A review of the
|
|
72
|
+
* revision for the wider scope is needed (shown in shadow mode, refused from 1.5a).
|
|
73
|
+
*/
|
|
74
|
+
grantScope?: {
|
|
75
|
+
mode: ApprovalScope["mode"];
|
|
76
|
+
orgs: string[];
|
|
77
|
+
};
|
|
68
78
|
}
|
|
69
79
|
/** A scope change (`orgs` only with `named`) or a disable. */
|
|
70
80
|
export type ScopeTarget = {
|
|
@@ -100,7 +110,11 @@ export declare class CatalogScopeService {
|
|
|
100
110
|
private readonly sync;
|
|
101
111
|
readonly txHost: TransactionHost;
|
|
102
112
|
private readonly hints;
|
|
103
|
-
|
|
113
|
+
/** The approved extension revision's grant: a scope beyond its approval scope is shown (1.4a). */
|
|
114
|
+
private readonly grants;
|
|
115
|
+
constructor(kdb: KernelDb, adminLock: SuperAdminLock, scopeWriter: ScopeWriter, catalog: CatalogService, pluginImport: PluginImport, installer: PluginInstaller, extensions: ExtensionAdmin, ops: ExtensionAdminOps, sync: PluginScopeSync, txHost: TransactionHost, hints: HintPublisher,
|
|
116
|
+
/** The approved extension revision's grant: a scope beyond its approval scope is shown (1.4a). */
|
|
117
|
+
grants: Pick<ExtensionRevisionGrants, "live">);
|
|
104
118
|
private get db();
|
|
105
119
|
/**
|
|
106
120
|
* Confirms a staged import ({@link PluginImport.confirm}: installs and enables the extension,
|
|
@@ -126,7 +140,13 @@ export declare class CatalogScopeService {
|
|
|
126
140
|
scope: PluginScope;
|
|
127
141
|
orgs?: string[];
|
|
128
142
|
scopeHash: string;
|
|
129
|
-
}, opts?: ActorOpts
|
|
143
|
+
}, opts?: ActorOpts & {
|
|
144
|
+
/**
|
|
145
|
+
* A Platform or token write may only narrow (AGENTS.md "Platform tool"): a scope reaching orgs
|
|
146
|
+
* the current one does not -> 403 `plugin.scope_widening_not_allowed`; widen on the web.
|
|
147
|
+
*/
|
|
148
|
+
onlyNarrows?: boolean;
|
|
149
|
+
}): Promise<CatalogItemView>;
|
|
130
150
|
/**
|
|
131
151
|
* Disables the plugin on the whole deployment (after its preview, `scopeHash` required) or
|
|
132
152
|
* enables it again (no hash); returns the item.
|
|
@@ -13,6 +13,9 @@ import { sql } from "kysely";
|
|
|
13
13
|
import { ApiError } from "../errors.js";
|
|
14
14
|
import { ExtensionAdminOps } from "../extensions/admin-ops.js";
|
|
15
15
|
import { ExtensionAdmin } from "../extensions/admin-view.js";
|
|
16
|
+
import { approvedGrant } from "../extensions/full-access-disclosure.js";
|
|
17
|
+
import { scopeWider } from "../extensions/revision-approvals.js";
|
|
18
|
+
import { ExtensionRevisionGrants } from "../extensions/revision-grants.js";
|
|
16
19
|
import { audit } from "../identity/audit.js";
|
|
17
20
|
import { SuperAdminLock } from "../identity/super-admin.js";
|
|
18
21
|
import { notifyItemShared } from "../inbox/org-notices.js";
|
|
@@ -96,7 +99,10 @@ let CatalogScopeService = class CatalogScopeService {
|
|
|
96
99
|
sync;
|
|
97
100
|
txHost;
|
|
98
101
|
hints;
|
|
99
|
-
|
|
102
|
+
grants;
|
|
103
|
+
constructor(kdb, adminLock, scopeWriter, catalog, pluginImport, installer, extensions, ops, sync, txHost, hints,
|
|
104
|
+
/** The approved extension revision's grant: a scope beyond its approval scope is shown (1.4a). */
|
|
105
|
+
grants) {
|
|
100
106
|
this.kdb = kdb;
|
|
101
107
|
this.adminLock = adminLock;
|
|
102
108
|
this.scopeWriter = scopeWriter;
|
|
@@ -108,6 +114,7 @@ let CatalogScopeService = class CatalogScopeService {
|
|
|
108
114
|
this.sync = sync;
|
|
109
115
|
this.txHost = txHost;
|
|
110
116
|
this.hints = hints;
|
|
117
|
+
this.grants = grants;
|
|
111
118
|
}
|
|
112
119
|
get db() {
|
|
113
120
|
return this.kdb.db;
|
|
@@ -189,7 +196,19 @@ let CatalogScopeService = class CatalogScopeService {
|
|
|
189
196
|
/** The preview of a scope change or a disable (nothing written). */
|
|
190
197
|
async preview(itemId, target) {
|
|
191
198
|
const item = await this.item(itemId, false);
|
|
192
|
-
|
|
199
|
+
const t = await this.targetOf(item, target);
|
|
200
|
+
const p = await this.compute(item, t);
|
|
201
|
+
const grant = await approvedGrant(this.db, this.grants, item.name);
|
|
202
|
+
return grant &&
|
|
203
|
+
scopeWider({ mode: t.scope, orgs: t.orgs }, grant.approvalScope)
|
|
204
|
+
? {
|
|
205
|
+
...p,
|
|
206
|
+
grantScope: {
|
|
207
|
+
mode: grant.approvalScope.mode,
|
|
208
|
+
orgs: grant.approvalScope.mode === "named" ? [...grant.approvalScope.orgs] : [],
|
|
209
|
+
},
|
|
210
|
+
}
|
|
211
|
+
: p;
|
|
193
212
|
}
|
|
194
213
|
/** Changes the scope after its preview (`scopeHash`); returns the item. */
|
|
195
214
|
async setScope(actor, itemId, body, opts = {}) {
|
|
@@ -254,6 +273,10 @@ let CatalogScopeService = class CatalogScopeService {
|
|
|
254
273
|
const item = await this.item(itemId, true);
|
|
255
274
|
const t = await this.targetOf(item, target);
|
|
256
275
|
const from = await this.listed(itemId);
|
|
276
|
+
if (opts.onlyNarrows &&
|
|
277
|
+
scopeWider({ mode: t.scope, orgs: t.orgs }, { mode: item.scope, orgs: from })) {
|
|
278
|
+
throw new ApiError("plugin.scope_widening_not_allowed", `This change widens who can use plugin ${item.name}; widen a plugin's scope in the admin console`);
|
|
279
|
+
}
|
|
257
280
|
// The owner stays listed (P3-17); widening goes through the share gate (P3-16)
|
|
258
281
|
assertOwnerListed(item, t);
|
|
259
282
|
assertShareableTarget(item, { scope: item.scope, orgs: from }, t);
|
|
@@ -692,6 +715,7 @@ CatalogScopeService = __decorate([
|
|
|
692
715
|
__param(7, Inject(ExtensionAdminOps)),
|
|
693
716
|
__param(8, Inject(PluginScopeSync)),
|
|
694
717
|
__param(9, Inject(TransactionHost)),
|
|
695
|
-
__param(10, Inject(InvalidationHints))
|
|
718
|
+
__param(10, Inject(InvalidationHints)),
|
|
719
|
+
__param(11, Inject(ExtensionRevisionGrants))
|
|
696
720
|
], CatalogScopeService);
|
|
697
721
|
export { CatalogScopeService };
|
|
@@ -37,7 +37,8 @@ import { expandGitUrl, GitSourceError, gitErrorDetails, normalGitPath, readGitTr
|
|
|
37
37
|
import { fetchMarketplaceArchive, marketplaceNetPolicy, marketplaceUrlProblem, requireMarketplacePublisher, } from "./marketplace-fetch.js";
|
|
38
38
|
import { assertEntryNotDeprecated, entryCompatible, entrySourceHost, HOST_VERSIONS, hostAllowed, loadMarketplaceEntry, MarketplacesService, pluginNameFrom, } from "./marketplaces.service.js";
|
|
39
39
|
import { switchOffItemConnectors } from "./plugin-connectors.js";
|
|
40
|
-
import { PluginImport } from "./plugin-import.js";
|
|
40
|
+
import { PluginImport, } from "./plugin-import.js";
|
|
41
|
+
import { officialPublisherIdentity } from "./provenance.js";
|
|
41
42
|
import { OFFICIAL_MARKETPLACE_ID, officialPublisherProofMode } from "./publisher-policy.js";
|
|
42
43
|
import { cancelPendingRequests } from "./request-rules.js";
|
|
43
44
|
import { newestFirst } from "./versions.js";
|
|
@@ -212,6 +213,10 @@ let CatalogService = class CatalogService {
|
|
|
212
213
|
let ref;
|
|
213
214
|
let detail;
|
|
214
215
|
let provenance;
|
|
216
|
+
// The revision's publisher evidence for its permission review (plan task 1.3a): the
|
|
217
|
+
// official proof under require, pin-only under the official pin-only policy (#1368), the
|
|
218
|
+
// attestations verified as any publisher elsewhere; none for an archive
|
|
219
|
+
let publisher;
|
|
215
220
|
if ("npm" in src) {
|
|
216
221
|
got = await this.installs.fetchMarketplacePackage({ package: src.npm.package, version: src.npm.version, integrity: src.npm.integrity }, opts.signal);
|
|
217
222
|
ref = `${input.marketplaceId}:${src.npm.package}@${src.npm.version}`;
|
|
@@ -220,8 +225,13 @@ let CatalogService = class CatalogService {
|
|
|
220
225
|
const publisherProof = await requireMarketplacePublisher(config, { name: src.npm.package, version: src.npm.version, integrity: got.integrity }, opts.signal);
|
|
221
226
|
detail.publisherProof = publisherProof;
|
|
222
227
|
provenance = { provenance: publisherProof };
|
|
228
|
+
publisher = {
|
|
229
|
+
evidence: { evidence: "verified", identity: officialPublisherIdentity() },
|
|
230
|
+
digest: publisherProof.evidenceDigest,
|
|
231
|
+
};
|
|
223
232
|
}
|
|
224
233
|
else if (official) {
|
|
234
|
+
publisher = { evidence: { evidence: "pin_only" } };
|
|
225
235
|
provenance = {
|
|
226
236
|
provenance: {
|
|
227
237
|
checked: false,
|
|
@@ -231,7 +241,13 @@ let CatalogService = class CatalogService {
|
|
|
231
241
|
};
|
|
232
242
|
}
|
|
233
243
|
else {
|
|
234
|
-
const
|
|
244
|
+
const revision = {
|
|
245
|
+
package: src.npm.package,
|
|
246
|
+
version: src.npm.version,
|
|
247
|
+
integrity: got.integrity,
|
|
248
|
+
};
|
|
249
|
+
const { provenance: p, publisher: evidence } = await this.installs.npmEvidence(revision, opts.signal);
|
|
250
|
+
publisher = evidence;
|
|
235
251
|
// A git marketplace may point to packages built in a different repository.
|
|
236
252
|
const mismatch = p.checked &&
|
|
237
253
|
marketplace.form === "git" &&
|
|
@@ -253,6 +269,7 @@ let CatalogService = class CatalogService {
|
|
|
253
269
|
}, {
|
|
254
270
|
...prepareOpts,
|
|
255
271
|
...(provenance !== undefined && { provenance }),
|
|
272
|
+
...(publisher !== undefined && { publisher }),
|
|
256
273
|
// an archive without plugin.json may be skills only (named by the entry, spec §5.3)
|
|
257
274
|
...("archive" in src && {
|
|
258
275
|
fallback: {
|
|
@@ -209,7 +209,7 @@ export declare function headsToResolve(entries: readonly MarketplaceEntry[], imp
|
|
|
209
209
|
/** The host versions (an entry's `minKernel` is judged against them). */
|
|
210
210
|
export declare const HOST_VERSIONS: {
|
|
211
211
|
readonly kernel: string;
|
|
212
|
-
readonly sdk: "0.1.0-rc.
|
|
212
|
+
readonly sdk: "0.1.0-rc.104";
|
|
213
213
|
};
|
|
214
214
|
/** Whether this deployment satisfies the entry's `minKernel`. */
|
|
215
215
|
export declare const entryCompatible: (e: Pick<MarketplaceEntry, "minKernel">) => boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EffectiveConfigs } from "../extensions/effective-config.js";
|
|
2
2
|
import { PluginIcons } from "../extensions/plugin-icons.js";
|
|
3
3
|
import { ExtensionRegistry } from "../extensions/registry.js";
|
|
4
|
+
import { ExtensionRevisionGrants } from "../extensions/revision-grants.js";
|
|
4
5
|
import { ExtensionAvailability } from "../extensions/unavailable.js";
|
|
5
6
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
6
7
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
@@ -45,13 +46,17 @@ export declare class OrgCatalogService {
|
|
|
45
46
|
/** The effective config of an extension for the org: a wanted plugin whose config is not valid needs input. */
|
|
46
47
|
private readonly effective;
|
|
47
48
|
private readonly icons;
|
|
49
|
+
/** The approved revision's grant, for the org admins' full-access disclosure (1.4a). */
|
|
50
|
+
private readonly grants;
|
|
48
51
|
constructor(kdb: KernelDb,
|
|
49
52
|
/** The org row lock (orgs/org-lock.ts): joins the caller's transaction. */
|
|
50
53
|
orgLock: OrgLock, storage: StorageService, registry: ExtensionRegistry, pluginInstaller: PluginInstaller, scopeWriter: ScopeWriter, log: KernelLogger, txHost: TransactionHost,
|
|
51
54
|
/** Why a plugin's extension cannot run (the `unavailable` state's reason). */
|
|
52
55
|
availability: ExtensionAvailability,
|
|
53
56
|
/** The effective config of an extension for the org: a wanted plugin whose config is not valid needs input. */
|
|
54
|
-
effective: Pick<EffectiveConfigs, "get">, icons: PluginIcons
|
|
57
|
+
effective: Pick<EffectiveConfigs, "get">, icons: PluginIcons,
|
|
58
|
+
/** The approved revision's grant, for the org admins' full-access disclosure (1.4a). */
|
|
59
|
+
grants: Pick<ExtensionRevisionGrants, "live">);
|
|
55
60
|
/** The kernel-schema handle of the current context (the transaction, else the pool). */
|
|
56
61
|
private get db();
|
|
57
62
|
/**
|
|
@@ -68,6 +73,8 @@ export declare class OrgCatalogService {
|
|
|
68
73
|
*/
|
|
69
74
|
/** The account is an admin (or owner) of the org. */
|
|
70
75
|
private isOrgAdmin;
|
|
76
|
+
/** The item's scope offers it to the org: `all` / `optional`, or `named` with the org listed. */
|
|
77
|
+
private scopeOffers;
|
|
71
78
|
private endpointTitles;
|
|
72
79
|
detail(orgId: string, accountId: string, itemId: string): Promise<OrgCatalogDetail>;
|
|
73
80
|
/**
|
|
@@ -10,9 +10,11 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
10
10
|
import { Inject, Injectable } from "@nestjs/common";
|
|
11
11
|
import { ApiError } from "../errors.js";
|
|
12
12
|
import { EffectiveConfigs } from "../extensions/effective-config.js";
|
|
13
|
+
import { readFullAccessDisclosure } from "../extensions/full-access-disclosure.js";
|
|
13
14
|
import { templateGuideOf } from "../extensions/plugin-guides.js";
|
|
14
15
|
import { PluginIcons } from "../extensions/plugin-icons.js";
|
|
15
16
|
import { ExtensionRegistry } from "../extensions/registry.js";
|
|
17
|
+
import { ExtensionRevisionGrants } from "../extensions/revision-grants.js";
|
|
16
18
|
import { ExtensionAvailability } from "../extensions/unavailable.js";
|
|
17
19
|
import { audit } from "../identity/audit.js";
|
|
18
20
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
@@ -72,13 +74,16 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
72
74
|
availability;
|
|
73
75
|
effective;
|
|
74
76
|
icons;
|
|
77
|
+
grants;
|
|
75
78
|
constructor(kdb,
|
|
76
79
|
/** The org row lock (orgs/org-lock.ts): joins the caller's transaction. */
|
|
77
80
|
orgLock, storage, registry, pluginInstaller, scopeWriter, log, txHost,
|
|
78
81
|
/** Why a plugin's extension cannot run (the `unavailable` state's reason). */
|
|
79
82
|
availability,
|
|
80
83
|
/** The effective config of an extension for the org: a wanted plugin whose config is not valid needs input. */
|
|
81
|
-
effective, icons
|
|
84
|
+
effective, icons,
|
|
85
|
+
/** The approved revision's grant, for the org admins' full-access disclosure (1.4a). */
|
|
86
|
+
grants) {
|
|
82
87
|
this.kdb = kdb;
|
|
83
88
|
this.orgLock = orgLock;
|
|
84
89
|
this.storage = storage;
|
|
@@ -90,6 +95,7 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
90
95
|
this.availability = availability;
|
|
91
96
|
this.effective = effective;
|
|
92
97
|
this.icons = icons;
|
|
98
|
+
this.grants = grants;
|
|
93
99
|
}
|
|
94
100
|
/** The kernel-schema handle of the current context (the transaction, else the pool). */
|
|
95
101
|
get db() {
|
|
@@ -247,6 +253,25 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
247
253
|
.executeTakeFirst();
|
|
248
254
|
return m !== undefined && roleAtLeast(m.role, "admin");
|
|
249
255
|
}
|
|
256
|
+
/** The item's scope offers it to the org: `all` / `optional`, or `named` with the org listed. */
|
|
257
|
+
async scopeOffers(itemId, orgId) {
|
|
258
|
+
const item = await this.db
|
|
259
|
+
.selectFrom("catalog_items")
|
|
260
|
+
.select("scope")
|
|
261
|
+
.where("id", "=", itemId)
|
|
262
|
+
.executeTakeFirst();
|
|
263
|
+
if (!item)
|
|
264
|
+
return false;
|
|
265
|
+
if (item.scope !== "named")
|
|
266
|
+
return true;
|
|
267
|
+
const listed = await this.db
|
|
268
|
+
.selectFrom("catalog_item_scope_orgs")
|
|
269
|
+
.select("org_id")
|
|
270
|
+
.where("item_id", "=", itemId)
|
|
271
|
+
.where("org_id", "=", orgId)
|
|
272
|
+
.executeTakeFirst();
|
|
273
|
+
return listed !== undefined;
|
|
274
|
+
}
|
|
250
275
|
endpointTitles(template) {
|
|
251
276
|
const paths = template.editableEndpoint;
|
|
252
277
|
if (!paths?.length)
|
|
@@ -309,7 +334,13 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
309
334
|
throw e;
|
|
310
335
|
});
|
|
311
336
|
// Each template's icon on the org's routes (its own, else the plugin's)
|
|
312
|
-
const
|
|
337
|
+
const isAdmin = await this.isOrgAdmin(orgId, accountId);
|
|
338
|
+
const icons = await this.icons.ofItemTemplates(itemId, templates.map((t) => t.id), { kind: "org", orgId, isAdmin });
|
|
339
|
+
// only the org's admins see it, and only for an item whose scope offers it to this org (not
|
|
340
|
+
// a named item merely shown to it, whatever its displayed state)
|
|
341
|
+
const fullAccessDisclosure = isAdmin && m.extension && (await this.scopeOffers(itemId, orgId))
|
|
342
|
+
? await readFullAccessDisclosure(this.db, this.grants, m.name)
|
|
343
|
+
: null;
|
|
313
344
|
const iconOf = (templateId) => icons.get(templateId) ?? null;
|
|
314
345
|
return {
|
|
315
346
|
item,
|
|
@@ -329,6 +360,7 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
329
360
|
skills: (m.skills ?? []).map((s) => packagePath(s.path)),
|
|
330
361
|
agents: (m.agents ?? []).map((a) => packagePath(a.path)),
|
|
331
362
|
...(Object.keys(agentConnectorNeeds).length > 0 && { agentConnectorNeeds }),
|
|
363
|
+
fullAccessDisclosure,
|
|
332
364
|
};
|
|
333
365
|
}
|
|
334
366
|
/**
|
|
@@ -624,6 +656,7 @@ OrgCatalogService = __decorate([
|
|
|
624
656
|
__param(7, Inject(TransactionHost)),
|
|
625
657
|
__param(8, Inject(ExtensionAvailability)),
|
|
626
658
|
__param(9, Inject(EffectiveConfigs)),
|
|
627
|
-
__param(10, Inject(PluginIcons))
|
|
659
|
+
__param(10, Inject(PluginIcons)),
|
|
660
|
+
__param(11, Inject(ExtensionRevisionGrants))
|
|
628
661
|
], OrgCatalogService);
|
|
629
662
|
export { OrgCatalogService };
|
|
@@ -756,8 +756,9 @@ let PlatformComponents = class PlatformComponents {
|
|
|
756
756
|
.execute();
|
|
757
757
|
// The plugin imported again after its delete: the connectors the deleted item's template
|
|
758
758
|
// made move to this one, and its installs take them back (spec §5 rule 8). Their orgs are
|
|
759
|
-
// not locked
|
|
760
|
-
//
|
|
759
|
+
// not locked. Their org's admins and the delete's owed uninstall (the scope sync) write
|
|
760
|
+
// them too; the relink locks the rows in id order as the uninstall does, so it waits for
|
|
761
|
+
// that work without a lock cycle (issue #1428)
|
|
761
762
|
await relinkDeletedItemConnectors(t, this.hints, {
|
|
762
763
|
itemId: plan.itemId,
|
|
763
764
|
name: plan.plugin,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FullAccessAcknowledgement } from "../extensions/revision-review.js";
|
|
1
2
|
import type { KernelLogger } from "../log.js";
|
|
2
3
|
import type { ActorOpts, CatalogItemView } from "./catalog.service.js";
|
|
3
4
|
import { PluginImport } from "./plugin-import.js";
|
|
@@ -43,6 +44,7 @@ export declare class PlatformImportUpdate {
|
|
|
43
44
|
confirm(actor: string, stagingId: string, input: {
|
|
44
45
|
reviewHash: string;
|
|
45
46
|
diffHash: string;
|
|
47
|
+
fullAccessAcknowledgement?: FullAccessAcknowledgement | undefined;
|
|
46
48
|
}, opts?: ActorOpts): Promise<PlatformImportUpdateResult>;
|
|
47
49
|
/** The staged target, which must be a new version of a live platform-owned plugin. */
|
|
48
50
|
private target;
|
|
@@ -62,7 +62,14 @@ let PlatformImportUpdate = class PlatformImportUpdate {
|
|
|
62
62
|
}
|
|
63
63
|
// The review hash is checked by the import's confirm (409 plugin.review_stale, nothing
|
|
64
64
|
// written)
|
|
65
|
-
const imported = await this.pluginImport.confirm(actor, stagingId, {
|
|
65
|
+
const imported = await this.pluginImport.confirm(actor, stagingId, {
|
|
66
|
+
reviewHash: input.reviewHash,
|
|
67
|
+
deploy: false,
|
|
68
|
+
updateFollows: true,
|
|
69
|
+
...(input.fullAccessAcknowledgement !== undefined && {
|
|
70
|
+
fullAccessAcknowledgement: input.fullAccessAcknowledgement,
|
|
71
|
+
}),
|
|
72
|
+
}, opts);
|
|
66
73
|
try {
|
|
67
74
|
const update = await this.updater.updateHeld(actor, st.itemId, { version: st.version, diffHash: input.diffHash }, opts);
|
|
68
75
|
return { item: await this.pluginImport.view(st.itemId), update };
|
|
@@ -11,6 +11,17 @@ export declare function pluginSwitchOff(itemId: string): {
|
|
|
11
11
|
disabled_by_plugin_id: import("kysely").RawBuilder<string | null>;
|
|
12
12
|
updated_at: import("kysely").RawBuilder<Date>;
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Locks connector rows in id order, before any of them is written. Every writer that changes
|
|
16
|
+
* several connectors of a plugin in one transaction takes them this way (the delete's switch-off,
|
|
17
|
+
* an org's uninstall, the re-import's relink), so two of them never wait for each other's rows in
|
|
18
|
+
* opposite orders (issue #1428: a re-import racing the delete's owed uninstall deadlocked, 40P01).
|
|
19
|
+
*/
|
|
20
|
+
export declare function lockConnectorRows(db: KernelSchemaDb, which: {
|
|
21
|
+
ids: readonly string[];
|
|
22
|
+
} | {
|
|
23
|
+
templateIds: readonly string[];
|
|
24
|
+
}): Promise<string[]>;
|
|
14
25
|
/**
|
|
15
26
|
* Switches off, in the caller's transaction, every live connector in any org made from one of the
|
|
16
27
|
* item's connector templates ({@link pluginSwitchOff}): the super admin's delete of the item
|