@capybara-hq/kernel 0.1.0-rc.1 → 0.1.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/admin.controller.d.ts +17 -17
- package/dist/admin/admin.controller.js +43 -26
- package/dist/admin/admin.module.d.ts +3 -0
- package/dist/admin/admin.module.js +22 -0
- package/dist/admin/extensions.controller.d.ts +14 -14
- package/dist/admin/extensions.controller.js +30 -17
- package/dist/admin/setup-lock.d.ts +16 -0
- package/dist/admin/setup-lock.js +47 -0
- package/dist/admin/setup.controller.d.ts +8 -8
- package/dist/admin/setup.controller.js +27 -25
- package/dist/admin/setup.service.d.ts +19 -27
- package/dist/admin/setup.service.js +61 -61
- package/dist/agents/agent-lookup.d.ts +53 -0
- package/dist/agents/agent-lookup.js +187 -0
- package/dist/agents/agents.controller.d.ts +1 -1
- package/dist/agents/agents.controller.js +14 -8
- package/dist/agents/agents.module.d.ts +7 -0
- package/dist/agents/agents.module.js +41 -0
- package/dist/agents/agents.service.d.ts +39 -58
- package/dist/agents/agents.service.js +280 -335
- package/dist/agents/definition.d.ts +39 -8
- package/dist/agents/definition.js +201 -17
- package/dist/agents/models.controller.d.ts +1 -1
- package/dist/agents/models.controller.js +2 -2
- package/dist/agents/templates.controller.d.ts +1 -1
- package/dist/agents/templates.controller.js +2 -2
- package/dist/agents/templates.d.ts +6 -8
- package/dist/agents/templates.js +39 -8
- package/dist/app.d.ts +93 -0
- package/dist/app.js +150 -0
- package/dist/catalog/admin-catalog.controller.d.ts +3 -3
- package/dist/catalog/admin-catalog.controller.js +27 -13
- package/dist/catalog/catalog-content.d.ts +185 -0
- package/dist/catalog/catalog-content.js +326 -0
- package/dist/catalog/catalog-items.d.ts +186 -0
- package/dist/catalog/catalog-items.js +410 -0
- package/dist/catalog/catalog.module.d.ts +14 -0
- package/dist/catalog/catalog.module.js +71 -0
- package/dist/catalog/catalog.service.d.ts +34 -188
- package/dist/catalog/catalog.service.js +155 -489
- package/dist/catalog/claude/agents.js +13 -10
- package/dist/catalog/cli.d.ts +3 -2
- package/dist/catalog/cli.js +13 -31
- package/dist/catalog/job-ids.d.ts +15 -0
- package/dist/catalog/job-ids.js +15 -0
- package/dist/catalog/jobs.d.ts +27 -0
- package/dist/catalog/jobs.js +70 -0
- package/dist/catalog/locks.d.ts +24 -0
- package/dist/catalog/locks.js +63 -0
- package/dist/catalog/marketplaces.controller.d.ts +4 -4
- package/dist/catalog/marketplaces.controller.js +22 -11
- package/dist/catalog/marketplaces.service.d.ts +31 -14
- package/dist/catalog/marketplaces.service.js +330 -256
- package/dist/catalog/org-catalog.controller.d.ts +4 -3
- package/dist/catalog/org-catalog.controller.js +29 -14
- package/dist/catalog/org-catalog.service.d.ts +32 -198
- package/dist/catalog/org-catalog.service.js +159 -400
- package/dist/catalog/plugin-import.d.ts +73 -34
- package/dist/catalog/plugin-import.js +356 -217
- package/dist/catalog/plugin-install.d.ts +83 -41
- package/dist/catalog/plugin-install.js +421 -269
- package/dist/catalog/plugin-upgrade.d.ts +59 -4
- package/dist/catalog/plugin-upgrade.js +407 -282
- package/dist/catalog/requests.service.d.ts +27 -15
- package/dist/catalog/requests.service.js +201 -145
- package/dist/catalog/upgrade-targets.d.ts +4 -7
- package/dist/channels/actions.d.ts +6 -4
- package/dist/channels/actions.js +1 -1
- package/dist/channels/cards.d.ts +10 -4
- package/dist/channels/cards.js +16 -8
- package/dist/channels/channels.module.d.ts +40 -0
- package/dist/channels/channels.module.js +128 -0
- package/dist/channels/connections.controller.d.ts +1 -1
- package/dist/channels/connections.controller.js +11 -6
- package/dist/channels/connections.service.d.ts +43 -21
- package/dist/channels/connections.service.js +236 -131
- package/dist/channels/inbound.d.ts +34 -38
- package/dist/channels/inbound.js +107 -41
- package/dist/channels/job-ids.d.ts +10 -0
- package/dist/channels/job-ids.js +10 -0
- package/dist/channels/jobs.d.ts +85 -0
- package/dist/channels/jobs.js +157 -0
- package/dist/channels/outbound.d.ts +60 -82
- package/dist/channels/outbound.js +165 -194
- package/dist/channels/supervisor.d.ts +88 -46
- package/dist/channels/supervisor.js +230 -132
- package/dist/channels/threads.d.ts +29 -8
- package/dist/channels/threads.js +71 -13
- package/dist/channels/webhook.d.ts +20 -14
- package/dist/channels/webhook.js +51 -20
- package/dist/config/load.d.ts +3 -2
- package/dist/config/load.js +3 -2
- package/dist/config/nacos-source.js +11 -2
- package/dist/config/schema.d.ts +1 -0
- package/dist/config/schema.js +12 -6
- package/dist/conversations/access.d.ts +29 -0
- package/dist/conversations/access.js +86 -0
- package/dist/conversations/artifacts.d.ts +11 -11
- package/dist/conversations/artifacts.js +36 -10
- package/dist/conversations/attachments.controller.d.ts +1 -1
- package/dist/conversations/attachments.controller.js +8 -6
- package/dist/conversations/attachments.module.d.ts +7 -0
- package/dist/conversations/attachments.module.js +25 -0
- package/dist/conversations/attachments.service.d.ts +30 -22
- package/dist/conversations/attachments.service.js +119 -46
- package/dist/conversations/conversations.controller.d.ts +8 -7
- package/dist/conversations/conversations.controller.js +59 -29
- package/dist/conversations/conversations.module.d.ts +8 -0
- package/dist/conversations/conversations.module.js +69 -0
- package/dist/conversations/conversations.service.d.ts +40 -38
- package/dist/conversations/conversations.service.js +130 -140
- package/dist/conversations/event-log.d.ts +39 -18
- package/dist/conversations/event-log.js +93 -27
- package/dist/conversations/events.d.ts +23 -3
- package/dist/conversations/events.js +26 -14
- package/dist/conversations/files.d.ts +10 -10
- package/dist/conversations/files.js +37 -11
- package/dist/conversations/idem-keys.d.ts +5 -0
- package/dist/conversations/idem-keys.js +5 -0
- package/dist/conversations/job-ids.d.ts +6 -0
- package/dist/conversations/job-ids.js +6 -0
- package/dist/conversations/outputs-read.d.ts +11 -11
- package/dist/conversations/outputs-read.js +31 -7
- package/dist/conversations/queue.d.ts +48 -56
- package/dist/conversations/queue.js +13 -289
- package/dist/conversations/queue.service.d.ts +60 -0
- package/dist/conversations/queue.service.js +343 -0
- package/dist/conversations/sandbox-status.d.ts +13 -10
- package/dist/conversations/sandbox-status.js +36 -8
- package/dist/conversations/titles.d.ts +71 -24
- package/dist/conversations/titles.js +159 -63
- package/dist/ctx/bus.js +9 -3
- package/dist/ctx/create-ctx.d.ts +6 -0
- package/dist/ctx/create-ctx.js +7 -9
- package/dist/ctx/lock.d.ts +7 -3
- package/dist/ctx/lock.js +9 -20
- package/dist/ctx/secrets.d.ts +10 -2
- package/dist/ctx/secrets.js +7 -3
- package/dist/db/kernel-schema.d.ts +4 -4
- package/dist/db/pool.d.ts +5 -0
- package/dist/db/pool.js +1 -0
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +1 -0
- package/dist/evals/budget.d.ts +42 -21
- package/dist/evals/budget.js +114 -62
- package/dist/evals/evals.module.d.ts +31 -0
- package/dist/evals/evals.module.js +114 -0
- package/dist/evals/jobs.d.ts +20 -0
- package/dist/evals/jobs.js +45 -0
- package/dist/evals/recorded-tools.d.ts +27 -1
- package/dist/evals/recorded-tools.js +85 -10
- package/dist/evals/run-replay.d.ts +61 -8
- package/dist/evals/run-replay.js +159 -85
- package/dist/evals/runs.controller.d.ts +1 -1
- package/dist/evals/runs.controller.js +17 -8
- package/dist/evals/runs.service.d.ts +23 -45
- package/dist/evals/runs.service.js +245 -234
- package/dist/evals/sets.controller.d.ts +1 -1
- package/dist/evals/sets.controller.js +17 -8
- package/dist/evals/sets.service.d.ts +22 -6
- package/dist/evals/sets.service.js +248 -194
- package/dist/evals/snapshot.d.ts +2 -2
- package/dist/evals/step-replay.d.ts +2 -2
- package/dist/evals/step-replay.js +1 -1
- package/dist/evals/trajectory.controller.d.ts +1 -1
- package/dist/evals/trajectory.controller.js +11 -7
- package/dist/evals/trajectory.d.ts +2 -2
- package/dist/evals/trajectory.service.d.ts +5 -4
- package/dist/evals/trajectory.service.js +30 -7
- package/dist/evals/worker.d.ts +44 -27
- package/dist/evals/worker.js +220 -121
- package/dist/extensions/admin-ops.d.ts +61 -33
- package/dist/extensions/admin-ops.js +248 -154
- package/dist/extensions/admin-view.d.ts +38 -27
- package/dist/extensions/admin-view.js +126 -55
- package/dist/extensions/approvals.d.ts +12 -8
- package/dist/extensions/approvals.js +73 -46
- package/dist/extensions/blobs.d.ts +27 -10
- package/dist/extensions/blobs.js +111 -45
- package/dist/extensions/bootstrap.d.ts +58 -31
- package/dist/extensions/bootstrap.js +175 -121
- package/dist/extensions/cli.d.ts +20 -10
- package/dist/extensions/cli.js +41 -96
- package/dist/extensions/config-issues.d.ts +7 -0
- package/dist/extensions/config-issues.js +31 -0
- package/dist/extensions/deployment-config-store.d.ts +49 -0
- package/dist/extensions/deployment-config-store.js +133 -0
- package/dist/extensions/deployment-config.d.ts +58 -67
- package/dist/extensions/deployment-config.js +202 -230
- package/dist/extensions/enabled.d.ts +5 -5
- package/dist/extensions/extensions.module.d.ts +8 -0
- package/dist/extensions/extensions.module.js +77 -0
- package/dist/extensions/hooks.d.ts +3 -2
- package/dist/extensions/hooks.js +1 -1
- package/dist/extensions/host.d.ts +72 -68
- package/dist/extensions/host.js +191 -152
- package/dist/extensions/installs.d.ts +49 -16
- package/dist/extensions/installs.js +128 -32
- package/dist/extensions/job-ids.d.ts +6 -0
- package/dist/extensions/job-ids.js +6 -0
- package/dist/extensions/lifecycle-topics.d.ts +18 -0
- package/dist/extensions/lifecycle-topics.js +18 -0
- package/dist/extensions/lifecycle.d.ts +35 -47
- package/dist/extensions/lifecycle.js +103 -39
- package/dist/extensions/locks.d.ts +33 -0
- package/dist/extensions/locks.js +86 -0
- package/dist/extensions/migrate-lock.d.ts +3 -4
- package/dist/extensions/org-config.controller.d.ts +1 -1
- package/dist/extensions/org-config.controller.js +8 -5
- package/dist/extensions/org-config.d.ts +48 -46
- package/dist/extensions/org-config.js +284 -226
- package/dist/extensions/registry.d.ts +50 -2
- package/dist/extensions/registry.js +89 -4
- package/dist/extensions/sources.d.ts +12 -8
- package/dist/extensions/sources.js +34 -13
- package/dist/files/files.module.d.ts +3 -0
- package/dist/files/files.module.js +22 -0
- package/dist/files/previewers.controller.d.ts +7 -2
- package/dist/files/previewers.controller.js +17 -9
- package/dist/files/previewers.d.ts +13 -18
- package/dist/files/previewers.js +83 -36
- 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 +47 -355
- package/dist/http/app.d.ts +11 -15
- package/dist/http/app.js +17 -62
- package/dist/http/error-filter.module.d.ts +5 -0
- package/dist/http/error-filter.module.js +18 -0
- package/dist/http/error.filter.js +2 -2
- package/dist/identity/accounts.d.ts +82 -29
- package/dist/identity/accounts.js +294 -175
- package/dist/identity/api-tokens.d.ts +11 -7
- package/dist/identity/api-tokens.js +71 -44
- package/dist/identity/audit.d.ts +7 -4
- package/dist/identity/audit.js +5 -1
- package/dist/identity/auth.controller.d.ts +11 -10
- package/dist/identity/auth.controller.js +31 -25
- package/dist/identity/auth.guard.d.ts +3 -3
- package/dist/identity/auth.guard.js +6 -4
- package/dist/identity/binding.d.ts +9 -11
- package/dist/identity/binding.js +41 -13
- package/dist/identity/enterprise-admin.d.ts +18 -12
- package/dist/identity/enterprise-admin.js +67 -13
- 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 +19 -15
- package/dist/identity/external.js +163 -125
- package/dist/identity/identity.module.d.ts +6 -0
- package/dist/identity/identity.module.js +56 -0
- package/dist/identity/me.controller.d.ts +16 -15
- package/dist/identity/me.controller.js +37 -31
- package/dist/identity/sessions.d.ts +12 -10
- package/dist/identity/sessions.js +74 -42
- package/dist/identity/settings.d.ts +20 -14
- package/dist/identity/settings.js +86 -58
- package/dist/identity/sso.controller.d.ts +7 -7
- package/dist/identity/sso.controller.js +13 -9
- package/dist/identity/sso.d.ts +9 -12
- package/dist/identity/sso.js +54 -24
- package/dist/inbox/inbox.module.d.ts +3 -0
- package/dist/inbox/inbox.module.js +22 -0
- package/dist/inbox/inbox.service.d.ts +7 -9
- package/dist/inbox/inbox.service.js +32 -11
- package/dist/index.d.ts +16 -11
- package/dist/index.js +9 -6
- 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 +165 -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 +25 -0
- package/dist/infra/config/kernel-config.service.js +126 -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 +90 -0
- package/dist/infra/database/kernel-db.d.ts +22 -0
- package/dist/infra/database/kernel-db.js +65 -0
- package/dist/infra/database/transaction-host.d.ts +50 -0
- package/dist/infra/database/transaction-host.js +125 -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 +17 -0
- package/dist/infra/database/xact-lock.js +43 -0
- package/dist/infra/events/kernel-events.d.ts +96 -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 +104 -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/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 +52 -0
- package/dist/infra/lifecycle/process-guards.js +86 -0
- package/dist/infra/lifecycle/shutdown-signals.d.ts +30 -0
- package/dist/infra/lifecycle/shutdown-signals.js +48 -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 +120 -0
- package/dist/infra/lock/lock.service.js +343 -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 +16 -0
- package/dist/infra/logging/logging.module.js +34 -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-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 +7 -0
- package/dist/infra/queue/redis-connection.js +18 -0
- package/dist/infra/queue/retired-schedulers.d.ts +7 -0
- package/dist/infra/queue/retired-schedulers.js +9 -0
- package/dist/infra/queue/run-job.d.ts +16 -0
- package/dist/infra/queue/run-job.js +19 -0
- package/dist/infra/redis/redis.module.d.ts +24 -0
- package/dist/infra/redis/redis.module.js +87 -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 +137 -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 +163 -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 +35 -0
- package/dist/infra/throttler/credential-throttler.js +77 -0
- package/dist/infra/throttler/named-throttlers.d.ts +31 -0
- package/dist/infra/throttler/named-throttlers.js +119 -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 +23 -0
- package/dist/infra/throttler/throttler.guard.js +68 -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 +15 -0
- package/dist/infra/tokens.js +15 -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 +136 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +140 -0
- package/dist/lifecycle/kernel-lifecycle.js +456 -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/models/models.module.d.ts +3 -0
- package/dist/models/models.module.js +24 -0
- package/dist/models/prices.d.ts +8 -2
- package/dist/models/prices.js +65 -37
- package/dist/models/purposes.controller.d.ts +1 -1
- package/dist/models/purposes.controller.js +5 -6
- package/dist/models/purposes.d.ts +35 -13
- package/dist/models/purposes.js +101 -51
- 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 +61 -31
- package/dist/orgs/directory-sync.js +212 -125
- package/dist/orgs/invitations.controller.d.ts +8 -8
- package/dist/orgs/invitations.controller.js +27 -26
- package/dist/orgs/invitations.service.d.ts +12 -9
- package/dist/orgs/invitations.service.js +130 -92
- package/dist/orgs/job-ids.d.ts +8 -0
- package/dist/orgs/job-ids.js +8 -0
- package/dist/orgs/members.service.d.ts +19 -12
- package/dist/orgs/members.service.js +161 -117
- package/dist/orgs/offboarding.d.ts +54 -57
- package/dist/orgs/offboarding.js +161 -71
- package/dist/orgs/org-lock.d.ts +28 -19
- package/dist/orgs/org-lock.js +81 -35
- package/dist/orgs/org.guard.d.ts +1 -1
- package/dist/orgs/org.guard.js +2 -2
- package/dist/orgs/orgs.controller.d.ts +13 -13
- package/dist/orgs/orgs.controller.js +29 -17
- package/dist/orgs/orgs.module.d.ts +6 -0
- package/dist/orgs/orgs.module.js +68 -0
- package/dist/orgs/orgs.service.d.ts +30 -19
- package/dist/orgs/orgs.service.js +139 -86
- package/dist/orgs/settings.controller.d.ts +1 -1
- package/dist/orgs/settings.controller.js +8 -6
- package/dist/orgs/settings.service.d.ts +16 -10
- package/dist/orgs/settings.service.js +77 -48
- package/dist/overrides.d.ts +56 -0
- package/dist/overrides.js +30 -0
- package/dist/roles/gateway-role.d.ts +43 -0
- package/dist/roles/gateway-role.js +98 -0
- package/dist/roles/gateway.module.d.ts +8 -0
- package/dist/roles/gateway.module.js +28 -0
- package/dist/roles/worker-role.d.ts +63 -0
- package/dist/roles/worker-role.js +144 -0
- package/dist/roles/worker.module.d.ts +14 -0
- package/dist/roles/worker.module.js +90 -0
- package/dist/runtime/abort.js +19 -2
- package/dist/runtime/checkpointer.d.ts +8 -3
- package/dist/runtime/checkpointer.js +87 -55
- package/dist/runtime/context/build.d.ts +6 -6
- package/dist/runtime/context/build.js +18 -8
- package/dist/runtime/context/claude-tools.d.ts +2 -1
- package/dist/runtime/context/claude-tools.js +9 -10
- package/dist/runtime/context/legacy-text.d.ts +22 -0
- package/dist/runtime/context/legacy-text.js +37 -0
- package/dist/runtime/context/skills.d.ts +29 -11
- package/dist/runtime/context/skills.js +37 -30
- package/dist/runtime/conversation-lock.d.ts +20 -11
- package/dist/runtime/conversation-lock.js +62 -72
- package/dist/runtime/hook-calls.d.ts +3 -3
- package/dist/runtime/hook-calls.js +1 -6
- package/dist/runtime/job-ids.d.ts +10 -0
- package/dist/runtime/job-ids.js +10 -0
- package/dist/runtime/langgraph-loop.js +1 -1
- package/dist/runtime/loop.d.ts +8 -1
- package/dist/runtime/loop.js +14 -0
- package/dist/runtime/maintenance-queue.d.ts +10 -0
- package/dist/runtime/maintenance-queue.js +10 -0
- package/dist/runtime/maintenance.d.ts +45 -74
- package/dist/runtime/maintenance.js +139 -137
- package/dist/runtime/model-call.d.ts +7 -4
- package/dist/runtime/model-call.js +25 -58
- package/dist/runtime/providers.d.ts +17 -6
- package/dist/runtime/providers.js +66 -25
- package/dist/runtime/quota.d.ts +17 -3
- package/dist/runtime/quota.js +27 -2
- package/dist/runtime/retired-schedulers.d.ts +7 -0
- package/dist/runtime/retired-schedulers.js +31 -0
- package/dist/runtime/run-control.d.ts +33 -0
- package/dist/runtime/run-control.js +77 -0
- package/dist/runtime/run-finish.d.ts +27 -18
- package/dist/runtime/run-finish.js +98 -51
- package/dist/runtime/run-jobs.d.ts +48 -0
- package/dist/runtime/run-jobs.js +95 -0
- package/dist/runtime/run-processors.d.ts +60 -0
- package/dist/runtime/run-processors.js +185 -0
- package/dist/runtime/run-queue.d.ts +32 -57
- package/dist/runtime/run-queue.js +291 -295
- package/dist/runtime/run-steps.d.ts +39 -0
- package/dist/runtime/run-steps.js +96 -0
- package/dist/runtime/run-worker.d.ts +122 -76
- package/dist/runtime/run-worker.js +343 -229
- package/dist/runtime/runtime.module.d.ts +10 -0
- package/dist/runtime/runtime.module.js +112 -0
- package/dist/runtime/step-log.d.ts +40 -0
- package/dist/runtime/step-log.js +94 -0
- package/dist/runtime/stream.controller.d.ts +5 -8
- package/dist/runtime/stream.controller.js +14 -12
- package/dist/runtime/stream.d.ts +24 -6
- package/dist/runtime/stream.js +78 -7
- package/dist/runtime/subagents/child.d.ts +3 -44
- package/dist/runtime/subagents/child.js +0 -79
- package/dist/runtime/subagents/definition.d.ts +5 -10
- package/dist/runtime/subagents/definition.js +13 -14
- package/dist/runtime/subagents/dispatch.d.ts +89 -8
- package/dist/runtime/subagents/dispatch.js +137 -142
- package/dist/runtime/subagents/limits.d.ts +9 -4
- package/dist/runtime/subagents/limits.js +4 -2
- package/dist/runtime/subagents/org-agents.d.ts +4 -4
- package/dist/runtime/subagents/org-agents.js +3 -2
- package/dist/runtime/subagents/progress.d.ts +2 -2
- package/dist/runtime/subagents/roster.d.ts +4 -4
- package/dist/runtime/subagents/roster.js +2 -2
- package/dist/runtime/subagents/skill-fork.d.ts +8 -9
- package/dist/runtime/subagents/skill-fork.js +17 -6
- package/dist/runtime/subagents/subagents.service.d.ts +40 -0
- package/dist/runtime/subagents/subagents.service.js +101 -0
- package/dist/runtime/usage-report.d.ts +94 -52
- package/dist/runtime/usage-report.js +200 -100
- package/dist/runtime/waits.d.ts +127 -59
- package/dist/runtime/waits.js +433 -210
- package/dist/sandbox/job-ids.d.ts +10 -0
- package/dist/sandbox/job-ids.js +10 -0
- package/dist/sandbox/jobs.d.ts +41 -0
- package/dist/sandbox/jobs.js +113 -0
- package/dist/sandbox/leases.d.ts +39 -31
- package/dist/sandbox/leases.js +117 -257
- package/dist/sandbox/providers.d.ts +19 -0
- package/dist/sandbox/providers.js +38 -0
- package/dist/sandbox/sandbox.module.d.ts +8 -0
- package/dist/sandbox/sandbox.module.js +30 -0
- package/dist/sandbox/sandbox.service.d.ts +24 -29
- package/dist/sandbox/sandbox.service.js +106 -75
- package/dist/skills/catalog.d.ts +37 -24
- package/dist/skills/catalog.js +100 -57
- package/dist/skills/changes.controller.d.ts +4 -4
- package/dist/skills/changes.controller.js +15 -9
- package/dist/skills/changes.service.d.ts +30 -20
- package/dist/skills/changes.service.js +425 -367
- package/dist/skills/invocable.controller.d.ts +1 -1
- package/dist/skills/invocable.controller.js +8 -5
- package/dist/skills/invocation-keys.d.ts +1 -1
- package/dist/skills/invocation-keys.js +1 -1
- package/dist/skills/invoke.d.ts +17 -16
- package/dist/skills/invoke.js +53 -21
- package/dist/skills/skills.controller.d.ts +1 -1
- package/dist/skills/skills.controller.js +11 -6
- package/dist/skills/skills.module.d.ts +6 -0
- package/dist/skills/skills.module.js +30 -0
- package/dist/skills/skills.service.d.ts +47 -30
- package/dist/skills/skills.service.js +221 -158
- package/dist/storage/job-ids.d.ts +6 -0
- package/dist/storage/job-ids.js +6 -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 +18 -4
- package/dist/storage/storage.service.js +44 -3
- package/dist/tools/approvals.controller.d.ts +1 -1
- package/dist/tools/approvals.controller.js +12 -8
- package/dist/tools/approvals.service.d.ts +33 -25
- package/dist/tools/approvals.service.js +343 -259
- package/dist/tools/breaker.d.ts +2 -2
- package/dist/tools/breaker.js +21 -3
- package/dist/tools/builtin-names.d.ts +73 -0
- package/dist/tools/builtin-names.js +116 -0
- package/dist/tools/builtins/agent.d.ts +7 -7
- package/dist/tools/builtins/agent.js +7 -11
- package/dist/tools/builtins/ask-user.d.ts +3 -3
- package/dist/tools/builtins/ask-user.js +3 -3
- package/dist/tools/builtins/builtin-tools.d.ts +21 -0
- package/dist/tools/builtins/builtin-tools.js +80 -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 +5 -5
- package/dist/tools/builtins/sandbox/bash.js +33 -30
- package/dist/tools/builtins/sandbox/common.d.ts +5 -4
- package/dist/tools/builtins/sandbox/common.js +2 -2
- package/dist/tools/builtins/sandbox/deliver.d.ts +1 -1
- package/dist/tools/builtins/sandbox/deliver.js +13 -13
- package/dist/tools/builtins/sandbox/edit.d.ts +1 -1
- package/dist/tools/builtins/sandbox/edit.js +42 -31
- package/dist/tools/builtins/sandbox/file-state.d.ts +34 -0
- package/dist/tools/builtins/sandbox/file-state.js +34 -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 +6 -6
- package/dist/tools/builtins/sandbox/grep.d.ts +7 -4
- package/dist/tools/builtins/sandbox/grep.js +149 -32
- package/dist/tools/builtins/sandbox/index.d.ts +1 -1
- package/dist/tools/builtins/sandbox/index.js +1 -1
- package/dist/tools/builtins/sandbox/read.d.ts +2 -2
- package/dist/tools/builtins/sandbox/read.js +22 -15
- package/dist/tools/builtins/sandbox/write.d.ts +1 -1
- package/dist/tools/builtins/sandbox/write.js +38 -34
- package/dist/tools/builtins/skill-load.d.ts +6 -6
- package/dist/tools/builtins/skill-load.js +33 -17
- package/dist/tools/builtins/skill-write.d.ts +4 -4
- package/dist/tools/builtins/skill-write.js +10 -10
- package/dist/tools/builtins/tool-search.d.ts +13 -9
- package/dist/tools/builtins/tool-search.js +25 -14
- package/dist/tools/canonical-json.d.ts +6 -0
- package/dist/tools/canonical-json.js +16 -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 +53 -18
- package/dist/tools/connectors.controller.d.ts +1 -1
- package/dist/tools/connectors.controller.js +21 -10
- package/dist/tools/connectors.service.d.ts +31 -13
- package/dist/tools/connectors.service.js +438 -348
- package/dist/tools/credentials.d.ts +17 -20
- package/dist/tools/credentials.js +55 -34
- package/dist/tools/display-names.d.ts +9 -0
- package/dist/tools/display-names.js +24 -0
- package/dist/tools/drift.d.ts +29 -41
- package/dist/tools/drift.js +116 -84
- package/dist/tools/elicitation.js +1 -1
- package/dist/tools/info.d.ts +32 -13
- package/dist/tools/info.js +88 -39
- package/dist/tools/job-ids.d.ts +13 -0
- package/dist/tools/job-ids.js +15 -0
- package/dist/tools/jobs.d.ts +24 -0
- package/dist/tools/jobs.js +69 -0
- package/dist/tools/legacy-data.d.ts +34 -0
- package/dist/tools/legacy-data.js +76 -0
- package/dist/tools/legacy-keys.d.ts +51 -0
- package/dist/tools/legacy-keys.js +115 -0
- package/dist/tools/naming.d.ts +1 -5
- package/dist/tools/naming.js +1 -7
- 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 +109 -81
- package/dist/tools/oauth/oauth.controller.d.ts +3 -3
- package/dist/tools/oauth/oauth.controller.js +12 -9
- package/dist/tools/oauth/tokens.d.ts +11 -3
- package/dist/tools/oauth/tokens.js +15 -14
- package/dist/tools/outputs.d.ts +13 -4
- package/dist/tools/outputs.js +48 -4
- package/dist/tools/pipeline.d.ts +72 -50
- package/dist/tools/pipeline.js +239 -100
- package/dist/tools/policy.d.ts +3 -16
- package/dist/tools/policy.js +13 -19
- package/dist/tools/questions.controller.d.ts +2 -2
- package/dist/tools/questions.controller.js +9 -6
- package/dist/tools/questions.service.d.ts +26 -25
- package/dist/tools/questions.service.js +201 -142
- package/dist/tools/registry.d.ts +43 -38
- package/dist/tools/registry.js +100 -72
- package/dist/tools/resources.d.ts +1 -1
- package/dist/tools/resources.js +1 -1
- package/dist/tools/specs.d.ts +5 -4
- package/dist/tools/specs.js +3 -1
- package/dist/tools/tools.module.d.ts +10 -0
- package/dist/tools/tools.module.js +91 -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 +9 -5
- package/dist/ui/embed-token.js +34 -6
- package/dist/ui/ui-stream.d.ts +22 -17
- package/dist/ui/ui-stream.js +72 -12
- package/dist/ui/ui.module.d.ts +7 -0
- package/dist/ui/ui.module.js +28 -0
- package/dist/ui/views.controller.d.ts +14 -12
- package/dist/ui/views.controller.js +32 -25
- package/dist/ui/views.d.ts +9 -57
- package/dist/ui/views.js +43 -45
- package/package.json +10 -3
- package/src/migrations/0063_tool_keys_claude_code.sql +220 -0
- 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/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/http/{gateway.module.d.ts → gateway-routes.d.ts} +0 -0
- /package/dist/http/{gateway.module.js → gateway-routes.js} +0 -0
|
@@ -1,16 +1,36 @@
|
|
|
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
|
+
};
|
|
1
10
|
import { randomUUID } from "node:crypto";
|
|
2
11
|
import { EXTENSION_POINTS, parseExtensionPoint, parseSkillMd, SKILL_ENTRY_FILE, } from "@capybara-hq/plugin-sdk";
|
|
12
|
+
import { Inject, Injectable } from "@nestjs/common";
|
|
3
13
|
import { sql } from "kysely";
|
|
4
14
|
import { normalizeToolRef } from "../agents/definition.js";
|
|
5
15
|
import { putTemplateVersionIn, revertTemplateVersionIn, softDeleteTemplateIn, } from "../agents/templates.js";
|
|
6
16
|
import { ApiError } from "../errors.js";
|
|
7
17
|
import { isExtensionEnabled } from "../extensions/enabled.js";
|
|
18
|
+
import { OrgExtensionConfigs, } from "../extensions/org-config.js";
|
|
19
|
+
import { ExtensionRegistry } from "../extensions/registry.js";
|
|
8
20
|
import { audit } from "../identity/audit.js";
|
|
9
|
-
import {
|
|
21
|
+
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
22
|
+
import { afterCommit } from "../infra/database/after-commit.js";
|
|
23
|
+
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
24
|
+
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
25
|
+
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
26
|
+
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
27
|
+
import { OrgLock } from "../orgs/org-lock.js";
|
|
10
28
|
import { packagePath } from "../packages/tgz.js";
|
|
11
|
-
import { skillConflictError, skillConflicts, } from "../skills/skills.service.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
29
|
+
import { SkillsService, skillConflictError, skillConflicts, } from "../skills/skills.service.js";
|
|
30
|
+
import { StorageService } from "../storage/storage.service.js";
|
|
31
|
+
import { ConnectorsService } from "../tools/connectors.service.js";
|
|
32
|
+
import { findConnectorIn, lockOrgForActions, readCatalogAgentTemplates, readCatalogFiles, readCatalogTemplates, requiredActions, skillOf, templateConnectorInput, templatePluginProblem, } from "./catalog-content.js";
|
|
33
|
+
import { assertItemInstallable, CatalogRequestsService, disabledPluginItems, pluginItemDisabled, } from "./requests.service.js";
|
|
14
34
|
import { upgradeInfo } from "./upgrade-targets.js";
|
|
15
35
|
import { maxSatisfying, satisfiesRange } from "./versions.js";
|
|
16
36
|
/** How deep plugin dependencies may nest (the root plugin's dependencies are level 1). */
|
|
@@ -183,14 +203,44 @@ export function under(e, at) {
|
|
|
183
203
|
* (plugin-upgrade.ts), which reuses the planning, install and ledger methods here (the ones without
|
|
184
204
|
* `private` are internal to the catalog, not an API).
|
|
185
205
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
206
|
+
let PluginInstaller = class PluginInstaller {
|
|
207
|
+
kdb;
|
|
208
|
+
orgLock;
|
|
209
|
+
storage;
|
|
210
|
+
registry;
|
|
211
|
+
skills;
|
|
212
|
+
orgConfigs;
|
|
213
|
+
requests;
|
|
214
|
+
config;
|
|
215
|
+
connectors;
|
|
216
|
+
log;
|
|
217
|
+
txHost;
|
|
218
|
+
constructor(kdb,
|
|
219
|
+
/** The org row lock (orgs/org-lock.ts): joins the caller's transaction. */
|
|
220
|
+
orgLock, storage,
|
|
221
|
+
/** The loaded extensions and connectors of this replica (the extension registry). */
|
|
222
|
+
registry, skills, orgConfigs, requests, config,
|
|
223
|
+
/** Org connectors: installs create, upgrade and remove them. */
|
|
224
|
+
connectors, log, txHost) {
|
|
225
|
+
this.kdb = kdb;
|
|
226
|
+
this.orgLock = orgLock;
|
|
227
|
+
this.storage = storage;
|
|
228
|
+
this.registry = registry;
|
|
229
|
+
this.skills = skills;
|
|
230
|
+
this.orgConfigs = orgConfigs;
|
|
231
|
+
this.requests = requests;
|
|
232
|
+
this.config = config;
|
|
233
|
+
this.connectors = connectors;
|
|
234
|
+
this.log = log;
|
|
235
|
+
this.txHost = txHost;
|
|
190
236
|
}
|
|
191
|
-
/** The
|
|
192
|
-
get
|
|
193
|
-
return this.
|
|
237
|
+
/** The kernel-schema handle of the current context (the transaction, else the pool). */
|
|
238
|
+
get db() {
|
|
239
|
+
return this.kdb.db;
|
|
240
|
+
}
|
|
241
|
+
/** `catalog.staleInstallMinutes`: an install `installing` for longer can be cleaned up by uninstalling it. */
|
|
242
|
+
staleInstallMinutes() {
|
|
243
|
+
return this.config.get().catalog.staleInstallMinutes;
|
|
194
244
|
}
|
|
195
245
|
/**
|
|
196
246
|
* The checks an install runs before it creates anything, without the org's input (for the org
|
|
@@ -243,14 +293,17 @@ export class PluginInstaller {
|
|
|
243
293
|
* and a name two plugins of the same plan both bring (the one installed first is the source).
|
|
244
294
|
*/
|
|
245
295
|
async assertNoSkillConflicts(orgId, plan) {
|
|
246
|
-
const conflicts = await planSkillConflicts(this.
|
|
296
|
+
const conflicts = await planSkillConflicts(this.db, orgId, plan);
|
|
247
297
|
if (conflicts.length > 0)
|
|
248
298
|
throw skillConflictError(conflicts);
|
|
249
299
|
}
|
|
250
300
|
/** The connector checks of templates against what this replica loads right now. */
|
|
251
301
|
templateDeps() {
|
|
252
|
-
const versions = new Map(this.
|
|
253
|
-
return {
|
|
302
|
+
const versions = new Map(this.registry.manifests().map((m) => [m.name, m.version]));
|
|
303
|
+
return {
|
|
304
|
+
findConnector: (plugin, kind) => findConnectorIn(this.registry, plugin, kind),
|
|
305
|
+
pluginVersion: (n) => versions.get(n),
|
|
306
|
+
};
|
|
254
307
|
}
|
|
255
308
|
/**
|
|
256
309
|
* Plans the install of one plugin version and, depth first, of its dependencies not yet
|
|
@@ -261,7 +314,7 @@ export class PluginInstaller {
|
|
|
261
314
|
async plan(orgId, actor, itemId, version, input, at, approvedBy) {
|
|
262
315
|
if (!UUID_RE.test(itemId))
|
|
263
316
|
throw new ApiError("catalog.item_not_found", "Plugin not found");
|
|
264
|
-
const v = await this.
|
|
317
|
+
const v = await this.db
|
|
265
318
|
.selectFrom("catalog_item_versions as v")
|
|
266
319
|
.innerJoin("catalog_items as i", "i.id", "v.item_id")
|
|
267
320
|
.select([
|
|
@@ -279,11 +332,11 @@ export class PluginInstaller {
|
|
|
279
332
|
if (!v)
|
|
280
333
|
throw new ApiError("catalog.item_not_found", "Plugin version not found");
|
|
281
334
|
const manifest = v.manifest;
|
|
282
|
-
const deps = await resolveDependencies(this.
|
|
335
|
+
const deps = await resolveDependencies(this.db, manifest);
|
|
283
336
|
const extension = await this.planExtension(orgId, manifest);
|
|
284
|
-
const templates = await readCatalogTemplates(this.
|
|
285
|
-
const skillNames = await catalogSkillNames(this.
|
|
286
|
-
const agentTemplates = await readCatalogAgentTemplates(this.
|
|
337
|
+
const templates = await readCatalogTemplates(this.storage, v);
|
|
338
|
+
const skillNames = await catalogSkillNames(this.storage, v, manifest);
|
|
339
|
+
const agentTemplates = await readCatalogAgentTemplates(this.storage, v);
|
|
287
340
|
const connectors = new Map();
|
|
288
341
|
if (input === null) {
|
|
289
342
|
for (const ct of templates) {
|
|
@@ -300,7 +353,7 @@ export class PluginInstaller {
|
|
|
300
353
|
}
|
|
301
354
|
const dependencies = [];
|
|
302
355
|
for (const dep of deps) {
|
|
303
|
-
if (await this.liveDependency(this.
|
|
356
|
+
if (await this.liveDependency(this.db, orgId, dep)) {
|
|
304
357
|
dependencies.push({ dep, plan: null });
|
|
305
358
|
continue;
|
|
306
359
|
}
|
|
@@ -355,7 +408,7 @@ export class PluginInstaller {
|
|
|
355
408
|
: `This connector template needs ${needs}`);
|
|
356
409
|
}
|
|
357
410
|
try {
|
|
358
|
-
this.
|
|
411
|
+
this.connectors.checkCreateInput(actor, ci);
|
|
359
412
|
}
|
|
360
413
|
catch (e) {
|
|
361
414
|
throw under(e, path);
|
|
@@ -397,30 +450,30 @@ export class PluginInstaller {
|
|
|
397
450
|
* cannot leave the component pointing at a removed install. `created` false: the org's existing
|
|
398
451
|
* install, if any (returns its id, undefined when there is none); it must be `installed`
|
|
399
452
|
* (`installing` -> 409 `plugin.install_in_progress`, retry later) and in range. `created` true:
|
|
400
|
-
* `child`, the dependency install this install just created, must still exist.
|
|
453
|
+
* `child`, the dependency install this install just created, must still exist. A step of an
|
|
454
|
+
* install or upgrade: it commits on its own (`requires_new`), the undo on failure relies on it.
|
|
401
455
|
*/
|
|
402
456
|
async recordDependency(orgId, dep, record, child) {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
}
|
|
410
|
-
await record({ kind: "plugin", ref: child, created: true, skillVersion: null }, t);
|
|
411
|
-
return child;
|
|
412
|
-
}
|
|
413
|
-
if (!live)
|
|
414
|
-
return undefined;
|
|
415
|
-
if (!satisfiesRange(live.version, dep.range)) {
|
|
416
|
-
throw unresolved(dep.name, dep.range, `this organization has version ${live.version} installed; uninstall it to install a matching version`);
|
|
417
|
-
}
|
|
418
|
-
if (live.status !== "installed") {
|
|
419
|
-
throw new ApiError("plugin.install_in_progress", `Dependency ${dep.name} is being installed by another install in this organization; try again when it finishes. An install stuck for longer than catalog.staleInstallMinutes can be removed by uninstalling it`);
|
|
457
|
+
const t = this.db;
|
|
458
|
+
await this.orgLock.lock(orgId);
|
|
459
|
+
const live = await this.findLiveDependency(t, orgId, dep, true);
|
|
460
|
+
if (child !== undefined) {
|
|
461
|
+
if (live?.id !== child || live.status !== "installed") {
|
|
462
|
+
throw unresolved(dep.name, dep.range, "its install in this organization was removed meanwhile; try again");
|
|
420
463
|
}
|
|
421
|
-
await record({ kind: "plugin", ref:
|
|
422
|
-
return
|
|
423
|
-
}
|
|
464
|
+
await record({ kind: "plugin", ref: child, created: true, skillVersion: null });
|
|
465
|
+
return child;
|
|
466
|
+
}
|
|
467
|
+
if (!live)
|
|
468
|
+
return undefined;
|
|
469
|
+
if (!satisfiesRange(live.version, dep.range)) {
|
|
470
|
+
throw unresolved(dep.name, dep.range, `this organization has version ${live.version} installed; uninstall it to install a matching version`);
|
|
471
|
+
}
|
|
472
|
+
if (live.status !== "installed") {
|
|
473
|
+
throw new ApiError("plugin.install_in_progress", `Dependency ${dep.name} is being installed by another install in this organization; try again when it finishes. An install stuck for longer than catalog.staleInstallMinutes can be removed by uninstalling it`);
|
|
474
|
+
}
|
|
475
|
+
await record({ kind: "plugin", ref: live.id, created: false, skillVersion: null });
|
|
476
|
+
return live.id;
|
|
424
477
|
}
|
|
425
478
|
/**
|
|
426
479
|
* Runs a plan: the install row, then the steps (see the class comment). Throws
|
|
@@ -432,59 +485,15 @@ export class PluginInstaller {
|
|
|
432
485
|
// The install row (role and item policy re-checked under the lock; one live install per org
|
|
433
486
|
// and item)
|
|
434
487
|
const installId = randomUUID();
|
|
435
|
-
await this.
|
|
436
|
-
await lockOrgForActions(t, orgId, actor, ctx.actions);
|
|
437
|
-
if (ctx.approvedBy !== undefined) {
|
|
438
|
-
// A dependency disabled (or removed) since it was planned
|
|
439
|
-
const own = await t
|
|
440
|
-
.selectFrom("catalog_items")
|
|
441
|
-
.select(["policy", "deleted_at"])
|
|
442
|
-
.where("id", "=", itemId)
|
|
443
|
-
.forShare()
|
|
444
|
-
.executeTakeFirst();
|
|
445
|
-
if (!own || own.deleted_at !== null) {
|
|
446
|
-
throw unresolved(plan.name, plan.version, "it was removed from the enterprise catalog");
|
|
447
|
-
}
|
|
448
|
-
if (own.policy === "disabled")
|
|
449
|
-
throw dependencyDisabled(plan.name);
|
|
450
|
-
}
|
|
451
|
-
await assertItemInstallable(t, orgId, itemId, ctx.approvedBy ?? itemId);
|
|
452
|
-
const live = await t
|
|
453
|
-
.selectFrom("plugin_installs")
|
|
454
|
-
.select("id")
|
|
455
|
-
.where("org_id", "=", orgId)
|
|
456
|
-
.where("item_id", "=", itemId)
|
|
457
|
-
.where("status", "<>", "failed")
|
|
458
|
-
.executeTakeFirst();
|
|
459
|
-
if (live)
|
|
460
|
-
throw alreadyInstalled();
|
|
461
|
-
try {
|
|
462
|
-
await t
|
|
463
|
-
.insertInto("plugin_installs")
|
|
464
|
-
.values({
|
|
465
|
-
id: installId,
|
|
466
|
-
org_id: orgId,
|
|
467
|
-
item_id: itemId,
|
|
468
|
-
version,
|
|
469
|
-
status: "installing",
|
|
470
|
-
installed_by: actor,
|
|
471
|
-
})
|
|
472
|
-
.execute();
|
|
473
|
-
}
|
|
474
|
-
catch (e) {
|
|
475
|
-
if (isUniqueViolation(e))
|
|
476
|
-
throw alreadyInstalled();
|
|
477
|
-
throw e;
|
|
478
|
-
}
|
|
479
|
-
});
|
|
488
|
+
await this.createInstallRow(orgId, actor, plan, ctx, installId);
|
|
480
489
|
const done = [];
|
|
481
|
-
// Records a component in the
|
|
482
|
-
// fails, the install aborts and rolls back)
|
|
483
|
-
const record = async (c
|
|
490
|
+
// Records a component in the transaction of the context (none: on its own; the install row
|
|
491
|
+
// already cleaned up -> the FK fails, the install aborts and rolls back)
|
|
492
|
+
const record = async (c) => {
|
|
484
493
|
// Into `done` first: a component that exists is rolled back even when recording it fails
|
|
485
494
|
// (enabling an extension and recording it share one transaction and fail together)
|
|
486
495
|
done.push(c);
|
|
487
|
-
await
|
|
496
|
+
await this.db
|
|
488
497
|
.insertInto("plugin_install_components")
|
|
489
498
|
.values({
|
|
490
499
|
install_id: installId,
|
|
@@ -532,25 +541,17 @@ export class PluginInstaller {
|
|
|
532
541
|
}
|
|
533
542
|
step = "extension";
|
|
534
543
|
if (plan.extension !== null) {
|
|
535
|
-
|
|
536
|
-
// "Enabled before" is decided under the org row lock (already enabled: put writes nothing,
|
|
537
|
-
// the config is untouched); the component is recorded in the same transaction
|
|
538
|
-
await this.d.orgConfigs.put(orgId, p, {
|
|
544
|
+
await this.enableExtension(orgId, plan.extension, {
|
|
539
545
|
enabled: true,
|
|
540
546
|
...(plan.extensionConfig !== undefined && { config: plan.extensionConfig }),
|
|
541
|
-
}, actor, opts.actorTokenId, {
|
|
542
|
-
viaItem: itemId,
|
|
543
|
-
...(nested && { approvedBy }),
|
|
544
|
-
ifDisabled: { skipped: false },
|
|
545
|
-
inTransaction: (t, skipped) => record({ kind: "extension", ref: p, created: !skipped, skillVersion: null }, t),
|
|
546
|
-
});
|
|
547
|
+
}, actor, opts.actorTokenId, { viaItem: itemId, ...(nested && { approvedBy }) }, record);
|
|
547
548
|
}
|
|
548
549
|
step = "connectors";
|
|
549
550
|
for (const ct of plan.templates) {
|
|
550
551
|
const ci = plan.connectors.get(ct.id);
|
|
551
552
|
if (!ci)
|
|
552
553
|
throw new ApiError("internal", `Connector template ${ct.id} was not planned`);
|
|
553
|
-
const r = await this.
|
|
554
|
+
const r = await this.connectors.create(orgId, actor, ci, opts.actorTokenId);
|
|
554
555
|
await record({
|
|
555
556
|
kind: "connector",
|
|
556
557
|
ref: r.connector.id,
|
|
@@ -561,29 +562,12 @@ export class PluginInstaller {
|
|
|
561
562
|
}
|
|
562
563
|
step = "agent_templates";
|
|
563
564
|
for (const a of plan.agentTemplates) {
|
|
564
|
-
|
|
565
|
-
// recorded in one transaction, under the org row lock
|
|
566
|
-
await this.d.db.transaction().execute(async (t) => {
|
|
567
|
-
await lockOrg(t, orgId);
|
|
568
|
-
const r = await putTemplateVersionIn(t, {
|
|
569
|
-
orgId,
|
|
570
|
-
plugin: plan.name,
|
|
571
|
-
catalogItemId: itemId,
|
|
572
|
-
catalogVersion: version,
|
|
573
|
-
sourceFormat: plan.sourceFormat,
|
|
574
|
-
}, a.template);
|
|
575
|
-
await record({
|
|
576
|
-
kind: "agent_template",
|
|
577
|
-
ref: r.id,
|
|
578
|
-
created: r.created,
|
|
579
|
-
skillVersion: !r.created && r.changed ? r.version : null,
|
|
580
|
-
}, t);
|
|
581
|
-
});
|
|
565
|
+
await this.installAgentTemplate(orgId, plan, a.template, record);
|
|
582
566
|
}
|
|
583
567
|
step = "skills";
|
|
584
568
|
for (const s of manifest.skills ?? []) {
|
|
585
|
-
const files = await readCatalogFiles(this.
|
|
586
|
-
const r = await this.
|
|
569
|
+
const files = await readCatalogFiles(this.storage, plan.row.object_prefix, plan.row.files, packagePath(s.path));
|
|
570
|
+
const r = await this.skills.createVersionFromFiles(orgId, actor, { ...skillOf(files), files }, {
|
|
587
571
|
catalog: {
|
|
588
572
|
itemId,
|
|
589
573
|
version,
|
|
@@ -600,68 +584,165 @@ export class PluginInstaller {
|
|
|
600
584
|
skillVersion: r.created ? null : r.version,
|
|
601
585
|
});
|
|
602
586
|
}
|
|
603
|
-
await this.
|
|
604
|
-
await lockOrg(t, orgId);
|
|
605
|
-
const updated = await t
|
|
606
|
-
.updateTable("plugin_installs")
|
|
607
|
-
.set({ status: "installed" })
|
|
608
|
-
.where("id", "=", installId)
|
|
609
|
-
.where("status", "=", "installing")
|
|
610
|
-
.executeTakeFirst();
|
|
611
|
-
// The install row was already cleaned up as stale: do not audit plugin.org_installed, roll
|
|
612
|
-
// back
|
|
613
|
-
if (updated.numUpdatedRows === 0n) {
|
|
614
|
-
throw new ApiError("plugin.install_not_found", "The install record was cleaned up as stale while the install was running");
|
|
615
|
-
}
|
|
616
|
-
await this.d.requests.resolveByInstall(t, orgId, itemId, actor, opts);
|
|
617
|
-
await audit(t, {
|
|
618
|
-
actorAccountId: actor,
|
|
619
|
-
...(opts.actorTokenId !== undefined && { actorTokenId: opts.actorTokenId }),
|
|
620
|
-
orgId,
|
|
621
|
-
action: "plugin.org_installed",
|
|
622
|
-
target: installId,
|
|
623
|
-
detail: {
|
|
624
|
-
itemId,
|
|
625
|
-
name: plan.name,
|
|
626
|
-
version,
|
|
627
|
-
components: done,
|
|
628
|
-
...(ctx.parent !== undefined && { dependencyOf: ctx.parent }),
|
|
629
|
-
},
|
|
630
|
-
});
|
|
631
|
-
});
|
|
587
|
+
await this.markInstalled(orgId, actor, installId, plan, done, ctx, opts);
|
|
632
588
|
return installId;
|
|
633
589
|
}
|
|
634
590
|
catch (e) {
|
|
635
591
|
const failure = e instanceof InstallFailure ? e : undefined;
|
|
636
592
|
const code = failure ? failure.code : e instanceof ApiError ? e.code : "internal";
|
|
637
593
|
const rollbackErrors = await this.rollback(orgId, actor, installId, done, opts);
|
|
638
|
-
await this.
|
|
639
|
-
await t
|
|
640
|
-
.updateTable("plugin_installs")
|
|
641
|
-
.set({ status: "failed", error: JSON.stringify({ step, code }) })
|
|
642
|
-
.where("id", "=", installId)
|
|
643
|
-
.execute();
|
|
644
|
-
await audit(t, {
|
|
645
|
-
actorAccountId: actor,
|
|
646
|
-
...(opts.actorTokenId !== undefined && { actorTokenId: opts.actorTokenId }),
|
|
647
|
-
orgId,
|
|
648
|
-
action: "plugin.org_install_failed",
|
|
649
|
-
target: installId,
|
|
650
|
-
detail: {
|
|
651
|
-
itemId,
|
|
652
|
-
name: plan.name,
|
|
653
|
-
version,
|
|
654
|
-
step,
|
|
655
|
-
code,
|
|
656
|
-
rolledBack: done,
|
|
657
|
-
rollbackErrors,
|
|
658
|
-
...(ctx.parent !== undefined && { dependencyOf: ctx.parent }),
|
|
659
|
-
},
|
|
660
|
-
});
|
|
661
|
-
});
|
|
594
|
+
await this.markFailed(orgId, actor, installId, plan, ctx, { step, code, done, rollbackErrors }, opts);
|
|
662
595
|
throw new InstallFailure(failure ? failure.step : step, failure ? failure.cause : e, failure ? failure.dependency : [], rollbackErrors.length === 0 && (failure?.rolledBack ?? true));
|
|
663
596
|
}
|
|
664
597
|
}
|
|
598
|
+
/**
|
|
599
|
+
* The install row (role and item policy re-checked under the lock; one live install per org and
|
|
600
|
+
* item). A step of the install: committed on its own.
|
|
601
|
+
*/
|
|
602
|
+
/**
|
|
603
|
+
* Enables a plugin's extension for the org and records it as a component of the install, in one
|
|
604
|
+
* transaction (`put` joins it): "enabled before" is decided under the org row lock (already
|
|
605
|
+
* enabled: `put` writes nothing, the config is untouched, the component is recorded as not
|
|
606
|
+
* created), and the ledger row is written before the COMMIT, so no concurrent uninstall fits
|
|
607
|
+
* between enabling and recording. Used by the install and the upgrade.
|
|
608
|
+
*/
|
|
609
|
+
async enableExtension(orgId, name, input, actor, actorTokenId, opts, record) {
|
|
610
|
+
const ifDisabled = { skipped: false };
|
|
611
|
+
await this.orgConfigs.put(orgId, name, input, actor, actorTokenId, { ...opts, ifDisabled });
|
|
612
|
+
await record({
|
|
613
|
+
kind: "extension",
|
|
614
|
+
ref: name,
|
|
615
|
+
created: !ifDisabled.skipped,
|
|
616
|
+
skillVersion: null,
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
async createInstallRow(orgId, actor, plan, ctx, installId) {
|
|
620
|
+
const { itemId, version } = plan;
|
|
621
|
+
const t = this.db;
|
|
622
|
+
await lockOrgForActions(this.orgLock, orgId, actor, ctx.actions);
|
|
623
|
+
if (ctx.approvedBy !== undefined) {
|
|
624
|
+
// A dependency disabled (or removed) since it was planned
|
|
625
|
+
const own = await t
|
|
626
|
+
.selectFrom("catalog_items")
|
|
627
|
+
.select(["policy", "deleted_at"])
|
|
628
|
+
.where("id", "=", itemId)
|
|
629
|
+
.forShare()
|
|
630
|
+
.executeTakeFirst();
|
|
631
|
+
if (!own || own.deleted_at !== null) {
|
|
632
|
+
throw unresolved(plan.name, plan.version, "it was removed from the enterprise catalog");
|
|
633
|
+
}
|
|
634
|
+
if (own.policy === "disabled")
|
|
635
|
+
throw dependencyDisabled(plan.name);
|
|
636
|
+
}
|
|
637
|
+
await assertItemInstallable(t, orgId, itemId, ctx.approvedBy ?? itemId);
|
|
638
|
+
const live = await t
|
|
639
|
+
.selectFrom("plugin_installs")
|
|
640
|
+
.select("id")
|
|
641
|
+
.where("org_id", "=", orgId)
|
|
642
|
+
.where("item_id", "=", itemId)
|
|
643
|
+
.where("status", "<>", "failed")
|
|
644
|
+
.executeTakeFirst();
|
|
645
|
+
if (live)
|
|
646
|
+
throw alreadyInstalled();
|
|
647
|
+
try {
|
|
648
|
+
await t
|
|
649
|
+
.insertInto("plugin_installs")
|
|
650
|
+
.values({
|
|
651
|
+
id: installId,
|
|
652
|
+
org_id: orgId,
|
|
653
|
+
item_id: itemId,
|
|
654
|
+
version,
|
|
655
|
+
status: "installing",
|
|
656
|
+
installed_by: actor,
|
|
657
|
+
})
|
|
658
|
+
.execute();
|
|
659
|
+
}
|
|
660
|
+
catch (e) {
|
|
661
|
+
if (isUniqueViolation(e))
|
|
662
|
+
throw alreadyInstalled();
|
|
663
|
+
throw e;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* An agent template step: created (or a new version of the org's live template of this plugin and
|
|
668
|
+
* name) and recorded in one transaction of its own, under the org row lock.
|
|
669
|
+
*/
|
|
670
|
+
async installAgentTemplate(orgId, plan, template, record) {
|
|
671
|
+
await this.orgLock.lock(orgId);
|
|
672
|
+
const r = await putTemplateVersionIn(this.db, {
|
|
673
|
+
orgId,
|
|
674
|
+
plugin: plan.name,
|
|
675
|
+
catalogItemId: plan.itemId,
|
|
676
|
+
catalogVersion: plan.version,
|
|
677
|
+
sourceFormat: plan.sourceFormat,
|
|
678
|
+
}, template);
|
|
679
|
+
await record({
|
|
680
|
+
kind: "agent_template",
|
|
681
|
+
ref: r.id,
|
|
682
|
+
created: r.created,
|
|
683
|
+
skillVersion: !r.created && r.changed ? r.version : null,
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
/** The install `installed` and its `plugin.org_installed` audit, under the org row lock (its own transaction). */
|
|
687
|
+
async markInstalled(orgId, actor, installId, plan, done, ctx, opts) {
|
|
688
|
+
const { itemId, version } = plan;
|
|
689
|
+
const t = this.db;
|
|
690
|
+
await this.orgLock.lock(orgId);
|
|
691
|
+
const updated = await t
|
|
692
|
+
.updateTable("plugin_installs")
|
|
693
|
+
.set({ status: "installed" })
|
|
694
|
+
.where("id", "=", installId)
|
|
695
|
+
.where("status", "=", "installing")
|
|
696
|
+
.executeTakeFirst();
|
|
697
|
+
// The install row was already cleaned up as stale: do not audit plugin.org_installed, roll
|
|
698
|
+
// back
|
|
699
|
+
if (updated.numUpdatedRows === 0n) {
|
|
700
|
+
throw new ApiError("plugin.install_not_found", "The install record was cleaned up as stale while the install was running");
|
|
701
|
+
}
|
|
702
|
+
await this.requests.resolveByInstall(orgId, itemId, actor, opts);
|
|
703
|
+
await audit(t, {
|
|
704
|
+
actorAccountId: actor,
|
|
705
|
+
...(opts.actorTokenId !== undefined && { actorTokenId: opts.actorTokenId }),
|
|
706
|
+
orgId,
|
|
707
|
+
action: "plugin.org_installed",
|
|
708
|
+
target: installId,
|
|
709
|
+
detail: {
|
|
710
|
+
itemId,
|
|
711
|
+
name: plan.name,
|
|
712
|
+
version,
|
|
713
|
+
components: done,
|
|
714
|
+
...(ctx.parent !== undefined && { dependencyOf: ctx.parent }),
|
|
715
|
+
},
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
/** The install `failed` with `{ step, code }` and its `plugin.org_install_failed` audit (its own transaction). */
|
|
719
|
+
async markFailed(orgId, actor, installId, plan, ctx, f, opts) {
|
|
720
|
+
const { itemId, version } = plan;
|
|
721
|
+
const { step, code, done, rollbackErrors } = f;
|
|
722
|
+
const t = this.db;
|
|
723
|
+
await t
|
|
724
|
+
.updateTable("plugin_installs")
|
|
725
|
+
.set({ status: "failed", error: JSON.stringify({ step, code }) })
|
|
726
|
+
.where("id", "=", installId)
|
|
727
|
+
.execute();
|
|
728
|
+
await audit(t, {
|
|
729
|
+
actorAccountId: actor,
|
|
730
|
+
...(opts.actorTokenId !== undefined && { actorTokenId: opts.actorTokenId }),
|
|
731
|
+
orgId,
|
|
732
|
+
action: "plugin.org_install_failed",
|
|
733
|
+
target: installId,
|
|
734
|
+
detail: {
|
|
735
|
+
itemId,
|
|
736
|
+
name: plan.name,
|
|
737
|
+
version,
|
|
738
|
+
step,
|
|
739
|
+
code,
|
|
740
|
+
rolledBack: done,
|
|
741
|
+
rollbackErrors,
|
|
742
|
+
...(ctx.parent !== undefined && { dependencyOf: ctx.parent }),
|
|
743
|
+
},
|
|
744
|
+
});
|
|
745
|
+
}
|
|
665
746
|
/**
|
|
666
747
|
* The extension to enable: the plugin's own, when it has one. Not loaded on this replica ->
|
|
667
748
|
* `catalog.not_deployed`; not yet enabled in this org while its own catalog item is disabled ->
|
|
@@ -672,11 +753,11 @@ export class PluginInstaller {
|
|
|
672
753
|
if (!manifest.extension)
|
|
673
754
|
return null;
|
|
674
755
|
const name = manifest.name;
|
|
675
|
-
if (!this.
|
|
756
|
+
if (!this.registry.manifests().some((m) => m.name === name)) {
|
|
676
757
|
throw new ApiError("catalog.not_deployed", `The extension of plugin ${name} is not deployed; ask the enterprise admin to install and enable it`);
|
|
677
758
|
}
|
|
678
|
-
const enabled = await isExtensionEnabled(this.
|
|
679
|
-
if (!enabled && (await disabledPluginItems(this.
|
|
759
|
+
const enabled = await isExtensionEnabled(this.db, orgId, name);
|
|
760
|
+
if (!enabled && (await disabledPluginItems(this.db, [name])).length > 0) {
|
|
680
761
|
throw pluginItemDisabled([name]);
|
|
681
762
|
}
|
|
682
763
|
return name;
|
|
@@ -705,46 +786,13 @@ export class PluginInstaller {
|
|
|
705
786
|
if (!c.created && c.skillVersion === null)
|
|
706
787
|
continue;
|
|
707
788
|
try {
|
|
708
|
-
const disabled =
|
|
709
|
-
await this.d.db.transaction().execute(async (t) => {
|
|
710
|
-
await lockOrg(t, orgId);
|
|
711
|
-
if (c.kind === "plugin") {
|
|
712
|
-
// A dependency install this install created: uninstalled by the usual rules
|
|
713
|
-
const sub = { removed: [], kept: [] };
|
|
714
|
-
await this.uninstallIn(t, orgId, actor, c.ref, {
|
|
715
|
-
report: sub,
|
|
716
|
-
removing: new Set([installId]),
|
|
717
|
-
from: installId,
|
|
718
|
-
authorize: false,
|
|
719
|
-
reason: "plugin_install_rollback",
|
|
720
|
-
opts,
|
|
721
|
-
});
|
|
722
|
-
disabled.push(...sub.removed.filter((r) => r.kind === "extension").map((r) => r.ref));
|
|
723
|
-
}
|
|
724
|
-
else {
|
|
725
|
-
// Another enabled extension depends on it (only it provides what that one needs in this
|
|
726
|
-
// org): kept (its component row too), so the other does not lose its dependency
|
|
727
|
-
if (c.kind === "extension" &&
|
|
728
|
-
(await this.d.orgConfigs.enabledDependents(t, orgId, c.ref)).length > 0) {
|
|
729
|
-
return;
|
|
730
|
-
}
|
|
731
|
-
const removed = await this.removeComponent(t, orgId, actor, c, "plugin_install_rollback");
|
|
732
|
-
if (removed && c.kind === "extension")
|
|
733
|
-
disabled.push(c.ref);
|
|
734
|
-
}
|
|
735
|
-
await t
|
|
736
|
-
.deleteFrom("plugin_install_components")
|
|
737
|
-
.where("install_id", "=", installId)
|
|
738
|
-
.where("kind", "=", c.kind)
|
|
739
|
-
.where("ref", "=", c.ref)
|
|
740
|
-
.execute();
|
|
741
|
-
});
|
|
789
|
+
const disabled = await this.rollbackOne(orgId, actor, installId, c, opts);
|
|
742
790
|
for (const p of disabled)
|
|
743
|
-
await this.
|
|
791
|
+
await this.orgConfigs.afterDisable(orgId, p);
|
|
744
792
|
}
|
|
745
793
|
catch (e) {
|
|
746
794
|
errors.push({ kind: c.kind, ref: c.ref });
|
|
747
|
-
this.
|
|
795
|
+
this.log.warn("plugin install rollback step failed", {
|
|
748
796
|
orgId,
|
|
749
797
|
kind: c.kind,
|
|
750
798
|
ref: c.ref,
|
|
@@ -754,11 +802,53 @@ export class PluginInstaller {
|
|
|
754
802
|
}
|
|
755
803
|
return errors;
|
|
756
804
|
}
|
|
805
|
+
/**
|
|
806
|
+
* Undoes one component of a failed install and deletes its component row, under the org row lock,
|
|
807
|
+
* in a transaction of its own (committed when it returns); returns the extensions it disabled
|
|
808
|
+
* (the caller notifies them).
|
|
809
|
+
*/
|
|
810
|
+
async rollbackOne(orgId, actor, installId, c, opts) {
|
|
811
|
+
const disabled = [];
|
|
812
|
+
const t = this.db;
|
|
813
|
+
await this.orgLock.lock(orgId);
|
|
814
|
+
if (c.kind === "plugin") {
|
|
815
|
+
// A dependency install this install created: uninstalled by the usual rules
|
|
816
|
+
const sub = { removed: [], kept: [] };
|
|
817
|
+
await this.uninstallIn(orgId, actor, c.ref, {
|
|
818
|
+
report: sub,
|
|
819
|
+
removing: new Set([installId]),
|
|
820
|
+
from: installId,
|
|
821
|
+
authorize: false,
|
|
822
|
+
reason: "plugin_install_rollback",
|
|
823
|
+
opts,
|
|
824
|
+
});
|
|
825
|
+
disabled.push(...sub.removed.filter((r) => r.kind === "extension").map((r) => r.ref));
|
|
826
|
+
}
|
|
827
|
+
else {
|
|
828
|
+
// Another enabled extension depends on it (only it provides what that one needs in this
|
|
829
|
+
// org): kept (its component row too), so the other does not lose its dependency
|
|
830
|
+
if (c.kind === "extension" &&
|
|
831
|
+
(await this.orgConfigs.enabledDependents(orgId, c.ref)).length > 0) {
|
|
832
|
+
return [];
|
|
833
|
+
}
|
|
834
|
+
const removed = await this.removeComponent(orgId, actor, c, "plugin_install_rollback");
|
|
835
|
+
if (removed && c.kind === "extension")
|
|
836
|
+
disabled.push(c.ref);
|
|
837
|
+
}
|
|
838
|
+
await t
|
|
839
|
+
.deleteFrom("plugin_install_components")
|
|
840
|
+
.where("install_id", "=", installId)
|
|
841
|
+
.where("kind", "=", c.kind)
|
|
842
|
+
.where("ref", "=", c.ref)
|
|
843
|
+
.execute();
|
|
844
|
+
return disabled;
|
|
845
|
+
}
|
|
757
846
|
/** Removes one component (one already gone is no error); returns whether anything changed. */
|
|
758
|
-
async removeComponent(
|
|
847
|
+
async removeComponent(orgId, actor, c, reason) {
|
|
759
848
|
if (c.kind === "extension") {
|
|
760
|
-
return this.
|
|
849
|
+
return this.orgConfigs.disableIn(orgId, c.ref, actor, reason);
|
|
761
850
|
}
|
|
851
|
+
const t = this.db;
|
|
762
852
|
if (c.kind === "connector") {
|
|
763
853
|
const live = await t
|
|
764
854
|
.selectFrom("connectors")
|
|
@@ -769,7 +859,7 @@ export class PluginInstaller {
|
|
|
769
859
|
.executeTakeFirst();
|
|
770
860
|
if (!live)
|
|
771
861
|
return false;
|
|
772
|
-
await this.
|
|
862
|
+
await this.connectors.removeIn(orgId, c.ref, actor, undefined, reason);
|
|
773
863
|
return true;
|
|
774
864
|
}
|
|
775
865
|
if (c.kind === "plugin")
|
|
@@ -783,9 +873,9 @@ export class PluginInstaller {
|
|
|
783
873
|
return false;
|
|
784
874
|
}
|
|
785
875
|
if (c.created)
|
|
786
|
-
return this.
|
|
876
|
+
return this.skills.softDeleteIn(orgId, c.ref, actor, reason);
|
|
787
877
|
if (c.skillVersion !== null) {
|
|
788
|
-
return this.
|
|
878
|
+
return this.skills.revertVersionIn(orgId, c.ref, c.skillVersion, actor, reason);
|
|
789
879
|
}
|
|
790
880
|
return false;
|
|
791
881
|
}
|
|
@@ -814,32 +904,36 @@ export class PluginInstaller {
|
|
|
814
904
|
async uninstall(orgId, actor, installId, opts = {}) {
|
|
815
905
|
if (!UUID_RE.test(installId))
|
|
816
906
|
throw installNotFound();
|
|
907
|
+
return this.writeUninstall(orgId, actor, installId, opts);
|
|
908
|
+
}
|
|
909
|
+
/** The uninstall's one transaction; the extensions it disabled are notified once it commits. */
|
|
910
|
+
async writeUninstall(orgId, actor, installId, opts) {
|
|
817
911
|
const report = { removed: [], kept: [] };
|
|
818
|
-
await this.
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
opts,
|
|
824
|
-
});
|
|
825
|
-
if (outcome === "missing")
|
|
826
|
-
throw installNotFound();
|
|
827
|
-
if (outcome === "kept") {
|
|
828
|
-
report.kept.push({ kind: "plugin", ref: installId, reason: "used_by_other_install" });
|
|
829
|
-
}
|
|
912
|
+
const outcome = await this.uninstallIn(orgId, actor, installId, {
|
|
913
|
+
report,
|
|
914
|
+
removing: new Set(),
|
|
915
|
+
authorize: true,
|
|
916
|
+
opts,
|
|
830
917
|
});
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
918
|
+
if (outcome === "missing")
|
|
919
|
+
throw installNotFound();
|
|
920
|
+
if (outcome === "kept") {
|
|
921
|
+
report.kept.push({ kind: "plugin", ref: installId, reason: "used_by_other_install" });
|
|
834
922
|
}
|
|
923
|
+
afterCommit(async () => {
|
|
924
|
+
for (const r of report.removed) {
|
|
925
|
+
if (r.kind === "extension")
|
|
926
|
+
await this.orgConfigs.afterDisable(orgId, r.ref);
|
|
927
|
+
}
|
|
928
|
+
});
|
|
835
929
|
return report;
|
|
836
930
|
}
|
|
837
931
|
/**
|
|
838
932
|
* The oldest other live install (not in `removing`) that has component `kind` / `ref`, or
|
|
839
933
|
* undefined.
|
|
840
934
|
*/
|
|
841
|
-
async heir(
|
|
842
|
-
let q =
|
|
935
|
+
async heir(orgId, removing, kind, ref) {
|
|
936
|
+
let q = this.db
|
|
843
937
|
.selectFrom("plugin_install_components as c")
|
|
844
938
|
.innerJoin("plugin_installs as a", "a.id", "c.install_id")
|
|
845
939
|
.select("a.id")
|
|
@@ -853,8 +947,8 @@ export class PluginInstaller {
|
|
|
853
947
|
return row?.id;
|
|
854
948
|
}
|
|
855
949
|
/** Passes ownership of a component to `heir` (its component row becomes created=true). */
|
|
856
|
-
async handOver(
|
|
857
|
-
await
|
|
950
|
+
async handOver(heir, kind, ref) {
|
|
951
|
+
await this.db
|
|
858
952
|
.updateTable("plugin_install_components")
|
|
859
953
|
.set({ created: true })
|
|
860
954
|
.where("install_id", "=", heir)
|
|
@@ -868,7 +962,8 @@ export class PluginInstaller {
|
|
|
868
962
|
* outcome of the install itself is returned for the caller to report: `missing`, `kept` (another
|
|
869
963
|
* install outside this uninstall depends on it) or `removed`.
|
|
870
964
|
*/
|
|
871
|
-
async uninstallIn(
|
|
965
|
+
async uninstallIn(orgId, actor, installId, ctx) {
|
|
966
|
+
const t = this.db;
|
|
872
967
|
const { removing } = ctx;
|
|
873
968
|
if (removing.has(installId))
|
|
874
969
|
return "removed";
|
|
@@ -882,7 +977,7 @@ export class PluginInstaller {
|
|
|
882
977
|
mine.kept.push(x);
|
|
883
978
|
ctx.report.kept.push(x);
|
|
884
979
|
};
|
|
885
|
-
const staleMinutes = this.
|
|
980
|
+
const staleMinutes = this.staleInstallMinutes();
|
|
886
981
|
if (ctx.authorize) {
|
|
887
982
|
const target = await t
|
|
888
983
|
.selectFrom("plugin_installs as a")
|
|
@@ -891,7 +986,7 @@ export class PluginInstaller {
|
|
|
891
986
|
.where("a.id", "=", installId)
|
|
892
987
|
.where("a.org_id", "=", orgId)
|
|
893
988
|
.executeTakeFirst();
|
|
894
|
-
await lockOrgForActions(
|
|
989
|
+
await lockOrgForActions(this.orgLock, orgId, actor, target ? requiredActions(target.manifest) : ALL_ACTIONS);
|
|
895
990
|
}
|
|
896
991
|
const row = await t
|
|
897
992
|
.selectFrom("plugin_installs as a")
|
|
@@ -914,10 +1009,10 @@ export class PluginInstaller {
|
|
|
914
1009
|
return "missing";
|
|
915
1010
|
// Another install outside this uninstall depends on it: kept (a dependency uninstall hands
|
|
916
1011
|
// ownership over)
|
|
917
|
-
const user = await this.heir(
|
|
1012
|
+
const user = await this.heir(orgId, new Set([...removing, installId]), "plugin", installId);
|
|
918
1013
|
if (user !== undefined) {
|
|
919
1014
|
if (ctx.from !== undefined)
|
|
920
|
-
await this.handOver(
|
|
1015
|
+
await this.handOver(user, "plugin", installId);
|
|
921
1016
|
return "kept";
|
|
922
1017
|
}
|
|
923
1018
|
if (row.status === "uninstalling" ||
|
|
@@ -927,7 +1022,7 @@ export class PluginInstaller {
|
|
|
927
1022
|
}
|
|
928
1023
|
if (row.status === "upgrading") {
|
|
929
1024
|
// An upgrade interrupted midway (a replica crashed): undone first, back at the old version
|
|
930
|
-
const undone = await this.undoUpgradeIn(
|
|
1025
|
+
const undone = await this.undoUpgradeIn(orgId, actor, installId, journalEntries(row.upgrade), "plugin_upgrade_cleanup");
|
|
931
1026
|
for (const x of undone)
|
|
932
1027
|
addRemoved(x);
|
|
933
1028
|
}
|
|
@@ -953,7 +1048,7 @@ export class PluginInstaller {
|
|
|
953
1048
|
? 2 + extensionOrder.indexOf(c.ref)
|
|
954
1049
|
: 1000 + (c.created ? 0 : 1);
|
|
955
1050
|
comps.sort((a, b) => rank(a) - rank(b));
|
|
956
|
-
const agentRefs = await this.agentRefs(
|
|
1051
|
+
const agentRefs = await this.agentRefs(orgId);
|
|
957
1052
|
for (const c of comps) {
|
|
958
1053
|
const keep = (reason) => addKept({ kind: c.kind, ref: c.ref, reason });
|
|
959
1054
|
let created = c.created;
|
|
@@ -983,7 +1078,7 @@ export class PluginInstaller {
|
|
|
983
1078
|
if (rollbackMode &&
|
|
984
1079
|
(c.kind === "skill" || c.kind === "agent_template") &&
|
|
985
1080
|
c.skill_version !== null &&
|
|
986
|
-
(await this.removeComponent(
|
|
1081
|
+
(await this.removeComponent(orgId, actor, comp, "plugin_install_cleanup"))) {
|
|
987
1082
|
addRemoved({ kind: c.kind, ref: c.ref });
|
|
988
1083
|
continue;
|
|
989
1084
|
}
|
|
@@ -991,7 +1086,7 @@ export class PluginInstaller {
|
|
|
991
1086
|
continue;
|
|
992
1087
|
}
|
|
993
1088
|
if (c.kind === "plugin") {
|
|
994
|
-
const outcome = await this.uninstallIn(
|
|
1089
|
+
const outcome = await this.uninstallIn(orgId, actor, c.ref, { ...ctx, from: installId });
|
|
995
1090
|
if (outcome === "removed")
|
|
996
1091
|
addRemoved({ kind: "plugin", ref: c.ref });
|
|
997
1092
|
else if (outcome === "kept")
|
|
@@ -999,7 +1094,7 @@ export class PluginInstaller {
|
|
|
999
1094
|
continue;
|
|
1000
1095
|
}
|
|
1001
1096
|
const reason = rollbackMode ? "plugin_install_cleanup" : (ctx.reason ?? "plugin_uninstall");
|
|
1002
|
-
const outcome = await this.decideRemovalIn(
|
|
1097
|
+
const outcome = await this.decideRemovalIn(orgId, actor, comp, removing, agentRefs, reason);
|
|
1003
1098
|
if (outcome === "removed")
|
|
1004
1099
|
addRemoved({ kind: c.kind, ref: c.ref });
|
|
1005
1100
|
else if (outcome !== "gone")
|
|
@@ -1034,7 +1129,7 @@ export class PluginInstaller {
|
|
|
1034
1129
|
* (`used_by_plugins`); otherwise removed (`removed`, or `gone` when it no longer existed). Used
|
|
1035
1130
|
* by uninstall and by an upgrade's removals.
|
|
1036
1131
|
*/
|
|
1037
|
-
async decideRemovalIn(
|
|
1132
|
+
async decideRemovalIn(orgId, actor, c, removing, agentRefs, reason) {
|
|
1038
1133
|
if (c.kind === "skill" && agentRefs.skills.has(c.ref))
|
|
1039
1134
|
return "used_by_agents";
|
|
1040
1135
|
if (c.kind === "agent_template" && agentRefs.templates.has(c.ref))
|
|
@@ -1042,16 +1137,16 @@ export class PluginInstaller {
|
|
|
1042
1137
|
if (c.kind === "connector" && agentRefs.connectors.has(c.ref))
|
|
1043
1138
|
return "used_by_agents";
|
|
1044
1139
|
if (c.kind !== "connector") {
|
|
1045
|
-
const heir = await this.heir(
|
|
1140
|
+
const heir = await this.heir(orgId, removing, c.kind, c.ref);
|
|
1046
1141
|
if (heir !== undefined) {
|
|
1047
|
-
await this.handOver(
|
|
1142
|
+
await this.handOver(heir, c.kind, c.ref);
|
|
1048
1143
|
return "used_by_other_install";
|
|
1049
1144
|
}
|
|
1050
1145
|
}
|
|
1051
1146
|
if (c.kind === "extension") {
|
|
1052
1147
|
const kinds = this.connectorKindsOf(c.ref);
|
|
1053
1148
|
if (kinds.length > 0) {
|
|
1054
|
-
const used = await
|
|
1149
|
+
const used = await this.db
|
|
1055
1150
|
.selectFrom("connectors")
|
|
1056
1151
|
.select("id")
|
|
1057
1152
|
.where("org_id", "=", orgId)
|
|
@@ -1061,21 +1156,21 @@ export class PluginInstaller {
|
|
|
1061
1156
|
if (used)
|
|
1062
1157
|
return "used_by_connectors";
|
|
1063
1158
|
}
|
|
1064
|
-
if ((await this.
|
|
1159
|
+
if ((await this.orgConfigs.enabledDependents(orgId, c.ref)).length > 0) {
|
|
1065
1160
|
return "used_by_plugins";
|
|
1066
1161
|
}
|
|
1067
1162
|
}
|
|
1068
|
-
return (await this.removeComponent(
|
|
1163
|
+
return (await this.removeComponent(orgId, actor, c, reason)) ? "removed" : "gone";
|
|
1069
1164
|
}
|
|
1070
1165
|
/** The order extensions are uninstalled in: the reverse of the install (requires) order; extensions not loaded on this replica last. */
|
|
1071
1166
|
uninstallExtensionOrder(refs) {
|
|
1072
|
-
const loaded = new Map(this.
|
|
1167
|
+
const loaded = new Map(this.registry.manifests().map((m) => [m.name, m]));
|
|
1073
1168
|
const known = refs.filter((r) => loaded.has(r)).map((r) => loaded.get(r));
|
|
1074
1169
|
return [...orderByRequires(known).reverse(), ...refs.filter((r) => !loaded.has(r))];
|
|
1075
1170
|
}
|
|
1076
1171
|
/** The org's plugin installs (failed ones included), newest first; `installId` picks one. */
|
|
1077
1172
|
async list(orgId, installId) {
|
|
1078
|
-
let q = this.
|
|
1173
|
+
let q = this.db
|
|
1079
1174
|
.selectFrom("plugin_installs as a")
|
|
1080
1175
|
.innerJoin("catalog_items as i", "i.id", "a.item_id")
|
|
1081
1176
|
.select([
|
|
@@ -1094,8 +1189,8 @@ export class PluginInstaller {
|
|
|
1094
1189
|
const rows = await q.orderBy("a.installed_at", "desc").orderBy("a.id").execute();
|
|
1095
1190
|
if (rows.length === 0)
|
|
1096
1191
|
return [];
|
|
1097
|
-
const info = await upgradeInfo(this.
|
|
1098
|
-
const comps = await this.
|
|
1192
|
+
const info = await upgradeInfo(this.db, this.registry, rows.map((r) => ({ itemId: r.item_id, name: r.name, version: r.version })));
|
|
1193
|
+
const comps = await this.db
|
|
1099
1194
|
.selectFrom("plugin_install_components")
|
|
1100
1195
|
.select(["install_id", "kind", "ref", "created", "skill_version", "dropped"])
|
|
1101
1196
|
.where("install_id", "in", rows.map((r) => r.id))
|
|
@@ -1131,9 +1226,9 @@ export class PluginInstaller {
|
|
|
1131
1226
|
* extension among them needs `afterDisable` once committed). Used when an upgrade fails and when
|
|
1132
1227
|
* an interrupted one is cleaned up.
|
|
1133
1228
|
*/
|
|
1134
|
-
async undoUpgradeIn(
|
|
1229
|
+
async undoUpgradeIn(orgId, actor, installId, steps, reason) {
|
|
1135
1230
|
const removed = [];
|
|
1136
|
-
const dropRow = (kind, ref) =>
|
|
1231
|
+
const dropRow = (kind, ref) => this.db
|
|
1137
1232
|
.deleteFrom("plugin_install_components")
|
|
1138
1233
|
.where("install_id", "=", installId)
|
|
1139
1234
|
.where("kind", "=", kind)
|
|
@@ -1141,11 +1236,11 @@ export class PluginInstaller {
|
|
|
1141
1236
|
.execute();
|
|
1142
1237
|
for (const s of [...steps].reverse()) {
|
|
1143
1238
|
if (s.op === "skill_version") {
|
|
1144
|
-
await this.
|
|
1239
|
+
await this.skills.revertVersionIn(orgId, s.ref, s.version, actor, reason);
|
|
1145
1240
|
continue;
|
|
1146
1241
|
}
|
|
1147
1242
|
if (s.op === "template_version") {
|
|
1148
|
-
await revertTemplateVersionIn(
|
|
1243
|
+
await revertTemplateVersionIn(this.db, orgId, s.ref, s.version);
|
|
1149
1244
|
continue;
|
|
1150
1245
|
}
|
|
1151
1246
|
if (s.op === "recorded") {
|
|
@@ -1155,7 +1250,7 @@ export class PluginInstaller {
|
|
|
1155
1250
|
if (s.kind === "plugin") {
|
|
1156
1251
|
const sub = { removed: [], kept: [] };
|
|
1157
1252
|
await dropRow(s.kind, s.ref);
|
|
1158
|
-
const outcome = await this.uninstallIn(
|
|
1253
|
+
const outcome = await this.uninstallIn(orgId, actor, s.ref, {
|
|
1159
1254
|
report: sub,
|
|
1160
1255
|
removing: new Set([installId]),
|
|
1161
1256
|
from: installId,
|
|
@@ -1169,12 +1264,12 @@ export class PluginInstaller {
|
|
|
1169
1264
|
continue;
|
|
1170
1265
|
}
|
|
1171
1266
|
if (s.kind === "extension" &&
|
|
1172
|
-
(await this.
|
|
1267
|
+
(await this.orgConfigs.enabledDependents(orgId, s.ref)).length > 0) {
|
|
1173
1268
|
// Another enabled extension needs it: kept, and stays this install's component
|
|
1174
1269
|
continue;
|
|
1175
1270
|
}
|
|
1176
1271
|
const c = { kind: s.kind, ref: s.ref, created: true, skillVersion: null };
|
|
1177
|
-
if (await this.removeComponent(
|
|
1272
|
+
if (await this.removeComponent(orgId, actor, c, reason)) {
|
|
1178
1273
|
removed.push({ kind: s.kind, ref: s.ref });
|
|
1179
1274
|
}
|
|
1180
1275
|
await dropRow(s.kind, s.ref);
|
|
@@ -1183,7 +1278,7 @@ export class PluginInstaller {
|
|
|
1183
1278
|
}
|
|
1184
1279
|
/** The connector kinds an extension provides (the `connector@1` implementations loaded on this replica). */
|
|
1185
1280
|
connectorKindsOf(plugin) {
|
|
1186
|
-
return this.
|
|
1281
|
+
return this.registry
|
|
1187
1282
|
.list("connector")
|
|
1188
1283
|
.filter((e) => e.plugin === plugin)
|
|
1189
1284
|
.map((e) => e.impl?.kind)
|
|
@@ -1193,8 +1288,8 @@ export class PluginInstaller {
|
|
|
1193
1288
|
* The connectors, org skills and agent templates (`subagents.templates`) referenced by the
|
|
1194
1289
|
* current definitions of the org's live agents.
|
|
1195
1290
|
*/
|
|
1196
|
-
async agentRefs(
|
|
1197
|
-
const rows = await
|
|
1291
|
+
async agentRefs(orgId) {
|
|
1292
|
+
const rows = await this.db
|
|
1198
1293
|
.selectFrom("agents as a")
|
|
1199
1294
|
.innerJoin("agent_versions as v", (j) => j.onRef("v.agent_id", "=", "a.id").onRef("v.version", "=", "a.current_version"))
|
|
1200
1295
|
.select("v.definition")
|
|
@@ -1221,7 +1316,64 @@ export class PluginInstaller {
|
|
|
1221
1316
|
}
|
|
1222
1317
|
return { connectors, skills, templates };
|
|
1223
1318
|
}
|
|
1224
|
-
}
|
|
1319
|
+
};
|
|
1320
|
+
__decorate([
|
|
1321
|
+
Transactional({ propagation: "requires_new" })
|
|
1322
|
+
], PluginInstaller.prototype, "recordDependency", null);
|
|
1323
|
+
__decorate([
|
|
1324
|
+
Transactional()
|
|
1325
|
+
], PluginInstaller.prototype, "enableExtension", null);
|
|
1326
|
+
__decorate([
|
|
1327
|
+
Transactional({ propagation: "requires_new" })
|
|
1328
|
+
], PluginInstaller.prototype, "createInstallRow", null);
|
|
1329
|
+
__decorate([
|
|
1330
|
+
Transactional({ propagation: "requires_new" })
|
|
1331
|
+
], PluginInstaller.prototype, "installAgentTemplate", null);
|
|
1332
|
+
__decorate([
|
|
1333
|
+
Transactional({ propagation: "requires_new" })
|
|
1334
|
+
], PluginInstaller.prototype, "markInstalled", null);
|
|
1335
|
+
__decorate([
|
|
1336
|
+
Transactional({ propagation: "requires_new" })
|
|
1337
|
+
], PluginInstaller.prototype, "markFailed", null);
|
|
1338
|
+
__decorate([
|
|
1339
|
+
Transactional({ propagation: "requires_new" })
|
|
1340
|
+
], PluginInstaller.prototype, "rollbackOne", null);
|
|
1341
|
+
__decorate([
|
|
1342
|
+
Transactional({ propagation: "mandatory" })
|
|
1343
|
+
], PluginInstaller.prototype, "removeComponent", null);
|
|
1344
|
+
__decorate([
|
|
1345
|
+
Transactional()
|
|
1346
|
+
], PluginInstaller.prototype, "writeUninstall", null);
|
|
1347
|
+
__decorate([
|
|
1348
|
+
Transactional({ propagation: "mandatory" })
|
|
1349
|
+
], PluginInstaller.prototype, "heir", null);
|
|
1350
|
+
__decorate([
|
|
1351
|
+
Transactional({ propagation: "mandatory" })
|
|
1352
|
+
], PluginInstaller.prototype, "handOver", null);
|
|
1353
|
+
__decorate([
|
|
1354
|
+
Transactional({ propagation: "mandatory" })
|
|
1355
|
+
], PluginInstaller.prototype, "uninstallIn", null);
|
|
1356
|
+
__decorate([
|
|
1357
|
+
Transactional({ propagation: "mandatory" })
|
|
1358
|
+
], PluginInstaller.prototype, "decideRemovalIn", null);
|
|
1359
|
+
__decorate([
|
|
1360
|
+
Transactional({ propagation: "mandatory" })
|
|
1361
|
+
], PluginInstaller.prototype, "undoUpgradeIn", null);
|
|
1362
|
+
PluginInstaller = __decorate([
|
|
1363
|
+
Injectable(),
|
|
1364
|
+
__param(0, Inject(KernelDb)),
|
|
1365
|
+
__param(1, Inject(OrgLock)),
|
|
1366
|
+
__param(2, Inject(StorageService)),
|
|
1367
|
+
__param(3, Inject(ExtensionRegistry)),
|
|
1368
|
+
__param(4, Inject(SkillsService)),
|
|
1369
|
+
__param(5, Inject(OrgExtensionConfigs)),
|
|
1370
|
+
__param(6, Inject(CatalogRequestsService)),
|
|
1371
|
+
__param(7, Inject(KernelConfigService)),
|
|
1372
|
+
__param(8, Inject(ConnectorsService)),
|
|
1373
|
+
__param(9, Inject(KERNEL_LOGGER)),
|
|
1374
|
+
__param(10, Inject(TransactionHost))
|
|
1375
|
+
], PluginInstaller);
|
|
1376
|
+
export { PluginInstaller };
|
|
1225
1377
|
/**
|
|
1226
1378
|
* The skill names of a catalog version, read from each skill's SKILL.md in storage (the names are
|
|
1227
1379
|
* not in plugin.json). Used by install planning and the upgrade preview.
|