@capybara-hq/kernel 0.1.0-rc.1 → 0.1.0-rc.11
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 +85 -5
- package/dist/admin/admin.controller.d.ts +52 -71
- package/dist/admin/admin.controller.js +117 -63
- package/dist/admin/admin.module.d.ts +3 -0
- package/dist/admin/admin.module.js +22 -0
- package/dist/admin/admin.schemas.d.ts +60 -0
- package/dist/admin/admin.schemas.js +50 -0
- package/dist/admin/extensions.controller.d.ts +47 -16
- package/dist/admin/extensions.controller.js +94 -23
- package/dist/admin/extensions.schemas.d.ts +7 -0
- package/dist/admin/extensions.schemas.js +10 -0
- package/dist/admin/limit-defaults.d.ts +20 -0
- package/dist/admin/limit-defaults.js +10 -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/agents/agent-lookup.d.ts +72 -0
- package/dist/agents/agent-lookup.js +208 -0
- package/dist/agents/agent-profile.service.d.ts +31 -0
- package/dist/agents/agent-profile.service.js +122 -0
- package/dist/agents/agents.controller.d.ts +54 -169
- package/dist/agents/agents.controller.js +172 -37
- package/dist/agents/agents.module.d.ts +10 -0
- package/dist/agents/agents.module.js +71 -0
- package/dist/agents/agents.schemas.d.ts +389 -0
- package/dist/agents/agents.schemas.js +126 -0
- package/dist/agents/agents.service.d.ts +104 -76
- package/dist/agents/agents.service.js +509 -383
- package/dist/agents/definition.d.ts +133 -21
- package/dist/agents/definition.js +361 -41
- package/dist/agents/from-template.d.ts +106 -0
- package/dist/agents/from-template.js +680 -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 +111 -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 +868 -0
- package/dist/agents/pending-connector-requests.d.ts +79 -0
- package/dist/agents/pending-connector-requests.js +215 -0
- package/dist/agents/pending-connectors.controller.d.ts +39 -0
- package/dist/agents/pending-connectors.controller.js +91 -0
- package/dist/agents/pending-connectors.service.d.ts +62 -0
- package/dist/agents/pending-connectors.service.js +282 -0
- package/dist/agents/profile.d.ts +114 -0
- package/dist/agents/profile.js +55 -0
- package/dist/agents/readiness.controller.d.ts +26 -0
- package/dist/agents/readiness.controller.js +56 -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 +500 -46
- package/dist/agents/templates.schemas.d.ts +20 -0
- package/dist/agents/templates.schemas.js +45 -0
- package/dist/app.d.ts +93 -0
- package/dist/app.js +150 -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 +44 -0
- package/dist/background/finish.js +95 -0
- package/dist/background/launch-lock.d.ts +15 -0
- package/dist/background/launch-lock.js +40 -0
- package/dist/background/launch.d.ts +42 -0
- package/dist/background/launch.js +77 -0
- package/dist/background/poll.job.d.ts +56 -0
- package/dist/background/poll.job.js +195 -0
- package/dist/background/render.d.ts +23 -0
- package/dist/background/render.js +48 -0
- package/dist/background/session.d.ts +48 -0
- package/dist/background/session.js +80 -0
- package/dist/background/status.d.ts +35 -0
- package/dist/background/status.js +57 -0
- package/dist/background/stop.d.ts +68 -0
- package/dist/background/stop.js +244 -0
- package/dist/background/store.d.ts +167 -0
- package/dist/background/store.js +361 -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 +77 -0
- package/dist/background/tasks.service.js +216 -0
- package/dist/background/wake-rules.d.ts +66 -0
- package/dist/background/wake-rules.js +113 -0
- package/dist/background/wake.d.ts +30 -0
- package/dist/background/wake.js +63 -0
- package/dist/catalog/admin-catalog.controller.d.ts +102 -52
- package/dist/catalog/admin-catalog.controller.js +222 -67
- package/dist/catalog/admin-catalog.schemas.d.ts +72 -0
- package/dist/catalog/admin-catalog.schemas.js +92 -0
- package/dist/catalog/catalog-content.d.ts +264 -0
- package/dist/catalog/catalog-content.js +430 -0
- package/dist/catalog/catalog-files.d.ts +41 -0
- package/dist/catalog/catalog-files.js +86 -0
- package/dist/catalog/catalog-import.module.d.ts +7 -0
- package/dist/catalog/catalog-import.module.js +60 -0
- package/dist/catalog/catalog-items.d.ts +290 -0
- package/dist/catalog/catalog-items.js +677 -0
- package/dist/catalog/catalog-scope.service.d.ts +286 -0
- package/dist/catalog/catalog-scope.service.js +1196 -0
- package/dist/catalog/catalog.module.d.ts +12 -0
- package/dist/catalog/catalog.module.js +81 -0
- package/dist/catalog/catalog.service.d.ts +144 -207
- package/dist/catalog/catalog.service.js +258 -528
- package/dist/catalog/claude/agents.js +15 -10
- package/dist/catalog/claude/translate.js +3 -0
- package/dist/catalog/cli.d.ts +14 -3
- package/dist/catalog/cli.js +39 -32
- package/dist/catalog/component-promotion.d.ts +96 -0
- package/dist/catalog/component-promotion.js +395 -0
- package/dist/catalog/component-scope.controller.d.ts +90 -0
- package/dist/catalog/component-scope.controller.js +234 -0
- package/dist/catalog/component-scope.schemas.d.ts +118 -0
- package/dist/catalog/component-scope.schemas.js +97 -0
- package/dist/catalog/component-scope.service.d.ts +366 -0
- package/dist/catalog/component-scope.service.js +1115 -0
- package/dist/catalog/component-state.d.ts +197 -0
- package/dist/catalog/component-state.js +473 -0
- package/dist/catalog/git-source.d.ts +9 -1
- package/dist/catalog/git-source.js +29 -2
- package/dist/catalog/job-ids.d.ts +45 -0
- package/dist/catalog/job-ids.js +40 -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/marketplace-fetch.d.ts +1 -1
- package/dist/catalog/marketplace-icons.d.ts +64 -0
- package/dist/catalog/marketplace-icons.js +131 -0
- package/dist/catalog/marketplaces.controller.d.ts +53 -44
- package/dist/catalog/marketplaces.controller.js +146 -51
- package/dist/catalog/marketplaces.schemas.d.ts +48 -0
- package/dist/catalog/marketplaces.schemas.js +53 -0
- package/dist/catalog/marketplaces.service.d.ts +136 -26
- package/dist/catalog/marketplaces.service.js +663 -281
- package/dist/catalog/org-catalog.controller.d.ts +115 -63
- package/dist/catalog/org-catalog.controller.js +207 -100
- package/dist/catalog/org-catalog.schemas.d.ts +88 -0
- package/dist/catalog/org-catalog.schemas.js +93 -0
- package/dist/catalog/org-catalog.service.d.ts +89 -216
- package/dist/catalog/org-catalog.service.js +434 -472
- package/dist/catalog/org-extension-switch.d.ts +41 -0
- package/dist/catalog/org-extension-switch.js +115 -0
- package/dist/catalog/org-extension.controller.d.ts +113 -0
- package/dist/catalog/org-extension.controller.js +271 -0
- package/dist/catalog/org-extension.schemas.d.ts +15 -0
- package/dist/catalog/org-extension.schemas.js +22 -0
- package/dist/catalog/org-plugin-uploads.controller.d.ts +77 -0
- package/dist/catalog/org-plugin-uploads.controller.js +200 -0
- package/dist/catalog/org-plugin-uploads.d.ts +71 -0
- package/dist/catalog/org-plugin-uploads.js +122 -0
- package/dist/catalog/org-plugin-uploads.schemas.d.ts +20 -0
- package/dist/catalog/org-plugin-uploads.schemas.js +32 -0
- package/dist/catalog/owned-items.d.ts +188 -0
- package/dist/catalog/owned-items.js +808 -0
- package/dist/catalog/owned-plugin-cleanup.d.ts +56 -0
- package/dist/catalog/owned-plugin-cleanup.js +194 -0
- package/dist/catalog/ownership.d.ts +172 -0
- package/dist/catalog/ownership.js +326 -0
- package/dist/catalog/platform-components.d.ts +243 -0
- package/dist/catalog/platform-components.js +872 -0
- package/dist/catalog/platform-migration.d.ts +115 -0
- package/dist/catalog/platform-migration.js +583 -0
- package/dist/catalog/plugin-import.d.ts +293 -71
- package/dist/catalog/plugin-import.js +1039 -281
- package/dist/catalog/plugin-install.d.ts +271 -66
- package/dist/catalog/plugin-install.js +1198 -344
- package/dist/catalog/plugin-package.d.ts +41 -4
- package/dist/catalog/plugin-package.js +140 -7
- package/dist/catalog/plugin-upgrade.d.ts +312 -188
- package/dist/catalog/plugin-upgrade.js +1371 -1065
- package/dist/catalog/request-rules.d.ts +65 -0
- package/dist/catalog/request-rules.js +217 -0
- package/dist/catalog/requests.service.d.ts +205 -117
- package/dist/catalog/requests.service.js +612 -369
- package/dist/catalog/reserved-names.d.ts +8 -0
- package/dist/catalog/reserved-names.js +42 -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 +7 -0
- package/dist/catalog/scope-sync-workers.js +29 -0
- package/dist/catalog/scope-sync.d.ts +176 -0
- package/dist/catalog/scope-sync.js +576 -0
- package/dist/catalog/scope.d.ts +42 -0
- package/dist/catalog/scope.js +42 -0
- package/dist/catalog/unshare.d.ts +22 -0
- package/dist/catalog/unshare.js +119 -0
- package/dist/channels/actions.d.ts +6 -4
- package/dist/channels/actions.js +11 -4
- package/dist/channels/cards.d.ts +33 -11
- package/dist/channels/cards.js +96 -24
- package/dist/channels/channels.module.d.ts +40 -0
- package/dist/channels/channels.module.js +130 -0
- package/dist/channels/channels.schemas.d.ts +37 -0
- package/dist/channels/channels.schemas.js +38 -0
- package/dist/channels/connections.controller.d.ts +44 -37
- package/dist/channels/connections.controller.js +83 -38
- package/dist/channels/connections.service.d.ts +101 -30
- package/dist/channels/connections.service.js +380 -147
- package/dist/channels/inbound.d.ts +44 -38
- package/dist/channels/inbound.js +190 -44
- 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 +71 -80
- package/dist/channels/outbound.js +219 -202
- package/dist/channels/phrases.d.ts +33 -2
- package/dist/channels/phrases.js +29 -1
- package/dist/channels/supervisor.d.ts +88 -46
- package/dist/channels/supervisor.js +230 -132
- package/dist/channels/threads.d.ts +34 -8
- package/dist/channels/threads.js +79 -13
- package/dist/channels/webhook.d.ts +20 -14
- package/dist/channels/webhook.js +51 -20
- package/dist/config/docs.js +5 -1
- 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 +36 -2
- package/dist/config/schema.js +226 -25
- package/dist/conversations/access.d.ts +31 -0
- package/dist/conversations/access.js +110 -0
- package/dist/conversations/agent-tree.d.ts +46 -0
- package/dist/conversations/agent-tree.js +92 -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 +60 -22
- package/dist/conversations/attachments.service.js +249 -51
- package/dist/conversations/conversations.controller.d.ts +86 -50
- package/dist/conversations/conversations.controller.js +184 -103
- package/dist/conversations/conversations.module.d.ts +8 -0
- package/dist/conversations/conversations.module.js +72 -0
- package/dist/conversations/conversations.schemas.d.ts +52 -0
- package/dist/conversations/conversations.schemas.js +79 -0
- package/dist/conversations/conversations.service.d.ts +166 -49
- package/dist/conversations/conversations.service.js +383 -179
- package/dist/conversations/environment-status.d.ts +24 -0
- package/dist/conversations/environment-status.js +71 -0
- package/dist/conversations/event-log.d.ts +64 -27
- package/dist/conversations/event-log.js +167 -31
- package/dist/conversations/events.d.ts +252 -9
- package/dist/conversations/events.js +243 -32
- 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/message-context.d.ts +79 -0
- package/dist/conversations/message-context.js +145 -0
- package/dist/conversations/outputs-read.d.ts +11 -11
- package/dist/conversations/outputs-read.js +31 -7
- package/dist/conversations/queue.d.ts +53 -58
- package/dist/conversations/queue.js +37 -293
- package/dist/conversations/queue.service.d.ts +60 -0
- package/dist/conversations/queue.service.js +350 -0
- package/dist/conversations/titles.d.ts +83 -27
- package/dist/conversations/titles.js +195 -71
- package/dist/conversations/tree.d.ts +17 -0
- package/dist/conversations/tree.js +42 -0
- package/dist/ctx/bus.js +9 -3
- package/dist/ctx/create-ctx.d.ts +26 -1
- package/dist/ctx/create-ctx.js +45 -16
- 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 +589 -27
- package/dist/db/pool.d.ts +10 -0
- package/dist/db/pool.js +4 -0
- package/dist/devices/device-auth.controller.d.ts +42 -0
- package/dist/devices/device-auth.controller.js +116 -0
- package/dist/devices/device-auth.d.ts +119 -0
- package/dist/devices/device-auth.js +403 -0
- package/dist/devices/device-auth.module.d.ts +7 -0
- package/dist/devices/device-auth.module.js +25 -0
- package/dist/devices/device-gateway.d.ts +128 -0
- package/dist/devices/device-gateway.js +530 -0
- package/dist/devices/device-provider.d.ts +89 -0
- package/dist/devices/device-provider.js +151 -0
- package/dist/devices/device-routes.d.ts +36 -0
- package/dist/devices/device-routes.js +90 -0
- package/dist/devices/devices.module.d.ts +16 -0
- package/dist/devices/devices.module.js +44 -0
- package/dist/devices/dto.d.ts +66 -0
- package/dist/devices/dto.js +44 -0
- package/dist/devices/keys.d.ts +25 -0
- package/dist/devices/keys.js +25 -0
- package/dist/devices/machines.d.ts +118 -0
- package/dist/devices/machines.js +366 -0
- package/dist/devices/relay.d.ts +100 -0
- package/dist/devices/relay.js +373 -0
- package/dist/devices/targets.d.ts +28 -0
- package/dist/devices/targets.js +73 -0
- package/dist/environments/access.d.ts +66 -0
- package/dist/environments/access.js +113 -0
- package/dist/environments/conversation-environments.d.ts +75 -0
- package/dist/environments/conversation-environments.js +231 -0
- package/dist/environments/dto.d.ts +25 -0
- package/dist/environments/dto.js +12 -0
- package/dist/environments/environments.controller.d.ts +36 -0
- package/dist/environments/environments.controller.js +124 -0
- package/dist/environments/environments.module.d.ts +8 -0
- package/dist/environments/environments.module.js +31 -0
- package/dist/environments/environments.schemas.d.ts +3 -0
- package/dist/environments/environments.schemas.js +14 -0
- package/dist/environments/environments.service.d.ts +251 -0
- package/dist/environments/environments.service.js +791 -0
- package/dist/environments/label.d.ts +11 -0
- package/dist/environments/label.js +25 -0
- package/dist/environments/legacy-cleanup.job.d.ts +34 -0
- package/dist/environments/legacy-cleanup.job.js +141 -0
- package/dist/errors.d.ts +160 -2
- package/dist/errors.js +160 -2
- 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/evals.schemas.d.ts +110 -0
- package/dist/evals/evals.schemas.js +107 -0
- package/dist/evals/jobs.d.ts +20 -0
- package/dist/evals/jobs.js +45 -0
- package/dist/evals/reconstruct.d.ts +18 -9
- package/dist/evals/reconstruct.js +36 -10
- package/dist/evals/recorded-tools.d.ts +37 -1
- package/dist/evals/recorded-tools.js +120 -10
- package/dist/evals/run-replay.d.ts +75 -10
- package/dist/evals/run-replay.js +218 -94
- package/dist/evals/runs.controller.d.ts +3 -58
- package/dist/evals/runs.controller.js +18 -50
- package/dist/evals/runs.service.d.ts +31 -52
- package/dist/evals/runs.service.js +281 -255
- package/dist/evals/sets.controller.d.ts +3 -29
- package/dist/evals/sets.controller.js +18 -39
- package/dist/evals/sets.service.d.ts +29 -13
- package/dist/evals/sets.service.js +262 -202
- package/dist/evals/snapshot.d.ts +5 -4
- package/dist/evals/snapshot.js +17 -4
- package/dist/evals/step-replay.d.ts +6 -8
- package/dist/evals/step-replay.js +17 -10
- 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.js +1 -1
- package/dist/evals/trajectory.service.d.ts +13 -7
- package/dist/evals/trajectory.service.js +56 -21
- package/dist/evals/worker.d.ts +48 -31
- package/dist/evals/worker.js +229 -124
- package/dist/extensions/admin-ops.d.ts +133 -41
- package/dist/extensions/admin-ops.js +378 -172
- package/dist/extensions/admin-view.d.ts +82 -32
- package/dist/extensions/admin-view.js +284 -71
- package/dist/extensions/approvals.d.ts +24 -10
- package/dist/extensions/approvals.js +73 -46
- package/dist/extensions/blobs.d.ts +27 -10
- package/dist/extensions/blobs.js +112 -45
- package/dist/extensions/bootstrap.d.ts +99 -36
- package/dist/extensions/bootstrap.js +290 -134
- package/dist/extensions/cli.d.ts +32 -10
- package/dist/extensions/cli.js +52 -98
- package/dist/extensions/config-hash.d.ts +10 -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 +124 -58
- 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 +146 -70
- package/dist/extensions/deployment-config.js +439 -246
- package/dist/extensions/display-name.d.ts +22 -0
- package/dist/extensions/display-name.js +77 -0
- package/dist/extensions/effective-config.d.ts +127 -0
- package/dist/extensions/effective-config.js +368 -0
- package/dist/extensions/enabled.d.ts +5 -5
- package/dist/extensions/extensions.module.d.ts +8 -0
- package/dist/extensions/extensions.module.js +96 -0
- package/dist/extensions/hooks.d.ts +40 -6
- package/dist/extensions/hooks.js +83 -17
- package/dist/extensions/host.d.ts +161 -80
- package/dist/extensions/host.js +505 -213
- package/dist/extensions/installs.d.ts +73 -19
- package/dist/extensions/installs.js +174 -37
- 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 +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 +141 -49
- package/dist/extensions/org-config.js +471 -243
- package/dist/extensions/org-levels.d.ts +37 -0
- package/dist/extensions/org-levels.js +71 -0
- package/dist/extensions/org-overrides.d.ts +151 -0
- package/dist/extensions/org-overrides.js +524 -0
- package/dist/extensions/package.d.ts +14 -1
- package/dist/extensions/package.js +51 -2
- package/dist/extensions/permission-view.d.ts +59 -6
- package/dist/extensions/permission-view.js +7 -5
- package/dist/extensions/plugin-guides.d.ts +129 -0
- package/dist/extensions/plugin-guides.js +283 -0
- package/dist/extensions/plugin-icons.d.ts +54 -0
- package/dist/extensions/plugin-icons.js +125 -0
- package/dist/extensions/plugin-items.d.ts +21 -0
- package/dist/extensions/plugin-items.js +42 -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 +73 -0
- package/dist/extensions/point-defaults.js +236 -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 +91 -4
- package/dist/extensions/resolve.d.ts +51 -1
- package/dist/extensions/resolve.js +85 -3
- package/dist/extensions/single-provider.d.ts +92 -0
- package/dist/extensions/single-provider.js +180 -0
- package/dist/extensions/sources.d.ts +19 -10
- package/dist/extensions/sources.js +34 -13
- package/dist/extensions/state.module.d.ts +9 -0
- package/dist/extensions/state.module.js +38 -0
- package/dist/extensions/unavailable.d.ts +50 -0
- package/dist/extensions/unavailable.js +115 -0
- 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 +19 -12
- package/dist/files/previewers.d.ts +21 -19
- package/dist/files/previewers.js +114 -38
- package/dist/files/previewers.schemas.d.ts +10 -0
- package/dist/files/previewers.schemas.js +9 -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 +93 -358
- package/dist/http/app.d.ts +22 -17
- package/dist/http/app.js +46 -65
- 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/http/{gateway.module.d.ts → gateway-routes.d.ts} +7 -3
- package/dist/http/gateway-routes.js +16 -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 +4 -1
- package/dist/http/plugin-dispatch.js +14 -2
- package/dist/identity/accounts.d.ts +137 -38
- package/dist/identity/accounts.js +386 -186
- package/dist/identity/api-tokens.d.ts +11 -7
- package/dist/identity/api-tokens.js +71 -44
- package/dist/identity/audit.d.ts +9 -5
- package/dist/identity/audit.js +5 -1
- package/dist/identity/auth.controller.d.ts +11 -10
- package/dist/identity/auth.controller.js +40 -30
- package/dist/identity/auth.guard.d.ts +16 -8
- package/dist/identity/auth.guard.js +41 -13
- package/dist/identity/binding.d.ts +9 -11
- package/dist/identity/binding.js +41 -13
- package/dist/identity/cookies.d.ts +26 -5
- package/dist/identity/cookies.js +58 -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 +19 -15
- package/dist/identity/external.js +163 -125
- package/dist/identity/identity.module.d.ts +6 -0
- package/dist/identity/identity.module.js +59 -0
- package/dist/identity/initial-passwords.controller.d.ts +22 -0
- package/dist/identity/initial-passwords.controller.js +49 -0
- package/dist/identity/initial-passwords.d.ts +61 -0
- package/dist/identity/initial-passwords.job.d.ts +16 -0
- package/dist/identity/initial-passwords.job.js +46 -0
- package/dist/identity/initial-passwords.js +159 -0
- package/dist/identity/me.controller.d.ts +32 -15
- package/dist/identity/me.controller.js +80 -33
- package/dist/identity/me.schemas.d.ts +24 -0
- package/dist/identity/me.schemas.js +25 -0
- package/dist/identity/principal.d.ts +11 -3
- package/dist/identity/principal.js +11 -3
- package/dist/identity/sessions.d.ts +24 -10
- package/dist/identity/sessions.js +119 -42
- package/dist/identity/settings.d.ts +69 -23
- package/dist/identity/settings.js +201 -72
- 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/identity/super-admin.d.ts +20 -0
- package/dist/identity/super-admin.js +81 -0
- package/dist/inbox/inbox.module.d.ts +6 -0
- package/dist/inbox/inbox.module.js +26 -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 +68 -11
- package/dist/inbox/inbox.service.js +104 -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 +151 -0
- package/dist/inbox/platform-inbox.service.js +263 -0
- package/dist/inbox/platform-notices.d.ts +19 -0
- package/dist/inbox/platform-notices.js +9 -0
- package/dist/index.d.ts +22 -13
- package/dist/index.js +16 -7
- 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 +173 -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 +157 -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 +91 -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 +121 -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 +90 -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 +18 -0
- package/dist/infra/logging/logging.module.js +52 -0
- package/dist/infra/queue/add-job-once.d.ts +14 -0
- package/dist/infra/queue/add-job-once.js +16 -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 +13 -0
- package/dist/infra/queue/redis-connection.js +25 -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 +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 +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 +36 -0
- package/dist/infra/throttler/named-throttlers.js +157 -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 +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 +145 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +140 -0
- package/dist/lifecycle/kernel-lifecycle.js +465 -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/models/embeddings.d.ts +82 -0
- package/dist/models/embeddings.js +326 -0
- package/dist/models/enablement.controller.d.ts +40 -0
- package/dist/models/enablement.controller.js +74 -0
- package/dist/models/enablement.d.ts +101 -0
- package/dist/models/enablement.js +264 -0
- package/dist/models/models.module.d.ts +7 -0
- package/dist/models/models.module.js +36 -0
- package/dist/models/org-models.schemas.d.ts +8 -0
- package/dist/models/org-models.schemas.js +22 -0
- package/dist/models/prices.d.ts +13 -5
- package/dist/models/prices.js +69 -39
- package/dist/models/purposes.controller.d.ts +6 -4
- package/dist/models/purposes.controller.js +16 -11
- package/dist/models/purposes.d.ts +103 -23
- package/dist/models/purposes.js +208 -77
- 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 +74 -35
- package/dist/orgs/directory-sync.js +243 -132
- 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 +61 -60
- package/dist/orgs/offboarding.js +206 -95
- package/dist/orgs/org-lock.d.ts +33 -19
- package/dist/orgs/org-lock.js +94 -35
- package/dist/orgs/org.guard.d.ts +11 -1
- package/dist/orgs/org.guard.js +45 -34
- package/dist/orgs/orgs.controller.d.ts +13 -16
- package/dist/orgs/orgs.controller.js +29 -20
- package/dist/orgs/orgs.module.d.ts +6 -0
- package/dist/orgs/orgs.module.js +71 -0
- package/dist/orgs/orgs.schemas.d.ts +8 -0
- package/dist/orgs/orgs.schemas.js +16 -0
- package/dist/orgs/orgs.service.d.ts +47 -21
- package/dist/orgs/orgs.service.js +166 -91
- package/dist/orgs/roles.d.ts +1 -1
- package/dist/orgs/roles.js +5 -1
- package/dist/orgs/settings.controller.d.ts +2 -2
- package/dist/orgs/settings.controller.js +8 -6
- package/dist/orgs/settings.service.d.ts +76 -14
- package/dist/orgs/settings.service.js +140 -51
- package/dist/overrides.d.ts +63 -0
- package/dist/overrides.js +34 -0
- package/dist/platform/actor.d.ts +48 -0
- package/dist/platform/actor.js +100 -0
- package/dist/platform/agent-docs.d.ts +18 -0
- package/dist/platform/agent-docs.js +59 -0
- package/dist/platform/availability.d.ts +14 -0
- package/dist/platform/availability.js +43 -0
- package/dist/platform/errors.d.ts +28 -0
- package/dist/platform/errors.js +65 -0
- package/dist/platform/exclusions.d.ts +11 -0
- package/dist/platform/exclusions.js +683 -0
- package/dist/platform/method.d.ts +6 -0
- package/dist/platform/method.js +15 -0
- package/dist/platform/operation.d.ts +169 -0
- package/dist/platform/operation.js +94 -0
- package/dist/platform/ops/accounts.ops.d.ts +32 -0
- package/dist/platform/ops/accounts.ops.js +291 -0
- package/dist/platform/ops/admin.ops.d.ts +38 -0
- package/dist/platform/ops/admin.ops.js +407 -0
- package/dist/platform/ops/agent-skills.ops.d.ts +24 -0
- package/dist/platform/ops/agent-skills.ops.js +226 -0
- package/dist/platform/ops/agent-templates.ops.d.ts +17 -0
- package/dist/platform/ops/agent-templates.ops.js +272 -0
- package/dist/platform/ops/agents.ops.d.ts +37 -0
- package/dist/platform/ops/agents.ops.js +717 -0
- package/dist/platform/ops/approvals.ops.d.ts +30 -0
- package/dist/platform/ops/approvals.ops.js +116 -0
- package/dist/platform/ops/background.ops.d.ts +14 -0
- package/dist/platform/ops/background.ops.js +134 -0
- package/dist/platform/ops/catalog-admin.ops.d.ts +74 -0
- package/dist/platform/ops/catalog-admin.ops.js +599 -0
- package/dist/platform/ops/channels.ops.d.ts +16 -0
- package/dist/platform/ops/channels.ops.js +195 -0
- package/dist/platform/ops/components.ops.d.ts +46 -0
- package/dist/platform/ops/components.ops.js +854 -0
- package/dist/platform/ops/connectors.ops.d.ts +17 -0
- package/dist/platform/ops/connectors.ops.js +188 -0
- package/dist/platform/ops/conversations.ops.d.ts +30 -0
- package/dist/platform/ops/conversations.ops.js +470 -0
- package/dist/platform/ops/environments.ops.d.ts +26 -0
- package/dist/platform/ops/environments.ops.js +311 -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 +783 -0
- package/dist/platform/ops/extensions-admin.ops.d.ts +25 -0
- package/dist/platform/ops/extensions-admin.ops.js +372 -0
- package/dist/platform/ops/extensions.ops.d.ts +25 -0
- package/dist/platform/ops/extensions.ops.js +347 -0
- package/dist/platform/ops/inbox.ops.d.ts +25 -0
- package/dist/platform/ops/inbox.ops.js +378 -0
- package/dist/platform/ops/marketplaces.ops.d.ts +22 -0
- package/dist/platform/ops/marketplaces.ops.js +466 -0
- package/dist/platform/ops/models.ops.d.ts +25 -0
- package/dist/platform/ops/models.ops.js +232 -0
- package/dist/platform/ops/org-plugins.ops.d.ts +29 -0
- package/dist/platform/ops/org-plugins.ops.js +329 -0
- package/dist/platform/ops/org-settings.ops.d.ts +18 -0
- package/dist/platform/ops/org-settings.ops.js +127 -0
- package/dist/platform/ops/orgs.ops.d.ts +28 -0
- package/dist/platform/ops/orgs.ops.js +296 -0
- package/dist/platform/ops/other-orgs.d.ts +20 -0
- package/dist/platform/ops/other-orgs.js +72 -0
- package/dist/platform/ops/paging.d.ts +14 -0
- package/dist/platform/ops/paging.js +20 -0
- package/dist/platform/ops/platform.ops.d.ts +30 -0
- package/dist/platform/ops/platform.ops.js +231 -0
- package/dist/platform/ops/plugins.ops.d.ts +35 -0
- package/dist/platform/ops/plugins.ops.js +476 -0
- package/dist/platform/ops/previewers.ops.d.ts +14 -0
- package/dist/platform/ops/previewers.ops.js +109 -0
- package/dist/platform/ops/requests.ops.d.ts +14 -0
- package/dist/platform/ops/requests.ops.js +191 -0
- package/dist/platform/ops/role.d.ts +4 -0
- package/dist/platform/ops/role.js +10 -0
- package/dist/platform/ops/skills.ops.d.ts +17 -0
- package/dist/platform/ops/skills.ops.js +216 -0
- package/dist/platform/ops/summary.d.ts +10 -0
- package/dist/platform/ops/summary.js +18 -0
- package/dist/platform/ops/themes.ops.d.ts +14 -0
- package/dist/platform/ops/themes.ops.js +47 -0
- package/dist/platform/ops/unavailable.d.ts +23 -0
- package/dist/platform/ops/unavailable.js +118 -0
- package/dist/platform/parity.d.ts +33 -0
- package/dist/platform/parity.js +272 -0
- package/dist/platform/platform-ops.module.d.ts +40 -0
- package/dist/platform/platform-ops.module.js +127 -0
- package/dist/platform/platform.module.d.ts +8 -0
- package/dist/platform/platform.module.js +25 -0
- package/dist/platform/registry.d.ts +30 -0
- package/dist/platform/registry.js +111 -0
- package/dist/platform/route-schemas.d.ts +18 -0
- package/dist/platform/route-schemas.js +66 -0
- package/dist/roles/gateway-role.d.ts +54 -0
- package/dist/roles/gateway-role.js +118 -0
- package/dist/roles/gateway.module.d.ts +9 -0
- package/dist/roles/gateway.module.js +31 -0
- package/dist/roles/worker-role.d.ts +65 -0
- package/dist/roles/worker-role.js +151 -0
- package/dist/roles/worker.module.d.ts +14 -0
- package/dist/roles/worker.module.js +106 -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 +21 -13
- package/dist/runtime/context/build.js +106 -29
- package/dist/runtime/context/claude-tools.d.ts +4 -1
- package/dist/runtime/context/claude-tools.js +13 -12
- package/dist/runtime/context/compaction.js +24 -1
- package/dist/runtime/context/environment-paths.d.ts +40 -0
- package/dist/runtime/context/environment-paths.js +48 -0
- package/dist/runtime/context/legacy-text.d.ts +22 -0
- package/dist/runtime/context/legacy-text.js +37 -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 +65 -0
- package/dist/runtime/context/run-context.js +215 -0
- package/dist/runtime/context/skills.d.ts +29 -11
- package/dist/runtime/context/skills.js +46 -32
- package/dist/runtime/context/tool-changes.d.ts +27 -0
- package/dist/runtime/context/tool-changes.js +60 -0
- package/dist/runtime/conversation-lock.d.ts +20 -11
- package/dist/runtime/conversation-lock.js +62 -72
- package/dist/runtime/hook-calls.d.ts +11 -4
- package/dist/runtime/hook-calls.js +41 -13
- package/dist/runtime/job-ids.d.ts +10 -0
- package/dist/runtime/job-ids.js +10 -0
- package/dist/runtime/langgraph-loop.d.ts +3 -1
- package/dist/runtime/langgraph-loop.js +37 -18
- package/dist/runtime/loop.d.ts +42 -6
- 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 +50 -74
- package/dist/runtime/maintenance.js +166 -137
- package/dist/runtime/model-call.d.ts +61 -15
- package/dist/runtime/model-call.js +128 -84
- package/dist/runtime/providers.d.ts +158 -27
- package/dist/runtime/providers.js +373 -63
- 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-context.service.d.ts +65 -0
- package/dist/runtime/run-context.service.js +236 -0
- package/dist/runtime/run-control.d.ts +43 -0
- package/dist/runtime/run-control.js +89 -0
- package/dist/runtime/run-drafts.d.ts +85 -0
- package/dist/runtime/run-drafts.js +230 -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 +46 -0
- package/dist/runtime/run-jobs.js +91 -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 +90 -58
- package/dist/runtime/run-queue.js +566 -297
- package/dist/runtime/run-steps.d.ts +39 -0
- package/dist/runtime/run-steps.js +96 -0
- package/dist/runtime/run-worker.d.ts +134 -77
- package/dist/runtime/run-worker.js +412 -237
- package/dist/runtime/runtime.module.d.ts +10 -0
- package/dist/runtime/runtime.module.js +122 -0
- package/dist/runtime/step-log.d.ts +51 -0
- package/dist/runtime/step-log.js +111 -0
- package/dist/runtime/stream.controller.d.ts +28 -9
- package/dist/runtime/stream.controller.js +72 -13
- package/dist/runtime/stream.d.ts +27 -6
- package/dist/runtime/stream.js +102 -7
- package/dist/runtime/subagents/child.d.ts +58 -51
- package/dist/runtime/subagents/child.js +105 -86
- package/dist/runtime/subagents/definition.d.ts +32 -28
- package/dist/runtime/subagents/definition.js +89 -143
- package/dist/runtime/subagents/deliveries.d.ts +71 -0
- package/dist/runtime/subagents/deliveries.js +228 -0
- package/dist/runtime/subagents/dispatch.d.ts +197 -27
- package/dist/runtime/subagents/dispatch.js +336 -270
- package/dist/runtime/subagents/limits.d.ts +32 -8
- package/dist/runtime/subagents/limits.js +44 -8
- package/dist/runtime/subagents/messages.d.ts +95 -0
- package/dist/runtime/subagents/messages.js +328 -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 +4 -4
- package/dist/runtime/subagents/preamble.js +9 -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 +30 -0
- package/dist/runtime/subagents/render.js +53 -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 +10 -10
- package/dist/runtime/subagents/skill-fork.js +23 -8
- 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/usage-report-jobs.d.ts +88 -0
- package/dist/runtime/usage-report-jobs.js +158 -0
- package/dist/runtime/usage-report.d.ts +121 -83
- package/dist/runtime/usage-report.js +355 -181
- package/dist/runtime/waits.d.ts +258 -81
- package/dist/runtime/waits.js +800 -263
- package/dist/sandbox/job-ids.d.ts +10 -0
- package/dist/sandbox/job-ids.js +10 -0
- package/dist/sandbox/jobs.d.ts +68 -0
- package/dist/sandbox/jobs.js +150 -0
- package/dist/sandbox/leases.d.ts +73 -82
- package/dist/sandbox/leases.js +162 -346
- package/dist/sandbox/providers.d.ts +46 -0
- package/dist/sandbox/providers.js +83 -0
- package/dist/sandbox/sandbox.module.d.ts +9 -0
- package/dist/sandbox/sandbox.module.js +36 -0
- package/dist/sandbox/sandbox.service.d.ts +359 -151
- package/dist/sandbox/sandbox.service.js +950 -435
- package/dist/sandbox/unreachable.d.ts +30 -0
- package/dist/sandbox/unreachable.js +108 -0
- package/dist/skills/catalog.d.ts +40 -26
- package/dist/skills/catalog.js +120 -99
- package/dist/skills/changes.controller.d.ts +11 -4
- package/dist/skills/changes.controller.js +34 -9
- package/dist/skills/changes.service.d.ts +31 -21
- package/dist/skills/changes.service.js +426 -368
- 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 +19 -18
- package/dist/skills/invoke.js +68 -24
- package/dist/skills/package.d.ts +20 -1
- package/dist/skills/package.js +28 -1
- package/dist/skills/skills.controller.d.ts +33 -7
- package/dist/skills/skills.controller.js +79 -12
- package/dist/skills/skills.module.d.ts +6 -0
- package/dist/skills/skills.module.js +39 -0
- package/dist/skills/skills.schemas.d.ts +48 -0
- package/dist/skills/skills.schemas.js +61 -0
- package/dist/skills/skills.service.d.ts +151 -44
- package/dist/skills/skills.service.js +636 -204
- package/dist/skills/usable.d.ts +81 -0
- package/dist/skills/usable.js +379 -0
- 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/themes/render-css.d.ts +12 -0
- package/dist/themes/render-css.js +132 -0
- package/dist/themes/theme-delivery.service.d.ts +34 -0
- package/dist/themes/theme-delivery.service.js +111 -0
- package/dist/themes/theme-state.d.ts +95 -0
- package/dist/themes/theme-state.js +203 -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 +28 -0
- package/dist/themes/themes-public.controller.js +92 -0
- package/dist/themes/themes.controller.d.ts +13 -0
- package/dist/themes/themes.controller.js +38 -0
- package/dist/themes/themes.module.d.ts +3 -0
- package/dist/themes/themes.module.js +21 -0
- package/dist/themes/themes.schemas.d.ts +3 -0
- package/dist/themes/themes.schemas.js +2 -0
- package/dist/themes/themes.service.d.ts +50 -0
- package/dist/themes/themes.service.js +99 -0
- package/dist/time-zone.d.ts +5 -0
- package/dist/time-zone.js +19 -0
- package/dist/tools/approvals.controller.d.ts +1 -1
- package/dist/tools/approvals.controller.js +14 -11
- package/dist/tools/approvals.schemas.d.ts +21 -0
- package/dist/tools/approvals.schemas.js +15 -0
- package/dist/tools/approvals.service.d.ts +53 -27
- package/dist/tools/approvals.service.js +365 -260
- package/dist/tools/breaker.d.ts +2 -2
- package/dist/tools/breaker.js +21 -3
- package/dist/tools/builtin-names.d.ts +109 -0
- package/dist/tools/builtin-names.js +173 -0
- package/dist/tools/builtins/agent.d.ts +27 -25
- package/dist/tools/builtins/agent.js +66 -63
- 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 +41 -0
- package/dist/tools/builtins/builtin-tools.js +151 -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/platform.d.ts +51 -0
- package/dist/tools/builtins/platform.js +451 -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 +293 -41
- package/dist/tools/builtins/sandbox/common.d.ts +137 -37
- package/dist/tools/builtins/sandbox/common.js +222 -62
- package/dist/tools/builtins/sandbox/deliver.d.ts +1 -1
- package/dist/tools/builtins/sandbox/deliver.js +21 -18
- package/dist/tools/builtins/sandbox/edit.d.ts +1 -1
- package/dist/tools/builtins/sandbox/edit.js +65 -51
- 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 +19 -14
- package/dist/tools/builtins/sandbox/grep.d.ts +7 -4
- package/dist/tools/builtins/sandbox/grep.js +155 -36
- package/dist/tools/builtins/sandbox/index.d.ts +9 -5
- package/dist/tools/builtins/sandbox/index.js +13 -5
- package/dist/tools/builtins/sandbox/read.d.ts +2 -2
- package/dist/tools/builtins/sandbox/read.js +30 -20
- package/dist/tools/builtins/sandbox/task-output.d.ts +79 -0
- package/dist/tools/builtins/sandbox/task-output.js +334 -0
- package/dist/tools/builtins/sandbox/task-stop.d.ts +10 -0
- package/dist/tools/builtins/sandbox/task-stop.js +113 -0
- package/dist/tools/builtins/sandbox/write.d.ts +1 -1
- package/dist/tools/builtins/sandbox/write.js +52 -45
- package/dist/tools/builtins/send-message.d.ts +56 -0
- package/dist/tools/builtins/send-message.js +100 -0
- package/dist/tools/builtins/skill-load.d.ts +32 -21
- package/dist/tools/builtins/skill-load.js +125 -74
- package/dist/tools/builtins/skill-write.d.ts +4 -4
- package/dist/tools/builtins/skill-write.js +12 -12
- package/dist/tools/builtins/tool-search.d.ts +13 -9
- package/dist/tools/builtins/tool-search.js +25 -14
- 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 +62 -0
- package/dist/tools/builtins/web/extract.js +271 -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 +210 -0
- package/dist/tools/builtins/web/url.d.ts +17 -0
- package/dist/tools/builtins/web/url.js +43 -0
- 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 +16 -3
- package/dist/tools/connectors.controller.js +34 -14
- package/dist/tools/connectors.schemas.d.ts +12 -0
- package/dist/tools/connectors.schemas.js +19 -0
- package/dist/tools/connectors.service.d.ts +80 -18
- package/dist/tools/connectors.service.js +529 -358
- package/dist/tools/credentials.d.ts +20 -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/extension-tools.controller.d.ts +14 -0
- package/dist/tools/extension-tools.controller.js +37 -0
- package/dist/tools/info.d.ts +73 -13
- package/dist/tools/info.js +151 -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 +45 -10
- package/dist/tools/oauth/tokens.js +70 -24
- package/dist/tools/org-tool-switches.d.ts +88 -0
- package/dist/tools/org-tool-switches.js +201 -0
- package/dist/tools/outputs.d.ts +13 -4
- package/dist/tools/outputs.js +48 -4
- package/dist/tools/pipeline.d.ts +108 -80
- package/dist/tools/pipeline.js +396 -409
- package/dist/tools/policy.d.ts +4 -17
- package/dist/tools/policy.js +49 -35
- 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 +215 -84
- package/dist/tools/registry.js +382 -264
- 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 +113 -0
- package/dist/tools/validate.js +1 -1
- 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 +10 -57
- package/dist/ui/views.js +58 -46
- package/package.json +13 -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/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.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/extensions/host.js
CHANGED
|
@@ -1,67 +1,50 @@
|
|
|
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
|
+
};
|
|
2
10
|
import { readFile } from "node:fs/promises";
|
|
3
11
|
import { createRequire } from "node:module";
|
|
4
12
|
import { dirname, isAbsolute, join, resolve as resolvePath } from "node:path";
|
|
5
13
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
14
|
import { EXTENSION_POINT_CARDINALITY, parseExtensionPoint, SDK_VERSION, } from "@capybara-hq/plugin-sdk";
|
|
7
|
-
import {
|
|
15
|
+
import { Inject, Injectable } from "@nestjs/common";
|
|
16
|
+
import { changedPaths, configFields, secretValues, unreachableSecrets } from "../config/fields.js";
|
|
8
17
|
import { pluginSchemaName, queryEnabledPlugins, } from "../ctx/create-ctx.js";
|
|
9
18
|
import { kernelDb } from "../db/kernel-schema.js";
|
|
10
19
|
import { migrate } from "../db/migrator.js";
|
|
11
20
|
import { createDb } from "../db/pool.js";
|
|
21
|
+
import { waitWithin } from "../infra/close-within.js";
|
|
22
|
+
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
23
|
+
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
24
|
+
import { LockService } from "../infra/lock/lock.service.js";
|
|
25
|
+
import { KERNEL_LOGGER, KEYRING, REDIS, REDIS_SUBSCRIBER } from "../infra/tokens.js";
|
|
26
|
+
import { KERNEL_APP_OPTIONS } from "../lifecycle/tokens.js";
|
|
27
|
+
import { ModelEmbeddings } from "../models/embeddings.js";
|
|
12
28
|
import { packagePath } from "../packages/tgz.js";
|
|
13
|
-
import {
|
|
29
|
+
import { EmbedTokens } from "../ui/embed-token.js";
|
|
30
|
+
import { ExtensionApprovals, planApprovals, readSnapshots, withPreApproved, } from "./approvals.js";
|
|
14
31
|
import { ExtensionBlobIntegrityError } from "./blobs.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
32
|
+
import { deploymentConfigHash } from "./config-hash.js";
|
|
33
|
+
import { toIssues } from "./config-issues.js";
|
|
34
|
+
import { configFormSchema, describeConfigUiProblems } from "./config-json-schema.js";
|
|
35
|
+
import { EffectiveConfigs } from "./effective-config.js";
|
|
36
|
+
import { HookRegistry } from "./hooks.js";
|
|
37
|
+
import { ExtensionInstalls } from "./installs.js";
|
|
38
|
+
import { ImportTracker, importExtensionModule, ManifestMismatchError, matchesSection, setupInstance, warnUpgrades, } from "./instance.js";
|
|
39
|
+
import { parseLoadGate } from "./org-levels.js";
|
|
40
|
+
import { declaredDisplayName, permissionSetOfSection, readMigrationSql } from "./package.js";
|
|
20
41
|
import { blockingKeys, computePermissionSet, UI_VIEW_KEY_PREFIX, } from "./permission-set.js";
|
|
21
42
|
import { ExtensionRegistry } from "./registry.js";
|
|
22
|
-
import { ExtensionResolveError, resolveExtensions } from "./resolve.js";
|
|
43
|
+
import { ExtensionResolveError, electSingleProviders, PROVIDER_CONFLICT, providerConflictMessage, resolveExtensions, } from "./resolve.js";
|
|
44
|
+
import { ReplicaStatusStore, } from "./sources.js";
|
|
23
45
|
import { PackageShaMismatchError, packageRootOf } from "./sync.js";
|
|
24
|
-
|
|
25
|
-
const canonicalJson = (v) => {
|
|
26
|
-
if (Array.isArray(v))
|
|
27
|
-
return `[${v.map((x) => (x === undefined ? "null" : canonicalJson(x))).join(",")}]`;
|
|
28
|
-
if (v !== null && typeof v === "object") {
|
|
29
|
-
const entries = Object.entries(v)
|
|
30
|
-
.filter(([, x]) => x !== undefined)
|
|
31
|
-
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
32
|
-
return `{${entries.map(([k, x]) => `${JSON.stringify(k)}:${canonicalJson(x)}`).join(",")}}`;
|
|
33
|
-
}
|
|
34
|
-
return JSON.stringify(v) ?? "null";
|
|
35
|
-
};
|
|
36
|
-
/** 遮蔽 secret 字段后参与摘要的固定占位值。 */
|
|
37
|
-
const SECRET_PLACEHOLDER = "<secret>";
|
|
38
|
-
/**
|
|
39
|
-
* 插件部署配置(校验后)中非密钥部分的摘要:先把 schema 里所有 secret 叶子(`configFields` 可达路径,
|
|
40
|
-
* 加载时 `assertSecretsReachable` 已保证密钥都在这些路径上)换成固定占位值,再取 sha256(键排序 JSON) 前 16 位十六进制。
|
|
41
|
-
* 给需要「配置变了就失效」的缓存键用(如模型列表)。密钥不参与摘要:不加盐的短摘要写进 Redis 键名后,
|
|
42
|
-
* 低熵密钥可被离线猜测、泄露的密钥可被确认;代价是轮换密钥不会让缓存失效(缓存内容本来就不该依赖密钥)。
|
|
43
|
-
* 没有部署配置 schema 时无从得知哪些是密钥,摘要不按配置区分。同一份配置在各副本上得到同一摘要。
|
|
44
|
-
* 函数自己按 schema 遮蔽,调用方不必(也不能忘记)先打码。
|
|
45
|
-
*/
|
|
46
|
-
export function deploymentConfigHash(schema, config) {
|
|
47
|
-
let redacted = null;
|
|
48
|
-
if (schema) {
|
|
49
|
-
redacted = structuredClone(config);
|
|
50
|
-
if (redacted !== null && typeof redacted === "object") {
|
|
51
|
-
for (const f of configFields(schema)) {
|
|
52
|
-
if (f.meta?.secret && getPath(redacted, f.path) !== undefined) {
|
|
53
|
-
setPath(redacted, f.path, SECRET_PLACEHOLDER);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return createHash("sha256").update(canonicalJson(redacted)).digest("hex").slice(0, 16);
|
|
59
|
-
}
|
|
46
|
+
export { deploymentConfigHash };
|
|
60
47
|
const CLOSED_DURING_LOAD = "plugin host closed during load";
|
|
61
|
-
/** 撤销实例时在途调用的默认排空时限(`extensionHost.drainSeconds` 的默认值)。 */
|
|
62
|
-
const DEFAULT_DRAIN_MS = 30_000;
|
|
63
|
-
/** 运行中重新加载时 setup 的默认时限(`extensionHost.reloadSetupTimeoutSeconds` 的默认值)。 */
|
|
64
|
-
const DEFAULT_RELOAD_SETUP_TIMEOUT_MS = 60_000;
|
|
65
48
|
/** 停机时等进行中的 unload / reload 的上限(之后直接关闭 setup 中的 ctx、撤销其余实例)。 */
|
|
66
49
|
const CLOSE_LIFECYCLE_WAIT_MS = 2_000;
|
|
67
50
|
/** 部署已知插件名(配置声明 / 安装记录)缓存的有效期:路由闸门 503 / 404 用,跨副本靠它收敛。 */
|
|
@@ -148,8 +131,31 @@ async function permissionSets(ordered, dirs) {
|
|
|
148
131
|
}
|
|
149
132
|
return sets;
|
|
150
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* The single-provider extension points `manifest` provides that `others` already provide, with
|
|
136
|
+
* those providers (a `conflict` pending's {@link PendingExtension.conflicts}).
|
|
137
|
+
*/
|
|
138
|
+
function conflictsOf(manifest, others) {
|
|
139
|
+
return manifest.provides
|
|
140
|
+
.filter((ref) => EXTENSION_POINT_CARDINALITY[parseExtensionPoint(ref).name] === "single")
|
|
141
|
+
.map((extensionPoint) => ({
|
|
142
|
+
extensionPoint,
|
|
143
|
+
providers: others
|
|
144
|
+
.filter((m) => m.name !== manifest.name && m.provides.includes(extensionPoint))
|
|
145
|
+
.map((m) => m.name),
|
|
146
|
+
}))
|
|
147
|
+
.filter((c) => c.providers.length > 0);
|
|
148
|
+
}
|
|
149
|
+
/** The replica status reason of a pending extension (`new` / `added` are both `approval`). */
|
|
150
|
+
function pendingReasonOf(p) {
|
|
151
|
+
return p.reason === "dependency" || p.reason === "conflict" ? p.reason : "approval";
|
|
152
|
+
}
|
|
151
153
|
/** 待批准插件的 warn 日志:点名插件、原因与新增项(依赖原因写明阻塞的能力与提供方)。 */
|
|
152
154
|
function warnPending(log, p) {
|
|
155
|
+
if (p.reason === "conflict") {
|
|
156
|
+
log.warn("extension not loaded: it provides a single-provider extension point another extension already provides (disable that one and this one loads, no restart)", { plugin: p.plugin, version: p.version, conflicts: p.conflicts });
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
153
159
|
if (p.reason === "dependency") {
|
|
154
160
|
const missing = (p.blockedBy ?? []).some((b) => b.providers.length === 0);
|
|
155
161
|
log.warn(missing
|
|
@@ -157,7 +163,7 @@ function warnPending(log, p) {
|
|
|
157
163
|
: "extension not loaded: a required extension point is only provided by extensions awaiting permission approval", { plugin: p.plugin, version: p.version, blockedBy: p.blockedBy });
|
|
158
164
|
return;
|
|
159
165
|
}
|
|
160
|
-
log.warn("extension not loaded: permissions awaiting approval (
|
|
166
|
+
log.warn("extension not loaded: permissions awaiting approval (a super admin approves it in the admin console, or run `capybara extensions review`, then `capybara extensions approve <name>`; running replicas load it without a restart)", { plugin: p.plugin, version: p.version, reason: p.reason, added: p.added, removed: p.removed });
|
|
161
167
|
}
|
|
162
168
|
/**
|
|
163
169
|
* 跑单个插件的迁移(`migrationsDir` 为迁移目录的绝对路径;没有迁移时为 undefined);返回已应用的文件,
|
|
@@ -212,16 +218,15 @@ function manifestOfSection(m) {
|
|
|
212
218
|
},
|
|
213
219
|
};
|
|
214
220
|
}
|
|
215
|
-
/** 内核消费的提供方能力:调用计入提供方实例的在途计数(撤销 / 升级时排空,C17)。 */
|
|
216
|
-
const TRACKED_EXTENSION_POINTS = {
|
|
217
|
-
connector: { sessions: ["open"] },
|
|
218
|
-
sandbox: {},
|
|
219
|
-
"model-provider": {},
|
|
220
|
-
};
|
|
221
221
|
/** 插件宿主:解析、校验配置、迁移、setup,并登记插件提供的能力与路由。 */
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
let ExtensionHost = class ExtensionHost {
|
|
223
|
+
registry;
|
|
224
|
+
installs;
|
|
225
|
+
approvals;
|
|
226
|
+
status;
|
|
227
|
+
config;
|
|
228
|
+
log;
|
|
229
|
+
effective;
|
|
225
230
|
/**
|
|
226
231
|
* Only resolves extensions and runs migrations in dependency order: no deployment config check, no
|
|
227
232
|
* setup, no Redis (for `capybara migrate`). Like `load()` it checks secret markers first
|
|
@@ -245,7 +250,7 @@ export class ExtensionHost {
|
|
|
245
250
|
const raw = createDb(opts.dbUrl, 1, () => { }, { connectTimeoutMs: opts.connectTimeoutMs });
|
|
246
251
|
let decisions;
|
|
247
252
|
try {
|
|
248
|
-
decisions = planApprovals(ordered, sets, await
|
|
253
|
+
decisions = planApprovals(ordered, sets, await readSnapshots(kernelDb(raw)));
|
|
249
254
|
}
|
|
250
255
|
finally {
|
|
251
256
|
await raw.destroy();
|
|
@@ -286,15 +291,19 @@ export class ExtensionHost {
|
|
|
286
291
|
for (const manifest of ordered)
|
|
287
292
|
assertSecretsReachable(manifest);
|
|
288
293
|
const sets = await permissionSets(ordered, dirs);
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
manifest
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
294
|
+
const out = [];
|
|
295
|
+
for (const manifest of ordered) {
|
|
296
|
+
const dir = dirs.get(manifest.name);
|
|
297
|
+
out.push({
|
|
298
|
+
source: "config",
|
|
299
|
+
manifest,
|
|
300
|
+
dir,
|
|
301
|
+
permissions: sets.get(manifest.name),
|
|
302
|
+
displayName: (await declaredDisplayName(dir, manifest.name)).displayName ?? null,
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
return out;
|
|
295
306
|
}
|
|
296
|
-
/** 本进程生效的插件实例(C17):消费方每次实时取,不缓存实现对象。 */
|
|
297
|
-
registry = new ExtensionRegistry();
|
|
298
307
|
/**
|
|
299
308
|
* M-1: plugin → mount points where deployment state expects `policy` hooks. A per-replica copy of PG
|
|
300
309
|
* deployment state (like the registry), rebuilt on every load / converge, never written elsewhere.
|
|
@@ -316,10 +325,6 @@ export class ExtensionHost {
|
|
|
316
325
|
imports = new ImportTracker();
|
|
317
326
|
/** 串行化 unload / reload(同一时刻只做一件,依赖方的连锁处理不交错)。 */
|
|
318
327
|
lifecycle = Promise.resolve();
|
|
319
|
-
drainMs;
|
|
320
|
-
disposeTimeoutMs;
|
|
321
|
-
reloadSetupTimeoutMs;
|
|
322
|
-
installedNames;
|
|
323
328
|
/** 安装记录里的插件名缓存(TTL + 注册表变化时作废)。 */
|
|
324
329
|
installedCache;
|
|
325
330
|
/** 本次因权限待批准(或依赖待批准插件)而未加载的插件。 */
|
|
@@ -329,6 +334,11 @@ export class ExtensionHost {
|
|
|
329
334
|
* 安装记录不在这里:每次 converge 都按 PG 期望状态重新判定。
|
|
330
335
|
*/
|
|
331
336
|
pendingActivations = new Map();
|
|
337
|
+
/**
|
|
338
|
+
* The load parameters of each config-declared extension that loaded: when its deployment config
|
|
339
|
+
* is cleared and the rest is invalid it goes back to {@link pendingActivations} (pending config).
|
|
340
|
+
*/
|
|
341
|
+
declaredActivations = new Map();
|
|
332
342
|
/** 安装记录准备好的候选(按插件名;sha 变了就作废)。 */
|
|
333
343
|
prepared = new Map();
|
|
334
344
|
/** 闸门放行后导入过的安装记录真实清单(按插件名;部署配置 schema 用,含待配置而未加载的)。 */
|
|
@@ -345,6 +355,11 @@ export class ExtensionHost {
|
|
|
345
355
|
retiring = new Map();
|
|
346
356
|
/** 配置声明插件的清单与权限集合(含未加载的;后台列表与网页批准用)。 */
|
|
347
357
|
declaredInfo = new Map();
|
|
358
|
+
/**
|
|
359
|
+
* Config-declared extensions' display names, read from their plugin directory's plugin.json at
|
|
360
|
+
* load (from the startup config, the same on every replica; never written elsewhere).
|
|
361
|
+
*/
|
|
362
|
+
declaredDisplayNames = new Map();
|
|
348
363
|
/** 导入过的插件名 → 来源与包(含未加载的;重名被跳过的一方不在这里)。 */
|
|
349
364
|
sources = new Map();
|
|
350
365
|
didLoad = false;
|
|
@@ -358,53 +373,124 @@ export class ExtensionHost {
|
|
|
358
373
|
/** 已创建、尚未登记(setup 进行中)的 ctx:close() 时立即关闭,不等 setup 返回。 */
|
|
359
374
|
settingUp;
|
|
360
375
|
resolveFrom;
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
status;
|
|
364
|
-
storedConfig;
|
|
376
|
+
/** What every extension's `ctx` is built from (kernel side only; nothing Nest crosses into `ctx`). */
|
|
377
|
+
deps;
|
|
365
378
|
/** 配置声明插件的部署配置最近一次判定是否合法(后台列表用;没判定过时按启动配置校验)。 */
|
|
366
379
|
configValidity = new Map();
|
|
367
380
|
/** 已告警过的「部署配置不合法」(插件名 → 说明;每个周期都会重新判定,同一说明只告警一次)。 */
|
|
368
381
|
configWarned = new Map();
|
|
382
|
+
/** `<name>@<version>` whose invalid config UI hints were warned about (a log dedupe only). */
|
|
383
|
+
configUiWarned = new Set();
|
|
384
|
+
/**
|
|
385
|
+
* The host builds each extension's `ctx` from the injected kernel services: the pool for
|
|
386
|
+
* `ctx.db` on the extension's schema, Redis for `kv` / `lock` / `bus` and the queues, the
|
|
387
|
+
* keyring for `secrets`. The config is read per call (`extensionConfig`, the drain and setup
|
|
388
|
+
* time limits, `extensionPermissions.autoApprove`).
|
|
389
|
+
*
|
|
390
|
+
* `KERNEL_APP_OPTIONS.resolveFrom`: the directory bare package names are resolved from, default
|
|
391
|
+
* `process.cwd()`; a relative path is made absolute against the cwd at construction. Absolute
|
|
392
|
+
* paths and `file:` URL extension specifiers are used as they are; bare package names are
|
|
393
|
+
* resolved with `createRequire(<resolveFrom>/noop.js).resolve`, so an extension package's exports
|
|
394
|
+
* must expose the `default` (or `require`) condition.
|
|
395
|
+
*/
|
|
396
|
+
constructor(
|
|
397
|
+
/** The process's extension registry (one provider, shared with other domains). */
|
|
398
|
+
registry,
|
|
369
399
|
/**
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
* extension package's exports must expose the `default` (or `require`) condition.
|
|
375
|
-
* @param opts.autoApprove Approve extension permissions automatically (config
|
|
376
|
-
* `extensionPermissions.autoApprove`, development and trials only): extensions needing approval write a
|
|
377
|
-
* snapshot with source auto and load as usual. Default false: extensions pending approval do not
|
|
378
|
-
* load (see {@link pending}).
|
|
379
|
-
* @param opts.status This replica's load status table (`extension_replica_status`): every
|
|
380
|
-
* extension's load result writes a row.
|
|
400
|
+
* The deployment's desired state (one way, spec §3): install record names (with the
|
|
401
|
+
* config-declared ones the extensions "known to the deployment": routes of one not active on
|
|
402
|
+
* this replica answer 503, an unknown name 404; cached {@link KNOWN_NAMES_TTL_MS}) and each
|
|
403
|
+
* extension's effective deployment config (the startup config plus the fields stored in PG, C10).
|
|
381
404
|
*/
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
405
|
+
installs, approvals,
|
|
406
|
+
/** This replica's load status table (`extension_replica_status`): every load result writes a row. */
|
|
407
|
+
status, config, kdb, redis, busSubscriber, keyring, embedTokens, locks, log, options,
|
|
408
|
+
/**
|
|
409
|
+
* Each hook call's effective config for its organization, and the providers excluded from an
|
|
410
|
+
* org's point resolution (layering spec A §6).
|
|
411
|
+
*/
|
|
412
|
+
effective,
|
|
413
|
+
/** `ctx.models`: the embeddings broker (spec B §5.4). */
|
|
414
|
+
models) {
|
|
415
|
+
this.registry = registry;
|
|
416
|
+
this.installs = installs;
|
|
417
|
+
this.approvals = approvals;
|
|
418
|
+
this.status = status;
|
|
419
|
+
this.config = config;
|
|
420
|
+
this.log = log;
|
|
421
|
+
this.effective = effective;
|
|
422
|
+
const c = config.get();
|
|
392
423
|
this.hooks = new HookRegistry({
|
|
393
424
|
instances: () => this.registry.all(),
|
|
394
425
|
current: (plugin) => this.registry.current(plugin),
|
|
395
426
|
expectedPolicy: (mount) => this.expectedPolicy(mount),
|
|
396
427
|
enabledPlugins: (orgId) => this.enabledPlugins(orgId),
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
428
|
+
effectiveConfig: (orgId, plugin) => effective.get(orgId, plugin),
|
|
429
|
+
locks,
|
|
430
|
+
config: () => ({ hooks: { timeoutMs: this.config.get().hooks.timeoutMs } }),
|
|
431
|
+
log,
|
|
400
432
|
});
|
|
433
|
+
this.deps = {
|
|
434
|
+
db: kdb.pool,
|
|
435
|
+
dbUrl: c.db.url,
|
|
436
|
+
connectTimeoutMs: c.db.connectTimeoutMs,
|
|
437
|
+
redis,
|
|
438
|
+
busSubscriber,
|
|
439
|
+
redisUrl: c.redis.url,
|
|
440
|
+
keyring,
|
|
441
|
+
embedTokens,
|
|
442
|
+
models,
|
|
443
|
+
// ctx.models.embed fires model.request through the same registry (spec B §5.4)
|
|
444
|
+
hooks: this.hooks,
|
|
445
|
+
locks,
|
|
446
|
+
runWorkers: c.roles.includes("worker"),
|
|
447
|
+
log,
|
|
448
|
+
};
|
|
401
449
|
this.registry.onChange(() => {
|
|
402
450
|
this.installedCache = undefined;
|
|
403
451
|
});
|
|
404
|
-
this.
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
452
|
+
this.resolveFrom = resolvePath(options.resolveFrom ?? process.cwd());
|
|
453
|
+
}
|
|
454
|
+
/** The startup config's `extensionConfig` (file / Nacos merged with env). */
|
|
455
|
+
get extensionConfig() {
|
|
456
|
+
return this.config.get().extensionConfig;
|
|
457
|
+
}
|
|
458
|
+
/** `extensionPermissions.autoApprove` (development and trials only; see `planApprovals`). */
|
|
459
|
+
get autoApprove() {
|
|
460
|
+
return this.config.get().extensionPermissions.autoApprove;
|
|
461
|
+
}
|
|
462
|
+
/** In-flight calls of a revoked instance are drained within this (`extensionHost.drainSeconds`). */
|
|
463
|
+
drainMs() {
|
|
464
|
+
return this.config.get().extensionHost.drainSeconds * 1000;
|
|
465
|
+
}
|
|
466
|
+
/** An extension's `dispose()` time limit (`extensionHost.disposeTimeoutSeconds`). */
|
|
467
|
+
disposeTimeoutMs() {
|
|
468
|
+
return this.config.get().extensionHost.disposeTimeoutSeconds * 1000;
|
|
469
|
+
}
|
|
470
|
+
/** `setup` time limit of a reload in a running process (`extensionHost.reloadSetupTimeoutSeconds`). */
|
|
471
|
+
reloadSetupTimeoutMs() {
|
|
472
|
+
return this.config.get().extensionHost.reloadSetupTimeoutSeconds * 1000;
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Records the config-declared extensions the CLI inspected (the CLI loads none): their names,
|
|
476
|
+
* manifests and permission sets for {@link declared} / {@link declaredPlugins}, and whether
|
|
477
|
+
* their deployment config is valid (the CLI merges and checks it like a replica would).
|
|
478
|
+
*/
|
|
479
|
+
noteInspected(inspected, configValid) {
|
|
480
|
+
for (const p of inspected) {
|
|
481
|
+
this.sources.set(p.manifest.name, { source: "config", sha256: null });
|
|
482
|
+
this.declaredInfo.set(p.manifest.name, {
|
|
483
|
+
source: "config",
|
|
484
|
+
manifest: p.manifest,
|
|
485
|
+
set: p.permissions,
|
|
486
|
+
});
|
|
487
|
+
if (p.displayName)
|
|
488
|
+
this.declaredDisplayNames.set(p.manifest.name, p.displayName);
|
|
489
|
+
const valid = configValid.get(p.manifest.name);
|
|
490
|
+
if (valid !== undefined)
|
|
491
|
+
this.configValidity.set(p.manifest.name, valid);
|
|
492
|
+
}
|
|
493
|
+
this.registry.declare(inspected.map((p) => p.manifest.name));
|
|
408
494
|
}
|
|
409
495
|
/**
|
|
410
496
|
* Imports each extension module (default export) and initializes them in dependency order; may be
|
|
@@ -455,6 +541,7 @@ export class ExtensionHost {
|
|
|
455
541
|
this.installLoader = p.installs;
|
|
456
542
|
const entries = await importEntries(p.config ?? [], this.resolveFrom);
|
|
457
543
|
await this.claimNames(entries);
|
|
544
|
+
await this.noteDisplayNames(entries);
|
|
458
545
|
const dirs = new Map(entries.map((e) => [e.manifest.name, e.dir]));
|
|
459
546
|
const urls = new Map(entries.map((e) => [e.manifest.name, e.url]));
|
|
460
547
|
// 有安装记录时:配置声明的插件若 requires 只能由安装记录满足,先挑出来,等安装记录加载完再解析与加载
|
|
@@ -464,13 +551,14 @@ export class ExtensionHost {
|
|
|
464
551
|
const ordered = resolveExtensions(ready, SDK_VERSION);
|
|
465
552
|
for (const e of entries)
|
|
466
553
|
this.sources.set(e.manifest.name, { source: "config", sha256: null });
|
|
554
|
+
this.registry.declare(entries.map((e) => e.manifest.name));
|
|
467
555
|
for (const e of entries)
|
|
468
556
|
assertSecretsReachable(e.manifest);
|
|
469
557
|
const sets = await permissionSets(ordered, dirs);
|
|
470
558
|
this.noteDeclared(ordered, sets);
|
|
471
|
-
const approvals =
|
|
559
|
+
const approvals = this.approvals;
|
|
472
560
|
if (this.autoApprove) {
|
|
473
|
-
this.
|
|
561
|
+
this.log.warn("extensionPermissions.autoApprove is ON: plugin permissions are approved automatically without review; never enable this in production");
|
|
474
562
|
}
|
|
475
563
|
const snapshots = ordered.length > 0 || p.installs ? await approvals.all() : new Map();
|
|
476
564
|
const decisions = new Map(planApprovals(ordered, sets, snapshots, {
|
|
@@ -496,7 +584,7 @@ export class ExtensionHost {
|
|
|
496
584
|
desired = await p.installs.desired();
|
|
497
585
|
}
|
|
498
586
|
catch (e) {
|
|
499
|
-
this.
|
|
587
|
+
this.log.error("cannot read extension install records; installed extensions are not loaded", {
|
|
500
588
|
err: e,
|
|
501
589
|
});
|
|
502
590
|
}
|
|
@@ -506,7 +594,7 @@ export class ExtensionHost {
|
|
|
506
594
|
// the first pass unloads nothing; the second skips what the first loaded.
|
|
507
595
|
const inPg = desired.filter((d) => d.blobStore === "pg");
|
|
508
596
|
if (inPg.length > 0 && inPg.length < desired.length) {
|
|
509
|
-
await this.applyInstalls(p.installs, inPg, true);
|
|
597
|
+
await this.applyInstalls(p.installs, inPg, true, desired);
|
|
510
598
|
}
|
|
511
599
|
installProviders = await this.applyInstalls(p.installs, desired, true);
|
|
512
600
|
}
|
|
@@ -517,11 +605,28 @@ export class ExtensionHost {
|
|
|
517
605
|
await this.refreshPolicyExpectations(p.installs ? desired : []);
|
|
518
606
|
const orphans = Object.keys(this.extensionConfig).filter((k) => !this.sources.has(k));
|
|
519
607
|
if (orphans.length > 0) {
|
|
520
|
-
this.
|
|
608
|
+
this.log.warn("extensionConfig has keys for extensions that are not loaded", {
|
|
521
609
|
keys: orphans,
|
|
522
610
|
});
|
|
523
611
|
}
|
|
524
612
|
}
|
|
613
|
+
/**
|
|
614
|
+
* Records each config-declared extension's display name from its plugin directory's plugin.json
|
|
615
|
+
* (spec §2.2); an invalid plugin.json only warns (no display name).
|
|
616
|
+
*/
|
|
617
|
+
async noteDisplayNames(entries) {
|
|
618
|
+
for (const e of entries) {
|
|
619
|
+
const { displayName, problem } = await declaredDisplayName(e.dir, e.manifest.name);
|
|
620
|
+
if (displayName)
|
|
621
|
+
this.declaredDisplayNames.set(e.manifest.name, displayName);
|
|
622
|
+
if (problem !== undefined) {
|
|
623
|
+
this.log.warn("plugin.json of a config-declared extension is invalid; no display name", {
|
|
624
|
+
plugin: e.manifest.name,
|
|
625
|
+
problem,
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
525
630
|
/**
|
|
526
631
|
* Config-declared extensions also take their name (I4, an addition to Ruling P3): the
|
|
527
632
|
* name is inserted into `extension_name_owners` with its npm package name (left alone when present).
|
|
@@ -533,7 +638,7 @@ export class ExtensionHost {
|
|
|
533
638
|
for (const e of entries) {
|
|
534
639
|
const pkg = await packageNameOf(e.dir);
|
|
535
640
|
if (pkg === undefined) {
|
|
536
|
-
this.
|
|
641
|
+
this.log.warn("plugin module has no package.json name; its plugin name is not claimed", {
|
|
537
642
|
plugin: e.manifest.name,
|
|
538
643
|
});
|
|
539
644
|
continue;
|
|
@@ -557,12 +662,12 @@ export class ExtensionHost {
|
|
|
557
662
|
for (const o of owners) {
|
|
558
663
|
const mine = rows.find((r) => r.name === o.name);
|
|
559
664
|
if (mine && mine.package_name !== o.package_name) {
|
|
560
|
-
this.
|
|
665
|
+
this.log.warn("plugin name is owned by a different npm package; the data, secrets and approval kept under this name came from that package", { plugin: o.name, owner: o.package_name, package: mine.package_name });
|
|
561
666
|
}
|
|
562
667
|
}
|
|
563
668
|
}
|
|
564
669
|
catch (err) {
|
|
565
|
-
this.
|
|
670
|
+
this.log.warn("cannot record plugin name owners", { err });
|
|
566
671
|
}
|
|
567
672
|
}
|
|
568
673
|
/**
|
|
@@ -598,18 +703,15 @@ export class ExtensionHost {
|
|
|
598
703
|
* 插件此刻的部署配置(未校验):启动配置补上 PG 里保存的字段(C10,见构造参数 `deploymentConfig`)。
|
|
599
704
|
*/
|
|
600
705
|
async rawConfigOf(name, schema) {
|
|
601
|
-
|
|
602
|
-
if (!this.storedConfig)
|
|
603
|
-
return fileValue ?? {};
|
|
604
|
-
return this.storedConfig(name, fileValue, schema);
|
|
706
|
+
return this.installs.effectiveDeploymentConfig(name, this.extensionConfig[name], schema);
|
|
605
707
|
}
|
|
606
|
-
/**
|
|
708
|
+
/** 把一份已校验部署配置里的密钥值登记到日志打码。 */
|
|
607
709
|
reportSecrets(schema, config) {
|
|
608
|
-
if (!schema
|
|
710
|
+
if (!schema)
|
|
609
711
|
return;
|
|
610
712
|
const values = secretValues(schema, config);
|
|
611
713
|
if (values.length > 0)
|
|
612
|
-
this.
|
|
714
|
+
this.log.addSecrets(values);
|
|
613
715
|
}
|
|
614
716
|
/**
|
|
615
717
|
* 安装记录收敛到 PG 期望状态(启动第 3 步与运行中的 {@link converge} 共用,C16);`desired` 为期望启用的记录。
|
|
@@ -624,21 +726,36 @@ export class ExtensionHost {
|
|
|
624
726
|
* 4. 运行中(非启动):对变了的能力做依赖方连锁(本轮刚加载的除外),此前因依赖卸下的插件随之补回。
|
|
625
727
|
* 返回启用的安装记录在静态清单里声明提供的能力(启动第 4 步据此判断待定还是缺提供方)。
|
|
626
728
|
*/
|
|
627
|
-
async applyInstalls(loader, desired, startup
|
|
729
|
+
async applyInstalls(loader, desired, startup,
|
|
730
|
+
/**
|
|
731
|
+
* Every install record desired enabled, in {@link ExtensionInstalls.desired} order (the
|
|
732
|
+
* single-provider election runs over all of them even when `desired` is the startup's first
|
|
733
|
+
* pass over the packages kept in PG).
|
|
734
|
+
*/
|
|
735
|
+
electAmong = desired) {
|
|
628
736
|
const declared = this.declared();
|
|
629
737
|
const installProviders = new Map();
|
|
630
738
|
const wanted = new Map();
|
|
739
|
+
// Single-provider election: of the enabled install records providing one single-provider
|
|
740
|
+
// extension point, only the earliest enabled is loaded (desired() order: enabled_at, install
|
|
741
|
+
// time, name). Decided from PG alone, never from what loaded here, so every replica and every
|
|
742
|
+
// restart picks the same one. Two enabled providers only remain from before a second enable
|
|
743
|
+
// was refused; the others are pending / conflict until the super admin disables one. A loser
|
|
744
|
+
// provides nothing (left out of `installProviders`, so `blockedBy` never names it).
|
|
745
|
+
const { losers } = electSingleProviders(electAmong.filter((d) => !declared.has(d.name)));
|
|
631
746
|
for (const d of desired) {
|
|
632
747
|
const taken = declared.get(d.name);
|
|
633
748
|
if (taken) {
|
|
634
749
|
if (!this.warnedConflicts.has(d.name)) {
|
|
635
750
|
this.warnedConflicts.add(d.name);
|
|
636
|
-
this.
|
|
751
|
+
this.log.warn("plugin is both installed and declared in the extensions config list; using the config plugin", { plugin: d.name, installedVersion: d.version });
|
|
637
752
|
// 该名字的状态行属于生效的一方,不覆盖;在它的 detail 里记下冲突(后台能看到)
|
|
638
753
|
await this.noteStatus(d.name, `name_conflict: install record ${d.version} (${d.sha256.slice(0, 16)}) ignored; the ${taken} plugin of the same name is used`);
|
|
639
754
|
}
|
|
640
755
|
continue;
|
|
641
756
|
}
|
|
757
|
+
if (losers.has(d.name))
|
|
758
|
+
continue;
|
|
642
759
|
wanted.set(d.name, d);
|
|
643
760
|
// 按审阅过的静态清单(不论随后加载成败)
|
|
644
761
|
for (const cap of d.section.manifest.provides) {
|
|
@@ -657,7 +774,7 @@ export class ExtensionHost {
|
|
|
657
774
|
changed.push(...gone.manifest.provides);
|
|
658
775
|
}
|
|
659
776
|
for (const [name, row] of [...this.installRows]) {
|
|
660
|
-
if (wanted.has(name) || this.registry.current(name))
|
|
777
|
+
if (wanted.has(name) || losers.has(name) || this.registry.current(name))
|
|
661
778
|
continue;
|
|
662
779
|
this.dropPending(name);
|
|
663
780
|
this.prepared.delete(name);
|
|
@@ -715,22 +832,30 @@ export class ExtensionHost {
|
|
|
715
832
|
}
|
|
716
833
|
for (const c of remaining) {
|
|
717
834
|
let detail = "cannot resolve the plugin's dependencies";
|
|
835
|
+
let conflict = false;
|
|
718
836
|
try {
|
|
719
837
|
tryResolve(c);
|
|
720
838
|
}
|
|
721
839
|
catch (e) {
|
|
722
840
|
detail = errMsg(e);
|
|
841
|
+
conflict = e instanceof ExtensionResolveError && e.code === PROVIDER_CONFLICT;
|
|
723
842
|
}
|
|
843
|
+
// A single-provider point another extension already provides: a conflict, not a missing
|
|
844
|
+
// dependency. Converge tries it again on every pass, so it loads once the other is gone.
|
|
845
|
+
const reason = conflict ? "conflict" : "dependency";
|
|
724
846
|
this.notePending({
|
|
725
847
|
plugin: c.d.name,
|
|
726
848
|
version: c.d.version,
|
|
727
849
|
added: [],
|
|
728
850
|
removed: [],
|
|
729
|
-
reason
|
|
851
|
+
reason,
|
|
730
852
|
blockedBy: (c.manifest.requires ?? []).map((extensionPoint) => ({
|
|
731
853
|
extensionPoint,
|
|
732
854
|
providers: (installProviders.get(extensionPoint) ?? []).filter((n) => n !== c.d.name),
|
|
733
855
|
})),
|
|
856
|
+
...(conflict && {
|
|
857
|
+
conflicts: conflictsOf(c.manifest, [...base(), ...accepted.map((a) => a.manifest)]),
|
|
858
|
+
}),
|
|
734
859
|
});
|
|
735
860
|
await this.writeStatus({
|
|
736
861
|
plugin: c.d.name,
|
|
@@ -738,11 +863,12 @@ export class ExtensionHost {
|
|
|
738
863
|
sha256: c.d.sha256,
|
|
739
864
|
source: "install",
|
|
740
865
|
state: "pending",
|
|
741
|
-
reason
|
|
866
|
+
reason,
|
|
742
867
|
detail,
|
|
743
868
|
});
|
|
744
869
|
}
|
|
745
870
|
if (accepted.length === 0) {
|
|
871
|
+
await this.noteLosers(desired, losers);
|
|
746
872
|
if (!startup && changed.length > 0)
|
|
747
873
|
await this.cascade(changed, drainMs);
|
|
748
874
|
return installProviders;
|
|
@@ -752,7 +878,7 @@ export class ExtensionHost {
|
|
|
752
878
|
// 4. 按拓扑序逐个:权限闸门 → 配置 → 迁移 → setup → 登记(替换旧实例)
|
|
753
879
|
const order = resolveExtensions([...base(), ...accepted.map((a) => a.manifest)], SDK_VERSION);
|
|
754
880
|
const byName = new Map(accepted.map((c) => [c.d.name, c]));
|
|
755
|
-
const approvals =
|
|
881
|
+
const approvals = this.approvals;
|
|
756
882
|
const snapshots = await approvals.all();
|
|
757
883
|
const activated = new Set();
|
|
758
884
|
for (const m of order) {
|
|
@@ -782,10 +908,42 @@ export class ExtensionHost {
|
|
|
782
908
|
changed.push(...inst.manifest.provides, ...(old?.manifest.provides ?? []));
|
|
783
909
|
}
|
|
784
910
|
}
|
|
911
|
+
await this.noteLosers(desired, losers);
|
|
785
912
|
if (!startup && changed.length > 0)
|
|
786
913
|
await this.cascade(changed, drainMs, activated);
|
|
787
914
|
return installProviders;
|
|
788
915
|
}
|
|
916
|
+
/**
|
|
917
|
+
* Marks the losers of the single-provider election pending / conflict, naming the winner; after
|
|
918
|
+
* this pass loaded what it could, so a winner not loaded here (failed, pending) is known: the
|
|
919
|
+
* election stays (replicas must agree), but the loser's detail says the point has no running
|
|
920
|
+
* provider and the admin view warns about it.
|
|
921
|
+
*/
|
|
922
|
+
async noteLosers(desired, losers) {
|
|
923
|
+
for (const d of desired) {
|
|
924
|
+
const lost = losers.get(d.name);
|
|
925
|
+
if (!lost)
|
|
926
|
+
continue;
|
|
927
|
+
const unloaded = this.registry.current(lost.winner) === undefined;
|
|
928
|
+
this.notePending({
|
|
929
|
+
plugin: d.name,
|
|
930
|
+
version: d.version,
|
|
931
|
+
added: [],
|
|
932
|
+
removed: [],
|
|
933
|
+
reason: "conflict",
|
|
934
|
+
conflicts: [{ extensionPoint: lost.extensionPoint, providers: [lost.winner] }],
|
|
935
|
+
});
|
|
936
|
+
await this.writeStatus({
|
|
937
|
+
plugin: d.name,
|
|
938
|
+
version: d.version,
|
|
939
|
+
sha256: d.sha256,
|
|
940
|
+
source: "install",
|
|
941
|
+
state: "pending",
|
|
942
|
+
reason: "conflict",
|
|
943
|
+
detail: providerConflictMessage(lost.extensionPoint, [lost.winner, d.name], unloaded ? lost.winner : undefined),
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
}
|
|
789
947
|
/**
|
|
790
948
|
* The load candidate of an install record: sync it locally, then compute the permission set from
|
|
791
949
|
* the reviewed static manifest and the package's migration SQL (the same algorithm as
|
|
@@ -873,7 +1031,7 @@ export class ExtensionHost {
|
|
|
873
1031
|
if (this.loggedFailures.get(plugin) === key)
|
|
874
1032
|
return;
|
|
875
1033
|
this.loggedFailures.set(plugin, key);
|
|
876
|
-
this.
|
|
1034
|
+
this.log.error("installed extension not loaded", {
|
|
877
1035
|
plugin,
|
|
878
1036
|
sha256,
|
|
879
1037
|
reason,
|
|
@@ -973,15 +1131,46 @@ export class ExtensionHost {
|
|
|
973
1131
|
});
|
|
974
1132
|
}
|
|
975
1133
|
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Checks the config UI hints of a loaded module's deployment and org schemas (spec §4.1). Invalid
|
|
1136
|
+
* hints never fail the load: the form schemas drop their `x-ui` (`configFormSchema`), one warning
|
|
1137
|
+
* per `<name>@<version>` is logged, and the returned text goes into the status detail (null when
|
|
1138
|
+
* every hint is valid). The packer refuses such a package; this covers hand-made ones. It never
|
|
1139
|
+
* throws (it runs after the instance is active, before its status row is written): a conversion
|
|
1140
|
+
* that throws is warned about and reported in the detail the same way.
|
|
1141
|
+
*/
|
|
1142
|
+
checkConfigUi(manifest) {
|
|
1143
|
+
const parts = [];
|
|
1144
|
+
for (const level of ["deployment", "org"]) {
|
|
1145
|
+
const schema = manifest.config?.[level];
|
|
1146
|
+
if (!schema)
|
|
1147
|
+
continue;
|
|
1148
|
+
try {
|
|
1149
|
+
const { problems } = configFormSchema(schema, level);
|
|
1150
|
+
if (problems.length > 0)
|
|
1151
|
+
parts.push(describeConfigUiProblems(level, problems));
|
|
1152
|
+
}
|
|
1153
|
+
catch (err) {
|
|
1154
|
+
parts.push(`${level} config UI hints could not be checked (${err instanceof Error ? err.message : String(err)})`);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
if (parts.length === 0)
|
|
1158
|
+
return null;
|
|
1159
|
+
const detail = parts.join("; ");
|
|
1160
|
+
const key = `${manifest.name}@${manifest.version}`;
|
|
1161
|
+
if (!this.configUiWarned.has(key)) {
|
|
1162
|
+
this.configUiWarned.add(key);
|
|
1163
|
+
this.log.warn("extension config UI hints are invalid and ignored: its config forms show plain fields", { plugin: manifest.name, version: manifest.version, detail });
|
|
1164
|
+
}
|
|
1165
|
+
return detail;
|
|
1166
|
+
}
|
|
976
1167
|
/** 给已有状态行补说明;失败只记 warn。 */
|
|
977
1168
|
async noteStatus(plugin, detail) {
|
|
978
|
-
if (!this.status)
|
|
979
|
-
return;
|
|
980
1169
|
try {
|
|
981
1170
|
await this.status.note(plugin, detail);
|
|
982
1171
|
}
|
|
983
1172
|
catch (e) {
|
|
984
|
-
this.
|
|
1173
|
+
this.log.warn("cannot write plugin replica status", { plugin, err: e });
|
|
985
1174
|
}
|
|
986
1175
|
}
|
|
987
1176
|
/**
|
|
@@ -1002,13 +1191,11 @@ export class ExtensionHost {
|
|
|
1002
1191
|
else
|
|
1003
1192
|
this.installRows.set(s.plugin, { version: s.version, sha256: s.sha256 });
|
|
1004
1193
|
}
|
|
1005
|
-
if (!this.status)
|
|
1006
|
-
return;
|
|
1007
1194
|
try {
|
|
1008
1195
|
await this.status.write(s);
|
|
1009
1196
|
}
|
|
1010
1197
|
catch (e) {
|
|
1011
|
-
this.
|
|
1198
|
+
this.log.warn("cannot write plugin replica status", { plugin: s.plugin, err: e });
|
|
1012
1199
|
}
|
|
1013
1200
|
}
|
|
1014
1201
|
/**
|
|
@@ -1054,7 +1241,7 @@ export class ExtensionHost {
|
|
|
1054
1241
|
if (this.closed)
|
|
1055
1242
|
throw new Error(CLOSED_DURING_LOAD, { cause: e });
|
|
1056
1243
|
// 读不到 PG 里保存的部署配置:按待配置处理,下次 reconcile 再试
|
|
1057
|
-
this.
|
|
1244
|
+
this.log.error("cannot read the stored deployment config of plugin", {
|
|
1058
1245
|
plugin: name,
|
|
1059
1246
|
err: e,
|
|
1060
1247
|
});
|
|
@@ -1068,7 +1255,9 @@ export class ExtensionHost {
|
|
|
1068
1255
|
return undefined;
|
|
1069
1256
|
}
|
|
1070
1257
|
let config = raw;
|
|
1071
|
-
|
|
1258
|
+
// the load gate (spec A §5.4a): overridable fields may stay empty on the platform, so
|
|
1259
|
+
// `ctx.config` may lack them; hidden and read-only fields must be complete
|
|
1260
|
+
const parsed = readConfig && schema ? parseLoadGate(schema, raw) : undefined;
|
|
1072
1261
|
if (a.source !== "install")
|
|
1073
1262
|
this.configValidity.set(name, parsed?.success ?? true);
|
|
1074
1263
|
if (decision.action === "pending") {
|
|
@@ -1081,9 +1270,9 @@ export class ExtensionHost {
|
|
|
1081
1270
|
// 每个周期都会重新判定:同一版本、同一原因只告警一次
|
|
1082
1271
|
if (before?.version !== decision.pending.version ||
|
|
1083
1272
|
before.reason !== decision.pending.reason) {
|
|
1084
|
-
warnPending(this.
|
|
1273
|
+
warnPending(this.log, decision.pending);
|
|
1085
1274
|
}
|
|
1086
|
-
const reason = decision.pending
|
|
1275
|
+
const reason = pendingReasonOf(decision.pending);
|
|
1087
1276
|
await this.writeStatus({ ...base, state: "pending", reason, detail: null });
|
|
1088
1277
|
return undefined;
|
|
1089
1278
|
}
|
|
@@ -1092,7 +1281,7 @@ export class ExtensionHost {
|
|
|
1092
1281
|
if (decision.changed) {
|
|
1093
1282
|
if (decision.autoApprove) {
|
|
1094
1283
|
await approvals.approve(name, manifest.version, a.set, { source: "auto" });
|
|
1095
|
-
this.
|
|
1284
|
+
this.log.warn("plugin permissions auto-approved (extensionPermissions.autoApprove)", {
|
|
1096
1285
|
plugin: name,
|
|
1097
1286
|
version: manifest.version,
|
|
1098
1287
|
added: decision.added,
|
|
@@ -1104,7 +1293,7 @@ export class ExtensionHost {
|
|
|
1104
1293
|
const updated = await approvals.refresh(name, manifest.version, a.set);
|
|
1105
1294
|
const merged = decision.added.filter((k) => k.startsWith(UI_VIEW_KEY_PREFIX));
|
|
1106
1295
|
if (updated && merged.length > 0 && blockingKeys(decision.added).length === 0) {
|
|
1107
|
-
this.
|
|
1296
|
+
this.log.info("plugin ui views merged into the permission snapshot", {
|
|
1108
1297
|
plugin: name,
|
|
1109
1298
|
version: manifest.version,
|
|
1110
1299
|
merged,
|
|
@@ -1121,7 +1310,7 @@ export class ExtensionHost {
|
|
|
1121
1310
|
// 待配置(C10):配置声明与安装记录都一样,内核照常启动;配置改好后下一次 reconcile 加载
|
|
1122
1311
|
if (this.configWarned.get(name) !== detail) {
|
|
1123
1312
|
this.configWarned.set(name, detail);
|
|
1124
|
-
this.
|
|
1313
|
+
this.log.warn("extension not loaded: its deployment config is missing or invalid (set it in the admin console or the startup config; it loads without a restart)", { plugin: name, source: a.source, detail });
|
|
1125
1314
|
}
|
|
1126
1315
|
retryLater();
|
|
1127
1316
|
await this.writeStatus({ ...base, state: "pending", reason: "config", detail });
|
|
@@ -1183,16 +1372,23 @@ export class ExtensionHost {
|
|
|
1183
1372
|
}
|
|
1184
1373
|
if (this.closed) {
|
|
1185
1374
|
await inst.dispose({ drainMs: 0 }).catch((err) => {
|
|
1186
|
-
this.
|
|
1375
|
+
this.log.warn("plugin context close failed", { plugin: name, err });
|
|
1187
1376
|
});
|
|
1188
1377
|
throw new Error(CLOSED_DURING_LOAD);
|
|
1189
1378
|
}
|
|
1190
1379
|
// 升级:替换加载参数(之后的依赖方连锁与 reload 用新版本),先登记新实例、再撤销旧实例
|
|
1191
1380
|
this.specs.set(name, spec);
|
|
1381
|
+
if (a.source !== "install")
|
|
1382
|
+
this.declaredActivations.set(name, a);
|
|
1192
1383
|
this.unloadedForDependency.delete(name);
|
|
1193
1384
|
const old = this.registry.activate(inst);
|
|
1194
1385
|
this.loggedFailures.delete(name);
|
|
1195
|
-
await this.writeStatus({
|
|
1386
|
+
await this.writeStatus({
|
|
1387
|
+
...base,
|
|
1388
|
+
state: "loaded",
|
|
1389
|
+
reason: null,
|
|
1390
|
+
detail: this.checkConfigUi(manifest),
|
|
1391
|
+
});
|
|
1196
1392
|
if (old)
|
|
1197
1393
|
this.retire(old);
|
|
1198
1394
|
return inst;
|
|
@@ -1204,7 +1400,7 @@ export class ExtensionHost {
|
|
|
1204
1400
|
retire(old) {
|
|
1205
1401
|
const p = this.disposeQuietly(old, this.drainMs()).finally(() => {
|
|
1206
1402
|
this.retiring.delete(old);
|
|
1207
|
-
this.
|
|
1403
|
+
this.log.info("previous plugin instance retired", {
|
|
1208
1404
|
plugin: old.name,
|
|
1209
1405
|
generation: old.generation,
|
|
1210
1406
|
});
|
|
@@ -1238,7 +1434,8 @@ export class ExtensionHost {
|
|
|
1238
1434
|
permissions: d.set,
|
|
1239
1435
|
configurable: schema !== undefined,
|
|
1240
1436
|
configValid: this.configValidity.get(name) ??
|
|
1241
|
-
(schema ? schema
|
|
1437
|
+
(schema ? parseLoadGate(schema, this.extensionConfig[name] ?? {}).success : true),
|
|
1438
|
+
displayName: this.declaredDisplayNames.get(name) ?? null,
|
|
1242
1439
|
};
|
|
1243
1440
|
});
|
|
1244
1441
|
}
|
|
@@ -1281,7 +1478,7 @@ export class ExtensionHost {
|
|
|
1281
1478
|
* `shrinkOnly`: only remove entries (a plugin no longer desired or approved), never add new ones.
|
|
1282
1479
|
*/
|
|
1283
1480
|
async refreshPolicyExpectations(desired, opts = {}) {
|
|
1284
|
-
const snapshots = await
|
|
1481
|
+
const snapshots = await this.approvals.all();
|
|
1285
1482
|
const next = new Map();
|
|
1286
1483
|
const add = (name, set) => {
|
|
1287
1484
|
const mounts = set?.permissions?.policyHooks ?? [];
|
|
@@ -1330,7 +1527,7 @@ export class ExtensionHost {
|
|
|
1330
1527
|
async activatePendingNow() {
|
|
1331
1528
|
if (this.pendingActivations.size === 0)
|
|
1332
1529
|
return [];
|
|
1333
|
-
const approvals =
|
|
1530
|
+
const approvals = this.approvals;
|
|
1334
1531
|
const snapshots = await approvals.all();
|
|
1335
1532
|
const activated = [];
|
|
1336
1533
|
/** 本次已经试过且失败的:同一次不再重试(下一次 converge 再试)。 */
|
|
@@ -1356,7 +1553,7 @@ export class ExtensionHost {
|
|
|
1356
1553
|
if (this.closed)
|
|
1357
1554
|
throw e;
|
|
1358
1555
|
// 配置声明的插件迁移 / setup 出错时 activate 抛错(启动时内核失败);运行中只记 failed
|
|
1359
|
-
this.
|
|
1556
|
+
this.log.error("approved plugin not loaded", { plugin: name, err: e });
|
|
1360
1557
|
await this.writeStatus({
|
|
1361
1558
|
plugin: name,
|
|
1362
1559
|
version: a.manifest.version,
|
|
@@ -1370,7 +1567,7 @@ export class ExtensionHost {
|
|
|
1370
1567
|
if (this.registry.current(name)) {
|
|
1371
1568
|
activated.push(name);
|
|
1372
1569
|
progress = true;
|
|
1373
|
-
this.
|
|
1570
|
+
this.log.info("approved plugin loaded", { plugin: name });
|
|
1374
1571
|
}
|
|
1375
1572
|
else {
|
|
1376
1573
|
// 加载失败(迁移、setup)或待配置:留着,下一次 converge 重试(同一次不再试)
|
|
@@ -1436,7 +1633,7 @@ export class ExtensionHost {
|
|
|
1436
1633
|
this.pendingPlugins.push(p);
|
|
1437
1634
|
if (before?.reason === p.reason)
|
|
1438
1635
|
return;
|
|
1439
|
-
const reason = p
|
|
1636
|
+
const reason = pendingReasonOf(p);
|
|
1440
1637
|
await this.writeStatus({
|
|
1441
1638
|
plugin: p.plugin,
|
|
1442
1639
|
version: a.manifest.version,
|
|
@@ -1453,7 +1650,7 @@ export class ExtensionHost {
|
|
|
1453
1650
|
}
|
|
1454
1651
|
/** 配置声明的插件名 → 来源(安装包不能与它们重名)。 */
|
|
1455
1652
|
declared() {
|
|
1456
|
-
return
|
|
1653
|
+
return this.registry.declared();
|
|
1457
1654
|
}
|
|
1458
1655
|
/**
|
|
1459
1656
|
* Extensions enabled in the org: `extension_org_configs.enabled` plus every required bootstrap
|
|
@@ -1476,6 +1673,7 @@ export class ExtensionHost {
|
|
|
1476
1673
|
.all()
|
|
1477
1674
|
.flatMap((i) => i.provided.has(ref) ? [{ plugin: i.name, impl: i.provided.get(ref) }] : []),
|
|
1478
1675
|
enabledPlugins: (orgId) => this.enabledPlugins(orgId),
|
|
1676
|
+
configOk: async (orgId, plugin) => (await this.effective.get(orgId, plugin)).ok,
|
|
1479
1677
|
};
|
|
1480
1678
|
get loadDeps() {
|
|
1481
1679
|
return {
|
|
@@ -1496,7 +1694,7 @@ export class ExtensionHost {
|
|
|
1496
1694
|
*/
|
|
1497
1695
|
async setup(spec, timeoutMs) {
|
|
1498
1696
|
if (this.imports.record(spec.manifest.name, spec.entryUrl)) {
|
|
1499
|
-
warnUpgrades(this.
|
|
1697
|
+
warnUpgrades(this.log, this.imports);
|
|
1500
1698
|
}
|
|
1501
1699
|
let ctx;
|
|
1502
1700
|
const p = setupInstance(this.loadDeps, spec.manifest, {
|
|
@@ -1534,7 +1732,7 @@ export class ExtensionHost {
|
|
|
1534
1732
|
if (this.settingUp === ctx)
|
|
1535
1733
|
this.settingUp = undefined;
|
|
1536
1734
|
await ctx?.close().catch((err) => {
|
|
1537
|
-
this.
|
|
1735
|
+
this.log.warn("plugin context close failed", { plugin: spec.manifest.name, err });
|
|
1538
1736
|
});
|
|
1539
1737
|
if (r === "closed")
|
|
1540
1738
|
throw new Error(CLOSED_DURING_LOAD);
|
|
@@ -1574,33 +1772,23 @@ export class ExtensionHost {
|
|
|
1574
1772
|
* 实时取自注册表:调用方不要缓存实现对象(插件撤销 / 升级后旧实现不再有效)。
|
|
1575
1773
|
*/
|
|
1576
1774
|
list(extensionPointName) {
|
|
1577
|
-
|
|
1578
|
-
const tracked = TRACKED_EXTENSION_POINTS[extensionPointName];
|
|
1579
|
-
for (const i of this.registry.all()) {
|
|
1580
|
-
for (const [cap, impl] of i.provided) {
|
|
1581
|
-
if (parseExtensionPoint(cap).name === extensionPointName) {
|
|
1582
|
-
out.push({
|
|
1583
|
-
plugin: i.name,
|
|
1584
|
-
capability: cap,
|
|
1585
|
-
// 内核消费的提供方调用计入实例在途计数:停用 / 升级时先排空、到时限中止(C17)
|
|
1586
|
-
impl: tracked && typeof impl === "object" && impl !== null
|
|
1587
|
-
? trackCalls(impl, i.inflight, tracked)
|
|
1588
|
-
: impl,
|
|
1589
|
-
version: i.version,
|
|
1590
|
-
configHash: i.configHash,
|
|
1591
|
-
inflight: i.inflight,
|
|
1592
|
-
});
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
return out;
|
|
1775
|
+
return this.registry.list(extensionPointName);
|
|
1597
1776
|
}
|
|
1598
1777
|
/**
|
|
1599
1778
|
* 已加载插件的部署配置(已按清单 schema 校验,含密钥),供内核调用该插件的能力时作为 `config` 传回
|
|
1600
1779
|
* (如 `identity-source@1` 的登录配置);未加载返回 undefined。不得回显到响应或日志。
|
|
1601
1780
|
*/
|
|
1602
1781
|
deploymentConfig(plugin) {
|
|
1603
|
-
return this.registry.
|
|
1782
|
+
return this.registry.deploymentConfig(plugin);
|
|
1783
|
+
}
|
|
1784
|
+
/**
|
|
1785
|
+
* The raw (unparsed) deployment config of a running extension: the startup config merged with
|
|
1786
|
+
* the PG values, as the host reads it before parsing (secrets included; never echo it). An org
|
|
1787
|
+
* copy is applied to this and parsed once (layering spec A §6), so schema transforms are not
|
|
1788
|
+
* run twice. Without a running instance, the stored values without a schema.
|
|
1789
|
+
*/
|
|
1790
|
+
rawDeploymentConfig(plugin) {
|
|
1791
|
+
return this.rawConfigOf(plugin, this.registry.current(plugin)?.manifest.config?.deployment);
|
|
1604
1792
|
}
|
|
1605
1793
|
/**
|
|
1606
1794
|
* 本副本拿得到的插件清单里的部署级 schema(生效实例 → 配置声明 → 安装记录准备好的候选);
|
|
@@ -1622,7 +1810,9 @@ export class ExtensionHost {
|
|
|
1622
1810
|
/**
|
|
1623
1811
|
* 部署配置保存后(`kernel.plugin-deployment-config`)本副本重读并校验(C10;与 unload / reload 串行):
|
|
1624
1812
|
* - 插件没在本副本生效 → `not_loaded`(配置声明的刷新后台的合法性判定;待配置的由 reconcile 加载);
|
|
1625
|
-
* - 不合法 → `invalid
|
|
1813
|
+
* - 不合法 → `invalid`:保持当前值,告警;但 PG 里已没有保存的配置(超级管理员清空了,`DELETE
|
|
1814
|
+
* /api/v1/admin/extensions/:name/config`)、剩下的来源(启动配置、默认值)又不够时 → `unloaded`:卸下实例、
|
|
1815
|
+
* 记为待配置(pending / config),依赖方连锁;重新配好后由 reconcile 加载;
|
|
1626
1816
|
* - 没变 → `unchanged`;只改了 hot 字段 → `hot`:就地替换,插件经 `ctx.config` 读到新值,不重新 setup;
|
|
1627
1817
|
* - 改了非 hot 字段 → `reload`:用新配置重新加载实例(先新后旧,排空在途调用),依赖方连锁;
|
|
1628
1818
|
* 重新加载失败旧实例保留(`reload_failed`,记 error)。
|
|
@@ -1637,10 +1827,10 @@ export class ExtensionHost {
|
|
|
1637
1827
|
if (schema) {
|
|
1638
1828
|
try {
|
|
1639
1829
|
const raw = await this.rawConfigOf(plugin, schema);
|
|
1640
|
-
this.configValidity.set(plugin, schema
|
|
1830
|
+
this.configValidity.set(plugin, parseLoadGate(schema, raw).success);
|
|
1641
1831
|
}
|
|
1642
1832
|
catch (err) {
|
|
1643
|
-
this.
|
|
1833
|
+
this.log.warn("cannot read the stored deployment config of plugin", {
|
|
1644
1834
|
plugin,
|
|
1645
1835
|
err,
|
|
1646
1836
|
});
|
|
@@ -1656,12 +1846,16 @@ export class ExtensionHost {
|
|
|
1656
1846
|
raw = await this.rawConfigOf(plugin, schema);
|
|
1657
1847
|
}
|
|
1658
1848
|
catch (err) {
|
|
1659
|
-
this.
|
|
1849
|
+
this.log.error("cannot read the stored deployment config of plugin; keeping its current config", { plugin, err });
|
|
1660
1850
|
return "invalid";
|
|
1661
1851
|
}
|
|
1662
|
-
const r = schema
|
|
1852
|
+
const r = parseLoadGate(schema, raw);
|
|
1663
1853
|
if (!r.success) {
|
|
1664
|
-
this.
|
|
1854
|
+
if (await this.clearedInPg(plugin)) {
|
|
1855
|
+
await this.unloadForMissingConfig(inst, toIssues(r.error));
|
|
1856
|
+
return "unloaded";
|
|
1857
|
+
}
|
|
1858
|
+
this.log.warn("plugin deployment config changed but is invalid on this replica; keeping the current config", {
|
|
1665
1859
|
plugin,
|
|
1666
1860
|
detail: toIssues(r.error)
|
|
1667
1861
|
.map((i) => `${i.path || "<root>"}: ${i.message}`)
|
|
@@ -1684,7 +1878,7 @@ export class ExtensionHost {
|
|
|
1684
1878
|
this.specs.set(plugin, { ...spec, config: next, configHash });
|
|
1685
1879
|
if (changed.every((p) => hot.has(p))) {
|
|
1686
1880
|
inst.updateConfig(next, configHash);
|
|
1687
|
-
this.
|
|
1881
|
+
this.log.info("plugin deployment config updated in place (hot fields)", {
|
|
1688
1882
|
plugin,
|
|
1689
1883
|
changed,
|
|
1690
1884
|
});
|
|
@@ -1702,21 +1896,110 @@ export class ExtensionHost {
|
|
|
1702
1896
|
this.specs.set(plugin, spec);
|
|
1703
1897
|
if (this.closed)
|
|
1704
1898
|
throw err;
|
|
1705
|
-
this.
|
|
1899
|
+
this.log.error("plugin reload after a deployment config change failed; it keeps its previous instance", { plugin, changed, err });
|
|
1706
1900
|
return "reload_failed";
|
|
1707
1901
|
}
|
|
1708
1902
|
await this.cascade(fresh.manifest.provides, drainMs);
|
|
1709
|
-
this.
|
|
1903
|
+
this.log.info("plugin reloaded after a deployment config change", { plugin, changed });
|
|
1710
1904
|
return "reload";
|
|
1711
1905
|
});
|
|
1712
1906
|
}
|
|
1907
|
+
/** PG holds no deployment config for the plugin (it was cleared); a read error counts as no. */
|
|
1908
|
+
async clearedInPg(plugin) {
|
|
1909
|
+
try {
|
|
1910
|
+
return !(await this.installs.hasStoredDeploymentConfig(plugin));
|
|
1911
|
+
}
|
|
1912
|
+
catch (err) {
|
|
1913
|
+
this.log.warn("cannot read whether the plugin has a stored deployment config", {
|
|
1914
|
+
plugin,
|
|
1915
|
+
err,
|
|
1916
|
+
});
|
|
1917
|
+
return false;
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
/**
|
|
1921
|
+
* Unloads an extension whose deployment config was cleared and is now missing or invalid (in
|
|
1922
|
+
* the host's serial queue): drains it, records pending / config (a config-declared one goes back
|
|
1923
|
+
* to {@link pendingActivations}; an install record is decided again on every converge) and
|
|
1924
|
+
* cascades to its dependents. It loads again without a restart once it is configured.
|
|
1925
|
+
*/
|
|
1926
|
+
async unloadForMissingConfig(inst, issues) {
|
|
1927
|
+
const plugin = inst.name;
|
|
1928
|
+
const drainMs = this.drainMs();
|
|
1929
|
+
const gone = await this.doUnload(plugin, drainMs, null);
|
|
1930
|
+
if (!gone)
|
|
1931
|
+
return;
|
|
1932
|
+
await this.markPendingConfig({ plugin, version: gone.version, sha256: gone.sha256, source: gone.source }, issues, "extension unloaded: its deployment config was cleared and what remains is missing or invalid (set it in the admin console or the startup config; it loads without a restart)");
|
|
1933
|
+
await this.cascade(gone.manifest.provides, drainMs);
|
|
1934
|
+
}
|
|
1935
|
+
/**
|
|
1936
|
+
* Records an extension that is not loaded as pending configuration: a config-declared one goes
|
|
1937
|
+
* back to {@link pendingActivations} (a later save loads it); an install record is decided again
|
|
1938
|
+
* on every converge.
|
|
1939
|
+
*/
|
|
1940
|
+
async markPendingConfig(p, issues, message) {
|
|
1941
|
+
const detail = issues.map((i) => `${i.path || "<root>"}: ${i.message}`).join("; ");
|
|
1942
|
+
const declared = this.declaredActivations.get(p.plugin);
|
|
1943
|
+
if (p.source !== "install") {
|
|
1944
|
+
this.configValidity.set(p.plugin, false);
|
|
1945
|
+
if (declared)
|
|
1946
|
+
this.pendingActivations.set(p.plugin, { ...declared, fatal: false });
|
|
1947
|
+
}
|
|
1948
|
+
this.configWarned.set(p.plugin, detail);
|
|
1949
|
+
this.log.warn(message, { plugin: p.plugin, source: p.source, detail });
|
|
1950
|
+
await this.writeStatus({ ...p, state: "pending", reason: "config", detail });
|
|
1951
|
+
}
|
|
1952
|
+
/**
|
|
1953
|
+
* Before an extension unloaded for a dependency comes back ({@link cascade}): re-reads its
|
|
1954
|
+
* deployment config, which may have been saved or cleared while it was down (applyDeploymentConfig
|
|
1955
|
+
* only records validity then), and refreshes its load parameters, so it never returns on a stale
|
|
1956
|
+
* config or revoked secrets. Returns false when the config is now missing or invalid and PG holds
|
|
1957
|
+
* none: the extension is left pending configuration instead. A read error, or an invalid config
|
|
1958
|
+
* that is still stored, keeps the previous config (as for a loaded extension).
|
|
1959
|
+
*/
|
|
1960
|
+
async refreshConfigForRestore(name, spec) {
|
|
1961
|
+
const schema = spec.manifest.config?.deployment;
|
|
1962
|
+
if (!schema)
|
|
1963
|
+
return true;
|
|
1964
|
+
let raw;
|
|
1965
|
+
try {
|
|
1966
|
+
raw = await this.rawConfigOf(name, schema);
|
|
1967
|
+
}
|
|
1968
|
+
catch (err) {
|
|
1969
|
+
this.log.error("cannot read the stored deployment config of plugin; restoring it on its previous config", { plugin: name, err });
|
|
1970
|
+
return true;
|
|
1971
|
+
}
|
|
1972
|
+
const r = parseLoadGate(schema, raw);
|
|
1973
|
+
if (!r.success) {
|
|
1974
|
+
if (!(await this.clearedInPg(name)))
|
|
1975
|
+
return true;
|
|
1976
|
+
await this.markPendingConfig({
|
|
1977
|
+
plugin: name,
|
|
1978
|
+
version: spec.manifest.version,
|
|
1979
|
+
sha256: spec.sha256,
|
|
1980
|
+
source: spec.source,
|
|
1981
|
+
}, toIssues(r.error), "extension not restored after its dependency came back: its deployment config was cleared and what remains is missing or invalid (set it in the admin console or the startup config; it loads without a restart)");
|
|
1982
|
+
return false;
|
|
1983
|
+
}
|
|
1984
|
+
if (spec.source !== "install")
|
|
1985
|
+
this.configValidity.set(name, true);
|
|
1986
|
+
if (changedPaths(schema, spec.config, r.data).length > 0) {
|
|
1987
|
+
this.reportSecrets(schema, r.data);
|
|
1988
|
+
this.specs.set(name, {
|
|
1989
|
+
...spec,
|
|
1990
|
+
config: r.data,
|
|
1991
|
+
configHash: deploymentConfigHash(schema, r.data),
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
return true;
|
|
1995
|
+
}
|
|
1713
1996
|
/** 本次未加载、等待批准权限的插件(含因 `requires` 只能由它们满足而未加载的插件),按依赖拓扑序。 */
|
|
1714
1997
|
pending() {
|
|
1715
1998
|
return structuredClone(this.pendingPlugins);
|
|
1716
1999
|
}
|
|
1717
2000
|
/** 已加载插件的清单(按加载顺序,即依赖拓扑序)。 */
|
|
1718
2001
|
manifests() {
|
|
1719
|
-
return this.registry.
|
|
2002
|
+
return this.registry.manifests();
|
|
1720
2003
|
}
|
|
1721
2004
|
/** 已加载插件的权限集合(加载时计算,清单不可变);未加载返回 undefined。 */
|
|
1722
2005
|
permissionSet(plugin) {
|
|
@@ -1756,15 +2039,13 @@ export class ExtensionHost {
|
|
|
1756
2039
|
}
|
|
1757
2040
|
/** 安装记录里的插件名(缓存,见 {@link unavailable})。 */
|
|
1758
2041
|
installed() {
|
|
1759
|
-
const load = this.installedNames;
|
|
1760
|
-
if (!load)
|
|
1761
|
-
return Promise.resolve(new Set());
|
|
1762
2042
|
const now = Date.now();
|
|
1763
2043
|
if (!this.installedCache || now - this.installedCache.at > KNOWN_NAMES_TTL_MS) {
|
|
1764
|
-
const names =
|
|
2044
|
+
const names = this.installs
|
|
2045
|
+
.installedNames()
|
|
1765
2046
|
.then((xs) => new Set(xs))
|
|
1766
2047
|
.catch((err) => {
|
|
1767
|
-
this.
|
|
2048
|
+
this.log.warn("cannot read plugin install records for the route gate", { err });
|
|
1768
2049
|
this.installedCache = undefined;
|
|
1769
2050
|
return new Set();
|
|
1770
2051
|
});
|
|
@@ -1881,7 +2162,7 @@ export class ExtensionHost {
|
|
|
1881
2162
|
reason,
|
|
1882
2163
|
detail: null,
|
|
1883
2164
|
});
|
|
1884
|
-
this.
|
|
2165
|
+
this.log.info("plugin unloaded", { plugin, generation: inst.generation, reason });
|
|
1885
2166
|
return inst;
|
|
1886
2167
|
}
|
|
1887
2168
|
/** 新建实例并原子替换、撤销旧实例(不做连锁)。 */
|
|
@@ -1913,11 +2194,11 @@ export class ExtensionHost {
|
|
|
1913
2194
|
source: inst.source,
|
|
1914
2195
|
state: "loaded",
|
|
1915
2196
|
reason: null,
|
|
1916
|
-
detail:
|
|
2197
|
+
detail: this.checkConfigUi(spec.manifest),
|
|
1917
2198
|
});
|
|
1918
2199
|
if (old)
|
|
1919
2200
|
await this.disposeQuietly(old, drainMs);
|
|
1920
|
-
this.
|
|
2201
|
+
this.log.info("plugin reloaded", { plugin, generation: inst.generation });
|
|
1921
2202
|
return inst;
|
|
1922
2203
|
}
|
|
1923
2204
|
/** 生效实例按依赖拓扑排序(解析不了时退回注册表顺序)。 */
|
|
@@ -1971,7 +2252,7 @@ export class ExtensionHost {
|
|
|
1971
2252
|
catch (err) {
|
|
1972
2253
|
if (this.closed)
|
|
1973
2254
|
throw err;
|
|
1974
|
-
this.
|
|
2255
|
+
this.log.error("dependent plugin reload failed; it keeps its previous instance", {
|
|
1975
2256
|
plugin: name,
|
|
1976
2257
|
err,
|
|
1977
2258
|
});
|
|
@@ -1989,6 +2270,10 @@ export class ExtensionHost {
|
|
|
1989
2270
|
const available = providedNow();
|
|
1990
2271
|
if (!(spec.manifest.requires ?? []).every((c) => available.has(c)))
|
|
1991
2272
|
continue;
|
|
2273
|
+
if (!(await this.refreshConfigForRestore(name, spec))) {
|
|
2274
|
+
this.unloadedForDependency.delete(name);
|
|
2275
|
+
continue;
|
|
2276
|
+
}
|
|
1992
2277
|
try {
|
|
1993
2278
|
await this.doReload(name, drainMs);
|
|
1994
2279
|
progress = true;
|
|
@@ -1996,7 +2281,7 @@ export class ExtensionHost {
|
|
|
1996
2281
|
catch (err) {
|
|
1997
2282
|
if (this.closed)
|
|
1998
2283
|
throw err;
|
|
1999
|
-
this.
|
|
2284
|
+
this.log.error("plugin reload after its dependency came back failed", {
|
|
2000
2285
|
plugin: name,
|
|
2001
2286
|
err,
|
|
2002
2287
|
});
|
|
@@ -2012,7 +2297,7 @@ export class ExtensionHost {
|
|
|
2012
2297
|
await inst.dispose({ drainMs, disposeTimeoutMs: this.disposeTimeoutMs() });
|
|
2013
2298
|
}
|
|
2014
2299
|
catch (err) {
|
|
2015
|
-
this.
|
|
2300
|
+
this.log.error("plugin dispose failed", { plugin: inst.name, err });
|
|
2016
2301
|
}
|
|
2017
2302
|
}
|
|
2018
2303
|
/**
|
|
@@ -2026,32 +2311,20 @@ export class ExtensionHost {
|
|
|
2026
2311
|
this.closed = true;
|
|
2027
2312
|
this.abort.abort();
|
|
2028
2313
|
await this.migrating?.catch(() => { });
|
|
2029
|
-
|
|
2030
|
-
await
|
|
2031
|
-
this.lifecycle.catch(() => { }),
|
|
2032
|
-
new Promise((resolve) => {
|
|
2033
|
-
timer = setTimeout(resolve, opts.lifecycleWaitMs ?? CLOSE_LIFECYCLE_WAIT_MS);
|
|
2034
|
-
}),
|
|
2035
|
-
]);
|
|
2036
|
-
clearTimeout(timer);
|
|
2314
|
+
const lifecycleWaitMs = opts.lifecycleWaitMs ?? CLOSE_LIFECYCLE_WAIT_MS;
|
|
2315
|
+
await waitWithin(this.lifecycle.catch(() => { }), lifecycleWaitMs);
|
|
2037
2316
|
// 升级时被替换、后台排空中的旧实例:同样最多等 lifecycleWaitMs,之后强制撤销(中止在途调用、不再排空),
|
|
2038
2317
|
// 赶在共用资源(Redis / PG)关闭之前
|
|
2039
2318
|
if (this.retiring.size > 0) {
|
|
2040
|
-
await Promise.
|
|
2041
|
-
Promise.allSettled([...this.retiring.values()]),
|
|
2042
|
-
new Promise((resolve) => {
|
|
2043
|
-
timer = setTimeout(resolve, opts.lifecycleWaitMs ?? CLOSE_LIFECYCLE_WAIT_MS);
|
|
2044
|
-
}),
|
|
2045
|
-
]);
|
|
2046
|
-
clearTimeout(timer);
|
|
2319
|
+
await waitWithin(Promise.allSettled([...this.retiring.values()]), lifecycleWaitMs);
|
|
2047
2320
|
await Promise.allSettled([...this.retiring.keys()].map((old) => old.hurry().catch((err) => {
|
|
2048
|
-
this.
|
|
2321
|
+
this.log.warn("plugin close failed", { plugin: old.name, err });
|
|
2049
2322
|
})));
|
|
2050
2323
|
}
|
|
2051
2324
|
const settingUp = this.settingUp;
|
|
2052
2325
|
this.settingUp = undefined;
|
|
2053
2326
|
await settingUp?.close().catch((e) => {
|
|
2054
|
-
this.
|
|
2327
|
+
this.log.error("plugin close failed", { err: e });
|
|
2055
2328
|
});
|
|
2056
2329
|
for (const inst of this.registry.all().reverse()) {
|
|
2057
2330
|
this.registry.deactivate(inst.name);
|
|
@@ -2061,11 +2334,30 @@ export class ExtensionHost {
|
|
|
2061
2334
|
waitQueueJobs: true,
|
|
2062
2335
|
disposeTimeoutMs: this.disposeTimeoutMs(),
|
|
2063
2336
|
});
|
|
2064
|
-
this.
|
|
2337
|
+
this.log.info("plugin closed", { plugin: inst.name });
|
|
2065
2338
|
}
|
|
2066
2339
|
catch (e) {
|
|
2067
|
-
this.
|
|
2340
|
+
this.log.error("plugin close failed", { plugin: inst.name, err: e });
|
|
2068
2341
|
}
|
|
2069
2342
|
}
|
|
2070
2343
|
}
|
|
2071
|
-
}
|
|
2344
|
+
};
|
|
2345
|
+
ExtensionHost = __decorate([
|
|
2346
|
+
Injectable(),
|
|
2347
|
+
__param(0, Inject(ExtensionRegistry)),
|
|
2348
|
+
__param(1, Inject(ExtensionInstalls)),
|
|
2349
|
+
__param(2, Inject(ExtensionApprovals)),
|
|
2350
|
+
__param(3, Inject(ReplicaStatusStore)),
|
|
2351
|
+
__param(4, Inject(KernelConfigService)),
|
|
2352
|
+
__param(5, Inject(KernelDb)),
|
|
2353
|
+
__param(6, Inject(REDIS)),
|
|
2354
|
+
__param(7, Inject(REDIS_SUBSCRIBER)),
|
|
2355
|
+
__param(8, Inject(KEYRING)),
|
|
2356
|
+
__param(9, Inject(EmbedTokens)),
|
|
2357
|
+
__param(10, Inject(LockService)),
|
|
2358
|
+
__param(11, Inject(KERNEL_LOGGER)),
|
|
2359
|
+
__param(12, Inject(KERNEL_APP_OPTIONS)),
|
|
2360
|
+
__param(13, Inject(EffectiveConfigs)),
|
|
2361
|
+
__param(14, Inject(ModelEmbeddings))
|
|
2362
|
+
], ExtensionHost);
|
|
2363
|
+
export { ExtensionHost };
|