@capybara-hq/kernel 0.1.0-rc.4 → 0.1.0-rc.41
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 +103 -5
- package/dist/admin/admin-agents.controller.d.ts +28 -0
- package/dist/admin/admin-agents.controller.js +79 -0
- package/dist/admin/admin-connectors.controller.d.ts +29 -0
- package/dist/admin/admin-connectors.controller.js +79 -0
- package/dist/admin/admin-items.schemas.d.ts +42 -0
- package/dist/admin/admin-items.schemas.js +48 -0
- package/dist/admin/admin.controller.d.ts +47 -80
- package/dist/admin/admin.controller.js +111 -85
- package/dist/admin/admin.module.d.ts +6 -1
- package/dist/admin/admin.module.js +60 -4
- package/dist/admin/admin.schemas.d.ts +87 -0
- package/dist/admin/admin.schemas.js +53 -0
- package/dist/admin/audit-log.service.d.ts +51 -0
- package/dist/admin/audit-log.service.js +78 -0
- package/dist/admin/audit.controller.d.ts +26 -0
- package/dist/admin/audit.controller.js +72 -0
- package/dist/admin/audit.schemas.d.ts +16 -0
- package/dist/admin/audit.schemas.js +37 -0
- package/dist/admin/extensions.controller.d.ts +26 -2
- package/dist/admin/extensions.controller.js +44 -6
- package/dist/admin/extensions.schemas.d.ts +7 -0
- package/dist/admin/extensions.schemas.js +10 -0
- package/dist/admin/health.service.d.ts +104 -0
- package/dist/admin/health.service.js +250 -0
- package/dist/admin/limit-defaults.d.ts +20 -0
- package/dist/admin/limit-defaults.js +10 -0
- package/dist/admin/org-network.controller.d.ts +30 -0
- package/dist/admin/org-network.controller.js +77 -0
- package/dist/admin/org-network.schemas.d.ts +16 -0
- package/dist/admin/org-network.schemas.js +27 -0
- package/dist/admin/org-network.service.d.ts +41 -0
- package/dist/admin/org-network.service.js +101 -0
- package/dist/admin/outbox-dead.controller.d.ts +21 -0
- package/dist/admin/outbox-dead.controller.js +65 -0
- package/dist/admin/outbox-dead.schemas.d.ts +24 -0
- package/dist/admin/outbox-dead.schemas.js +42 -0
- package/dist/admin/outbox-dead.service.d.ts +81 -0
- package/dist/admin/outbox-dead.service.js +248 -0
- package/dist/admin/overview.controller.d.ts +31 -0
- package/dist/admin/overview.controller.js +78 -0
- package/dist/admin/overview.schemas.d.ts +8 -0
- package/dist/admin/overview.schemas.js +13 -0
- package/dist/admin/overview.service.d.ts +147 -0
- package/dist/admin/overview.service.js +256 -0
- package/dist/admin/setup-lock.d.ts +1 -1
- package/dist/admin/setup-lock.js +1 -1
- package/dist/admin/setup.controller.d.ts +1 -1
- package/dist/admin/setup.controller.js +1 -1
- package/dist/admin/setup.service.d.ts +4 -4
- package/dist/admin/setup.service.js +8 -8
- package/dist/admin/usage.service.d.ts +149 -0
- package/dist/admin/usage.service.js +321 -0
- package/dist/agents/admin-agents.d.ts +105 -0
- package/dist/agents/admin-agents.js +228 -0
- package/dist/agents/agent-lookup.d.ts +21 -0
- package/dist/agents/agent-lookup.js +28 -10
- package/dist/agents/agent-profile.service.d.ts +7 -5
- package/dist/agents/agent-profile.service.js +14 -9
- package/dist/agents/agents.controller.d.ts +26 -231
- package/dist/agents/agents.controller.js +70 -51
- package/dist/agents/agents.module.d.ts +6 -2
- package/dist/agents/agents.module.js +43 -7
- package/dist/agents/agents.schemas.d.ts +440 -0
- package/dist/agents/agents.schemas.js +126 -0
- package/dist/agents/agents.service.d.ts +117 -34
- package/dist/agents/agents.service.js +411 -146
- package/dist/agents/definition.d.ts +143 -49
- package/dist/agents/definition.js +228 -233
- package/dist/agents/from-template.d.ts +109 -0
- package/dist/agents/from-template.js +693 -0
- package/dist/agents/from-template.service.d.ts +72 -0
- package/dist/agents/from-template.service.js +178 -0
- package/dist/agents/models.controller.d.ts +38 -6
- package/dist/agents/models.controller.js +70 -9
- package/dist/agents/org-templates.d.ts +186 -0
- package/dist/agents/org-templates.js +928 -0
- package/dist/agents/pending-connector-requests.d.ts +79 -0
- package/dist/agents/pending-connector-requests.js +215 -0
- package/dist/agents/pending-connectors.controller.d.ts +39 -0
- package/dist/agents/pending-connectors.controller.js +91 -0
- package/dist/agents/pending-connectors.service.d.ts +62 -0
- package/dist/agents/pending-connectors.service.js +282 -0
- package/dist/agents/profile.d.ts +18 -0
- package/dist/agents/profile.js +5 -1
- 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.controller.d.ts +77 -5
- package/dist/agents/templates.controller.js +153 -7
- package/dist/agents/templates.d.ts +127 -23
- package/dist/agents/templates.js +465 -54
- package/dist/agents/templates.schemas.d.ts +20 -0
- package/dist/agents/templates.schemas.js +45 -0
- package/dist/app.js +2 -0
- package/dist/attribution/platform-attribution.d.ts +104 -0
- package/dist/attribution/platform-attribution.js +149 -0
- package/dist/background/background.controller.js +3 -2
- package/dist/background/background.module.js +8 -1
- package/dist/background/background.schemas.d.ts +10 -0
- package/dist/background/background.schemas.js +16 -0
- package/dist/background/finish.d.ts +8 -4
- package/dist/background/finish.js +16 -4
- package/dist/background/launch-lock.d.ts +4 -3
- package/dist/background/launch-lock.js +4 -3
- package/dist/background/launch.d.ts +57 -12
- package/dist/background/launch.js +106 -16
- package/dist/background/poll.job.d.ts +10 -7
- package/dist/background/poll.job.js +37 -24
- package/dist/background/session.d.ts +28 -5
- package/dist/background/session.js +42 -6
- package/dist/background/status.d.ts +2 -2
- package/dist/background/status.js +4 -4
- package/dist/background/stop.d.ts +12 -8
- package/dist/background/stop.js +58 -59
- package/dist/background/store.d.ts +34 -7
- package/dist/background/store.js +44 -8
- package/dist/background/tasks.service.d.ts +50 -8
- package/dist/background/tasks.service.js +131 -46
- package/dist/background/wake-rules.d.ts +32 -18
- package/dist/background/wake-rules.js +65 -23
- package/dist/background/wake.d.ts +13 -11
- package/dist/background/wake.js +20 -14
- package/dist/catalog/admin-catalog.controller.d.ts +157 -57
- package/dist/catalog/admin-catalog.controller.js +314 -70
- package/dist/catalog/admin-catalog.schemas.d.ts +87 -0
- package/dist/catalog/admin-catalog.schemas.js +107 -0
- package/dist/catalog/appearance.schemas.d.ts +10 -0
- package/dist/catalog/appearance.schemas.js +20 -0
- package/dist/catalog/appearance.service.d.ts +105 -0
- package/dist/catalog/appearance.service.js +304 -0
- package/dist/catalog/catalog-content.d.ts +145 -36
- package/dist/catalog/catalog-content.js +123 -17
- package/dist/catalog/catalog-files.d.ts +42 -0
- package/dist/catalog/catalog-files.js +89 -0
- package/dist/catalog/catalog-import.module.d.ts +7 -0
- package/dist/catalog/catalog-import.module.js +59 -0
- package/dist/catalog/catalog-items.d.ts +122 -7
- package/dist/catalog/catalog-items.js +302 -14
- package/dist/catalog/catalog-scope.service.d.ts +312 -0
- package/dist/catalog/catalog-scope.service.js +1261 -0
- package/dist/catalog/catalog.module.d.ts +8 -9
- package/dist/catalog/catalog.module.js +55 -31
- package/dist/catalog/catalog.service.d.ts +129 -31
- package/dist/catalog/catalog.service.js +193 -105
- package/dist/catalog/claude/report.d.ts +9 -2
- package/dist/catalog/claude/report.js +1 -0
- package/dist/catalog/claude/translate.js +4 -1
- package/dist/catalog/cli.d.ts +1 -1
- package/dist/catalog/cli.js +4 -1
- package/dist/catalog/component-promotion.d.ts +96 -0
- package/dist/catalog/component-promotion.js +394 -0
- package/dist/catalog/component-scope.controller.d.ts +102 -0
- package/dist/catalog/component-scope.controller.js +257 -0
- package/dist/catalog/component-scope.schemas.d.ts +118 -0
- package/dist/catalog/component-scope.schemas.js +97 -0
- package/dist/catalog/component-scope.service.d.ts +394 -0
- package/dist/catalog/component-scope.service.js +1131 -0
- package/dist/catalog/component-state.d.ts +219 -0
- package/dist/catalog/component-state.js +493 -0
- package/dist/catalog/git-source.d.ts +9 -1
- package/dist/catalog/git-source.js +29 -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 +19 -5
- package/dist/catalog/job-ids.js +21 -5
- package/dist/catalog/marketplace-fetch.d.ts +6 -3
- package/dist/catalog/marketplace-fetch.js +4 -1
- package/dist/catalog/marketplace-icons.d.ts +64 -0
- package/dist/catalog/marketplace-icons.js +131 -0
- package/dist/catalog/marketplaces.controller.d.ts +50 -41
- package/dist/catalog/marketplaces.controller.js +130 -46
- package/dist/catalog/marketplaces.schemas.d.ts +48 -0
- package/dist/catalog/marketplaces.schemas.js +53 -0
- package/dist/catalog/marketplaces.service.d.ts +110 -17
- package/dist/catalog/marketplaces.service.js +339 -30
- package/dist/catalog/org-catalog.controller.d.ts +124 -62
- package/dist/catalog/org-catalog.controller.js +208 -93
- package/dist/catalog/org-catalog.schemas.d.ts +117 -0
- package/dist/catalog/org-catalog.schemas.js +141 -0
- package/dist/catalog/org-catalog.service.d.ts +74 -33
- package/dist/catalog/org-catalog.service.js +382 -158
- package/dist/catalog/org-extension-switch.d.ts +46 -0
- package/dist/catalog/org-extension-switch.js +162 -0
- package/dist/catalog/org-extension.controller.d.ts +133 -0
- package/dist/catalog/org-extension.controller.js +313 -0
- package/dist/catalog/org-extension.schemas.d.ts +15 -0
- package/dist/catalog/org-extension.schemas.js +22 -0
- package/dist/catalog/org-plugin-uploads.controller.d.ts +77 -0
- package/dist/catalog/org-plugin-uploads.controller.js +199 -0
- package/dist/catalog/org-plugin-uploads.d.ts +68 -0
- package/dist/catalog/org-plugin-uploads.js +116 -0
- package/dist/catalog/org-plugin-uploads.schemas.d.ts +19 -0
- package/dist/catalog/org-plugin-uploads.schemas.js +30 -0
- package/dist/catalog/owned-items.d.ts +181 -0
- package/dist/catalog/owned-items.js +788 -0
- package/dist/catalog/owned-plugin-cleanup.d.ts +47 -0
- package/dist/catalog/owned-plugin-cleanup.js +140 -0
- package/dist/catalog/ownership.d.ts +172 -0
- package/dist/catalog/ownership.js +326 -0
- package/dist/catalog/platform-components.d.ts +264 -0
- package/dist/catalog/platform-components.js +857 -0
- package/dist/catalog/platform-import-update.d.ts +50 -0
- package/dist/catalog/platform-import-update.js +116 -0
- package/dist/catalog/plugin-import.d.ts +294 -55
- package/dist/catalog/plugin-import.js +841 -147
- package/dist/catalog/plugin-install.d.ts +232 -88
- package/dist/catalog/plugin-install.js +866 -232
- package/dist/catalog/plugin-package.d.ts +54 -13
- package/dist/catalog/plugin-package.js +225 -33
- package/dist/catalog/plugin-upgrade.d.ts +325 -225
- package/dist/catalog/plugin-upgrade.js +1317 -1132
- package/dist/catalog/request-rules.d.ts +65 -0
- package/dist/catalog/request-rules.js +217 -0
- package/dist/catalog/requests.service.d.ts +253 -117
- package/dist/catalog/requests.service.js +724 -323
- package/dist/catalog/reserved-names.d.ts +8 -0
- package/dist/catalog/reserved-names.js +42 -0
- package/dist/catalog/scope-jobs.d.ts +59 -0
- package/dist/catalog/scope-jobs.js +78 -0
- package/dist/catalog/scope-orgs.d.ts +21 -0
- package/dist/catalog/scope-orgs.js +66 -0
- package/dist/catalog/scope-state.d.ts +35 -0
- package/dist/catalog/scope-state.js +87 -0
- package/dist/catalog/scope-sync-workers.d.ts +30 -0
- package/dist/catalog/scope-sync-workers.js +97 -0
- package/dist/catalog/scope-sync.d.ts +148 -0
- package/dist/catalog/scope-sync.js +498 -0
- package/dist/catalog/scope.d.ts +42 -0
- package/dist/catalog/scope.js +42 -0
- package/dist/catalog/unshare.d.ts +21 -0
- package/dist/catalog/unshare.js +116 -0
- package/dist/channels/actions.d.ts +5 -0
- package/dist/channels/actions.js +33 -7
- package/dist/channels/cards.d.ts +59 -9
- package/dist/channels/cards.js +172 -19
- package/dist/channels/channels.module.d.ts +13 -9
- package/dist/channels/channels.module.js +33 -11
- package/dist/channels/channels.schemas.d.ts +41 -0
- package/dist/channels/channels.schemas.js +40 -0
- package/dist/channels/connections.controller.d.ts +46 -37
- package/dist/channels/connections.controller.js +76 -34
- package/dist/channels/connections.service.d.ts +89 -12
- package/dist/channels/connections.service.js +239 -26
- package/dist/channels/deliver-job.d.ts +32 -0
- package/dist/channels/deliver-job.js +29 -0
- package/dist/channels/inbound.d.ts +12 -27
- package/dist/channels/inbound.js +115 -23
- package/dist/channels/job-ids.d.ts +2 -6
- package/dist/channels/job-ids.js +2 -6
- package/dist/channels/jobs.d.ts +37 -20
- package/dist/channels/jobs.js +79 -27
- package/dist/channels/outbound.d.ts +40 -3
- package/dist/channels/outbound.js +187 -22
- package/dist/channels/phrases.d.ts +121 -2
- package/dist/channels/phrases.js +99 -1
- package/dist/channels/supervisor.d.ts +4 -3
- package/dist/channels/supervisor.js +6 -3
- package/dist/channels/threads.d.ts +16 -3
- package/dist/channels/threads.js +38 -3
- package/dist/channels/webhook.d.ts +21 -1
- package/dist/channels/webhook.js +39 -4
- package/dist/client/client-access.service.d.ts +102 -0
- package/dist/client/client-access.service.js +303 -0
- package/dist/client/client-builds.service.d.ts +109 -0
- package/dist/client/client-builds.service.js +229 -0
- package/dist/client/client-delivery.controller.d.ts +25 -0
- package/dist/client/client-delivery.controller.js +66 -0
- package/dist/client/client-files.d.ts +48 -0
- package/dist/client/client-files.js +136 -0
- package/dist/client/client-reports.cron.d.ts +13 -0
- package/dist/client/client-reports.cron.js +42 -0
- package/dist/client/client-reports.service.d.ts +30 -0
- package/dist/client/client-reports.service.js +102 -0
- package/dist/client/client-sign-in.service.d.ts +21 -0
- package/dist/client/client-sign-in.service.js +49 -0
- package/dist/client/client.controller.d.ts +49 -0
- package/dist/client/client.controller.js +129 -0
- package/dist/client/client.module.d.ts +8 -0
- package/dist/client/client.module.js +28 -0
- package/dist/client/client.schemas.d.ts +61 -0
- package/dist/client/client.schemas.js +27 -0
- package/dist/config/docs.js +5 -1
- package/dist/config/env.js +19 -1
- package/dist/config/load.js +8 -1
- package/dist/config/schema.d.ts +103 -50
- package/dist/config/schema.js +528 -97
- package/dist/conversations/access.d.ts +6 -4
- package/dist/conversations/access.js +27 -5
- package/dist/conversations/agent-tree.d.ts +62 -0
- package/dist/conversations/agent-tree.js +128 -0
- package/dist/conversations/attachments.service.d.ts +49 -3
- package/dist/conversations/attachments.service.js +108 -38
- package/dist/conversations/conversations.controller.d.ts +62 -82
- package/dist/conversations/conversations.controller.js +107 -105
- package/dist/conversations/conversations.module.d.ts +1 -1
- package/dist/conversations/conversations.module.js +7 -7
- package/dist/conversations/conversations.schemas.d.ts +60 -0
- package/dist/conversations/conversations.schemas.js +93 -0
- package/dist/conversations/conversations.service.d.ts +300 -30
- package/dist/conversations/conversations.service.js +496 -117
- package/dist/conversations/device-status.d.ts +24 -0
- package/dist/conversations/device-status.js +71 -0
- package/dist/conversations/event-log.d.ts +60 -17
- package/dist/conversations/event-log.js +129 -21
- package/dist/conversations/events.d.ts +546 -44
- package/dist/conversations/events.js +628 -98
- package/dist/conversations/files.d.ts +39 -12
- package/dist/conversations/files.js +134 -55
- package/dist/conversations/media-types.d.ts +25 -0
- package/dist/conversations/media-types.js +38 -0
- package/dist/conversations/message-context.d.ts +82 -0
- package/dist/conversations/message-context.js +149 -0
- package/dist/conversations/queue.d.ts +20 -4
- package/dist/conversations/queue.js +31 -3
- package/dist/conversations/queue.service.d.ts +20 -9
- package/dist/conversations/queue.service.js +95 -25
- package/dist/conversations/source.d.ts +10 -0
- package/dist/conversations/source.js +17 -0
- package/dist/conversations/titles.d.ts +26 -11
- package/dist/conversations/titles.js +67 -25
- package/dist/conversations/tree.d.ts +27 -0
- package/dist/conversations/tree.js +77 -0
- package/dist/ctx/create-ctx.d.ts +81 -9
- package/dist/ctx/create-ctx.js +223 -53
- package/dist/ctx/net.d.ts +50 -0
- package/dist/ctx/net.js +67 -0
- package/dist/ctx/secrets.d.ts +24 -7
- package/dist/ctx/secrets.js +97 -30
- package/dist/db/kernel-schema.d.ts +815 -36
- package/dist/devices/access.d.ts +66 -0
- package/dist/devices/access.js +113 -0
- package/dist/devices/conversation-devices.d.ts +161 -0
- package/dist/devices/conversation-devices.js +367 -0
- package/dist/devices/device-projects.service.d.ts +162 -0
- package/dist/devices/device-projects.service.js +503 -0
- package/dist/devices/devices.controller.d.ts +65 -0
- package/dist/devices/devices.controller.js +219 -0
- package/dist/devices/devices.module.d.ts +8 -0
- package/dist/devices/devices.module.js +47 -0
- package/dist/devices/devices.schemas.d.ts +11 -0
- package/dist/devices/devices.schemas.js +30 -0
- package/dist/devices/devices.service.d.ts +421 -0
- package/dist/devices/devices.service.js +1085 -0
- package/dist/devices/dto.d.ts +86 -0
- package/dist/devices/dto.js +96 -0
- package/dist/devices/label.d.ts +11 -0
- package/dist/devices/label.js +25 -0
- package/dist/devices/legacy-cleanup.job.d.ts +34 -0
- package/dist/devices/legacy-cleanup.job.js +141 -0
- package/dist/devices/public-suffix.d.ts +6 -0
- package/dist/devices/public-suffix.js +79 -0
- package/dist/devices/working-root.d.ts +41 -0
- package/dist/devices/working-root.js +50 -0
- package/dist/errors.d.ts +327 -10
- package/dist/errors.js +327 -10
- package/dist/evals/evals.module.js +16 -3
- package/dist/evals/evals.schemas.d.ts +110 -0
- package/dist/evals/evals.schemas.js +107 -0
- package/dist/evals/jobs.d.ts +14 -6
- package/dist/evals/jobs.js +21 -19
- package/dist/evals/plan.d.ts +20 -15
- package/dist/evals/plan.js +29 -6
- package/dist/evals/reconstruct.d.ts +44 -28
- package/dist/evals/reconstruct.js +134 -70
- package/dist/evals/recorded-tools.d.ts +9 -26
- package/dist/evals/recorded-tools.js +30 -84
- package/dist/evals/run-replay.d.ts +34 -11
- package/dist/evals/run-replay.js +99 -32
- package/dist/evals/runs.controller.d.ts +2 -57
- package/dist/evals/runs.controller.js +1 -42
- package/dist/evals/runs.service.d.ts +13 -13
- package/dist/evals/runs.service.js +55 -62
- package/dist/evals/sets.controller.d.ts +2 -28
- package/dist/evals/sets.controller.js +1 -31
- package/dist/evals/sets.service.d.ts +24 -11
- package/dist/evals/sets.service.js +64 -23
- package/dist/evals/snapshot.d.ts +9 -3
- package/dist/evals/snapshot.js +5 -4
- package/dist/evals/step-replay.d.ts +10 -6
- package/dist/evals/step-replay.js +9 -3
- package/dist/evals/trajectory.d.ts +19 -3
- package/dist/evals/trajectory.js +14 -1
- package/dist/evals/trajectory.service.d.ts +8 -3
- package/dist/evals/trajectory.service.js +26 -14
- package/dist/evals/worker.d.ts +5 -5
- package/dist/evals/worker.js +11 -4
- package/dist/extensions/admin-ops.d.ts +86 -14
- package/dist/extensions/admin-ops.js +194 -49
- package/dist/extensions/admin-view.d.ts +61 -13
- package/dist/extensions/admin-view.js +267 -47
- package/dist/extensions/approvals.d.ts +12 -2
- package/dist/extensions/blobs.d.ts +14 -1
- package/dist/extensions/blobs.js +48 -5
- package/dist/extensions/bootstrap.d.ts +86 -11
- package/dist/extensions/bootstrap.js +221 -37
- package/dist/extensions/cli.d.ts +12 -0
- package/dist/extensions/cli.js +11 -3
- package/dist/extensions/config-hash.d.ts +10 -0
- package/dist/extensions/config-hash.js +38 -0
- package/dist/extensions/deployment-config.d.ts +44 -6
- package/dist/extensions/deployment-config.js +131 -7
- package/dist/extensions/effective-config.d.ts +133 -0
- package/dist/extensions/effective-config.js +379 -0
- package/dist/extensions/extensions.module.js +31 -12
- package/dist/extensions/guide-places.d.ts +68 -0
- package/dist/extensions/guide-places.js +152 -0
- package/dist/extensions/hooks.d.ts +59 -7
- package/dist/extensions/hooks.js +97 -17
- package/dist/extensions/host.d.ts +87 -14
- package/dist/extensions/host.js +299 -81
- package/dist/extensions/installs.d.ts +31 -12
- package/dist/extensions/installs.js +61 -17
- package/dist/extensions/instance.d.ts +15 -2
- package/dist/extensions/instance.js +18 -0
- package/dist/extensions/ledger.d.ts +1 -1
- package/dist/extensions/lifecycle-hooks.d.ts +99 -0
- package/dist/extensions/lifecycle-hooks.js +273 -0
- package/dist/extensions/lifecycle.d.ts +6 -1
- package/dist/extensions/lifecycle.js +9 -2
- package/dist/extensions/locks.d.ts +12 -0
- package/dist/extensions/locks.js +26 -0
- package/dist/extensions/org-config.d.ts +104 -8
- package/dist/extensions/org-config.js +214 -35
- package/dist/extensions/org-levels.d.ts +37 -0
- package/dist/extensions/org-levels.js +71 -0
- package/dist/extensions/org-overrides.d.ts +151 -0
- package/dist/extensions/org-overrides.js +524 -0
- package/dist/extensions/package.d.ts +6 -5
- package/dist/extensions/package.js +5 -5
- package/dist/extensions/permission-set.d.ts +40 -9
- package/dist/extensions/permission-set.js +43 -9
- package/dist/extensions/permission-view.d.ts +112 -20
- package/dist/extensions/permission-view.js +50 -22
- package/dist/extensions/plugin-guides.d.ts +282 -0
- package/dist/extensions/plugin-guides.js +554 -0
- package/dist/extensions/plugin-icons.d.ts +54 -0
- package/dist/extensions/plugin-icons.js +125 -0
- package/dist/extensions/plugin-items.d.ts +41 -0
- package/dist/extensions/plugin-items.js +70 -0
- package/dist/extensions/point-defaults.controller.d.ts +2 -8
- package/dist/extensions/point-defaults.controller.js +1 -3
- package/dist/extensions/point-defaults.d.ts +43 -7
- package/dist/extensions/point-defaults.js +80 -19
- package/dist/extensions/point-defaults.schemas.d.ts +9 -0
- package/dist/extensions/point-defaults.schemas.js +14 -0
- package/dist/extensions/resolve.d.ts +51 -1
- package/dist/extensions/resolve.js +85 -3
- package/dist/extensions/single-provider.d.ts +92 -0
- package/dist/extensions/single-provider.js +180 -0
- package/dist/extensions/sources.d.ts +13 -2
- package/dist/extensions/sources.js +2 -0
- package/dist/extensions/state.module.d.ts +9 -0
- package/dist/extensions/state.module.js +46 -0
- package/dist/extensions/sync.js +5 -10
- package/dist/extensions/unavailable.d.ts +50 -0
- package/dist/extensions/unavailable.js +114 -0
- package/dist/extensions/usage-subscribers.d.ts +43 -0
- package/dist/extensions/usage-subscribers.js +108 -0
- package/dist/files/previewers.controller.js +2 -3
- package/dist/files/previewers.d.ts +10 -3
- package/dist/files/previewers.js +46 -11
- package/dist/files/previewers.schemas.d.ts +10 -0
- package/dist/files/previewers.schemas.js +9 -0
- package/dist/git/gateway.d.ts +93 -0
- package/dist/git/gateway.js +750 -0
- package/dist/git/gateway.route.d.ts +16 -0
- package/dist/git/gateway.route.js +41 -0
- package/dist/git/git.module.d.ts +10 -0
- package/dist/git/git.module.js +31 -0
- package/dist/git/identity.d.ts +80 -0
- package/dist/git/identity.js +209 -0
- package/dist/git/pkt-line.d.ts +53 -0
- package/dist/git/pkt-line.js +146 -0
- package/dist/git/run-end.d.ts +29 -0
- package/dist/git/run-end.js +121 -0
- package/dist/git/sources.d.ts +42 -0
- package/dist/git/sources.js +134 -0
- package/dist/git/tickets.d.ts +69 -0
- package/dist/git/tickets.js +194 -0
- package/dist/http/api.module.js +81 -4
- package/dist/http/app.d.ts +25 -4
- package/dist/http/app.js +46 -7
- package/dist/http/gateway-routes.d.ts +7 -3
- package/dist/http/gateway-routes.js +6 -3
- package/dist/http/plugin-dispatch.d.ts +58 -18
- package/dist/http/plugin-dispatch.js +137 -30
- package/dist/http/plugin-route-access.d.ts +56 -0
- package/dist/http/plugin-route-access.js +192 -0
- package/dist/identity/accounts.d.ts +77 -31
- package/dist/identity/accounts.js +133 -52
- package/dist/identity/audit.d.ts +2 -13
- package/dist/identity/audit.js +0 -27
- package/dist/identity/auth.controller.js +5 -9
- package/dist/identity/auth.guard.d.ts +38 -16
- package/dist/identity/auth.guard.js +96 -41
- package/dist/identity/cookies.d.ts +8 -7
- package/dist/identity/cookies.js +19 -29
- package/dist/identity/identity.module.d.ts +1 -1
- package/dist/identity/identity.module.js +7 -4
- package/dist/identity/initial-passwords.controller.d.ts +22 -0
- package/dist/identity/initial-passwords.controller.js +49 -0
- package/dist/identity/initial-passwords.d.ts +61 -0
- package/dist/identity/initial-passwords.job.d.ts +16 -0
- package/dist/identity/initial-passwords.job.js +46 -0
- package/dist/identity/initial-passwords.js +158 -0
- package/dist/identity/me.controller.d.ts +12 -0
- package/dist/identity/me.controller.js +34 -2
- package/dist/identity/me.schemas.d.ts +24 -0
- package/dist/identity/me.schemas.js +25 -0
- package/dist/identity/principal.d.ts +11 -3
- package/dist/identity/principal.js +11 -3
- package/dist/identity/sessions.d.ts +0 -6
- package/dist/identity/sessions.js +0 -18
- package/dist/identity/settings.d.ts +216 -12
- package/dist/identity/settings.js +420 -29
- package/dist/identity/{enterprise-admin.d.ts → super-admin.d.ts} +5 -5
- package/dist/identity/{enterprise-admin.js → super-admin.js} +24 -24
- package/dist/identity/write-actor.d.ts +11 -0
- package/dist/identity/write-actor.js +7 -0
- package/dist/inbox/inbox.module.d.ts +4 -1
- package/dist/inbox/inbox.module.js +9 -4
- package/dist/inbox/inbox.schemas.d.ts +8 -0
- package/dist/inbox/inbox.schemas.js +11 -0
- package/dist/inbox/inbox.service.d.ts +65 -4
- package/dist/inbox/inbox.service.js +82 -4
- package/dist/inbox/org-notices.d.ts +63 -0
- package/dist/inbox/org-notices.js +91 -0
- package/dist/inbox/platform-inbox.controller.d.ts +23 -0
- package/dist/inbox/platform-inbox.controller.js +58 -0
- package/dist/inbox/platform-inbox.service.d.ts +160 -0
- package/dist/inbox/platform-inbox.service.js +282 -0
- package/dist/inbox/platform-notices.d.ts +19 -0
- package/dist/inbox/platform-notices.js +9 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.js +12 -3
- package/dist/infra/cli/kernel-cli.module.js +14 -1
- 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.d.ts +7 -0
- package/dist/infra/config/kernel-config.service.js +47 -1
- package/dist/infra/database/transaction-host.d.ts +32 -0
- package/dist/infra/database/transaction-host.js +40 -3
- package/dist/infra/database/xact-lock.d.ts +17 -1
- package/dist/infra/database/xact-lock.js +29 -2
- package/dist/infra/events/kernel-events.d.ts +20 -25
- 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/lock/lock.service.d.ts +8 -0
- package/dist/infra/lock/lock.service.js +27 -0
- package/dist/infra/outbox/outbox-relay.module.d.ts +6 -0
- package/dist/infra/outbox/outbox-relay.module.js +18 -0
- package/dist/infra/outbox/outbox.dispatcher.d.ts +103 -0
- package/dist/infra/outbox/outbox.dispatcher.js +310 -0
- package/dist/infra/outbox/outbox.module.d.ts +24 -0
- package/dist/infra/outbox/outbox.module.js +50 -0
- package/dist/infra/outbox/outbox.relay.d.ts +31 -0
- package/dist/infra/outbox/outbox.relay.js +76 -0
- package/dist/infra/outbox/outbox.service.d.ts +60 -0
- package/dist/infra/outbox/outbox.service.js +161 -0
- package/dist/infra/outbox/registry.d.ts +321 -0
- package/dist/infra/outbox/registry.js +318 -0
- package/dist/infra/presence/presence.module.d.ts +6 -0
- package/dist/infra/presence/presence.module.js +22 -0
- package/dist/infra/presence/replica-presence.d.ts +87 -0
- package/dist/infra/presence/replica-presence.js +189 -0
- package/dist/infra/queue/queue-names.d.ts +8 -0
- package/dist/infra/queue/queue-names.js +17 -0
- package/dist/infra/throttler/named-throttlers.d.ts +15 -0
- package/dist/infra/throttler/named-throttlers.js +83 -0
- package/dist/infra/throttler/throttler.guard.d.ts +2 -1
- package/dist/infra/throttler/throttler.guard.js +3 -2
- package/dist/kernel.module.js +21 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +9 -3
- package/dist/lifecycle/kernel-lifecycle.js +47 -18
- package/dist/local-devices/device-auth.controller.d.ts +42 -0
- package/dist/local-devices/device-auth.controller.js +116 -0
- package/dist/local-devices/device-auth.d.ts +124 -0
- package/dist/local-devices/device-auth.js +410 -0
- package/dist/local-devices/device-auth.module.d.ts +7 -0
- package/dist/local-devices/device-auth.module.js +25 -0
- package/dist/local-devices/device-policy.service.d.ts +174 -0
- package/dist/local-devices/device-policy.service.js +470 -0
- package/dist/local-devices/device-routes.d.ts +36 -0
- package/dist/local-devices/device-routes.js +90 -0
- package/dist/local-devices/dto.d.ts +66 -0
- package/dist/local-devices/dto.js +44 -0
- package/dist/local-devices/keys.d.ts +25 -0
- package/dist/local-devices/keys.js +25 -0
- package/dist/local-devices/local-device-gateway.d.ts +136 -0
- package/dist/local-devices/local-device-gateway.js +570 -0
- package/dist/local-devices/local-device-provider.d.ts +152 -0
- package/dist/local-devices/local-device-provider.js +238 -0
- package/dist/local-devices/local-devices.module.d.ts +17 -0
- package/dist/local-devices/local-devices.module.js +60 -0
- package/dist/local-devices/machines.d.ts +164 -0
- package/dist/local-devices/machines.js +543 -0
- package/dist/local-devices/network-grants.d.ts +88 -0
- package/dist/local-devices/network-grants.js +267 -0
- package/dist/local-devices/policy-op-jobs.d.ts +15 -0
- package/dist/local-devices/policy-op-jobs.js +12 -0
- package/dist/local-devices/policy-summary.d.ts +98 -0
- package/dist/local-devices/policy-summary.js +152 -0
- package/dist/local-devices/relay.d.ts +102 -0
- package/dist/local-devices/relay.js +375 -0
- package/dist/local-devices/targets.d.ts +33 -0
- package/dist/local-devices/targets.js +87 -0
- package/dist/models/embeddings.d.ts +82 -0
- package/dist/models/embeddings.js +319 -0
- package/dist/models/enablement.controller.d.ts +40 -0
- package/dist/models/enablement.controller.js +74 -0
- package/dist/models/enablement.d.ts +100 -0
- package/dist/models/enablement.js +257 -0
- package/dist/models/models.module.d.ts +5 -1
- package/dist/models/models.module.js +19 -4
- package/dist/models/org-models.schemas.d.ts +8 -0
- package/dist/models/org-models.schemas.js +22 -0
- package/dist/models/prices.d.ts +8 -6
- package/dist/models/prices.js +11 -9
- package/dist/models/purposes.controller.d.ts +6 -4
- package/dist/models/purposes.controller.js +13 -7
- package/dist/models/purposes.d.ts +56 -14
- package/dist/models/purposes.js +90 -25
- package/dist/net/public-address.d.ts +35 -5
- package/dist/net/public-address.js +78 -22
- package/dist/net/safe-fetch.d.ts +6 -2
- package/dist/net/safe-fetch.js +31 -8
- package/dist/orgs/directory-sync.d.ts +14 -5
- package/dist/orgs/directory-sync.js +44 -18
- package/dist/orgs/members.service.js +6 -1
- package/dist/orgs/network-allowances.service.d.ts +79 -0
- package/dist/orgs/network-allowances.service.js +371 -0
- package/dist/orgs/offboarding.d.ts +55 -56
- package/dist/orgs/offboarding.js +147 -170
- package/dist/orgs/org-lock.d.ts +33 -2
- package/dist/orgs/org-lock.js +72 -4
- package/dist/orgs/org.guard.d.ts +10 -0
- package/dist/orgs/org.guard.js +43 -32
- package/dist/orgs/orgs.controller.d.ts +12 -6
- package/dist/orgs/orgs.controller.js +21 -8
- package/dist/orgs/orgs.module.d.ts +3 -2
- package/dist/orgs/orgs.module.js +16 -12
- package/dist/orgs/orgs.schemas.d.ts +20 -0
- package/dist/orgs/orgs.schemas.js +21 -0
- package/dist/orgs/orgs.service.d.ts +32 -9
- package/dist/orgs/orgs.service.js +81 -22
- package/dist/orgs/roles.d.ts +1 -1
- package/dist/orgs/roles.js +11 -1
- package/dist/orgs/settings.controller.d.ts +6 -3
- package/dist/orgs/settings.controller.js +9 -4
- package/dist/orgs/settings.service.d.ts +379 -45
- package/dist/orgs/settings.service.js +515 -77
- package/dist/overrides.d.ts +56 -4
- package/dist/overrides.js +32 -2
- package/dist/packages/npm.d.ts +28 -9
- package/dist/packages/npm.js +30 -19
- package/dist/packages/provenance.d.ts +3 -1
- package/dist/packages/provenance.js +7 -3
- package/dist/packages/tgz.d.ts +0 -2
- package/dist/packages/tgz.js +0 -2
- package/dist/platform/actor.d.ts +48 -0
- package/dist/platform/actor.js +100 -0
- package/dist/platform/agent-docs.d.ts +18 -0
- package/dist/platform/agent-docs.js +59 -0
- package/dist/platform/availability.d.ts +14 -0
- package/dist/platform/availability.js +43 -0
- package/dist/platform/errors.d.ts +28 -0
- package/dist/platform/errors.js +65 -0
- package/dist/platform/exclusions.d.ts +11 -0
- package/dist/platform/exclusions.js +787 -0
- package/dist/platform/method.d.ts +6 -0
- package/dist/platform/method.js +15 -0
- package/dist/platform/operation.d.ts +169 -0
- package/dist/platform/operation.js +106 -0
- package/dist/platform/ops/accounts.ops.d.ts +32 -0
- package/dist/platform/ops/accounts.ops.js +291 -0
- package/dist/platform/ops/admin-items.ops.d.ts +37 -0
- package/dist/platform/ops/admin-items.ops.js +278 -0
- package/dist/platform/ops/admin.ops.d.ts +38 -0
- package/dist/platform/ops/admin.ops.js +549 -0
- package/dist/platform/ops/agent-skills.ops.d.ts +50 -0
- package/dist/platform/ops/agent-skills.ops.js +510 -0
- package/dist/platform/ops/agent-templates.ops.d.ts +17 -0
- package/dist/platform/ops/agent-templates.ops.js +272 -0
- package/dist/platform/ops/agents.ops.d.ts +37 -0
- package/dist/platform/ops/agents.ops.js +723 -0
- package/dist/platform/ops/approvals.ops.d.ts +30 -0
- package/dist/platform/ops/approvals.ops.js +116 -0
- package/dist/platform/ops/background.ops.d.ts +14 -0
- package/dist/platform/ops/background.ops.js +134 -0
- package/dist/platform/ops/catalog-admin.ops.d.ts +94 -0
- package/dist/platform/ops/catalog-admin.ops.js +710 -0
- package/dist/platform/ops/channels.ops.d.ts +16 -0
- package/dist/platform/ops/channels.ops.js +195 -0
- package/dist/platform/ops/components.ops.d.ts +46 -0
- package/dist/platform/ops/components.ops.js +854 -0
- package/dist/platform/ops/connectors.ops.d.ts +17 -0
- package/dist/platform/ops/connectors.ops.js +235 -0
- package/dist/platform/ops/conversations.ops.d.ts +30 -0
- package/dist/platform/ops/conversations.ops.js +505 -0
- package/dist/platform/ops/devices.ops.d.ts +28 -0
- package/dist/platform/ops/devices.ops.js +446 -0
- package/dist/platform/ops/errors.d.ts +16 -0
- package/dist/platform/ops/errors.js +30 -0
- package/dist/platform/ops/evals.ops.d.ts +28 -0
- package/dist/platform/ops/evals.ops.js +731 -0
- package/dist/platform/ops/extensions-admin.ops.d.ts +25 -0
- package/dist/platform/ops/extensions-admin.ops.js +372 -0
- package/dist/platform/ops/extensions.ops.d.ts +25 -0
- package/dist/platform/ops/extensions.ops.js +347 -0
- package/dist/platform/ops/inbox.ops.d.ts +25 -0
- package/dist/platform/ops/inbox.ops.js +397 -0
- package/dist/platform/ops/marketplaces.ops.d.ts +22 -0
- package/dist/platform/ops/marketplaces.ops.js +466 -0
- package/dist/platform/ops/models.ops.d.ts +25 -0
- package/dist/platform/ops/models.ops.js +232 -0
- package/dist/platform/ops/org-plugins.ops.d.ts +35 -0
- package/dist/platform/ops/org-plugins.ops.js +388 -0
- package/dist/platform/ops/org-settings.ops.d.ts +18 -0
- package/dist/platform/ops/org-settings.ops.js +144 -0
- package/dist/platform/ops/orgs.ops.d.ts +36 -0
- package/dist/platform/ops/orgs.ops.js +435 -0
- package/dist/platform/ops/other-orgs.d.ts +20 -0
- package/dist/platform/ops/other-orgs.js +72 -0
- package/dist/platform/ops/outbox.ops.d.ts +21 -0
- package/dist/platform/ops/outbox.ops.js +125 -0
- package/dist/platform/ops/paging.d.ts +14 -0
- package/dist/platform/ops/paging.js +20 -0
- package/dist/platform/ops/platform.ops.d.ts +41 -0
- package/dist/platform/ops/platform.ops.js +261 -0
- package/dist/platform/ops/plugins.ops.d.ts +35 -0
- package/dist/platform/ops/plugins.ops.js +476 -0
- package/dist/platform/ops/previewers.ops.d.ts +14 -0
- package/dist/platform/ops/previewers.ops.js +109 -0
- package/dist/platform/ops/requests.ops.d.ts +14 -0
- package/dist/platform/ops/requests.ops.js +192 -0
- package/dist/platform/ops/role.d.ts +4 -0
- package/dist/platform/ops/role.js +10 -0
- package/dist/platform/ops/schedules.ops.d.ts +21 -0
- package/dist/platform/ops/schedules.ops.js +509 -0
- package/dist/platform/ops/setup.ops.d.ts +24 -0
- package/dist/platform/ops/setup.ops.js +212 -0
- package/dist/platform/ops/skills.ops.d.ts +17 -0
- package/dist/platform/ops/skills.ops.js +160 -0
- package/dist/platform/ops/summary.d.ts +10 -0
- package/dist/platform/ops/summary.js +18 -0
- package/dist/platform/ops/themes.ops.d.ts +14 -0
- package/dist/platform/ops/themes.ops.js +47 -0
- package/dist/platform/ops/ui.ops.d.ts +8 -0
- package/dist/platform/ops/ui.ops.js +41 -0
- package/dist/platform/ops/unavailable.d.ts +23 -0
- package/dist/platform/ops/unavailable.js +118 -0
- package/dist/platform/parity.d.ts +33 -0
- package/dist/platform/parity.js +272 -0
- package/dist/platform/platform-ops.module.d.ts +45 -0
- package/dist/platform/platform-ops.module.js +150 -0
- package/dist/platform/platform.module.d.ts +8 -0
- package/dist/platform/platform.module.js +25 -0
- package/dist/platform/registry.d.ts +30 -0
- package/dist/platform/registry.js +111 -0
- package/dist/platform/route-schemas.d.ts +18 -0
- package/dist/platform/route-schemas.js +94 -0
- package/dist/roles/gateway-role.d.ts +18 -3
- package/dist/roles/gateway-role.js +33 -5
- package/dist/roles/gateway.module.d.ts +2 -1
- package/dist/roles/gateway.module.js +6 -3
- package/dist/roles/worker-role.d.ts +13 -7
- package/dist/roles/worker-role.js +27 -20
- package/dist/roles/worker.module.d.ts +1 -1
- package/dist/roles/worker.module.js +27 -7
- package/dist/runtime/checkpointer.d.ts +3 -0
- package/dist/runtime/checkpointer.js +9 -3
- package/dist/runtime/compaction-progress.d.ts +62 -0
- package/dist/runtime/compaction-progress.js +82 -0
- package/dist/runtime/compaction-settings.service.d.ts +16 -0
- package/dist/runtime/compaction-settings.service.js +42 -0
- package/dist/runtime/compaction.service.d.ts +50 -0
- package/dist/runtime/compaction.service.js +75 -0
- package/dist/runtime/context/build.d.ts +80 -21
- package/dist/runtime/context/build.js +291 -64
- package/dist/runtime/context/claude-tools.d.ts +2 -1
- package/dist/runtime/context/claude-tools.js +5 -4
- package/dist/runtime/context/compaction.d.ts +111 -16
- package/dist/runtime/context/compaction.js +423 -55
- package/dist/runtime/context/device-paths.d.ts +82 -0
- package/dist/runtime/context/device-paths.js +165 -0
- package/dist/runtime/context/fit.d.ts +111 -0
- package/dist/runtime/context/fit.js +278 -0
- package/dist/runtime/context/plugin-context.d.ts +20 -0
- package/dist/runtime/context/plugin-context.js +30 -0
- package/dist/runtime/context/project-root.d.ts +43 -0
- package/dist/runtime/context/project-root.js +85 -0
- package/dist/runtime/context/reminders.d.ts +2 -0
- package/dist/runtime/context/reminders.js +2 -0
- package/dist/runtime/context/run-context.d.ts +88 -0
- package/dist/runtime/context/run-context.js +295 -0
- package/dist/runtime/context/skills.d.ts +38 -54
- package/dist/runtime/context/skills.js +85 -119
- package/dist/runtime/context/tool-changes.d.ts +27 -0
- package/dist/runtime/context/tool-changes.js +50 -0
- package/dist/runtime/conversation-lock.d.ts +4 -11
- package/dist/runtime/conversation-lock.js +14 -18
- package/dist/runtime/hook-calls.d.ts +14 -7
- package/dist/runtime/hook-calls.js +47 -14
- package/dist/runtime/langgraph-loop.d.ts +3 -1
- package/dist/runtime/langgraph-loop.js +60 -24
- package/dist/runtime/limits.d.ts +15 -0
- package/dist/runtime/limits.js +25 -0
- package/dist/runtime/loop.d.ts +48 -7
- package/dist/runtime/loop.js +2 -1
- package/dist/runtime/maintenance.d.ts +21 -15
- package/dist/runtime/maintenance.js +99 -27
- package/dist/runtime/model-call.d.ts +186 -30
- package/dist/runtime/model-call.js +1014 -378
- package/dist/runtime/plugin-context.service.d.ts +75 -0
- package/dist/runtime/plugin-context.service.js +220 -0
- package/dist/runtime/project/knowledge.d.ts +129 -0
- package/dist/runtime/project/knowledge.js +248 -0
- package/dist/runtime/project/knowledge.service.d.ts +85 -0
- package/dist/runtime/project/knowledge.service.js +288 -0
- package/dist/runtime/providers.d.ts +156 -44
- package/dist/runtime/providers.js +346 -130
- package/dist/runtime/queue-lost-jobs.d.ts +24 -0
- package/dist/runtime/queue-lost-jobs.js +51 -0
- package/dist/runtime/run-context.service.d.ts +82 -0
- package/dist/runtime/run-context.service.js +255 -0
- package/dist/runtime/run-control.d.ts +62 -5
- package/dist/runtime/run-control.js +98 -12
- package/dist/runtime/run-deletion.d.ts +29 -0
- package/dist/runtime/run-deletion.js +153 -0
- package/dist/runtime/run-drafts.d.ts +85 -0
- package/dist/runtime/run-drafts.js +230 -0
- package/dist/runtime/run-execution.d.ts +76 -0
- package/dist/runtime/run-execution.js +175 -0
- package/dist/runtime/run-finish.d.ts +49 -12
- package/dist/runtime/run-finish.js +140 -15
- package/dist/runtime/run-jobs.d.ts +112 -15
- package/dist/runtime/run-jobs.js +235 -32
- package/dist/runtime/run-liveness.d.ts +11 -0
- package/dist/runtime/run-liveness.js +19 -0
- package/dist/runtime/run-orphan-check.job.d.ts +145 -0
- package/dist/runtime/run-orphan-check.job.js +413 -0
- package/dist/runtime/run-processors.d.ts +16 -9
- package/dist/runtime/run-processors.js +1 -1
- package/dist/runtime/run-queue.d.ts +123 -61
- package/dist/runtime/run-queue.js +454 -253
- package/dist/runtime/run-status.d.ts +12 -0
- package/dist/runtime/run-status.js +21 -0
- package/dist/runtime/run-steps.d.ts +3 -2
- package/dist/runtime/run-steps.js +15 -11
- package/dist/runtime/run-worker.d.ts +78 -28
- package/dist/runtime/run-worker.js +499 -154
- package/dist/runtime/runtime.module.d.ts +2 -3
- package/dist/runtime/runtime.module.js +41 -6
- package/dist/runtime/step-log.d.ts +30 -7
- package/dist/runtime/step-log.js +42 -13
- package/dist/runtime/stream.controller.d.ts +24 -4
- package/dist/runtime/stream.controller.js +60 -9
- package/dist/runtime/stream.d.ts +4 -1
- package/dist/runtime/stream.js +50 -5
- package/dist/runtime/subagents/child.d.ts +55 -7
- package/dist/runtime/subagents/child.js +106 -8
- package/dist/runtime/subagents/definition.d.ts +53 -28
- package/dist/runtime/subagents/definition.js +161 -211
- package/dist/runtime/subagents/deliveries.d.ts +74 -0
- package/dist/runtime/subagents/deliveries.js +237 -0
- package/dist/runtime/subagents/dispatch.d.ts +125 -32
- package/dist/runtime/subagents/dispatch.js +233 -171
- package/dist/runtime/subagents/limits.d.ts +24 -5
- package/dist/runtime/subagents/limits.js +40 -6
- package/dist/runtime/subagents/messages.d.ts +99 -0
- package/dist/runtime/subagents/messages.js +336 -0
- package/dist/runtime/subagents/org-agents.js +1 -2
- package/dist/runtime/subagents/preamble.d.ts +6 -4
- package/dist/runtime/subagents/preamble.js +11 -7
- package/dist/runtime/subagents/progress.d.ts +8 -6
- package/dist/runtime/subagents/progress.js +11 -6
- package/dist/runtime/subagents/render.d.ts +29 -0
- package/dist/runtime/subagents/render.js +52 -0
- package/dist/runtime/subagents/roster.d.ts +24 -7
- package/dist/runtime/subagents/roster.js +47 -11
- package/dist/runtime/subagents/skill-fork.d.ts +8 -9
- package/dist/runtime/subagents/skill-fork.js +16 -9
- package/dist/runtime/subagents/status.d.ts +14 -0
- package/dist/runtime/subagents/status.js +23 -0
- package/dist/runtime/subagents/subagents.service.d.ts +7 -4
- package/dist/runtime/subagents/subagents.service.js +12 -7
- package/dist/runtime/subagents/template-skills.d.ts +47 -0
- package/dist/runtime/subagents/template-skills.js +76 -0
- package/dist/runtime/subagents/tree-jobs.d.ts +62 -0
- package/dist/runtime/subagents/tree-jobs.js +86 -0
- package/dist/runtime/usage-report-jobs.d.ts +63 -0
- package/dist/runtime/usage-report-jobs.js +106 -0
- package/dist/runtime/usage-report.d.ts +47 -98
- package/dist/runtime/usage-report.js +141 -243
- package/dist/runtime/waits.d.ts +130 -167
- package/dist/runtime/waits.js +328 -706
- package/dist/sandbox/jobs.d.ts +50 -13
- package/dist/sandbox/jobs.js +64 -21
- package/dist/sandbox/leases.d.ts +37 -54
- package/dist/sandbox/leases.js +71 -115
- package/dist/sandbox/modes.d.ts +120 -0
- package/dist/sandbox/modes.js +145 -0
- package/dist/sandbox/platform-auto-mode.d.ts +63 -0
- package/dist/sandbox/platform-auto-mode.js +63 -0
- package/dist/sandbox/providers.d.ts +34 -7
- package/dist/sandbox/providers.js +54 -9
- package/dist/sandbox/review/classifier.d.ts +135 -0
- package/dist/sandbox/review/classifier.js +419 -0
- package/dist/sandbox/review/index.d.ts +13 -0
- package/dist/sandbox/review/index.js +10 -0
- package/dist/sandbox/review/review.service.d.ts +145 -0
- package/dist/sandbox/review/review.service.js +372 -0
- package/dist/sandbox/review/rules.d.ts +87 -0
- package/dist/sandbox/review/rules.js +5319 -0
- package/dist/sandbox/review/types.d.ts +116 -0
- package/dist/sandbox/review/types.js +48 -0
- package/dist/sandbox/sandbox-file-reader.d.ts +35 -0
- package/dist/sandbox/sandbox-file-reader.js +98 -0
- package/dist/sandbox/sandbox.module.d.ts +3 -2
- package/dist/sandbox/sandbox.module.js +15 -4
- package/dist/sandbox/sandbox.service.d.ts +436 -145
- package/dist/sandbox/sandbox.service.js +1232 -435
- package/dist/sandbox/unreachable.d.ts +30 -0
- package/dist/sandbox/unreachable.js +108 -0
- package/dist/schedules/calendar.d.ts +134 -0
- package/dist/schedules/calendar.js +410 -0
- package/dist/schedules/effective-settings.d.ts +22 -0
- package/dist/schedules/effective-settings.js +18 -0
- package/dist/schedules/errors.d.ts +8 -0
- package/dist/schedules/errors.js +8 -0
- package/dist/schedules/fire.d.ts +137 -0
- package/dist/schedules/fire.js +708 -0
- package/dist/schedules/grant-rules.d.ts +120 -0
- package/dist/schedules/grant-rules.js +186 -0
- package/dist/schedules/job-ids.d.ts +81 -0
- package/dist/schedules/job-ids.js +95 -0
- package/dist/schedules/pause.d.ts +9 -0
- package/dist/schedules/pause.js +33 -0
- package/dist/schedules/run-tracker.d.ts +76 -0
- package/dist/schedules/run-tracker.js +321 -0
- package/dist/schedules/scan.job.d.ts +45 -0
- package/dist/schedules/scan.job.js +189 -0
- package/dist/schedules/schedule-math.d.ts +73 -0
- package/dist/schedules/schedule-math.js +294 -0
- package/dist/schedules/scheduled-tasks.service.d.ts +362 -0
- package/dist/schedules/scheduled-tasks.service.js +1253 -0
- package/dist/schedules/schedules.controller.d.ts +72 -0
- package/dist/schedules/schedules.controller.js +256 -0
- package/dist/schedules/schedules.module.d.ts +16 -0
- package/dist/schedules/schedules.module.js +61 -0
- package/dist/schedules/schedules.schemas.d.ts +351 -0
- package/dist/schedules/schedules.schemas.js +213 -0
- package/dist/schedules/store.d.ts +86 -0
- package/dist/schedules/store.js +410 -0
- package/dist/schedules/store.module.d.ts +6 -0
- package/dist/schedules/store.module.js +21 -0
- package/dist/schedules/types.d.ts +110 -0
- package/dist/schedules/types.js +1 -0
- package/dist/schedules/unattended.d.ts +89 -0
- package/dist/schedules/unattended.js +189 -0
- package/dist/setup/kernel-checks.d.ts +91 -0
- package/dist/setup/kernel-checks.js +296 -0
- package/dist/setup/oauth-token-probe.d.ts +40 -0
- package/dist/setup/oauth-token-probe.js +96 -0
- package/dist/setup/redact-check.d.ts +18 -0
- package/dist/setup/redact-check.js +46 -0
- package/dist/setup/setup-check-registry.d.ts +86 -0
- package/dist/setup/setup-check-registry.js +75 -0
- package/dist/setup/setup-checks.controller.d.ts +28 -0
- package/dist/setup/setup-checks.controller.js +78 -0
- package/dist/setup/setup-checks.schemas.d.ts +38 -0
- package/dist/setup/setup-checks.schemas.js +43 -0
- package/dist/setup/setup-checks.service.d.ts +144 -0
- package/dist/setup/setup-checks.service.js +683 -0
- package/dist/setup/setup-guides.controller.d.ts +18 -0
- package/dist/setup/setup-guides.controller.js +48 -0
- package/dist/setup/setup-guides.schemas.d.ts +10 -0
- package/dist/setup/setup-guides.schemas.js +6 -0
- package/dist/setup/setup-guides.service.d.ts +126 -0
- package/dist/setup/setup-guides.service.js +315 -0
- package/dist/setup/setup.module.d.ts +8 -0
- package/dist/setup/setup.module.js +31 -0
- package/dist/skills/agent-skills.controller.d.ts +48 -0
- package/dist/skills/agent-skills.controller.js +131 -0
- package/dist/skills/agent-skills.service.d.ts +258 -0
- package/dist/skills/agent-skills.service.js +960 -0
- package/dist/skills/catalog.d.ts +84 -71
- package/dist/skills/catalog.js +152 -245
- package/dist/skills/changes.controller.d.ts +12 -22
- package/dist/skills/changes.controller.js +27 -56
- package/dist/skills/changes.service.d.ts +69 -115
- package/dist/skills/changes.service.js +249 -599
- package/dist/skills/conversation-catalog.d.ts +52 -0
- package/dist/skills/conversation-catalog.js +141 -0
- package/dist/skills/invocable.controller.d.ts +1 -1
- package/dist/skills/invocable.controller.js +2 -2
- package/dist/skills/invocation-keys.d.ts +1 -1
- package/dist/skills/invocation-keys.js +1 -1
- package/dist/skills/invoke.d.ts +68 -6
- package/dist/skills/invoke.js +229 -9
- package/dist/skills/package.d.ts +15 -1
- package/dist/skills/package.js +14 -1
- package/dist/skills/skills.controller.d.ts +35 -7
- package/dist/skills/skills.controller.js +64 -11
- package/dist/skills/skills.module.js +30 -3
- package/dist/skills/skills.schemas.d.ts +44 -0
- package/dist/skills/skills.schemas.js +68 -0
- package/dist/skills/skills.service.d.ts +158 -60
- package/dist/skills/skills.service.js +640 -162
- package/dist/skills/usable.d.ts +131 -0
- package/dist/skills/usable.js +521 -0
- package/dist/storage/storage.service.js +9 -1
- package/dist/themes/render-css.d.ts +13 -0
- package/dist/themes/render-css.js +135 -0
- package/dist/themes/theme-delivery.service.d.ts +36 -0
- package/dist/themes/theme-delivery.service.js +116 -0
- package/dist/themes/theme-state.d.ts +116 -0
- package/dist/themes/theme-state.js +221 -0
- package/dist/themes/theme-usage.d.ts +61 -0
- package/dist/themes/theme-usage.js +98 -0
- package/dist/themes/themes-public.controller.d.ts +33 -0
- package/dist/themes/themes-public.controller.js +98 -0
- package/dist/themes/themes.controller.d.ts +13 -0
- package/dist/themes/themes.controller.js +38 -0
- package/dist/themes/themes.module.d.ts +3 -0
- package/dist/themes/themes.module.js +21 -0
- package/dist/themes/themes.schemas.d.ts +3 -0
- package/dist/themes/themes.schemas.js +2 -0
- package/dist/themes/themes.service.d.ts +50 -0
- package/dist/themes/themes.service.js +99 -0
- package/dist/time-zone.d.ts +5 -0
- package/dist/time-zone.js +19 -0
- package/dist/tools/admin-connectors.d.ts +69 -0
- package/dist/tools/admin-connectors.js +135 -0
- package/dist/tools/approvals.controller.d.ts +4 -2
- package/dist/tools/approvals.controller.js +19 -5
- package/dist/tools/approvals.schemas.d.ts +22 -0
- package/dist/tools/approvals.schemas.js +17 -0
- package/dist/tools/approvals.service.d.ts +485 -19
- package/dist/tools/approvals.service.js +1468 -34
- package/dist/tools/builtin-names.d.ts +55 -24
- package/dist/tools/builtin-names.js +97 -31
- package/dist/tools/builtins/agent.d.ts +23 -21
- package/dist/tools/builtins/agent.js +62 -55
- package/dist/tools/builtins/ask-user.js +3 -2
- package/dist/tools/builtins/builtin-tools.d.ts +17 -5
- package/dist/tools/builtins/builtin-tools.js +79 -20
- package/dist/tools/builtins/current-time.d.ts +26 -0
- package/dist/tools/builtins/current-time.js +99 -0
- package/dist/tools/builtins/handback.d.ts +28 -0
- package/dist/tools/builtins/handback.js +53 -0
- package/dist/tools/builtins/platform.d.ts +51 -0
- package/dist/tools/builtins/platform.js +451 -0
- package/dist/tools/builtins/sandbox/bash.d.ts +2 -2
- package/dist/tools/builtins/sandbox/bash.js +94 -34
- package/dist/tools/builtins/sandbox/common.d.ts +168 -42
- package/dist/tools/builtins/sandbox/common.js +298 -138
- package/dist/tools/builtins/sandbox/deliver.js +9 -6
- package/dist/tools/builtins/sandbox/device-code.d.ts +40 -0
- package/dist/tools/builtins/sandbox/device-code.js +57 -0
- package/dist/tools/builtins/sandbox/edit.js +48 -39
- 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/file-state.d.ts +31 -1
- package/dist/tools/builtins/sandbox/file-state.js +33 -3
- package/dist/tools/builtins/sandbox/glob.js +15 -9
- package/dist/tools/builtins/sandbox/grep.js +13 -11
- package/dist/tools/builtins/sandbox/index.d.ts +11 -5
- package/dist/tools/builtins/sandbox/index.js +15 -5
- package/dist/tools/builtins/sandbox/read.js +13 -7
- package/dist/tools/builtins/sandbox/task-list.d.ts +12 -0
- package/dist/tools/builtins/sandbox/task-list.js +130 -0
- package/dist/tools/builtins/sandbox/task-output.d.ts +54 -7
- package/dist/tools/builtins/sandbox/task-output.js +122 -25
- package/dist/tools/builtins/sandbox/task-stop.js +6 -5
- package/dist/tools/builtins/sandbox/write.js +41 -33
- package/dist/tools/builtins/schedules.d.ts +109 -0
- package/dist/tools/builtins/schedules.js +947 -0
- package/dist/tools/builtins/send-message.d.ts +56 -0
- package/dist/tools/builtins/send-message.js +100 -0
- package/dist/tools/builtins/skill-load.d.ts +74 -18
- package/dist/tools/builtins/skill-load.js +255 -61
- package/dist/tools/builtins/tool-search.d.ts +4 -7
- package/dist/tools/builtins/tool-search.js +10 -13
- package/dist/tools/builtins/web/extract.d.ts +2 -4
- package/dist/tools/builtins/web/extract.js +6 -5
- package/dist/tools/builtins/web/fetch.js +1 -0
- package/dist/tools/builtins/web/search.js +1 -0
- package/dist/tools/connector-account-policies.d.ts +86 -0
- package/dist/tools/connector-account-policies.js +220 -0
- package/dist/tools/connector-content.js +1 -0
- package/dist/tools/connectors.controller.d.ts +89 -9
- package/dist/tools/connectors.controller.js +167 -17
- package/dist/tools/connectors.schemas.d.ts +40 -0
- package/dist/tools/connectors.schemas.js +46 -0
- package/dist/tools/connectors.service.d.ts +169 -11
- package/dist/tools/connectors.service.js +421 -35
- package/dist/tools/credentials.d.ts +41 -0
- package/dist/tools/credentials.js +150 -1
- package/dist/tools/credentials.module.d.ts +7 -0
- package/dist/tools/credentials.module.js +22 -0
- package/dist/tools/device-op-resolver.d.ts +40 -0
- package/dist/tools/device-op-resolver.js +121 -0
- package/dist/tools/drift.d.ts +6 -2
- package/dist/tools/drift.js +10 -5
- package/dist/tools/elicitation.d.ts +2 -0
- package/dist/tools/elicitation.js +1 -1
- package/dist/tools/extension-tools.controller.d.ts +14 -0
- package/dist/tools/extension-tools.controller.js +37 -0
- package/dist/tools/fixed-ask.d.ts +7 -0
- package/dist/tools/fixed-ask.js +9 -0
- package/dist/tools/git-asks.d.ts +113 -0
- package/dist/tools/git-asks.js +174 -0
- package/dist/tools/git-push-policy.d.ts +92 -0
- package/dist/tools/git-push-policy.js +177 -0
- package/dist/tools/info.d.ts +46 -11
- package/dist/tools/info.js +72 -22
- package/dist/tools/job-ids.d.ts +0 -4
- package/dist/tools/job-ids.js +1 -6
- package/dist/tools/network-asks.d.ts +122 -0
- package/dist/tools/network-asks.js +233 -0
- package/dist/tools/oauth/discovery.d.ts +38 -16
- package/dist/tools/oauth/discovery.js +59 -33
- package/dist/tools/oauth/flow.js +1 -1
- package/dist/tools/oauth/tokens.d.ts +54 -7
- package/dist/tools/oauth/tokens.js +87 -17
- package/dist/tools/org-tool-switches.d.ts +89 -0
- package/dist/tools/org-tool-switches.js +201 -0
- package/dist/tools/pipeline.d.ts +175 -59
- package/dist/tools/pipeline.js +846 -442
- package/dist/tools/policy.d.ts +51 -14
- package/dist/tools/policy.js +200 -60
- package/dist/tools/questions.service.d.ts +50 -9
- package/dist/tools/questions.service.js +128 -12
- package/dist/tools/registry.d.ts +196 -56
- package/dist/tools/registry.js +300 -219
- package/dist/tools/tools.module.js +42 -8
- package/dist/ui/admin-ui.controller.d.ts +56 -0
- package/dist/ui/admin-ui.controller.js +192 -0
- package/dist/ui/arrangement.d.ts +65 -0
- package/dist/ui/arrangement.js +171 -0
- package/dist/ui/embed-token.d.ts +2 -2
- package/dist/ui/embed-token.js +30 -5
- package/dist/ui/registry.d.ts +42 -17
- package/dist/ui/registry.js +46 -14
- package/dist/ui/slots.controller.d.ts +11 -0
- package/dist/ui/slots.controller.js +25 -0
- package/dist/ui/ui-stream.d.ts +20 -3
- package/dist/ui/ui-stream.js +25 -7
- package/dist/ui/ui.schemas.d.ts +70 -0
- package/dist/ui/ui.schemas.js +65 -0
- package/dist/ui/views.controller.d.ts +35 -49
- package/dist/ui/views.controller.js +48 -70
- package/dist/ui/views.d.ts +113 -19
- package/dist/ui/views.js +257 -56
- package/package.json +6 -3
- package/src/migrations/0074_subagent_tree.sql +50 -0
- package/src/migrations/0075_plugin_scope.sql +61 -0
- package/src/migrations/0076_skills_created_by_nullable.sql +6 -0
- package/src/migrations/0077_scope_requests.sql +52 -0
- package/src/migrations/0078_scope_grant_switches.sql +18 -0
- package/src/migrations/0079_scope_live_install_switches.sql +19 -0
- package/src/migrations/0080_rename_enterprise_admin.sql +18 -0
- package/src/migrations/0081_platform_components.sql +129 -0
- package/src/migrations/0082_platform_migration.sql +33 -0
- package/src/migrations/0083_plugin_scope_sync_failures.sql +15 -0
- package/src/migrations/0084_org_owned_items.sql +85 -0
- package/src/migrations/0085_agent_templates_phase4.sql +45 -0
- package/src/migrations/0086_org_layering.sql +30 -0
- package/src/migrations/0087_approval_summary.sql +6 -0
- package/src/migrations/0088_environments.sql +80 -0
- package/src/migrations/0089_model_kinds_usage.sql +38 -0
- package/src/migrations/0090_initial_passwords.sql +27 -0
- package/src/migrations/0091_account_time_zone.sql +4 -0
- package/src/migrations/0092_tools_default_on.sql +27 -0
- package/src/migrations/0093_connected_environments.sql +37 -0
- package/src/migrations/0094_environment_paths_idx.sql +7 -0
- package/src/migrations/0095_environment_files_resets.sql +5 -0
- package/src/migrations/0096_environment_demoted_default.sql +18 -0
- package/src/migrations/0097_extension_installs_enabled_at.sql +16 -0
- package/src/migrations/0098_single_provider_running_first.sql +41 -0
- package/src/migrations/0099_channel_connection_guide_ack.sql +6 -0
- package/src/migrations/0100_catalog_files.sql +13 -0
- package/src/migrations/0101_marketplace_icons.sql +32 -0
- package/src/migrations/0102_themes.sql +64 -0
- package/src/migrations/0103_ui_theme_setting.sql +7 -0
- package/src/migrations/0104_connector_tool_account_policies.sql +16 -0
- package/src/migrations/0105_devices_rename.sql +136 -0
- package/src/migrations/0106_setup_guides_v2.sql +10 -0
- package/src/migrations/0107_extension_client_builds.sql +50 -0
- package/src/migrations/0108_question_skipped.sql +6 -0
- package/src/migrations/0109_audit_platform_idx.sql +5 -0
- package/src/migrations/0110_usage_time_idx.sql +8 -0
- package/src/migrations/0111_agent_skill_sharing.sql +22 -0
- package/src/migrations/0112_skill_share_requests.sql +4 -0
- package/src/migrations/0113_scheduled_tasks.sql +108 -0
- package/src/migrations/0114_network_asks.sql +23 -0
- package/src/migrations/0115_network_requests.sql +28 -0
- package/src/migrations/0116_skills_default_on.sql +37 -0
- package/src/migrations/0117_sandbox_tiers.sql +11 -0
- package/src/migrations/0118_device_policy_ops.sql +6 -0
- package/src/migrations/0119_outbox.sql +22 -0
- package/src/migrations/0120_drop_usage_report_sweep.sql +7 -0
- package/src/migrations/0121_drop_platform_migration_runs.sql +12 -0
- package/src/migrations/0122_drop_scheduled_task_runs_rechecked_at.sql +5 -0
- package/src/migrations/0123_pgvector.sql +27 -0
- package/src/migrations/0124_conversation_source.sql +36 -0
- package/src/migrations/0125_conversation_tree_stopped_at.sql +5 -0
- package/src/migrations/0126_git_gateway.sql +10 -0
- package/src/migrations/0127_git_push_policy.sql +12 -0
- package/src/migrations/0128_scheduled_task_plugin_disabled.sql +10 -0
- package/src/migrations/0129_connector_plugin_disabled.sql +5 -0
- package/src/migrations/0130_auto_mode.sql +48 -0
- package/src/migrations/0131_device_mode.sql +9 -0
- package/src/migrations/0132_compact_runs.sql +6 -0
- package/src/migrations/0133_project_root.sql +30 -0
- package/src/migrations/0134_org_cloud_network_delta.sql +38 -0
- package/src/migrations/0135_run_execution_claim.sql +2 -0
- package/src/migrations/0136_run_recovery_cursor.sql +6 -0
- 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/src/migrations/0145_org_network_allowances.sql +12 -0
- package/dist/catalog/upgrade-targets.d.ts +0 -56
- package/dist/catalog/upgrade-targets.js +0 -90
- package/dist/conversations/job-ids.d.ts +0 -6
- package/dist/conversations/job-ids.js +0 -6
- package/dist/conversations/sandbox-status.d.ts +0 -24
- package/dist/conversations/sandbox-status.js +0 -52
- package/dist/extensions/job-ids.d.ts +0 -6
- package/dist/extensions/job-ids.js +0 -6
- package/dist/extensions/org-config.controller.d.ts +0 -32
- package/dist/extensions/org-config.controller.js +0 -70
- 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/builtins/skill-write.d.ts +0 -59
- package/dist/tools/builtins/skill-write.js +0 -244
- 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 -115
|
@@ -8,14 +8,17 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
10
|
import { createHash, randomUUID } from "node:crypto";
|
|
11
|
-
import { PLUGIN_MANIFEST_FILE, parseSkillMd, SDK_VERSION, SKILL_ENTRY_FILE, } from "@capybara-hq/plugin-sdk";
|
|
11
|
+
import { appearanceIssues, PLUGIN_MANIFEST_FILE, parseSkillMd, pluginDescription, SDK_VERSION, SKILL_ENTRY_FILE, } from "@capybara-hq/plugin-sdk";
|
|
12
12
|
import { Inject, Injectable } from "@nestjs/common";
|
|
13
13
|
import { sql } from "kysely";
|
|
14
14
|
import semver from "semver";
|
|
15
|
+
import { ClientBuilds } from "../client/client-builds.service.js";
|
|
16
|
+
import { checkClientFiles } from "../client/client-files.js";
|
|
15
17
|
import { ApiError } from "../errors.js";
|
|
16
18
|
import { ExtensionAdminOps } from "../extensions/admin-ops.js";
|
|
19
|
+
import { ExtensionAdmin } from "../extensions/admin-view.js";
|
|
17
20
|
import { writeSnapshot } from "../extensions/approvals.js";
|
|
18
|
-
import { ExtensionBlobs } from "../extensions/blobs.js";
|
|
21
|
+
import { blobKey, ExtensionBlobs } from "../extensions/blobs.js";
|
|
19
22
|
import { ExtensionInstalls } from "../extensions/installs.js";
|
|
20
23
|
import { PluginApproveLock, PluginInstallLock } from "../extensions/locks.js";
|
|
21
24
|
import { unrunMigrations } from "../extensions/migrate-lock.js";
|
|
@@ -24,58 +27,73 @@ import { diffPermissions, permissionKeys, WARNINGS_KEY_PREFIX, } from "../extens
|
|
|
24
27
|
import { reviewHash as extensionReviewHash, migrationWarnings, permissionGroups, permissionKeyItems, } from "../extensions/permission-view.js";
|
|
25
28
|
import { ExtensionRegistry } from "../extensions/registry.js";
|
|
26
29
|
import { audit } from "../identity/audit.js";
|
|
27
|
-
import {
|
|
30
|
+
import { assertCustomAllowed } from "../identity/settings.js";
|
|
31
|
+
import { SuperAdminLock } from "../identity/super-admin.js";
|
|
28
32
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
33
|
+
import { afterCommit } from "../infra/database/after-commit.js";
|
|
29
34
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
30
35
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
31
36
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
37
|
+
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
32
38
|
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
39
|
+
import { OrgLock } from "../orgs/org-lock.js";
|
|
33
40
|
import { packPackageTgz } from "../packages/tgz.js";
|
|
34
41
|
import { checkSkillFiles, SkillArchiveError } from "../skills/package.js";
|
|
35
42
|
import { StorageService } from "../storage/storage.service.js";
|
|
36
43
|
import { canonicalJson } from "../tools/canonical-json.js";
|
|
37
44
|
import { endpointCredentialIssues } from "../tools/endpoint.js";
|
|
38
45
|
import { findConnectorIn } from "./catalog-content.js";
|
|
39
|
-
import {
|
|
46
|
+
import { displayFilePaths, putDisplayFiles, sweepDisplayFiles } from "./catalog-files.js";
|
|
47
|
+
import { assertOrgsExist, assertPluginNameOwner, catalogObjectPrefix, itemConfirmations, itemScopeFacts, itemView, markVersionApplied, permissionsMismatch, precheckCatalogImport, putCatalogFiles, templateProblems, unappliedOwnVersion, writeCatalogVersion, } from "./catalog-items.js";
|
|
40
48
|
import { CLAUDE_PLUGIN_FILE, claudeContentDigest, } from "./claude/manifest.js";
|
|
41
49
|
import { CLAUDE_MCP_CONNECTOR } from "./claude/mcp.js";
|
|
42
50
|
import { item as reportItem, sortItems, } from "./claude/report.js";
|
|
43
51
|
import { isClaudePluginTree, translateClaudePlugin } from "./claude/translate.js";
|
|
44
52
|
import { CatalogItemLock } from "./locks.js";
|
|
45
|
-
import {
|
|
53
|
+
import { assertNameFree, assertPackageFree, assertShareable, packageOwner, releaseExtensionClaim, shareGate, usableBy, } from "./ownership.js";
|
|
54
|
+
import { PlanStale, PlatformComponents } from "./platform-components.js";
|
|
55
|
+
import { PluginPackageError, readPluginFiles, readPluginPackage, themeApiError, } from "./plugin-package.js";
|
|
56
|
+
import { hasImportRequests, importRequestOf, resolveImportRequests } from "./request-rules.js";
|
|
57
|
+
import { assertNameNotReserved } from "./reserved-names.js";
|
|
58
|
+
import { oweScopeItem } from "./scope-jobs.js";
|
|
59
|
+
import { addScopeOrg } from "./scope-orgs.js";
|
|
46
60
|
import { maxSatisfying, satisfiesRange } from "./versions.js";
|
|
47
61
|
/**
|
|
48
|
-
*
|
|
62
|
+
* Platform import of a plugin (package ecosystem spec §4.3): one review for every plugin, whatever
|
|
49
63
|
* it contains (an extension, skills, connector templates, dependencies), confirmed once.
|
|
50
64
|
*
|
|
51
65
|
* prepare: the tgz is always hostile input, and **nothing is written until every check passes**
|
|
52
66
|
* (F-AD): `readPluginPackage` (plugin.json, package.json, listed / scanned skills and templates,
|
|
53
|
-
* icons
|
|
54
|
-
* (`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
|
|
55
68
|
* refused; name ownership; a downgrade to a version with unrun migrations is refused), each skill by
|
|
56
69
|
* the skill package rules, each connector template against the connector loaded on this replica (or
|
|
57
70
|
* statically when the connector is provided by the plugin's own extension or by a dependency), the
|
|
58
|
-
* catalog name / version conflicts and the actor still
|
|
71
|
+
* catalog name / version conflicts and the actor still a super admin. Dependencies are only
|
|
59
72
|
* resolved against the imported catalog versions for the review (an unresolved one does not block
|
|
60
73
|
* the import, spec §4.1); they are never fetched. Only then is the extension handed to
|
|
61
|
-
* `ExtensionInstalls.ingest` (source `catalog`), the skill / template
|
|
62
|
-
* storage,
|
|
74
|
+
* `ExtensionInstalls.ingest` (source `catalog`), the skill / template files written to object
|
|
75
|
+
* storage, the display files (icons, setup guide files; `catalog-files.ts`) written to PG with a
|
|
76
|
+
* staging row (24 hours), and `catalog.plugin_staged` audited. A display file inside a skill
|
|
77
|
+
* directory or at a template's path goes to both places: each reader finds it where it looks.
|
|
63
78
|
*
|
|
64
79
|
* confirm: `reviewHash` must match the staging; in one transaction it deletes the staging row
|
|
65
80
|
* (confirm works once), locks the extension name and recomputes its deployment state (installed /
|
|
66
81
|
* upgraded / swapped after the review -> `plugin.review_stale`), writes the extension's permission
|
|
67
|
-
* snapshot when it is installed by this import (
|
|
68
|
-
* `extension.permissions_approved` carrying the plugin), and creates the item
|
|
69
|
-
* (`manifest` = the normalized plugin.json,
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
82
|
+
* snapshot when it is installed or upgraded by this import (source web, audit
|
|
83
|
+
* `extension.permissions_approved` carrying the plugin), and creates the item (with the scope the
|
|
84
|
+
* admin chose, default `optional`) or adds the version (`manifest` = the normalized plugin.json,
|
|
85
|
+
* `extension_sha256`, the files under the staging prefix); an item's first usable version also
|
|
86
|
+
* gets its platform component rows there (their files copied before, keyed by content: a failure
|
|
87
|
+
* leaves nothing a retry copies again; no job heals an item later). After the commit the plugin's
|
|
88
|
+
* own extension is installed on the deployment and enabled (`ExtensionAdminOps.install` + `enable`;
|
|
89
|
+
* each replica reconciles, no restart); a failure is returned, not thrown, and an upgrade that was
|
|
90
|
+
* not installed gets its old snapshot back.
|
|
74
91
|
*
|
|
75
92
|
* Expired staging is cleaned by the maintenance job `app-staging-cleanup`
|
|
76
|
-
* ({@link PluginImport.cleanupExpired}): it deletes the staging row and its object prefix
|
|
77
|
-
*
|
|
78
|
-
*
|
|
93
|
+
* ({@link PluginImport.cleanupExpired}): it deletes the staging row and its object prefix, then the
|
|
94
|
+
* display files (`catalog_files`) nothing lists any more; a stored extension package stays in the
|
|
95
|
+
* content-addressed `extension_packages` (the same as importing the same tgz again; without an
|
|
96
|
+
* install record referencing it it is never loaded).
|
|
79
97
|
*/
|
|
80
98
|
/** How long a staged import is kept. */
|
|
81
99
|
export const PLUGIN_STAGING_TTL_MS = 24 * 3600_000;
|
|
@@ -93,13 +111,17 @@ const invalid = (problems) => new ApiError("catalog.invalid_manifest", `Invalid
|
|
|
93
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`);
|
|
94
112
|
const mismatch = (what) => new ApiError("marketplace.package_mismatch", `The downloaded package does not match the marketplace entry: ${what}`);
|
|
95
113
|
/**
|
|
96
|
-
* The API error of a plugin package that cannot be read in a catalog path:
|
|
97
|
-
* `
|
|
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
|
|
116
|
+
* `[{ theme, issues }]`, the failing pairs); anything else -> `catalog.invalid_manifest` (issues as
|
|
117
|
+
* details).
|
|
98
118
|
*/
|
|
99
119
|
export function catalogPackageError(e) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
120
|
+
if (e.code === "client.undeclared")
|
|
121
|
+
return new ApiError("client.undeclared", e.message);
|
|
122
|
+
if (e.code === "theme.invalid" || e.code === "theme.unreadable") {
|
|
123
|
+
return themeApiError(e);
|
|
124
|
+
}
|
|
103
125
|
return invalid(e.issues);
|
|
104
126
|
}
|
|
105
127
|
/** Runs a package read, mapping its errors with {@link catalogPackageError}. */
|
|
@@ -123,16 +145,21 @@ const fileOf = (path, data) => ({
|
|
|
123
145
|
let PluginImport = class PluginImport {
|
|
124
146
|
kdb;
|
|
125
147
|
adminLock;
|
|
148
|
+
orgLock;
|
|
126
149
|
installLock;
|
|
127
150
|
approveLock;
|
|
128
151
|
itemLock;
|
|
129
152
|
config;
|
|
130
153
|
installs;
|
|
131
154
|
ops;
|
|
155
|
+
admin;
|
|
132
156
|
blobs;
|
|
133
157
|
registry;
|
|
134
158
|
log;
|
|
135
159
|
txHost;
|
|
160
|
+
platform;
|
|
161
|
+
clientBuilds;
|
|
162
|
+
outbox;
|
|
136
163
|
/** Where plugin files go (the kernel's object storage; the CLI's own, see {@link useCliStorage}). */
|
|
137
164
|
files;
|
|
138
165
|
/**
|
|
@@ -142,24 +169,37 @@ let PluginImport = class PluginImport {
|
|
|
142
169
|
*/
|
|
143
170
|
connectorsLoaded = true;
|
|
144
171
|
constructor(kdb,
|
|
145
|
-
/** The
|
|
146
|
-
adminLock,
|
|
172
|
+
/** The super admin lock (identity/super-admin.ts): joins the caller's transaction. */
|
|
173
|
+
adminLock,
|
|
174
|
+
/** The owner org's lock: an org upload re-checks its admin under it (ruling P3-7). */
|
|
175
|
+
orgLock, installLock, approveLock, itemLock, config, storage, installs, ops, admin,
|
|
147
176
|
/** Reads a package from the package store (confirm recomputes the permission set). */
|
|
148
177
|
blobs,
|
|
149
178
|
/** Config-declared names, loaded connectors and extension versions (the extension registry). */
|
|
150
|
-
registry, log, txHost
|
|
179
|
+
registry, log, txHost,
|
|
180
|
+
/** The platform rows of a new item's components, written in the confirm's transaction. */
|
|
181
|
+
platform,
|
|
182
|
+
/** The client build of a dropped org upload's package is deleted with it. */
|
|
183
|
+
clientBuilds,
|
|
184
|
+
/** The item's scope sync, owed by the confirm's commit when it deploys no extension. */
|
|
185
|
+
outbox) {
|
|
151
186
|
this.kdb = kdb;
|
|
152
187
|
this.adminLock = adminLock;
|
|
188
|
+
this.orgLock = orgLock;
|
|
153
189
|
this.installLock = installLock;
|
|
154
190
|
this.approveLock = approveLock;
|
|
155
191
|
this.itemLock = itemLock;
|
|
156
192
|
this.config = config;
|
|
157
193
|
this.installs = installs;
|
|
158
194
|
this.ops = ops;
|
|
195
|
+
this.admin = admin;
|
|
159
196
|
this.blobs = blobs;
|
|
160
197
|
this.registry = registry;
|
|
161
198
|
this.log = log;
|
|
162
199
|
this.txHost = txHost;
|
|
200
|
+
this.platform = platform;
|
|
201
|
+
this.clientBuilds = clientBuilds;
|
|
202
|
+
this.outbox = outbox;
|
|
163
203
|
this.files = storage;
|
|
164
204
|
}
|
|
165
205
|
/** The kernel-schema handle of the current context (the transaction, else the pool). */
|
|
@@ -174,21 +214,29 @@ let PluginImport = class PluginImport {
|
|
|
174
214
|
useCliStorage(storage) {
|
|
175
215
|
this.files = storage;
|
|
176
216
|
this.connectorsLoaded = false;
|
|
217
|
+
this.platform.useCliStorage(storage);
|
|
177
218
|
}
|
|
178
219
|
/**
|
|
179
|
-
* The
|
|
220
|
+
* The super-admin re-check under the lock, in the caller's transaction. `actor` null is the
|
|
180
221
|
* CLI (the operator of the deployment: no account to re-check, audits carry no actor), like
|
|
181
|
-
* `ExtensionInstalls.ingest`.
|
|
222
|
+
* `ExtensionInstalls.ingest`. An org upload (`owner`) re-checks the actor as an admin of the
|
|
223
|
+
* owner org under the org row lock instead (`catalog.upload`; an org deleted meanwhile -> 404
|
|
224
|
+
* `org.not_found`).
|
|
182
225
|
*/
|
|
183
|
-
async authorizeActor(actor) {
|
|
184
|
-
if (
|
|
226
|
+
async authorizeActor(actor, owner) {
|
|
227
|
+
if (owner !== undefined) {
|
|
228
|
+
if (actor === null)
|
|
229
|
+
throw new Error("an org upload has an actor");
|
|
230
|
+
await this.orgLock.lockAndAuthorize(owner.orgId, actor, "catalog.upload");
|
|
231
|
+
}
|
|
232
|
+
else if (actor === null)
|
|
185
233
|
await this.adminLock.lock();
|
|
186
234
|
else
|
|
187
235
|
await this.adminLock.lockAndAuthorize(actor);
|
|
188
236
|
}
|
|
189
237
|
/** The re-check alone, in a transaction of its own (before anything is written). */
|
|
190
|
-
async authorize(actor) {
|
|
191
|
-
await this.authorizeActor(actor);
|
|
238
|
+
async authorize(actor, owner) {
|
|
239
|
+
await this.authorizeActor(actor, owner);
|
|
192
240
|
}
|
|
193
241
|
/**
|
|
194
242
|
* Reads, checks and stages a plugin (see the file header). Returns the staging id and review.
|
|
@@ -279,6 +327,10 @@ let PluginImport = class PluginImport {
|
|
|
279
327
|
*/
|
|
280
328
|
async prepareContents(actor, pkg, tgz, source, opts) {
|
|
281
329
|
const maxBytes = this.config.get().packages.maxBytes;
|
|
330
|
+
const owner = opts.owner;
|
|
331
|
+
if (owner !== undefined && source.kind !== "file") {
|
|
332
|
+
throw new Error("an org upload is a file (ruling P3-7)");
|
|
333
|
+
}
|
|
282
334
|
// 1. Every check (nothing written)
|
|
283
335
|
const m = pkg.manifest;
|
|
284
336
|
const packageName = packageNameOf(pkg);
|
|
@@ -292,14 +344,50 @@ let PluginImport = class PluginImport {
|
|
|
292
344
|
? await readingPackage(() => readExtensionPackage(bytes, { maxBytes, hostSdkVersion: SDK_VERSION }))
|
|
293
345
|
: undefined;
|
|
294
346
|
const content = this.checkContent(pkg, format);
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
347
|
+
// suggestedAppearance.theme against the themes the scan found (the manifest may not list them)
|
|
348
|
+
const appearance = appearanceIssues(m, pkg.themes.map((t) => t.id));
|
|
349
|
+
if (appearance.length > 0)
|
|
350
|
+
throw invalid(appearance);
|
|
351
|
+
// Client code (client extensions spec §9.1): the section re-checked and every file against it
|
|
352
|
+
// (keys, listed = present, sizes, sha384 recomputed, the CSS layer wrap); delivered from object
|
|
353
|
+
// storage, so refused without one. The store checks the bytes it writes again. A bootstrap
|
|
354
|
+
// plugin never carries it: a bootstrap run may have no object store (it may be a bootstrap
|
|
355
|
+
// plugin itself), and a required entry failing on that would stop the start.
|
|
356
|
+
if (ext?.section.client !== undefined) {
|
|
357
|
+
if (source.kind === "bootstrap") {
|
|
358
|
+
throw new ApiError("client.invalid", `Bootstrap plugin ${m.name} ships client code (extension.client), which a bootstrap plugin may not carry: its files are kept in object storage, which a bootstrap run may not have (the object store may be a bootstrap plugin itself); take ${m.name} out of bootstrap.json and import it into the catalog instead`);
|
|
359
|
+
}
|
|
360
|
+
checkClientFiles(ext.section.client, pkg.files);
|
|
361
|
+
this.files.assertAvailable();
|
|
362
|
+
}
|
|
363
|
+
// A name live for another owner (an org's for the super admin; the platform's or another
|
|
364
|
+
// org's for an org) -> 409 plugin.name_taken naming it (P3-14); the same owner adds a version
|
|
365
|
+
await assertNameFree(this.db, m.name, owner?.orgId ?? null);
|
|
366
|
+
if (owner !== undefined) {
|
|
367
|
+
// a bootstrap or marketplace plugin's name stays free for the platform (ruling P3-28)
|
|
368
|
+
await assertNameNotReserved(this.db, m.name);
|
|
369
|
+
// its npm package is an identity of this org only (ruling P3-51)
|
|
370
|
+
await assertPackageFree(this.db, packageName, owner.orgId);
|
|
371
|
+
await assertCustomContent(this.db, content);
|
|
372
|
+
}
|
|
373
|
+
// An org's own version imported but not applied: its update is retried (pre-flight F4)
|
|
374
|
+
const retry = owner !== undefined && !m.extension
|
|
375
|
+
? await unappliedOwnVersion(this.db, m.name, owner.orgId, {
|
|
376
|
+
packageName,
|
|
377
|
+
version: m.version,
|
|
378
|
+
contentDigest: pkg.contentDigest,
|
|
379
|
+
})
|
|
380
|
+
: undefined;
|
|
381
|
+
const { existing, version } = retry !== undefined
|
|
382
|
+
? { existing: { id: retry.itemId }, version: retry.version }
|
|
383
|
+
: await precheckCatalogImport(this.db, m.name, {
|
|
384
|
+
packageName,
|
|
385
|
+
version: m.version,
|
|
386
|
+
contentDigest: pkg.contentDigest,
|
|
387
|
+
...(source.integrity !== undefined && { integrity: source.integrity }),
|
|
388
|
+
...(source.detail !== undefined && { detail: source.detail }),
|
|
389
|
+
...(source.marketplaceId !== undefined && { marketplaceId: source.marketplaceId }),
|
|
390
|
+
});
|
|
303
391
|
// The catalog name space is the extension name space: a declarative plugin cannot take a
|
|
304
392
|
// config-declared or another package's extension name either
|
|
305
393
|
this.assertNotDeclared(m.name);
|
|
@@ -309,8 +397,17 @@ let PluginImport = class PluginImport {
|
|
|
309
397
|
extension = await this.reviewExtension(ext, await this.extensionState(m.name, packageName));
|
|
310
398
|
await assertDowngradable(this.db, extension, ext.migrationSql);
|
|
311
399
|
}
|
|
312
|
-
|
|
400
|
+
// Display files go to PG with the staging row; skills and templates need object storage, which a
|
|
401
|
+
// bootstrap import never has (the object store may be a bootstrap plugin itself). A file that is
|
|
402
|
+
// both (an icon inside a skill directory) goes to both: the readers of each look only there
|
|
403
|
+
const displayFiles = content.files.filter((f) => content.displayPaths.has(f.path));
|
|
404
|
+
const objectFiles = content.files.filter((f) => content.objectPaths.has(f.path));
|
|
405
|
+
if (objectFiles.length > 0 && retry === undefined) {
|
|
406
|
+
if (source.kind === "bootstrap" && !this.files.available) {
|
|
407
|
+
throw new ApiError("storage.unavailable", `Bootstrap plugin ${m.name} ships skills, connector templates, agent templates or themes, which are kept in object storage, and object storage is not running yet (it may be a bootstrap plugin itself); a required bootstrap plugin may ship only an icon and setup guides, an optional one is retried once the extensions have loaded`);
|
|
408
|
+
}
|
|
313
409
|
this.files.assertAvailable();
|
|
410
|
+
}
|
|
314
411
|
const src = {
|
|
315
412
|
kind: source.kind,
|
|
316
413
|
ref: source.ref,
|
|
@@ -318,7 +415,7 @@ let PluginImport = class PluginImport {
|
|
|
318
415
|
...(source.marketplaceId !== undefined && { marketplaceId: source.marketplaceId }),
|
|
319
416
|
...(source.detail !== undefined && { detail: source.detail }),
|
|
320
417
|
};
|
|
321
|
-
const dependencies = await this.resolveDependencies(m);
|
|
418
|
+
const dependencies = await this.resolveDependencies(m, owner);
|
|
322
419
|
let translation;
|
|
323
420
|
if (opts.claude !== undefined) {
|
|
324
421
|
const added = [
|
|
@@ -348,7 +445,8 @@ let PluginImport = class PluginImport {
|
|
|
348
445
|
contentDigest: pkg.contentDigest,
|
|
349
446
|
packageName,
|
|
350
447
|
publisher: m.publisher,
|
|
351
|
-
description: m.description,
|
|
448
|
+
description: pluginDescription(m.description).en,
|
|
449
|
+
descriptionZh: pluginDescription(m.description).zh ?? null,
|
|
352
450
|
...(m.displayName !== undefined && { displayName: m.displayName }),
|
|
353
451
|
...(m.license !== undefined && { license: m.license }),
|
|
354
452
|
...(m.homepage !== undefined && { homepage: m.homepage }),
|
|
@@ -356,6 +454,7 @@ let PluginImport = class PluginImport {
|
|
|
356
454
|
skills: content.skills,
|
|
357
455
|
connectorTemplates: content.templates,
|
|
358
456
|
...(content.agentTemplates.length > 0 && { agentTemplates: content.agentTemplates }),
|
|
457
|
+
...(content.themes.length > 0 && { themes: content.themes }),
|
|
359
458
|
dependencies,
|
|
360
459
|
source: src,
|
|
361
460
|
provenance: (opts.provenance ?? NOT_NPM).provenance,
|
|
@@ -364,8 +463,9 @@ let PluginImport = class PluginImport {
|
|
|
364
463
|
reviewHash: "",
|
|
365
464
|
};
|
|
366
465
|
review.reviewHash = pluginReviewHash(review, content.files);
|
|
367
|
-
// Re-check under the lock that the actor is still an
|
|
368
|
-
|
|
466
|
+
// Re-check under the lock that the actor is still a super admin (an org upload: an admin of
|
|
467
|
+
// the owner org) before writing
|
|
468
|
+
await this.authorize(actor, owner);
|
|
369
469
|
// 2. Write: the extension into the package store, files into object storage, the staging row
|
|
370
470
|
const stagingId = randomUUID();
|
|
371
471
|
const itemId = existing?.id ?? randomUUID();
|
|
@@ -379,12 +479,14 @@ let PluginImport = class PluginImport {
|
|
|
379
479
|
}, {
|
|
380
480
|
...(opts.actorTokenId !== undefined && { actorTokenId: opts.actorTokenId }),
|
|
381
481
|
...(bootstrap && { store: "pg" }),
|
|
482
|
+
// an org upload only stores the package (nothing runs until the super admin confirms)
|
|
483
|
+
...(owner !== undefined && { owner }),
|
|
382
484
|
});
|
|
383
485
|
}
|
|
384
486
|
let objectPrefix = null;
|
|
385
|
-
if (
|
|
487
|
+
if (objectFiles.length > 0 && retry === undefined) {
|
|
386
488
|
objectPrefix = catalogObjectPrefix(itemId, version, stagingId);
|
|
387
|
-
await putCatalogFiles(this.files, objectPrefix,
|
|
489
|
+
await putCatalogFiles(this.files, objectPrefix, objectFiles);
|
|
388
490
|
}
|
|
389
491
|
const keys = ext
|
|
390
492
|
? permissionKeys(permissionSetOfPackage(ext))
|
|
@@ -392,28 +494,34 @@ let PluginImport = class PluginImport {
|
|
|
392
494
|
.sort()
|
|
393
495
|
: [];
|
|
394
496
|
const mismatch = permissionsMismatch(opts.expect?.marketplace?.permissions, ext ? keys : undefined);
|
|
497
|
+
const manifest = normalizedManifest(pkg);
|
|
498
|
+
const replacements = manifest.suggestedAppearance?.replacements;
|
|
395
499
|
const staged = {
|
|
396
500
|
itemId,
|
|
397
501
|
packageName,
|
|
398
502
|
version,
|
|
399
503
|
contentDigest: pkg.contentDigest,
|
|
400
504
|
size: tgz.size,
|
|
401
|
-
manifest
|
|
505
|
+
manifest,
|
|
506
|
+
...(replacements !== undefined && { appearanceOrder: Object.keys(replacements) }),
|
|
402
507
|
files: content.files.map(({ path, size, sha256 }) => ({ path, size, sha256 })),
|
|
403
508
|
...(mismatch !== null && { permissionsMismatch: mismatch }),
|
|
404
509
|
sourceFormat: format,
|
|
405
510
|
...(translation !== undefined && { translation }),
|
|
406
511
|
...(license.text !== undefined && { licenseText: license.text }),
|
|
407
512
|
...(license.truncated && { licenseTruncated: true }),
|
|
513
|
+
...(retry !== undefined && { retry: true }),
|
|
408
514
|
};
|
|
409
|
-
await this.writeStaging(actor, stagingId, review, staged, objectPrefix, src, opts);
|
|
515
|
+
await this.writeStaging(actor, stagingId, review, staged, objectPrefix, src, opts, owner, displayFiles);
|
|
410
516
|
return { stagingId, review, permissionKeys: keys, permissionsMismatch: mismatch };
|
|
411
517
|
}
|
|
412
518
|
/** The staging row and the `catalog.plugin_staged` audit, the actor re-checked under the lock. */
|
|
413
|
-
async writeStaging(actor, stagingId, review, staged, objectPrefix, src, opts) {
|
|
519
|
+
async writeStaging(actor, stagingId, review, staged, objectPrefix, src, opts, owner, displayFiles) {
|
|
414
520
|
const { extension } = review;
|
|
415
521
|
const t = this.db;
|
|
416
|
-
await this.authorizeActor(actor);
|
|
522
|
+
await this.authorizeActor(actor, owner);
|
|
523
|
+
// committed with the staging row that lists them (the sweep keeps what a staging lists)
|
|
524
|
+
await putDisplayFiles(t, displayFiles);
|
|
417
525
|
await t
|
|
418
526
|
.insertInto("plugin_import_staging")
|
|
419
527
|
.values({
|
|
@@ -424,6 +532,8 @@ let PluginImport = class PluginImport {
|
|
|
424
532
|
source: JSON.stringify(src),
|
|
425
533
|
created_by: actor,
|
|
426
534
|
expires_at: new Date(Date.now() + PLUGIN_STAGING_TTL_MS),
|
|
535
|
+
// the org's own staging (P3-8); null = the super admin's
|
|
536
|
+
org_id: owner?.orgId ?? null,
|
|
427
537
|
})
|
|
428
538
|
.execute();
|
|
429
539
|
await audit(t, {
|
|
@@ -443,6 +553,8 @@ let PluginImport = class PluginImport {
|
|
|
443
553
|
...(extension && {
|
|
444
554
|
extension: { sha256: extension.sha256, action: extension.action },
|
|
445
555
|
}),
|
|
556
|
+
...(owner !== undefined && { orgId: owner.orgId }),
|
|
557
|
+
...opts.auditDetail,
|
|
446
558
|
},
|
|
447
559
|
});
|
|
448
560
|
}
|
|
@@ -465,9 +577,10 @@ let PluginImport = class PluginImport {
|
|
|
465
577
|
/**
|
|
466
578
|
* A staged import's review, as prepare returned it, with a marketplace import's permission
|
|
467
579
|
* mismatch when there is one (the import page loads `?staging=<id>` with it). Unknown, expired or
|
|
468
|
-
* already confirmed -> 404 `plugin.staging_not_found`.
|
|
580
|
+
* already confirmed -> 404 `plugin.staging_not_found`. Each sees only its own staging (P3-8):
|
|
581
|
+
* the super admin's routes the platform's (no `owner`), an org's routes that org's.
|
|
469
582
|
*/
|
|
470
|
-
async staged(stagingId) {
|
|
583
|
+
async staged(stagingId, owner) {
|
|
471
584
|
if (!UUID_RE.test(stagingId))
|
|
472
585
|
throw notFound();
|
|
473
586
|
const row = await this.db
|
|
@@ -475,6 +588,7 @@ let PluginImport = class PluginImport {
|
|
|
475
588
|
.select(["id", "review", "manifest"])
|
|
476
589
|
.where("id", "=", stagingId)
|
|
477
590
|
.where("expires_at", ">", sql `now()`)
|
|
591
|
+
.where(ownStaging(owner))
|
|
478
592
|
.executeTakeFirst();
|
|
479
593
|
if (!row)
|
|
480
594
|
throw notFound();
|
|
@@ -486,17 +600,119 @@ let PluginImport = class PluginImport {
|
|
|
486
600
|
};
|
|
487
601
|
}
|
|
488
602
|
/**
|
|
489
|
-
*
|
|
490
|
-
*
|
|
603
|
+
* What an org's staged upload targets (P3-12, pre-flight F3): its item, version and review hash,
|
|
604
|
+
* whether the item exists (a new version of the org's own plugin) or the version is imported
|
|
605
|
+
* already (F4), and the target as the platform updater reads it: the staged manifest and files,
|
|
606
|
+
* or the imported version's for a retry. Another org's staging -> 404 `plugin.staging_not_found`.
|
|
607
|
+
* Without `owner`: a platform staging, and `existing` means a live platform-owned item (the
|
|
608
|
+
* platform's import and update, `PlatformImportUpdate`).
|
|
609
|
+
*/
|
|
610
|
+
async stagedTarget(stagingId, owner) {
|
|
611
|
+
if (!UUID_RE.test(stagingId))
|
|
612
|
+
throw notFound();
|
|
613
|
+
const row = await this.db
|
|
614
|
+
.selectFrom("plugin_import_staging")
|
|
615
|
+
.select(["review", "manifest", "object_prefix"])
|
|
616
|
+
.where("id", "=", stagingId)
|
|
617
|
+
.where("expires_at", ">", sql `now()`)
|
|
618
|
+
.where(ownStaging(owner))
|
|
619
|
+
.executeTakeFirst();
|
|
620
|
+
if (!row)
|
|
621
|
+
throw notFound();
|
|
622
|
+
const review = row.review;
|
|
623
|
+
const staged = row.manifest;
|
|
624
|
+
const item = await this.db
|
|
625
|
+
.selectFrom("catalog_items")
|
|
626
|
+
.select(["id", "awaiting_confirmation"])
|
|
627
|
+
.where("id", "=", staged.itemId)
|
|
628
|
+
.where("deleted_at", "is", null)
|
|
629
|
+
.where((eb) => owner === undefined ? eb("owner_org_id", "is", null) : eb("owner_org_id", "=", owner.orgId))
|
|
630
|
+
.executeTakeFirst();
|
|
631
|
+
const imported = staged.retry === true
|
|
632
|
+
? await this.db
|
|
633
|
+
.selectFrom("catalog_item_versions")
|
|
634
|
+
.select(["version", "manifest", "object_prefix", "files", "extension_sha256"])
|
|
635
|
+
.where("item_id", "=", staged.itemId)
|
|
636
|
+
.where("version", "=", staged.version)
|
|
637
|
+
.executeTakeFirst()
|
|
638
|
+
: undefined;
|
|
639
|
+
return {
|
|
640
|
+
itemId: staged.itemId,
|
|
641
|
+
version: staged.version,
|
|
642
|
+
reviewHash: review.reviewHash,
|
|
643
|
+
extension: review.extension !== undefined,
|
|
644
|
+
existing: item !== undefined,
|
|
645
|
+
awaiting: item?.awaiting_confirmation === true,
|
|
646
|
+
retry: staged.retry === true,
|
|
647
|
+
target: imported !== undefined
|
|
648
|
+
? {
|
|
649
|
+
version: imported.version,
|
|
650
|
+
manifest: imported.manifest,
|
|
651
|
+
object_prefix: imported.object_prefix,
|
|
652
|
+
files: imported.files,
|
|
653
|
+
extension_sha256: imported.extension_sha256,
|
|
654
|
+
}
|
|
655
|
+
: {
|
|
656
|
+
version: staged.version,
|
|
657
|
+
manifest: staged.manifest,
|
|
658
|
+
object_prefix: row.object_prefix,
|
|
659
|
+
files: staged.files,
|
|
660
|
+
extension_sha256: review.extension?.sha256 ?? null,
|
|
661
|
+
},
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
/** The catalog item's view (as a confirm returns it). */
|
|
665
|
+
async view(itemId) {
|
|
666
|
+
return this.itemView(itemId);
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Confirms a staged import (see the file header). Returns the committed catalog item and the
|
|
670
|
+
* extension's deploy result (a failed deploy is returned, not thrown). `scope` (default
|
|
671
|
+
* `optional`) and `orgs` (only with `named`; each an existing org, else `validation_failed`) are
|
|
672
|
+
* written when this confirm creates the item; a new version of an existing item keeps its scope.
|
|
673
|
+
* The commit owes the item's scope sync, or the extension's deploy does (see {@link commit}).
|
|
674
|
+
*
|
|
675
|
+
* An org upload (`opts.owner`, spec §14): only that org's staging; the actor re-checked as its
|
|
676
|
+
* admin; `scope` / `orgs` are not taken: a new item is owned by the org, scope `named: [owner]`,
|
|
677
|
+
* not shown to other orgs, `shareable` as given (default false). Custom deny, the name owner and
|
|
678
|
+
* the dependencies are checked again under the item name's lock. A package with an extension
|
|
679
|
+
* is stored and its extension name claimed, nothing approved or installed: the version waits
|
|
680
|
+
* for the super admin (`pending`, ruling P3-10; see {@link commit}).
|
|
491
681
|
*/
|
|
492
682
|
async confirm(actor, stagingId, input, opts = {}) {
|
|
493
683
|
if (!UUID_RE.test(stagingId))
|
|
494
684
|
throw notFound();
|
|
685
|
+
const owner = opts.owner;
|
|
686
|
+
if (owner !== undefined && (input.scope !== undefined || input.orgs !== undefined)) {
|
|
687
|
+
throw new Error("an org upload's scope is its owner's");
|
|
688
|
+
}
|
|
689
|
+
// A staging prepared by approving an org's `import` request defaults to that org (spec §5.1
|
|
690
|
+
// rule 3); the admin may still choose any scope
|
|
691
|
+
const linked = input.scope === undefined && owner === undefined
|
|
692
|
+
? await importRequestOf(this.db, stagingId)
|
|
693
|
+
: undefined;
|
|
694
|
+
const scope = owner !== undefined
|
|
695
|
+
? "named"
|
|
696
|
+
: (input.scope ?? (linked !== undefined ? "named" : "optional"));
|
|
697
|
+
const orgs = owner !== undefined
|
|
698
|
+
? [owner.orgId]
|
|
699
|
+
: (input.orgs ?? (linked !== undefined ? [linked.orgId] : undefined));
|
|
700
|
+
if (input.orgs !== undefined && scope !== "named") {
|
|
701
|
+
throw new ApiError("validation_failed", "orgs: only allowed with scope named", [
|
|
702
|
+
{ path: "orgs", message: "only allowed with scope named" },
|
|
703
|
+
]);
|
|
704
|
+
}
|
|
705
|
+
if (scope === "named" && (orgs ?? []).length === 0) {
|
|
706
|
+
throw new ApiError("validation_failed", "orgs: scope named needs at least one organization", [
|
|
707
|
+
{ path: "orgs", message: "scope named needs at least one organization" },
|
|
708
|
+
]);
|
|
709
|
+
}
|
|
495
710
|
const row = await this.db
|
|
496
711
|
.selectFrom("plugin_import_staging")
|
|
497
712
|
.selectAll()
|
|
498
713
|
.where("id", "=", stagingId)
|
|
499
714
|
.where("expires_at", ">", sql `now()`)
|
|
715
|
+
.where(ownStaging(owner))
|
|
500
716
|
.executeTakeFirst();
|
|
501
717
|
if (!row)
|
|
502
718
|
throw notFound();
|
|
@@ -505,36 +721,151 @@ let PluginImport = class PluginImport {
|
|
|
505
721
|
const src = row.source;
|
|
506
722
|
if (input.reviewHash !== review.reviewHash)
|
|
507
723
|
throw reviewStale(review);
|
|
508
|
-
const manifest =
|
|
724
|
+
const manifest = staged.manifest;
|
|
509
725
|
const reviewed = review.extension;
|
|
510
|
-
// Read the stored package outside the transaction (unless it was already installed as is
|
|
511
|
-
|
|
512
|
-
const
|
|
726
|
+
// Read the stored package outside the transaction (unless it was already installed as is, or
|
|
727
|
+
// an org upload, which approves nothing)
|
|
728
|
+
const stored = reviewed && reviewed.action !== "keep" && owner === undefined
|
|
729
|
+
? await this.readStored(reviewed.sha256)
|
|
730
|
+
: undefined;
|
|
731
|
+
// The platform components of the item's first usable version: planned and their files copied
|
|
732
|
+
// (keyed by content) before the transaction, their rows written in it
|
|
733
|
+
const prepared = staged.retry === true || (owner !== undefined && reviewed !== undefined)
|
|
734
|
+
? undefined
|
|
735
|
+
: await this.prepareFirstVersion(staged, row.object_prefix, owner);
|
|
736
|
+
const committed = await this.commit(actor, { stagingId, review, staged, src, manifest, objectPrefix: row.object_prefix }, {
|
|
737
|
+
scope,
|
|
738
|
+
orgs: [...new Set(orgs ?? [])].sort(),
|
|
739
|
+
...(owner !== undefined && { owner, shareable: input.shareable ?? false }),
|
|
740
|
+
}, stored, opts, prepared, input.updateFollows === true);
|
|
513
741
|
const { now } = committed;
|
|
514
|
-
|
|
742
|
+
if (committed.pending) {
|
|
743
|
+
// Waits for the super admin (P3-10): no platform components, nothing deployed
|
|
744
|
+
return {
|
|
745
|
+
item: await this.itemView(committed.itemId),
|
|
746
|
+
created: committed.created,
|
|
747
|
+
deploy: null,
|
|
748
|
+
pending: true,
|
|
749
|
+
firstVersion: false,
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
if (input.deploy === false) {
|
|
753
|
+
return {
|
|
754
|
+
item: await this.itemView(committed.itemId),
|
|
755
|
+
created: committed.created,
|
|
756
|
+
deploy: null,
|
|
757
|
+
pending: false,
|
|
758
|
+
firstVersion: committed.firstVersion,
|
|
759
|
+
...(now &&
|
|
760
|
+
committed.previous !== undefined && {
|
|
761
|
+
approval: { review, extension: now, previous: committed.previous },
|
|
762
|
+
}),
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
const deploy = now && now.action !== "keep"
|
|
515
766
|
? await this.deploy(actor, review, committed.itemId, now, committed.previous, opts, input.enable ?? true)
|
|
516
767
|
: null;
|
|
517
|
-
return {
|
|
768
|
+
return {
|
|
769
|
+
item: await this.itemView(committed.itemId),
|
|
770
|
+
created: committed.created,
|
|
771
|
+
deploy,
|
|
772
|
+
pending: false,
|
|
773
|
+
firstVersion: committed.firstVersion,
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* The platform components of the staged version when its confirm will most likely make it the
|
|
778
|
+
* item's first usable version ({@link commit} decides under its locks): no live item of the name
|
|
779
|
+
* yet, or an org upload replacing its own first upload still awaiting confirmation. Planned from
|
|
780
|
+
* the staged content and their files copied, outside any transaction; otherwise undefined.
|
|
781
|
+
*/
|
|
782
|
+
async prepareFirstVersion(staged, objectPrefix, owner) {
|
|
783
|
+
const live = await this.db
|
|
784
|
+
.selectFrom("catalog_items")
|
|
785
|
+
.select(["id", "awaiting_confirmation", "owner_org_id"])
|
|
786
|
+
.where("name", "=", staged.manifest.name)
|
|
787
|
+
.where("deleted_at", "is", null)
|
|
788
|
+
.executeTakeFirst();
|
|
789
|
+
const first = live === undefined ||
|
|
790
|
+
(owner !== undefined && live.awaiting_confirmation && live.owner_org_id === owner.orgId);
|
|
791
|
+
if (!first)
|
|
792
|
+
return undefined;
|
|
793
|
+
return this.platform.prepareImport({
|
|
794
|
+
itemId: live?.id ?? staged.itemId,
|
|
795
|
+
plugin: staged.manifest.name,
|
|
796
|
+
version: staged.version,
|
|
797
|
+
manifest: staged.manifest,
|
|
798
|
+
objectPrefix,
|
|
799
|
+
files: staged.files,
|
|
800
|
+
sourceFormat: staged.sourceFormat ?? "capybara",
|
|
801
|
+
});
|
|
518
802
|
}
|
|
519
803
|
/**
|
|
520
804
|
* The confirm's transaction: the staging row consumed, the extension's action recomputed under
|
|
521
805
|
* its install lock (stale -> `plugin.review_stale`), its snapshot approved, and the catalog
|
|
522
806
|
* version written under the item name's lock.
|
|
807
|
+
*
|
|
808
|
+
* An org upload with an extension (ruling P3-10) approves nothing: under the install lock it
|
|
809
|
+
* claims the extension name for its package (another package's -> 409
|
|
810
|
+
* `extension.name_conflict` naming its owner, before anything is written), and the version
|
|
811
|
+
* written becomes the item's pending one (`pending_version` / `_by` / `_at`; a first version
|
|
812
|
+
* also `awaiting_confirmation`). A later upload replaces the pending version (P3-11). An org
|
|
813
|
+
* upload without an extension for an item whose first version still waits (plan Task 6) replaces
|
|
814
|
+
* that upload and applies at once: the item stops waiting and the claim is released (nothing
|
|
815
|
+
* was installed under it).
|
|
816
|
+
*
|
|
817
|
+
* The item's first usable version (a new item not waiting, or an awaiting first upload replaced)
|
|
818
|
+
* writes the platform rows of its skills, agent templates, connector templates and themes
|
|
819
|
+
* (plugin scope phase 2) from `prepared` (their files copied before the transaction, keyed by
|
|
820
|
+
* content): a failure rolls the whole confirm back, and a retry copies nothing again. A plan made
|
|
821
|
+
* for another item or version, or a component changed since it -> `plugin.review_stale`. A new
|
|
822
|
+
* version of an existing item leaves them to the platform update.
|
|
523
823
|
*/
|
|
524
|
-
async commit(actor, c,
|
|
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) {
|
|
525
827
|
const { stagingId, review, staged, src, manifest } = c;
|
|
526
828
|
const reviewed = review.extension;
|
|
527
829
|
const stale = () => reviewStale(review);
|
|
528
|
-
|
|
830
|
+
const { owner } = scope;
|
|
831
|
+
await this.authorizeActor(actor, owner);
|
|
529
832
|
const t = this.db;
|
|
530
833
|
const used = await t
|
|
531
834
|
.deleteFrom("plugin_import_staging")
|
|
532
835
|
.where("id", "=", stagingId)
|
|
533
836
|
.where("expires_at", ">", sql `now()`)
|
|
837
|
+
.where(ownStaging(owner))
|
|
534
838
|
.returning("id")
|
|
535
839
|
.executeTakeFirst();
|
|
536
840
|
if (!used)
|
|
537
841
|
throw notFound();
|
|
842
|
+
if (owner !== undefined) {
|
|
843
|
+
await assertCustomContent(t, {
|
|
844
|
+
skills: review.skills,
|
|
845
|
+
agentTemplates: review.agentTemplates ?? [],
|
|
846
|
+
templates: review.connectorTemplates,
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
await assertOrgsExist(t, scope.orgs);
|
|
850
|
+
// Checked again before this upload claims anything (ruling P3-51)
|
|
851
|
+
if (owner !== undefined)
|
|
852
|
+
await assertPackageFree(t, staged.packageName, owner.orgId);
|
|
853
|
+
// The item's name lock and its live row before the extension's install lock: the global lock
|
|
854
|
+
// order is the item, then the install lock (ruling P3-50; ExtensionAdminOps.install locks the
|
|
855
|
+
// source item row before the install lock, an org deletion its items before it). Taken after
|
|
856
|
+
// the install lock instead, a confirmation of an org upload racing a replacement upload
|
|
857
|
+
// deadlocks (40P01).
|
|
858
|
+
const m = manifest;
|
|
859
|
+
await this.itemLock.lock(m.name);
|
|
860
|
+
// The scope the audit records: the review's for a new item, the item's own for a new version
|
|
861
|
+
// of a live item (which keeps its scope)
|
|
862
|
+
const existing = await t
|
|
863
|
+
.selectFrom("catalog_items")
|
|
864
|
+
.select(["id", "scope", "awaiting_confirmation", "package_name"])
|
|
865
|
+
.where("name", "=", m.name)
|
|
866
|
+
.where("deleted_at", "is", null)
|
|
867
|
+
.forUpdate()
|
|
868
|
+
.executeTakeFirst();
|
|
538
869
|
let now;
|
|
539
870
|
let previous;
|
|
540
871
|
if (reviewed) {
|
|
@@ -544,23 +875,73 @@ let PluginImport = class PluginImport {
|
|
|
544
875
|
await this.installLock.lock(reviewed.name);
|
|
545
876
|
now = {
|
|
546
877
|
...reviewed,
|
|
547
|
-
...actionOf(await this.extensionState(reviewed.name, staged.packageName), reviewed.sha256),
|
|
878
|
+
...actionOf(await this.extensionState(reviewed.name, staged.packageName), reviewed.sha256, reviewed.version),
|
|
548
879
|
};
|
|
549
880
|
if (pluginReviewHash({ ...review, extension: now }, staged.files) !== review.reviewHash) {
|
|
550
881
|
throw stale();
|
|
551
882
|
}
|
|
883
|
+
if (owner !== undefined) {
|
|
884
|
+
// An org upload only claims the name (P3-10): the super admin approves and installs it
|
|
885
|
+
await t
|
|
886
|
+
.insertInto("extension_name_owners")
|
|
887
|
+
.values({ name: reviewed.name, package_name: staged.packageName })
|
|
888
|
+
.onConflict((oc) => oc.column("name").doNothing())
|
|
889
|
+
.execute();
|
|
890
|
+
await assertPluginNameOwner(t, reviewed.name, staged.packageName);
|
|
891
|
+
}
|
|
552
892
|
// A foreseeable deploy failure (a downgrade to a version with unrun migrations) is refused
|
|
553
893
|
// before anything is written
|
|
554
|
-
if (
|
|
894
|
+
if (now.action === "upgrade" && stored) {
|
|
555
895
|
await assertDowngradable(t, now, stored.migrationSql);
|
|
556
896
|
}
|
|
557
|
-
if (now.action === "install" ||
|
|
897
|
+
if (owner === undefined && (now.action === "install" || now.action === "upgrade")) {
|
|
558
898
|
previous = await this.approve(actor, review, staged, now, stored, opts);
|
|
559
899
|
}
|
|
560
900
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
901
|
+
// Under the name's lock: the first confirm of a name wins, a later one of another owner is
|
|
902
|
+
// refused naming it, before anything of it is written (P3-14)
|
|
903
|
+
await assertNameFree(t, m.name, owner?.orgId ?? null);
|
|
904
|
+
if (owner !== undefined) {
|
|
905
|
+
await assertNameNotReserved(t, m.name);
|
|
906
|
+
await this.resolveDependencies(m, owner);
|
|
907
|
+
}
|
|
908
|
+
const actual = existing === undefined
|
|
909
|
+
? scope
|
|
910
|
+
: {
|
|
911
|
+
scope: existing.scope,
|
|
912
|
+
orgs: (await t
|
|
913
|
+
.selectFrom("catalog_item_scope_orgs")
|
|
914
|
+
.select("org_id")
|
|
915
|
+
.where("item_id", "=", existing.id)
|
|
916
|
+
.orderBy("org_id")
|
|
917
|
+
.execute()).map((r) => r.org_id),
|
|
918
|
+
};
|
|
919
|
+
if (staged.retry === true) {
|
|
920
|
+
// An org's own version imported already (pre-flight F4): nothing to write, the caller
|
|
921
|
+
// retries its update; it must still be there as reviewed
|
|
922
|
+
const v = existing === undefined
|
|
923
|
+
? undefined
|
|
924
|
+
: await t
|
|
925
|
+
.selectFrom("catalog_item_versions")
|
|
926
|
+
.select("version")
|
|
927
|
+
.where("item_id", "=", existing.id)
|
|
928
|
+
.where("version", "=", staged.version)
|
|
929
|
+
.where("content_digest", "=", staged.contentDigest)
|
|
930
|
+
.executeTakeFirst();
|
|
931
|
+
if (existing === undefined || existing.id !== staged.itemId || v === undefined)
|
|
932
|
+
throw stale();
|
|
933
|
+
return {
|
|
934
|
+
itemId: existing.id,
|
|
935
|
+
created: false,
|
|
936
|
+
firstVersion: false,
|
|
937
|
+
pending: false,
|
|
938
|
+
now,
|
|
939
|
+
previous,
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
const { id: itemId, created } = await writeCatalogVersion(t, {
|
|
943
|
+
// an org's version becomes its latest only when applied or confirmed (P3-34)
|
|
944
|
+
...(owner !== undefined && { keepLatest: true }),
|
|
564
945
|
actor,
|
|
565
946
|
...(opts.actorTokenId !== undefined && { actorTokenId: opts.actorTokenId }),
|
|
566
947
|
name: m.name,
|
|
@@ -568,9 +949,10 @@ let PluginImport = class PluginImport {
|
|
|
568
949
|
version: staged.version,
|
|
569
950
|
contentDigest: staged.contentDigest,
|
|
570
951
|
manifest: m,
|
|
952
|
+
appearanceOrder: staged.appearanceOrder ?? null,
|
|
571
953
|
listing: {
|
|
572
954
|
publisher: m.publisher,
|
|
573
|
-
description: m.description,
|
|
955
|
+
description: pluginDescription(m.description).en,
|
|
574
956
|
displayName: m.displayName ?? null,
|
|
575
957
|
},
|
|
576
958
|
newItemId: staged.itemId,
|
|
@@ -591,12 +973,126 @@ let PluginImport = class PluginImport {
|
|
|
591
973
|
licenseTruncated: staged.licenseTruncated === true,
|
|
592
974
|
auditDetail: {
|
|
593
975
|
stagingId,
|
|
594
|
-
|
|
595
|
-
|
|
976
|
+
scope: actual.scope,
|
|
977
|
+
...(actual.scope === "named" && { orgs: actual.orgs }),
|
|
596
978
|
...(now && { extension: { name: now.name, version: now.version, action: now.action } }),
|
|
597
979
|
},
|
|
598
980
|
});
|
|
599
|
-
|
|
981
|
+
// A new item gets the scope chosen in the review; a new version keeps the item's scope, its
|
|
982
|
+
// org list and its scope version (prepare reuses the live item's id, so the id cannot tell)
|
|
983
|
+
if (created) {
|
|
984
|
+
await t
|
|
985
|
+
.updateTable("catalog_items")
|
|
986
|
+
.set({
|
|
987
|
+
scope: scope.scope,
|
|
988
|
+
// an org upload: the org owns it, nobody else sees it until shared and shown (P3-16)
|
|
989
|
+
...(owner !== undefined && {
|
|
990
|
+
owner_org_id: owner.orgId,
|
|
991
|
+
shareable: scope.shareable === true,
|
|
992
|
+
shown_to_others: false,
|
|
993
|
+
}),
|
|
994
|
+
})
|
|
995
|
+
.where("id", "=", itemId)
|
|
996
|
+
.execute();
|
|
997
|
+
if (scope.scope === "named" && scope.orgs.length > 0) {
|
|
998
|
+
await t
|
|
999
|
+
.insertInto("catalog_item_scope_orgs")
|
|
1000
|
+
.values(scope.orgs.map((org_id) => ({ item_id: itemId, org_id })))
|
|
1001
|
+
.onConflict((oc) => oc.doNothing())
|
|
1002
|
+
.execute();
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
// The org requests this staging answers resolve with the confirm; on an item that existed
|
|
1006
|
+
// already (imported meanwhile) a `named` scope gains their orgs. An org-owned item held back by
|
|
1007
|
+
// the share gate fails closed before any request is marked (ruling P3-26; P3-14 refuses a
|
|
1008
|
+
// super admin import of an org-owned name, so this should not be reached)
|
|
1009
|
+
const item = created
|
|
1010
|
+
? undefined
|
|
1011
|
+
: await t
|
|
1012
|
+
.selectFrom("catalog_items")
|
|
1013
|
+
.select(["id", "name", "scope", "builtin", "owner_org_id", "shareable"])
|
|
1014
|
+
.where("id", "=", itemId)
|
|
1015
|
+
.forUpdate()
|
|
1016
|
+
.executeTakeFirstOrThrow();
|
|
1017
|
+
if (item !== undefined && !shareGate(item) && (await hasImportRequests(t, stagingId))) {
|
|
1018
|
+
assertShareable(item);
|
|
1019
|
+
}
|
|
1020
|
+
const requestOrgs = await resolveImportRequests(t, stagingId, itemId, actor, opts);
|
|
1021
|
+
if (item !== undefined) {
|
|
1022
|
+
for (const org of requestOrgs)
|
|
1023
|
+
await addScopeOrg(t, actor, item, org, opts);
|
|
1024
|
+
}
|
|
1025
|
+
const pending = owner !== undefined && reviewed !== undefined;
|
|
1026
|
+
// An org's first version without an extension is installed at once: applied (P3-52)
|
|
1027
|
+
if (owner !== undefined && created && !pending)
|
|
1028
|
+
await markVersionApplied(t, itemId, staged.version);
|
|
1029
|
+
if (pending) {
|
|
1030
|
+
// Waits for the super admin; a later upload replaces the pending version (P3-10, P3-11)
|
|
1031
|
+
await t
|
|
1032
|
+
.updateTable("catalog_items")
|
|
1033
|
+
.set({
|
|
1034
|
+
...(created && { awaiting_confirmation: true }),
|
|
1035
|
+
pending_version: staged.version,
|
|
1036
|
+
pending_by: actor,
|
|
1037
|
+
pending_at: sql `now()`,
|
|
1038
|
+
})
|
|
1039
|
+
.where("id", "=", itemId)
|
|
1040
|
+
.execute();
|
|
1041
|
+
}
|
|
1042
|
+
// A first version still waiting replaced by one without an extension: applied at once
|
|
1043
|
+
const replacedAwaiting = owner !== undefined && !pending && existing?.awaiting_confirmation === true;
|
|
1044
|
+
if (replacedAwaiting) {
|
|
1045
|
+
await t
|
|
1046
|
+
.updateTable("catalog_items")
|
|
1047
|
+
.set({
|
|
1048
|
+
awaiting_confirmation: false,
|
|
1049
|
+
pending_version: null,
|
|
1050
|
+
pending_by: null,
|
|
1051
|
+
pending_at: null,
|
|
1052
|
+
latest_version: staged.version,
|
|
1053
|
+
})
|
|
1054
|
+
.where("id", "=", itemId)
|
|
1055
|
+
.execute();
|
|
1056
|
+
await markVersionApplied(t, itemId, staged.version);
|
|
1057
|
+
await releaseExtensionClaim(t, m.name, existing.package_name);
|
|
1058
|
+
}
|
|
1059
|
+
const firstVersion = (created && !pending) || replacedAwaiting;
|
|
1060
|
+
if (firstVersion) {
|
|
1061
|
+
if (prepared?.plan.itemId !== itemId || prepared.plan.version !== staged.version) {
|
|
1062
|
+
throw stale();
|
|
1063
|
+
}
|
|
1064
|
+
try {
|
|
1065
|
+
await this.platform.applySyncIn(prepared);
|
|
1066
|
+
}
|
|
1067
|
+
catch (e) {
|
|
1068
|
+
if (e instanceof PlanStale)
|
|
1069
|
+
throw stale();
|
|
1070
|
+
throw e;
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
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) {
|
|
1079
|
+
const item = await t
|
|
1080
|
+
.selectFrom("catalog_items")
|
|
1081
|
+
.select("scope")
|
|
1082
|
+
.where("id", "=", itemId)
|
|
1083
|
+
.executeTakeFirstOrThrow();
|
|
1084
|
+
if (item.scope !== "optional" || owner !== undefined) {
|
|
1085
|
+
await oweScopeItem(this.outbox, t, itemId);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
return {
|
|
1089
|
+
itemId,
|
|
1090
|
+
created,
|
|
1091
|
+
firstVersion,
|
|
1092
|
+
pending,
|
|
1093
|
+
now,
|
|
1094
|
+
previous,
|
|
1095
|
+
};
|
|
600
1096
|
}
|
|
601
1097
|
/**
|
|
602
1098
|
* Writes the extension's permission snapshot for the version being imported (source web; cli
|
|
@@ -644,7 +1140,9 @@ let PluginImport = class PluginImport {
|
|
|
644
1140
|
}
|
|
645
1141
|
/**
|
|
646
1142
|
* Deploys the plugin's extension after the commit: `install` (a new install is disabled, a version
|
|
647
|
-
* change keeps the desired state) then `enable
|
|
1143
|
+
* change keeps the desired state) then `enable`, unless another enabled extension provides one of
|
|
1144
|
+
* its single-provider extension points: then it stays disabled (result `installed` with code
|
|
1145
|
+
* `extension.single_provider_enabled`). Nothing is thrown; the result says what happened.
|
|
648
1146
|
* When an upgrade was not installed, the snapshot overwritten at confirm is restored (the old
|
|
649
1147
|
* version keeps running, F-O; audit `extension.permissions_restored`). Retry through the extension
|
|
650
1148
|
* admin (the package is already in the package store) with the sha256 from the result.
|
|
@@ -659,8 +1157,9 @@ let PluginImport = class PluginImport {
|
|
|
659
1157
|
const failure = (e) => e instanceof ApiError
|
|
660
1158
|
? { code: e.code, message: e.message }
|
|
661
1159
|
: { code: "internal", message: "Internal error" };
|
|
1160
|
+
let installed;
|
|
662
1161
|
try {
|
|
663
|
-
await this.ops.install(p.name, p.sha256, actor, opts.actorTokenId, {
|
|
1162
|
+
installed = await this.ops.install(p.name, p.sha256, actor, opts.actorTokenId, {
|
|
664
1163
|
catalogItemId: itemId,
|
|
665
1164
|
});
|
|
666
1165
|
}
|
|
@@ -686,17 +1185,32 @@ let PluginImport = class PluginImport {
|
|
|
686
1185
|
}
|
|
687
1186
|
return result;
|
|
688
1187
|
}
|
|
1188
|
+
// An upgrade of an enabled extension that newly provides a held single-provider point: left
|
|
1189
|
+
// disabled by the install, and why
|
|
1190
|
+
if (installed.leftDisabled !== undefined) {
|
|
1191
|
+
return { ...base, result: "installed", ...installed.leftDisabled };
|
|
1192
|
+
}
|
|
689
1193
|
if (!enable)
|
|
690
1194
|
return { ...base, result: "installed" };
|
|
691
1195
|
try {
|
|
692
|
-
await this.ops.
|
|
693
|
-
|
|
1196
|
+
const r = await this.ops.enableUnlessOccupied(p.name, actor, opts.actorTokenId);
|
|
1197
|
+
if (r.enabled)
|
|
1198
|
+
return { ...base, result: "enabled" };
|
|
1199
|
+
// A single-provider point another enabled extension provides: installed disabled, and why
|
|
1200
|
+
return { ...base, result: "installed", ...r.note };
|
|
694
1201
|
}
|
|
695
1202
|
catch (e) {
|
|
696
1203
|
this.log.warn("enabling a plugin's extension failed", { plugin: p.name, err: e });
|
|
697
1204
|
return { ...base, result: "failed", ...failure(e) };
|
|
698
1205
|
}
|
|
699
1206
|
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Puts back the approval a confirm with `deploy: false` wrote, after the step that was to deploy
|
|
1209
|
+
* the extension failed (see {@link restoreSnapshot}; false when someone changed it meanwhile).
|
|
1210
|
+
*/
|
|
1211
|
+
async restoreApproval(actor, held, opts = {}) {
|
|
1212
|
+
return this.restoreSnapshot(actor, held.review, held.extension, held.previous, opts);
|
|
1213
|
+
}
|
|
700
1214
|
/**
|
|
701
1215
|
* Restores the snapshot overwritten at confirm (deletes it when there was none before), audits
|
|
702
1216
|
* `extension.permissions_restored`. Compare-and-write (row locked): restores only while the
|
|
@@ -745,11 +1259,24 @@ let PluginImport = class PluginImport {
|
|
|
745
1259
|
return true;
|
|
746
1260
|
}
|
|
747
1261
|
/**
|
|
748
|
-
* Deletes expired staging rows and their object prefixes (maintenance job `app-staging-cleanup`)
|
|
749
|
-
* Row by row: objects first, then the
|
|
750
|
-
*
|
|
1262
|
+
* Deletes expired staging rows and their object prefixes (maintenance job `app-staging-cleanup`),
|
|
1263
|
+
* then the unused display files ({@link sweepDisplayFiles}). Row by row: objects first, then the
|
|
1264
|
+
* row (a failed object delete keeps the row for the next round); concurrent replicas skip each
|
|
1265
|
+
* other's rows (`SKIP LOCKED`). Returns the rows deleted.
|
|
751
1266
|
*/
|
|
752
1267
|
async cleanupExpired() {
|
|
1268
|
+
const total = await this.cleanupStagingRows();
|
|
1269
|
+
// display files no version or staging lists (an abandoned import's), older than a staging
|
|
1270
|
+
try {
|
|
1271
|
+
await sweepDisplayFiles(this.db, PLUGIN_STAGING_TTL_MS);
|
|
1272
|
+
}
|
|
1273
|
+
catch (err) {
|
|
1274
|
+
this.log.warn("cannot sweep unused catalog display files", { err });
|
|
1275
|
+
}
|
|
1276
|
+
return total;
|
|
1277
|
+
}
|
|
1278
|
+
/** The expired staging rows, batch by batch; returns the rows deleted. */
|
|
1279
|
+
async cleanupStagingRows() {
|
|
753
1280
|
let total = 0;
|
|
754
1281
|
for (;;) {
|
|
755
1282
|
const batch = await this.db
|
|
@@ -786,7 +1313,7 @@ let PluginImport = class PluginImport {
|
|
|
786
1313
|
const t = this.db;
|
|
787
1314
|
const locked = await t
|
|
788
1315
|
.selectFrom("plugin_import_staging")
|
|
789
|
-
.select("id")
|
|
1316
|
+
.select(["id", "org_id", "review", "manifest"])
|
|
790
1317
|
.where("id", "=", r.id)
|
|
791
1318
|
.where("expires_at", "<=", sql `now()`)
|
|
792
1319
|
.forUpdate()
|
|
@@ -797,8 +1324,86 @@ let PluginImport = class PluginImport {
|
|
|
797
1324
|
if (r.object_prefix)
|
|
798
1325
|
await this.files.deployment().deletePrefix(r.object_prefix);
|
|
799
1326
|
await t.deleteFrom("plugin_import_staging").where("id", "=", r.id).execute();
|
|
1327
|
+
await this.dropOrgPackage(locked);
|
|
800
1328
|
return true;
|
|
801
1329
|
}
|
|
1330
|
+
/**
|
|
1331
|
+
* An expired org staging's extension package (an org upload stores it at prepare, P3-10): removed
|
|
1332
|
+
* with the staging unless something else uses it — an install (running or migrated), a catalog
|
|
1333
|
+
* version, another staging — or it was stored by anyone else (the package row's source must be
|
|
1334
|
+
* this staging's own `catalog` ref). A platform staging keeps its package, as before. Its object
|
|
1335
|
+
* is deleted after the commit.
|
|
1336
|
+
*/
|
|
1337
|
+
async dropOrgPackage(row) {
|
|
1338
|
+
const sha = row.review.extension?.sha256;
|
|
1339
|
+
if (row.org_id === null || sha === undefined)
|
|
1340
|
+
return;
|
|
1341
|
+
const staged = row.manifest;
|
|
1342
|
+
const t = this.db;
|
|
1343
|
+
const pkg = await t
|
|
1344
|
+
.selectFrom("extension_packages")
|
|
1345
|
+
.select("blob_store")
|
|
1346
|
+
.where("sha256", "=", sha)
|
|
1347
|
+
.where("source", "=", "catalog")
|
|
1348
|
+
.where("source_ref", "=", `${staged.itemId}@${staged.version}`)
|
|
1349
|
+
.forUpdate()
|
|
1350
|
+
.executeTakeFirst();
|
|
1351
|
+
if (!pkg)
|
|
1352
|
+
return;
|
|
1353
|
+
const used = (await t
|
|
1354
|
+
.selectFrom("extension_installs")
|
|
1355
|
+
.select("name")
|
|
1356
|
+
.where((eb) => eb.or([eb("sha256", "=", sha), eb("migrated_sha", "=", sha)]))
|
|
1357
|
+
.executeTakeFirst()) ??
|
|
1358
|
+
(await t
|
|
1359
|
+
.selectFrom("catalog_item_versions")
|
|
1360
|
+
.select("version")
|
|
1361
|
+
.where("extension_sha256", "=", sha)
|
|
1362
|
+
.executeTakeFirst()) ??
|
|
1363
|
+
(await t
|
|
1364
|
+
.selectFrom("plugin_import_staging")
|
|
1365
|
+
.select("id")
|
|
1366
|
+
.where(sql `review->'extension'->>'sha256' = ${sha}`)
|
|
1367
|
+
.executeTakeFirst());
|
|
1368
|
+
if (used !== undefined)
|
|
1369
|
+
return;
|
|
1370
|
+
const build = await t
|
|
1371
|
+
.selectFrom("extension_client_builds")
|
|
1372
|
+
.select("object_prefix")
|
|
1373
|
+
.where("package_sha256", "=", sha)
|
|
1374
|
+
.executeTakeFirst();
|
|
1375
|
+
// extension_blobs (a PG-stored package) and extension_client_builds go with the row (ON
|
|
1376
|
+
// DELETE CASCADE)
|
|
1377
|
+
await t.deleteFrom("extension_packages").where("sha256", "=", sha).execute();
|
|
1378
|
+
if (build !== undefined) {
|
|
1379
|
+
afterCommit(async () => {
|
|
1380
|
+
try {
|
|
1381
|
+
await this.clientBuilds.deleteFiles(sha, build.object_prefix);
|
|
1382
|
+
}
|
|
1383
|
+
catch (err) {
|
|
1384
|
+
this.log.warn("cannot delete an expired org upload's client build objects", {
|
|
1385
|
+
sha256: sha,
|
|
1386
|
+
err,
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
// The object only once the row is gone for good: a failure leaves an unreferenced object
|
|
1392
|
+
// (harmless; a later upload of the same bytes rewrites it), never a row without its bytes
|
|
1393
|
+
if (pkg.blob_store === "object") {
|
|
1394
|
+
afterCommit(async () => {
|
|
1395
|
+
try {
|
|
1396
|
+
await this.files.deployment().delete(blobKey(sha));
|
|
1397
|
+
}
|
|
1398
|
+
catch (err) {
|
|
1399
|
+
this.log.warn("cannot delete an expired org upload's extension package object", {
|
|
1400
|
+
sha256: sha,
|
|
1401
|
+
err,
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
802
1407
|
// ---------------------------------------------------------------------------------------------
|
|
803
1408
|
/** npm / marketplace imports: the package must be the one that was asked for. */
|
|
804
1409
|
checkExpected(pkg, expect, format = "capybara") {
|
|
@@ -837,7 +1442,6 @@ let PluginImport = class PluginImport {
|
|
|
837
1442
|
const m = pkg.manifest;
|
|
838
1443
|
const notLoaded = [];
|
|
839
1444
|
const templatePaths = new Map();
|
|
840
|
-
const pinned = new Map((m.skills ?? []).map((s) => [packagePath(s.path), s.pinned === true]));
|
|
841
1445
|
const problems = [];
|
|
842
1446
|
const stored = new Map();
|
|
843
1447
|
const keep = (path) => {
|
|
@@ -845,8 +1449,16 @@ let PluginImport = class PluginImport {
|
|
|
845
1449
|
if (data !== undefined && !stored.has(path))
|
|
846
1450
|
stored.set(path, fileOf(path, data));
|
|
847
1451
|
};
|
|
848
|
-
|
|
849
|
-
|
|
1452
|
+
const objectPaths = new Set();
|
|
1453
|
+
const keepObject = (path) => {
|
|
1454
|
+
keep(path);
|
|
1455
|
+
if (stored.has(path))
|
|
1456
|
+
objectPaths.add(path);
|
|
1457
|
+
};
|
|
1458
|
+
// The plugin icon and the setup guide documents (rendered by PluginGuides): display files
|
|
1459
|
+
const displayPaths = displayFilePaths(m, pkg.connectorTemplates.flatMap((c) => (c.file.icon === undefined ? [] : [c.file.icon])));
|
|
1460
|
+
for (const path of displayPaths)
|
|
1461
|
+
keep(path);
|
|
850
1462
|
const skills = [];
|
|
851
1463
|
for (const s of pkg.skills) {
|
|
852
1464
|
const files = s.files.map((f) => fileOf(f, pkg.files.get(`${s.dir}/${f}`)));
|
|
@@ -862,10 +1474,9 @@ let PluginImport = class PluginImport {
|
|
|
862
1474
|
body: "errors" in md ? "" : md.body,
|
|
863
1475
|
path: `./${s.dir}`,
|
|
864
1476
|
files: files.length,
|
|
865
|
-
suggestPinned: pinned.get(s.dir) === true,
|
|
866
1477
|
});
|
|
867
1478
|
for (const f of s.files)
|
|
868
|
-
|
|
1479
|
+
keepObject(`${s.dir}/${f}`);
|
|
869
1480
|
}
|
|
870
1481
|
catch (e) {
|
|
871
1482
|
if (!(e instanceof SkillArchiveError))
|
|
@@ -909,10 +1520,8 @@ let PluginImport = class PluginImport {
|
|
|
909
1520
|
else {
|
|
910
1521
|
problems.push(`${at}.connector: extension ${t.plugin} providing connector "${t.connector}" is not loaded in this deployment and is neither this plugin's extension nor a dependency`);
|
|
911
1522
|
}
|
|
912
|
-
|
|
1523
|
+
keepObject(c.path);
|
|
913
1524
|
templatePaths.set(c.id, c.path);
|
|
914
|
-
if (c.file.icon !== undefined)
|
|
915
|
-
keep(packagePath(c.file.icon));
|
|
916
1525
|
return {
|
|
917
1526
|
id: c.id,
|
|
918
1527
|
displayName: c.file.displayName,
|
|
@@ -926,43 +1535,89 @@ let PluginImport = class PluginImport {
|
|
|
926
1535
|
};
|
|
927
1536
|
});
|
|
928
1537
|
const agentTemplates = pkg.agentTemplates.map((a) => {
|
|
929
|
-
|
|
1538
|
+
keepObject(a.path);
|
|
930
1539
|
const { name, description, instructions, model, ...rest } = a.template;
|
|
931
1540
|
return { name, path: a.path, description, instructions, model: model ?? "inherit", ...rest };
|
|
932
1541
|
});
|
|
1542
|
+
// Themes: the file as written, the assets as sanitized by the reader (never the uploaded
|
|
1543
|
+
// originals: a shared path, e.g. the plugin icon, is stored sanitized too)
|
|
1544
|
+
const themes = pkg.themes.map((t) => {
|
|
1545
|
+
keepObject(t.path);
|
|
1546
|
+
for (const [path, data] of t.assets) {
|
|
1547
|
+
stored.set(path, fileOf(path, data));
|
|
1548
|
+
objectPaths.add(path);
|
|
1549
|
+
}
|
|
1550
|
+
const logo = t.theme.logo;
|
|
1551
|
+
return {
|
|
1552
|
+
id: t.id,
|
|
1553
|
+
name: t.theme.name,
|
|
1554
|
+
schemes: ["dark", "light"].filter((k) => t.theme.schemes[k] !== undefined),
|
|
1555
|
+
fonts: t.theme.fonts?.length ?? 0,
|
|
1556
|
+
logo: logo !== undefined && Object.keys(logo).length > 0,
|
|
1557
|
+
};
|
|
1558
|
+
});
|
|
933
1559
|
if (problems.length > 0)
|
|
934
1560
|
throw invalid(problems);
|
|
935
1561
|
return {
|
|
936
1562
|
files: [...stored.values()],
|
|
1563
|
+
displayPaths,
|
|
1564
|
+
objectPaths,
|
|
937
1565
|
templates,
|
|
938
1566
|
skills,
|
|
939
1567
|
agentTemplates,
|
|
1568
|
+
themes,
|
|
940
1569
|
notLoaded,
|
|
941
1570
|
templatePaths,
|
|
942
1571
|
};
|
|
943
1572
|
}
|
|
944
1573
|
/**
|
|
945
1574
|
* The highest imported, non-deleted catalog version satisfying each dependency's range (null when
|
|
946
|
-
* none does).
|
|
1575
|
+
* none does). An org upload (`owner`, P3-13) resolves only against items the org can use
|
|
1576
|
+
* ({@link usableBy}: confirmed, not disabled, offered to it), and any dependency left unresolved
|
|
1577
|
+
* -> 409 `plugin.dependency_unavailable` (details `[{ dependencies }]`, their names): an org
|
|
1578
|
+
* upload never brings in anything the org could not install itself.
|
|
947
1579
|
*/
|
|
948
|
-
async resolveDependencies(m) {
|
|
1580
|
+
async resolveDependencies(m, owner) {
|
|
949
1581
|
const deps = m.dependencies ?? [];
|
|
950
1582
|
if (deps.length === 0)
|
|
951
1583
|
return [];
|
|
952
|
-
const
|
|
1584
|
+
const names = deps.map((d) => d.name);
|
|
1585
|
+
const versions = this.db
|
|
953
1586
|
.selectFrom("catalog_items as i")
|
|
954
1587
|
.innerJoin("catalog_item_versions as v", "v.item_id", "i.id")
|
|
955
|
-
.select(["i.name", "v.version", "v.imported_at"])
|
|
956
1588
|
.where("i.deleted_at", "is", null)
|
|
957
|
-
.where("i.name", "in",
|
|
958
|
-
|
|
959
|
-
|
|
1589
|
+
.where("i.name", "in", names);
|
|
1590
|
+
const rows = owner === undefined
|
|
1591
|
+
? await versions.select(["i.name", "v.version", "v.imported_at"]).execute()
|
|
1592
|
+
: (await versions
|
|
1593
|
+
// the org's own row of a `named` list (usableBy reads whether it is listed)
|
|
1594
|
+
.leftJoin("catalog_item_scope_orgs as so", (j) => j.onRef("so.item_id", "=", "i.id").on("so.org_id", "=", owner.orgId))
|
|
1595
|
+
.select([
|
|
1596
|
+
"i.name",
|
|
1597
|
+
"v.version",
|
|
1598
|
+
"v.imported_at",
|
|
1599
|
+
"i.scope",
|
|
1600
|
+
"i.builtin",
|
|
1601
|
+
"i.disabled",
|
|
1602
|
+
"i.deleted_at",
|
|
1603
|
+
"i.awaiting_confirmation",
|
|
1604
|
+
"i.owner_org_id",
|
|
1605
|
+
"i.shareable",
|
|
1606
|
+
"so.org_id as listed",
|
|
1607
|
+
])
|
|
1608
|
+
.execute()).filter((r) => usableBy(r, owner.orgId, r.listed !== null));
|
|
1609
|
+
const resolved = deps.map((d) => ({
|
|
960
1610
|
name: d.name,
|
|
961
1611
|
range: d.version,
|
|
962
1612
|
resolved: maxSatisfying(rows
|
|
963
1613
|
.filter((r) => r.name === d.name)
|
|
964
1614
|
.map((r) => ({ version: r.version, importedAt: r.imported_at })), d.version)?.version ?? null,
|
|
965
1615
|
}));
|
|
1616
|
+
const missing = resolved.filter((d) => d.resolved === null).map((d) => d.name);
|
|
1617
|
+
if (owner !== undefined && missing.length > 0) {
|
|
1618
|
+
throw new ApiError("plugin.dependency_unavailable", `Dependencies not available to this organization: ${missing.join(", ")}`, [{ dependencies: missing }]);
|
|
1619
|
+
}
|
|
1620
|
+
return resolved;
|
|
966
1621
|
}
|
|
967
1622
|
/**
|
|
968
1623
|
* The extension's state on the deployment; installed from another npm package ->
|
|
@@ -980,7 +1635,7 @@ let PluginImport = class PluginImport {
|
|
|
980
1635
|
.where("extension_installs.name", "=", name)
|
|
981
1636
|
.executeTakeFirst();
|
|
982
1637
|
if (r && r.package_name !== packageName) {
|
|
983
|
-
throw new ApiError("extension.name_conflict", `Extension ${name} is already installed from package ${r.package_name}; package ${packageName} cannot use it
|
|
1638
|
+
throw new ApiError("extension.name_conflict", `Extension ${name} is already installed from package ${r.package_name}; package ${packageName} cannot use it`, [{ owner: await packageOwner(this.db, r.package_name, name) }]);
|
|
984
1639
|
}
|
|
985
1640
|
return r
|
|
986
1641
|
? { kind: "installed", version: r.version, sha256: r.sha256, packageName: r.package_name }
|
|
@@ -1002,7 +1657,7 @@ let PluginImport = class PluginImport {
|
|
|
1002
1657
|
name,
|
|
1003
1658
|
version: pkg.section.version,
|
|
1004
1659
|
sha256: pkg.sha256,
|
|
1005
|
-
...actionOf(state, pkg.sha256),
|
|
1660
|
+
...actionOf(state, pkg.sha256, pkg.section.version),
|
|
1006
1661
|
permissions,
|
|
1007
1662
|
added,
|
|
1008
1663
|
addedItems: permissionKeyItems(added),
|
|
@@ -1010,6 +1665,7 @@ let PluginImport = class PluginImport {
|
|
|
1010
1665
|
warnings,
|
|
1011
1666
|
reviewHash: extensionReviewHash(set, warnings),
|
|
1012
1667
|
sensitive: permissions.some((g) => g.sensitive) || warnings.length > 0,
|
|
1668
|
+
...(pkg.section.client !== undefined && { client: reviewClient(pkg) }),
|
|
1013
1669
|
};
|
|
1014
1670
|
}
|
|
1015
1671
|
async readStored(sha256) {
|
|
@@ -1027,10 +1683,11 @@ let PluginImport = class PluginImport {
|
|
|
1027
1683
|
.executeTakeFirstOrThrow();
|
|
1028
1684
|
const versions = await this.db
|
|
1029
1685
|
.selectFrom("catalog_item_versions")
|
|
1030
|
-
.select(["version", "source", "imported_at"])
|
|
1686
|
+
.select(["version", "source", "imported_at", "extension_sha256", "manifest", "source_format"])
|
|
1031
1687
|
.where("item_id", "=", itemId)
|
|
1032
1688
|
.execute();
|
|
1033
|
-
|
|
1689
|
+
const facts = await itemScopeFacts(this.db, [item], await itemConfirmations(this.admin, [item], new Map([[item.id, versions]])));
|
|
1690
|
+
return itemView(item, versions, 0, undefined, facts.get(item.id));
|
|
1034
1691
|
}
|
|
1035
1692
|
};
|
|
1036
1693
|
__decorate([
|
|
@@ -1054,41 +1711,46 @@ __decorate([
|
|
|
1054
1711
|
__decorate([
|
|
1055
1712
|
Transactional()
|
|
1056
1713
|
], PluginImport.prototype, "cleanupOne", null);
|
|
1714
|
+
__decorate([
|
|
1715
|
+
Transactional({ propagation: "mandatory" })
|
|
1716
|
+
], PluginImport.prototype, "dropOrgPackage", null);
|
|
1057
1717
|
PluginImport = __decorate([
|
|
1058
1718
|
Injectable(),
|
|
1059
1719
|
__param(0, Inject(KernelDb)),
|
|
1060
|
-
__param(1, Inject(
|
|
1061
|
-
__param(2, Inject(
|
|
1062
|
-
__param(3, Inject(
|
|
1063
|
-
__param(4, Inject(
|
|
1064
|
-
__param(5, Inject(
|
|
1065
|
-
__param(6, Inject(
|
|
1066
|
-
__param(7, Inject(
|
|
1067
|
-
__param(8, Inject(
|
|
1068
|
-
__param(9, Inject(
|
|
1069
|
-
__param(10, Inject(
|
|
1070
|
-
__param(11, Inject(
|
|
1071
|
-
__param(12, Inject(
|
|
1720
|
+
__param(1, Inject(SuperAdminLock)),
|
|
1721
|
+
__param(2, Inject(OrgLock)),
|
|
1722
|
+
__param(3, Inject(PluginInstallLock)),
|
|
1723
|
+
__param(4, Inject(PluginApproveLock)),
|
|
1724
|
+
__param(5, Inject(CatalogItemLock)),
|
|
1725
|
+
__param(6, Inject(KernelConfigService)),
|
|
1726
|
+
__param(7, Inject(StorageService)),
|
|
1727
|
+
__param(8, Inject(ExtensionInstalls)),
|
|
1728
|
+
__param(9, Inject(ExtensionAdminOps)),
|
|
1729
|
+
__param(10, Inject(ExtensionAdmin)),
|
|
1730
|
+
__param(11, Inject(ExtensionBlobs)),
|
|
1731
|
+
__param(12, Inject(ExtensionRegistry)),
|
|
1732
|
+
__param(13, Inject(KERNEL_LOGGER)),
|
|
1733
|
+
__param(14, Inject(TransactionHost)),
|
|
1734
|
+
__param(15, Inject(PlatformComponents)),
|
|
1735
|
+
__param(16, Inject(ClientBuilds)),
|
|
1736
|
+
__param(17, Inject(OutboxService))
|
|
1072
1737
|
], PluginImport);
|
|
1073
1738
|
export { PluginImport };
|
|
1074
1739
|
/**
|
|
1075
1740
|
* plugin.json as stored on the version: skills and connector templates listed explicitly (what was
|
|
1076
|
-
* scanned when the manifest omitted them)
|
|
1741
|
+
* scanned when the manifest omitted them).
|
|
1077
1742
|
*/
|
|
1078
1743
|
function normalizedManifest(pkg) {
|
|
1079
|
-
const
|
|
1080
|
-
const { agents: _, ...manifest } = pkg.manifest;
|
|
1744
|
+
const { agents: _, themes: __, ...manifest } = pkg.manifest;
|
|
1081
1745
|
return {
|
|
1082
1746
|
...manifest,
|
|
1083
|
-
skills: pkg.skills.map((s) => {
|
|
1084
|
-
const p = pinned.get(s.dir);
|
|
1085
|
-
return { path: `./${s.dir}`, ...(p !== undefined && { pinned: p }) };
|
|
1086
|
-
}),
|
|
1747
|
+
skills: pkg.skills.map((s) => ({ path: `./${s.dir}` })),
|
|
1087
1748
|
connectorTemplates: pkg.connectorTemplates.map((t) => ({ path: `./${t.path}` })),
|
|
1088
1749
|
// listed only when there are any, so the stored manifests of other plugins stay as they were
|
|
1089
1750
|
...(pkg.agentTemplates.length > 0 && {
|
|
1090
1751
|
agents: pkg.agentTemplates.map((a) => ({ path: `./${a.path}` })),
|
|
1091
1752
|
}),
|
|
1753
|
+
...(pkg.themes.length > 0 && { themes: pkg.themes.map((t) => ({ path: `./${t.path}` })) }),
|
|
1092
1754
|
};
|
|
1093
1755
|
}
|
|
1094
1756
|
/** package.json `name`, or null without one (a git plugin; never the string "undefined"). */
|
|
@@ -1097,13 +1759,20 @@ function packageNameOf(pkg) {
|
|
|
1097
1759
|
return typeof name === "string" ? name : null;
|
|
1098
1760
|
}
|
|
1099
1761
|
/** The extension's deployment state -> action and current version. */
|
|
1100
|
-
function actionOf(s, sha256) {
|
|
1762
|
+
function actionOf(s, sha256, version) {
|
|
1101
1763
|
if (s.kind === "installed") {
|
|
1764
|
+
// A version below the deployed one is recorded in the catalog only: an import never
|
|
1765
|
+
// downgrades the deployment (ruling H)
|
|
1766
|
+
const older = s.sha256 !== sha256 &&
|
|
1767
|
+
semver.valid(version) !== null &&
|
|
1768
|
+
semver.valid(s.version) !== null &&
|
|
1769
|
+
semver.lt(version, s.version);
|
|
1102
1770
|
return {
|
|
1103
|
-
action: s.sha256 === sha256 ? "keep" : "upgrade",
|
|
1771
|
+
action: s.sha256 === sha256 || older ? "keep" : "upgrade",
|
|
1104
1772
|
deployed: true,
|
|
1105
1773
|
currentVersion: s.version,
|
|
1106
1774
|
currentSha256: s.sha256,
|
|
1775
|
+
...(older && { olderThanDeployed: true }),
|
|
1107
1776
|
};
|
|
1108
1777
|
}
|
|
1109
1778
|
return { action: "install", deployed: false, currentVersion: null, currentSha256: null };
|
|
@@ -1113,13 +1782,17 @@ function actionOf(s, sha256) {
|
|
|
1113
1782
|
* current version / package, its own review digest), every template field, each skill's name / path
|
|
1114
1783
|
* / file count, the dependency resolution, the sha256 of every stored file, the format, the
|
|
1115
1784
|
* translation report's items, the sha256 of the license text and the two review flags
|
|
1116
|
-
* (`claudeManifestIgnored`, `licenseTruncated`),
|
|
1785
|
+
* (`claudeManifestIgnored`, `licenseTruncated`), the agent templates when there are any and the
|
|
1786
|
+
* themes when there are any.
|
|
1117
1787
|
* Exported for tests. `repository` is display only.
|
|
1118
1788
|
*/
|
|
1119
1789
|
export function pluginReviewHash(r, files) {
|
|
1120
1790
|
const e = r.extension;
|
|
1121
1791
|
const lic = r.licenseText;
|
|
1122
|
-
|
|
1792
|
+
// canonicalJson, not JSON.stringify: the review is stored as jsonb, which reorders object keys,
|
|
1793
|
+
// so a template's auth / endpoint object would hash differently at confirm (plugin.review_stale
|
|
1794
|
+
// on every import of a plugin whose connector template has a non-trivial auth block).
|
|
1795
|
+
const canonical = canonicalJson([
|
|
1123
1796
|
r.name,
|
|
1124
1797
|
r.version,
|
|
1125
1798
|
r.contentDigest,
|
|
@@ -1146,9 +1819,34 @@ export function pluginReviewHash(r, files) {
|
|
|
1146
1819
|
...((r.agentTemplates ?? []).length > 0
|
|
1147
1820
|
? [(r.agentTemplates ?? []).map((a) => [a.path, canonicalJson(a)])]
|
|
1148
1821
|
: []),
|
|
1822
|
+
// themes, only when there are any, tagged (never read as agent templates)
|
|
1823
|
+
...((r.themes ?? []).length > 0
|
|
1824
|
+
? [{ themes: (r.themes ?? []).map((t) => [t.id, canonicalJson(t)]) }]
|
|
1825
|
+
: []),
|
|
1149
1826
|
]);
|
|
1150
1827
|
return createHash("sha256").update(canonical).digest("hex").slice(0, 32);
|
|
1151
1828
|
}
|
|
1829
|
+
/** The client code of a read extension package for its review (sizes from the package's files). */
|
|
1830
|
+
function reviewClient(pkg) {
|
|
1831
|
+
const c = pkg.section.client;
|
|
1832
|
+
const sizes = new Map(pkg.files.map((f) => [f.path, f.size]));
|
|
1833
|
+
const files = [
|
|
1834
|
+
...(c.entry !== undefined ? [c.entry] : []),
|
|
1835
|
+
...(c.styles ?? []),
|
|
1836
|
+
...(c.assets ?? []),
|
|
1837
|
+
].map((path) => {
|
|
1838
|
+
// checkClientFiles ran first: every listed file is in the package
|
|
1839
|
+
const size = sizes.get(path.slice(2));
|
|
1840
|
+
if (size === undefined)
|
|
1841
|
+
throw new Error(`client file ${path} is not in the package`);
|
|
1842
|
+
return { path, size };
|
|
1843
|
+
});
|
|
1844
|
+
return {
|
|
1845
|
+
files,
|
|
1846
|
+
totalBytes: files.reduce((n, f) => n + f.size, 0),
|
|
1847
|
+
apiVersion: c.apiVersion,
|
|
1848
|
+
};
|
|
1849
|
+
}
|
|
1152
1850
|
/**
|
|
1153
1851
|
* A version change that is a downgrade (the imported version below the installed one) whose
|
|
1154
1852
|
* version has migrations not run on this deployment -> `extension.downgrade_unsupported` (the same
|
|
@@ -1183,26 +1881,22 @@ function licenseOf(files) {
|
|
|
1183
1881
|
return { truncated: false };
|
|
1184
1882
|
}
|
|
1185
1883
|
/**
|
|
1186
|
-
* The
|
|
1187
|
-
*
|
|
1188
|
-
* undefined keeps the plugin's flags.
|
|
1884
|
+
* The staging rows a route may see (P3-8): the platform's (`org_id` null) without an owner, else
|
|
1885
|
+
* the owner org's.
|
|
1189
1886
|
*/
|
|
1190
|
-
function
|
|
1191
|
-
|
|
1192
|
-
return m;
|
|
1193
|
-
const byName = new Map(review.skills.map((s) => [s.name, s.path]));
|
|
1194
|
-
const unknown = names.filter((n) => !byName.has(n));
|
|
1195
|
-
if (unknown.length > 0) {
|
|
1196
|
-
throw new ApiError("validation_failed", `pinnedSuggestions: ${unknown.map((n) => JSON.stringify(n)).join(", ")} ${unknown.length === 1 ? "is not a skill" : "are not skills"} of this plugin`);
|
|
1197
|
-
}
|
|
1198
|
-
const paths = new Set(names.map((n) => byName.get(n)));
|
|
1199
|
-
return {
|
|
1200
|
-
...m,
|
|
1201
|
-
skills: (m.skills ?? []).map(({ pinned: _, ...s }) => paths.has(s.path) ? { ...s, pinned: true } : s),
|
|
1202
|
-
};
|
|
1887
|
+
function ownStaging(owner) {
|
|
1888
|
+
return (eb) => owner === undefined ? eb("org_id", "is", null) : eb("org_id", "=", owner.orgId);
|
|
1203
1889
|
}
|
|
1204
|
-
/**
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1890
|
+
/**
|
|
1891
|
+
* An org upload's custom deny, by content (ruling P3-15'): skills or agent templates ->
|
|
1892
|
+
* `customSkills`, connector templates -> `customConnectors`; each `deny` -> 403
|
|
1893
|
+
* `catalog.custom_disabled`. A package carrying neither passes; themes are covered by neither
|
|
1894
|
+
* switch (themes spec §6), so a themes-only upload passes.
|
|
1895
|
+
*/
|
|
1896
|
+
async function assertCustomContent(db, content) {
|
|
1897
|
+
if (content.skills.length > 0 || content.agentTemplates.length > 0) {
|
|
1898
|
+
await assertCustomAllowed(db, "customSkills");
|
|
1899
|
+
}
|
|
1900
|
+
if (content.templates.length > 0)
|
|
1901
|
+
await assertCustomAllowed(db, "customConnectors");
|
|
1208
1902
|
}
|