@capybara-hq/kernel 0.1.0-rc.35 → 0.1.0-rc.37
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 +5 -5
- package/dist/admin/admin.module.d.ts +3 -3
- package/dist/admin/admin.module.js +6 -6
- package/dist/admin/audit-log.service.d.ts +51 -0
- package/dist/admin/{platform-audit.service.js → audit-log.service.js} +20 -12
- package/dist/admin/audit.controller.d.ts +18 -6
- package/dist/admin/audit.controller.js +36 -6
- package/dist/admin/audit.schemas.d.ts +9 -1
- package/dist/admin/audit.schemas.js +22 -2
- package/dist/admin/outbox-dead.controller.d.ts +4 -6
- package/dist/admin/outbox-dead.controller.js +9 -6
- package/dist/admin/outbox-dead.schemas.d.ts +16 -0
- package/dist/admin/outbox-dead.schemas.js +25 -1
- package/dist/admin/outbox-dead.service.d.ts +16 -7
- package/dist/admin/outbox-dead.service.js +34 -10
- package/dist/admin/overview.service.d.ts +3 -3
- package/dist/admin/overview.service.js +0 -1
- package/dist/agents/agent-lookup.js +2 -10
- package/dist/agents/agents.module.js +3 -0
- package/dist/agents/agents.service.js +9 -20
- package/dist/agents/definition.d.ts +3 -51
- package/dist/agents/definition.js +4 -254
- package/dist/agents/org-templates.js +2 -6
- package/dist/agents/readiness.controller.d.ts +8 -19
- package/dist/agents/readiness.controller.js +11 -25
- package/dist/agents/readiness.service.d.ts +42 -0
- package/dist/agents/readiness.service.js +78 -0
- package/dist/agents/templates.d.ts +0 -6
- package/dist/agents/templates.js +8 -34
- package/dist/background/store.d.ts +2 -0
- package/dist/background/store.js +3 -1
- package/dist/background/wake-rules.js +2 -1
- package/dist/catalog/admin-catalog.controller.d.ts +1 -2
- package/dist/catalog/admin-catalog.controller.js +1 -2
- package/dist/catalog/appearance.service.js +1 -3
- package/dist/catalog/catalog-content.d.ts +1 -1
- package/dist/catalog/catalog-content.js +1 -4
- package/dist/catalog/catalog-items.js +3 -3
- package/dist/catalog/catalog-scope.service.d.ts +10 -28
- package/dist/catalog/catalog-scope.service.js +22 -73
- package/dist/catalog/cli.d.ts +0 -11
- package/dist/catalog/cli.js +0 -20
- package/dist/catalog/component-scope.service.js +0 -2
- package/dist/catalog/component-state.js +2 -2
- package/dist/catalog/install-status.d.ts +6 -0
- package/dist/catalog/install-status.js +6 -0
- package/dist/catalog/job-ids.d.ts +0 -4
- package/dist/catalog/job-ids.js +0 -4
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-catalog.service.d.ts +2 -0
- package/dist/catalog/org-catalog.service.js +8 -3
- package/dist/catalog/org-extension-switch.d.ts +7 -2
- package/dist/catalog/org-extension-switch.js +56 -9
- package/dist/catalog/org-plugin-uploads.d.ts +6 -15
- package/dist/catalog/org-plugin-uploads.js +9 -27
- package/dist/catalog/owned-items.js +1 -3
- package/dist/catalog/platform-import-update.js +1 -1
- package/dist/catalog/plugin-import.d.ts +15 -13
- package/dist/catalog/plugin-import.js +21 -30
- package/dist/catalog/plugin-install.d.ts +3 -43
- package/dist/catalog/plugin-install.js +8 -150
- package/dist/catalog/plugin-package.d.ts +5 -10
- package/dist/catalog/plugin-package.js +12 -33
- package/dist/catalog/plugin-upgrade.js +5 -4
- package/dist/catalog/scope-jobs.d.ts +34 -34
- package/dist/catalog/scope-jobs.js +50 -37
- package/dist/catalog/scope-orgs.d.ts +1 -1
- package/dist/catalog/scope-orgs.js +1 -2
- package/dist/catalog/scope-sync-workers.d.ts +4 -3
- package/dist/catalog/scope-sync-workers.js +18 -6
- package/dist/catalog/scope-sync.d.ts +56 -59
- package/dist/catalog/scope-sync.js +96 -166
- package/dist/catalog/unshare.d.ts +3 -4
- package/dist/catalog/unshare.js +5 -8
- package/dist/channels/job-ids.d.ts +2 -6
- package/dist/channels/job-ids.js +2 -6
- package/dist/channels/outbound.d.ts +1 -1
- package/dist/channels/outbound.js +1 -1
- package/dist/channels/supervisor.d.ts +2 -3
- package/dist/channels/supervisor.js +2 -3
- package/dist/client/client-access.service.js +1 -1
- package/dist/config/env.js +19 -1
- package/dist/config/load.d.ts +0 -6
- package/dist/config/load.js +8 -27
- package/dist/config/schema.d.ts +53 -47
- package/dist/config/schema.js +190 -40
- package/dist/conversations/attachments.service.d.ts +10 -3
- package/dist/conversations/attachments.service.js +49 -16
- package/dist/conversations/conversations.controller.d.ts +0 -39
- package/dist/conversations/conversations.controller.js +0 -39
- package/dist/conversations/events.d.ts +71 -46
- package/dist/conversations/events.js +124 -112
- package/dist/conversations/media-types.d.ts +25 -0
- package/dist/conversations/media-types.js +38 -0
- package/dist/conversations/queue.d.ts +3 -1
- package/dist/conversations/queue.service.js +9 -2
- package/dist/conversations/titles.js +6 -0
- package/dist/ctx/create-ctx.js +1 -2
- package/dist/ctx/secrets.d.ts +24 -7
- package/dist/ctx/secrets.js +97 -30
- package/dist/db/kernel-schema.d.ts +17 -6
- package/dist/errors.d.ts +5 -2
- package/dist/errors.js +5 -2
- package/dist/evals/reconstruct.d.ts +4 -17
- package/dist/evals/reconstruct.js +13 -53
- package/dist/evals/recorded-tools.d.ts +0 -27
- package/dist/evals/recorded-tools.js +2 -92
- package/dist/evals/run-replay.d.ts +1 -6
- package/dist/evals/run-replay.js +10 -17
- package/dist/evals/sets.service.d.ts +17 -5
- package/dist/evals/sets.service.js +33 -12
- package/dist/evals/snapshot.d.ts +1 -2
- package/dist/evals/snapshot.js +4 -17
- package/dist/extensions/admin-ops.d.ts +6 -1
- package/dist/extensions/admin-ops.js +17 -4
- package/dist/extensions/admin-view.d.ts +7 -4
- package/dist/extensions/admin-view.js +27 -21
- package/dist/extensions/bootstrap.js +0 -1
- package/dist/extensions/cli.js +0 -1
- package/dist/extensions/host.d.ts +2 -3
- package/dist/extensions/host.js +1 -5
- package/dist/extensions/installs.d.ts +1 -3
- package/dist/extensions/instance.d.ts +0 -2
- package/dist/extensions/instance.js +0 -3
- package/dist/extensions/org-config.d.ts +4 -4
- package/dist/extensions/org-config.js +13 -22
- package/dist/extensions/package.d.ts +6 -6
- package/dist/extensions/package.js +3 -7
- package/dist/extensions/permission-view.d.ts +2 -4
- package/dist/extensions/plugin-items.d.ts +21 -1
- package/dist/extensions/plugin-items.js +28 -0
- package/dist/extensions/sync.js +5 -10
- package/dist/extensions/unavailable.js +0 -1
- package/dist/http/api.module.js +2 -1
- package/dist/identity/audit.d.ts +0 -12
- package/dist/identity/audit.js +0 -27
- package/dist/identity/auth.controller.js +5 -9
- package/dist/identity/cookies.d.ts +4 -9
- package/dist/identity/cookies.js +8 -32
- package/dist/identity/initial-passwords.d.ts +1 -1
- package/dist/identity/initial-passwords.js +1 -2
- package/dist/identity/sessions.d.ts +0 -6
- package/dist/identity/sessions.js +0 -18
- package/dist/inbox/platform-inbox.service.d.ts +33 -1
- package/dist/inbox/platform-inbox.service.js +56 -6
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/infra/cli/master-key-rewrap.d.ts +15 -0
- package/dist/infra/cli/master-key-rewrap.js +24 -0
- package/dist/infra/config/kernel-config.service.js +0 -17
- package/dist/infra/health/health.controller.js +8 -0
- package/dist/infra/health/process-fault.d.ts +16 -0
- package/dist/infra/health/process-fault.js +49 -0
- package/dist/infra/lifecycle/process-guards.d.ts +8 -2
- package/dist/infra/lifecycle/process-guards.js +12 -3
- package/dist/infra/lifecycle/shutdown-signals.d.ts +10 -1
- package/dist/infra/lifecycle/shutdown-signals.js +28 -13
- package/dist/infra/outbox/outbox.service.d.ts +12 -9
- package/dist/infra/outbox/outbox.service.js +22 -26
- package/dist/infra/outbox/registry.d.ts +15 -7
- package/dist/infra/outbox/registry.js +39 -23
- package/dist/lifecycle/kernel-lifecycle.js +1 -7
- package/dist/models/enablement.d.ts +5 -6
- package/dist/models/enablement.js +7 -14
- package/dist/orgs/orgs.module.d.ts +2 -2
- package/dist/orgs/orgs.module.js +2 -2
- package/dist/orgs/settings.controller.d.ts +3 -2
- package/dist/orgs/settings.service.d.ts +59 -14
- package/dist/orgs/settings.service.js +102 -20
- package/dist/overrides.d.ts +3 -7
- package/dist/overrides.js +2 -4
- package/dist/packages/tgz.d.ts +0 -2
- package/dist/packages/tgz.js +0 -2
- package/dist/platform/exclusions.js +0 -5
- package/dist/platform/operation.js +1 -1
- package/dist/platform/ops/admin.ops.d.ts +2 -2
- package/dist/platform/ops/admin.ops.js +9 -6
- package/dist/platform/ops/agents.ops.d.ts +3 -3
- package/dist/platform/ops/agents.ops.js +7 -10
- package/dist/platform/ops/connectors.ops.js +46 -1
- package/dist/platform/ops/evals.ops.js +1 -64
- package/dist/platform/ops/extensions-admin.ops.js +1 -1
- package/dist/platform/ops/inbox.ops.js +16 -3
- package/dist/platform/ops/org-plugins.ops.js +1 -1
- package/dist/platform/ops/orgs.ops.d.ts +5 -3
- package/dist/platform/ops/orgs.ops.js +19 -4
- package/dist/platform/ops/outbox.ops.js +5 -5
- package/dist/roles/worker-role.d.ts +2 -3
- package/dist/roles/worker-role.js +3 -13
- package/dist/runtime/context/build.d.ts +56 -18
- package/dist/runtime/context/build.js +143 -50
- package/dist/runtime/context/compaction.d.ts +1 -3
- package/dist/runtime/context/compaction.js +42 -8
- package/dist/runtime/context/run-context.js +1 -2
- package/dist/runtime/context/skills.d.ts +27 -56
- package/dist/runtime/context/skills.js +42 -114
- package/dist/runtime/context/tool-changes.d.ts +3 -3
- package/dist/runtime/context/tool-changes.js +6 -16
- package/dist/runtime/hook-calls.d.ts +6 -6
- package/dist/runtime/hook-calls.js +7 -7
- package/dist/runtime/langgraph-loop.js +1 -0
- package/dist/runtime/maintenance.d.ts +3 -11
- package/dist/runtime/maintenance.js +5 -20
- package/dist/runtime/model-call.d.ts +5 -0
- package/dist/runtime/model-call.js +48 -36
- package/dist/runtime/providers.d.ts +33 -35
- package/dist/runtime/providers.js +64 -109
- package/dist/runtime/run-context.service.js +7 -22
- package/dist/runtime/run-deletion.d.ts +6 -0
- package/dist/runtime/run-deletion.js +39 -16
- package/dist/runtime/run-execution.js +4 -3
- package/dist/runtime/run-finish.js +2 -1
- package/dist/runtime/run-liveness.d.ts +11 -0
- package/dist/runtime/run-liveness.js +19 -0
- package/dist/runtime/run-orphan-check.job.js +2 -1
- package/dist/runtime/run-queue.js +8 -16
- package/dist/runtime/run-worker.d.ts +2 -2
- package/dist/runtime/run-worker.js +8 -6
- package/dist/runtime/subagents/definition.d.ts +16 -20
- package/dist/runtime/subagents/definition.js +27 -27
- package/dist/runtime/subagents/dispatch.d.ts +6 -2
- package/dist/runtime/subagents/dispatch.js +17 -3
- package/dist/runtime/subagents/org-agents.js +1 -2
- package/dist/runtime/subagents/preamble.d.ts +3 -2
- package/dist/runtime/subagents/preamble.js +3 -2
- package/dist/runtime/subagents/render.d.ts +1 -2
- package/dist/runtime/subagents/render.js +1 -2
- package/dist/runtime/subagents/skill-fork.d.ts +2 -4
- package/dist/runtime/subagents/template-skills.d.ts +47 -0
- package/dist/runtime/subagents/template-skills.js +76 -0
- package/dist/schedules/effective-settings.d.ts +9 -3
- package/dist/schedules/effective-settings.js +5 -4
- package/dist/schedules/fire.js +11 -0
- package/dist/schedules/scheduled-tasks.service.js +5 -0
- package/dist/schedules/unattended.d.ts +2 -0
- package/dist/schedules/unattended.js +6 -1
- package/dist/skills/agent-skills.service.js +1 -2
- package/dist/skills/catalog.d.ts +1 -3
- package/dist/skills/catalog.js +1 -3
- package/dist/skills/conversation-catalog.d.ts +1 -2
- package/dist/skills/conversation-catalog.js +1 -2
- package/dist/skills/usable.js +2 -3
- package/dist/storage/storage.service.js +9 -1
- package/dist/tools/approvals.service.js +2 -4
- package/dist/tools/builtin-names.d.ts +2 -9
- package/dist/tools/builtin-names.js +4 -13
- package/dist/tools/builtins/sandbox/bash.js +3 -3
- package/dist/tools/builtins/sandbox/common.d.ts +7 -13
- package/dist/tools/builtins/sandbox/common.js +8 -115
- package/dist/tools/builtins/sandbox/fetch-attachment.d.ts +10 -0
- package/dist/tools/builtins/sandbox/fetch-attachment.js +119 -0
- package/dist/tools/builtins/sandbox/glob.js +1 -3
- package/dist/tools/builtins/sandbox/grep.js +3 -5
- package/dist/tools/builtins/sandbox/index.d.ts +8 -5
- package/dist/tools/builtins/sandbox/index.js +10 -5
- package/dist/tools/builtins/sandbox/read.js +3 -2
- package/dist/tools/builtins/tool-search.d.ts +4 -7
- package/dist/tools/builtins/tool-search.js +6 -10
- package/dist/tools/connector-account-policies.d.ts +30 -3
- package/dist/tools/connector-account-policies.js +54 -7
- package/dist/tools/connectors.controller.d.ts +24 -11
- package/dist/tools/connectors.controller.js +35 -6
- package/dist/tools/connectors.schemas.d.ts +14 -1
- package/dist/tools/connectors.schemas.js +14 -2
- package/dist/tools/connectors.service.d.ts +22 -0
- package/dist/tools/connectors.service.js +56 -0
- package/dist/tools/drift.d.ts +1 -1
- package/dist/tools/drift.js +1 -1
- package/dist/tools/git-push-policy.d.ts +4 -1
- package/dist/tools/git-push-policy.js +3 -1
- package/dist/tools/info.d.ts +1 -7
- package/dist/tools/info.js +5 -18
- package/dist/tools/job-ids.d.ts +0 -4
- package/dist/tools/job-ids.js +1 -6
- package/dist/tools/pipeline.d.ts +4 -10
- package/dist/tools/pipeline.js +16 -62
- package/dist/tools/policy.d.ts +6 -2
- package/dist/tools/policy.js +14 -12
- package/dist/tools/registry.js +1 -5
- package/dist/ui/views.d.ts +5 -5
- package/dist/ui/views.js +10 -16
- package/package.json +3 -3
- package/src/migrations/0137_audit_org_idx.sql +5 -0
- package/src/migrations/0138_plugin_install_status_no_upgrading.sql +18 -0
- package/src/migrations/0139_retire_legacy_forms.sql +183 -0
- package/src/migrations/0140_retire_history_forms.sql +148 -0
- package/src/migrations/0141_install_ledger_promoted_rows.sql +36 -0
- package/src/migrations/0142_backfill_event_fields.sql +74 -0
- package/src/migrations/0143_backfill_model_call_fields.sql +105 -0
- package/src/migrations/0144_retire_frozen_definition_keys.sql +163 -0
- package/dist/admin/platform-audit.service.d.ts +0 -41
- package/dist/conversations/job-ids.d.ts +0 -6
- package/dist/conversations/job-ids.js +0 -6
- package/dist/extensions/job-ids.d.ts +0 -6
- package/dist/extensions/job-ids.js +0 -6
- package/dist/infra/queue/retired-schedulers.d.ts +0 -7
- package/dist/infra/queue/retired-schedulers.js +0 -9
- package/dist/orgs/job-ids.d.ts +0 -8
- package/dist/orgs/job-ids.js +0 -8
- package/dist/runtime/context/legacy-text.d.ts +0 -22
- package/dist/runtime/context/legacy-text.js +0 -37
- package/dist/runtime/job-ids.d.ts +0 -10
- package/dist/runtime/job-ids.js +0 -10
- package/dist/runtime/retired-schedulers.d.ts +0 -7
- package/dist/runtime/retired-schedulers.js +0 -31
- package/dist/storage/job-ids.d.ts +0 -6
- package/dist/storage/job-ids.js +0 -6
- package/dist/tools/legacy-data.d.ts +0 -34
- package/dist/tools/legacy-data.js +0 -76
- package/dist/tools/legacy-keys.d.ts +0 -51
- package/dist/tools/legacy-keys.js +0 -114
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { SingleProviderNote } from "../extensions/single-provider.js";
|
|
2
|
-
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
3
2
|
import type { ActorOpts, CatalogItemView } from "./catalog.service.js";
|
|
4
|
-
import { CatalogScopeService } from "./catalog-scope.service.js";
|
|
5
3
|
import { PluginImport, type PluginReview } from "./plugin-import.js";
|
|
6
4
|
import { PlatformPluginUpdater, type PlatformUpdatePreview } from "./plugin-upgrade.js";
|
|
7
5
|
/** A staged org upload: the review, and the update preview of a new version (null: none). */
|
|
@@ -40,10 +38,8 @@ export declare function ownerUpdateHash(reviewHash: string, diffHash: string): s
|
|
|
40
38
|
/**
|
|
41
39
|
* An org admin's plugin upload (spec §14.1 item 1, rulings P3-7, P3-8, P3-12, P3-13 to P3-15'): a
|
|
42
40
|
* `.tgz` prepared and confirmed through {@link PluginImport} in owner mode (the org's own staging,
|
|
43
|
-
* its admin re-checked under the org row lock), owned by the org with scope `named: [owner]`.
|
|
44
|
-
*
|
|
45
|
-
* `PluginImport` cannot reach the scope service, which depends on it), and installs it in the
|
|
46
|
-
* owner org.
|
|
41
|
+
* its admin re-checked under the org row lock), owned by the org with scope `named: [owner]`. The
|
|
42
|
+
* confirm's commit owes the item's scope sync, which installs it in the owner org.
|
|
47
43
|
*
|
|
48
44
|
* A new version of the org's own plugin without an extension (P3-12, P3-12') is reviewed with the
|
|
49
45
|
* platform update it applies (`PlatformPluginUpdater.previewForOwner` on the staged target,
|
|
@@ -54,24 +50,19 @@ export declare function ownerUpdateHash(reviewHash: string, diffHash: string): s
|
|
|
54
50
|
*/
|
|
55
51
|
export declare class OrgPluginUploads {
|
|
56
52
|
private readonly pluginImport;
|
|
57
|
-
private readonly scope;
|
|
58
53
|
private readonly updater;
|
|
59
|
-
|
|
60
|
-
constructor(pluginImport: PluginImport, scope: CatalogScopeService, updater: PlatformPluginUpdater, txHost: TransactionHost);
|
|
54
|
+
constructor(pluginImport: PluginImport, updater: PlatformPluginUpdater);
|
|
61
55
|
/** Reads, checks and stages the uploaded tgz for the org (see `PluginImport.prepare`). */
|
|
62
56
|
prepare(actor: string, orgId: string, bytes: Uint8Array, opts?: ActorOpts): Promise<OrgUploadReview>;
|
|
63
57
|
/** The org's own staged upload; another org's or the platform's -> 404 `plugin.staging_not_found`. */
|
|
64
58
|
staged(orgId: string, stagingId: string): Promise<OrgUploadReview>;
|
|
65
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Confirms the org's staged upload (applying a new version); its commit owes the scope sync.
|
|
61
|
+
*/
|
|
66
62
|
confirm(actor: string, orgId: string, stagingId: string, input: {
|
|
67
63
|
reviewHash: string;
|
|
68
64
|
shareable?: boolean;
|
|
69
65
|
}, opts?: ActorOpts): Promise<OrgUploadResult>;
|
|
70
|
-
/**
|
|
71
|
-
* Owes the confirmed item's scope sync in a transaction of its own: the confirm's writes span
|
|
72
|
-
* more than one transaction (`PluginImport.confirm`), and the sync follows the last of them.
|
|
73
|
-
*/
|
|
74
|
-
private oweSync;
|
|
75
66
|
/** The review with the update preview of a new version and the combined hash (P3-12). */
|
|
76
67
|
private withUpdate;
|
|
77
68
|
}
|
|
@@ -10,10 +10,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
11
11
|
import { Inject, Injectable } from "@nestjs/common";
|
|
12
12
|
import { ApiError } from "../errors.js";
|
|
13
|
-
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
14
|
-
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
15
13
|
import { canonicalJson } from "../tools/canonical-json.js";
|
|
16
|
-
import { CatalogScopeService } from "./catalog-scope.service.js";
|
|
17
14
|
import { PluginImport } from "./plugin-import.js";
|
|
18
15
|
import { PlatformPluginUpdater } from "./plugin-upgrade.js";
|
|
19
16
|
/** The hash an org confirms a new version with: the review's and the update's (P3-12). */
|
|
@@ -27,10 +24,8 @@ const reviewStale = (name, version) => new ApiError("plugin.review_stale", `The
|
|
|
27
24
|
/**
|
|
28
25
|
* An org admin's plugin upload (spec §14.1 item 1, rulings P3-7, P3-8, P3-12, P3-13 to P3-15'): a
|
|
29
26
|
* `.tgz` prepared and confirmed through {@link PluginImport} in owner mode (the org's own staging,
|
|
30
|
-
* its admin re-checked under the org row lock), owned by the org with scope `named: [owner]`.
|
|
31
|
-
*
|
|
32
|
-
* `PluginImport` cannot reach the scope service, which depends on it), and installs it in the
|
|
33
|
-
* owner org.
|
|
27
|
+
* its admin re-checked under the org row lock), owned by the org with scope `named: [owner]`. The
|
|
28
|
+
* confirm's commit owes the item's scope sync, which installs it in the owner org.
|
|
34
29
|
*
|
|
35
30
|
* A new version of the org's own plugin without an extension (P3-12, P3-12') is reviewed with the
|
|
36
31
|
* platform update it applies (`PlatformPluginUpdater.previewForOwner` on the staged target,
|
|
@@ -41,14 +36,10 @@ const reviewStale = (name, version) => new ApiError("plugin.review_stale", `The
|
|
|
41
36
|
*/
|
|
42
37
|
let OrgPluginUploads = class OrgPluginUploads {
|
|
43
38
|
pluginImport;
|
|
44
|
-
scope;
|
|
45
39
|
updater;
|
|
46
|
-
|
|
47
|
-
constructor(pluginImport, scope, updater, txHost) {
|
|
40
|
+
constructor(pluginImport, updater) {
|
|
48
41
|
this.pluginImport = pluginImport;
|
|
49
|
-
this.scope = scope;
|
|
50
42
|
this.updater = updater;
|
|
51
|
-
this.txHost = txHost;
|
|
52
43
|
}
|
|
53
44
|
/** Reads, checks and stages the uploaded tgz for the org (see `PluginImport.prepare`). */
|
|
54
45
|
async prepare(actor, orgId, bytes, opts = {}) {
|
|
@@ -60,7 +51,9 @@ let OrgPluginUploads = class OrgPluginUploads {
|
|
|
60
51
|
const r = await this.pluginImport.staged(stagingId, { orgId });
|
|
61
52
|
return this.withUpdate(orgId, r.stagingId, r.review);
|
|
62
53
|
}
|
|
63
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Confirms the org's staged upload (applying a new version); its commit owes the scope sync.
|
|
56
|
+
*/
|
|
64
57
|
async confirm(actor, orgId, stagingId, input, opts = {}) {
|
|
65
58
|
const st = await this.pluginImport.stagedTarget(stagingId, { orgId });
|
|
66
59
|
if (!appliesAtOnce(st)) {
|
|
@@ -71,7 +64,6 @@ let OrgPluginUploads = class OrgPluginUploads {
|
|
|
71
64
|
// A version waiting for the super admin is synced by their confirmation (P3-10)
|
|
72
65
|
if (r.pending)
|
|
73
66
|
return { item: r.item, outcome: "pending" };
|
|
74
|
-
await this.oweSync(r.item.id);
|
|
75
67
|
return { item: r.item, outcome: r.firstVersion ? "installed" : "updated" };
|
|
76
68
|
}
|
|
77
69
|
// The one hash covers the review and the update (P3-12): both recomputed now
|
|
@@ -82,6 +74,8 @@ let OrgPluginUploads = class OrgPluginUploads {
|
|
|
82
74
|
const r = await this.pluginImport.confirm(actor, stagingId, {
|
|
83
75
|
reviewHash: st.reviewHash,
|
|
84
76
|
...(input.shareable !== undefined && { shareable: input.shareable }),
|
|
77
|
+
// the update below owes the scope sync with its commit
|
|
78
|
+
updateFollows: true,
|
|
85
79
|
}, { ...opts, owner: { orgId } });
|
|
86
80
|
// The version is committed; a failed update leaves it imported (uploading it again retries)
|
|
87
81
|
const u = await this.updater.updateAsOwner(orgId, actor, r.item.id, st.version, preview.diffHash, opts);
|
|
@@ -93,13 +87,6 @@ let OrgPluginUploads = class OrgPluginUploads {
|
|
|
93
87
|
}),
|
|
94
88
|
};
|
|
95
89
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Owes the confirmed item's scope sync in a transaction of its own: the confirm's writes span
|
|
98
|
-
* more than one transaction (`PluginImport.confirm`), and the sync follows the last of them.
|
|
99
|
-
*/
|
|
100
|
-
async oweSync(itemId) {
|
|
101
|
-
await this.scope.enqueueSync(itemId);
|
|
102
|
-
}
|
|
103
90
|
/** The review with the update preview of a new version and the combined hash (P3-12). */
|
|
104
91
|
async withUpdate(orgId, stagingId, review) {
|
|
105
92
|
const st = await this.pluginImport.stagedTarget(stagingId, { orgId });
|
|
@@ -113,15 +100,10 @@ let OrgPluginUploads = class OrgPluginUploads {
|
|
|
113
100
|
};
|
|
114
101
|
}
|
|
115
102
|
};
|
|
116
|
-
__decorate([
|
|
117
|
-
Transactional()
|
|
118
|
-
], OrgPluginUploads.prototype, "oweSync", null);
|
|
119
103
|
OrgPluginUploads = __decorate([
|
|
120
104
|
Injectable(),
|
|
121
105
|
__param(0, Inject(PluginImport)),
|
|
122
|
-
__param(1, Inject(
|
|
123
|
-
__param(2, Inject(PlatformPluginUpdater)),
|
|
124
|
-
__param(3, Inject(TransactionHost))
|
|
106
|
+
__param(1, Inject(PlatformPluginUpdater))
|
|
125
107
|
], OrgPluginUploads);
|
|
126
108
|
export { OrgPluginUploads };
|
|
127
109
|
/**
|
|
@@ -423,7 +423,6 @@ let OwnedItems = class OwnedItems {
|
|
|
423
423
|
pending_at: null,
|
|
424
424
|
...(!item.shareable && { shown_to_others: false }),
|
|
425
425
|
...(item.scope === "all" && { scope: "named" }),
|
|
426
|
-
scope_version: sql `scope_version + 1`,
|
|
427
426
|
updated_at: now,
|
|
428
427
|
})
|
|
429
428
|
.where("id", "=", item.id)
|
|
@@ -470,7 +469,7 @@ let OwnedItems = class OwnedItems {
|
|
|
470
469
|
for (const { c, orgs } of narrow) {
|
|
471
470
|
await t
|
|
472
471
|
.updateTable(TABLE_OF[c.kind])
|
|
473
|
-
.set({ scope: "named",
|
|
472
|
+
.set({ scope: "named", updated_at: now })
|
|
474
473
|
.where("id", "=", c.id)
|
|
475
474
|
.execute();
|
|
476
475
|
await t
|
|
@@ -622,7 +621,6 @@ let OwnedItems = class OwnedItems {
|
|
|
622
621
|
...(!c.shareable && { shown_to_others: false }),
|
|
623
622
|
...(narrowTo !== null && {
|
|
624
623
|
scope: "named",
|
|
625
|
-
scope_version: sql `scope_version + 1`,
|
|
626
624
|
}),
|
|
627
625
|
updated_at: now,
|
|
628
626
|
})
|
|
@@ -62,7 +62,7 @@ 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, { reviewHash: input.reviewHash, deploy: false }, opts);
|
|
65
|
+
const imported = await this.pluginImport.confirm(actor, stagingId, { reviewHash: input.reviewHash, deploy: false, updateFollows: true }, opts);
|
|
66
66
|
try {
|
|
67
67
|
const update = await this.updater.updateHeld(actor, st.itemId, { version: st.version, diffHash: input.diffHash }, opts);
|
|
68
68
|
return { item: await this.pluginImport.view(st.itemId), update };
|
|
@@ -33,8 +33,7 @@ import type { PluginScope } from "./scope.js";
|
|
|
33
33
|
*
|
|
34
34
|
* prepare: the tgz is always hostile input, and **nothing is written until every check passes**
|
|
35
35
|
* (F-AD): `readPluginPackage` (plugin.json, package.json, listed / scanned skills and templates,
|
|
36
|
-
* icons
|
|
37
|
-
* (`readExtensionPackage`), the extension's deployment state (config-declared names are
|
|
36
|
+
* icons), the extension's module graph and migrations (`readExtensionPackage`), the extension's deployment state (config-declared names are
|
|
38
37
|
* refused; name ownership; a downgrade to a version with unrun migrations is refused), each skill by
|
|
39
38
|
* the skill package rules, each connector template against the connector loaded on this replica (or
|
|
40
39
|
* statically when the connector is provided by the plugin's own extension or by a dependency), the
|
|
@@ -387,9 +386,8 @@ export interface StagedTarget {
|
|
|
387
386
|
};
|
|
388
387
|
}
|
|
389
388
|
/**
|
|
390
|
-
* The API error of a plugin package that cannot be read in a catalog path:
|
|
391
|
-
* `
|
|
392
|
-
* spec §5) -> `theme.invalid` (details `[{ theme, errors }]`) or `theme.unreadable` (details
|
|
389
|
+
* The API error of a plugin package that cannot be read in a catalog path: undeclared client code
|
|
390
|
+
* -> `client.undeclared`; a failing theme (themes spec §5) -> `theme.invalid` (details `[{ theme, errors }]`) or `theme.unreadable` (details
|
|
393
391
|
* `[{ theme, issues }]`, the failing pairs); anything else -> `catalog.invalid_manifest` (issues as
|
|
394
392
|
* details).
|
|
395
393
|
*/
|
|
@@ -417,10 +415,8 @@ export declare class PluginImport {
|
|
|
417
415
|
private readonly platform;
|
|
418
416
|
/** The client build of a dropped org upload's package is deleted with it. */
|
|
419
417
|
private readonly clientBuilds;
|
|
420
|
-
/** The scope sync
|
|
418
|
+
/** The item's scope sync, owed by the confirm's commit when it deploys no extension. */
|
|
421
419
|
private readonly outbox;
|
|
422
|
-
/** The backstop's delay (a test seam; default `SCOPE_BACKSTOP_DELAY_MS`). */
|
|
423
|
-
private readonly backstopDelayMs;
|
|
424
420
|
/** Where plugin files go (the kernel's object storage; the CLI's own, see {@link useCliStorage}). */
|
|
425
421
|
private files;
|
|
426
422
|
/**
|
|
@@ -442,10 +438,8 @@ export declare class PluginImport {
|
|
|
442
438
|
platform: PlatformComponents,
|
|
443
439
|
/** The client build of a dropped org upload's package is deleted with it. */
|
|
444
440
|
clientBuilds: ClientBuilds,
|
|
445
|
-
/** The scope sync
|
|
446
|
-
outbox: Pick<OutboxService, "add"
|
|
447
|
-
/** The backstop's delay (a test seam; default `SCOPE_BACKSTOP_DELAY_MS`). */
|
|
448
|
-
backstopDelayMs?: number);
|
|
441
|
+
/** The item's scope sync, owed by the confirm's commit when it deploys no extension. */
|
|
442
|
+
outbox: Pick<OutboxService, "add">);
|
|
449
443
|
/** The kernel-schema handle of the current context (the transaction, else the pool). */
|
|
450
444
|
private get db();
|
|
451
445
|
/**
|
|
@@ -557,7 +551,7 @@ export declare class PluginImport {
|
|
|
557
551
|
* extension's deploy result (a failed deploy is returned, not thrown). `scope` (default
|
|
558
552
|
* `optional`) and `orgs` (only with `named`; each an existing org, else `validation_failed`) are
|
|
559
553
|
* written when this confirm creates the item; a new version of an existing item keeps its scope.
|
|
560
|
-
* The
|
|
554
|
+
* The commit owes the item's scope sync, or the extension's deploy does (see {@link commit}).
|
|
561
555
|
*
|
|
562
556
|
* An org upload (`opts.owner`, spec §14): only that org's staging; the actor re-checked as its
|
|
563
557
|
* admin; `scope` / `orgs` are not taken: a new item is owned by the org, scope `named: [owner]`,
|
|
@@ -587,6 +581,14 @@ export declare class PluginImport {
|
|
|
587
581
|
* `approval`.
|
|
588
582
|
*/
|
|
589
583
|
deploy?: boolean;
|
|
584
|
+
/**
|
|
585
|
+
* A platform update of the item to this version follows the confirm (`PlatformImportUpdate`,
|
|
586
|
+
* an org's own version applied at once by `OrgPluginUploads`): the update owes the item's
|
|
587
|
+
* scope sync with its own commit, so this commit owes none. A sync owed here would run while
|
|
588
|
+
* the update moves the extension, converge the orgs to the old version, and turn the
|
|
589
|
+
* update's reviewed diff stale before its commit.
|
|
590
|
+
*/
|
|
591
|
+
updateFollows?: boolean;
|
|
590
592
|
}, opts?: ActorOpts & {
|
|
591
593
|
owner?: ImportOwner;
|
|
592
594
|
}): Promise<PluginConfirmResult>;
|
|
@@ -9,7 +9,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
9
9
|
};
|
|
10
10
|
import { createHash, randomUUID } from "node:crypto";
|
|
11
11
|
import { appearanceIssues, PLUGIN_MANIFEST_FILE, parseSkillMd, pluginDescription, SDK_VERSION, SKILL_ENTRY_FILE, } from "@capybara-hq/plugin-sdk";
|
|
12
|
-
import { Inject, Injectable
|
|
12
|
+
import { Inject, Injectable } from "@nestjs/common";
|
|
13
13
|
import { sql } from "kysely";
|
|
14
14
|
import semver from "semver";
|
|
15
15
|
import { ClientBuilds } from "../client/client-builds.service.js";
|
|
@@ -55,7 +55,7 @@ import { PlanStale, PlatformComponents } from "./platform-components.js";
|
|
|
55
55
|
import { PluginPackageError, readPluginFiles, readPluginPackage, themeApiError, } from "./plugin-package.js";
|
|
56
56
|
import { hasImportRequests, importRequestOf, resolveImportRequests } from "./request-rules.js";
|
|
57
57
|
import { assertNameNotReserved } from "./reserved-names.js";
|
|
58
|
-
import { oweScopeItem
|
|
58
|
+
import { oweScopeItem } from "./scope-jobs.js";
|
|
59
59
|
import { addScopeOrg } from "./scope-orgs.js";
|
|
60
60
|
import { maxSatisfying, satisfiesRange } from "./versions.js";
|
|
61
61
|
/**
|
|
@@ -64,8 +64,7 @@ import { maxSatisfying, satisfiesRange } from "./versions.js";
|
|
|
64
64
|
*
|
|
65
65
|
* prepare: the tgz is always hostile input, and **nothing is written until every check passes**
|
|
66
66
|
* (F-AD): `readPluginPackage` (plugin.json, package.json, listed / scanned skills and templates,
|
|
67
|
-
* icons
|
|
68
|
-
* (`readExtensionPackage`), the extension's deployment state (config-declared names are
|
|
67
|
+
* icons), the extension's module graph and migrations (`readExtensionPackage`), the extension's deployment state (config-declared names are
|
|
69
68
|
* refused; name ownership; a downgrade to a version with unrun migrations is refused), each skill by
|
|
70
69
|
* the skill package rules, each connector template against the connector loaded on this replica (or
|
|
71
70
|
* statically when the connector is provided by the plugin's own extension or by a dependency), the
|
|
@@ -112,16 +111,12 @@ const invalid = (problems) => new ApiError("catalog.invalid_manifest", `Invalid
|
|
|
112
111
|
const reviewStale = (review) => new ApiError("plugin.review_stale", `The review of plugin ${review.name} ${review.version} is out of date (it changed, or its extension on this deployment changed since it was prepared); review it again`);
|
|
113
112
|
const mismatch = (what) => new ApiError("marketplace.package_mismatch", `The downloaded package does not match the marketplace entry: ${what}`);
|
|
114
113
|
/**
|
|
115
|
-
* The API error of a plugin package that cannot be read in a catalog path:
|
|
116
|
-
* `
|
|
117
|
-
* spec §5) -> `theme.invalid` (details `[{ theme, errors }]`) or `theme.unreadable` (details
|
|
114
|
+
* The API error of a plugin package that cannot be read in a catalog path: undeclared client code
|
|
115
|
+
* -> `client.undeclared`; a failing theme (themes spec §5) -> `theme.invalid` (details `[{ theme, errors }]`) or `theme.unreadable` (details
|
|
118
116
|
* `[{ theme, issues }]`, the failing pairs); anything else -> `catalog.invalid_manifest` (issues as
|
|
119
117
|
* details).
|
|
120
118
|
*/
|
|
121
119
|
export function catalogPackageError(e) {
|
|
122
|
-
const legacy = e.code === "catalog.legacy_format" || e.code === "extension.legacy_format";
|
|
123
|
-
if (legacy)
|
|
124
|
-
return new ApiError("catalog.legacy_format", e.message, e.issues);
|
|
125
120
|
if (e.code === "client.undeclared")
|
|
126
121
|
return new ApiError("client.undeclared", e.message);
|
|
127
122
|
if (e.code === "theme.invalid" || e.code === "theme.unreadable") {
|
|
@@ -165,7 +160,6 @@ let PluginImport = class PluginImport {
|
|
|
165
160
|
platform;
|
|
166
161
|
clientBuilds;
|
|
167
162
|
outbox;
|
|
168
|
-
backstopDelayMs;
|
|
169
163
|
/** Where plugin files go (the kernel's object storage; the CLI's own, see {@link useCliStorage}). */
|
|
170
164
|
files;
|
|
171
165
|
/**
|
|
@@ -187,10 +181,8 @@ let PluginImport = class PluginImport {
|
|
|
187
181
|
platform,
|
|
188
182
|
/** The client build of a dropped org upload's package is deleted with it. */
|
|
189
183
|
clientBuilds,
|
|
190
|
-
/** The scope sync
|
|
191
|
-
outbox
|
|
192
|
-
/** The backstop's delay (a test seam; default `SCOPE_BACKSTOP_DELAY_MS`). */
|
|
193
|
-
backstopDelayMs = SCOPE_BACKSTOP_DELAY_MS) {
|
|
184
|
+
/** The item's scope sync, owed by the confirm's commit when it deploys no extension. */
|
|
185
|
+
outbox) {
|
|
194
186
|
this.kdb = kdb;
|
|
195
187
|
this.adminLock = adminLock;
|
|
196
188
|
this.orgLock = orgLock;
|
|
@@ -208,7 +200,6 @@ let PluginImport = class PluginImport {
|
|
|
208
200
|
this.platform = platform;
|
|
209
201
|
this.clientBuilds = clientBuilds;
|
|
210
202
|
this.outbox = outbox;
|
|
211
|
-
this.backstopDelayMs = backstopDelayMs;
|
|
212
203
|
this.files = storage;
|
|
213
204
|
}
|
|
214
205
|
/** The kernel-schema handle of the current context (the transaction, else the pool). */
|
|
@@ -679,7 +670,7 @@ let PluginImport = class PluginImport {
|
|
|
679
670
|
* extension's deploy result (a failed deploy is returned, not thrown). `scope` (default
|
|
680
671
|
* `optional`) and `orgs` (only with `named`; each an existing org, else `validation_failed`) are
|
|
681
672
|
* written when this confirm creates the item; a new version of an existing item keeps its scope.
|
|
682
|
-
* The
|
|
673
|
+
* The commit owes the item's scope sync, or the extension's deploy does (see {@link commit}).
|
|
683
674
|
*
|
|
684
675
|
* An org upload (`opts.owner`, spec §14): only that org's staging; the actor re-checked as its
|
|
685
676
|
* admin; `scope` / `orgs` are not taken: a new item is owned by the org, scope `named: [owner]`,
|
|
@@ -746,7 +737,7 @@ let PluginImport = class PluginImport {
|
|
|
746
737
|
scope,
|
|
747
738
|
orgs: [...new Set(orgs ?? [])].sort(),
|
|
748
739
|
...(owner !== undefined && { owner, shareable: input.shareable ?? false }),
|
|
749
|
-
}, stored, opts, prepared);
|
|
740
|
+
}, stored, opts, prepared, input.updateFollows === true);
|
|
750
741
|
const { now } = committed;
|
|
751
742
|
if (committed.pending) {
|
|
752
743
|
// Waits for the super admin (P3-10): no platform components, nothing deployed
|
|
@@ -830,7 +821,9 @@ let PluginImport = class PluginImport {
|
|
|
830
821
|
* for another item or version, or a component changed since it -> `plugin.review_stale`. A new
|
|
831
822
|
* version of an existing item leaves them to the platform update.
|
|
832
823
|
*/
|
|
833
|
-
async commit(actor, c, scope, stored, opts, prepared
|
|
824
|
+
async commit(actor, c, scope, stored, opts, prepared,
|
|
825
|
+
/** A platform update follows and owes the scope sync (see `confirm`'s `updateFollows`). */
|
|
826
|
+
updateFollows) {
|
|
834
827
|
const { stagingId, review, staged, src, manifest } = c;
|
|
835
828
|
const reviewed = review.extension;
|
|
836
829
|
const stale = () => reviewStale(review);
|
|
@@ -1077,19 +1070,19 @@ let PluginImport = class PluginImport {
|
|
|
1077
1070
|
throw e;
|
|
1078
1071
|
}
|
|
1079
1072
|
}
|
|
1080
|
-
// The commit owes the
|
|
1081
|
-
//
|
|
1082
|
-
|
|
1073
|
+
// The commit owes the item's scope sync when its scope turns it on by itself (`all` or
|
|
1074
|
+
// `named`; an org's own item always), unless an extension is to be installed or upgraded: then
|
|
1075
|
+
// its deploy owes it (`oweDeployedExtensionSync`), so no sync runs before it is enabled; or a
|
|
1076
|
+
// platform update to this version follows: its commit owes it
|
|
1077
|
+
const deploys = now !== undefined && now.action !== "keep";
|
|
1078
|
+
if (!pending && !deploys && !updateFollows) {
|
|
1083
1079
|
const item = await t
|
|
1084
1080
|
.selectFrom("catalog_items")
|
|
1085
1081
|
.select("scope")
|
|
1086
1082
|
.where("id", "=", itemId)
|
|
1087
1083
|
.executeTakeFirstOrThrow();
|
|
1088
|
-
if (item.scope !== "optional") {
|
|
1089
|
-
await oweScopeItem(this.outbox, t, itemId
|
|
1090
|
-
backstop: true,
|
|
1091
|
-
backstopDelayMs: this.backstopDelayMs,
|
|
1092
|
-
});
|
|
1084
|
+
if (item.scope !== "optional" || owner !== undefined) {
|
|
1085
|
+
await oweScopeItem(this.outbox, t, itemId);
|
|
1093
1086
|
}
|
|
1094
1087
|
}
|
|
1095
1088
|
return {
|
|
@@ -1740,9 +1733,7 @@ PluginImport = __decorate([
|
|
|
1740
1733
|
__param(14, Inject(TransactionHost)),
|
|
1741
1734
|
__param(15, Inject(PlatformComponents)),
|
|
1742
1735
|
__param(16, Inject(ClientBuilds)),
|
|
1743
|
-
__param(17, Inject(OutboxService))
|
|
1744
|
-
__param(18, Optional()),
|
|
1745
|
-
__param(18, Inject(SCOPE_BACKSTOP_DELAY))
|
|
1736
|
+
__param(17, Inject(OutboxService))
|
|
1746
1737
|
], PluginImport);
|
|
1747
1738
|
export { PluginImport };
|
|
1748
1739
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AgentTemplate, type ConnectorTemplateFile, type ConnectorTemplateSpec, type PluginManifest } from "@capybara-hq/plugin-sdk";
|
|
2
|
-
import type { KernelSchemaDb, SourceFormat } from "../db/kernel-schema.js";
|
|
2
|
+
import type { KernelSchemaDb, PluginInstallStatus, SourceFormat } from "../db/kernel-schema.js";
|
|
3
3
|
import { ApiError } from "../errors.js";
|
|
4
4
|
import { OrgExtensionConfigs, type OrgExtensionInput, type OrgExtensionPutOptions } from "../extensions/org-config.js";
|
|
5
5
|
import { ExtensionRegistry } from "../extensions/registry.js";
|
|
@@ -108,7 +108,7 @@ export interface PluginInstallView {
|
|
|
108
108
|
itemId: string;
|
|
109
109
|
name: string;
|
|
110
110
|
version: string;
|
|
111
|
-
status:
|
|
111
|
+
status: PluginInstallStatus;
|
|
112
112
|
installedBy: string | null;
|
|
113
113
|
installedAt: string;
|
|
114
114
|
/** The failed install's step and code, or the last failed upgrade's (the install stays installed). */
|
|
@@ -261,8 +261,7 @@ export declare function under(e: unknown, at: string): unknown;
|
|
|
261
261
|
* `plugin.install_failed` is thrown. Uninstall removes only components with created=true that
|
|
262
262
|
* nothing else uses, and reports what it kept and why. No in-process state; the org row lock
|
|
263
263
|
* serializes writes within one org. There is no per-org upgrade: a platform plugin is updated
|
|
264
|
-
* once for the deployment (`PlatformPluginUpdater`, plugin-upgrade.ts, ruling F2)
|
|
265
|
-
* `upgrading` by an earlier per-org upgrade is undone from its journal by the next uninstall. The
|
|
264
|
+
* once for the deployment (`PlatformPluginUpdater`, plugin-upgrade.ts, ruling F2). The
|
|
266
265
|
* methods without `private` are internal to the catalog, not an API.
|
|
267
266
|
*/
|
|
268
267
|
export declare class PluginInstaller {
|
|
@@ -510,19 +509,6 @@ export declare class PluginInstaller {
|
|
|
510
509
|
private uninstallExtensionOrder;
|
|
511
510
|
/** The org's plugin installs (failed ones included), newest first; `installId` picks one. */
|
|
512
511
|
list(orgId: string, installId?: string): Promise<PluginInstallView[]>;
|
|
513
|
-
/**
|
|
514
|
-
* Undoes the steps of an upgrade in the caller's transaction (the caller holds the org row lock),
|
|
515
|
-
* in reverse order: components it created are removed (a dependency install by the uninstall
|
|
516
|
-
* rules, an extension another enabled extension depends on is kept), the ledger rows it added
|
|
517
|
-
* are deleted, and versions it added to skills are reverted (`revertVersionIn` reverts exactly
|
|
518
|
-
* one version, and an upgrade adds at most one per skill). Returns the components removed (an
|
|
519
|
-
* extension among them needs `afterDisable` once committed). Used when an upgrade fails and when
|
|
520
|
-
* an interrupted one is cleaned up.
|
|
521
|
-
*/
|
|
522
|
-
undoUpgradeIn(orgId: string, actor: string | null, installId: string, steps: readonly UpgradeStep[], reason: string): Promise<{
|
|
523
|
-
kind: ComponentKind;
|
|
524
|
-
ref: string;
|
|
525
|
-
}[]>;
|
|
526
512
|
/**
|
|
527
513
|
* Installs the dependencies an installed plugin's version declares and the org lacks (rule 9),
|
|
528
514
|
* as the kernel (actor null): a platform update can add one. Each is recorded on the install
|
|
@@ -642,32 +628,6 @@ export interface SkillPlan {
|
|
|
642
628
|
* Exported for the upgrade preview.
|
|
643
629
|
*/
|
|
644
630
|
export declare function planSkillConflicts(db: KernelSchemaDb, orgId: string, plan: SkillPlan): Promise<SkillConflict[]>;
|
|
645
|
-
/**
|
|
646
|
-
* One step a running upgrade took, journaled in `plugin_installs.upgrade.done` (migration 0049) so
|
|
647
|
-
* a failed or interrupted upgrade can be undone: `created` a component the upgrade created (its
|
|
648
|
-
* ledger row created=true), `recorded` an existing component it added to the ledger
|
|
649
|
-
* (created=false), `skill_version` / `template_version` a version it added to a skill / an agent
|
|
650
|
-
* template.
|
|
651
|
-
*/
|
|
652
|
-
export type UpgradeStep = {
|
|
653
|
-
op: "created";
|
|
654
|
-
kind: ComponentKind;
|
|
655
|
-
ref: string;
|
|
656
|
-
} | {
|
|
657
|
-
op: "recorded";
|
|
658
|
-
kind: ComponentKind;
|
|
659
|
-
ref: string;
|
|
660
|
-
} | {
|
|
661
|
-
op: "skill_version";
|
|
662
|
-
ref: string;
|
|
663
|
-
version: number;
|
|
664
|
-
} | {
|
|
665
|
-
op: "template_version";
|
|
666
|
-
ref: string;
|
|
667
|
-
version: number;
|
|
668
|
-
};
|
|
669
|
-
/** The journaled steps of `plugin_installs.upgrade` (malformed entries are skipped). */
|
|
670
|
-
export declare function journalEntries(upgrade: unknown): UpgradeStep[];
|
|
671
631
|
/** The org actions a plan needs: the union over the plugins it installs (spec §10). */
|
|
672
632
|
export declare function planActions(plan: InstallPlan): OrgAction[];
|
|
673
633
|
export {};
|