@capybara-hq/kernel 0.1.0-rc.1 → 0.1.0-rc.100
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 +113 -6
- 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 +66 -89
- package/dist/admin/admin.controller.js +153 -92
- package/dist/admin/admin.module.d.ts +8 -0
- package/dist/admin/admin.module.js +92 -0
- package/dist/admin/admin.schemas.d.ts +110 -0
- package/dist/admin/admin.schemas.js +54 -0
- package/dist/admin/audit-log.service.d.ts +52 -0
- package/dist/admin/audit-log.service.js +81 -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 +72 -18
- package/dist/admin/extensions.controller.js +144 -26
- package/dist/admin/extensions.schemas.d.ts +28 -0
- package/dist/admin/extensions.schemas.js +49 -0
- package/dist/admin/health.service.d.ts +111 -0
- package/dist/admin/health.service.js +286 -0
- package/dist/admin/limit-defaults.d.ts +20 -0
- package/dist/admin/limit-defaults.js +10 -0
- package/dist/admin/login-sources.controller.d.ts +30 -0
- package/dist/admin/login-sources.controller.js +77 -0
- package/dist/admin/login-sources.schemas.d.ts +25 -0
- package/dist/admin/login-sources.schemas.js +49 -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 +43 -0
- package/dist/admin/org-network.service.js +109 -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 +264 -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 +16 -0
- package/dist/admin/setup-lock.js +47 -0
- package/dist/admin/setup.controller.d.ts +9 -9
- package/dist/admin/setup.controller.js +28 -26
- package/dist/admin/setup.service.d.ts +20 -28
- package/dist/admin/setup.service.js +65 -65
- package/dist/admin/usage.service.d.ts +149 -0
- package/dist/admin/usage.service.js +321 -0
- package/dist/agents/admin-agents.d.ts +106 -0
- package/dist/agents/admin-agents.js +234 -0
- package/dist/agents/agent-lookup.d.ts +80 -0
- package/dist/agents/agent-lookup.js +223 -0
- package/dist/agents/agent-profile.service.d.ts +34 -0
- package/dist/agents/agent-profile.service.js +136 -0
- package/dist/agents/agents.controller.d.ts +48 -171
- package/dist/agents/agents.controller.js +167 -40
- package/dist/agents/agents.module.d.ts +11 -0
- package/dist/agents/agents.module.js +84 -0
- package/dist/agents/agents.schemas.d.ts +450 -0
- package/dist/agents/agents.schemas.js +145 -0
- package/dist/agents/agents.service.d.ts +171 -78
- package/dist/agents/agents.service.js +704 -409
- package/dist/agents/avatar-view.d.ts +8 -0
- package/dist/agents/avatar-view.js +12 -0
- package/dist/agents/definition.d.ts +153 -24
- package/dist/agents/definition.js +246 -57
- 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/instruction-files.d.ts +60 -0
- package/dist/agents/instruction-files.js +108 -0
- package/dist/agents/models.controller.d.ts +44 -6
- package/dist/agents/models.controller.js +84 -8
- package/dist/agents/org-templates.d.ts +186 -0
- package/dist/agents/org-templates.js +929 -0
- package/dist/agents/pending-connector-requests.d.ts +79 -0
- package/dist/agents/pending-connector-requests.js +221 -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 +284 -0
- package/dist/agents/profile.d.ts +139 -0
- package/dist/agents/profile.js +66 -0
- package/dist/agents/readiness.controller.d.ts +16 -0
- package/dist/agents/readiness.controller.js +43 -0
- package/dist/agents/readiness.service.d.ts +81 -0
- package/dist/agents/readiness.service.js +121 -0
- package/dist/agents/templates.controller.d.ts +78 -6
- package/dist/agents/templates.controller.js +154 -8
- package/dist/agents/templates.d.ts +132 -30
- package/dist/agents/templates.js +489 -46
- package/dist/agents/templates.schemas.d.ts +20 -0
- package/dist/agents/templates.schemas.js +45 -0
- package/dist/app.d.ts +99 -0
- package/dist/app.js +154 -0
- package/dist/attribution/platform-attribution.d.ts +113 -0
- package/dist/attribution/platform-attribution.js +166 -0
- package/dist/background/background.controller.d.ts +38 -0
- package/dist/background/background.controller.js +88 -0
- package/dist/background/background.module.d.ts +10 -0
- package/dist/background/background.module.js +39 -0
- package/dist/background/background.schemas.d.ts +10 -0
- package/dist/background/background.schemas.js +16 -0
- package/dist/background/finish.d.ts +57 -0
- package/dist/background/finish.js +163 -0
- package/dist/background/launch-lock.d.ts +15 -0
- package/dist/background/launch-lock.js +40 -0
- package/dist/background/launch.d.ts +54 -0
- package/dist/background/launch.js +93 -0
- package/dist/background/managed-output.d.ts +110 -0
- package/dist/background/managed-output.js +219 -0
- package/dist/background/managed.d.ts +56 -0
- package/dist/background/managed.js +131 -0
- package/dist/background/poll.job.d.ts +96 -0
- package/dist/background/poll.job.js +357 -0
- package/dist/background/render.d.ts +32 -0
- package/dist/background/render.js +68 -0
- package/dist/background/retire-legacy-tasks.job.d.ts +57 -0
- package/dist/background/retire-legacy-tasks.job.js +149 -0
- package/dist/background/session.d.ts +7 -0
- package/dist/background/session.js +7 -0
- package/dist/background/stop.d.ts +130 -0
- package/dist/background/stop.js +393 -0
- package/dist/background/store.d.ts +272 -0
- package/dist/background/store.js +589 -0
- package/dist/background/store.module.d.ts +6 -0
- package/dist/background/store.module.js +22 -0
- package/dist/background/tasks.service.d.ts +131 -0
- package/dist/background/tasks.service.js +285 -0
- package/dist/background/wake-rules.d.ts +71 -0
- package/dist/background/wake-rules.js +126 -0
- package/dist/background/wake.d.ts +30 -0
- package/dist/background/wake.js +63 -0
- package/dist/catalog/admin-catalog.controller.d.ts +167 -60
- package/dist/catalog/admin-catalog.controller.js +347 -75
- package/dist/catalog/admin-catalog.schemas.d.ts +89 -0
- package/dist/catalog/admin-catalog.schemas.js +113 -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 +296 -0
- package/dist/catalog/catalog-content.js +382 -0
- 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 +301 -0
- package/dist/catalog/catalog-items.js +702 -0
- package/dist/catalog/catalog-scope.service.d.ts +312 -0
- package/dist/catalog/catalog-scope.service.js +1265 -0
- package/dist/catalog/catalog.module.d.ts +15 -0
- package/dist/catalog/catalog.module.js +108 -0
- package/dist/catalog/catalog.service.d.ts +162 -205
- package/dist/catalog/catalog.service.js +299 -536
- package/dist/catalog/claude/agents.js +15 -10
- package/dist/catalog/claude/report.d.ts +9 -2
- package/dist/catalog/claude/report.js +1 -0
- package/dist/catalog/claude/translate.js +5 -2
- package/dist/catalog/cli.d.ts +11 -3
- package/dist/catalog/cli.js +23 -32
- package/dist/catalog/component-promotion.d.ts +96 -0
- package/dist/catalog/component-promotion.js +396 -0
- package/dist/catalog/component-scope.controller.d.ts +96 -0
- package/dist/catalog/component-scope.controller.js +262 -0
- package/dist/catalog/component-scope.schemas.d.ts +118 -0
- package/dist/catalog/component-scope.schemas.js +99 -0
- package/dist/catalog/component-scope.service.d.ts +399 -0
- package/dist/catalog/component-scope.service.js +1150 -0
- package/dist/catalog/component-state.d.ts +242 -0
- package/dist/catalog/component-state.js +532 -0
- package/dist/catalog/credential-key.d.ts +10 -0
- package/dist/catalog/credential-key.js +28 -0
- package/dist/catalog/git-source.d.ts +30 -1
- package/dist/catalog/git-source.js +86 -13
- package/dist/catalog/install-status.d.ts +6 -0
- package/dist/catalog/install-status.js +6 -0
- package/dist/catalog/job-ids.d.ts +58 -0
- package/dist/catalog/job-ids.js +60 -0
- package/dist/catalog/jobs.d.ts +36 -0
- package/dist/catalog/jobs.js +91 -0
- package/dist/catalog/locks.d.ts +24 -0
- package/dist/catalog/locks.js +63 -0
- package/dist/catalog/marketplace-fetch.d.ts +16 -4
- package/dist/catalog/marketplace-fetch.js +14 -7
- package/dist/catalog/marketplace-icons.d.ts +64 -0
- package/dist/catalog/marketplace-icons.js +131 -0
- package/dist/catalog/marketplaces.controller.d.ts +56 -46
- package/dist/catalog/marketplaces.controller.js +151 -53
- package/dist/catalog/marketplaces.schemas.d.ts +55 -0
- package/dist/catalog/marketplaces.schemas.js +66 -0
- package/dist/catalog/marketplaces.service.d.ts +202 -33
- package/dist/catalog/marketplaces.service.js +867 -300
- package/dist/catalog/org-catalog.controller.d.ts +104 -65
- package/dist/catalog/org-catalog.controller.js +210 -102
- package/dist/catalog/org-catalog.schemas.d.ts +128 -0
- package/dist/catalog/org-catalog.schemas.js +173 -0
- package/dist/catalog/org-catalog.service.d.ts +100 -216
- package/dist/catalog/org-catalog.service.js +464 -479
- package/dist/catalog/org-extension-switch.d.ts +41 -0
- package/dist/catalog/org-extension-switch.js +123 -0
- package/dist/catalog/org-extension.controller.d.ts +113 -0
- package/dist/catalog/org-extension.controller.js +276 -0
- package/dist/catalog/org-extension.schemas.d.ts +45 -0
- package/dist/catalog/org-extension.schemas.js +85 -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 +32 -0
- package/dist/catalog/owned-items.d.ts +181 -0
- package/dist/catalog/owned-items.js +797 -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 +328 -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 +381 -79
- package/dist/catalog/plugin-import.js +1213 -336
- package/dist/catalog/plugin-install.d.ts +337 -142
- package/dist/catalog/plugin-install.js +1278 -508
- package/dist/catalog/plugin-package.d.ts +55 -13
- package/dist/catalog/plugin-package.js +227 -33
- package/dist/catalog/plugin-upgrade.d.ts +405 -188
- package/dist/catalog/plugin-upgrade.js +1559 -1079
- package/dist/catalog/request-rules.d.ts +65 -0
- package/dist/catalog/request-rules.js +223 -0
- package/dist/catalog/requests.service.d.ts +266 -116
- package/dist/catalog/requests.service.js +819 -355
- package/dist/catalog/reserved-names.d.ts +8 -0
- package/dist/catalog/reserved-names.js +36 -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 +67 -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 +100 -0
- package/dist/catalog/scope-sync.d.ts +154 -0
- package/dist/catalog/scope-sync.js +512 -0
- package/dist/catalog/scope.d.ts +42 -0
- package/dist/catalog/scope.js +42 -0
- package/dist/catalog/template-connector-ensure.d.ts +100 -0
- package/dist/catalog/template-connector-ensure.js +285 -0
- package/dist/catalog/template-connector-jobs.d.ts +28 -0
- package/dist/catalog/template-connector-jobs.js +54 -0
- package/dist/catalog/template-connector-reconcile.d.ts +44 -0
- package/dist/catalog/template-connector-reconcile.js +114 -0
- package/dist/catalog/template-connectors.processor.d.ts +32 -0
- package/dist/catalog/template-connectors.processor.js +101 -0
- package/dist/catalog/template-description.d.ts +17 -0
- package/dist/catalog/template-description.js +18 -0
- package/dist/catalog/unshare.d.ts +21 -0
- package/dist/catalog/unshare.js +119 -0
- package/dist/channels/actions.d.ts +8 -4
- package/dist/channels/actions.js +53 -9
- package/dist/channels/cards.d.ts +97 -12
- package/dist/channels/cards.js +292 -28
- package/dist/channels/channels.module.d.ts +44 -0
- package/dist/channels/channels.module.js +153 -0
- package/dist/channels/channels.schemas.d.ts +54 -0
- package/dist/channels/channels.schemas.js +55 -0
- package/dist/channels/connections.controller.d.ts +46 -37
- package/dist/channels/connections.controller.js +85 -38
- package/dist/channels/connections.service.d.ts +184 -35
- package/dist/channels/connections.service.js +554 -156
- package/dist/channels/deliver-job.d.ts +32 -0
- package/dist/channels/deliver-job.js +29 -0
- package/dist/channels/features.d.ts +20 -1
- package/dist/channels/features.js +31 -5
- package/dist/channels/file-delivery.d.ts +76 -0
- package/dist/channels/file-delivery.js +176 -0
- package/dist/channels/inbound.d.ts +54 -64
- package/dist/channels/inbound.js +246 -61
- package/dist/channels/job-ids.d.ts +6 -0
- package/dist/channels/job-ids.js +6 -0
- package/dist/channels/jobs.d.ts +102 -0
- package/dist/channels/jobs.js +210 -0
- package/dist/channels/outbound.d.ts +119 -82
- package/dist/channels/outbound.js +1080 -229
- package/dist/channels/phrases.d.ts +263 -10
- package/dist/channels/phrases.js +220 -10
- package/dist/channels/progress.d.ts +75 -0
- package/dist/channels/progress.js +216 -0
- package/dist/channels/supervisor.d.ts +89 -46
- package/dist/channels/supervisor.js +234 -132
- package/dist/channels/threads.d.ts +47 -8
- package/dist/channels/threads.js +115 -13
- package/dist/channels/webhook.d.ts +40 -14
- package/dist/channels/webhook.js +86 -20
- 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 +106 -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/fields.js +20 -4
- package/dist/config/load.d.ts +35 -4
- package/dist/config/load.js +108 -6
- package/dist/config/nacos-source.js +11 -2
- package/dist/config/permission-migration.d.ts +34 -0
- package/dist/config/permission-migration.js +115 -0
- package/dist/config/product-name.d.ts +8 -0
- package/dist/config/product-name.js +9 -0
- package/dist/config/schema.d.ts +171 -49
- package/dist/config/schema.js +924 -137
- package/dist/conversations/access.d.ts +40 -0
- package/dist/conversations/access.js +120 -0
- package/dist/conversations/agent-tree.d.ts +62 -0
- package/dist/conversations/agent-tree.js +128 -0
- package/dist/conversations/approval-profile.d.ts +30 -0
- package/dist/conversations/approval-profile.js +62 -0
- package/dist/conversations/artifacts.d.ts +11 -11
- package/dist/conversations/artifacts.js +36 -10
- package/dist/conversations/attachments.controller.d.ts +12 -4
- package/dist/conversations/attachments.controller.js +25 -10
- package/dist/conversations/attachments.module.d.ts +7 -0
- package/dist/conversations/attachments.module.js +25 -0
- package/dist/conversations/attachments.service.d.ts +226 -29
- package/dist/conversations/attachments.service.js +806 -160
- package/dist/conversations/conversations.controller.d.ts +115 -85
- package/dist/conversations/conversations.controller.js +237 -131
- package/dist/conversations/conversations.module.d.ts +8 -0
- package/dist/conversations/conversations.module.js +88 -0
- package/dist/conversations/conversations.schemas.d.ts +73 -0
- package/dist/conversations/conversations.schemas.js +105 -0
- package/dist/conversations/conversations.service.d.ts +416 -64
- package/dist/conversations/conversations.service.js +894 -219
- package/dist/conversations/delivery-scope.d.ts +34 -0
- package/dist/conversations/delivery-scope.js +23 -0
- package/dist/conversations/device-status.d.ts +24 -0
- package/dist/conversations/device-status.js +71 -0
- package/dist/conversations/event-log.d.ts +124 -27
- package/dist/conversations/event-log.js +291 -32
- package/dist/conversations/event-people.d.ts +12 -0
- package/dist/conversations/event-people.js +28 -0
- package/dist/conversations/events.d.ts +1305 -34
- package/dist/conversations/events.js +1285 -95
- package/dist/conversations/files.d.ts +91 -21
- package/dist/conversations/files.js +244 -61
- package/dist/conversations/idem-keys.d.ts +5 -0
- package/dist/conversations/idem-keys.js +5 -0
- package/dist/conversations/leak-check.d.ts +26 -0
- package/dist/conversations/leak-check.js +69 -0
- 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/model-image.d.ts +39 -0
- package/dist/conversations/model-image.js +80 -0
- package/dist/conversations/outputs-read.d.ts +11 -11
- package/dist/conversations/outputs-read.js +31 -7
- package/dist/conversations/permission-profile-store.d.ts +50 -0
- package/dist/conversations/permission-profile-store.js +67 -0
- package/dist/conversations/permission-profile-store.module.d.ts +2 -0
- package/dist/conversations/permission-profile-store.module.js +19 -0
- package/dist/conversations/permission-profiles.controller.d.ts +97 -0
- package/dist/conversations/permission-profiles.controller.js +105 -0
- package/dist/conversations/permission-profiles.schemas.d.ts +31 -0
- package/dist/conversations/permission-profiles.schemas.js +23 -0
- package/dist/conversations/permission-profiles.service.d.ts +69 -0
- package/dist/conversations/permission-profiles.service.js +191 -0
- package/dist/conversations/prompt-suggestion-request.d.ts +95 -0
- package/dist/conversations/prompt-suggestion-request.js +213 -0
- package/dist/conversations/prompt-suggestion-store.d.ts +51 -0
- package/dist/conversations/prompt-suggestion-store.js +136 -0
- package/dist/conversations/prompt-suggestions.d.ts +153 -0
- package/dist/conversations/prompt-suggestions.js +565 -0
- package/dist/conversations/queue.d.ts +70 -60
- package/dist/conversations/queue.js +65 -294
- package/dist/conversations/queue.service.d.ts +71 -0
- package/dist/conversations/queue.service.js +419 -0
- package/dist/conversations/source.d.ts +10 -0
- package/dist/conversations/source.js +19 -0
- package/dist/conversations/titles.d.ts +97 -28
- package/dist/conversations/titles.js +250 -83
- package/dist/conversations/tree.d.ts +27 -0
- package/dist/conversations/tree.js +83 -0
- package/dist/ctx/bus.js +11 -3
- package/dist/ctx/create-ctx.d.ts +136 -11
- package/dist/ctx/create-ctx.js +394 -67
- package/dist/ctx/device-provider-check.d.ts +11 -0
- package/dist/ctx/device-provider-check.js +36 -0
- package/dist/ctx/lock.d.ts +7 -3
- package/dist/ctx/lock.js +9 -20
- package/dist/ctx/net.d.ts +50 -0
- package/dist/ctx/net.js +67 -0
- package/dist/ctx/queue.js +4 -2
- package/dist/ctx/secrets.d.ts +47 -3
- package/dist/ctx/secrets.js +142 -28
- package/dist/db/kernel-schema.d.ts +1305 -44
- package/dist/db/pool.d.ts +16 -0
- package/dist/db/pool.js +7 -2
- package/dist/device-access/conversation-notice-delivery.d.ts +116 -0
- package/dist/device-access/conversation-notice-delivery.js +344 -0
- package/dist/device-access/conversation-notices.d.ts +27 -0
- package/dist/device-access/conversation-notices.js +42 -0
- package/dist/device-access/device-access.module.d.ts +7 -0
- package/dist/device-access/device-access.module.js +41 -0
- package/dist/device-access/device-access.service.d.ts +188 -0
- package/dist/device-access/device-access.service.js +695 -0
- package/dist/device-access/token.d.ts +6 -0
- package/dist/device-access/token.js +6 -0
- package/dist/device-access/viewer-routes.d.ts +45 -0
- package/dist/device-access/viewer-routes.js +81 -0
- package/dist/device-access/viewer.d.ts +247 -0
- package/dist/device-access/viewer.js +858 -0
- package/dist/devices/access.d.ts +35 -0
- package/dist/devices/access.js +76 -0
- package/dist/devices/access.module.d.ts +2 -0
- package/dist/devices/access.module.js +19 -0
- package/dist/devices/conversation-devices.d.ts +159 -0
- package/dist/devices/conversation-devices.js +352 -0
- package/dist/devices/default-provider-setting.d.ts +45 -0
- package/dist/devices/default-provider-setting.js +59 -0
- package/dist/devices/device-projects.service.d.ts +148 -0
- package/dist/devices/device-projects.service.js +471 -0
- package/dist/devices/device-provider-selection.d.ts +36 -0
- package/dist/devices/device-provider-selection.js +85 -0
- package/dist/devices/device-provider-selection.module.d.ts +3 -0
- package/dist/devices/device-provider-selection.module.js +22 -0
- package/dist/devices/devices.controller.d.ts +55 -0
- package/dist/devices/devices.controller.js +182 -0
- package/dist/devices/devices.module.d.ts +8 -0
- package/dist/devices/devices.module.js +53 -0
- package/dist/devices/devices.schemas.d.ts +7 -0
- package/dist/devices/devices.schemas.js +26 -0
- package/dist/devices/devices.service.d.ts +492 -0
- package/dist/devices/devices.service.js +1196 -0
- package/dist/devices/dto.d.ts +104 -0
- package/dist/devices/dto.js +101 -0
- package/dist/devices/errors.d.ts +14 -0
- package/dist/devices/errors.js +14 -0
- package/dist/devices/label.d.ts +9 -0
- package/dist/devices/label.js +14 -0
- package/dist/devices/legacy-cleanup.job.d.ts +34 -0
- package/dist/devices/legacy-cleanup.job.js +147 -0
- package/dist/devices/project-rules.d.ts +30 -0
- package/dist/devices/project-rules.js +16 -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 +43 -0
- package/dist/devices/working-root.js +56 -0
- package/dist/dial-in/access.d.ts +45 -0
- package/dist/dial-in/access.js +90 -0
- package/dist/dial-in/auth.controller.d.ts +48 -0
- package/dist/dial-in/auth.controller.js +131 -0
- package/dist/dial-in/auth.module.d.ts +7 -0
- package/dist/dial-in/auth.module.js +27 -0
- package/dist/dial-in/auth.service.d.ts +158 -0
- package/dist/dial-in/auth.service.js +475 -0
- package/dist/dial-in/dial-in.module.d.ts +9 -0
- package/dist/dial-in/dial-in.module.js +37 -0
- package/dist/dial-in/dto.d.ts +81 -0
- package/dist/dial-in/dto.js +56 -0
- package/dist/dial-in/envelope.d.ts +95 -0
- package/dist/dial-in/envelope.js +89 -0
- package/dist/dial-in/gateway.d.ts +273 -0
- package/dist/dial-in/gateway.js +1064 -0
- package/dist/dial-in/handlers.d.ts +56 -0
- package/dist/dial-in/handlers.js +100 -0
- package/dist/dial-in/keys.d.ts +37 -0
- package/dist/dial-in/keys.js +37 -0
- package/dist/dial-in/machines.d.ts +144 -0
- package/dist/dial-in/machines.js +337 -0
- package/dist/dial-in/relay.d.ts +167 -0
- package/dist/dial-in/relay.js +517 -0
- package/dist/dial-in/relay.module.d.ts +7 -0
- package/dist/dial-in/relay.module.js +24 -0
- package/dist/dial-in/routes.d.ts +56 -0
- package/dist/dial-in/routes.js +133 -0
- package/dist/dial-in/streams.d.ts +66 -0
- package/dist/dial-in/streams.js +296 -0
- package/dist/dial-in/targets.d.ts +45 -0
- package/dist/dial-in/targets.js +91 -0
- package/dist/errors.d.ts +462 -10
- package/dist/errors.js +462 -10
- package/dist/evals/budget.d.ts +42 -21
- package/dist/evals/budget.js +127 -62
- package/dist/evals/evals.module.d.ts +31 -0
- package/dist/evals/evals.module.js +127 -0
- package/dist/evals/evals.schemas.d.ts +110 -0
- package/dist/evals/evals.schemas.js +107 -0
- package/dist/evals/jobs.d.ts +28 -0
- package/dist/evals/jobs.js +47 -0
- package/dist/evals/plan.d.ts +20 -15
- package/dist/evals/plan.js +29 -6
- package/dist/evals/reconstruct.d.ts +104 -32
- package/dist/evals/reconstruct.js +208 -79
- package/dist/evals/recorded-permission-context.d.ts +79 -0
- package/dist/evals/recorded-permission-context.js +157 -0
- package/dist/evals/recorded-tools.d.ts +26 -1
- package/dist/evals/recorded-tools.js +55 -8
- package/dist/evals/run-replay.d.ts +103 -13
- package/dist/evals/run-replay.js +298 -109
- package/dist/evals/runs.controller.d.ts +3 -58
- package/dist/evals/runs.controller.js +18 -50
- package/dist/evals/runs.service.d.ts +32 -54
- package/dist/evals/runs.service.js +274 -264
- package/dist/evals/sets.controller.d.ts +3 -29
- package/dist/evals/sets.controller.js +18 -39
- package/dist/evals/sets.service.d.ts +46 -17
- package/dist/evals/sets.service.js +320 -210
- package/dist/evals/snapshot.d.ts +11 -5
- package/dist/evals/snapshot.js +5 -4
- package/dist/evals/step-replay.d.ts +12 -8
- package/dist/evals/step-replay.js +24 -12
- package/dist/evals/trajectory.controller.d.ts +1 -1
- package/dist/evals/trajectory.controller.js +11 -7
- package/dist/evals/trajectory.d.ts +21 -5
- package/dist/evals/trajectory.js +14 -1
- package/dist/evals/trajectory.service.d.ts +17 -8
- package/dist/evals/trajectory.service.js +59 -21
- package/dist/evals/worker.d.ts +57 -31
- package/dist/evals/worker.js +248 -125
- package/dist/extensions/admin-ops.d.ts +142 -42
- package/dist/extensions/admin-ops.js +433 -187
- package/dist/extensions/admin-view.d.ts +96 -35
- package/dist/extensions/admin-view.js +390 -89
- package/dist/extensions/approvals.d.ts +24 -10
- package/dist/extensions/approvals.js +73 -46
- package/dist/extensions/blobs.d.ts +40 -10
- package/dist/extensions/blobs.js +156 -46
- package/dist/extensions/bootstrap-defaults.d.ts +24 -0
- package/dist/extensions/bootstrap-defaults.js +78 -0
- package/dist/extensions/bootstrap-extra.d.ts +84 -0
- package/dist/extensions/bootstrap-extra.js +151 -0
- package/dist/extensions/bootstrap-manifest.d.ts +14 -0
- package/dist/extensions/bootstrap-manifest.js +23 -0
- package/dist/extensions/bootstrap-packages.d.ts +98 -0
- package/dist/extensions/bootstrap-packages.js +303 -0
- package/dist/extensions/bootstrap.d.ts +249 -76
- package/dist/extensions/bootstrap.js +703 -333
- package/dist/extensions/cli.d.ts +32 -10
- package/dist/extensions/cli.js +52 -99
- package/dist/extensions/config-hash.d.ts +12 -0
- package/dist/extensions/config-hash.js +38 -0
- package/dist/extensions/config-issues.d.ts +19 -0
- package/dist/extensions/config-issues.js +48 -0
- package/dist/extensions/config-json-schema.d.ts +43 -7
- package/dist/extensions/config-json-schema.js +122 -58
- package/dist/extensions/deployed-snapshots.d.ts +19 -0
- package/dist/extensions/deployed-snapshots.js +59 -0
- package/dist/extensions/deployment-config-store.d.ts +55 -0
- package/dist/extensions/deployment-config-store.js +133 -0
- package/dist/extensions/deployment-config.d.ts +152 -70
- package/dist/extensions/deployment-config.js +453 -248
- package/dist/extensions/display-name.d.ts +22 -0
- package/dist/extensions/display-name.js +77 -0
- package/dist/extensions/effective-config.d.ts +134 -0
- package/dist/extensions/effective-config.js +380 -0
- package/dist/extensions/enabled.d.ts +29 -9
- package/dist/extensions/enabled.js +48 -10
- package/dist/extensions/extensions.module.d.ts +8 -0
- package/dist/extensions/extensions.module.js +111 -0
- package/dist/extensions/guide-places.d.ts +82 -0
- package/dist/extensions/guide-places.js +175 -0
- package/dist/extensions/hooks.d.ts +62 -9
- package/dist/extensions/hooks.js +98 -18
- package/dist/extensions/host.d.ts +215 -85
- package/dist/extensions/host.js +610 -241
- package/dist/extensions/installs.d.ts +77 -22
- package/dist/extensions/installs.js +179 -38
- package/dist/extensions/instance.d.ts +16 -3
- package/dist/extensions/instance.js +22 -2
- package/dist/extensions/ledger.d.ts +1 -1
- package/dist/extensions/lifecycle-hooks.d.ts +99 -0
- package/dist/extensions/lifecycle-hooks.js +260 -0
- package/dist/extensions/lifecycle-topics.d.ts +18 -0
- package/dist/extensions/lifecycle-topics.js +18 -0
- package/dist/extensions/lifecycle.d.ts +40 -47
- package/dist/extensions/lifecycle.js +110 -39
- package/dist/extensions/locks.d.ts +45 -0
- package/dist/extensions/locks.js +112 -0
- package/dist/extensions/migrate-lock.d.ts +3 -4
- package/dist/extensions/org-config.d.ts +160 -92
- package/dist/extensions/org-config.js +372 -362
- package/dist/extensions/org-levels.d.ts +50 -0
- package/dist/extensions/org-levels.js +151 -0
- package/dist/extensions/org-overrides.d.ts +152 -0
- package/dist/extensions/org-overrides.js +525 -0
- package/dist/extensions/package.d.ts +20 -6
- package/dist/extensions/package.js +56 -7
- package/dist/extensions/permission-set.d.ts +68 -11
- package/dist/extensions/permission-set.js +67 -15
- package/dist/extensions/permission-view.d.ts +120 -19
- package/dist/extensions/permission-view.js +62 -22
- package/dist/extensions/plugin-guides.d.ts +320 -0
- package/dist/extensions/plugin-guides.js +635 -0
- package/dist/extensions/plugin-icons.d.ts +140 -0
- package/dist/extensions/plugin-icons.js +342 -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 +28 -0
- package/dist/extensions/point-defaults.controller.js +69 -0
- package/dist/extensions/point-defaults.d.ts +113 -0
- package/dist/extensions/point-defaults.js +287 -0
- package/dist/extensions/point-defaults.schemas.d.ts +9 -0
- package/dist/extensions/point-defaults.schemas.js +14 -0
- package/dist/extensions/registry.d.ts +50 -2
- package/dist/extensions/registry.js +92 -4
- package/dist/extensions/resolve.d.ts +51 -1
- package/dist/extensions/resolve.js +90 -3
- package/dist/extensions/single-provider.d.ts +92 -0
- package/dist/extensions/single-provider.js +180 -0
- package/dist/extensions/sources.d.ts +25 -10
- package/dist/extensions/sources.js +36 -13
- 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/files.module.d.ts +6 -0
- package/dist/files/files.module.js +26 -0
- package/dist/files/previewers.controller.d.ts +19 -2
- package/dist/files/previewers.controller.js +71 -12
- package/dist/files/previewers.d.ts +109 -20
- package/dist/files/previewers.js +298 -66
- package/dist/files/previewers.schemas.d.ts +10 -0
- package/dist/files/previewers.schemas.js +9 -0
- package/dist/git/gateway.d.ts +102 -0
- package/dist/git/gateway.js +771 -0
- package/dist/git/gateway.route.d.ts +16 -0
- package/dist/git/gateway.route.js +39 -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/html/csp.d.ts +13 -0
- package/dist/html/csp.js +33 -0
- package/dist/html/html-document.controller.d.ts +31 -0
- package/dist/html/html-document.controller.js +75 -0
- package/dist/html/html-document.service.d.ts +49 -0
- package/dist/html/html-document.service.js +143 -0
- package/dist/html/html-token.d.ts +58 -0
- package/dist/html/html-token.js +154 -0
- package/dist/html/html-type.d.ts +15 -0
- package/dist/html/html-type.js +44 -0
- package/dist/html/html.module.d.ts +6 -0
- package/dist/html/html.module.js +26 -0
- package/dist/http/adapter.d.ts +3 -0
- package/dist/http/adapter.js +25 -0
- package/dist/http/api.module.d.ts +3 -110
- package/dist/http/api.module.js +180 -359
- package/dist/http/app.d.ts +35 -18
- package/dist/http/app.js +72 -67
- package/dist/http/error-filter.module.d.ts +5 -0
- package/dist/http/error-filter.module.js +18 -0
- package/dist/http/error.filter.d.ts +2 -0
- package/dist/http/error.filter.js +13 -4
- package/dist/http/gateway-routes.d.ts +23 -0
- package/dist/http/gateway-routes.js +17 -0
- package/dist/http/meta.controller.d.ts +49 -0
- package/dist/http/meta.controller.js +114 -0
- package/dist/http/nest-logger.d.ts +6 -5
- package/dist/http/nest-logger.js +24 -10
- package/dist/http/plugin-dispatch.d.ts +58 -18
- package/dist/http/plugin-dispatch.js +145 -30
- package/dist/http/plugin-route-access.d.ts +57 -0
- package/dist/http/plugin-route-access.js +208 -0
- package/dist/identity/account-avatar.controller.d.ts +30 -0
- package/dist/identity/account-avatar.controller.js +117 -0
- package/dist/identity/account-avatar.d.ts +67 -0
- package/dist/identity/account-avatar.js +136 -0
- package/dist/identity/account-avatars.service.d.ts +77 -0
- package/dist/identity/account-avatars.service.js +321 -0
- package/dist/identity/accounts.d.ts +176 -38
- package/dist/identity/accounts.js +523 -188
- package/dist/identity/api-tokens.d.ts +11 -7
- package/dist/identity/api-tokens.js +79 -44
- package/dist/identity/app-auth.controller.d.ts +26 -0
- package/dist/identity/app-auth.controller.js +65 -0
- package/dist/identity/app-auth.d.ts +84 -0
- package/dist/identity/app-auth.js +212 -0
- package/dist/identity/app-auth.schemas.d.ts +60 -0
- package/dist/identity/app-auth.schemas.js +46 -0
- package/dist/identity/audit.d.ts +9 -17
- package/dist/identity/audit.js +5 -28
- package/dist/identity/auth.controller.d.ts +13 -10
- package/dist/identity/auth.controller.js +31 -25
- package/dist/identity/auth.guard.d.ts +40 -18
- package/dist/identity/auth.guard.js +112 -45
- package/dist/identity/binding.d.ts +9 -11
- package/dist/identity/binding.js +41 -13
- package/dist/identity/cookies.d.ts +21 -5
- package/dist/identity/cookies.js +34 -6
- package/dist/identity/external-identity-lock.d.ts +17 -0
- package/dist/identity/external-identity-lock.js +39 -0
- package/dist/identity/external.d.ts +93 -51
- package/dist/identity/external.js +297 -168
- package/dist/identity/identity.module.d.ts +7 -0
- package/dist/identity/identity.module.js +79 -0
- package/dist/identity/initial-passwords.controller.d.ts +24 -0
- package/dist/identity/initial-passwords.controller.js +55 -0
- package/dist/identity/initial-passwords.d.ts +70 -0
- package/dist/identity/initial-passwords.job.d.ts +17 -0
- package/dist/identity/initial-passwords.job.js +52 -0
- package/dist/identity/initial-passwords.js +154 -0
- package/dist/identity/linked-accounts.d.ts +42 -0
- package/dist/identity/linked-accounts.js +78 -0
- package/dist/identity/login-sources.d.ts +160 -0
- package/dist/identity/login-sources.js +403 -0
- package/dist/identity/me.controller.d.ts +58 -17
- package/dist/identity/me.controller.js +131 -33
- package/dist/identity/me.schemas.d.ts +60 -0
- package/dist/identity/me.schemas.js +55 -0
- package/dist/identity/principal.d.ts +11 -3
- package/dist/identity/principal.js +11 -3
- package/dist/identity/sessions.d.ts +25 -10
- package/dist/identity/sessions.js +127 -46
- package/dist/identity/settings.d.ts +319 -23
- package/dist/identity/settings.js +817 -73
- package/dist/identity/sso-decisions.d.ts +75 -0
- package/dist/identity/sso-decisions.js +42 -0
- package/dist/identity/sso-link.d.ts +61 -0
- package/dist/identity/sso-link.js +157 -0
- package/dist/identity/sso-paths.d.ts +7 -0
- package/dist/identity/sso-paths.js +13 -0
- package/dist/identity/sso.controller.d.ts +102 -18
- package/dist/identity/sso.controller.js +232 -34
- package/dist/identity/sso.d.ts +87 -39
- package/dist/identity/sso.js +188 -84
- package/dist/identity/super-admin.d.ts +20 -0
- package/dist/identity/super-admin.js +81 -0
- package/dist/identity/write-actor.d.ts +11 -0
- package/dist/identity/write-actor.js +7 -0
- package/dist/inbox/inbox.module.d.ts +6 -0
- package/dist/inbox/inbox.module.js +27 -0
- package/dist/inbox/inbox.schemas.d.ts +8 -0
- package/dist/inbox/inbox.schemas.js +11 -0
- package/dist/inbox/inbox.service.d.ts +71 -12
- package/dist/inbox/inbox.service.js +112 -13
- 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 +170 -0
- package/dist/inbox/platform-inbox.service.js +297 -0
- package/dist/inbox/platform-notices.d.ts +33 -0
- package/dist/inbox/platform-notices.js +29 -0
- package/dist/index.d.ts +40 -15
- package/dist/index.js +34 -10
- package/dist/infra/cache/cache.module.d.ts +3 -0
- package/dist/infra/cache/cache.module.js +16 -0
- package/dist/infra/cache/cache.service.d.ts +21 -0
- package/dist/infra/cache/cache.service.js +80 -0
- package/dist/infra/cache/cacheable.decorator.d.ts +32 -0
- package/dist/infra/cache/cacheable.decorator.js +83 -0
- package/dist/infra/cli/kernel-cli.module.d.ts +66 -0
- package/dist/infra/cli/kernel-cli.module.js +181 -0
- package/dist/infra/cli/master-key-rewrap.d.ts +15 -0
- package/dist/infra/cli/master-key-rewrap.js +24 -0
- package/dist/infra/cli/permission-cutover.d.ts +59 -0
- package/dist/infra/cli/permission-cutover.js +107 -0
- package/dist/infra/close-within.d.ts +15 -0
- package/dist/infra/close-within.js +36 -0
- package/dist/infra/config/config.module.d.ts +13 -0
- package/dist/infra/config/config.module.js +39 -0
- package/dist/infra/config/kernel-config.service.d.ts +32 -0
- package/dist/infra/config/kernel-config.service.js +221 -0
- package/dist/infra/database/after-commit.d.ts +6 -0
- package/dist/infra/database/after-commit.js +9 -0
- package/dist/infra/database/database.module.d.ts +25 -0
- package/dist/infra/database/database.module.js +92 -0
- package/dist/infra/database/kernel-db.d.ts +22 -0
- package/dist/infra/database/kernel-db.js +65 -0
- package/dist/infra/database/org-scope.d.ts +59 -0
- package/dist/infra/database/org-scope.js +68 -0
- package/dist/infra/database/rls-role.d.ts +11 -0
- package/dist/infra/database/rls-role.js +33 -0
- package/dist/infra/database/scoped-dialect.d.ts +18 -0
- package/dist/infra/database/scoped-dialect.js +245 -0
- package/dist/infra/database/startup-activation-transaction.d.ts +36 -0
- package/dist/infra/database/startup-activation-transaction.js +242 -0
- package/dist/infra/database/transaction-host.d.ts +129 -0
- package/dist/infra/database/transaction-host.js +281 -0
- package/dist/infra/database/transactional.decorator.d.ts +15 -0
- package/dist/infra/database/transactional.decorator.js +27 -0
- package/dist/infra/database/xact-lock.d.ts +34 -0
- package/dist/infra/database/xact-lock.js +76 -0
- package/dist/infra/events/kernel-events.d.ts +102 -0
- package/dist/infra/events/kernel-events.js +65 -0
- package/dist/infra/health/health.controller.d.ts +26 -0
- package/dist/infra/health/health.controller.js +112 -0
- package/dist/infra/health/health.module.d.ts +9 -0
- package/dist/infra/health/health.module.js +24 -0
- package/dist/infra/health/health.options.d.ts +10 -0
- package/dist/infra/health/health.options.js +15 -0
- package/dist/infra/health/process-fault.d.ts +16 -0
- package/dist/infra/health/process-fault.js +49 -0
- package/dist/infra/health/shutdown-state.d.ts +6 -0
- package/dist/infra/health/shutdown-state.js +2 -0
- package/dist/infra/lifecycle/graceful-shutdown.module.d.ts +6 -0
- package/dist/infra/lifecycle/graceful-shutdown.module.js +23 -0
- package/dist/infra/lifecycle/graceful-shutdown.service.d.ts +70 -0
- package/dist/infra/lifecycle/graceful-shutdown.service.js +135 -0
- package/dist/infra/lifecycle/process-guards.d.ts +58 -0
- package/dist/infra/lifecycle/process-guards.js +99 -0
- package/dist/infra/lifecycle/shutdown-signals.d.ts +39 -0
- package/dist/infra/lifecycle/shutdown-signals.js +63 -0
- package/dist/infra/lock/key-template.d.ts +13 -0
- package/dist/infra/lock/key-template.js +46 -0
- package/dist/infra/lock/lock.module.d.ts +3 -0
- package/dist/infra/lock/lock.module.js +16 -0
- package/dist/infra/lock/lock.service.d.ts +132 -0
- package/dist/infra/lock/lock.service.js +376 -0
- package/dist/infra/lock/shared-lease.d.ts +44 -0
- package/dist/infra/lock/shared-lease.js +121 -0
- package/dist/infra/lock/with-lock.decorator.d.ts +28 -0
- package/dist/infra/lock/with-lock.decorator.js +49 -0
- package/dist/infra/logging/logging.module.d.ts +18 -0
- package/dist/infra/logging/logging.module.js +52 -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 +321 -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 +166 -0
- package/dist/infra/outbox/registry.d.ts +474 -0
- package/dist/infra/outbox/registry.js +438 -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/configured-processor.d.ts +18 -0
- package/dist/infra/queue/configured-processor.js +23 -0
- package/dist/infra/queue/job-failure.d.ts +18 -0
- package/dist/infra/queue/job-failure.js +26 -0
- package/dist/infra/queue/queue-names.d.ts +8 -0
- package/dist/infra/queue/queue-names.js +22 -0
- package/dist/infra/queue/queue-shutdown.d.ts +27 -0
- package/dist/infra/queue/queue-shutdown.js +81 -0
- package/dist/infra/queue/queue.module.d.ts +16 -0
- package/dist/infra/queue/queue.module.js +61 -0
- package/dist/infra/queue/redis-connection.d.ts +13 -0
- package/dist/infra/queue/redis-connection.js +25 -0
- package/dist/infra/queue/run-job.d.ts +22 -0
- package/dist/infra/queue/run-job.js +32 -0
- package/dist/infra/redis/redis.module.d.ts +24 -0
- package/dist/infra/redis/redis.module.js +91 -0
- package/dist/infra/schedule/cron-tick.d.ts +12 -0
- package/dist/infra/schedule/cron-tick.js +25 -0
- package/dist/infra/schedule/locked-cron.decorator.d.ts +27 -0
- package/dist/infra/schedule/locked-cron.decorator.js +53 -0
- package/dist/infra/schedule/locked-interval.d.ts +69 -0
- package/dist/infra/schedule/locked-interval.js +190 -0
- package/dist/infra/schedule/locked-tick.d.ts +90 -0
- package/dist/infra/schedule/locked-tick.js +145 -0
- package/dist/infra/schedule/schedule.module.d.ts +8 -0
- package/dist/infra/schedule/schedule.module.js +27 -0
- package/dist/infra/schedule/scheduled-runs.d.ts +69 -0
- package/dist/infra/schedule/scheduled-runs.js +165 -0
- package/dist/infra/swagger/swagger.d.ts +16 -0
- package/dist/infra/swagger/swagger.js +31 -0
- package/dist/infra/throttler/credential-throttler.d.ts +38 -0
- package/dist/infra/throttler/credential-throttler.js +80 -0
- package/dist/infra/throttler/named-throttlers.d.ts +51 -0
- package/dist/infra/throttler/named-throttlers.js +244 -0
- package/dist/infra/throttler/redis-throttler-storage.d.ts +38 -0
- package/dist/infra/throttler/redis-throttler-storage.js +130 -0
- package/dist/infra/throttler/throttler.guard.d.ts +24 -0
- package/dist/infra/throttler/throttler.guard.js +69 -0
- package/dist/infra/throttler/throttler.module.d.ts +15 -0
- package/dist/infra/throttler/throttler.module.js +53 -0
- package/dist/infra/tokens.d.ts +20 -0
- package/dist/infra/tokens.js +20 -0
- package/dist/infra/validation/create-zod-dto.d.ts +23 -0
- package/dist/infra/validation/create-zod-dto.js +35 -0
- package/dist/infra/validation/parse-with-zod.d.ts +7 -0
- package/dist/infra/validation/parse-with-zod.js +12 -0
- package/dist/infra/validation/validation.module.d.ts +3 -0
- package/dist/infra/validation/validation.module.js +16 -0
- package/dist/infra/validation/zod-params.d.ts +7 -0
- package/dist/infra/validation/zod-params.js +42 -0
- package/dist/infra/validation/zod-validation.pipe.d.ts +11 -0
- package/dist/infra/validation/zod-validation.pipe.js +31 -0
- package/dist/kernel.d.ts +9 -244
- package/dist/kernel.js +8 -1305
- package/dist/kernel.module.d.ts +17 -0
- package/dist/kernel.module.js +165 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +166 -0
- package/dist/lifecycle/kernel-lifecycle.js +618 -0
- package/dist/lifecycle/tokens.d.ts +3 -0
- package/dist/lifecycle/tokens.js +3 -0
- package/dist/log-context.d.ts +2 -0
- package/dist/log-context.js +4 -0
- package/dist/log.d.ts +13 -1
- package/dist/log.js +93 -17
- package/dist/media/image-header.d.ts +10 -0
- package/dist/media/image-header.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/image-usable.d.ts +46 -0
- package/dist/models/image-usable.js +60 -0
- package/dist/models/images.d.ts +127 -0
- package/dist/models/images.js +445 -0
- package/dist/models/models.module.d.ts +8 -0
- package/dist/models/models.module.js +50 -0
- package/dist/models/org-models.schemas.d.ts +8 -0
- package/dist/models/org-models.schemas.js +23 -0
- package/dist/models/prices.d.ts +13 -5
- package/dist/models/prices.js +69 -39
- package/dist/models/purposes.controller.d.ts +13 -4
- package/dist/models/purposes.controller.js +25 -11
- package/dist/models/purposes.d.ts +129 -57
- package/dist/models/purposes.js +275 -85
- package/dist/net/public-address.d.ts +38 -8
- package/dist/net/public-address.js +83 -24
- package/dist/net/safe-fetch.d.ts +28 -6
- package/dist/net/safe-fetch.js +105 -8
- package/dist/orgs/device-network-setting.d.ts +82 -0
- package/dist/orgs/device-network-setting.js +142 -0
- package/dist/orgs/directory-sync.controller.d.ts +1 -1
- package/dist/orgs/directory-sync.controller.js +2 -2
- package/dist/orgs/directory-sync.d.ts +85 -39
- package/dist/orgs/directory-sync.js +255 -139
- package/dist/orgs/invitations.controller.d.ts +9 -17
- package/dist/orgs/invitations.controller.js +31 -31
- package/dist/orgs/invitations.service.d.ts +24 -11
- package/dist/orgs/invitations.service.js +141 -94
- package/dist/orgs/members.service.d.ts +34 -15
- package/dist/orgs/members.service.js +181 -121
- 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 +86 -84
- package/dist/orgs/offboarding.js +287 -184
- package/dist/orgs/org-lock.d.ts +66 -20
- package/dist/orgs/org-lock.js +156 -36
- package/dist/orgs/org-owner.d.ts +7 -0
- package/dist/orgs/org-owner.js +16 -0
- package/dist/orgs/org.guard.d.ts +11 -1
- package/dist/orgs/org.guard.js +49 -34
- package/dist/orgs/orgs.controller.d.ts +24 -26
- package/dist/orgs/orgs.controller.js +51 -26
- package/dist/orgs/orgs.module.d.ts +7 -0
- package/dist/orgs/orgs.module.js +72 -0
- package/dist/orgs/orgs.schemas.d.ts +46 -0
- package/dist/orgs/orgs.schemas.js +43 -0
- package/dist/orgs/orgs.service.d.ts +57 -21
- package/dist/orgs/orgs.service.js +209 -91
- 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 +17 -10
- package/dist/orgs/settings.service.d.ts +474 -56
- package/dist/orgs/settings.service.js +786 -108
- package/dist/overrides.d.ts +126 -0
- package/dist/overrides.js +70 -0
- package/dist/packages/npm.d.ts +37 -10
- package/dist/packages/npm.js +67 -24
- 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 +19 -0
- package/dist/platform/availability.js +47 -0
- package/dist/platform/connector-person-fields.d.ts +67 -0
- package/dist/platform/connector-person-fields.js +129 -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 +789 -0
- package/dist/platform/file-ref.d.ts +90 -0
- package/dist/platform/file-ref.js +162 -0
- package/dist/platform/method.d.ts +6 -0
- package/dist/platform/method.js +16 -0
- package/dist/platform/operation.d.ts +257 -0
- package/dist/platform/operation.js +110 -0
- package/dist/platform/ops/accounts.ops.d.ts +32 -0
- package/dist/platform/ops/accounts.ops.js +292 -0
- package/dist/platform/ops/admin-items.ops.d.ts +37 -0
- package/dist/platform/ops/admin-items.ops.js +279 -0
- package/dist/platform/ops/admin.ops.d.ts +40 -0
- package/dist/platform/ops/admin.ops.js +684 -0
- package/dist/platform/ops/agent-skills.ops.d.ts +52 -0
- package/dist/platform/ops/agent-skills.ops.js +664 -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 +44 -0
- package/dist/platform/ops/agents.ops.js +809 -0
- package/dist/platform/ops/approvals.ops.d.ts +30 -0
- package/dist/platform/ops/approvals.ops.js +121 -0
- package/dist/platform/ops/background.ops.d.ts +14 -0
- package/dist/platform/ops/background.ops.js +137 -0
- package/dist/platform/ops/catalog-admin.ops.d.ts +102 -0
- package/dist/platform/ops/catalog-admin.ops.js +793 -0
- package/dist/platform/ops/channels.ops.d.ts +23 -0
- package/dist/platform/ops/channels.ops.js +432 -0
- package/dist/platform/ops/components.ops.d.ts +48 -0
- package/dist/platform/ops/components.ops.js +913 -0
- package/dist/platform/ops/connectors.ops.d.ts +35 -0
- package/dist/platform/ops/connectors.ops.js +913 -0
- package/dist/platform/ops/conversations.ops.d.ts +30 -0
- package/dist/platform/ops/conversations.ops.js +508 -0
- package/dist/platform/ops/devices.ops.d.ts +28 -0
- package/dist/platform/ops/devices.ops.js +520 -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 +66 -0
- package/dist/platform/ops/extensions-admin.ops.js +766 -0
- package/dist/platform/ops/extensions.ops.d.ts +45 -0
- package/dist/platform/ops/extensions.ops.js +670 -0
- package/dist/platform/ops/inbox.ops.d.ts +25 -0
- package/dist/platform/ops/inbox.ops.js +417 -0
- package/dist/platform/ops/list-handoff.d.ts +10 -0
- package/dist/platform/ops/list-handoff.js +11 -0
- package/dist/platform/ops/marketplaces.ops.d.ts +22 -0
- package/dist/platform/ops/marketplaces.ops.js +490 -0
- package/dist/platform/ops/models.ops.d.ts +25 -0
- package/dist/platform/ops/models.ops.js +242 -0
- package/dist/platform/ops/org-plugins.ops.d.ts +45 -0
- package/dist/platform/ops/org-plugins.ops.js +537 -0
- package/dist/platform/ops/org-settings.ops.d.ts +18 -0
- package/dist/platform/ops/org-settings.ops.js +152 -0
- package/dist/platform/ops/orgs.ops.d.ts +73 -0
- package/dist/platform/ops/orgs.ops.js +722 -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 +126 -0
- package/dist/platform/ops/paging.d.ts +14 -0
- package/dist/platform/ops/paging.js +20 -0
- package/dist/platform/ops/person-inputs.d.ts +61 -0
- package/dist/platform/ops/person-inputs.js +121 -0
- package/dist/platform/ops/platform-icons.ops.d.ts +14 -0
- package/dist/platform/ops/platform-icons.ops.js +117 -0
- package/dist/platform/ops/platform.ops.d.ts +43 -0
- package/dist/platform/ops/platform.ops.js +314 -0
- package/dist/platform/ops/plugins.ops.d.ts +39 -0
- package/dist/platform/ops/plugins.ops.js +454 -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 +201 -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/shares.ops.d.ts +16 -0
- package/dist/platform/ops/shares.ops.js +107 -0
- package/dist/platform/ops/skills.ops.d.ts +23 -0
- package/dist/platform/ops/skills.ops.js +279 -0
- package/dist/platform/ops/summary.d.ts +15 -0
- package/dist/platform/ops/summary.js +28 -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 +40 -0
- package/dist/platform/parity.js +360 -0
- package/dist/platform/person-fields.d.ts +120 -0
- package/dist/platform/person-fields.js +404 -0
- package/dist/platform/platform-ops.module.d.ts +47 -0
- package/dist/platform/platform-ops.module.js +160 -0
- package/dist/platform/platform.module.d.ts +9 -0
- package/dist/platform/platform.module.js +28 -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 +107 -0
- package/dist/platform/sealed-inputs.d.ts +44 -0
- package/dist/platform/sealed-inputs.js +116 -0
- package/dist/platform/sealed-reveals.controller.d.ts +17 -0
- package/dist/platform/sealed-reveals.controller.js +48 -0
- package/dist/platform/sealed-reveals.d.ts +54 -0
- package/dist/platform/sealed-reveals.js +155 -0
- package/dist/push/delivery.d.ts +88 -0
- package/dist/push/delivery.js +269 -0
- package/dist/push/fanout.d.ts +29 -0
- package/dist/push/fanout.js +95 -0
- package/dist/push/jobs.d.ts +43 -0
- package/dist/push/jobs.js +19 -0
- package/dist/push/preferences.service.d.ts +18 -0
- package/dist/push/preferences.service.js +82 -0
- package/dist/push/provider-host.d.ts +34 -0
- package/dist/push/provider-host.js +94 -0
- package/dist/push/push-owed.d.ts +33 -0
- package/dist/push/push-owed.js +93 -0
- package/dist/push/push-processor.d.ts +40 -0
- package/dist/push/push-processor.js +114 -0
- package/dist/push/push.controller.d.ts +28 -0
- package/dist/push/push.controller.js +92 -0
- package/dist/push/push.module.d.ts +6 -0
- package/dist/push/push.module.js +29 -0
- package/dist/push/push.schemas.d.ts +88 -0
- package/dist/push/push.schemas.js +53 -0
- package/dist/push/recipients.d.ts +29 -0
- package/dist/push/recipients.js +270 -0
- package/dist/push/registration-cleanup.d.ts +9 -0
- package/dist/push/registration-cleanup.js +16 -0
- package/dist/push/registrations.service.d.ts +55 -0
- package/dist/push/registrations.service.js +254 -0
- package/dist/push/stale.job.d.ts +25 -0
- package/dist/push/stale.job.js +76 -0
- package/dist/push/texts.d.ts +31 -0
- package/dist/push/texts.js +46 -0
- package/dist/push/token-store.d.ts +31 -0
- package/dist/push/token-store.js +52 -0
- package/dist/push/triggers.d.ts +19 -0
- package/dist/push/triggers.js +30 -0
- package/dist/roles/gateway-role.d.ts +65 -0
- package/dist/roles/gateway-role.js +144 -0
- package/dist/roles/gateway.module.d.ts +10 -0
- package/dist/roles/gateway.module.js +41 -0
- package/dist/roles/worker-role.d.ts +82 -0
- package/dist/roles/worker-role.js +186 -0
- package/dist/roles/worker.module.d.ts +14 -0
- package/dist/roles/worker.module.js +151 -0
- package/dist/runtime/abort.js +19 -2
- package/dist/runtime/checkpointer.d.ts +11 -3
- package/dist/runtime/checkpointer.js +93 -55
- 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 +24 -0
- package/dist/runtime/compaction-settings.service.js +48 -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 +162 -47
- package/dist/runtime/context/build.js +512 -88
- package/dist/runtime/context/claude-tools.d.ts +4 -1
- package/dist/runtime/context/claude-tools.js +13 -12
- package/dist/runtime/context/compaction.d.ts +111 -16
- package/dist/runtime/context/compaction.js +434 -55
- package/dist/runtime/context/device-paths.d.ts +92 -0
- package/dist/runtime/context/device-paths.js +185 -0
- package/dist/runtime/context/fit.d.ts +111 -0
- package/dist/runtime/context/fit.js +278 -0
- package/dist/runtime/context/permission-profile.d.ts +55 -0
- package/dist/runtime/context/permission-profile.js +275 -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 -36
- package/dist/runtime/context/skills.js +90 -117
- 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 +19 -17
- package/dist/runtime/conversation-lock.js +66 -80
- package/dist/runtime/hook-calls.d.ts +27 -10
- package/dist/runtime/hook-calls.js +72 -21
- package/dist/runtime/langgraph-loop.d.ts +3 -1
- package/dist/runtime/langgraph-loop.js +62 -25
- package/dist/runtime/limits.d.ts +15 -0
- package/dist/runtime/limits.js +25 -0
- package/dist/runtime/loop.d.ts +57 -8
- package/dist/runtime/loop.js +15 -0
- package/dist/runtime/maintenance-queue.d.ts +10 -0
- package/dist/runtime/maintenance-queue.js +10 -0
- package/dist/runtime/maintenance.d.ts +63 -74
- package/dist/runtime/maintenance.js +288 -138
- package/dist/runtime/model-call.d.ts +251 -23
- package/dist/runtime/model-call.js +1142 -410
- package/dist/runtime/permission-context-errors.d.ts +39 -0
- package/dist/runtime/permission-context-errors.js +67 -0
- package/dist/runtime/permission-context.service.d.ts +60 -0
- package/dist/runtime/permission-context.service.js +289 -0
- package/dist/runtime/plugin-context.service.d.ts +75 -0
- package/dist/runtime/plugin-context.service.js +210 -0
- package/dist/runtime/project/knowledge.d.ts +135 -0
- package/dist/runtime/project/knowledge.js +256 -0
- package/dist/runtime/project/knowledge.service.d.ts +94 -0
- package/dist/runtime/project/knowledge.service.js +347 -0
- package/dist/runtime/providers.d.ts +203 -37
- package/dist/runtime/providers.js +458 -125
- package/dist/runtime/queue-lost-jobs.d.ts +24 -0
- package/dist/runtime/queue-lost-jobs.js +51 -0
- package/dist/runtime/quota.d.ts +17 -3
- package/dist/runtime/quota.js +27 -2
- package/dist/runtime/run-context.service.d.ts +82 -0
- package/dist/runtime/run-context.service.js +256 -0
- package/dist/runtime/run-control.d.ts +90 -0
- package/dist/runtime/run-control.js +163 -0
- package/dist/runtime/run-deletion.d.ts +29 -0
- package/dist/runtime/run-deletion.js +157 -0
- package/dist/runtime/run-drafts.d.ts +127 -0
- package/dist/runtime/run-drafts.js +331 -0
- package/dist/runtime/run-execution.d.ts +80 -0
- package/dist/runtime/run-execution.js +191 -0
- package/dist/runtime/run-finish.d.ts +70 -24
- package/dist/runtime/run-finish.js +230 -55
- package/dist/runtime/run-jobs.d.ts +145 -0
- package/dist/runtime/run-jobs.js +301 -0
- 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 +425 -0
- package/dist/runtime/run-processors.d.ts +75 -0
- package/dist/runtime/run-processors.js +220 -0
- package/dist/runtime/run-queue.d.ts +148 -88
- package/dist/runtime/run-queue.js +680 -368
- package/dist/runtime/run-status.d.ts +12 -0
- package/dist/runtime/run-status.js +21 -0
- package/dist/runtime/run-steps.d.ts +47 -0
- package/dist/runtime/run-steps.js +119 -0
- package/dist/runtime/run-worker.d.ts +183 -82
- package/dist/runtime/run-worker.js +783 -298
- package/dist/runtime/runtime.module.d.ts +9 -0
- package/dist/runtime/runtime.module.js +172 -0
- package/dist/runtime/step-log.d.ts +69 -0
- package/dist/runtime/step-log.js +138 -0
- package/dist/runtime/stream.controller.d.ts +30 -11
- package/dist/runtime/stream.controller.js +75 -18
- package/dist/runtime/stream.d.ts +33 -6
- package/dist/runtime/stream.js +184 -9
- package/dist/runtime/subagents/child.d.ts +58 -51
- package/dist/runtime/subagents/child.js +108 -87
- package/dist/runtime/subagents/definition.d.ts +58 -38
- package/dist/runtime/subagents/definition.js +165 -214
- package/dist/runtime/subagents/deliveries.d.ts +74 -0
- package/dist/runtime/subagents/deliveries.js +240 -0
- package/dist/runtime/subagents/dispatch.d.ts +203 -29
- package/dist/runtime/subagents/dispatch.js +353 -292
- package/dist/runtime/subagents/limits.d.ts +32 -8
- package/dist/runtime/subagents/limits.js +44 -8
- package/dist/runtime/subagents/messages.d.ts +99 -0
- package/dist/runtime/subagents/messages.js +338 -0
- package/dist/runtime/subagents/org-agents.d.ts +4 -4
- package/dist/runtime/subagents/org-agents.js +3 -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 +10 -8
- 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 +27 -10
- package/dist/runtime/subagents/roster.js +49 -13
- package/dist/runtime/subagents/skill-fork.d.ts +14 -16
- package/dist/runtime/subagents/skill-fork.js +29 -10
- 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 +43 -0
- package/dist/runtime/subagents/subagents.service.js +106 -0
- package/dist/runtime/subagents/template-skills.d.ts +47 -0
- package/dist/runtime/subagents/template-skills.js +77 -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 +107 -0
- package/dist/runtime/usage-report.d.ts +111 -113
- package/dist/runtime/usage-report.js +290 -266
- package/dist/runtime/waits.d.ts +204 -167
- package/dist/runtime/waits.js +581 -690
- package/dist/runtime/write-base.d.ts +95 -0
- package/dist/runtime/write-base.js +281 -0
- package/dist/runtime/write-base.service.d.ts +68 -0
- package/dist/runtime/write-base.service.js +184 -0
- package/dist/sandbox/attachments-path.d.ts +15 -0
- package/dist/sandbox/attachments-path.js +15 -0
- package/dist/sandbox/cloud-permission-snapshot.d.ts +159 -0
- package/dist/sandbox/cloud-permission-snapshot.js +430 -0
- package/dist/sandbox/cloud-permission-snapshot.module.d.ts +8 -0
- package/dist/sandbox/cloud-permission-snapshot.module.js +34 -0
- package/dist/sandbox/device-reports.d.ts +110 -0
- package/dist/sandbox/device-reports.js +317 -0
- package/dist/sandbox/device-reports.module.d.ts +7 -0
- package/dist/sandbox/device-reports.module.js +25 -0
- package/dist/sandbox/device-sandbox-settings.d.ts +230 -0
- package/dist/sandbox/device-sandbox-settings.js +470 -0
- package/dist/sandbox/device-sandbox.d.ts +210 -0
- package/dist/sandbox/device-sandbox.js +234 -0
- package/dist/sandbox/device-services.d.ts +83 -0
- package/dist/sandbox/device-services.js +234 -0
- package/dist/sandbox/held-operations.d.ts +43 -0
- package/dist/sandbox/held-operations.js +137 -0
- package/dist/sandbox/job-ids.d.ts +10 -0
- package/dist/sandbox/job-ids.js +10 -0
- package/dist/sandbox/jobs.d.ts +89 -0
- package/dist/sandbox/jobs.js +174 -0
- package/dist/sandbox/kernel-read.d.ts +85 -0
- package/dist/sandbox/kernel-read.js +87 -0
- package/dist/sandbox/leases.d.ts +92 -81
- package/dist/sandbox/leases.js +239 -343
- package/dist/sandbox/legacy-retirement.d.ts +269 -0
- package/dist/sandbox/legacy-retirement.js +925 -0
- package/dist/sandbox/legacy-retirement.module.d.ts +8 -0
- package/dist/sandbox/legacy-retirement.module.js +25 -0
- package/dist/sandbox/managed-device-context.d.ts +118 -0
- package/dist/sandbox/managed-device-context.js +374 -0
- package/dist/sandbox/managed-device-context.module.d.ts +6 -0
- package/dist/sandbox/managed-device-context.module.js +37 -0
- package/dist/sandbox/modes.d.ts +210 -0
- package/dist/sandbox/modes.js +253 -0
- package/dist/sandbox/network-grants.d.ts +69 -0
- package/dist/sandbox/network-grants.js +227 -0
- package/dist/sandbox/network-grants.module.d.ts +2 -0
- package/dist/sandbox/network-grants.module.js +14 -0
- package/dist/sandbox/operation-authority-types.d.ts +27 -0
- package/dist/sandbox/operation-authority-types.js +50 -0
- package/dist/sandbox/operation-authority.d.ts +166 -0
- package/dist/sandbox/operation-authority.js +923 -0
- package/dist/sandbox/operation-authority.module.d.ts +2 -0
- package/dist/sandbox/operation-authority.module.js +29 -0
- package/dist/sandbox/operation-intents.d.ts +263 -0
- package/dist/sandbox/operation-intents.js +1464 -0
- package/dist/sandbox/operation-intents.module.d.ts +2 -0
- package/dist/sandbox/operation-intents.module.js +21 -0
- package/dist/sandbox/operation-payloads.d.ts +33 -0
- package/dist/sandbox/operation-payloads.js +332 -0
- package/dist/sandbox/operation-reconcile.job.d.ts +73 -0
- package/dist/sandbox/operation-reconcile.job.js +332 -0
- package/dist/sandbox/permission-authority-epochs.d.ts +18 -0
- package/dist/sandbox/permission-authority-epochs.js +83 -0
- package/dist/sandbox/permission-authority-lock.d.ts +44 -0
- package/dist/sandbox/permission-authority-lock.js +167 -0
- package/dist/sandbox/permission-authority.module.d.ts +9 -0
- package/dist/sandbox/permission-authority.module.js +55 -0
- package/dist/sandbox/permission-auto-grants.d.ts +42 -0
- package/dist/sandbox/permission-auto-grants.js +145 -0
- package/dist/sandbox/permission-availability.d.ts +63 -0
- package/dist/sandbox/permission-availability.js +71 -0
- package/dist/sandbox/permission-call-grants.d.ts +47 -0
- package/dist/sandbox/permission-call-grants.js +427 -0
- package/dist/sandbox/permission-call-grants.module.d.ts +2 -0
- package/dist/sandbox/permission-call-grants.module.js +28 -0
- package/dist/sandbox/permission-call-types.d.ts +149 -0
- package/dist/sandbox/permission-call-types.js +1 -0
- package/dist/sandbox/permission-ceiling-writes.d.ts +57 -0
- package/dist/sandbox/permission-ceiling-writes.js +236 -0
- package/dist/sandbox/permission-config-publication.d.ts +126 -0
- package/dist/sandbox/permission-config-publication.js +529 -0
- package/dist/sandbox/permission-context-types.d.ts +60 -0
- package/dist/sandbox/permission-context-types.js +11 -0
- package/dist/sandbox/permission-facts.d.ts +384 -0
- package/dist/sandbox/permission-facts.js +714 -0
- package/dist/sandbox/permission-facts.module.d.ts +2 -0
- package/dist/sandbox/permission-facts.module.js +20 -0
- package/dist/sandbox/permission-instance-writes.d.ts +76 -0
- package/dist/sandbox/permission-instance-writes.js +232 -0
- package/dist/sandbox/permission-runtime-reports.d.ts +92 -0
- package/dist/sandbox/permission-runtime-reports.js +337 -0
- package/dist/sandbox/permission-transitions.d.ts +31 -0
- package/dist/sandbox/permission-transitions.js +158 -0
- package/dist/sandbox/providers.d.ts +60 -0
- package/dist/sandbox/providers.js +101 -0
- package/dist/sandbox/providers.module.d.ts +2 -0
- package/dist/sandbox/providers.module.js +19 -0
- package/dist/sandbox/request-not-sent.d.ts +15 -0
- package/dist/sandbox/request-not-sent.js +20 -0
- package/dist/sandbox/review/classifier.d.ts +221 -0
- package/dist/sandbox/review/classifier.js +536 -0
- package/dist/sandbox/review/index.d.ts +13 -0
- package/dist/sandbox/review/index.js +10 -0
- package/dist/sandbox/review/permission-candidate.d.ts +142 -0
- package/dist/sandbox/review/permission-candidate.js +446 -0
- package/dist/sandbox/review/review.service.d.ts +184 -0
- package/dist/sandbox/review/review.service.js +586 -0
- package/dist/sandbox/review/rules.d.ts +87 -0
- package/dist/sandbox/review/rules.js +5363 -0
- package/dist/sandbox/review/types.d.ts +122 -0
- package/dist/sandbox/review/types.js +48 -0
- package/dist/sandbox/sandbox-file-reader.d.ts +47 -0
- package/dist/sandbox/sandbox-file-reader.js +125 -0
- package/dist/sandbox/sandbox.module.d.ts +10 -0
- package/dist/sandbox/sandbox.module.js +78 -0
- package/dist/sandbox/sandbox.service.d.ts +929 -154
- package/dist/sandbox/sandbox.service.js +3315 -493
- package/dist/sandbox/unreachable.d.ts +30 -0
- package/dist/sandbox/unreachable.js +125 -0
- package/dist/sandbox/use-context.d.ts +20 -0
- package/dist/sandbox/use-context.js +1 -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 +146 -0
- package/dist/schedules/fire.js +728 -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 +35 -0
- package/dist/schedules/run-tracker.d.ts +84 -0
- package/dist/schedules/run-tracker.js +350 -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 +359 -0
- package/dist/schedules/scheduled-tasks.service.js +1249 -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 +63 -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 +421 -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 +193 -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 +67 -0
- package/dist/setup/setup-checks.schemas.js +75 -0
- package/dist/setup/setup-checks.service.d.ts +168 -0
- package/dist/setup/setup-checks.service.js +781 -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 +141 -0
- package/dist/setup/setup-guides.service.js +348 -0
- package/dist/setup/setup.module.d.ts +8 -0
- package/dist/setup/setup.module.js +31 -0
- package/dist/shares/liveness.d.ts +59 -0
- package/dist/shares/liveness.js +163 -0
- package/dist/shares/revoke.d.ts +26 -0
- package/dist/shares/revoke.js +43 -0
- package/dist/shares/settings.d.ts +76 -0
- package/dist/shares/settings.js +117 -0
- package/dist/shares/share-code.d.ts +4 -0
- package/dist/shares/share-code.js +28 -0
- package/dist/shares/share-objects.d.ts +52 -0
- package/dist/shares/share-objects.js +123 -0
- package/dist/shares/share-open.controller.d.ts +35 -0
- package/dist/shares/share-open.controller.js +107 -0
- package/dist/shares/share-open.service.d.ts +107 -0
- package/dist/shares/share-open.service.js +288 -0
- package/dist/shares/share-previews.controller.d.ts +50 -0
- package/dist/shares/share-previews.controller.js +115 -0
- package/dist/shares/shares.controller.d.ts +34 -0
- package/dist/shares/shares.controller.js +114 -0
- package/dist/shares/shares.module.d.ts +8 -0
- package/dist/shares/shares.module.js +41 -0
- package/dist/shares/shares.schemas.d.ts +31 -0
- package/dist/shares/shares.schemas.js +25 -0
- package/dist/shares/shares.service.d.ts +183 -0
- package/dist/shares/shares.service.js +561 -0
- package/dist/shares/sweep.job.d.ts +74 -0
- package/dist/shares/sweep.job.js +332 -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 +971 -0
- package/dist/skills/catalog.d.ts +112 -86
- package/dist/skills/catalog.js +222 -269
- package/dist/skills/changes.controller.d.ts +14 -24
- package/dist/skills/changes.controller.js +35 -58
- package/dist/skills/changes.service.d.ts +81 -116
- package/dist/skills/changes.service.js +354 -641
- package/dist/skills/conversation-catalog.d.ts +52 -0
- package/dist/skills/conversation-catalog.js +142 -0
- package/dist/skills/invocable.controller.d.ts +2 -2
- package/dist/skills/invocable.controller.js +10 -7
- package/dist/skills/invocation-keys.d.ts +1 -1
- package/dist/skills/invocation-keys.js +1 -1
- package/dist/skills/invoke.d.ts +104 -21
- package/dist/skills/invoke.js +235 -26
- package/dist/skills/package.d.ts +15 -1
- package/dist/skills/package.js +14 -1
- package/dist/skills/skill-files.d.ts +91 -0
- package/dist/skills/skill-files.js +144 -0
- package/dist/skills/skills.controller.d.ts +59 -15
- package/dist/skills/skills.controller.js +139 -26
- package/dist/skills/skills.module.d.ts +6 -0
- package/dist/skills/skills.module.js +60 -0
- package/dist/skills/skills.schemas.d.ts +96 -0
- package/dist/skills/skills.schemas.js +151 -0
- package/dist/skills/skills.service.d.ts +218 -76
- package/dist/skills/skills.service.js +850 -292
- package/dist/skills/usable.d.ts +131 -0
- package/dist/skills/usable.js +521 -0
- package/dist/storage/purge.d.ts +22 -7
- package/dist/storage/purge.js +55 -3
- package/dist/storage/storage.module.d.ts +6 -0
- package/dist/storage/storage.module.js +23 -0
- package/dist/storage/storage.service.d.ts +20 -4
- package/dist/storage/storage.service.js +56 -4
- package/dist/themes/avatar-preset-key.d.ts +6 -0
- package/dist/themes/avatar-preset-key.js +9 -0
- package/dist/themes/platform-icon-objects.d.ts +51 -0
- package/dist/themes/platform-icon-objects.js +113 -0
- package/dist/themes/platform-icon-public.controller.d.ts +17 -0
- package/dist/themes/platform-icon-public.controller.js +58 -0
- package/dist/themes/platform-icon.controller.d.ts +22 -0
- package/dist/themes/platform-icon.controller.js +65 -0
- package/dist/themes/platform-icon.schemas.d.ts +48 -0
- package/dist/themes/platform-icon.schemas.js +53 -0
- package/dist/themes/platform-icon.service.d.ts +83 -0
- package/dist/themes/platform-icon.service.js +301 -0
- 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 +44 -0
- package/dist/themes/theme-delivery.service.js +131 -0
- package/dist/themes/theme-state.d.ts +157 -0
- package/dist/themes/theme-state.js +278 -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 +6 -0
- package/dist/themes/themes.module.js +26 -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 +77 -0
- package/dist/themes/themes.service.js +133 -0
- package/dist/time-zone.d.ts +5 -0
- package/dist/time-zone.js +19 -0
- package/dist/tools/admin-connectors.d.ts +71 -0
- package/dist/tools/admin-connectors.js +139 -0
- package/dist/tools/approvals.controller.d.ts +6 -2
- package/dist/tools/approvals.controller.js +49 -12
- package/dist/tools/approvals.schemas.d.ts +23 -0
- package/dist/tools/approvals.schemas.js +19 -0
- package/dist/tools/approvals.service.d.ts +605 -35
- package/dist/tools/approvals.service.js +1875 -238
- package/dist/tools/breaker.d.ts +2 -2
- package/dist/tools/breaker.js +21 -3
- package/dist/tools/builtin-names.d.ts +124 -0
- package/dist/tools/builtin-names.js +213 -0
- package/dist/tools/builtins/agent.d.ts +27 -25
- package/dist/tools/builtins/agent.js +70 -63
- package/dist/tools/builtins/artifacts.d.ts +69 -0
- package/dist/tools/builtins/artifacts.js +143 -0
- package/dist/tools/builtins/ask-user.d.ts +3 -3
- package/dist/tools/builtins/ask-user.js +6 -5
- package/dist/tools/builtins/builtin-tools.d.ts +66 -0
- package/dist/tools/builtins/builtin-tools.js +298 -0
- package/dist/tools/builtins/conversation-files.d.ts +48 -0
- package/dist/tools/builtins/conversation-files.js +162 -0
- 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/image/generate.d.ts +65 -0
- package/dist/tools/builtins/image/generate.js +594 -0
- package/dist/tools/builtins/image/index.d.ts +2 -0
- package/dist/tools/builtins/image/index.js +2 -0
- package/dist/tools/builtins/image/paths.d.ts +12 -0
- package/dist/tools/builtins/image/paths.js +26 -0
- package/dist/tools/builtins/image/size.d.ts +12 -0
- package/dist/tools/builtins/image/size.js +36 -0
- package/dist/tools/builtins/platform.d.ts +96 -0
- package/dist/tools/builtins/platform.js +756 -0
- package/dist/tools/builtins/read-tool-output.d.ts +3 -3
- package/dist/tools/builtins/read-tool-output.js +3 -3
- package/dist/tools/builtins/sandbox/bash.d.ts +58 -6
- package/dist/tools/builtins/sandbox/bash.js +463 -45
- package/dist/tools/builtins/sandbox/common.d.ts +300 -40
- package/dist/tools/builtins/sandbox/common.js +521 -140
- package/dist/tools/builtins/sandbox/deliver.d.ts +4 -1
- package/dist/tools/builtins/sandbox/deliver.js +122 -77
- 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/device-owner.d.ts +12 -0
- package/dist/tools/builtins/sandbox/device-owner.js +13 -0
- package/dist/tools/builtins/sandbox/edit.d.ts +1 -1
- package/dist/tools/builtins/sandbox/edit.js +72 -51
- package/dist/tools/builtins/sandbox/fetch-attachment.d.ts +10 -0
- package/dist/tools/builtins/sandbox/fetch-attachment.js +126 -0
- package/dist/tools/builtins/sandbox/file-state.d.ts +64 -0
- package/dist/tools/builtins/sandbox/file-state.js +64 -0
- package/dist/tools/builtins/sandbox/glob-match.d.ts +1 -1
- package/dist/tools/builtins/sandbox/glob-match.js +1 -1
- package/dist/tools/builtins/sandbox/glob.d.ts +1 -1
- package/dist/tools/builtins/sandbox/glob.js +27 -17
- package/dist/tools/builtins/sandbox/grep.d.ts +14 -4
- package/dist/tools/builtins/sandbox/grep.js +166 -52
- package/dist/tools/builtins/sandbox/index.d.ts +13 -5
- package/dist/tools/builtins/sandbox/index.js +21 -5
- package/dist/tools/builtins/sandbox/read.d.ts +57 -3
- package/dist/tools/builtins/sandbox/read.js +279 -47
- package/dist/tools/builtins/sandbox/search-command.d.ts +44 -0
- package/dist/tools/builtins/sandbox/search-command.js +94 -0
- package/dist/tools/builtins/sandbox/task-list.d.ts +12 -0
- package/dist/tools/builtins/sandbox/task-list.js +136 -0
- package/dist/tools/builtins/sandbox/task-output.d.ts +67 -0
- package/dist/tools/builtins/sandbox/task-output.js +458 -0
- package/dist/tools/builtins/sandbox/task-stop.d.ts +11 -0
- package/dist/tools/builtins/sandbox/task-stop.js +142 -0
- package/dist/tools/builtins/sandbox/write.d.ts +1 -1
- package/dist/tools/builtins/sandbox/write.js +59 -46
- package/dist/tools/builtins/schedules.d.ts +109 -0
- package/dist/tools/builtins/schedules.js +952 -0
- package/dist/tools/builtins/send-message.d.ts +56 -0
- package/dist/tools/builtins/send-message.js +101 -0
- package/dist/tools/builtins/size-text.d.ts +2 -0
- package/dist/tools/builtins/size-text.js +8 -0
- package/dist/tools/builtins/skill-load.d.ts +88 -25
- package/dist/tools/builtins/skill-load.js +363 -81
- package/dist/tools/builtins/tool-search.d.ts +9 -8
- package/dist/tools/builtins/tool-search.js +21 -13
- package/dist/tools/builtins/vision/read-image.d.ts +59 -0
- package/dist/tools/builtins/vision/read-image.js +220 -0
- package/dist/tools/builtins/web/errors.d.ts +8 -0
- package/dist/tools/builtins/web/errors.js +53 -0
- package/dist/tools/builtins/web/extract.d.ts +60 -0
- package/dist/tools/builtins/web/extract.js +268 -0
- package/dist/tools/builtins/web/fetch.d.ts +55 -0
- package/dist/tools/builtins/web/fetch.js +175 -0
- package/dist/tools/builtins/web/index.d.ts +13 -0
- package/dist/tools/builtins/web/index.js +12 -0
- package/dist/tools/builtins/web/page-cache.d.ts +25 -0
- package/dist/tools/builtins/web/page-cache.js +77 -0
- package/dist/tools/builtins/web/search.d.ts +25 -0
- package/dist/tools/builtins/web/search.js +208 -0
- package/dist/tools/builtins/web/url.d.ts +17 -0
- package/dist/tools/builtins/web/url.js +43 -0
- package/dist/tools/call-scope.d.ts +105 -0
- package/dist/tools/call-scope.js +81 -0
- package/dist/tools/canonical-json.d.ts +6 -0
- package/dist/tools/canonical-json.js +16 -0
- package/dist/tools/connector-account-policies.d.ts +86 -0
- package/dist/tools/connector-account-policies.js +223 -0
- package/dist/tools/connector-content.controller.d.ts +1 -1
- package/dist/tools/connector-content.controller.js +11 -6
- package/dist/tools/connector-content.d.ts +12 -15
- package/dist/tools/connector-content.js +54 -18
- package/dist/tools/connector-setup.d.ts +28 -0
- package/dist/tools/connector-setup.js +33 -0
- package/dist/tools/connector-tools-jobs.d.ts +35 -0
- package/dist/tools/connector-tools-jobs.js +40 -0
- package/dist/tools/connector-tools.processor.d.ts +32 -0
- package/dist/tools/connector-tools.processor.js +97 -0
- package/dist/tools/connectors.controller.d.ts +129 -19
- package/dist/tools/connectors.controller.js +222 -66
- package/dist/tools/connectors.schemas.d.ts +216 -0
- package/dist/tools/connectors.schemas.js +142 -0
- package/dist/tools/connectors.service.d.ts +367 -38
- package/dist/tools/connectors.service.js +1290 -392
- package/dist/tools/credentials.d.ts +95 -20
- package/dist/tools/credentials.js +294 -36
- package/dist/tools/credentials.module.d.ts +7 -0
- package/dist/tools/credentials.module.js +22 -0
- package/dist/tools/display-names.d.ts +9 -0
- package/dist/tools/display-names.js +24 -0
- package/dist/tools/drift.d.ts +39 -42
- package/dist/tools/drift.js +175 -107
- package/dist/tools/editable-endpoint.d.ts +23 -0
- package/dist/tools/editable-endpoint.js +92 -0
- package/dist/tools/elicitation.d.ts +2 -0
- package/dist/tools/elicitation.js +2 -2
- 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 +180 -0
- package/dist/tools/info.d.ts +92 -17
- package/dist/tools/info.js +186 -44
- package/dist/tools/job-ids.d.ts +9 -0
- package/dist/tools/job-ids.js +10 -0
- package/dist/tools/jobs.d.ts +24 -0
- package/dist/tools/jobs.js +69 -0
- package/dist/tools/naming.d.ts +1 -5
- package/dist/tools/naming.js +1 -7
- package/dist/tools/network-asks.d.ts +275 -0
- package/dist/tools/network-asks.js +415 -0
- package/dist/tools/oauth/authorization-params.d.ts +7 -0
- package/dist/tools/oauth/authorization-params.js +19 -0
- package/dist/tools/oauth/discovery.d.ts +40 -16
- package/dist/tools/oauth/discovery.js +62 -34
- package/dist/tools/oauth/flow-paths.d.ts +16 -0
- package/dist/tools/oauth/flow-paths.js +38 -0
- package/dist/tools/oauth/flow.d.ts +30 -30
- package/dist/tools/oauth/flow.js +119 -82
- package/dist/tools/oauth/oauth.controller.d.ts +6 -9
- package/dist/tools/oauth/oauth.controller.js +13 -19
- package/dist/tools/oauth/oauth.schemas.d.ts +14 -0
- package/dist/tools/oauth/oauth.schemas.js +27 -0
- package/dist/tools/oauth/tokens.d.ts +65 -10
- package/dist/tools/oauth/tokens.js +104 -32
- package/dist/tools/org-tool-switches.d.ts +89 -0
- package/dist/tools/org-tool-switches.js +201 -0
- package/dist/tools/outputs.d.ts +19 -8
- package/dist/tools/outputs.js +64 -16
- package/dist/tools/permission-approval-jobs.d.ts +18 -0
- package/dist/tools/permission-approval-jobs.js +95 -0
- package/dist/tools/pipeline.d.ts +589 -96
- package/dist/tools/pipeline.js +2641 -545
- package/dist/tools/policy.d.ts +55 -26
- package/dist/tools/policy.js +212 -67
- package/dist/tools/questions.controller.d.ts +2 -2
- package/dist/tools/questions.controller.js +11 -8
- package/dist/tools/questions.service.d.ts +145 -28
- package/dist/tools/questions.service.js +467 -142
- package/dist/tools/registry.d.ts +371 -94
- package/dist/tools/registry.js +446 -273
- package/dist/tools/resources.d.ts +1 -1
- package/dist/tools/resources.js +1 -1
- package/dist/tools/result-images.d.ts +91 -0
- package/dist/tools/result-images.js +195 -0
- package/dist/tools/specs.d.ts +5 -4
- package/dist/tools/specs.js +3 -1
- package/dist/tools/tool-review.d.ts +113 -0
- package/dist/tools/tool-review.js +303 -0
- package/dist/tools/tool-watch-queue.d.ts +45 -0
- package/dist/tools/tool-watch-queue.js +28 -0
- package/dist/tools/tool-watch-queue.module.d.ts +7 -0
- package/dist/tools/tool-watch-queue.module.js +24 -0
- package/dist/tools/tool-watch.processor.d.ts +35 -0
- package/dist/tools/tool-watch.processor.js +114 -0
- package/dist/tools/tool-watch.service.d.ts +46 -0
- package/dist/tools/tool-watch.service.js +199 -0
- package/dist/tools/tools.module.d.ts +10 -0
- package/dist/tools/tools.module.js +168 -0
- package/dist/tools/validate.js +1 -1
- package/dist/tools/watched-waits-lock.d.ts +15 -0
- package/dist/tools/watched-waits-lock.js +40 -0
- 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/call-extension.d.ts +16 -0
- package/dist/ui/call-extension.js +38 -0
- package/dist/ui/embed-token.d.ts +11 -7
- package/dist/ui/embed-token.js +140 -13
- 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 +41 -19
- package/dist/ui/ui-stream.js +97 -19
- package/dist/ui/ui.module.d.ts +7 -0
- package/dist/ui/ui.module.js +28 -0
- package/dist/ui/ui.schemas.d.ts +73 -0
- package/dist/ui/ui.schemas.js +73 -0
- package/dist/ui/views.controller.d.ts +46 -56
- package/dist/ui/views.controller.js +97 -94
- package/dist/ui/views.d.ts +151 -76
- package/dist/ui/views.js +359 -99
- package/dist/until-aborted.d.ts +5 -0
- package/dist/until-aborted.js +16 -0
- package/package.json +14 -3
- package/src/migrations/0063_tool_keys_claude_code.sql +220 -0
- package/src/migrations/0064_account_last_org.sql +7 -0
- package/src/migrations/0065_conversation_archive.sql +8 -0
- package/src/migrations/0066_extension_display_name.sql +4 -0
- package/src/migrations/0067_agent_profiles.sql +20 -0
- package/src/migrations/0068_agent_avatar_uploads.sql +7 -0
- package/src/migrations/0069_attachments_agent_idx.sql +3 -0
- package/src/migrations/0070_background_tasks.sql +37 -0
- package/src/migrations/0071_background_tasks_reserve.sql +6 -0
- package/src/migrations/0072_background_tasks_stopping.sql +5 -0
- package/src/migrations/0073_org_extension_point_defaults.sql +11 -0
- 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/src/migrations/0146_permission_authority_epochs.sql +6 -0
- package/src/migrations/0147_conversation_permission_profiles.sql +4 -0
- package/src/migrations/0148_first_message_request_hash.sql +2 -0
- package/src/migrations/0149_sandbox_operation_intents.sql +66 -0
- package/src/migrations/0150_permission_call_grants_and_approvals.sql +36 -0
- package/src/migrations/0151_starting_execution_grants.sql +8 -0
- package/src/migrations/0152_background_launch_identity.sql +66 -0
- package/src/migrations/0153_background_cancel_requester.sql +13 -0
- package/src/migrations/0154_cloud_owner_ceiling.sql +14 -0
- package/src/migrations/0155_device_instance_generations.sql +30 -0
- package/src/migrations/0156_device_owner_report.sql +7 -0
- package/src/migrations/0157_legacy_retirement.sql +116 -0
- package/src/migrations/0158_legacy_freeze_enumerated.sql +5 -0
- package/src/migrations/0159_retirement_exact_cancel.sql +9 -0
- package/src/migrations/0160_model_usage_image_kind.sql +10 -0
- package/src/migrations/0161_file_shares.sql +35 -0
- package/src/migrations/0162_permission_call_escalation.sql +9 -0
- package/src/migrations/0163_read_attachments.sql +10 -0
- package/src/migrations/0164_platform_icons.sql +10 -0
- package/src/migrations/0165_device_network_columns.sql +50 -0
- package/src/migrations/0166_permission_grant_full_access.sql +17 -0
- package/src/migrations/0167_device_network_backfill.sql +32 -0
- package/src/migrations/0168_binding_installed_connection.sql +6 -0
- package/src/migrations/0169_platform_sealed_inputs.sql +23 -0
- package/src/migrations/0170_platform_sealed_reveals.sql +27 -0
- package/src/migrations/0171_account_avatar.sql +26 -0
- package/src/migrations/0172_push.sql +40 -0
- package/src/migrations/0173_push_auth_notice.sql +10 -0
- package/src/migrations/0174_marketplace_managed_username.sql +4 -0
- package/src/migrations/0175_secure_input_kind.sql +8 -0
- package/src/migrations/0176_device_report.sql +6 -0
- package/src/migrations/0177_dial_in_contract.sql +32 -0
- package/src/migrations/0178_bootstrap_run_extra.sql +17 -0
- package/src/migrations/0179_device_report_limit_text.sql +28 -0
- package/src/migrations/0180_device_instance_abandoned.sql +6 -0
- package/src/migrations/0181_connector_description.sql +3 -0
- package/src/migrations/0182_rls_policies.sql +202 -0
- package/src/migrations/0183_connectors_created_by_nullable.sql +5 -0
- package/src/migrations/0184_background_cancel_failure.sql +10 -0
- package/src/migrations/0185_channel_process_display.sql +13 -0
- package/src/migrations/0186_question_woken.sql +5 -0
- package/src/migrations/0187_device_conversation_notices.sql +35 -0
- package/dist/catalog/upgrade-targets.d.ts +0 -59
- package/dist/catalog/upgrade-targets.js +0 -90
- package/dist/conversations/sandbox-status.d.ts +0 -21
- package/dist/conversations/sandbox-status.js +0 -24
- package/dist/extensions/org-config.controller.d.ts +0 -24
- package/dist/extensions/org-config.controller.js +0 -59
- package/dist/http/gateway.module.d.ts +0 -15
- package/dist/http/gateway.module.js +0 -13
- package/dist/http/health.controller.d.ts +0 -26
- package/dist/http/health.controller.js +0 -79
- package/dist/http/tokens.d.ts +0 -131
- package/dist/http/tokens.js +0 -131
- package/dist/http/zod.pipe.d.ts +0 -8
- package/dist/http/zod.pipe.js +0 -14
- package/dist/identity/enterprise-admin.d.ts +0 -14
- package/dist/identity/enterprise-admin.js +0 -27
- package/dist/identity/rate-limit.d.ts +0 -55
- package/dist/identity/rate-limit.js +0 -121
- package/dist/sandbox/lifecycle.d.ts +0 -21
- package/dist/sandbox/lifecycle.js +0 -68
- package/dist/tools/builtins/sandbox/names.d.ts +0 -7
- package/dist/tools/builtins/sandbox/names.js +0 -20
- package/dist/tools/builtins/skill-write.d.ts +0 -59
- package/dist/tools/builtins/skill-write.js +0 -244
|
@@ -1,699 +1,808 @@
|
|
|
1
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
// The platform plugin update (plugin and component management spec §7, plugin scope phase 2,
|
|
11
|
+
// Task 7): a platform plugin has one version for the deployment, so an update is previewed and
|
|
12
|
+
// confirmed once by the super admin, per component. The per-org upgrade routes are retired (ruling
|
|
13
|
+
// F2).
|
|
14
|
+
import { createHash } from "node:crypto";
|
|
15
|
+
import { SDK_VERSION } from "@capybara-hq/plugin-sdk";
|
|
16
|
+
import { Inject, Injectable } from "@nestjs/common";
|
|
2
17
|
import { sql } from "kysely";
|
|
3
|
-
import { putTemplateVersionIn } from "../agents/templates.js";
|
|
4
18
|
import { ApiError } from "../errors.js";
|
|
5
|
-
import {
|
|
19
|
+
import { ExtensionAdminOps } from "../extensions/admin-ops.js";
|
|
20
|
+
import { ExtensionBlobs } from "../extensions/blobs.js";
|
|
21
|
+
import { permissionSetOfPackage, readExtensionPackage } from "../extensions/package.js";
|
|
22
|
+
import { blockingKeys, diffPermissions } from "../extensions/permission-set.js";
|
|
23
|
+
import { PluginGuides } from "../extensions/plugin-guides.js";
|
|
24
|
+
import { ExtensionRegistry } from "../extensions/registry.js";
|
|
6
25
|
import { audit } from "../identity/audit.js";
|
|
7
|
-
import {
|
|
26
|
+
import { SuperAdminLock } from "../identity/super-admin.js";
|
|
27
|
+
import { addOrgNotice, itemDisplayName, notifySharedUpdate } from "../inbox/org-notices.js";
|
|
28
|
+
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
29
|
+
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
30
|
+
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
31
|
+
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
32
|
+
import { LockService } from "../infra/lock/lock.service.js";
|
|
33
|
+
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
34
|
+
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
35
|
+
import { OrgLock } from "../orgs/org-lock.js";
|
|
8
36
|
import { packagePath } from "../packages/tgz.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
37
|
+
import { StorageService } from "../storage/storage.service.js";
|
|
38
|
+
import { assertNotPlatformDefault, pickedByIn, themesPreview, } from "../themes/theme-usage.js";
|
|
39
|
+
import { canonicalJson } from "../tools/canonical-json.js";
|
|
40
|
+
import { setupNeed } from "../tools/connector-setup.js";
|
|
41
|
+
import { ConnectorsService } from "../tools/connectors.service.js";
|
|
42
|
+
import { dirDigest, getPath, readCatalogAgentTemplates, readCatalogTemplates, readCatalogThemes, setPath, skillFilesDigest, templatePluginProblem, themeAssetsDigest, } from "./catalog-content.js";
|
|
43
|
+
import { markVersionApplied, versionUsable } from "./catalog-items.js";
|
|
44
|
+
import { agentsUsing, clashingOrgSkills, clashingPlatformSkills, componentOn, connectorsMadeFrom, connectorTemplatesOn, listedIn, loadComponents, loadScopeState, pluginFactsOf, switchOf, themeIdClashes, } from "./component-state.js";
|
|
45
|
+
import { credentialKey } from "./credential-key.js";
|
|
46
|
+
import { LIVE_INSTALL_STATUSES } from "./install-status.js";
|
|
47
|
+
import { CatalogItemLock } from "./locks.js";
|
|
48
|
+
import { isUsable, itemPendingError, itemRemovedError } from "./ownership.js";
|
|
49
|
+
import { PlanStale, PlatformComponents } from "./platform-components.js";
|
|
50
|
+
import { catalogSkillNames, PluginInstaller } from "./plugin-install.js";
|
|
51
|
+
import { wantedOn } from "./scope.js";
|
|
52
|
+
import { PluginScopeSync } from "./scope-sync.js";
|
|
53
|
+
import { oweTemplateConnectors } from "./template-connector-jobs.js";
|
|
54
|
+
import { compareVersions, satisfiesRange } from "./versions.js";
|
|
16
55
|
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
17
|
-
const installNotFound = () => new ApiError("plugin.install_not_found", "Plugin install not found");
|
|
18
|
-
const inProgress = () => new ApiError("plugin.install_in_progress", "This plugin install is being installed, upgraded or uninstalled; try again when it finishes");
|
|
19
|
-
const stale = () => new ApiError("plugin.upgrade_stale", "The upgrade preview is out of date (the catalog version or this install's components changed); preview the upgrade again");
|
|
20
|
-
const targetInvalid = (message, details) => new ApiError("plugin.upgrade_target_invalid", message, details);
|
|
21
|
-
const fail = (path, message) => new ApiError("validation_failed", "Request validation failed", [{ path, message }]);
|
|
22
56
|
const sha256 = (s) => createHash("sha256").update(s).digest("hex");
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
default:
|
|
39
|
-
return canonicalJson(auth);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
57
|
+
const itemNotFound = () => new ApiError("catalog.item_not_found", "Catalog item not found");
|
|
58
|
+
const stale = () => new ApiError("plugin.upgrade_stale", "The update preview is out of date (the catalog version, the platform components, a pin or a connector changed); preview the update again");
|
|
59
|
+
/** The pending version a super admin confirms was replaced by another upload (P3-11). */
|
|
60
|
+
const pendingStale = (name) => new ApiError("extension.approval_stale", `The pending upload of ${name} changed since it was reviewed; review it again`);
|
|
61
|
+
const targetInvalid = (message, details) => new ApiError("plugin.upgrade_target_invalid", message, details);
|
|
62
|
+
/** A version an org uploaded that was never applied or confirmed, or was rejected (P3-37, P3-52). */
|
|
63
|
+
const notApplied = (name, version) => targetInvalid(`Version ${version} of plugin ${name} was uploaded by an organization and never applied or confirmed (or was rejected); the generic update cannot apply it`, [{ reason: "org_version_not_applied", version }]);
|
|
64
|
+
const KIND_ORDER = {
|
|
65
|
+
skill: 0,
|
|
66
|
+
agent_template: 1,
|
|
67
|
+
connector_template: 2,
|
|
68
|
+
theme: 3,
|
|
69
|
+
};
|
|
70
|
+
/** How long one update holds its item (renewed while it runs). */
|
|
71
|
+
const UPDATE_LOCK_TTL_MS = 60_000;
|
|
42
72
|
/** The digest of all files of a catalog version. */
|
|
43
|
-
const filesDigest = (row) =>
|
|
44
|
-
.map((f) => `${f.path}\0${f.sha256}\n`)
|
|
45
|
-
.sort()
|
|
46
|
-
.join(""));
|
|
47
|
-
/** The digest of the files under `dir/` of a catalog version (paths relative to it). */
|
|
48
|
-
function dirDigest(row, dir) {
|
|
49
|
-
const prefix = `${dir}/`;
|
|
50
|
-
return sha256(row.files
|
|
51
|
-
.filter((f) => f.path.startsWith(prefix))
|
|
52
|
-
.map((f) => `${f.path.slice(prefix.length)}\0${f.sha256}\n`)
|
|
53
|
-
.sort()
|
|
54
|
-
.join(""));
|
|
55
|
-
}
|
|
73
|
+
const filesDigest = (row) => skillFilesDigest(row.files.map((f) => ({ path: f.path, sha256: f.sha256 })));
|
|
56
74
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* the
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
75
|
+
* The platform plugin update (spec §7; ruling F2 retires the per-org upgrades):
|
|
76
|
+
* - **preview** diffs the platform's current components of the plugin (the version recorded in
|
|
77
|
+
* `catalog_items.platform_synced_version`, components updated on their own included) against a
|
|
78
|
+
* catalog version: each skill (by name, by its files' digest), agent template (by name, canonical
|
|
79
|
+
* definition) and connector template (by id, canonical file) is `added`, `removed`, `same`, or
|
|
80
|
+
* `upgrade` / `downgrade` (the target's direction from the component's catalog version). It marks
|
|
81
|
+
* components updated on their own, components with their own scope and the orgs whose linked
|
|
82
|
+
* copy is pinned; lists removed components agents still use (they stay, spec §7.3), the org
|
|
83
|
+
* connectors made from changed templates (all orgs, ruling E2; `credentialsReset` when the
|
|
84
|
+
* credential shape changed), the connectors it creates from the templates it turns on (added,
|
|
85
|
+
* or no longer shipped off; plugin pages spec §5.2.3) with the setup state each starts in, the
|
|
86
|
+
* templates it turns off (now shipped off, on only by default), the orgs where the scope sync
|
|
87
|
+
* owed with it will install the plugin, the deployment's extension move, and a `diffHash`. Refused: same version, a disabled or deleted
|
|
88
|
+
* item, a target without the extension the deployment runs for it or moving a config-declared
|
|
89
|
+
* one, a template moving to another connector, a plugin another platform plugin depends on
|
|
90
|
+
* outside its range, and an added skill whose name is taken where the plugin is on (rule 10).
|
|
91
|
+
* - **update** runs under a Redis lock per item (another update -> `plugin.install_in_progress`):
|
|
92
|
+
* the extension first (`ExtensionAdminOps.install`, enabled when the update installs it; added
|
|
93
|
+
* permissions wait for the admin's approval as for any extension upgrade), then one transaction
|
|
94
|
+
* under the item name's lock that recomputes the diff (`plugin.upgrade_stale` on a difference)
|
|
95
|
+
* and writes the platform versions (`PlatformComponents.applySyncIn`, which records
|
|
96
|
+
* `platform_synced_version`), the removals (a component no agent uses is soft-deleted, so
|
|
97
|
+
* unpinned linked copies go with it; pinned copies keep their own version; a removed connector
|
|
98
|
+
* template leaves its connectors as the orgs' own), clears the pins of linked copies, fans
|
|
99
|
+
* changed templates out to every connector made from them (`applyTemplateIn`, under each org's
|
|
100
|
+
* row lock, credentials cleared only for a changed credential shape), creates the connectors of
|
|
101
|
+
* the templates it turns on (`ConnectorsService.createDeferredIn`, no outbound call, those orgs
|
|
102
|
+
* locked with the others), moves every org install to the version and audits
|
|
103
|
+
* `plugin.platform_updated`; the scope sync of the item and its dependencies is owed in that
|
|
104
|
+
* transaction (orgs get new dependencies by rule 9). A failure rolls the transaction back and
|
|
105
|
+
* puts the extension back where it was (audit `plugin.platform_update_failed`, 502
|
|
106
|
+
* `plugin.upgrade_failed`); files copied to `deployment/platform/` stay unreferenced.
|
|
107
|
+
* Transaction size: the whole fan-out (every changed template's connectors and every created
|
|
108
|
+
* connector, in every org where the plugin is on) is one transaction holding every touched org's
|
|
109
|
+
* row lock, with no batching; it grows with orgs x templates, so a deployment with very many orgs
|
|
110
|
+
* sees one long transaction (and other writes to those orgs waiting) per update. Deferred
|
|
111
|
+
* connectors (ruling R27) add one outbox row per org and no connector rows. Builtin plugins get no
|
|
112
|
+
* created connectors (ruling R28).
|
|
113
|
+
* Storage is never read or written inside the transaction: the target's contents (and the
|
|
114
|
+
* extension package, for `needsApproval`) are read and the platform files copied
|
|
115
|
+
* (`PlatformComponents.prepareSync`) after the Redis lock is taken and before the transaction,
|
|
116
|
+
* which reuses them and writes rows only (`applySyncIn`). The confirm-time diff treats the
|
|
117
|
+
* extension this update moved as expected (the install record must point at that package).
|
|
118
|
+
* Recovery: a process that dies between the extension step and the transaction leaves the
|
|
119
|
+
* deployment on the target's extension with the platform components unchanged; a new preview
|
|
120
|
+
* then shows the extension unchanged (`extension: null`) and the components still to move, and
|
|
121
|
+
* confirming it completes the update (or an update back to the old version moves it back).
|
|
122
|
+
* No in-process state.
|
|
80
123
|
*/
|
|
81
|
-
|
|
124
|
+
let PlatformPluginUpdater = class PlatformPluginUpdater {
|
|
125
|
+
kdb;
|
|
126
|
+
txHost;
|
|
127
|
+
adminLock;
|
|
128
|
+
itemLock;
|
|
129
|
+
orgLock;
|
|
130
|
+
locks;
|
|
131
|
+
storage;
|
|
132
|
+
registry;
|
|
133
|
+
ops;
|
|
134
|
+
blobs;
|
|
135
|
+
config;
|
|
136
|
+
platform;
|
|
82
137
|
installer;
|
|
83
|
-
|
|
84
|
-
|
|
138
|
+
connectors;
|
|
139
|
+
sync;
|
|
140
|
+
log;
|
|
141
|
+
guides;
|
|
142
|
+
outbox;
|
|
143
|
+
constructor(kdb, txHost, adminLock, itemLock, orgLock, locks, storage, registry, ops,
|
|
144
|
+
/** Reads the target's extension package (its permissions, for `needsApproval`). */
|
|
145
|
+
blobs, config, platform,
|
|
146
|
+
/** Template dependencies (the deployed connector kinds). */
|
|
147
|
+
installer, connectors, sync, log,
|
|
148
|
+
/** The connector template guides an update changes (the preview's `guideChanges`). */
|
|
149
|
+
guides,
|
|
150
|
+
/** Owes the template connector ensure of the orgs with a deferred connector (ruling R27). */
|
|
151
|
+
outbox) {
|
|
152
|
+
this.kdb = kdb;
|
|
153
|
+
this.txHost = txHost;
|
|
154
|
+
this.adminLock = adminLock;
|
|
155
|
+
this.itemLock = itemLock;
|
|
156
|
+
this.orgLock = orgLock;
|
|
157
|
+
this.locks = locks;
|
|
158
|
+
this.storage = storage;
|
|
159
|
+
this.registry = registry;
|
|
160
|
+
this.ops = ops;
|
|
161
|
+
this.blobs = blobs;
|
|
162
|
+
this.config = config;
|
|
163
|
+
this.platform = platform;
|
|
85
164
|
this.installer = installer;
|
|
86
|
-
this.
|
|
165
|
+
this.connectors = connectors;
|
|
166
|
+
this.sync = sync;
|
|
167
|
+
this.log = log;
|
|
168
|
+
this.guides = guides;
|
|
169
|
+
this.outbox = outbox;
|
|
170
|
+
}
|
|
171
|
+
get db() {
|
|
172
|
+
return this.kdb.db;
|
|
173
|
+
}
|
|
174
|
+
/** The update preview (see the class comment); writes nothing. */
|
|
175
|
+
async preview(itemId, version) {
|
|
176
|
+
return this.withGuideChanges(await this.diff(itemId, version));
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The update preview of a version staged for import, not imported yet (the platform's import and
|
|
180
|
+
* update, `PlatformImportUpdate`): the same diff as {@link preview}, with the target read from the
|
|
181
|
+
* staging (`target`, whose files are where the import's version row will point), so the
|
|
182
|
+
* `diffHash` is the one {@link updateHeld} recomputes after the import. Writes nothing.
|
|
183
|
+
*/
|
|
184
|
+
async previewStaged(itemId, version, target) {
|
|
185
|
+
if (target.version !== version) {
|
|
186
|
+
throw new Error(`internal: previewStaged got the staged target of version ${target.version} for version ${version}`);
|
|
187
|
+
}
|
|
188
|
+
return this.withGuideChanges(await this.diff(itemId, version, { target }));
|
|
87
189
|
}
|
|
88
|
-
/** The
|
|
89
|
-
async
|
|
90
|
-
await this.recoverInterrupted(orgId, actor, installId);
|
|
91
|
-
const diff = await this.diff(orgId, actor, installId, version, null);
|
|
92
|
-
await this.d.db.transaction().execute((t) => lockOrgForActions(t, orgId, actor, diff.actions));
|
|
190
|
+
/** The preview of a diff with the template guides it changes. */
|
|
191
|
+
async withGuideChanges(d) {
|
|
93
192
|
return {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
diffHash: diff.diffHash,
|
|
97
|
-
components: diff.components,
|
|
98
|
-
inputs: diff.inputs,
|
|
99
|
-
templates: diff.templates.flatMap((c) => c.target !== undefined &&
|
|
100
|
-
(diff.inputs.connectors.includes(c.id) || diff.inputs.credentialsChanged.includes(c.id))
|
|
101
|
-
? [orgTemplateView(c.id, c.target)]
|
|
102
|
-
: []),
|
|
193
|
+
...previewOf(d),
|
|
194
|
+
guideChanges: await this.guides.templateGuideChanges(d.itemId, d.from, d.to),
|
|
103
195
|
};
|
|
104
196
|
}
|
|
105
197
|
/**
|
|
106
|
-
* The
|
|
107
|
-
*
|
|
108
|
-
*
|
|
198
|
+
* The update preview of a new version of an org's own plugin (ruling P3-12): the item must be
|
|
199
|
+
* owned by `orgId` (else 404, as for any item the org cannot see), the target carries no
|
|
200
|
+
* extension (an extension-bearing version waits for the super admin, plan Task 6), and a target
|
|
201
|
+
* dropping the deployment's extension is allowed (P3-12'). `staged` is the target read from the
|
|
202
|
+
* org's staging (pre-flight F3); without it the imported version `version` is read. The route
|
|
203
|
+
* authorizes the org admin; writes nothing.
|
|
109
204
|
*/
|
|
110
|
-
async
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (
|
|
114
|
-
throw
|
|
115
|
-
|
|
205
|
+
async previewForOwner(orgId, itemId, version, staged) {
|
|
206
|
+
// An internal invariant, not reachable from input: the only caller (OrgPluginUploads) passes
|
|
207
|
+
// the staged target together with its own version (PluginImport.stagedTarget)
|
|
208
|
+
if (staged !== undefined && staged.version !== version) {
|
|
209
|
+
throw new Error(`internal: previewForOwner got the staged target of version ${staged.version} for version ${version}`);
|
|
210
|
+
}
|
|
211
|
+
const preview = await this.withGuideChanges(await this.diff(itemId, version, {
|
|
212
|
+
owner: { orgId },
|
|
213
|
+
...(staged !== undefined && { target: staged }),
|
|
214
|
+
}));
|
|
215
|
+
// The owner sees the names of the orgs whose default a removed theme is (named like the other
|
|
216
|
+
// orgs the preview mentions, P3-14 / P3-19), but people only of its own org: other orgs'
|
|
217
|
+
// member counts were never disclosed to it. Display only: `diffHash` covers the full preview.
|
|
218
|
+
const themes = preview.themes === undefined
|
|
219
|
+
? undefined
|
|
220
|
+
: await Promise.all(preview.themes.map(async (t) => ({
|
|
221
|
+
...t,
|
|
222
|
+
pickedBy: await pickedByIn(this.db, t.id, new Set([orgId])),
|
|
223
|
+
})));
|
|
224
|
+
// Other orgs' scope sync failures are theirs: the owner sees only that the scope sync will try
|
|
225
|
+
// to install there (their names, P3-19), not whether or why it failed. Display only as well
|
|
226
|
+
const scopeInstalls = preview.scopeInstalls.map((o) => o.orgId === orgId ? o : { orgId: o.orgId, orgName: o.orgName });
|
|
227
|
+
const owned = { ...preview, scopeInstalls, ...(themes !== undefined && { themes }) };
|
|
228
|
+
return { ...owned, orgNames: await this.orgNamesOf(owned) };
|
|
116
229
|
}
|
|
117
230
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
231
|
+
* Locks, in sorted order and before the item (ruling P3-50), every live org the update may
|
|
232
|
+
* write in: the orgs with connectors made from the plugin's connector templates, the orgs the
|
|
233
|
+
* update creates connectors in (`creating`, from the diff before the transaction) and the item's
|
|
234
|
+
* owner org. `acting`: the owner org an owner update acts for, locked with its admin re-checked
|
|
235
|
+
* (`catalog.upload`; deleted -> 404 `org.not_found`). Returns the live orgs locked; another
|
|
236
|
+
* deleted one is skipped.
|
|
121
237
|
*/
|
|
122
|
-
async
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
238
|
+
async lockUpdateOrgs(itemId, creating, acting) {
|
|
239
|
+
const item = await this.db
|
|
240
|
+
.selectFrom("catalog_items")
|
|
241
|
+
.select("owner_org_id")
|
|
242
|
+
.where("id", "=", itemId)
|
|
243
|
+
.executeTakeFirst();
|
|
244
|
+
const made = await this.db
|
|
245
|
+
.selectFrom("connectors as c")
|
|
246
|
+
.innerJoin("platform_connector_templates as t", "t.id", "c.platform_template_id")
|
|
247
|
+
.select("c.org_id")
|
|
248
|
+
.distinct()
|
|
249
|
+
.where("t.catalog_item_id", "=", itemId)
|
|
250
|
+
.where("c.deleted_at", "is", null)
|
|
251
|
+
.execute();
|
|
252
|
+
const ids = new Set([...made.map((r) => r.org_id), ...creating]);
|
|
253
|
+
if (item?.owner_org_id)
|
|
254
|
+
ids.add(item.owner_org_id);
|
|
255
|
+
if (acting !== undefined)
|
|
256
|
+
ids.add(acting.orgId);
|
|
257
|
+
const live = new Set();
|
|
258
|
+
for (const orgId of [...ids].sort()) {
|
|
259
|
+
if (orgId === acting?.orgId) {
|
|
260
|
+
await this.orgLock.lockAndAuthorize(orgId, acting.actor, "catalog.upload");
|
|
261
|
+
live.add(orgId);
|
|
262
|
+
}
|
|
263
|
+
else if (await this.orgLock.tryLock(orgId)) {
|
|
264
|
+
live.add(orgId);
|
|
265
|
+
}
|
|
129
266
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
267
|
+
return live;
|
|
268
|
+
}
|
|
269
|
+
/** The names of the orgs a preview mentions, by id (an owner's preview, see `orgNames`). */
|
|
270
|
+
async orgNamesOf(p) {
|
|
271
|
+
const ids = new Set([
|
|
272
|
+
...(p.extension?.orgs ?? []),
|
|
273
|
+
...p.connectorOrgs.map((c) => c.orgId),
|
|
274
|
+
...p.scopeInstalls.map((o) => o.orgId),
|
|
275
|
+
...p.components.flatMap((c) => [...c.pinnedOrgs, ...(c.kept ?? []).map((k) => k.orgId)]),
|
|
276
|
+
...(p.themes ?? []).flatMap((t) => t.orgDefaults.map((o) => o.orgId)),
|
|
277
|
+
]);
|
|
278
|
+
if (ids.size === 0)
|
|
279
|
+
return {};
|
|
280
|
+
const rows = await this.db
|
|
281
|
+
.selectFrom("orgs")
|
|
282
|
+
.select(["id", "name"])
|
|
283
|
+
.where("id", "in", [...ids])
|
|
284
|
+
.where("deleted_at", "is", null)
|
|
285
|
+
.execute();
|
|
286
|
+
return Object.fromEntries(rows.map((r) => [r.id, r.name]));
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Applies a new version of an org's own plugin for its owner (ruling P3-12, see
|
|
290
|
+
* {@link previewForOwner}): the actor must be an admin of the owner org (`catalog.upload`,
|
|
291
|
+
* re-checked under the org row lock in the transaction), then the platform update as
|
|
292
|
+
* {@link update} does, also removing the extension when the target drops it. In the update's
|
|
293
|
+
* transaction the orgs using the shared plugin are told (`shared_item_updated`, one notice per
|
|
294
|
+
* plugin) and a pending version is cleared (pre-flight F7: the new version replaces it).
|
|
295
|
+
*/
|
|
296
|
+
async updateAsOwner(orgId, actor, itemId, version, diffHash, opts = {}) {
|
|
297
|
+
if (!UUID_RE.test(itemId))
|
|
298
|
+
throw itemNotFound();
|
|
299
|
+
await this.authorizeOwner(orgId, actor);
|
|
300
|
+
return this.locked(itemId, () => this.updateLocked(actor, itemId, { version, diffHash }, opts, { orgId }));
|
|
301
|
+
}
|
|
302
|
+
/** The actor is an admin of the owner org (a read of the membership under the org row lock). */
|
|
303
|
+
async authorizeOwner(orgId, actor) {
|
|
304
|
+
await this.orgLock.lockAndAuthorize(orgId, actor, "catalog.upload");
|
|
305
|
+
}
|
|
306
|
+
/** Runs `f` holding the item's update lock (another update -> `plugin.install_in_progress`). */
|
|
307
|
+
async locked(itemId, f) {
|
|
308
|
+
const handle = await this.locks.acquire(`plugin-update-${itemId}`, {
|
|
309
|
+
ttlMs: UPDATE_LOCK_TTL_MS,
|
|
310
|
+
});
|
|
311
|
+
if (!handle) {
|
|
312
|
+
throw new ApiError("plugin.install_in_progress", "This plugin is being updated; try again when that update finishes");
|
|
135
313
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
await
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
314
|
+
try {
|
|
315
|
+
return await f();
|
|
316
|
+
}
|
|
317
|
+
finally {
|
|
318
|
+
await handle.release();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* The super admin's confirmation of an org upload's pending new version (rulings P3-10, P3-21,
|
|
323
|
+
* pre-flight F8): the update to `version` as {@link update} does it (the super admin's, the
|
|
324
|
+
* extension installed or upgraded on the deployment), with the version allowed although it is
|
|
325
|
+
* pending. Its transaction re-reads the item under the row lock: removed meanwhile -> 409
|
|
326
|
+
* `catalog.item_removed`, the pending version replaced -> 409 `extension.approval_stale` (both
|
|
327
|
+
* undo the extension step); then the pending state is cleared and the owner told
|
|
328
|
+
* (`upload_confirmed`). The caller checked the digest of the version's package.
|
|
329
|
+
*/
|
|
330
|
+
async updateToPending(actor, itemId, version, opts = {}) {
|
|
331
|
+
if (!UUID_RE.test(itemId))
|
|
332
|
+
throw itemNotFound();
|
|
333
|
+
return this.locked(itemId, () => this.updateToPendingLocked(actor, itemId, version, opts));
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* {@link updateToPending} for a caller already holding the item's update lock
|
|
337
|
+
* ({@link withItemLock}): the super admin's confirmation runs all its steps under it (ruling
|
|
338
|
+
* P3-35).
|
|
339
|
+
*/
|
|
340
|
+
async updateToPendingLocked(actor, itemId, version, opts = {}) {
|
|
341
|
+
const d = await this.diff(itemId, version, { confirmPending: version });
|
|
342
|
+
return this.updateLocked(actor, itemId, { version, diffHash: d.diffHash }, opts, undefined, version);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Runs `f` holding the item's update lock (the one every platform update of the item takes;
|
|
346
|
+
* another holder -> 409 `plugin.install_in_progress`): the super admin's confirmation of an org
|
|
347
|
+
* upload runs every step under it (ruling P3-35).
|
|
348
|
+
*/
|
|
349
|
+
withItemLock(itemId, f) {
|
|
350
|
+
if (!UUID_RE.test(itemId))
|
|
351
|
+
throw itemNotFound();
|
|
352
|
+
return this.locked(itemId, f);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* {@link update} for a caller already holding the item's update lock ({@link withItemLock}):
|
|
356
|
+
* the platform's import and update runs its import and this update under one hold.
|
|
357
|
+
*/
|
|
358
|
+
async updateHeld(actor, itemId, input, opts = {}) {
|
|
359
|
+
return this.updateLocked(actor, itemId, input, opts);
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Runs an update confirmed with the preview's `diffHash` (see the class comment). A version an
|
|
363
|
+
* org upload waits with, or an item whose first version waits, -> 409 `catalog.item_pending`
|
|
364
|
+
* (confirmed in the admin console's pending confirmations instead, pre-flight F8). `actor`
|
|
365
|
+
* null: the kernel itself (the bootstrap step raising a pinned plugin without an extension): no
|
|
366
|
+
* super admin is re-checked and the audits name no account.
|
|
367
|
+
*/
|
|
368
|
+
async update(actor, itemId, input, opts = {}) {
|
|
369
|
+
if (!UUID_RE.test(itemId))
|
|
370
|
+
throw itemNotFound();
|
|
371
|
+
return this.locked(itemId, () => this.updateLocked(actor, itemId, input, opts));
|
|
372
|
+
}
|
|
373
|
+
async updateLocked(actor, itemId, input, opts, owner, confirmPending) {
|
|
374
|
+
// Storage is read and written here, before any transaction (see the class comment)
|
|
375
|
+
const checked = await this.diff(itemId, input.version, {
|
|
376
|
+
...(owner && { owner }),
|
|
377
|
+
...(confirmPending !== undefined && { confirmPending }),
|
|
165
378
|
});
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
.where(sql `upgrade->>'id'`, "=", upgradeId)
|
|
180
|
-
.executeTakeFirst();
|
|
181
|
-
if (r.numUpdatedRows === 0n)
|
|
182
|
-
throw cleanedUp();
|
|
183
|
-
unjournaled = undefined;
|
|
184
|
-
};
|
|
185
|
-
// Records a component in the ledger and the journal, in the given transaction
|
|
186
|
-
const record = async (c, t) => {
|
|
187
|
-
const inserted = await t
|
|
188
|
-
.insertInto("plugin_install_components")
|
|
189
|
-
.values({
|
|
190
|
-
install_id: installId,
|
|
191
|
-
kind: c.kind,
|
|
192
|
-
ref: c.ref,
|
|
193
|
-
created: c.created,
|
|
194
|
-
skill_version: c.skillVersion,
|
|
195
|
-
template_id: c.templateId ?? null,
|
|
196
|
-
})
|
|
197
|
-
.onConflict((oc) => oc.columns(["install_id", "kind", "ref"]).doNothing())
|
|
198
|
-
.returning("ref")
|
|
199
|
-
.executeTakeFirst();
|
|
200
|
-
if (c.created)
|
|
201
|
-
await journal({ op: "created", kind: c.kind, ref: c.ref }, t);
|
|
202
|
-
else if (inserted)
|
|
203
|
-
await journal({ op: "recorded", kind: c.kind, ref: c.ref }, t);
|
|
204
|
-
};
|
|
205
|
-
let step = "dependencies";
|
|
206
|
-
const disabled = [];
|
|
379
|
+
if (checked.diffHash !== input.diffHash)
|
|
380
|
+
throw stale();
|
|
381
|
+
const prepared = await this.platform.prepareSync(itemId, input.version);
|
|
382
|
+
const ext = checked.extension;
|
|
383
|
+
// The extension admin re-checks the actor: a super admin, or for an owner update the owner
|
|
384
|
+
// org's admin (and audits it with `ownerOrgId`)
|
|
385
|
+
const opsOwner = owner && { orgId: owner.orgId };
|
|
386
|
+
let step = "extension";
|
|
387
|
+
let extensionMoved = false;
|
|
388
|
+
let enabledHere = false;
|
|
389
|
+
let leftDisabled;
|
|
390
|
+
/** A removal: the extension was enabled before it (put back enabled on failure). */
|
|
391
|
+
let removedEnabled = false;
|
|
207
392
|
try {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
393
|
+
if (ext?.sha256 === null) {
|
|
394
|
+
// The target drops the extension (P3-12'): disabled (drained), then uninstalled
|
|
395
|
+
const row = await this.db
|
|
396
|
+
.selectFrom("extension_installs")
|
|
397
|
+
.select("desired_state")
|
|
398
|
+
.where("name", "=", checked.name)
|
|
399
|
+
.executeTakeFirst();
|
|
400
|
+
removedEnabled = row?.desired_state === "enabled";
|
|
401
|
+
await this.ops.disable(checked.name, actor, opts.actorTokenId, opsOwner);
|
|
402
|
+
extensionMoved = true;
|
|
403
|
+
await this.ops.uninstall(checked.name, actor, opts.actorTokenId, opsOwner);
|
|
404
|
+
}
|
|
405
|
+
else if (ext) {
|
|
406
|
+
const installed = await this.ops.install(checked.name, ext.sha256, actor, opts.actorTokenId, { catalogItemId: itemId, ...(opsOwner && { owner: opsOwner }) });
|
|
407
|
+
extensionMoved = true;
|
|
408
|
+
// A new version newly providing a held single-provider point: left disabled by the install
|
|
409
|
+
leftDisabled = installed.leftDisabled;
|
|
410
|
+
if (ext.previous === null) {
|
|
411
|
+
// An occupied single-provider point leaves it installed disabled
|
|
412
|
+
const r = await this.ops.enableUnlessOccupied(checked.name, actor, opts.actorTokenId, opsOwner);
|
|
413
|
+
enabledHere = r.enabled;
|
|
414
|
+
if (!r.enabled)
|
|
415
|
+
leftDisabled = r.note;
|
|
215
416
|
}
|
|
216
|
-
|
|
417
|
+
}
|
|
418
|
+
step = "components";
|
|
419
|
+
const diff = await this.commit(actor, itemId, input, opts, {
|
|
420
|
+
contents: checked.contents,
|
|
421
|
+
extension: ext,
|
|
422
|
+
createOrgs: [...new Set(checked.creates.map((c) => c.orgId))],
|
|
423
|
+
}, prepared, owner, confirmPending);
|
|
424
|
+
return {
|
|
425
|
+
itemId,
|
|
426
|
+
version: diff.to.version,
|
|
427
|
+
components: diff.components,
|
|
428
|
+
extension: extensionView(diff.extension),
|
|
429
|
+
connectorOrgs: diff.connectorOrgs,
|
|
430
|
+
...(leftDisabled !== undefined && { extensionLeftDisabled: leftDisabled }),
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
catch (e) {
|
|
434
|
+
let rolledBack = true;
|
|
435
|
+
if (extensionMoved && ext) {
|
|
436
|
+
// An owner update was authorized at its start: the put-back is not checked again
|
|
437
|
+
const back = opsOwner && { ...opsOwner, rollback: true };
|
|
217
438
|
try {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
throw new InstallFailure(e.step, e.cause, [dep.name, ...e.dependency], e.rolledBack);
|
|
439
|
+
if (ext.sha256 === null) {
|
|
440
|
+
// Removed by this update: the previous package reinstalled (as it was)
|
|
441
|
+
await this.ops.install(checked.name, ext.previous, actor, opts.actorTokenId, {
|
|
442
|
+
catalogItemId: itemId,
|
|
443
|
+
...(back && { owner: back }),
|
|
444
|
+
});
|
|
445
|
+
if (removedEnabled)
|
|
446
|
+
await this.ops.enable(checked.name, actor, opts.actorTokenId, back);
|
|
227
447
|
}
|
|
228
|
-
if (
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
448
|
+
else if (ext.previous !== null) {
|
|
449
|
+
await this.ops.install(checked.name, ext.previous, actor, opts.actorTokenId, {
|
|
450
|
+
...(back && { owner: back }),
|
|
451
|
+
});
|
|
452
|
+
// The install left the enabled extension disabled (a held single-provider point): the
|
|
453
|
+
// previous version, which did not provide it, runs again
|
|
454
|
+
if (leftDisabled !== undefined) {
|
|
455
|
+
await this.ops.enable(checked.name, actor, opts.actorTokenId, back);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
// Installed by this update: an uninstall needs it disabled first
|
|
460
|
+
if (enabledHere)
|
|
461
|
+
await this.ops.disable(checked.name, actor, opts.actorTokenId, back);
|
|
462
|
+
await this.ops.uninstall(checked.name, actor, opts.actorTokenId, back);
|
|
232
463
|
}
|
|
233
|
-
throw new InstallFailure("dependencies", e, [dep.name], true);
|
|
234
464
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
if (diff.extension?.change === "added") {
|
|
239
|
-
const name = diff.extension.name;
|
|
240
|
-
await this.d.orgConfigs.put(orgId, name, {
|
|
241
|
-
enabled: true,
|
|
242
|
-
...(input.extensionConfig !== undefined && { config: input.extensionConfig }),
|
|
243
|
-
}, actor, opts.actorTokenId, {
|
|
244
|
-
viaItem: itemId,
|
|
245
|
-
ifDisabled: { skipped: false },
|
|
246
|
-
inTransaction: (t, skipped) => record({ kind: "extension", ref: name, created: !skipped, skillVersion: null }, t),
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
step = "skills";
|
|
250
|
-
for (const s of diff.skills) {
|
|
251
|
-
if (s.change !== "added" && s.change !== "changed")
|
|
252
|
-
continue;
|
|
253
|
-
const files = await readCatalogFiles(this.d.storage, diff.to.object_prefix, diff.to.files, s.dir);
|
|
254
|
-
const r = await this.d.skills.createVersionFromFiles(orgId, actor, { ...skillOf(files), files }, {
|
|
255
|
-
catalog: {
|
|
465
|
+
catch (u) {
|
|
466
|
+
rolledBack = false;
|
|
467
|
+
this.log.error("putting a plugin's extension back after a failed update failed", {
|
|
256
468
|
itemId,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
suggestPinned: s.suggestPinned === true,
|
|
260
|
-
},
|
|
261
|
-
...opts,
|
|
262
|
-
});
|
|
263
|
-
await this.d.db.transaction().execute(async (t) => {
|
|
264
|
-
if (r.created) {
|
|
265
|
-
await record({ kind: "skill", ref: r.skill.id, created: true, skillVersion: null }, t);
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
await journal({ op: "skill_version", ref: r.skill.id, version: r.version }, t);
|
|
269
|
-
await record({ kind: "skill", ref: r.skill.id, created: false, skillVersion: r.version }, t);
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
step = "agent_templates";
|
|
273
|
-
for (const a of diff.agentTemplates) {
|
|
274
|
-
if (a.change !== "added" && a.change !== "changed")
|
|
275
|
-
continue;
|
|
276
|
-
await this.d.db.transaction().execute(async (t) => {
|
|
277
|
-
await lockOrg(t, orgId);
|
|
278
|
-
const r = await putTemplateVersionIn(t, {
|
|
279
|
-
orgId,
|
|
280
|
-
plugin: diff.name,
|
|
281
|
-
catalogItemId: itemId,
|
|
282
|
-
catalogVersion: diff.to.version,
|
|
283
|
-
sourceFormat: diff.to.source_format,
|
|
284
|
-
}, a.template);
|
|
285
|
-
if (r.created) {
|
|
286
|
-
await record({ kind: "agent_template", ref: r.id, created: true, skillVersion: null }, t);
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
if (r.changed)
|
|
290
|
-
await journal({ op: "template_version", ref: r.id, version: r.version }, t);
|
|
291
|
-
await record({
|
|
292
|
-
kind: "agent_template",
|
|
293
|
-
ref: r.id,
|
|
294
|
-
created: false,
|
|
295
|
-
skillVersion: r.changed ? r.version : null,
|
|
296
|
-
}, t);
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
step = "connectors";
|
|
300
|
-
for (const [templateId, ci] of diff.creates) {
|
|
301
|
-
const r = await this.d.connectors.create(orgId, actor, ci, opts.actorTokenId);
|
|
302
|
-
await this.d.db.transaction().execute((t) => record({
|
|
303
|
-
kind: "connector",
|
|
304
|
-
ref: r.connector.id,
|
|
305
|
-
created: true,
|
|
306
|
-
skillVersion: null,
|
|
307
|
-
templateId,
|
|
308
|
-
}, t));
|
|
309
|
-
}
|
|
310
|
-
const prepared = [];
|
|
311
|
-
for (const tpl of diff.templates) {
|
|
312
|
-
const update = diff.updates.get(tpl.id);
|
|
313
|
-
if (!update || !tpl.connector)
|
|
314
|
-
continue;
|
|
315
|
-
try {
|
|
316
|
-
prepared.push({
|
|
317
|
-
connectorId: tpl.connector.id,
|
|
318
|
-
p: await this.d.connectors.prepareTemplateUpdate(actor, tpl.connector.connector, update),
|
|
469
|
+
plugin: checked.name,
|
|
470
|
+
err: u,
|
|
319
471
|
});
|
|
320
472
|
}
|
|
321
|
-
catch (e) {
|
|
322
|
-
throw under(e, `connectors.${tpl.id}`);
|
|
323
|
-
}
|
|
324
473
|
}
|
|
325
|
-
|
|
326
|
-
await this.
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
if (dep.change !== "changed" || !dep.child)
|
|
343
|
-
continue;
|
|
344
|
-
const live = await t
|
|
345
|
-
.selectFrom("plugin_installs")
|
|
346
|
-
.select("version")
|
|
347
|
-
.where("id", "=", dep.child.installId)
|
|
348
|
-
.forShare()
|
|
349
|
-
.executeTakeFirst();
|
|
350
|
-
if (!live || !satisfiesRange(live.version, dep.range)) {
|
|
351
|
-
throw new ApiError("catalog.dependency_unresolved", `Dependency ${dep.name}@${dep.range} cannot be resolved: its install in this organization changed meanwhile; preview the upgrade again`, [{ dependency: dep.name, range: dep.range }]);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
const report = await this.removeIn(t, orgId, actor, diff, disabled);
|
|
355
|
-
// An unchanged skill gets no new version, so the target's pinned suggestion goes onto its
|
|
356
|
-
// current version (when that version is this plugin's) here, with the version switch.
|
|
357
|
-
for (const sk of diff.skills) {
|
|
358
|
-
if (sk.change !== "unchanged" || !sk.ledger)
|
|
359
|
-
continue;
|
|
360
|
-
await t
|
|
361
|
-
.updateTable("skill_versions as v")
|
|
362
|
-
.set({ suggest_pinned: sk.suggestPinned === true })
|
|
363
|
-
.from("skills as s")
|
|
364
|
-
.whereRef("s.id", "=", "v.skill_id")
|
|
365
|
-
.whereRef("s.current_version", "=", "v.version")
|
|
366
|
-
.where("s.id", "=", sk.ledger.ref)
|
|
367
|
-
.where("s.org_id", "=", orgId)
|
|
368
|
-
.where("v.catalog_item_id", "=", itemId)
|
|
369
|
-
.where("v.suggest_pinned", "<>", sk.suggestPinned === true)
|
|
370
|
-
.execute();
|
|
371
|
-
}
|
|
372
|
-
await t
|
|
373
|
-
.updateTable("plugin_installs")
|
|
374
|
-
.set({ version: diff.to.version, status: "installed", upgrade: null, error: null })
|
|
375
|
-
.where("id", "=", installId)
|
|
376
|
-
.execute();
|
|
377
|
-
await this.d.requests.resolveByInstall(t, orgId, itemId, actor, opts);
|
|
378
|
-
await audit(t, {
|
|
379
|
-
actorAccountId: actor,
|
|
380
|
-
...(opts.actorTokenId !== undefined && { actorTokenId: opts.actorTokenId }),
|
|
381
|
-
orgId,
|
|
382
|
-
action: "plugin.org_upgraded",
|
|
383
|
-
target: installId,
|
|
384
|
-
detail: {
|
|
385
|
-
itemId,
|
|
386
|
-
name: diff.name,
|
|
387
|
-
from: diff.from.version,
|
|
388
|
-
to: diff.to.version,
|
|
389
|
-
components: diff.components,
|
|
390
|
-
removed: report.removed,
|
|
391
|
-
kept: report.kept,
|
|
392
|
-
},
|
|
393
|
-
});
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
catch (e) {
|
|
397
|
-
throw await this.failed(orgId, actor, installId, upgradeId, diff, { done, unjournaled }, step, e, opts);
|
|
474
|
+
const code = e instanceof ApiError ? e.code : "internal";
|
|
475
|
+
await this.auditFailure(actor, checked, { step, code, rolledBack }, opts);
|
|
476
|
+
// A refusal found under the lock (stale, disabled meanwhile, a conflict, a downgrade the
|
|
477
|
+
// extension's migrations refuse): returned as it is
|
|
478
|
+
if (e instanceof ApiError && e.status < 500 && rolledBack)
|
|
479
|
+
throw e;
|
|
480
|
+
throw new ApiError("plugin.upgrade_failed", rolledBack
|
|
481
|
+
? `Updating the plugin failed at step ${step} (${code}); the platform is back at version ${checked.from ?? "(none)"}`
|
|
482
|
+
: `Updating the plugin failed at step ${step} (${code}) and putting its extension back failed; check the extension in the admin console`, [
|
|
483
|
+
{
|
|
484
|
+
step,
|
|
485
|
+
code,
|
|
486
|
+
...(e instanceof ApiError && { message: e.message }),
|
|
487
|
+
...(e instanceof ApiError && e.details !== undefined && { causeDetails: e.details }),
|
|
488
|
+
rolledBack,
|
|
489
|
+
},
|
|
490
|
+
]);
|
|
398
491
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
492
|
+
}
|
|
493
|
+
/** `plugin.platform_update_failed`, in a transaction of its own. */
|
|
494
|
+
async auditFailure(actor, diff, f, opts) {
|
|
495
|
+
await audit(this.db, {
|
|
496
|
+
actorAccountId: actor,
|
|
497
|
+
...(opts.actorTokenId !== undefined && { actorTokenId: opts.actorTokenId }),
|
|
498
|
+
action: "plugin.platform_update_failed",
|
|
499
|
+
target: diff.itemId,
|
|
500
|
+
detail: { name: diff.name, from: diff.from, to: diff.to.version, ...f },
|
|
501
|
+
});
|
|
405
502
|
}
|
|
406
503
|
/**
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
* is no longer this upgrade's (another request cleaned it up as interrupted and undid what it
|
|
410
|
-
* journaled), only the step whose journal write failed is undone and the install row is left as
|
|
411
|
-
* the cleanup set it. Returns the error to throw: 502 `plugin.upgrade_failed` (a dependency
|
|
412
|
-
* another install is still installing: its 409 as it is).
|
|
504
|
+
* The update's transaction (see the class comment): the super admin re-checked, the diff
|
|
505
|
+
* recomputed under the item name's lock, then every write. Returns the diff it applied.
|
|
413
506
|
*/
|
|
414
|
-
async
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
507
|
+
async commit(actor, itemId, input, opts, pre, prepared, owner, confirmPending) {
|
|
508
|
+
if (owner !== undefined && actor === null) {
|
|
509
|
+
throw new Error("an owner update needs the acting account");
|
|
510
|
+
}
|
|
511
|
+
// null: the kernel itself (the bootstrap step), no super admin to re-check
|
|
512
|
+
if (owner === undefined && actor !== null)
|
|
513
|
+
await this.adminLock.lockAndAuthorize(actor);
|
|
514
|
+
// The global lock order (ruling P3-50): the orgs (sorted; the acting owner org's admin
|
|
515
|
+
// re-checked at its place), then the item, then its components; an org deletion locks its org
|
|
516
|
+
// row, then the items it owns
|
|
517
|
+
const liveOrgs = await this.lockUpdateOrgs(itemId, pre.createOrgs, owner && actor !== null ? { orgId: owner.orgId, actor } : undefined);
|
|
518
|
+
const named = await this.db
|
|
519
|
+
.selectFrom("catalog_items")
|
|
520
|
+
.select("name")
|
|
521
|
+
.where("id", "=", itemId)
|
|
522
|
+
.executeTakeFirst();
|
|
523
|
+
if (!named)
|
|
524
|
+
throw itemNotFound();
|
|
525
|
+
await this.itemLock.lock(named.name);
|
|
526
|
+
let pendingOwner = null;
|
|
527
|
+
if (confirmPending !== undefined) {
|
|
528
|
+
// The super admin's confirmation (P3-21): still pending with the version they reviewed
|
|
529
|
+
const row = await this.db
|
|
530
|
+
.selectFrom("catalog_items")
|
|
531
|
+
.select(["deleted_at", "pending_version", "owner_org_id"])
|
|
532
|
+
.where("id", "=", itemId)
|
|
533
|
+
.forUpdate()
|
|
534
|
+
.executeTakeFirstOrThrow();
|
|
535
|
+
if (row.deleted_at !== null)
|
|
536
|
+
throw itemRemovedError(named.name);
|
|
537
|
+
if (row.pending_version !== confirmPending)
|
|
538
|
+
throw pendingStale(named.name);
|
|
539
|
+
pendingOwner = row.owner_org_id;
|
|
540
|
+
}
|
|
541
|
+
const diff = await this.diff(itemId, input.version, {
|
|
542
|
+
pre,
|
|
543
|
+
...(owner && { owner }),
|
|
544
|
+
...(confirmPending !== undefined && { confirmPending }),
|
|
545
|
+
});
|
|
546
|
+
if (diff.diffHash !== input.diffHash)
|
|
547
|
+
throw stale();
|
|
548
|
+
const t = this.db;
|
|
549
|
+
// The platform versions (files copied before the transaction; rows only here)
|
|
420
550
|
try {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
551
|
+
await this.platform.applySyncIn(prepared);
|
|
552
|
+
}
|
|
553
|
+
catch (e) {
|
|
554
|
+
if (e instanceof PlanStale)
|
|
555
|
+
throw stale();
|
|
556
|
+
throw e;
|
|
557
|
+
}
|
|
558
|
+
// Removals (spec §7.3): kept while agents use it; otherwise soft-deleted
|
|
559
|
+
const now = sql `now()`;
|
|
560
|
+
for (const c of diff.components) {
|
|
561
|
+
if (c.change !== "removed" || c.id === null || c.kept !== undefined)
|
|
562
|
+
continue;
|
|
563
|
+
const table = c.kind === "skill"
|
|
564
|
+
? "platform_skills"
|
|
565
|
+
: c.kind === "agent_template"
|
|
566
|
+
? "platform_agent_templates"
|
|
567
|
+
: c.kind === "theme"
|
|
568
|
+
? "platform_themes"
|
|
569
|
+
: "platform_connector_templates";
|
|
570
|
+
await t
|
|
571
|
+
.updateTable(table)
|
|
572
|
+
.set({ deleted_at: now, updated_at: now })
|
|
573
|
+
.where("id", "=", c.id)
|
|
574
|
+
.execute();
|
|
575
|
+
}
|
|
576
|
+
// Pins of linked copies: moved to the plugin's version (spec §7.1)
|
|
577
|
+
for (const c of diff.components) {
|
|
578
|
+
if (c.change === "removed" || c.id === null || c.pinnedOrgs.length === 0)
|
|
579
|
+
continue;
|
|
580
|
+
if (c.kind === "skill") {
|
|
436
581
|
await t
|
|
437
|
-
.updateTable("
|
|
438
|
-
.set({
|
|
439
|
-
.where("
|
|
440
|
-
.where(
|
|
582
|
+
.updateTable("skills")
|
|
583
|
+
.set({ pinned_version: null, updated_at: now })
|
|
584
|
+
.where("platform_skill_id", "=", c.id)
|
|
585
|
+
.where("org_id", "in", c.pinnedOrgs)
|
|
586
|
+
.where("pinned_version", "is not", null)
|
|
587
|
+
.execute();
|
|
588
|
+
}
|
|
589
|
+
else if (c.kind === "agent_template") {
|
|
590
|
+
await t
|
|
591
|
+
.updateTable("agent_templates")
|
|
592
|
+
.set({ pinned_version: null, updated_at: now })
|
|
593
|
+
.where("platform_template_id", "=", c.id)
|
|
594
|
+
.where("org_id", "in", c.pinnedOrgs)
|
|
595
|
+
.where("pinned_version", "is not", null)
|
|
441
596
|
.execute();
|
|
442
|
-
await audit(t, {
|
|
443
|
-
actorAccountId: actor,
|
|
444
|
-
...(opts.actorTokenId !== undefined && { actorTokenId: opts.actorTokenId }),
|
|
445
|
-
orgId,
|
|
446
|
-
action: "plugin.org_upgrade_failed",
|
|
447
|
-
target: installId,
|
|
448
|
-
detail: {
|
|
449
|
-
itemId: diff.itemId,
|
|
450
|
-
name: diff.name,
|
|
451
|
-
from: diff.from.version,
|
|
452
|
-
to: diff.to.version,
|
|
453
|
-
step: at,
|
|
454
|
-
code,
|
|
455
|
-
rolledBack: undo,
|
|
456
|
-
...(!ours && { cleanedUpMeanwhile: true }),
|
|
457
|
-
},
|
|
458
|
-
});
|
|
459
|
-
return out;
|
|
460
|
-
});
|
|
461
|
-
for (const r of removed) {
|
|
462
|
-
if (r.kind === "extension")
|
|
463
|
-
await this.d.orgConfigs.afterDisable(orgId, r.ref);
|
|
464
597
|
}
|
|
465
598
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
599
|
+
// Connectors made from changed templates, in every org (ruling E2)
|
|
600
|
+
const orgs = [...new Set(diff.connectors.map((c) => c.orgId))].sort();
|
|
601
|
+
for (const orgId of orgs) {
|
|
602
|
+
if (!liveOrgs.has(orgId)) {
|
|
603
|
+
// Locked before the item (P3-50): an org not locked then is deleted (its connectors go
|
|
604
|
+
// with it), or its connector was made since, which changes what the update does
|
|
605
|
+
const live = await t
|
|
606
|
+
.selectFrom("orgs")
|
|
607
|
+
.select("id")
|
|
608
|
+
.where("id", "=", orgId)
|
|
609
|
+
.where("deleted_at", "is", null)
|
|
610
|
+
.executeTakeFirst();
|
|
611
|
+
if (live === undefined)
|
|
612
|
+
continue;
|
|
613
|
+
throw stale();
|
|
614
|
+
}
|
|
615
|
+
for (const c of diff.connectors.filter((x) => x.orgId === orgId)) {
|
|
616
|
+
const prepared = await this.prepare(actor, itemId, diff.to.version, c);
|
|
617
|
+
await this.connectors.applyTemplateIn(orgId, c.id, actor, prepared, opts.actorTokenId);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
// Connectors of the templates the update turns on, in every org where the plugin is on (plugin
|
|
621
|
+
// pages spec §5.2.3): rows only, no outbound call; a ready one's tool list is owed through the
|
|
622
|
+
// outbox. Created by the kernel itself (no actor: the super admin need not be an org member)
|
|
623
|
+
for (const c of diff.creates) {
|
|
624
|
+
// Locked before the item (P3-50) from the diff before the transaction, which the diffHash
|
|
625
|
+
// check matched: the recomputed diff names only live, locked orgs (an org deleted since
|
|
626
|
+
// drops out of it and fails the hash check as stale), so this guards the invariant only
|
|
627
|
+
if (!liveOrgs.has(c.orgId))
|
|
628
|
+
throw stale();
|
|
629
|
+
await this.createTemplateConnectorIn(itemId, diff.to.version, c);
|
|
630
|
+
}
|
|
631
|
+
// A deferred connector writes nothing (ruling R27): the org's ensure creates it once its
|
|
632
|
+
// connector extension is on there and loaded (the job retries while it is not loaded)
|
|
633
|
+
for (const orgId of diff.deferredOrgs)
|
|
634
|
+
await oweTemplateConnectors(this.outbox, t, orgId);
|
|
635
|
+
// One version for the deployment: every live org install of the plugin moves with it (one
|
|
636
|
+
// still installing too; an install marked installed later records the platform version
|
|
637
|
+
// current at its commit, PluginInstaller.markInstalled)
|
|
638
|
+
await t
|
|
639
|
+
.updateTable("plugin_installs")
|
|
640
|
+
.set({ version: diff.to.version, error: null })
|
|
641
|
+
.where("item_id", "=", itemId)
|
|
642
|
+
.where("status", "in", [...LIVE_INSTALL_STATUSES])
|
|
643
|
+
.execute();
|
|
644
|
+
if (owner !== undefined || confirmPending !== undefined) {
|
|
645
|
+
// An org's version becomes its latest once applied or confirmed (ruling P3-34)
|
|
646
|
+
await t
|
|
647
|
+
.updateTable("catalog_items")
|
|
648
|
+
.set({ latest_version: diff.to.version })
|
|
649
|
+
.where("id", "=", itemId)
|
|
650
|
+
.execute();
|
|
651
|
+
await markVersionApplied(t, itemId, diff.to.version);
|
|
652
|
+
// An owner's new version replaces a version waiting for the super admin (pre-flight F7):
|
|
653
|
+
// their confirmation of it is then refused (409 extension.not_pending); the super admin's
|
|
654
|
+
// confirmation applied it
|
|
655
|
+
await t
|
|
656
|
+
.updateTable("catalog_items")
|
|
657
|
+
.set({ pending_version: null, pending_by: null, pending_at: null })
|
|
658
|
+
.where("id", "=", itemId)
|
|
659
|
+
.where("pending_version", "is not", null)
|
|
660
|
+
.execute();
|
|
661
|
+
}
|
|
662
|
+
if (confirmPending !== undefined && pendingOwner !== null) {
|
|
663
|
+
await addOrgNotice(t, pendingOwner, "upload_confirmed", {
|
|
664
|
+
itemId,
|
|
665
|
+
name: diff.name,
|
|
666
|
+
displayName: await itemDisplayName(t, itemId),
|
|
667
|
+
version: diff.to.version,
|
|
473
668
|
});
|
|
474
669
|
}
|
|
475
|
-
|
|
476
|
-
|
|
670
|
+
// The orgs using a shared org-owned plugin are told, one notice per plugin (a platform-owned
|
|
671
|
+
// plugin tells nobody); a plugin never synced before has no version to come from
|
|
672
|
+
if (diff.from !== null) {
|
|
673
|
+
await notifySharedUpdate(t, { kind: "plugin", id: itemId }, { name: diff.name, from: diff.from, to: diff.to.version });
|
|
477
674
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
:
|
|
483
|
-
{
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
...(
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
675
|
+
await audit(t, {
|
|
676
|
+
actorAccountId: actor,
|
|
677
|
+
...(opts.actorTokenId !== undefined && { actorTokenId: opts.actorTokenId }),
|
|
678
|
+
action: "plugin.platform_updated",
|
|
679
|
+
target: itemId,
|
|
680
|
+
detail: {
|
|
681
|
+
name: diff.name,
|
|
682
|
+
from: diff.from,
|
|
683
|
+
to: diff.to.version,
|
|
684
|
+
...(owner !== undefined && { ownerOrgId: owner.orgId }),
|
|
685
|
+
components: diff.components.map((c) => ({
|
|
686
|
+
kind: c.kind,
|
|
687
|
+
name: c.name,
|
|
688
|
+
change: c.change,
|
|
689
|
+
...(c.kept !== undefined && { kept: true }),
|
|
690
|
+
...(c.pinnedOrgs.length > 0 && c.change !== "removed" && { unpinned: c.pinnedOrgs }),
|
|
691
|
+
})),
|
|
692
|
+
...(diff.extension && { extension: extensionView(diff.extension) }),
|
|
693
|
+
connectors: diff.connectors.map((c) => ({
|
|
694
|
+
orgId: c.orgId,
|
|
695
|
+
id: c.id,
|
|
696
|
+
credentialsReset: c.credentialsReset,
|
|
697
|
+
})),
|
|
698
|
+
...(diff.deferredOrgs.length > 0 && {
|
|
699
|
+
deferredConnectors: diff.connectorOrgs.flatMap((o) => o.deferred.map((d) => ({ orgId: o.orgId, templateId: d.templateId, kind: d.kind }))),
|
|
700
|
+
}),
|
|
701
|
+
...opts.auditDetail,
|
|
491
702
|
},
|
|
492
|
-
|
|
703
|
+
});
|
|
704
|
+
// The scope sync of the item and its dependencies is owed with the update (outbox spec §8.1)
|
|
705
|
+
for (const id of [itemId, ...diff.dependencies])
|
|
706
|
+
await this.sync.enqueueItem(id);
|
|
707
|
+
return diff;
|
|
493
708
|
}
|
|
494
709
|
/**
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
710
|
+
* The template update of one connector: the new endpoint preset with the org's values at the
|
|
711
|
+
* editable paths, the auth preset and default policies; credentials cleared (no new ones: they
|
|
712
|
+
* are the org's) when the credential shape changed.
|
|
498
713
|
*/
|
|
499
|
-
async
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
.select("status")
|
|
507
|
-
.where("id", "=", installId)
|
|
508
|
-
.where("org_id", "=", orgId)
|
|
509
|
-
.executeTakeFirst();
|
|
510
|
-
if (peek?.status !== "upgrading")
|
|
511
|
-
return [];
|
|
512
|
-
await lockOrg(t, orgId);
|
|
513
|
-
const row = await t
|
|
514
|
-
.selectFrom("plugin_installs as a")
|
|
515
|
-
.innerJoin("catalog_items as i", "i.id", "a.item_id")
|
|
516
|
-
.select([
|
|
517
|
-
"a.status",
|
|
518
|
-
"a.upgrade",
|
|
519
|
-
"a.item_id",
|
|
520
|
-
"i.name",
|
|
521
|
-
sql `coalesce((a.upgrade->>'startedAt')::timestamptz < now() - make_interval(mins => ${staleMinutes}), false)`.as("stale"),
|
|
522
|
-
])
|
|
523
|
-
.where("a.id", "=", installId)
|
|
524
|
-
.where("a.org_id", "=", orgId)
|
|
525
|
-
.forUpdate("a")
|
|
526
|
-
.executeTakeFirst();
|
|
527
|
-
if (row?.status !== "upgrading" || !row.stale)
|
|
528
|
-
return [];
|
|
529
|
-
const steps = journalEntries(row.upgrade);
|
|
530
|
-
const out = await this.installer.undoUpgradeIn(t, orgId, actor, installId, steps, "plugin_upgrade_cleanup");
|
|
531
|
-
await t
|
|
532
|
-
.updateTable("plugin_installs")
|
|
533
|
-
.set({
|
|
534
|
-
status: "installed",
|
|
535
|
-
upgrade: null,
|
|
536
|
-
error: JSON.stringify({ step: "interrupted", code: "internal" }),
|
|
537
|
-
})
|
|
538
|
-
.where("id", "=", installId)
|
|
539
|
-
.execute();
|
|
540
|
-
const j = row.upgrade;
|
|
541
|
-
await audit(t, {
|
|
542
|
-
actorAccountId: actor,
|
|
543
|
-
orgId,
|
|
544
|
-
action: "plugin.org_upgrade_failed",
|
|
545
|
-
target: installId,
|
|
546
|
-
detail: {
|
|
547
|
-
itemId: row.item_id,
|
|
548
|
-
name: row.name,
|
|
549
|
-
from: j?.from ?? null,
|
|
550
|
-
to: j?.to ?? null,
|
|
551
|
-
step: "interrupted",
|
|
552
|
-
code: "internal",
|
|
553
|
-
rolledBack: steps,
|
|
554
|
-
},
|
|
555
|
-
});
|
|
556
|
-
return out;
|
|
557
|
-
});
|
|
558
|
-
for (const r of removed) {
|
|
559
|
-
if (r.kind === "extension")
|
|
560
|
-
await this.d.orgConfigs.afterDisable(orgId, r.ref);
|
|
714
|
+
async prepare(actor, itemId, version, c) {
|
|
715
|
+
const template = c.file.template;
|
|
716
|
+
const endpoint = structuredClone(template.endpoint);
|
|
717
|
+
for (const e of template.editableEndpoint ?? []) {
|
|
718
|
+
const v = getPath(c.endpoint, e);
|
|
719
|
+
if (v !== undefined)
|
|
720
|
+
setPath(endpoint, e, v);
|
|
561
721
|
}
|
|
722
|
+
const input = {
|
|
723
|
+
endpoint,
|
|
724
|
+
auth: template.auth,
|
|
725
|
+
...(template.git !== undefined && { git: template.git }),
|
|
726
|
+
template: {
|
|
727
|
+
itemId,
|
|
728
|
+
version,
|
|
729
|
+
templateId: c.templateId,
|
|
730
|
+
...(template.defaultToolPolicies !== undefined && {
|
|
731
|
+
defaultToolPolicies: template.defaultToolPolicies,
|
|
732
|
+
}),
|
|
733
|
+
},
|
|
734
|
+
resetCredentials: false,
|
|
735
|
+
};
|
|
736
|
+
// Checked without credentials (nothing outbound); a changed shape then clears the old ones
|
|
737
|
+
const prepared = await this.connectors.prepareTemplateUpdate(actor, c.connector, input);
|
|
738
|
+
return c.credentialsReset
|
|
739
|
+
? { ...prepared, input: { ...prepared.input, resetCredentials: true } }
|
|
740
|
+
: prepared;
|
|
562
741
|
}
|
|
563
742
|
/**
|
|
564
|
-
*
|
|
565
|
-
* (
|
|
566
|
-
*
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
* install is uninstalled by the same rules (another install using it takes it over). Skills ->
|
|
570
|
-
* connectors -> extension -> dependencies.
|
|
743
|
+
* Creates the connector of a template the update turns on in an org, in the update's
|
|
744
|
+
* transaction (the org row locked): as an install creates it (`PluginInstaller.planConnector`,
|
|
745
|
+
* `ConnectorsService.createDeferredIn`: no outbound call, `needs_config` when the template needs
|
|
746
|
+
* an org credential or OAuth client), by the kernel itself, and recorded on the org's live
|
|
747
|
+
* install of the plugin when there is one (a builtin plugin has none).
|
|
571
748
|
*/
|
|
572
|
-
async
|
|
573
|
-
const
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
.where("install_id", "=", diff.installId)
|
|
579
|
-
.where("kind", "=", kind)
|
|
580
|
-
.where("ref", "=", ref);
|
|
581
|
-
const dropRow = (kind, ref) => t
|
|
582
|
-
.deleteFrom("plugin_install_components")
|
|
583
|
-
.where("install_id", "=", diff.installId)
|
|
584
|
-
.where("kind", "=", kind)
|
|
585
|
-
.where("ref", "=", ref)
|
|
586
|
-
.execute();
|
|
587
|
-
const removed = [
|
|
588
|
-
...diff.skills.flatMap((x) => (x.change === "removed" && x.ledger ? [x.ledger] : [])),
|
|
589
|
-
...diff.agentTemplates.flatMap((x) => (x.change === "removed" && x.ledger ? [x.ledger] : [])),
|
|
590
|
-
...diff.templates.flatMap((x) => (x.change === "removed" && x.ledger ? [x.ledger] : [])),
|
|
591
|
-
...(diff.extension?.change === "removed"
|
|
592
|
-
? diff.ledger.filter((l) => l.kind === "extension" && l.ref === diff.extension?.name)
|
|
593
|
-
: []),
|
|
594
|
-
];
|
|
595
|
-
const agentRefs = await this.installer.agentRefs(t, orgId);
|
|
596
|
-
const self = new Set([diff.installId]);
|
|
597
|
-
for (const l of removed) {
|
|
598
|
-
if (!l.created) {
|
|
599
|
-
await dropRow(l.kind, l.ref);
|
|
600
|
-
keep(l.kind, l.ref, "pre_existing");
|
|
601
|
-
continue;
|
|
602
|
-
}
|
|
603
|
-
const outcome = await this.installer.decideRemovalIn(t, orgId, actor, { kind: l.kind, ref: l.ref, created: true, skillVersion: null }, self, agentRefs, reason);
|
|
604
|
-
if (outcome === "used_by_agents" ||
|
|
605
|
-
outcome === "used_by_connectors" ||
|
|
606
|
-
outcome === "used_by_plugins") {
|
|
607
|
-
// Still used: stays this install's, marked dropped, so an uninstall (or a later upgrade
|
|
608
|
-
// bringing it back) still finds it
|
|
609
|
-
await row(l.kind, l.ref).set({ dropped: true }).execute();
|
|
610
|
-
keep(l.kind, l.ref, outcome);
|
|
611
|
-
continue;
|
|
612
|
-
}
|
|
613
|
-
await dropRow(l.kind, l.ref);
|
|
614
|
-
if (outcome === "removed") {
|
|
615
|
-
report.removed.push({ kind: l.kind, ref: l.ref });
|
|
616
|
-
if (l.kind === "extension")
|
|
617
|
-
disabled.push(l.ref);
|
|
618
|
-
}
|
|
619
|
-
else if (outcome !== "gone")
|
|
620
|
-
keep(l.kind, l.ref, outcome);
|
|
621
|
-
}
|
|
622
|
-
// Components back in the plugin (dropped by an earlier upgrade, brought again by the target)
|
|
623
|
-
const back = [
|
|
624
|
-
...diff.skills.flatMap((x) => x.change !== "removed" && x.ledger?.dropped
|
|
625
|
-
? [{ kind: "skill", ref: x.ledger.ref }]
|
|
626
|
-
: []),
|
|
627
|
-
...diff.agentTemplates.flatMap((x) => x.change !== "removed" && x.ledger?.dropped
|
|
628
|
-
? [{ kind: "agent_template", ref: x.ledger.ref }]
|
|
629
|
-
: []),
|
|
630
|
-
...diff.templates.flatMap((x) => x.change !== "removed" && x.ledger?.dropped
|
|
631
|
-
? [{ kind: "connector", ref: x.ledger.ref }]
|
|
632
|
-
: []),
|
|
633
|
-
...(diff.extension && diff.extension.change !== "removed"
|
|
634
|
-
? diff.ledger
|
|
635
|
-
.filter((l) => l.kind === "extension" && l.ref === diff.extension?.name && l.dropped)
|
|
636
|
-
.map((l) => ({ kind: "extension", ref: l.ref }))
|
|
637
|
-
: []),
|
|
638
|
-
];
|
|
639
|
-
for (const b of back)
|
|
640
|
-
await row(b.kind, b.ref).set({ dropped: false }).execute();
|
|
641
|
-
for (const dep of diff.dependencies) {
|
|
642
|
-
if (dep.change !== "removed" || !dep.child)
|
|
643
|
-
continue;
|
|
644
|
-
const ref = dep.child.installId;
|
|
645
|
-
await dropRow("plugin", ref);
|
|
646
|
-
if (!dep.child.ledger.created) {
|
|
647
|
-
keep("plugin", ref, "pre_existing");
|
|
648
|
-
continue;
|
|
649
|
-
}
|
|
650
|
-
const sub = { removed: [], kept: [] };
|
|
651
|
-
const outcome = await this.installer.uninstallIn(t, orgId, actor, ref, {
|
|
652
|
-
report: sub,
|
|
653
|
-
removing: new Set(),
|
|
654
|
-
from: diff.installId,
|
|
655
|
-
authorize: false,
|
|
656
|
-
reason,
|
|
657
|
-
opts: {},
|
|
658
|
-
});
|
|
659
|
-
for (const r of sub.removed)
|
|
660
|
-
if (r.kind === "extension")
|
|
661
|
-
disabled.push(r.ref);
|
|
662
|
-
if (outcome === "removed")
|
|
663
|
-
report.removed.push({ kind: "plugin", ref });
|
|
664
|
-
else if (outcome === "kept")
|
|
665
|
-
keep("plugin", ref, "used_by_other_install");
|
|
666
|
-
}
|
|
667
|
-
return report;
|
|
749
|
+
async createTemplateConnectorIn(itemId, version, c) {
|
|
750
|
+
const ci = this.installer.planConnector(null, { itemId, version }, { id: c.templateId, file: c.file }, "", undefined);
|
|
751
|
+
const connectorId = await this.connectors.createDeferredIn(c.orgId, null, ci, {
|
|
752
|
+
auditDetail: { via: "platform_update" },
|
|
753
|
+
});
|
|
754
|
+
await this.installer.recordTemplateConnectorIn(c.orgId, itemId, connectorId, c.templateId, LIVE_INSTALL_STATUSES);
|
|
668
755
|
}
|
|
669
756
|
/**
|
|
670
|
-
* Computes an
|
|
671
|
-
*
|
|
757
|
+
* Computes an update (see the class comment). `target`: the target read from an org's staging
|
|
758
|
+
* instead of `catalog_item_versions` (pre-flight F3). `owner`: an owner update (P3-12): the item
|
|
759
|
+
* must be the org's, an extension-bearing target is refused, and a target dropping the
|
|
760
|
+
* extension removes it.
|
|
672
761
|
*/
|
|
673
|
-
async diff(
|
|
674
|
-
const db = this.
|
|
675
|
-
if (!UUID_RE.test(
|
|
676
|
-
throw
|
|
677
|
-
const
|
|
678
|
-
.selectFrom("
|
|
679
|
-
.
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
762
|
+
async diff(itemId, version, o = {}) {
|
|
763
|
+
const db = this.db;
|
|
764
|
+
if (!UUID_RE.test(itemId))
|
|
765
|
+
throw itemNotFound();
|
|
766
|
+
const item = await db
|
|
767
|
+
.selectFrom("catalog_items")
|
|
768
|
+
.select([
|
|
769
|
+
"id",
|
|
770
|
+
"name",
|
|
771
|
+
"scope",
|
|
772
|
+
"disabled",
|
|
773
|
+
"builtin",
|
|
774
|
+
"deleted_at",
|
|
775
|
+
"platform_synced_version",
|
|
776
|
+
"owner_org_id",
|
|
777
|
+
"awaiting_confirmation",
|
|
778
|
+
"pending_version",
|
|
779
|
+
"latest_version",
|
|
780
|
+
])
|
|
781
|
+
.where("id", "=", itemId)
|
|
683
782
|
.executeTakeFirst();
|
|
684
|
-
if (!
|
|
685
|
-
throw
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
783
|
+
if (!item || item.deleted_at !== null)
|
|
784
|
+
throw itemNotFound();
|
|
785
|
+
// A version waiting for the super admin applies only through their confirmation (P3-9, F8)
|
|
786
|
+
if (o.confirmPending !== version) {
|
|
787
|
+
if (item.awaiting_confirmation)
|
|
788
|
+
throw itemPendingError(item.name);
|
|
789
|
+
if (item.pending_version !== null && item.pending_version === version) {
|
|
790
|
+
throw itemPendingError(item.name, version);
|
|
791
|
+
}
|
|
792
|
+
// The super admin's generic update of an org's plugin reaches only its applied version
|
|
793
|
+
// (`latest_version`, ruling P3-34/P3-37): one the org uploaded that was never applied or
|
|
794
|
+
// confirmed (a rejected or failed one) is not theirs to apply
|
|
795
|
+
if (o.owner === undefined && item.owner_org_id !== null && version !== item.latest_version) {
|
|
796
|
+
throw notApplied(item.name, version);
|
|
797
|
+
}
|
|
692
798
|
}
|
|
693
|
-
if (
|
|
694
|
-
throw
|
|
799
|
+
if (o.owner !== undefined && item.owner_org_id !== o.owner.orgId)
|
|
800
|
+
throw itemNotFound();
|
|
801
|
+
if (item.disabled) {
|
|
802
|
+
throw new ApiError("catalog.item_disabled", "This plugin is disabled on the deployment; enable it before updating");
|
|
695
803
|
}
|
|
696
|
-
const
|
|
804
|
+
const name = item.name;
|
|
805
|
+
const versions = (await db
|
|
697
806
|
.selectFrom("catalog_item_versions")
|
|
698
807
|
.select([
|
|
699
808
|
"version",
|
|
@@ -701,519 +810,890 @@ export class PluginUpgrader {
|
|
|
701
810
|
"object_prefix",
|
|
702
811
|
"files",
|
|
703
812
|
"extension_sha256",
|
|
704
|
-
"
|
|
705
|
-
"
|
|
813
|
+
"applied_at",
|
|
814
|
+
"rejected_at",
|
|
706
815
|
])
|
|
707
816
|
.where("item_id", "=", itemId)
|
|
708
|
-
.execute();
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
if (!fromRow) {
|
|
712
|
-
throw new ApiError("catalog.item_not_found", `The installed version ${install.version} is no longer in the enterprise catalog`);
|
|
713
|
-
}
|
|
714
|
-
if (!toRow)
|
|
817
|
+
.execute());
|
|
818
|
+
const to = o.target ?? versions.find((v) => v.version === version);
|
|
819
|
+
if (!to)
|
|
715
820
|
throw new ApiError("catalog.item_not_found", `Version ${version} of this item not found`);
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
821
|
+
// Whoever owns the item now (a transfer keeps the version rows), the generic update never
|
|
822
|
+
// reaches a version that was rejected or never applied (ruling P3-52)
|
|
823
|
+
const row = versions.find((v) => v.version === version);
|
|
824
|
+
if (o.owner === undefined && o.confirmPending !== version && row && !versionUsable(row)) {
|
|
825
|
+
throw notApplied(item.name, version);
|
|
826
|
+
}
|
|
827
|
+
if (o.owner !== undefined && to.manifest.extension) {
|
|
828
|
+
// An org's version with an extension waits for the super admin's confirmation (plan Task 6)
|
|
829
|
+
throw new ApiError("plugin.extension_upload_pending", `Version ${to.version} of plugin ${item.name} has an extension; it applies once a super admin confirms it`);
|
|
830
|
+
}
|
|
831
|
+
const from = item.platform_synced_version;
|
|
832
|
+
const fromRow = versions.find((v) => v.version === from);
|
|
833
|
+
if (from === to.version) {
|
|
834
|
+
// Confirming a preview whose update already ran (a concurrent confirm won): stale
|
|
835
|
+
if (o.pre)
|
|
721
836
|
throw stale();
|
|
722
|
-
throw targetInvalid(`
|
|
723
|
-
{ reason: "same_version", version: from
|
|
837
|
+
throw targetInvalid(`The platform already runs version ${from} of plugin ${name}`, [
|
|
838
|
+
{ reason: "same_version", version: from },
|
|
724
839
|
]);
|
|
725
840
|
}
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
841
|
+
const target = await this.extensionTarget(name, fromRow, to, o.owner !== undefined);
|
|
842
|
+
let extension;
|
|
843
|
+
if (o.pre) {
|
|
844
|
+
// The confirm's transaction: the extension this update moved is expected in place (a
|
|
845
|
+
// removed one gone)
|
|
846
|
+
if (o.pre.extension) {
|
|
847
|
+
const row = await db
|
|
848
|
+
.selectFrom("extension_installs")
|
|
849
|
+
.select("sha256")
|
|
850
|
+
.where("name", "=", name)
|
|
851
|
+
.executeTakeFirst();
|
|
852
|
+
if ((row?.sha256 ?? null) !== o.pre.extension.sha256)
|
|
853
|
+
throw stale();
|
|
854
|
+
extension = o.pre.extension;
|
|
740
855
|
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
.innerJoin("plugin_installs as a", "a.id", "c.install_id")
|
|
746
|
-
.innerJoin("catalog_item_versions as v", (j) => j.onRef("v.item_id", "=", "a.item_id").onRef("v.version", "=", "a.version"))
|
|
747
|
-
.innerJoin("catalog_items as i", "i.id", "a.item_id")
|
|
748
|
-
.select(["i.name", "v.manifest"])
|
|
749
|
-
.where("c.kind", "=", "plugin")
|
|
750
|
-
.where("c.ref", "=", installId)
|
|
751
|
-
.where("a.org_id", "=", orgId)
|
|
752
|
-
.where("a.status", "<>", "failed")
|
|
753
|
-
.execute();
|
|
754
|
-
for (const p of parents) {
|
|
755
|
-
const range = p.manifest.dependencies?.find((x) => x.name === name)?.version;
|
|
756
|
-
if (range !== undefined && !satisfiesRange(to.version, range)) {
|
|
757
|
-
throw targetInvalid(`Plugin ${p.name} installed in this organization depends on ${name}@${range}, which version ${to.version} does not satisfy`, [{ reason: "dependent_range", dependent: p.name, range, version: to.version }]);
|
|
856
|
+
else {
|
|
857
|
+
if (target !== null)
|
|
858
|
+
throw stale();
|
|
859
|
+
extension = null;
|
|
758
860
|
}
|
|
759
861
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
const change = !from.manifest.extension
|
|
767
|
-
? "added"
|
|
768
|
-
: !to.manifest.extension
|
|
769
|
-
? "removed"
|
|
770
|
-
: from.extension_sha256 !== to.extension_sha256 ||
|
|
771
|
-
from.manifest.extension.manifest.version !== to.manifest.extension.manifest.version
|
|
772
|
-
? "changed"
|
|
773
|
-
: "unchanged";
|
|
774
|
-
extension = { change, name };
|
|
775
|
-
if (change === "added") {
|
|
776
|
-
await this.installer.planExtension(orgId, to.manifest);
|
|
777
|
-
extensionConfig = !(await isExtensionEnabled(db, orgId, name));
|
|
778
|
-
}
|
|
779
|
-
components.push({
|
|
780
|
-
kind: "extension",
|
|
781
|
-
ref: name,
|
|
782
|
-
change,
|
|
783
|
-
...(change === "changed" && {
|
|
784
|
-
detail: `${from.manifest.extension?.manifest.version} -> ${to.manifest.extension?.manifest.version}`,
|
|
785
|
-
}),
|
|
786
|
-
});
|
|
862
|
+
else {
|
|
863
|
+
extension = target && {
|
|
864
|
+
...target,
|
|
865
|
+
needsApproval: target.sha256 !== null && (await this.needsApproval(name, target.sha256)),
|
|
866
|
+
orgs: [],
|
|
867
|
+
};
|
|
787
868
|
}
|
|
788
|
-
|
|
789
|
-
const
|
|
790
|
-
|
|
791
|
-
const
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
resolved: r,
|
|
820
|
-
child,
|
|
821
|
-
});
|
|
869
|
+
const contents = o.pre?.contents ?? (await this.readContents(to));
|
|
870
|
+
const dependencies = await this.checkDependents(name, to);
|
|
871
|
+
// The platform's components of the plugin and the target's
|
|
872
|
+
const live = await this.liveComponents(itemId);
|
|
873
|
+
const components = [];
|
|
874
|
+
const direction = (fromVersion) => fromVersion === null || compareVersions(to.version, fromVersion) >= 0
|
|
875
|
+
? "upgrade"
|
|
876
|
+
: "downgrade";
|
|
877
|
+
const added = (kind, n) => ({
|
|
878
|
+
kind,
|
|
879
|
+
id: null,
|
|
880
|
+
name: n,
|
|
881
|
+
change: "added",
|
|
882
|
+
from: null,
|
|
883
|
+
to: to.version,
|
|
884
|
+
updatedOnOwn: false,
|
|
885
|
+
ownScope: false,
|
|
886
|
+
pinnedOrgs: [],
|
|
887
|
+
});
|
|
888
|
+
// Skills (by name, by their files' digest)
|
|
889
|
+
const toSkills = contents.skillNames.map((n, i) => {
|
|
890
|
+
const entry = (to.manifest.skills ?? [])[i];
|
|
891
|
+
return {
|
|
892
|
+
name: n,
|
|
893
|
+
digest: dirDigest(to, packagePath(entry?.path)),
|
|
894
|
+
};
|
|
895
|
+
});
|
|
896
|
+
for (const s of toSkills) {
|
|
897
|
+
const l = live.skills.find((x) => x.name === s.name);
|
|
898
|
+
if (!l) {
|
|
899
|
+
components.push(added("skill", s.name));
|
|
822
900
|
continue;
|
|
823
901
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
902
|
+
const same = skillFilesDigest(l.manifest.files) === s.digest;
|
|
903
|
+
components.push({
|
|
904
|
+
kind: "skill",
|
|
905
|
+
id: l.id,
|
|
906
|
+
name: s.name,
|
|
907
|
+
change: same ? "same" : direction(l.catalogVersion),
|
|
908
|
+
from: l.catalogVersion,
|
|
909
|
+
to: to.version,
|
|
910
|
+
updatedOnOwn: l.updatedOnOwn,
|
|
911
|
+
ownScope: l.ownScope,
|
|
912
|
+
pinnedOrgs: [],
|
|
834
913
|
});
|
|
835
914
|
}
|
|
836
|
-
for (const
|
|
837
|
-
if (
|
|
915
|
+
for (const l of live.skills) {
|
|
916
|
+
if (toSkills.some((s) => s.name === l.name))
|
|
838
917
|
continue;
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
918
|
+
components.push({
|
|
919
|
+
kind: "skill",
|
|
920
|
+
id: l.id,
|
|
921
|
+
name: l.name,
|
|
842
922
|
change: "removed",
|
|
843
|
-
|
|
844
|
-
|
|
923
|
+
from: l.catalogVersion,
|
|
924
|
+
to: null,
|
|
925
|
+
updatedOnOwn: l.updatedOnOwn,
|
|
926
|
+
ownScope: l.ownScope,
|
|
927
|
+
pinnedOrgs: [],
|
|
845
928
|
});
|
|
846
929
|
}
|
|
847
|
-
|
|
930
|
+
// Agent templates (by name, canonical definition)
|
|
931
|
+
const toAgents = contents.agents;
|
|
932
|
+
for (const a of toAgents) {
|
|
933
|
+
const l = live.agentTemplates.find((x) => x.name === a.template.name);
|
|
934
|
+
if (!l) {
|
|
935
|
+
components.push(added("agent_template", a.template.name));
|
|
936
|
+
continue;
|
|
937
|
+
}
|
|
938
|
+
const same = canonicalJson(l.definition) === canonicalJson(a.template);
|
|
848
939
|
components.push({
|
|
849
|
-
kind: "
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
940
|
+
kind: "agent_template",
|
|
941
|
+
id: l.id,
|
|
942
|
+
name: l.name,
|
|
943
|
+
change: same ? "same" : direction(l.catalogVersion),
|
|
944
|
+
from: l.catalogVersion,
|
|
945
|
+
to: to.version,
|
|
946
|
+
updatedOnOwn: l.updatedOnOwn,
|
|
947
|
+
ownScope: l.ownScope,
|
|
948
|
+
pinnedOrgs: [],
|
|
856
949
|
});
|
|
857
950
|
}
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
const toNames = await catalogSkillNames(this.d.storage, to, to.manifest);
|
|
861
|
-
const dirOf = (m, i) => packagePath((m.skills ?? [])[i]?.path);
|
|
862
|
-
const fromSkills = new Map(fromNames.map((n, i) => [n, dirOf(from.manifest, i)]));
|
|
863
|
-
const toSkills = new Map(toNames.map((n, i) => [n, dirOf(to.manifest, i)]));
|
|
864
|
-
const toPinned = new Set(toNames.filter((_, i) => (to.manifest.skills ?? [])[i]?.pinned === true));
|
|
865
|
-
const skillRefs = ledger.filter((l) => l.kind === "skill").map((l) => l.ref);
|
|
866
|
-
const liveSkills = skillRefs.length === 0
|
|
867
|
-
? []
|
|
868
|
-
: await db
|
|
869
|
-
.selectFrom("skills")
|
|
870
|
-
.select(["id", "name"])
|
|
871
|
-
.where("id", "in", skillRefs)
|
|
872
|
-
.where("org_id", "=", orgId)
|
|
873
|
-
.where("deleted_at", "is", null)
|
|
874
|
-
.execute();
|
|
875
|
-
const ledgerOfSkill = (n) => {
|
|
876
|
-
const s = liveSkills.find((x) => x.name === n);
|
|
877
|
-
return s && ledger.find((l) => l.kind === "skill" && l.ref === s.id);
|
|
878
|
-
};
|
|
879
|
-
const skills = [];
|
|
880
|
-
for (const [n, dir] of toSkills) {
|
|
881
|
-
const before = fromSkills.get(n);
|
|
882
|
-
const l = ledgerOfSkill(n);
|
|
883
|
-
const change = before === undefined
|
|
884
|
-
? "added"
|
|
885
|
-
: dirDigest(from, before) === dirDigest(to, dir)
|
|
886
|
-
? "unchanged"
|
|
887
|
-
: "changed";
|
|
888
|
-
skills.push({
|
|
889
|
-
name: n,
|
|
890
|
-
change,
|
|
891
|
-
dir,
|
|
892
|
-
suggestPinned: toPinned.has(n),
|
|
893
|
-
...(l && { ledger: l }),
|
|
894
|
-
});
|
|
895
|
-
}
|
|
896
|
-
for (const n of fromSkills.keys()) {
|
|
897
|
-
if (toSkills.has(n))
|
|
951
|
+
for (const l of live.agentTemplates) {
|
|
952
|
+
if (toAgents.some((a) => a.template.name === l.name))
|
|
898
953
|
continue;
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
dependencies: dependencies
|
|
911
|
-
.filter((x) => x.change === "added")
|
|
912
|
-
.map((x) => ({ plan: x.plan ?? null })),
|
|
913
|
-
});
|
|
914
|
-
if (conflicts.length > 0)
|
|
915
|
-
throw skillConflictError(conflicts);
|
|
916
|
-
// Agent templates (by name; phase C)
|
|
917
|
-
const fromAgents = await readCatalogAgentTemplates(this.d.storage, from);
|
|
918
|
-
const toAgents = await readCatalogAgentTemplates(this.d.storage, to);
|
|
919
|
-
const templateRefs = ledger.filter((l) => l.kind === "agent_template").map((l) => l.ref);
|
|
920
|
-
const liveTemplates = templateRefs.length === 0
|
|
921
|
-
? []
|
|
922
|
-
: await db
|
|
923
|
-
.selectFrom("agent_templates")
|
|
924
|
-
.select(["id", "name"])
|
|
925
|
-
.where("id", "in", templateRefs)
|
|
926
|
-
.where("org_id", "=", orgId)
|
|
927
|
-
.where("deleted_at", "is", null)
|
|
928
|
-
.execute();
|
|
929
|
-
const ledgerOfTemplate = (n) => {
|
|
930
|
-
const r = liveTemplates.find((x) => x.name === n);
|
|
931
|
-
return r && ledger.find((l) => l.kind === "agent_template" && l.ref === r.id);
|
|
932
|
-
};
|
|
933
|
-
const agentTemplates = [];
|
|
934
|
-
for (const a of toAgents) {
|
|
935
|
-
const n = a.template.name;
|
|
936
|
-
const before = fromAgents.find((x) => x.template.name === n);
|
|
937
|
-
const l = ledgerOfTemplate(n);
|
|
938
|
-
const change = before === undefined
|
|
939
|
-
? "added"
|
|
940
|
-
: canonicalJson(before.template) === canonicalJson(a.template)
|
|
941
|
-
? "unchanged"
|
|
942
|
-
: "changed";
|
|
943
|
-
agentTemplates.push({ name: n, change, template: a.template, ...(l && { ledger: l }) });
|
|
944
|
-
}
|
|
945
|
-
for (const a of fromAgents) {
|
|
946
|
-
const n = a.template.name;
|
|
947
|
-
if (toAgents.some((x) => x.template.name === n))
|
|
948
|
-
continue;
|
|
949
|
-
const l = ledgerOfTemplate(n);
|
|
950
|
-
agentTemplates.push({ name: n, change: "removed", ...(l && { ledger: l }) });
|
|
951
|
-
}
|
|
952
|
-
for (const a of agentTemplates) {
|
|
953
|
-
components.push({ kind: "agent_template", ref: a.name, change: a.change });
|
|
954
|
+
components.push({
|
|
955
|
+
kind: "agent_template",
|
|
956
|
+
id: l.id,
|
|
957
|
+
name: l.name,
|
|
958
|
+
change: "removed",
|
|
959
|
+
from: l.catalogVersion,
|
|
960
|
+
to: null,
|
|
961
|
+
updatedOnOwn: l.updatedOnOwn,
|
|
962
|
+
ownScope: l.ownScope,
|
|
963
|
+
pinnedOrgs: [],
|
|
964
|
+
});
|
|
954
965
|
}
|
|
955
|
-
// Connector templates (by id)
|
|
956
|
-
const
|
|
957
|
-
const toTemplates = await readCatalogTemplates(this.d.storage, to);
|
|
958
|
-
// The install's connectors by template; a dropped one (kept only for the agents using it) counts
|
|
959
|
-
// only while its connector is live, so a template the target brings back maps onto it
|
|
960
|
-
const connectorRows = ledger.filter((l) => l.kind === "connector" && l.template_id !== null);
|
|
961
|
-
const liveConnectors = connectorRows.length === 0
|
|
962
|
-
? []
|
|
963
|
-
: await db
|
|
964
|
-
.selectFrom("connectors")
|
|
965
|
-
.select(["id", "connector", "endpoint", "auth"])
|
|
966
|
-
.where("id", "in", connectorRows.map((l) => l.ref))
|
|
967
|
-
.where("org_id", "=", orgId)
|
|
968
|
-
.where("deleted_at", "is", null)
|
|
969
|
-
.execute();
|
|
970
|
-
const connectorOf = (templateId) => {
|
|
971
|
-
const rows = connectorRows.filter((x) => x.template_id === templateId);
|
|
972
|
-
const l = rows.find((x) => !x.dropped) ??
|
|
973
|
-
rows.find((x) => liveConnectors.some((c) => c.id === x.ref));
|
|
974
|
-
const c = l && liveConnectors.find((x) => x.id === l.ref);
|
|
975
|
-
return {
|
|
976
|
-
...(l && { ledger: l }),
|
|
977
|
-
...(c && {
|
|
978
|
-
connector: {
|
|
979
|
-
id: c.id,
|
|
980
|
-
connector: c.connector,
|
|
981
|
-
endpoint: c.endpoint,
|
|
982
|
-
auth: c.auth,
|
|
983
|
-
},
|
|
984
|
-
}),
|
|
985
|
-
};
|
|
986
|
-
};
|
|
966
|
+
// Connector templates (by id, canonical file) and the connectors made from them
|
|
967
|
+
const toTemplates = contents.templates;
|
|
987
968
|
const deps = this.installer.templateDeps();
|
|
988
|
-
const
|
|
969
|
+
const connectors = [];
|
|
970
|
+
const shippedOff = (f) => f.defaultEnabled === false;
|
|
971
|
+
/** Templates whose `defaultEnabled` the target flips: id -> shipped off, and the platform id. */
|
|
972
|
+
const flipped = new Map();
|
|
973
|
+
const flippedIds = new Map();
|
|
989
974
|
for (const ct of toTemplates) {
|
|
990
|
-
const
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
if (!before && mapped.ledger?.dropped && mapped.connector) {
|
|
994
|
-
// Back in the plugin (an earlier upgrade dropped it, its connector was kept): the kept
|
|
995
|
-
// connector is updated to the template, not created again (its slug would be taken)
|
|
975
|
+
const l = live.templates.find((x) => x.name === ct.id);
|
|
976
|
+
if (!l) {
|
|
977
|
+
const problem = templatePluginProblem(deps, ct.file.template);
|
|
996
978
|
if (problem !== undefined)
|
|
997
979
|
throw new ApiError("catalog.not_deployed", problem);
|
|
998
|
-
|
|
999
|
-
throw targetInvalid(`Connector template ${ct.id} comes back for another connector (${ct.file.template.plugin} "${ct.file.template.connector}"); uninstall the plugin and install the new version instead`, [
|
|
1000
|
-
{
|
|
1001
|
-
reason: "template_connector",
|
|
1002
|
-
template: ct.id,
|
|
1003
|
-
plugin: ct.file.template.plugin,
|
|
1004
|
-
connector: ct.file.template.connector,
|
|
1005
|
-
},
|
|
1006
|
-
]);
|
|
1007
|
-
}
|
|
1008
|
-
const credentialsChanged = credentialKey(mapped.connector.auth) !==
|
|
1009
|
-
credentialKey(ct.file.template.auth);
|
|
1010
|
-
templates.push({
|
|
1011
|
-
id: ct.id,
|
|
1012
|
-
change: "changed",
|
|
1013
|
-
target: ct.file,
|
|
1014
|
-
...mapped,
|
|
1015
|
-
credentialsChanged,
|
|
1016
|
-
});
|
|
980
|
+
components.push(added("connector_template", ct.id));
|
|
1017
981
|
continue;
|
|
1018
982
|
}
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
983
|
+
const same = canonicalJson(l.file) === canonicalJson(ct.file);
|
|
984
|
+
components.push({
|
|
985
|
+
kind: "connector_template",
|
|
986
|
+
id: l.id,
|
|
987
|
+
name: ct.id,
|
|
988
|
+
change: same ? "same" : direction(l.version),
|
|
989
|
+
from: l.version,
|
|
990
|
+
to: to.version,
|
|
991
|
+
updatedOnOwn: false,
|
|
992
|
+
ownScope: l.ownScope,
|
|
993
|
+
pinnedOrgs: [],
|
|
994
|
+
});
|
|
995
|
+
if (same)
|
|
1023
996
|
continue;
|
|
997
|
+
if (shippedOff(l.file) !== shippedOff(ct.file)) {
|
|
998
|
+
flipped.set(ct.id, shippedOff(ct.file));
|
|
999
|
+
flippedIds.set(ct.id, l.id);
|
|
1024
1000
|
}
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1001
|
+
const before = l.file.template;
|
|
1002
|
+
const after = ct.file.template;
|
|
1003
|
+
if (before.plugin !== after.plugin || before.connector !== after.connector) {
|
|
1004
|
+
throw targetInvalid(`Connector template ${ct.id} moves to another connector (${after.plugin} "${after.connector}"); remove the plugin and import the new version as a new plugin instead`, [
|
|
1005
|
+
{
|
|
1006
|
+
reason: "template_connector",
|
|
1007
|
+
template: ct.id,
|
|
1008
|
+
plugin: after.plugin,
|
|
1009
|
+
connector: after.connector,
|
|
1010
|
+
},
|
|
1011
|
+
]);
|
|
1012
|
+
}
|
|
1013
|
+
const made = await db
|
|
1014
|
+
.selectFrom("connectors")
|
|
1015
|
+
.select(["id", "org_id", "name", "connector", "endpoint", "auth"])
|
|
1016
|
+
.where("platform_template_id", "=", l.id)
|
|
1017
|
+
.where("deleted_at", "is", null)
|
|
1018
|
+
.orderBy("org_id")
|
|
1019
|
+
.orderBy("id")
|
|
1020
|
+
.execute();
|
|
1021
|
+
if (made.length > 0) {
|
|
1022
|
+
const problem = templatePluginProblem(deps, after);
|
|
1023
|
+
if (problem !== undefined)
|
|
1039
1024
|
throw new ApiError("catalog.not_deployed", problem);
|
|
1040
|
-
}
|
|
1041
1025
|
}
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1026
|
+
for (const c of made) {
|
|
1027
|
+
connectors.push({
|
|
1028
|
+
orgId: c.org_id,
|
|
1029
|
+
id: c.id,
|
|
1030
|
+
name: c.name,
|
|
1031
|
+
connector: c.connector,
|
|
1032
|
+
endpoint: c.endpoint,
|
|
1033
|
+
templateId: ct.id,
|
|
1034
|
+
file: ct.file,
|
|
1035
|
+
credentialsReset: credentialKey(c.auth) !==
|
|
1036
|
+
credentialKey(after.auth),
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1047
1039
|
}
|
|
1048
|
-
for (const
|
|
1049
|
-
if (toTemplates.some((x) => x.id ===
|
|
1040
|
+
for (const l of live.templates) {
|
|
1041
|
+
if (toTemplates.some((x) => x.id === l.name))
|
|
1050
1042
|
continue;
|
|
1051
|
-
|
|
1052
|
-
|
|
1043
|
+
components.push({
|
|
1044
|
+
kind: "connector_template",
|
|
1045
|
+
id: l.id,
|
|
1046
|
+
name: l.name,
|
|
1053
1047
|
change: "removed",
|
|
1054
|
-
|
|
1055
|
-
|
|
1048
|
+
from: l.version,
|
|
1049
|
+
to: null,
|
|
1050
|
+
updatedOnOwn: false,
|
|
1051
|
+
ownScope: l.ownScope,
|
|
1052
|
+
pinnedOrgs: [],
|
|
1056
1053
|
});
|
|
1057
1054
|
}
|
|
1058
|
-
|
|
1055
|
+
// Themes (by id, canonical definition and their assets' digest)
|
|
1056
|
+
const toThemes = contents.themes;
|
|
1057
|
+
for (const th of toThemes) {
|
|
1058
|
+
const l = live.themes.find((x) => x.name === th.id);
|
|
1059
|
+
if (!l) {
|
|
1060
|
+
components.push(added("theme", th.id));
|
|
1061
|
+
continue;
|
|
1062
|
+
}
|
|
1063
|
+
const same = canonicalJson(l.definition) === canonicalJson(th.theme) &&
|
|
1064
|
+
l.assetsDigest === th.assetsDigest;
|
|
1059
1065
|
components.push({
|
|
1060
|
-
kind: "
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1066
|
+
kind: "theme",
|
|
1067
|
+
id: l.id,
|
|
1068
|
+
name: th.id,
|
|
1069
|
+
change: same ? "same" : direction(l.catalogVersion),
|
|
1070
|
+
from: l.catalogVersion,
|
|
1071
|
+
to: to.version,
|
|
1072
|
+
updatedOnOwn: false,
|
|
1073
|
+
ownScope: l.ownScope,
|
|
1074
|
+
pinnedOrgs: [],
|
|
1067
1075
|
});
|
|
1068
1076
|
}
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1077
|
+
for (const l of live.themes) {
|
|
1078
|
+
if (toThemes.some((x) => x.id === l.name))
|
|
1079
|
+
continue;
|
|
1080
|
+
components.push({
|
|
1081
|
+
kind: "theme",
|
|
1082
|
+
id: l.id,
|
|
1083
|
+
name: l.name,
|
|
1084
|
+
change: "removed",
|
|
1085
|
+
from: l.catalogVersion,
|
|
1086
|
+
to: null,
|
|
1087
|
+
updatedOnOwn: false,
|
|
1088
|
+
ownScope: l.ownScope,
|
|
1089
|
+
pinnedOrgs: [],
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
// The orgs where the plugin is on (a live install; builtin: every org)
|
|
1093
|
+
const onOrgs = await this.pluginOrgs(itemId, item.builtin);
|
|
1094
|
+
if (extension)
|
|
1095
|
+
extension = { ...extension, orgs: onOrgs };
|
|
1096
|
+
// Rule 10: an added skill must not take a name already used where the plugin is on
|
|
1097
|
+
const conflicts = [];
|
|
1098
|
+
for (const c of components) {
|
|
1099
|
+
if (c.kind !== "skill" || c.change !== "added")
|
|
1100
|
+
continue;
|
|
1101
|
+
for (const orgId of onOrgs) {
|
|
1102
|
+
const ids = [
|
|
1103
|
+
...(await clashingOrgSkills(db, orgId, { id: "", itemId }, c.name)),
|
|
1104
|
+
...(await clashingPlatformSkills(db, orgId, { id: "" }, c.name)).map((x) => x.id),
|
|
1105
|
+
];
|
|
1106
|
+
if (ids.length > 0)
|
|
1107
|
+
conflicts.push({ skill: c.name, orgId, conflicts: ids.sort() });
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
if (conflicts.length > 0) {
|
|
1111
|
+
throw new ApiError("plugin.skill_conflict", `The update adds skills whose names organizations already use where the plugin is on (${[...new Set(conflicts.map((c) => c.skill))].join(", ")}); remove or rename those skills first`, conflicts);
|
|
1112
|
+
}
|
|
1113
|
+
// Themes spec §7: an update never removes the platform default theme; rule 10 (§6): an added
|
|
1114
|
+
// theme must not take an id already on where the plugin is on
|
|
1115
|
+
const removedThemes = components
|
|
1116
|
+
.filter((c) => c.kind === "theme" && c.change === "removed" && c.id !== null)
|
|
1117
|
+
.map((c) => c.id);
|
|
1118
|
+
await assertNotPlatformDefault(db, removedThemes, () => "gone");
|
|
1119
|
+
const themeConflicts = [];
|
|
1120
|
+
for (const c of components) {
|
|
1121
|
+
if (c.kind !== "theme" || c.change !== "added")
|
|
1122
|
+
continue;
|
|
1123
|
+
for (const orgId of onOrgs) {
|
|
1124
|
+
const clash = await themeIdClashes(db, orgId, null, c.name);
|
|
1125
|
+
if (clash.length > 0) {
|
|
1126
|
+
themeConflicts.push({
|
|
1127
|
+
theme: c.name,
|
|
1128
|
+
orgId,
|
|
1129
|
+
themes: clash.map((x) => x.id),
|
|
1130
|
+
plugins: clash.map((x) => x.plugin ?? "platform"),
|
|
1131
|
+
});
|
|
1081
1132
|
}
|
|
1082
1133
|
}
|
|
1083
|
-
|
|
1084
|
-
|
|
1134
|
+
}
|
|
1135
|
+
if (themeConflicts.length > 0) {
|
|
1136
|
+
throw new ApiError("theme.id_taken", `The update adds themes whose ids are already on in organizations where the plugin is on (${[...new Set(themeConflicts.map((c) => c.theme))].join(", ")}); switch those themes off there first`, themeConflicts);
|
|
1137
|
+
}
|
|
1138
|
+
const themes = await this.themesLost(removedThemes);
|
|
1139
|
+
// Pinned copies (in orgs where the component is on) and removed components agents use
|
|
1140
|
+
for (const kind of ["skill", "agent_template"]) {
|
|
1141
|
+
const mine = components.filter((c) => c.kind === kind && c.id !== null);
|
|
1142
|
+
if (mine.length === 0)
|
|
1143
|
+
continue;
|
|
1144
|
+
const pins = kind === "skill"
|
|
1145
|
+
? await db
|
|
1146
|
+
.selectFrom("skills")
|
|
1147
|
+
.select(["org_id", "platform_skill_id as platform_id"])
|
|
1148
|
+
.where("platform_skill_id", "in", mine.map((c) => c.id))
|
|
1149
|
+
.where("pinned_version", "is not", null)
|
|
1150
|
+
.where("deleted_at", "is", null)
|
|
1151
|
+
.execute()
|
|
1152
|
+
: await db
|
|
1153
|
+
.selectFrom("agent_templates")
|
|
1154
|
+
.select(["org_id", "platform_template_id as platform_id"])
|
|
1155
|
+
.where("platform_template_id", "in", mine.map((c) => c.id))
|
|
1156
|
+
.where("pinned_version", "is not", null)
|
|
1157
|
+
.where("deleted_at", "is", null)
|
|
1158
|
+
.execute();
|
|
1159
|
+
const facts = mine.map((c) => {
|
|
1160
|
+
const l = (kind === "skill" ? live.skills : live.agentTemplates).find((x) => x.id === c.id);
|
|
1161
|
+
return {
|
|
1162
|
+
id: c.id,
|
|
1163
|
+
itemId,
|
|
1164
|
+
scopeMode: l?.scopeMode ?? "follow",
|
|
1165
|
+
scope: l?.scope ?? "optional",
|
|
1166
|
+
disabled: l?.disabled ?? false,
|
|
1167
|
+
};
|
|
1168
|
+
});
|
|
1169
|
+
const st = await loadScopeState(db, kind, facts);
|
|
1170
|
+
for (const c of mine) {
|
|
1171
|
+
const f = facts.find((x) => x.id === c.id);
|
|
1172
|
+
if (!f)
|
|
1173
|
+
continue;
|
|
1174
|
+
const orgsPinned = [
|
|
1175
|
+
...new Set(pins.filter((p) => p.platform_id === c.id).map((p) => p.org_id)),
|
|
1176
|
+
];
|
|
1177
|
+
c.pinnedOrgs = orgsPinned
|
|
1178
|
+
.filter((orgId) => componentOn(f, pluginFactsOf(st, itemId, orgId), listedIn(st, f.id, orgId), switchOf(st, f.id, orgId)))
|
|
1179
|
+
.sort();
|
|
1180
|
+
if (c.change !== "removed")
|
|
1181
|
+
continue;
|
|
1182
|
+
const kept = [];
|
|
1183
|
+
for (const orgId of await this.liveOrgs()) {
|
|
1184
|
+
const agents = await agentsUsing(db, orgId, kind, [c.id]);
|
|
1185
|
+
if (agents.length > 0) {
|
|
1186
|
+
kept.push({ orgId, agents: agents.map((a) => ({ id: a.id, name: a.name })) });
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
if (kept.length > 0)
|
|
1190
|
+
c.kept = kept;
|
|
1085
1191
|
}
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1192
|
+
}
|
|
1193
|
+
// The org connectors: changed templates' connectors, templates turned on (their connectors
|
|
1194
|
+
// created) or off
|
|
1195
|
+
const addedTemplates = components
|
|
1196
|
+
.filter((c) => c.kind === "connector_template" && c.change === "added")
|
|
1197
|
+
.map((c) => c.name)
|
|
1198
|
+
// an added template shipped off is on nowhere (no org can have switched it on yet)
|
|
1199
|
+
.filter((id) => {
|
|
1200
|
+
const f = toTemplates.find((x) => x.id === id)?.file;
|
|
1201
|
+
return item.builtin || f === undefined || !shippedOff(f);
|
|
1202
|
+
});
|
|
1203
|
+
const byOrg = new Map();
|
|
1204
|
+
const entry = (orgId) => {
|
|
1205
|
+
const e = byOrg.get(orgId) ?? { orgId, connectors: [], created: [], deferred: [] };
|
|
1206
|
+
byOrg.set(orgId, e);
|
|
1207
|
+
return e;
|
|
1208
|
+
};
|
|
1209
|
+
for (const c of connectors) {
|
|
1210
|
+
entry(c.orgId).connectors.push({
|
|
1211
|
+
id: c.id,
|
|
1212
|
+
name: c.name,
|
|
1213
|
+
templateId: c.templateId,
|
|
1214
|
+
credentialsReset: c.credentialsReset,
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
const creates = [];
|
|
1218
|
+
/** The orgs with a deferred connector: the update owes their template connector ensure. */
|
|
1219
|
+
const deferred = new Set();
|
|
1220
|
+
if (addedTemplates.length > 0 || flipped.size > 0) {
|
|
1221
|
+
// a named plugin still on in an org it no longer lists gets nothing new there (the scope
|
|
1222
|
+
// sync removes it)
|
|
1223
|
+
const listedOrgs = item.scope === "named" && !item.builtin
|
|
1224
|
+
? new Set((await db
|
|
1225
|
+
.selectFrom("catalog_item_scope_orgs")
|
|
1226
|
+
.select("org_id")
|
|
1227
|
+
.where("item_id", "=", itemId)
|
|
1228
|
+
.execute()).map((r) => r.org_id))
|
|
1229
|
+
: undefined;
|
|
1230
|
+
const ids = [...flipped.keys()].sort();
|
|
1231
|
+
for (const orgId of onOrgs) {
|
|
1232
|
+
if (listedOrgs !== undefined && !listedOrgs.has(orgId))
|
|
1089
1233
|
continue;
|
|
1234
|
+
// a template the org already has a live connector from (one a switch-off kept) needs none
|
|
1235
|
+
const has = await this.installer.connectedTemplates(orgId, itemId);
|
|
1236
|
+
const turnedOn = [...(await connectorTemplatesOn(db, orgId, itemId, addedTemplates))];
|
|
1237
|
+
if (ids.length > 0) {
|
|
1238
|
+
const before = await connectorTemplatesOn(db, orgId, itemId, ids);
|
|
1239
|
+
const after = await connectorTemplatesOn(db, orgId, itemId, ids, flipped);
|
|
1240
|
+
for (const id of ids) {
|
|
1241
|
+
const platformId = flippedIds.get(id);
|
|
1242
|
+
if (after.has(id) && !before.has(id)) {
|
|
1243
|
+
turnedOn.push(id);
|
|
1244
|
+
}
|
|
1245
|
+
else if (before.has(id) && !after.has(id)) {
|
|
1246
|
+
const agents = await agentsUsing(db, orgId, "connector_template", [platformId]);
|
|
1247
|
+
const e = entry(orgId);
|
|
1248
|
+
e.turnedOff = [
|
|
1249
|
+
...(e.turnedOff ?? []),
|
|
1250
|
+
{
|
|
1251
|
+
templateId: id,
|
|
1252
|
+
agents: agents.map((a) => ({ id: a.id, name: a.name })),
|
|
1253
|
+
connectorsKept: await connectorsMadeFrom(db, orgId, platformId),
|
|
1254
|
+
},
|
|
1255
|
+
];
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1090
1258
|
}
|
|
1091
|
-
|
|
1259
|
+
// A builtin plugin gets no connectors from an update until a design covers builtin
|
|
1260
|
+
// template connectors (ruling R28): it is on everywhere without an install
|
|
1261
|
+
if (item.builtin)
|
|
1092
1262
|
continue;
|
|
1093
|
-
|
|
1263
|
+
for (const id of turnedOn.sort()) {
|
|
1264
|
+
if (has.has(id))
|
|
1265
|
+
continue;
|
|
1266
|
+
const file = toTemplates.find((x) => x.id === id)?.file;
|
|
1267
|
+
if (file === undefined)
|
|
1268
|
+
continue;
|
|
1269
|
+
const t = file.template;
|
|
1270
|
+
// Decided here, not only at the confirm (ruling R27), with the checks the confirm runs:
|
|
1271
|
+
// the template's connector extension loaded on this replica (planning; the bootstrap's
|
|
1272
|
+
// first pass runs before the extensions load) and its kind available in the org (the
|
|
1273
|
+
// create's own check, `ConnectorsService.kindAvailable`). Otherwise it waits; the update
|
|
1274
|
+
// owes the org's template connector ensure, which creates it once both hold
|
|
1275
|
+
if (!deps.findConnector(t.plugin, t.connector) ||
|
|
1276
|
+
!(await this.connectors.kindAvailable(orgId, t.connector))) {
|
|
1277
|
+
deferred.add(orgId);
|
|
1278
|
+
entry(orgId).deferred.push({
|
|
1279
|
+
templateId: id,
|
|
1280
|
+
displayName: file.displayName,
|
|
1281
|
+
kind: t.connector,
|
|
1282
|
+
});
|
|
1283
|
+
continue;
|
|
1284
|
+
}
|
|
1285
|
+
creates.push({ orgId, templateId: id, file });
|
|
1286
|
+
entry(orgId).created.push({
|
|
1287
|
+
templateId: id,
|
|
1288
|
+
displayName: file.displayName,
|
|
1289
|
+
setup: setupNeed(t.auth) === undefined
|
|
1290
|
+
? "ready"
|
|
1291
|
+
: "needs_config",
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
// the connectors as the confirm plans them, checked now: a refusal shows in the preview as
|
|
1296
|
+
// a readable target refusal
|
|
1297
|
+
for (const id of new Set(creates.map((c) => c.templateId))) {
|
|
1298
|
+
const file = creates.find((c) => c.templateId === id)?.file;
|
|
1299
|
+
try {
|
|
1300
|
+
this.installer.planConnector(null, { itemId, version: to.version }, { id, file }, "", undefined);
|
|
1301
|
+
}
|
|
1302
|
+
catch (e) {
|
|
1303
|
+
if (!(e instanceof ApiError))
|
|
1304
|
+
throw e;
|
|
1305
|
+
throw targetInvalid(`Connector template ${id} of version ${to.version} cannot become a connector (${e.message}); fix the template and import a new version`, [
|
|
1306
|
+
{
|
|
1307
|
+
reason: "template_connector_invalid",
|
|
1308
|
+
template: id,
|
|
1309
|
+
code: e.code,
|
|
1310
|
+
...(e.details !== undefined && { causeDetails: e.details }),
|
|
1311
|
+
},
|
|
1312
|
+
]);
|
|
1313
|
+
}
|
|
1094
1314
|
}
|
|
1095
1315
|
}
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
const manifests = await db
|
|
1107
|
-
.selectFrom("plugin_installs as a")
|
|
1108
|
-
.innerJoin("catalog_item_versions as v", (j) => j.onRef("v.item_id", "=", "a.item_id").onRef("v.version", "=", "a.version"))
|
|
1109
|
-
.select("v.manifest")
|
|
1110
|
-
.where("a.id", "in", removedDeps.map((x) => x.child?.installId))
|
|
1111
|
-
.execute();
|
|
1112
|
-
for (const m of manifests)
|
|
1113
|
-
for (const a of requiredActions(m.manifest))
|
|
1114
|
-
actions.add(a);
|
|
1115
|
-
}
|
|
1116
|
-
const lh = ledgerHash(ledger);
|
|
1316
|
+
const scopeInstalls = await this.scopeInstallsOf(item, onOrgs);
|
|
1317
|
+
const connectorOrgs = [...byOrg.values()]
|
|
1318
|
+
.map((e) => ({
|
|
1319
|
+
...e,
|
|
1320
|
+
created: e.created.sort((a, b) => a.templateId.localeCompare(b.templateId)),
|
|
1321
|
+
deferred: e.deferred.sort((a, b) => a.templateId.localeCompare(b.templateId)),
|
|
1322
|
+
connectors: e.connectors.sort((a, b) => `${a.templateId}\0${a.id}`.localeCompare(`${b.templateId}\0${b.id}`)),
|
|
1323
|
+
}))
|
|
1324
|
+
.sort((a, b) => a.orgId.localeCompare(b.orgId));
|
|
1325
|
+
components.sort((a, b) => KIND_ORDER[a.kind] - KIND_ORDER[b.kind] || a.name.localeCompare(b.name));
|
|
1117
1326
|
const diffHash = sha256(canonicalJson({
|
|
1118
|
-
|
|
1119
|
-
from
|
|
1327
|
+
itemId,
|
|
1328
|
+
from,
|
|
1120
1329
|
to: to.version,
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1330
|
+
manifest: to.manifest,
|
|
1331
|
+
files: filesDigest(to),
|
|
1332
|
+
// `needsApproval` is shown only: it does not change what the confirm does
|
|
1333
|
+
extension: extension && {
|
|
1334
|
+
from: extension.from,
|
|
1335
|
+
to: extension.to,
|
|
1336
|
+
orgs: extension.orgs,
|
|
1337
|
+
sha256: extension.sha256,
|
|
1338
|
+
},
|
|
1124
1339
|
components,
|
|
1125
|
-
|
|
1340
|
+
connectors: connectors.map((c) => ({
|
|
1341
|
+
id: c.id,
|
|
1342
|
+
endpoint: c.endpoint,
|
|
1343
|
+
reset: c.credentialsReset,
|
|
1344
|
+
})),
|
|
1345
|
+
connectorOrgs,
|
|
1346
|
+
// by org and failing state: an org's name or failure message changes nothing it does
|
|
1347
|
+
scopeInstalls: scopeInstalls.map((o) => ({ orgId: o.orgId, failing: o.failing === true })),
|
|
1348
|
+
// only when present: a diff without themes keeps the hash it had before themes
|
|
1349
|
+
...(themes !== undefined && { themes }),
|
|
1126
1350
|
}));
|
|
1127
1351
|
return {
|
|
1128
|
-
installId,
|
|
1129
1352
|
itemId,
|
|
1130
1353
|
name,
|
|
1131
1354
|
from,
|
|
1132
1355
|
to,
|
|
1133
|
-
|
|
1356
|
+
components,
|
|
1134
1357
|
extension,
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1358
|
+
connectors,
|
|
1359
|
+
creates,
|
|
1360
|
+
deferredOrgs: [...deferred].sort(),
|
|
1361
|
+
connectorOrgs,
|
|
1362
|
+
scopeInstalls,
|
|
1363
|
+
...(themes !== undefined && { themes }),
|
|
1364
|
+
contents,
|
|
1138
1365
|
dependencies,
|
|
1139
|
-
components,
|
|
1140
|
-
inputs,
|
|
1141
1366
|
diffHash,
|
|
1142
|
-
ledgerHash: lh,
|
|
1143
|
-
actions: [...actions],
|
|
1144
|
-
creates,
|
|
1145
|
-
updates,
|
|
1146
1367
|
};
|
|
1147
1368
|
}
|
|
1148
1369
|
/**
|
|
1149
|
-
* The
|
|
1150
|
-
*
|
|
1151
|
-
* the credentials it needs changed (then the input must give what the template needs).
|
|
1370
|
+
* The target's skill names, agent templates, connector templates and themes, from object storage
|
|
1371
|
+
* (a theme failing its checks -> 400 `theme.invalid`, themes spec §6).
|
|
1152
1372
|
*/
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1373
|
+
async readContents(to) {
|
|
1374
|
+
return {
|
|
1375
|
+
skillNames: await catalogSkillNames(this.storage, to, to.manifest),
|
|
1376
|
+
agents: await readCatalogAgentTemplates(this.storage, to),
|
|
1377
|
+
templates: await readCatalogTemplates(this.storage, to),
|
|
1378
|
+
themes: await readCatalogThemes(this.storage, to),
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
/**
|
|
1382
|
+
* Whether the target's extension package asks for permissions the approved snapshot does not
|
|
1383
|
+
* cover (no snapshot, or a blocking addition): it then loads only once approved (§7.4).
|
|
1384
|
+
*/
|
|
1385
|
+
async needsApproval(name, sha) {
|
|
1386
|
+
if (this.config.get().extensionPermissions.autoApprove)
|
|
1387
|
+
return false;
|
|
1388
|
+
const pkg = await readExtensionPackage(await this.blobs.get(sha), {
|
|
1389
|
+
maxBytes: this.config.get().packages.maxBytes,
|
|
1390
|
+
hostSdkVersion: SDK_VERSION,
|
|
1391
|
+
});
|
|
1392
|
+
const snap = await this.db
|
|
1393
|
+
.selectFrom("extension_permission_snapshots")
|
|
1394
|
+
.select("permissions")
|
|
1395
|
+
.where("plugin", "=", name)
|
|
1396
|
+
.executeTakeFirst();
|
|
1397
|
+
if (!snap)
|
|
1398
|
+
return true;
|
|
1399
|
+
const { added } = diffPermissions(snap.permissions, permissionSetOfPackage(pkg));
|
|
1400
|
+
return blockingKeys(added).length > 0;
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* The deployment's extension step: none when the target carries the extension the deployment
|
|
1404
|
+
* runs; a version without the extension the deployment runs for the plugin is refused, except
|
|
1405
|
+
* for an owner update (`allowRemove`, ruling P3-12': removing code runs none), which removes an
|
|
1406
|
+
* installed one; a move of a config-declared extension is refused.
|
|
1407
|
+
*/
|
|
1408
|
+
async extensionTarget(name, from, to, allowRemove = false) {
|
|
1409
|
+
const want = to.manifest.extension;
|
|
1410
|
+
const row = await this.db
|
|
1411
|
+
.selectFrom("extension_installs")
|
|
1412
|
+
.select(["sha256", "version"])
|
|
1413
|
+
.where("name", "=", name)
|
|
1414
|
+
.executeTakeFirst();
|
|
1415
|
+
// Only an extension declared in the startup config runs without an install record; one this
|
|
1416
|
+
// replica still has loaded after its uninstall (until its reconcile) does not count
|
|
1417
|
+
const declared = this.registry.declared().get(name) === "config";
|
|
1418
|
+
const loaded = declared ? this.registry.manifests().find((m) => m.name === name) : undefined;
|
|
1419
|
+
if (!want) {
|
|
1420
|
+
if (allowRemove && from?.manifest.extension && row && !declared) {
|
|
1421
|
+
return { from: row.version, to: null, sha256: null, previous: row.sha256 };
|
|
1163
1422
|
}
|
|
1423
|
+
if (from?.manifest.extension && (row || declared)) {
|
|
1424
|
+
throw targetInvalid(`Version ${to.version} of plugin ${name} has no extension, but the deployment runs it; uninstall the extension first`, [{ reason: "extension_removed", version: to.version }]);
|
|
1425
|
+
}
|
|
1426
|
+
return null;
|
|
1164
1427
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
if (v !== undefined)
|
|
1169
|
-
setPath(endpoint, e, v);
|
|
1428
|
+
if (row) {
|
|
1429
|
+
if (row.sha256 === to.extension_sha256)
|
|
1430
|
+
return null;
|
|
1170
1431
|
}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
}
|
|
1181
|
-
if (!oauth && given?.client !== undefined) {
|
|
1182
|
-
throw fail(`${path}.client`, "This connector does not use OAuth; provide credential instead");
|
|
1183
|
-
}
|
|
1432
|
+
else if (declared) {
|
|
1433
|
+
if (loaded?.version === want.manifest.version)
|
|
1434
|
+
return null;
|
|
1435
|
+
throw targetInvalid(`The extension of plugin ${name} is declared in the startup config at version ${loaded?.version ?? "(not loaded)"}; it cannot be moved to ${want.manifest.version} by an update`, [{ reason: "config_extension", deploymentVersion: loaded?.version ?? null }]);
|
|
1436
|
+
}
|
|
1437
|
+
if (to.extension_sha256 === null) {
|
|
1438
|
+
throw targetInvalid(`Version ${to.version} of plugin ${name} has no extension package`, [
|
|
1439
|
+
{ reason: "extension_package", version: to.version },
|
|
1440
|
+
]);
|
|
1184
1441
|
}
|
|
1185
|
-
const credential = oauth ? given?.client : given?.credential;
|
|
1186
1442
|
return {
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
version,
|
|
1192
|
-
templateId: c.id,
|
|
1193
|
-
...(template.defaultToolPolicies !== undefined && {
|
|
1194
|
-
defaultToolPolicies: template.defaultToolPolicies,
|
|
1195
|
-
}),
|
|
1196
|
-
},
|
|
1197
|
-
resetCredentials: c.credentialsChanged,
|
|
1198
|
-
...(c.credentialsChanged && credential !== undefined && { credential }),
|
|
1443
|
+
from: row?.version ?? null,
|
|
1444
|
+
to: want.manifest.version,
|
|
1445
|
+
sha256: to.extension_sha256,
|
|
1446
|
+
previous: row?.sha256 ?? null,
|
|
1199
1447
|
};
|
|
1200
1448
|
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Other platform plugins depending on this one must accept the target (their platform version's
|
|
1451
|
+
* dependency range); returns the catalog items of the target's own dependencies (their scope
|
|
1452
|
+
* sync is owed with the update: rule 9).
|
|
1453
|
+
*/
|
|
1454
|
+
async checkDependents(name, to) {
|
|
1455
|
+
const rows = await this.db
|
|
1456
|
+
.selectFrom("catalog_items as i")
|
|
1457
|
+
.innerJoin("catalog_item_versions as v", (j) => j
|
|
1458
|
+
.onRef("v.item_id", "=", "i.id")
|
|
1459
|
+
.on(sql `v.version`, "=", sql `coalesce(i.platform_synced_version, i.latest_version)`))
|
|
1460
|
+
.select(["i.id", "i.name", "v.manifest"])
|
|
1461
|
+
.where("i.deleted_at", "is", null)
|
|
1462
|
+
.execute();
|
|
1463
|
+
for (const r of rows) {
|
|
1464
|
+
if (r.name === name)
|
|
1465
|
+
continue;
|
|
1466
|
+
const range = r.manifest.dependencies?.find((d) => d.name === name)?.version;
|
|
1467
|
+
if (range !== undefined && !satisfiesRange(to.version, range)) {
|
|
1468
|
+
throw targetInvalid(`Plugin ${r.name} depends on ${name}@${range}, which version ${to.version} does not satisfy`, [{ reason: "dependent_range", dependent: r.name, range, version: to.version }]);
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
const wanted = new Set((to.manifest.dependencies ?? []).map((d) => d.name));
|
|
1472
|
+
return rows.filter((r) => wanted.has(r.name)).map((r) => r.id);
|
|
1473
|
+
}
|
|
1474
|
+
/** The plugin's live platform components with their current versions. */
|
|
1475
|
+
async liveComponents(itemId) {
|
|
1476
|
+
const db = this.db;
|
|
1477
|
+
const skills = (await db
|
|
1478
|
+
.selectFrom("platform_skills as p")
|
|
1479
|
+
.innerJoin("platform_skill_versions as v", (j) => j.onRef("v.skill_id", "=", "p.id").onRef("v.version", "=", "p.current_version"))
|
|
1480
|
+
.select([
|
|
1481
|
+
"p.id",
|
|
1482
|
+
"p.name",
|
|
1483
|
+
"p.scope_mode",
|
|
1484
|
+
"p.scope",
|
|
1485
|
+
"p.disabled",
|
|
1486
|
+
"v.manifest",
|
|
1487
|
+
"v.catalog_version",
|
|
1488
|
+
"v.updated_on_own",
|
|
1489
|
+
])
|
|
1490
|
+
.where("p.catalog_item_id", "=", itemId)
|
|
1491
|
+
.where("p.deleted_at", "is", null)
|
|
1492
|
+
.execute()).map((r) => ({
|
|
1493
|
+
id: r.id,
|
|
1494
|
+
name: r.name,
|
|
1495
|
+
scopeMode: r.scope_mode,
|
|
1496
|
+
scope: r.scope,
|
|
1497
|
+
disabled: r.disabled,
|
|
1498
|
+
manifest: r.manifest,
|
|
1499
|
+
catalogVersion: r.catalog_version,
|
|
1500
|
+
updatedOnOwn: r.updated_on_own,
|
|
1501
|
+
ownScope: r.scope_mode === "own",
|
|
1502
|
+
}));
|
|
1503
|
+
const agentTemplates = (await db
|
|
1504
|
+
.selectFrom("platform_agent_templates as p")
|
|
1505
|
+
.innerJoin("platform_agent_template_versions as v", (j) => j.onRef("v.template_id", "=", "p.id").onRef("v.version", "=", "p.current_version"))
|
|
1506
|
+
.select([
|
|
1507
|
+
"p.id",
|
|
1508
|
+
"p.name",
|
|
1509
|
+
"p.scope_mode",
|
|
1510
|
+
"p.scope",
|
|
1511
|
+
"p.disabled",
|
|
1512
|
+
"v.definition",
|
|
1513
|
+
"v.catalog_version",
|
|
1514
|
+
"v.updated_on_own",
|
|
1515
|
+
])
|
|
1516
|
+
.where("p.catalog_item_id", "=", itemId)
|
|
1517
|
+
.where("p.deleted_at", "is", null)
|
|
1518
|
+
.execute()).map((r) => ({
|
|
1519
|
+
id: r.id,
|
|
1520
|
+
name: r.name,
|
|
1521
|
+
scopeMode: r.scope_mode,
|
|
1522
|
+
scope: r.scope,
|
|
1523
|
+
disabled: r.disabled,
|
|
1524
|
+
definition: r.definition,
|
|
1525
|
+
catalogVersion: r.catalog_version,
|
|
1526
|
+
updatedOnOwn: r.updated_on_own,
|
|
1527
|
+
ownScope: r.scope_mode === "own",
|
|
1528
|
+
}));
|
|
1529
|
+
const templates = (await db
|
|
1530
|
+
.selectFrom("platform_connector_templates")
|
|
1531
|
+
.select(["id", "template_id", "current_version", "file", "scope_mode"])
|
|
1532
|
+
.where("catalog_item_id", "=", itemId)
|
|
1533
|
+
.where("deleted_at", "is", null)
|
|
1534
|
+
.execute()).map((r) => ({
|
|
1535
|
+
id: r.id,
|
|
1536
|
+
name: r.template_id,
|
|
1537
|
+
version: r.current_version,
|
|
1538
|
+
file: r.file,
|
|
1539
|
+
ownScope: r.scope_mode === "own",
|
|
1540
|
+
}));
|
|
1541
|
+
const themes = (await db
|
|
1542
|
+
.selectFrom("platform_themes as p")
|
|
1543
|
+
.innerJoin("platform_theme_versions as v", (j) => j.onRef("v.theme_id", "=", "p.id").onRef("v.version", "=", "p.current_version"))
|
|
1544
|
+
.leftJoin("catalog_item_versions as cv", (j) => j
|
|
1545
|
+
.onRef("cv.item_id", "=", "p.catalog_item_id")
|
|
1546
|
+
.onRef("cv.version", "=", "v.catalog_version"))
|
|
1547
|
+
.select(["p.id", "p.name", "p.scope_mode", "v.definition", "v.catalog_version", "cv.files"])
|
|
1548
|
+
.where("p.catalog_item_id", "=", itemId)
|
|
1549
|
+
.where("p.deleted_at", "is", null)
|
|
1550
|
+
.execute()).map((r) => ({
|
|
1551
|
+
id: r.id,
|
|
1552
|
+
name: r.name,
|
|
1553
|
+
definition: r.definition,
|
|
1554
|
+
catalogVersion: r.catalog_version,
|
|
1555
|
+
// no recorded files (should not happen): never equal, the update writes a new version
|
|
1556
|
+
assetsDigest: r.files === null ? null : themeAssetsDigest(r.files, r.definition),
|
|
1557
|
+
ownScope: r.scope_mode === "own",
|
|
1558
|
+
}));
|
|
1559
|
+
return { skills, agentTemplates, templates, themes };
|
|
1560
|
+
}
|
|
1561
|
+
/** The `themes` block of the preview: the orgs each of the removed themes `ids` is on in. */
|
|
1562
|
+
async themesLost(ids) {
|
|
1563
|
+
if (ids.length === 0)
|
|
1564
|
+
return undefined;
|
|
1565
|
+
const comps = await loadComponents(this.db, "theme", { ids });
|
|
1566
|
+
const st = await loadScopeState(this.db, "theme", comps);
|
|
1567
|
+
const orgs = await this.liveOrgs();
|
|
1568
|
+
const lost = new Map();
|
|
1569
|
+
for (const c of comps) {
|
|
1570
|
+
const on = orgs.filter((orgId) => componentOn(c, pluginFactsOf(st, c.itemId, orgId), listedIn(st, c.id, orgId), switchOf(st, c.id, orgId)));
|
|
1571
|
+
lost.set(c.id, new Set(on));
|
|
1572
|
+
}
|
|
1573
|
+
return themesPreview(this.db, lost);
|
|
1574
|
+
}
|
|
1575
|
+
/**
|
|
1576
|
+
* {@link PlatformUpdatePreview.scopeInstalls}: the live orgs without a live install (`onOrgs`
|
|
1577
|
+
* are those with one) whose scope wants the plugin on, as the scope sync decides it
|
|
1578
|
+
* (`wantedOn`). None for a builtin plugin (on everywhere without an install) or one not usable.
|
|
1579
|
+
*/
|
|
1580
|
+
async scopeInstallsOf(item, onOrgs) {
|
|
1581
|
+
if (item.builtin || !isUsable(item))
|
|
1582
|
+
return [];
|
|
1583
|
+
const [orgs, listed, switches, failures] = await Promise.all([
|
|
1584
|
+
this.db
|
|
1585
|
+
.selectFrom("orgs")
|
|
1586
|
+
.select(["id", "name"])
|
|
1587
|
+
.where("deleted_at", "is", null)
|
|
1588
|
+
.orderBy("id")
|
|
1589
|
+
.execute(),
|
|
1590
|
+
this.db
|
|
1591
|
+
.selectFrom("catalog_item_scope_orgs")
|
|
1592
|
+
.select("org_id")
|
|
1593
|
+
.where("item_id", "=", item.id)
|
|
1594
|
+
.execute(),
|
|
1595
|
+
this.db
|
|
1596
|
+
.selectFrom("catalog_item_org_switches")
|
|
1597
|
+
.select(["org_id", "enabled"])
|
|
1598
|
+
.where("item_id", "=", item.id)
|
|
1599
|
+
.execute(),
|
|
1600
|
+
this.db
|
|
1601
|
+
.selectFrom("plugin_scope_sync_failures")
|
|
1602
|
+
.select(["org_id", "message"])
|
|
1603
|
+
.where("item_id", "=", item.id)
|
|
1604
|
+
.execute(),
|
|
1605
|
+
]);
|
|
1606
|
+
const failed = new Map(failures.map((r) => [r.org_id, r.message]));
|
|
1607
|
+
const on = new Set(onOrgs);
|
|
1608
|
+
const inList = new Set(listed.map((r) => r.org_id));
|
|
1609
|
+
const sw = new Map(switches.map((r) => [r.org_id, r.enabled]));
|
|
1610
|
+
return orgs
|
|
1611
|
+
.filter((o) => !on.has(o.id) && wantedOn(item, inList.has(o.id), sw.get(o.id) ?? null))
|
|
1612
|
+
.map((o) => {
|
|
1613
|
+
const lastFailure = failed.get(o.id);
|
|
1614
|
+
return {
|
|
1615
|
+
orgId: o.id,
|
|
1616
|
+
orgName: o.name,
|
|
1617
|
+
...(lastFailure !== undefined && { failing: true, lastFailure }),
|
|
1618
|
+
};
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
/** The orgs where the plugin is on: a live install (builtin: every live org). */
|
|
1622
|
+
async pluginOrgs(itemId, builtin) {
|
|
1623
|
+
if (builtin)
|
|
1624
|
+
return this.liveOrgs();
|
|
1625
|
+
const rows = await this.db
|
|
1626
|
+
.selectFrom("plugin_installs as a")
|
|
1627
|
+
.innerJoin("orgs as o", "o.id", "a.org_id")
|
|
1628
|
+
.select("a.org_id")
|
|
1629
|
+
.distinct()
|
|
1630
|
+
.where("a.item_id", "=", itemId)
|
|
1631
|
+
.where("a.status", "in", [...LIVE_INSTALL_STATUSES])
|
|
1632
|
+
.where("o.deleted_at", "is", null)
|
|
1633
|
+
.orderBy("a.org_id")
|
|
1634
|
+
.execute();
|
|
1635
|
+
return rows.map((r) => r.org_id);
|
|
1636
|
+
}
|
|
1637
|
+
async liveOrgs() {
|
|
1638
|
+
const rows = await this.db
|
|
1639
|
+
.selectFrom("orgs")
|
|
1640
|
+
.select("id")
|
|
1641
|
+
.where("deleted_at", "is", null)
|
|
1642
|
+
.orderBy("id")
|
|
1643
|
+
.execute();
|
|
1644
|
+
return rows.map((r) => r.id);
|
|
1645
|
+
}
|
|
1646
|
+
};
|
|
1647
|
+
__decorate([
|
|
1648
|
+
Transactional()
|
|
1649
|
+
], PlatformPluginUpdater.prototype, "authorizeOwner", null);
|
|
1650
|
+
__decorate([
|
|
1651
|
+
Transactional({ propagation: "requires_new" })
|
|
1652
|
+
], PlatformPluginUpdater.prototype, "auditFailure", null);
|
|
1653
|
+
__decorate([
|
|
1654
|
+
Transactional({ propagation: "requires_new" })
|
|
1655
|
+
], PlatformPluginUpdater.prototype, "commit", null);
|
|
1656
|
+
PlatformPluginUpdater = __decorate([
|
|
1657
|
+
Injectable()
|
|
1658
|
+
// org-filter: the platform plugin update (one version per deployment) moves the item's installs,
|
|
1659
|
+
// connectors and pinned copies in every org by design, keyed by the platform item / template ids
|
|
1660
|
+
,
|
|
1661
|
+
__param(0, Inject(KernelDb)),
|
|
1662
|
+
__param(1, Inject(TransactionHost)),
|
|
1663
|
+
__param(2, Inject(SuperAdminLock)),
|
|
1664
|
+
__param(3, Inject(CatalogItemLock)),
|
|
1665
|
+
__param(4, Inject(OrgLock)),
|
|
1666
|
+
__param(5, Inject(LockService)),
|
|
1667
|
+
__param(6, Inject(StorageService)),
|
|
1668
|
+
__param(7, Inject(ExtensionRegistry)),
|
|
1669
|
+
__param(8, Inject(ExtensionAdminOps)),
|
|
1670
|
+
__param(9, Inject(ExtensionBlobs)),
|
|
1671
|
+
__param(10, Inject(KernelConfigService)),
|
|
1672
|
+
__param(11, Inject(PlatformComponents)),
|
|
1673
|
+
__param(12, Inject(PluginInstaller)),
|
|
1674
|
+
__param(13, Inject(ConnectorsService)),
|
|
1675
|
+
__param(14, Inject(PluginScopeSync)),
|
|
1676
|
+
__param(15, Inject(KERNEL_LOGGER)),
|
|
1677
|
+
__param(16, Inject(PluginGuides)),
|
|
1678
|
+
__param(17, Inject(OutboxService))
|
|
1679
|
+
], PlatformPluginUpdater);
|
|
1680
|
+
export { PlatformPluginUpdater };
|
|
1681
|
+
/** The preview of a diff (without `guideChanges`, which reads PG). */
|
|
1682
|
+
function previewOf(d) {
|
|
1683
|
+
return {
|
|
1684
|
+
itemId: d.itemId,
|
|
1685
|
+
name: d.name,
|
|
1686
|
+
from: d.from,
|
|
1687
|
+
to: d.to.version,
|
|
1688
|
+
components: d.components,
|
|
1689
|
+
extension: extensionView(d.extension),
|
|
1690
|
+
connectorOrgs: d.connectorOrgs,
|
|
1691
|
+
scopeInstalls: d.scopeInstalls,
|
|
1692
|
+
...(d.themes !== undefined && { themes: d.themes }),
|
|
1693
|
+
diffHash: d.diffHash,
|
|
1694
|
+
};
|
|
1201
1695
|
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
return db
|
|
1206
|
-
.selectFrom("plugin_install_components")
|
|
1207
|
-
.select(["kind", "ref", "created", "skill_version", "template_id", "dropped"])
|
|
1208
|
-
.where("install_id", "=", installId)
|
|
1209
|
-
.orderBy("kind")
|
|
1210
|
-
.orderBy("ref")
|
|
1211
|
-
.execute();
|
|
1212
|
-
}
|
|
1213
|
-
/** A fingerprint of the ledger (order independent). */
|
|
1214
|
-
function ledgerHash(rows) {
|
|
1215
|
-
return sha256(rows
|
|
1216
|
-
.map((r) => `${r.kind}\0${r.ref}\0${r.created}\0${r.skill_version}\0${r.template_id}\0${r.dropped}\n`)
|
|
1217
|
-
.sort()
|
|
1218
|
-
.join(""));
|
|
1696
|
+
/** The extension step as the preview and the result show it. */
|
|
1697
|
+
function extensionView(e) {
|
|
1698
|
+
return e && { from: e.from, to: e.to, orgs: e.orgs, needsApproval: e.needsApproval };
|
|
1219
1699
|
}
|