@capybara-hq/kernel 0.1.0-rc.3 → 0.1.0-rc.5
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 +61 -5
- package/dist/admin/admin.controller.d.ts +47 -16
- package/dist/admin/admin.controller.js +44 -19
- package/dist/admin/extensions.controller.d.ts +24 -3
- package/dist/admin/extensions.controller.js +48 -8
- package/dist/admin/setup-lock.d.ts +1 -1
- package/dist/admin/setup-lock.js +1 -1
- package/dist/admin/setup.controller.d.ts +1 -1
- package/dist/admin/setup.controller.js +1 -1
- package/dist/admin/setup.service.d.ts +4 -4
- package/dist/admin/setup.service.js +8 -8
- package/dist/agents/agent-lookup.d.ts +19 -0
- package/dist/agents/agent-lookup.js +21 -0
- package/dist/agents/agent-profile.service.d.ts +29 -0
- package/dist/agents/agent-profile.service.js +117 -0
- package/dist/agents/agents.controller.d.ts +168 -3
- package/dist/agents/agents.controller.js +201 -12
- package/dist/agents/agents.module.d.ts +4 -1
- package/dist/agents/agents.module.js +36 -6
- package/dist/agents/agents.service.d.ts +64 -27
- package/dist/agents/agents.service.js +199 -74
- package/dist/agents/definition.d.ts +53 -0
- package/dist/agents/definition.js +55 -0
- package/dist/agents/from-template.d.ts +106 -0
- package/dist/agents/from-template.js +649 -0
- package/dist/agents/from-template.service.d.ts +60 -0
- package/dist/agents/from-template.service.js +161 -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 +9 -3
- package/dist/agents/models.controller.js +19 -4
- package/dist/agents/org-templates.d.ts +176 -0
- package/dist/agents/org-templates.js +827 -0
- package/dist/agents/pending-connector-requests.d.ts +77 -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 +96 -0
- package/dist/agents/profile.js +51 -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 +86 -5
- package/dist/agents/templates.controller.js +171 -7
- package/dist/agents/templates.d.ts +127 -23
- package/dist/agents/templates.js +476 -53
- package/dist/background/background.controller.d.ts +38 -0
- package/dist/background/background.controller.js +87 -0
- package/dist/background/background.module.d.ts +10 -0
- package/dist/background/background.module.js +39 -0
- package/dist/background/finish.d.ts +44 -0
- package/dist/background/finish.js +94 -0
- package/dist/background/launch-lock.d.ts +15 -0
- package/dist/background/launch-lock.js +40 -0
- package/dist/background/launch.d.ts +36 -0
- package/dist/background/launch.js +70 -0
- package/dist/background/poll.job.d.ts +56 -0
- package/dist/background/poll.job.js +190 -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 +79 -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 +243 -0
- package/dist/background/store.d.ts +162 -0
- package/dist/background/store.js +357 -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 +211 -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 +129 -30
- package/dist/catalog/admin-catalog.controller.js +213 -42
- package/dist/catalog/catalog-content.d.ts +58 -32
- package/dist/catalog/catalog-content.js +34 -8
- 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 +111 -7
- package/dist/catalog/catalog-items.js +279 -13
- package/dist/catalog/catalog-scope.service.d.ts +260 -0
- package/dist/catalog/catalog-scope.service.js +1116 -0
- package/dist/catalog/catalog.module.d.ts +7 -9
- package/dist/catalog/catalog.module.js +41 -31
- package/dist/catalog/catalog.service.d.ts +101 -29
- package/dist/catalog/catalog.service.js +104 -106
- package/dist/catalog/claude/agents.js +2 -0
- package/dist/catalog/cli.d.ts +11 -1
- package/dist/catalog/cli.js +26 -1
- 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 +152 -0
- package/dist/catalog/component-scope.controller.js +287 -0
- package/dist/catalog/component-scope.service.d.ts +303 -0
- package/dist/catalog/component-scope.service.js +936 -0
- package/dist/catalog/component-state.d.ts +174 -0
- package/dist/catalog/component-state.js +437 -0
- package/dist/catalog/job-ids.d.ts +30 -0
- package/dist/catalog/job-ids.js +25 -0
- package/dist/catalog/marketplace-fetch.d.ts +1 -1
- package/dist/catalog/marketplaces.controller.d.ts +22 -5
- package/dist/catalog/marketplaces.controller.js +56 -7
- package/dist/catalog/marketplaces.service.d.ts +54 -14
- package/dist/catalog/marketplaces.service.js +71 -22
- package/dist/catalog/org-catalog.controller.d.ts +125 -34
- package/dist/catalog/org-catalog.controller.js +181 -65
- package/dist/catalog/org-catalog.service.d.ts +65 -33
- package/dist/catalog/org-catalog.service.js +324 -157
- 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 +119 -0
- package/dist/catalog/org-extension.controller.js +266 -0
- package/dist/catalog/org-plugin-uploads.controller.d.ts +98 -0
- package/dist/catalog/org-plugin-uploads.controller.js +213 -0
- package/dist/catalog/org-plugin-uploads.d.ts +63 -0
- package/dist/catalog/org-plugin-uploads.js +116 -0
- package/dist/catalog/owned-items.d.ts +184 -0
- package/dist/catalog/owned-items.js +789 -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 +221 -0
- package/dist/catalog/platform-components.js +761 -0
- package/dist/catalog/platform-migration.d.ts +115 -0
- package/dist/catalog/platform-migration.js +582 -0
- package/dist/catalog/plugin-import.d.ts +178 -34
- package/dist/catalog/plugin-import.js +623 -83
- package/dist/catalog/plugin-install.d.ts +185 -41
- package/dist/catalog/plugin-install.js +758 -126
- package/dist/catalog/plugin-upgrade.d.ts +260 -225
- package/dist/catalog/plugin-upgrade.js +1148 -1137
- package/dist/catalog/request-rules.d.ts +65 -0
- package/dist/catalog/request-rules.js +217 -0
- package/dist/catalog/requests.service.d.ts +193 -118
- package/dist/catalog/requests.service.js +526 -343
- 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 +118 -0
- package/dist/channels/actions.js +1 -0
- package/dist/channels/cards.js +21 -3
- package/dist/channels/channels.module.js +2 -0
- package/dist/channels/connections.service.d.ts +16 -1
- package/dist/channels/connections.service.js +38 -4
- package/dist/channels/inbound.d.ts +9 -1
- package/dist/channels/inbound.js +67 -5
- package/dist/channels/phrases.d.ts +35 -0
- package/dist/channels/phrases.js +29 -0
- package/dist/channels/threads.d.ts +5 -0
- package/dist/channels/threads.js +8 -0
- package/dist/config/docs.js +3 -1
- package/dist/config/schema.d.ts +24 -2
- package/dist/config/schema.js +145 -19
- package/dist/conversations/access.d.ts +6 -4
- package/dist/conversations/access.js +29 -5
- package/dist/conversations/agent-tree.d.ts +46 -0
- package/dist/conversations/agent-tree.js +92 -0
- package/dist/conversations/attachments.service.d.ts +30 -0
- package/dist/conversations/attachments.service.js +130 -5
- package/dist/conversations/conversations.controller.d.ts +79 -23
- package/dist/conversations/conversations.controller.js +141 -50
- package/dist/conversations/conversations.module.d.ts +1 -1
- package/dist/conversations/conversations.module.js +10 -7
- package/dist/conversations/conversations.service.d.ts +108 -9
- package/dist/conversations/conversations.service.js +237 -30
- package/dist/conversations/environment-status.d.ts +24 -0
- package/dist/conversations/environment-status.js +71 -0
- package/dist/conversations/event-log.d.ts +21 -6
- package/dist/conversations/event-log.js +70 -1
- package/dist/conversations/events.d.ts +140 -0
- package/dist/conversations/events.js +142 -13
- package/dist/conversations/queue.d.ts +3 -1
- package/dist/conversations/queue.js +13 -2
- package/dist/conversations/queue.service.d.ts +1 -1
- package/dist/conversations/queue.service.js +8 -1
- package/dist/conversations/titles.d.ts +12 -3
- package/dist/conversations/titles.js +36 -8
- package/dist/conversations/tree.d.ts +17 -0
- package/dist/conversations/tree.js +42 -0
- package/dist/ctx/create-ctx.d.ts +5 -0
- package/dist/ctx/create-ctx.js +15 -5
- package/dist/db/kernel-schema.d.ts +420 -20
- package/dist/db/pool.d.ts +5 -0
- package/dist/db/pool.js +3 -0
- package/dist/environments/access.d.ts +41 -0
- package/dist/environments/access.js +77 -0
- package/dist/environments/conversation-environments.d.ts +61 -0
- package/dist/environments/conversation-environments.js +170 -0
- package/dist/environments/dto.d.ts +25 -0
- package/dist/environments/dto.js +12 -0
- package/dist/environments/environments.controller.d.ts +33 -0
- package/dist/environments/environments.controller.js +110 -0
- package/dist/environments/environments.module.d.ts +8 -0
- package/dist/environments/environments.module.js +27 -0
- package/dist/environments/environments.service.d.ts +153 -0
- package/dist/environments/environments.service.js +541 -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 +90 -2
- package/dist/errors.js +90 -2
- package/dist/evals/reconstruct.d.ts +18 -9
- package/dist/evals/reconstruct.js +26 -7
- package/dist/evals/run-replay.d.ts +7 -2
- package/dist/evals/run-replay.js +42 -7
- package/dist/evals/step-replay.d.ts +2 -5
- package/dist/evals/step-replay.js +13 -7
- package/dist/evals/trajectory.js +1 -1
- package/dist/evals/trajectory.service.d.ts +8 -3
- package/dist/evals/trajectory.service.js +26 -14
- package/dist/evals/worker.d.ts +5 -5
- package/dist/evals/worker.js +9 -3
- package/dist/extensions/admin-ops.d.ts +36 -10
- package/dist/extensions/admin-ops.js +67 -42
- package/dist/extensions/admin-view.d.ts +39 -10
- package/dist/extensions/admin-view.js +111 -20
- package/dist/extensions/blobs.js +1 -0
- package/dist/extensions/bootstrap.d.ts +17 -4
- package/dist/extensions/bootstrap.js +70 -9
- package/dist/extensions/cli.d.ts +12 -0
- package/dist/extensions/cli.js +11 -2
- package/dist/extensions/config-issues.d.ts +13 -1
- package/dist/extensions/config-issues.js +22 -5
- 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 +6 -0
- package/dist/extensions/deployment-config.d.ts +78 -8
- package/dist/extensions/deployment-config.js +172 -34
- 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/extensions.module.js +14 -2
- package/dist/extensions/hooks.d.ts +37 -4
- package/dist/extensions/hooks.js +82 -16
- package/dist/extensions/host.d.ts +45 -2
- package/dist/extensions/host.js +112 -16
- package/dist/extensions/installs.d.ts +20 -8
- package/dist/extensions/installs.js +37 -15
- package/dist/extensions/org-config.d.ts +81 -6
- package/dist/extensions/org-config.js +195 -44
- 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 +19 -4
- package/dist/extensions/permission-view.js +4 -4
- 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 +34 -0
- package/dist/extensions/point-defaults.controller.js +71 -0
- package/dist/extensions/point-defaults.d.ts +71 -0
- package/dist/extensions/point-defaults.js +234 -0
- package/dist/extensions/registry.d.ts +1 -1
- package/dist/extensions/registry.js +2 -0
- package/dist/extensions/resolve.d.ts +5 -1
- package/dist/extensions/resolve.js +15 -2
- package/dist/files/previewers.d.ts +8 -1
- package/dist/files/previewers.js +35 -6
- package/dist/http/api.module.js +31 -3
- package/dist/http/app.d.ts +11 -2
- package/dist/http/app.js +31 -5
- package/dist/http/nest-logger.d.ts +6 -5
- package/dist/http/nest-logger.js +24 -10
- package/dist/identity/accounts.d.ts +29 -29
- package/dist/identity/accounts.js +47 -47
- package/dist/identity/audit.d.ts +2 -1
- package/dist/identity/auth.controller.js +9 -5
- package/dist/identity/auth.guard.d.ts +13 -5
- package/dist/identity/auth.guard.js +26 -9
- package/dist/identity/cookies.d.ts +20 -5
- package/dist/identity/cookies.js +44 -6
- package/dist/identity/identity.module.d.ts +1 -1
- package/dist/identity/identity.module.js +4 -4
- package/dist/identity/me.controller.d.ts +5 -1
- package/dist/identity/me.controller.js +12 -3
- package/dist/identity/principal.d.ts +3 -3
- package/dist/identity/principal.js +3 -3
- package/dist/identity/sessions.d.ts +12 -0
- package/dist/identity/sessions.js +45 -0
- package/dist/identity/settings.d.ts +22 -11
- package/dist/identity/settings.js +53 -18
- package/dist/identity/{enterprise-admin.d.ts → super-admin.d.ts} +5 -5
- package/dist/identity/{enterprise-admin.js → super-admin.js} +24 -24
- package/dist/inbox/inbox.module.d.ts +4 -1
- package/dist/inbox/inbox.module.js +7 -3
- package/dist/inbox/inbox.service.d.ts +62 -3
- package/dist/inbox/inbox.service.js +74 -4
- package/dist/inbox/org-notices.d.ts +63 -0
- package/dist/inbox/org-notices.js +91 -0
- package/dist/inbox/platform-inbox.controller.d.ts +23 -0
- package/dist/inbox/platform-inbox.controller.js +58 -0
- package/dist/inbox/platform-inbox.service.d.ts +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 +2 -2
- package/dist/index.js +1 -1
- package/dist/infra/cli/kernel-cli.module.js +9 -1
- package/dist/infra/config/kernel-config.service.js +27 -1
- package/dist/infra/database/database.module.js +1 -0
- package/dist/infra/database/xact-lock.d.ts +1 -1
- package/dist/infra/database/xact-lock.js +1 -1
- package/dist/infra/events/kernel-events.d.ts +19 -2
- package/dist/infra/lifecycle/process-guards.js +4 -0
- package/dist/infra/logging/logging.module.d.ts +4 -2
- package/dist/infra/logging/logging.module.js +24 -6
- 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/redis-connection.d.ts +6 -0
- package/dist/infra/queue/redis-connection.js +7 -0
- package/dist/infra/redis/redis.module.js +6 -2
- package/dist/infra/tokens.d.ts +6 -1
- package/dist/infra/tokens.js +6 -1
- package/dist/kernel.module.js +6 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +1 -1
- package/dist/lifecycle/kernel-lifecycle.js +4 -4
- package/dist/log.d.ts +13 -1
- package/dist/log.js +93 -17
- package/dist/models/prices.d.ts +5 -5
- package/dist/models/prices.js +4 -4
- package/dist/models/purposes.controller.d.ts +6 -4
- package/dist/models/purposes.controller.js +13 -7
- package/dist/models/purposes.d.ts +43 -9
- package/dist/models/purposes.js +48 -18
- package/dist/orgs/directory-sync.d.ts +14 -5
- package/dist/orgs/directory-sync.js +41 -17
- package/dist/orgs/offboarding.d.ts +12 -8
- package/dist/orgs/offboarding.js +54 -33
- package/dist/orgs/org-lock.d.ts +5 -0
- package/dist/orgs/org-lock.js +13 -0
- package/dist/orgs/org.guard.d.ts +10 -0
- package/dist/orgs/org.guard.js +43 -32
- package/dist/orgs/orgs.module.js +3 -0
- package/dist/orgs/orgs.service.d.ts +20 -7
- package/dist/orgs/orgs.service.js +32 -12
- package/dist/orgs/roles.d.ts +1 -1
- package/dist/orgs/roles.js +5 -1
- package/dist/orgs/settings.controller.d.ts +1 -1
- package/dist/orgs/settings.service.d.ts +20 -3
- package/dist/orgs/settings.service.js +19 -4
- package/dist/overrides.d.ts +3 -0
- package/dist/overrides.js +2 -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 +11 -0
- package/dist/platform/errors.js +26 -0
- package/dist/platform/exclusions.d.ts +12 -0
- package/dist/platform/exclusions.js +1387 -0
- package/dist/platform/method.d.ts +6 -0
- package/dist/platform/method.js +15 -0
- package/dist/platform/operation.d.ts +92 -0
- package/dist/platform/operation.js +35 -0
- package/dist/platform/ops/agent-templates.ops.d.ts +14 -0
- package/dist/platform/ops/agent-templates.ops.js +92 -0
- package/dist/platform/ops/agents.ops.d.ts +19 -0
- package/dist/platform/ops/agents.ops.js +294 -0
- package/dist/platform/ops/connectors.ops.d.ts +15 -0
- package/dist/platform/ops/connectors.ops.js +126 -0
- package/dist/platform/ops/errors.d.ts +11 -0
- package/dist/platform/ops/errors.js +22 -0
- package/dist/platform/ops/extensions.ops.d.ts +19 -0
- package/dist/platform/ops/extensions.ops.js +116 -0
- package/dist/platform/ops/marketplaces.ops.d.ts +16 -0
- package/dist/platform/ops/marketplaces.ops.js +157 -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 +23 -0
- package/dist/platform/ops/platform.ops.js +158 -0
- package/dist/platform/ops/plugins.ops.d.ts +33 -0
- package/dist/platform/ops/plugins.ops.js +377 -0
- package/dist/platform/ops/requests.ops.d.ts +14 -0
- package/dist/platform/ops/requests.ops.js +153 -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 +13 -0
- package/dist/platform/ops/skills.ops.js +98 -0
- package/dist/platform/ops/summary.d.ts +10 -0
- package/dist/platform/ops/summary.js +18 -0
- package/dist/platform/platform-ops.module.d.ts +7 -0
- package/dist/platform/platform-ops.module.js +55 -0
- package/dist/platform/platform.module.d.ts +8 -0
- package/dist/platform/platform.module.js +25 -0
- package/dist/platform/redact-orgs.d.ts +7 -0
- package/dist/platform/redact-orgs.js +52 -0
- package/dist/platform/registry.d.ts +30 -0
- package/dist/platform/registry.js +111 -0
- package/dist/roles/worker-role.d.ts +6 -4
- package/dist/roles/worker-role.js +14 -7
- package/dist/roles/worker.module.d.ts +1 -1
- package/dist/roles/worker.module.js +15 -1
- package/dist/runtime/context/build.d.ts +11 -7
- package/dist/runtime/context/build.js +46 -19
- package/dist/runtime/context/claude-tools.d.ts +3 -1
- package/dist/runtime/context/claude-tools.js +8 -6
- package/dist/runtime/context/compaction.js +13 -0
- package/dist/runtime/context/reminders.d.ts +2 -0
- package/dist/runtime/context/reminders.js +2 -0
- package/dist/runtime/context/skills.js +9 -2
- package/dist/runtime/context/tool-changes.d.ts +27 -0
- package/dist/runtime/context/tool-changes.js +60 -0
- package/dist/runtime/hook-calls.js +2 -0
- package/dist/runtime/langgraph-loop.d.ts +3 -1
- package/dist/runtime/langgraph-loop.js +36 -17
- package/dist/runtime/loop.d.ts +34 -5
- package/dist/runtime/maintenance.d.ts +9 -4
- package/dist/runtime/maintenance.js +35 -8
- package/dist/runtime/model-call.d.ts +46 -8
- package/dist/runtime/model-call.js +72 -21
- package/dist/runtime/providers.d.ts +6 -0
- package/dist/runtime/providers.js +8 -0
- package/dist/runtime/run-control.d.ts +11 -1
- package/dist/runtime/run-control.js +12 -0
- package/dist/runtime/run-drafts.d.ts +85 -0
- package/dist/runtime/run-drafts.js +230 -0
- package/dist/runtime/run-jobs.d.ts +3 -5
- package/dist/runtime/run-jobs.js +3 -7
- package/dist/runtime/run-queue.d.ts +59 -2
- package/dist/runtime/run-queue.js +311 -38
- package/dist/runtime/run-worker.d.ts +11 -5
- package/dist/runtime/run-worker.js +69 -33
- package/dist/runtime/runtime.module.js +11 -3
- package/dist/runtime/step-log.d.ts +15 -4
- package/dist/runtime/step-log.js +24 -7
- package/dist/runtime/stream.controller.d.ts +23 -1
- package/dist/runtime/stream.controller.js +60 -3
- package/dist/runtime/stream.d.ts +4 -1
- package/dist/runtime/stream.js +27 -3
- package/dist/runtime/subagents/child.d.ts +55 -7
- package/dist/runtime/subagents/child.js +105 -7
- package/dist/runtime/subagents/definition.d.ts +12 -3
- package/dist/runtime/subagents/definition.js +44 -28
- package/dist/runtime/subagents/deliveries.d.ts +71 -0
- package/dist/runtime/subagents/deliveries.js +228 -0
- package/dist/runtime/subagents/dispatch.d.ts +115 -26
- package/dist/runtime/subagents/dispatch.js +212 -141
- package/dist/runtime/subagents/limits.d.ts +24 -5
- package/dist/runtime/subagents/limits.js +40 -6
- package/dist/runtime/subagents/messages.d.ts +95 -0
- package/dist/runtime/subagents/messages.js +328 -0
- package/dist/runtime/subagents/preamble.d.ts +4 -4
- package/dist/runtime/subagents/preamble.js +9 -7
- package/dist/runtime/subagents/progress.d.ts +8 -6
- package/dist/runtime/subagents/progress.js +11 -6
- package/dist/runtime/subagents/render.d.ts +30 -0
- package/dist/runtime/subagents/render.js +53 -0
- package/dist/runtime/subagents/roster.d.ts +24 -7
- package/dist/runtime/subagents/roster.js +47 -11
- package/dist/runtime/subagents/skill-fork.d.ts +3 -2
- package/dist/runtime/subagents/skill-fork.js +8 -4
- package/dist/runtime/subagents/status.d.ts +14 -0
- package/dist/runtime/subagents/status.js +23 -0
- package/dist/runtime/subagents/subagents.service.d.ts +7 -4
- package/dist/runtime/subagents/subagents.service.js +11 -6
- package/dist/runtime/usage-report.d.ts +2 -1
- package/dist/runtime/usage-report.js +19 -13
- package/dist/runtime/waits.d.ts +145 -36
- package/dist/runtime/waits.js +423 -109
- package/dist/sandbox/jobs.d.ts +40 -13
- package/dist/sandbox/jobs.js +57 -20
- package/dist/sandbox/leases.d.ts +37 -54
- package/dist/sandbox/leases.js +71 -115
- package/dist/sandbox/providers.d.ts +2 -2
- package/dist/sandbox/providers.js +1 -1
- package/dist/sandbox/sandbox.module.d.ts +3 -2
- package/dist/sandbox/sandbox.module.js +10 -4
- package/dist/sandbox/sandbox.service.d.ts +282 -129
- package/dist/sandbox/sandbox.service.js +736 -381
- package/dist/skills/catalog.d.ts +3 -2
- package/dist/skills/catalog.js +21 -43
- package/dist/skills/changes.controller.d.ts +7 -0
- package/dist/skills/changes.controller.js +19 -1
- package/dist/skills/invoke.js +8 -3
- package/dist/skills/package.d.ts +20 -1
- package/dist/skills/package.js +28 -1
- package/dist/skills/skills.controller.d.ts +39 -4
- package/dist/skills/skills.controller.js +88 -10
- package/dist/skills/skills.module.js +10 -1
- package/dist/skills/skills.service.d.ts +106 -26
- package/dist/skills/skills.service.js +421 -75
- package/dist/skills/usable.d.ts +81 -0
- package/dist/skills/usable.js +379 -0
- package/dist/tools/approvals.service.d.ts +20 -2
- package/dist/tools/approvals.service.js +25 -4
- package/dist/tools/builtin-names.d.ts +41 -7
- package/dist/tools/builtin-names.js +59 -7
- package/dist/tools/builtins/agent.d.ts +23 -21
- package/dist/tools/builtins/agent.js +62 -55
- package/dist/tools/builtins/builtin-tools.d.ts +19 -1
- package/dist/tools/builtins/builtin-tools.js +59 -2
- package/dist/tools/builtins/handback.d.ts +28 -0
- package/dist/tools/builtins/handback.js +53 -0
- package/dist/tools/builtins/platform.d.ts +34 -0
- package/dist/tools/builtins/platform.js +362 -0
- package/dist/tools/builtins/sandbox/bash.d.ts +1 -1
- package/dist/tools/builtins/sandbox/bash.js +241 -4
- package/dist/tools/builtins/sandbox/common.d.ts +69 -27
- package/dist/tools/builtins/sandbox/common.js +87 -48
- package/dist/tools/builtins/sandbox/deliver.js +1 -1
- package/dist/tools/builtins/sandbox/edit.js +2 -2
- package/dist/tools/builtins/sandbox/glob.js +2 -2
- package/dist/tools/builtins/sandbox/grep.js +2 -4
- package/dist/tools/builtins/sandbox/index.d.ts +3 -1
- package/dist/tools/builtins/sandbox/index.js +7 -1
- package/dist/tools/builtins/sandbox/read.js +1 -1
- package/dist/tools/builtins/sandbox/task-output.d.ts +74 -0
- package/dist/tools/builtins/sandbox/task-output.js +329 -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.js +2 -2
- 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 +22 -14
- package/dist/tools/builtins/skill-load.js +86 -57
- package/dist/tools/builtins/skill-write.js +1 -1
- 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/connectors.controller.d.ts +10 -0
- package/dist/tools/connectors.controller.js +12 -0
- package/dist/tools/connectors.service.d.ts +46 -5
- package/dist/tools/connectors.service.js +94 -15
- 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 +42 -1
- package/dist/tools/info.js +64 -1
- package/dist/tools/oauth/flow-paths.d.ts +1 -1
- package/dist/tools/oauth/flow-paths.js +1 -1
- package/dist/tools/org-tool-switches.d.ts +74 -0
- package/dist/tools/org-tool-switches.js +184 -0
- package/dist/tools/pipeline.d.ts +46 -40
- package/dist/tools/pipeline.js +202 -364
- package/dist/tools/policy.d.ts +1 -1
- package/dist/tools/policy.js +36 -16
- package/dist/tools/registry.d.ts +120 -8
- package/dist/tools/registry.js +112 -19
- package/dist/tools/tools.module.js +24 -2
- package/dist/tools/validate.js +1 -1
- package/dist/ui/views.d.ts +2 -1
- package/dist/ui/views.js +17 -3
- package/package.json +3 -3
- 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/dist/catalog/upgrade-targets.d.ts +0 -56
- package/dist/catalog/upgrade-targets.js +0 -90
- package/dist/conversations/sandbox-status.d.ts +0 -24
- package/dist/conversations/sandbox-status.js +0 -52
- package/dist/extensions/org-config.controller.d.ts +0 -24
- package/dist/extensions/org-config.controller.js +0 -62
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type PluginExtensionSection } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import type { core } from "zod";
|
|
3
3
|
import type { Keyring } from "../ctx/secrets.js";
|
|
4
|
-
import {
|
|
4
|
+
import { SuperAdminLock } from "../identity/super-admin.js";
|
|
5
5
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
6
6
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
7
7
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
8
|
+
import { OrgLock } from "../orgs/org-lock.js";
|
|
8
9
|
import { type ProvenanceResult } from "../packages/provenance.js";
|
|
9
10
|
import { ExtensionApprovals } from "./approvals.js";
|
|
10
11
|
import { ExtensionBlobs } from "./blobs.js";
|
|
@@ -83,7 +84,7 @@ export interface IngestSource {
|
|
|
83
84
|
export declare class ExtensionInstalls {
|
|
84
85
|
private readonly db;
|
|
85
86
|
readonly txHost: TransactionHost;
|
|
86
|
-
/** The
|
|
87
|
+
/** The super admin lock (identity/super-admin.ts): joins the transaction. */
|
|
87
88
|
private readonly adminLock;
|
|
88
89
|
private readonly blobs;
|
|
89
90
|
private readonly approvals;
|
|
@@ -91,11 +92,15 @@ export declare class ExtensionInstalls {
|
|
|
91
92
|
private readonly registry;
|
|
92
93
|
private readonly config;
|
|
93
94
|
private readonly keyring;
|
|
95
|
+
/** The owner org's lock: an org upload re-checks its org admin instead (ruling P3-10). */
|
|
96
|
+
private readonly orgLock;
|
|
94
97
|
constructor(db: KernelDb, txHost: TransactionHost,
|
|
95
|
-
/** The
|
|
96
|
-
adminLock:
|
|
98
|
+
/** The super admin lock (identity/super-admin.ts): joins the transaction. */
|
|
99
|
+
adminLock: SuperAdminLock, blobs: ExtensionBlobs, approvals: ExtensionApprovals,
|
|
97
100
|
/** The config-declared extension names (an install cannot take them, C15). */
|
|
98
|
-
registry: ExtensionRegistry, config: KernelConfigService, keyring: Keyring
|
|
101
|
+
registry: ExtensionRegistry, config: KernelConfigService, keyring: Keyring,
|
|
102
|
+
/** The owner org's lock: an org upload re-checks its org admin instead (ruling P3-10). */
|
|
103
|
+
orgLock: OrgLock);
|
|
99
104
|
/**
|
|
100
105
|
* An extension's effective deployment config, not validated yet (C10): the startup config
|
|
101
106
|
* (`fileValue`, file / Nacos merged with env) completed by the fields stored in PG; merged by
|
|
@@ -112,19 +117,26 @@ export declare class ExtensionInstalls {
|
|
|
112
117
|
* - extension name equal to a config-declared one -> `extension.config_declared`;
|
|
113
118
|
* - an install record of the same name comes from another npm package -> `extension.name_conflict`
|
|
114
119
|
* (a new version of the same package is an upgrade, handled elsewhere).
|
|
115
|
-
* `actor` null means the CLI (no
|
|
120
|
+
* `actor` null means the CLI (no super admin re-check, audit without an actor). `owner`: an org
|
|
121
|
+
* upload (spec §14, P3-10): the actor is re-checked as an org admin of that org (`catalog.upload`)
|
|
122
|
+
* instead of a super admin; the package is only stored, as always (nothing runs, no install).
|
|
116
123
|
*/
|
|
117
124
|
ingest(actor: string | null, bytes: Uint8Array, src: IngestSource, opts?: {
|
|
118
125
|
actorTokenId?: string;
|
|
119
126
|
store?: "object" | "pg";
|
|
120
127
|
expectPackageName?: string;
|
|
128
|
+
owner?: {
|
|
129
|
+
orgId: string;
|
|
130
|
+
};
|
|
121
131
|
}): Promise<PackageReview>;
|
|
122
132
|
/**
|
|
123
|
-
* The
|
|
133
|
+
* The super admin re-check under its lock, in a transaction of its own (`requires_new`, as
|
|
124
134
|
* before the conversion): the package write that follows never runs inside a caller's
|
|
125
135
|
* transaction holding the lock.
|
|
126
136
|
*/
|
|
127
137
|
private authorize;
|
|
138
|
+
/** The super admin, or for an org upload the owner org's admin, re-checked under its lock. */
|
|
139
|
+
private authorizeIn;
|
|
128
140
|
/**
|
|
129
141
|
* The `extension.package_uploaded` audit, re-checking the actor under the lock, committed on its
|
|
130
142
|
* own (`requires_new`): the stored package it records is not rolled back by a caller either.
|
|
@@ -138,7 +150,7 @@ export declare class ExtensionInstalls {
|
|
|
138
150
|
/**
|
|
139
151
|
* Fetches one package from the configured npm registry (verified by `dist.integrity`, see
|
|
140
152
|
* packages/npm.ts), downloading only, not storing: download failure -> `packages.npm_failed` (502);
|
|
141
|
-
* over `packages.maxBytes` -> `extension.package_too_large`.
|
|
153
|
+
* over `packages.maxBytes` -> `extension.package_too_large`. Platform catalog npm imports use it
|
|
142
154
|
* too.
|
|
143
155
|
*/
|
|
144
156
|
fetchNpm(input: {
|
|
@@ -12,12 +12,13 @@ import { Inject, Injectable } from "@nestjs/common";
|
|
|
12
12
|
import { configFields } from "../config/fields.js";
|
|
13
13
|
import { ApiError } from "../errors.js";
|
|
14
14
|
import { audit } from "../identity/audit.js";
|
|
15
|
-
import {
|
|
15
|
+
import { SuperAdminLock } from "../identity/super-admin.js";
|
|
16
16
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
17
17
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
18
18
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
19
19
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
20
20
|
import { KEYRING } from "../infra/tokens.js";
|
|
21
|
+
import { OrgLock } from "../orgs/org-lock.js";
|
|
21
22
|
import { fetchNpmPackage, IntegrityMismatchError, NpmFetchError, PackageTooLargeError, } from "../packages/npm.js";
|
|
22
23
|
import { fetchProvenance, PROVENANCE_TIMEOUT_MS, } from "../packages/provenance.js";
|
|
23
24
|
import { ExtensionApprovals } from "./approvals.js";
|
|
@@ -45,11 +46,14 @@ let ExtensionInstalls = class ExtensionInstalls {
|
|
|
45
46
|
registry;
|
|
46
47
|
config;
|
|
47
48
|
keyring;
|
|
49
|
+
orgLock;
|
|
48
50
|
constructor(db, txHost,
|
|
49
|
-
/** The
|
|
51
|
+
/** The super admin lock (identity/super-admin.ts): joins the transaction. */
|
|
50
52
|
adminLock, blobs, approvals,
|
|
51
53
|
/** The config-declared extension names (an install cannot take them, C15). */
|
|
52
|
-
registry, config, keyring
|
|
54
|
+
registry, config, keyring,
|
|
55
|
+
/** The owner org's lock: an org upload re-checks its org admin instead (ruling P3-10). */
|
|
56
|
+
orgLock) {
|
|
53
57
|
this.db = db;
|
|
54
58
|
this.txHost = txHost;
|
|
55
59
|
this.adminLock = adminLock;
|
|
@@ -58,6 +62,7 @@ let ExtensionInstalls = class ExtensionInstalls {
|
|
|
58
62
|
this.registry = registry;
|
|
59
63
|
this.config = config;
|
|
60
64
|
this.keyring = keyring;
|
|
65
|
+
this.orgLock = orgLock;
|
|
61
66
|
}
|
|
62
67
|
/**
|
|
63
68
|
* An extension's effective deployment config, not validated yet (C10): the startup config
|
|
@@ -84,9 +89,14 @@ let ExtensionInstalls = class ExtensionInstalls {
|
|
|
84
89
|
* - extension name equal to a config-declared one -> `extension.config_declared`;
|
|
85
90
|
* - an install record of the same name comes from another npm package -> `extension.name_conflict`
|
|
86
91
|
* (a new version of the same package is an upgrade, handled elsewhere).
|
|
87
|
-
* `actor` null means the CLI (no
|
|
92
|
+
* `actor` null means the CLI (no super admin re-check, audit without an actor). `owner`: an org
|
|
93
|
+
* upload (spec §14, P3-10): the actor is re-checked as an org admin of that org (`catalog.upload`)
|
|
94
|
+
* instead of a super admin; the package is only stored, as always (nothing runs, no install).
|
|
88
95
|
*/
|
|
89
96
|
async ingest(actor, bytes, src, opts = {}) {
|
|
97
|
+
if (opts.owner !== undefined && actor === null) {
|
|
98
|
+
throw new Error("an org upload has an actor");
|
|
99
|
+
}
|
|
90
100
|
const maxBytes = this.config.get().packages.maxBytes;
|
|
91
101
|
if (bytes.byteLength > maxBytes) {
|
|
92
102
|
throw new ApiError("extension.package_too_large", `The extension package is larger than ${maxBytes} bytes`);
|
|
@@ -121,9 +131,9 @@ let ExtensionInstalls = class ExtensionInstalls {
|
|
|
121
131
|
if (installed && installed.package_name !== packageName) {
|
|
122
132
|
throw new ApiError("extension.name_conflict", `Extension ${m.name} is already installed from package ${installed.package_name}; package ${packageName} uses the same extension name`);
|
|
123
133
|
}
|
|
124
|
-
//
|
|
134
|
+
// 写包之前在锁内复核发起人仍是超级管理员(守卫读到的身份可能已过期);审计在写完后同样复核
|
|
125
135
|
if (actor !== null)
|
|
126
|
-
await this.authorize(actor);
|
|
136
|
+
await this.authorize(actor, opts.owner);
|
|
127
137
|
await this.blobs.put(pkg, bytes, {
|
|
128
138
|
source: src.source,
|
|
129
139
|
ref: src.ref,
|
|
@@ -135,7 +145,8 @@ let ExtensionInstalls = class ExtensionInstalls {
|
|
|
135
145
|
version: m.version,
|
|
136
146
|
sha256: pkg.sha256,
|
|
137
147
|
source: src.source,
|
|
138
|
-
|
|
148
|
+
...(opts.owner !== undefined && { orgId: opts.owner.orgId }),
|
|
149
|
+
}, opts.owner);
|
|
139
150
|
const set = permissionSetOfPackage(pkg);
|
|
140
151
|
const snapshot = (await this.approvals.all()).get(m.name);
|
|
141
152
|
const { added, removed } = diffPermissions(snapshot?.permissions, set);
|
|
@@ -153,20 +164,27 @@ let ExtensionInstalls = class ExtensionInstalls {
|
|
|
153
164
|
};
|
|
154
165
|
}
|
|
155
166
|
/**
|
|
156
|
-
* The
|
|
167
|
+
* The super admin re-check under its lock, in a transaction of its own (`requires_new`, as
|
|
157
168
|
* before the conversion): the package write that follows never runs inside a caller's
|
|
158
169
|
* transaction holding the lock.
|
|
159
170
|
*/
|
|
160
|
-
async authorize(actor) {
|
|
161
|
-
await this.
|
|
171
|
+
async authorize(actor, owner) {
|
|
172
|
+
await this.authorizeIn(actor, owner);
|
|
173
|
+
}
|
|
174
|
+
/** The super admin, or for an org upload the owner org's admin, re-checked under its lock. */
|
|
175
|
+
async authorizeIn(actor, owner) {
|
|
176
|
+
if (owner !== undefined)
|
|
177
|
+
await this.orgLock.lockAndAuthorize(owner.orgId, actor, "catalog.upload");
|
|
178
|
+
else
|
|
179
|
+
await this.adminLock.lockAndAuthorize(actor);
|
|
162
180
|
}
|
|
163
181
|
/**
|
|
164
182
|
* The `extension.package_uploaded` audit, re-checking the actor under the lock, committed on its
|
|
165
183
|
* own (`requires_new`): the stored package it records is not rolled back by a caller either.
|
|
166
184
|
*/
|
|
167
|
-
async auditUpload(actor, actorTokenId, detail) {
|
|
185
|
+
async auditUpload(actor, actorTokenId, detail, owner) {
|
|
168
186
|
if (actor !== null)
|
|
169
|
-
await this.
|
|
187
|
+
await this.authorizeIn(actor, owner);
|
|
170
188
|
await audit(this.db.db, {
|
|
171
189
|
...(actor !== null && { actorAccountId: actor }),
|
|
172
190
|
...(actorTokenId !== undefined && { actorTokenId }),
|
|
@@ -182,7 +200,7 @@ let ExtensionInstalls = class ExtensionInstalls {
|
|
|
182
200
|
/**
|
|
183
201
|
* Fetches one package from the configured npm registry (verified by `dist.integrity`, see
|
|
184
202
|
* packages/npm.ts), downloading only, not storing: download failure -> `packages.npm_failed` (502);
|
|
185
|
-
* over `packages.maxBytes` -> `extension.package_too_large`.
|
|
203
|
+
* over `packages.maxBytes` -> `extension.package_too_large`. Platform catalog npm imports use it
|
|
186
204
|
* too.
|
|
187
205
|
*/
|
|
188
206
|
async fetchNpm(input, signal) {
|
|
@@ -332,6 +350,9 @@ let ExtensionInstalls = class ExtensionInstalls {
|
|
|
332
350
|
__decorate([
|
|
333
351
|
Transactional({ propagation: "requires_new" })
|
|
334
352
|
], ExtensionInstalls.prototype, "authorize", null);
|
|
353
|
+
__decorate([
|
|
354
|
+
Transactional({ propagation: "mandatory" })
|
|
355
|
+
], ExtensionInstalls.prototype, "authorizeIn", null);
|
|
335
356
|
__decorate([
|
|
336
357
|
Transactional({ propagation: "requires_new" })
|
|
337
358
|
], ExtensionInstalls.prototype, "auditUpload", null);
|
|
@@ -339,11 +360,12 @@ ExtensionInstalls = __decorate([
|
|
|
339
360
|
Injectable(),
|
|
340
361
|
__param(0, Inject(KernelDb)),
|
|
341
362
|
__param(1, Inject(TransactionHost)),
|
|
342
|
-
__param(2, Inject(
|
|
363
|
+
__param(2, Inject(SuperAdminLock)),
|
|
343
364
|
__param(3, Inject(ExtensionBlobs)),
|
|
344
365
|
__param(4, Inject(ExtensionApprovals)),
|
|
345
366
|
__param(5, Inject(ExtensionRegistry)),
|
|
346
367
|
__param(6, Inject(KernelConfigService)),
|
|
347
|
-
__param(7, Inject(KEYRING))
|
|
368
|
+
__param(7, Inject(KEYRING)),
|
|
369
|
+
__param(8, Inject(OrgLock))
|
|
348
370
|
], ExtensionInstalls);
|
|
349
371
|
export { ExtensionInstalls };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type PluginScope } from "../catalog/scope.js";
|
|
1
2
|
import { type Keyring } from "../ctx/secrets.js";
|
|
3
|
+
import type { KernelSchemaDb } from "../db/kernel-schema.js";
|
|
2
4
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
3
5
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
4
6
|
import { KernelEvents } from "../infra/events/kernel-events.js";
|
|
@@ -6,6 +8,7 @@ import type { KernelLogger } from "../log.js";
|
|
|
6
8
|
import { OrgLock } from "../orgs/org-lock.js";
|
|
7
9
|
import { type ConfigIssue, toIssues } from "./config-issues.js";
|
|
8
10
|
import { type JsonSchema } from "./config-json-schema.js";
|
|
11
|
+
import { EffectiveConfigs } from "./effective-config.js";
|
|
9
12
|
import { ExtensionHost } from "./host.js";
|
|
10
13
|
import { ExtensionInstalls } from "./installs.js";
|
|
11
14
|
import { type PermissionGroup } from "./permission-view.js";
|
|
@@ -37,7 +40,26 @@ export interface OrgExtensionView {
|
|
|
37
40
|
* disabled here (`extension.required`); its org config, when it has one, can still be set.
|
|
38
41
|
*/
|
|
39
42
|
required: boolean;
|
|
43
|
+
/** The catalog plugin the extension ships in and its scope (builtin counts as `all`); null without one. */
|
|
44
|
+
catalogItem: {
|
|
45
|
+
itemId: string;
|
|
46
|
+
scope: PluginScope;
|
|
47
|
+
} | null;
|
|
48
|
+
/** The org admin can switch it (the plugin's switch): never for an `all` / builtin plugin. */
|
|
49
|
+
switchable: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The two-level deployment config (spec A §5.3, §5.4): `following` the platform, a `copy` of the
|
|
52
|
+
* overridable fields, or `none` (the extension has no overridable field, or is unavailable).
|
|
53
|
+
*/
|
|
54
|
+
overrideState: "following" | "copy" | "none";
|
|
55
|
+
/**
|
|
56
|
+
* The org must configure the extension before it works here (spec A §6): its effective config
|
|
57
|
+
* is not valid, or a required org-only field is missing. Always false when unavailable.
|
|
58
|
+
*/
|
|
59
|
+
needsConfig: boolean;
|
|
40
60
|
}
|
|
61
|
+
/** The extension points an extension provides, from its permission list's `provides` group. */
|
|
62
|
+
export declare function providesOf(view: Pick<OrgExtensionView, "permissions">): string[];
|
|
41
63
|
/** `put` 的输入:`config` 中的密钥字段缺省 = 保留原值、`null` = 清除、其他值 = 新值。 */
|
|
42
64
|
export interface OrgExtensionInput {
|
|
43
65
|
enabled?: boolean | undefined;
|
|
@@ -48,7 +70,7 @@ export interface OrgExtensionInput {
|
|
|
48
70
|
/** `put` 的内部选项(不来自 HTTP)。 */
|
|
49
71
|
export interface OrgExtensionPutOptions {
|
|
50
72
|
/**
|
|
51
|
-
* Enable through this
|
|
73
|
+
* Enable through this platform catalog item (the extension's own item, or an app item: plugins
|
|
52
74
|
* in an app follow the app item's policy, C22). When omitted, judged by every source item in
|
|
53
75
|
* `extension_catalog_sources` (the strictest wins); an extension not installed through the catalog
|
|
54
76
|
* is not bound by catalog policy.
|
|
@@ -69,6 +91,13 @@ export interface OrgExtensionPutOptions {
|
|
|
69
91
|
ifDisabled?: {
|
|
70
92
|
skipped: boolean;
|
|
71
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* Check the role and the config (the given `config`, or with `enabled: true` the stored one,
|
|
96
|
+
* merged with the stored secrets, against the schema) and write nothing: lets a caller that must
|
|
97
|
+
* do another write first fail without a side effect. The rules for newly enabling (catalog policy,
|
|
98
|
+
* dependencies) are left to that write: the plugin install that enables it checks them.
|
|
99
|
+
*/
|
|
100
|
+
validateOnly?: boolean;
|
|
72
101
|
}
|
|
73
102
|
/**
|
|
74
103
|
* Org-level extension config: enablement and the `config.org` config stored per org.
|
|
@@ -90,6 +119,8 @@ export declare class OrgExtensionConfigs {
|
|
|
90
119
|
private readonly events;
|
|
91
120
|
/** Secret values handled (written or decrypted) are masked in the logs after the commit. */
|
|
92
121
|
private readonly log;
|
|
122
|
+
/** The effective deployment config of each org (spec A §6): read for `needsConfig`. */
|
|
123
|
+
private readonly effective;
|
|
93
124
|
/** Test seam only: a deterministic interleaving point after the config rows are read, before the secrets. */
|
|
94
125
|
afterConfigRowRead: (() => Promise<void>) | undefined;
|
|
95
126
|
constructor(kdb: KernelDb, txHost: TransactionHost, keyring: Keyring, host: ExtensionHost,
|
|
@@ -100,7 +131,9 @@ export declare class OrgExtensionConfigs {
|
|
|
100
131
|
/** `extension.org-disabled` after a disable commits (channel connections drop at once). */
|
|
101
132
|
events: KernelEvents,
|
|
102
133
|
/** Secret values handled (written or decrypted) are masked in the logs after the commit. */
|
|
103
|
-
log: KernelLogger
|
|
134
|
+
log: KernelLogger,
|
|
135
|
+
/** The effective deployment config of each org (spec A §6): read for `needsConfig`. */
|
|
136
|
+
effective: EffectiveConfigs);
|
|
104
137
|
/** The kernel-schema handle of the current transaction. */
|
|
105
138
|
private get db();
|
|
106
139
|
/** 把一份组织配置里的密钥值登记到日志打码(无密钥时无操作);调用方须在事务提交后调用。 */
|
|
@@ -108,12 +141,34 @@ export declare class OrgExtensionConfigs {
|
|
|
108
141
|
/** After a write committed: a disabled extension's channel connections drop at once. */
|
|
109
142
|
private afterPut;
|
|
110
143
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
144
|
+
* The state of every loaded extension the org sees, in load order (no row: `enabled` false,
|
|
145
|
+
* `config` null), then the installed extensions not loaded right now (disabled on the deployment
|
|
146
|
+
* and the like) as `available: false`, sorted by name.
|
|
113
147
|
*/
|
|
114
148
|
list(orgId: string): Promise<OrgExtensionView[]>;
|
|
149
|
+
/**
|
|
150
|
+
* Fills `overrideState` and the platform half of `needsConfig` (spec A §6) for the views of
|
|
151
|
+
* extensions with overridable fields (the others always run with the platform's config, which
|
|
152
|
+
* loaded valid). Reads the org's copy rows once and the effective config of each such extension.
|
|
153
|
+
*/
|
|
154
|
+
private withLayers;
|
|
115
155
|
/** `REPEATABLE READ` read-only: the config rows and the secrets come from one snapshot. */
|
|
116
156
|
private listSnapshot;
|
|
157
|
+
/**
|
|
158
|
+
* How an `enabled` write of this extension is handled: `direct` through {@link put} (a required
|
|
159
|
+
* bootstrap plugin keeps `extension.required`; an extension without a live item is config-declared;
|
|
160
|
+
* several live items keep the direct write, the strictest source rules applying), `locked` (a live
|
|
161
|
+
* item is builtin and the write switches off: `plugin.scope_locked`), or `item` (the single plugin
|
|
162
|
+
* whose org switch it is).
|
|
163
|
+
*/
|
|
164
|
+
switchPlan(plugin: string, enabled: boolean): Promise<{
|
|
165
|
+
kind: "direct";
|
|
166
|
+
} | {
|
|
167
|
+
kind: "locked";
|
|
168
|
+
} | {
|
|
169
|
+
kind: "item";
|
|
170
|
+
itemId: string;
|
|
171
|
+
}>;
|
|
117
172
|
/**
|
|
118
173
|
* Writes enablement and / or config. The actor's role is re-read under the org row lock (needs
|
|
119
174
|
* `org.extensions.manage`).
|
|
@@ -125,8 +180,16 @@ export declare class OrgExtensionConfigs {
|
|
|
125
180
|
* - The merged full config (or, without `config`, the existing config when the result is enabled)
|
|
126
181
|
* does not satisfy the schema -> `extension.config_invalid`.
|
|
127
182
|
*/
|
|
128
|
-
put(orgId: string, plugin: string, input: OrgExtensionInput,
|
|
183
|
+
put(orgId: string, plugin: string, input: OrgExtensionInput,
|
|
184
|
+
/** null: the kernel itself (the plugin scope sync installing a plugin), no role check. */
|
|
185
|
+
actorAccountId: string | null, actorTokenId?: string, opts?: OrgExtensionPutOptions): Promise<OrgExtensionView>;
|
|
129
186
|
private write;
|
|
187
|
+
/**
|
|
188
|
+
* The rules of a write that switches: newly enabling an extension from the platform catalog
|
|
189
|
+
* re-checks the item policy and grants (C22; one already enabled is unaffected), enabling needs
|
|
190
|
+
* the dependencies enabled, disabling (without `force`) no enabled dependents.
|
|
191
|
+
*/
|
|
192
|
+
private assertSwitchRules;
|
|
130
193
|
/**
|
|
131
194
|
* 读取并解密某插件在该组织下的完整配置(供运行时按组织构造插件实例)。
|
|
132
195
|
* A required bootstrap plugin is enabled without a row (its stored config, or `{}`, is validated).
|
|
@@ -150,7 +213,7 @@ export declare class OrgExtensionConfigs {
|
|
|
150
213
|
* 在调用方事务里停用(应用安装的回滚与卸载用;调用方已锁组织行并复核角色):不检查依赖方,配置保留,
|
|
151
214
|
* 审计 `org.plugin_config.updated`(带 reason)。提交后调用方须再调 {@link afterDisable}。
|
|
152
215
|
*/
|
|
153
|
-
disableIn(orgId: string, plugin: string, actorAccountId: string, reason: string): Promise<boolean>;
|
|
216
|
+
disableIn(orgId: string, plugin: string, actorAccountId: string | null, reason: string): Promise<boolean>;
|
|
154
217
|
/** {@link disableIn} 的事务提交之后:通知停用(断开该插件的渠道连接等)。 */
|
|
155
218
|
afterDisable(orgId: string, plugin: string): Promise<void>;
|
|
156
219
|
/** 该组织已启用的插件名(只含当前已加载的插件;待批准的不算;必需的引导插件始终算启用)。 */
|
|
@@ -166,6 +229,18 @@ export declare class OrgExtensionConfigs {
|
|
|
166
229
|
private manifest;
|
|
167
230
|
private permissionsOf;
|
|
168
231
|
private view;
|
|
232
|
+
/**
|
|
233
|
+
* The org schema's form JSON Schema, a copy (`x-ui` stripped when its hints are invalid; the host
|
|
234
|
+
* warns at load). Never throws: a hint conversion that throws serves the plain schema, or null
|
|
235
|
+
* (one warning per schema on this replica), so one hand-made package cannot fail the org's list.
|
|
236
|
+
*/
|
|
237
|
+
private formSchema;
|
|
169
238
|
/** 该组织在 `kernel` 命名空间下已设置的插件配置密钥键(不解密)。 */
|
|
170
239
|
private setSecretKeys;
|
|
171
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Whether the org sees `plugin` in its extension list (a required bootstrap plugin always; else
|
|
243
|
+
* under its catalog items' scope, as {@link OrgExtensionConfigs.list} filters). `db` may be a
|
|
244
|
+
* transaction.
|
|
245
|
+
*/
|
|
246
|
+
export declare function extensionVisibleTo(db: KernelSchemaDb, orgId: string, plugin: string): Promise<boolean>;
|