@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
package/bootstrap.json
CHANGED
|
@@ -3,24 +3,80 @@
|
|
|
3
3
|
"schemaVersion": 1,
|
|
4
4
|
"marketplace": {
|
|
5
5
|
"url": "https://github.com/capybara-hq/plugins.git",
|
|
6
|
-
"commit": "
|
|
6
|
+
"commit": "77f0ac0c0bbb1e7e3ea66ae3bd7931f0ed06b777"
|
|
7
7
|
},
|
|
8
8
|
"plugins": [
|
|
9
9
|
{
|
|
10
10
|
"name": "openai-compatible",
|
|
11
11
|
"source": "npm",
|
|
12
12
|
"npm": "@capybara-hq/plugin-openai-compatible",
|
|
13
|
-
"version": "0.1.0-rc.
|
|
14
|
-
"integrity": "sha512-
|
|
13
|
+
"version": "0.1.0-rc.2",
|
|
14
|
+
"integrity": "sha512-HG3sPg9VjSldr/qP5647SV0LP3xEqIbtnMvl4VG0XHCHRPJ1wc9PBMb8hrTZ3FGc43OKTWgFyfAV3fNKm29JtQ==",
|
|
15
15
|
"required": true
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "object-store-s3",
|
|
19
19
|
"source": "npm",
|
|
20
20
|
"npm": "@capybara-hq/plugin-object-store-s3",
|
|
21
|
-
"version": "0.1.0-rc.
|
|
22
|
-
"integrity": "sha512
|
|
21
|
+
"version": "0.1.0-rc.1",
|
|
22
|
+
"integrity": "sha512-/HABg+/LsR+YJmRlJYB694hFFgZPTReN9BDwArdZpsNR0n/uBanRgaNnTT/C/wZd4uNTq9EVClYvZ4t3xmjKGQ==",
|
|
23
23
|
"required": true
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "anthropic",
|
|
27
|
+
"source": "npm",
|
|
28
|
+
"npm": "@capybara-hq/plugin-anthropic",
|
|
29
|
+
"version": "0.1.0-rc.1",
|
|
30
|
+
"integrity": "sha512-/Ptn4epXv38kBKqd3MDxhy21hP0vQLkLdEov6sUvn2BlKRltgLYAbiKD/9P+B1w2RZmoNXdhZgqoSZ0Q036LNw==",
|
|
31
|
+
"required": false
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "openai",
|
|
35
|
+
"source": "npm",
|
|
36
|
+
"npm": "@capybara-hq/plugin-openai",
|
|
37
|
+
"version": "0.1.0-rc.1",
|
|
38
|
+
"integrity": "sha512-F714dJ023p8XcrPXYNZyjiow5BXza5KTdlJV4Uw8spgulgjPSF44n0SVMEA1iyYCwOFrr58NSvw51AqmOYg6Fw==",
|
|
39
|
+
"required": false
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "connector-mcp",
|
|
43
|
+
"source": "npm",
|
|
44
|
+
"npm": "@capybara-hq/plugin-connector-mcp",
|
|
45
|
+
"version": "0.1.0-rc.1",
|
|
46
|
+
"integrity": "sha512-cMc/d7Tngzx7/kyyCmt9W4kVC8JkfH1q7dQ5bLpnTJfwg8iYrdwUGaD6Q7ImYCb3AiguM0Xe2Js4RlU7ed22Kw==",
|
|
47
|
+
"required": false
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "connector-openapi",
|
|
51
|
+
"source": "npm",
|
|
52
|
+
"npm": "@capybara-hq/plugin-connector-openapi",
|
|
53
|
+
"version": "0.1.0-rc.1",
|
|
54
|
+
"integrity": "sha512-XahjgfA5hay/D32rUNrvql4SYAk0R04vGLyEzZg6Sq4ZNoqFHTKuj8Gndr5lD3AiwMqVngTva+x3hpVdosmEjA==",
|
|
55
|
+
"required": false
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "jina",
|
|
59
|
+
"source": "npm",
|
|
60
|
+
"npm": "@capybara-hq/plugin-jina",
|
|
61
|
+
"version": "0.1.0-rc.0",
|
|
62
|
+
"integrity": "sha512-fFquQfglzgaCoq3/tcRCYBdLfLe1BzIO5xDJHP1h0I7ugXGmUn9qdtFWOJ6Sw8TJvFeeqGSrkvtAUTVo5Phe2w==",
|
|
63
|
+
"required": false
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "sandbox-docker",
|
|
67
|
+
"source": "npm",
|
|
68
|
+
"npm": "@capybara-hq/plugin-sandbox-docker",
|
|
69
|
+
"version": "0.1.0-rc.2",
|
|
70
|
+
"integrity": "sha512-f5BiecQQvRLI8NaGHUy3l+nNvcCLXTQnHQ8od93PAbBpg6q0EkAvZ7R/M4yZ7dK7PeIan61VB+QfwlnpLLw27Q==",
|
|
71
|
+
"required": false
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "todo",
|
|
75
|
+
"source": "npm",
|
|
76
|
+
"npm": "@capybara-hq/plugin-todo",
|
|
77
|
+
"version": "0.1.0-rc.1",
|
|
78
|
+
"integrity": "sha512-Qz2FX05Nxbbetf8rcbmA3QZqvGDFeBgJOz/+vckD0N7di8YVKs3qoqoU7mzvBKnImWK63LiJLotGNQUY2QsXhg==",
|
|
79
|
+
"required": false
|
|
24
80
|
}
|
|
25
81
|
]
|
|
26
82
|
}
|
|
@@ -1,27 +1,46 @@
|
|
|
1
|
-
import type { Logger } from "@capybara-hq/plugin-sdk";
|
|
1
|
+
import type { LocalizedName, Logger } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { CatalogRequestsService } from "../catalog/requests.service.js";
|
|
4
4
|
import { ExtensionAdmin } from "../extensions/admin-view.js";
|
|
5
|
+
import { ExtensionDisplayNames } from "../extensions/display-name.js";
|
|
5
6
|
import { type Account, AccountsService } from "../identity/accounts.js";
|
|
6
7
|
import { type Principal } from "../identity/principal.js";
|
|
7
8
|
import { SessionService } from "../identity/sessions.js";
|
|
8
9
|
import { type DeploymentSettings, SettingsService } from "../identity/settings.js";
|
|
10
|
+
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
9
11
|
import { type ModelPrice, type ModelPricePut, PricesService } from "../models/prices.js";
|
|
10
|
-
import { ModelPurposesService, type
|
|
12
|
+
import { ModelPurposesService, type PurposeListing, type PurposePut } from "../models/purposes.js";
|
|
11
13
|
import { type Org, OrgsService } from "../orgs/orgs.service.js";
|
|
12
14
|
import { ProviderRegistry, type ProviderStatus } from "../runtime/providers.js";
|
|
15
|
+
import type { SubagentLimits } from "../runtime/subagents/limits.js";
|
|
13
16
|
/** 后台概览(`GET /api/v1/admin/overview`)的计数。 */
|
|
14
17
|
export interface AdminOverview {
|
|
15
18
|
/**
|
|
16
|
-
* Extensions
|
|
19
|
+
* Extensions a super admin has to act on (pending approval or configuration, failed, missing
|
|
17
20
|
* dependency, replicas disagree); see `extensionNeedsAction`.
|
|
18
21
|
*/
|
|
19
22
|
extensionsNeedingAction: number;
|
|
20
|
-
/** Catalog requests waiting for
|
|
23
|
+
/** Catalog requests waiting for a super admin (stage deployment, pending). */
|
|
21
24
|
catalogRequestsPending: number;
|
|
22
25
|
orgs: number;
|
|
23
26
|
accounts: number;
|
|
24
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* The deployment's defaults of the per-org limits (with `GET /api/v1/admin/orgs`): what an
|
|
30
|
+
* organization without an override gets, from the live config. `subagents.maxDispatchesPerRun` and
|
|
31
|
+
* `maxTokensPerRun` of 0 mean no limit.
|
|
32
|
+
*/
|
|
33
|
+
export interface LimitDefaults {
|
|
34
|
+
/** `runtime.orgConcurrency`. */
|
|
35
|
+
runConcurrency: number;
|
|
36
|
+
/** `sandbox.limits.cpu` / `memoryMb`. */
|
|
37
|
+
sandbox: {
|
|
38
|
+
cpu: number;
|
|
39
|
+
memoryMb: number;
|
|
40
|
+
};
|
|
41
|
+
/** `subagents.*`. */
|
|
42
|
+
subagents: SubagentLimits;
|
|
43
|
+
}
|
|
25
44
|
declare const ListQuerySchema: z.ZodObject<{
|
|
26
45
|
after: z.ZodOptional<z.ZodString>;
|
|
27
46
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
@@ -31,7 +50,7 @@ declare const CreateAccountSchema: z.ZodObject<{
|
|
|
31
50
|
password: z.ZodString;
|
|
32
51
|
displayName: z.ZodString;
|
|
33
52
|
email: z.ZodOptional<z.ZodEmail>;
|
|
34
|
-
|
|
53
|
+
superAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
35
54
|
}, z.core.$strip>;
|
|
36
55
|
declare const UpdateAccountSchema: z.ZodObject<{
|
|
37
56
|
displayName: z.ZodOptional<z.ZodString>;
|
|
@@ -39,13 +58,13 @@ declare const UpdateAccountSchema: z.ZodObject<{
|
|
|
39
58
|
active: "active";
|
|
40
59
|
disabled: "disabled";
|
|
41
60
|
}>>;
|
|
42
|
-
|
|
61
|
+
isSuperAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
43
62
|
}, z.core.$strip>;
|
|
44
63
|
/** 至少给出一个键;`runConcurrencyOverrides` 按组织合并,值为 null 删除该组织的覆盖。 */
|
|
45
64
|
declare const SettingsSchema: z.ZodObject<{
|
|
46
65
|
orgCreation: z.ZodOptional<z.ZodEnum<{
|
|
47
66
|
anyone: "anyone";
|
|
48
|
-
|
|
67
|
+
super_admin: "super_admin";
|
|
49
68
|
}>>;
|
|
50
69
|
runConcurrencyOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodNumber>>>;
|
|
51
70
|
priceCurrency: z.ZodOptional<z.ZodString>;
|
|
@@ -54,7 +73,8 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
54
73
|
memoryMb: z.ZodOptional<z.ZodNumber>;
|
|
55
74
|
}, z.core.$strict>>>>;
|
|
56
75
|
subagentLimitOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
|
|
57
|
-
|
|
76
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
77
|
+
maxConcurrentPerConversation: z.ZodOptional<z.ZodNumber>;
|
|
58
78
|
maxDispatchesPerRun: z.ZodOptional<z.ZodNumber>;
|
|
59
79
|
maxTokensPerRun: z.ZodOptional<z.ZodNumber>;
|
|
60
80
|
}, z.core.$strict>>>>;
|
|
@@ -66,9 +86,10 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
66
86
|
allow: "allow";
|
|
67
87
|
deny: "deny";
|
|
68
88
|
}>>;
|
|
89
|
+
orgMarketplaceBrowse: z.ZodOptional<z.ZodBoolean>;
|
|
69
90
|
}, z.core.$strict>;
|
|
70
91
|
/**
|
|
71
|
-
*
|
|
92
|
+
* 超级管理员端点(`/api/v1/admin/*`):只接受超级管理员的 Web 会话或个人令牌;
|
|
72
93
|
* 服务令牌一律 `forbidden`(未标 `@AllowService`)。
|
|
73
94
|
*/
|
|
74
95
|
export declare class AdminController {
|
|
@@ -82,7 +103,9 @@ export declare class AdminController {
|
|
|
82
103
|
private readonly plugins;
|
|
83
104
|
private readonly registry;
|
|
84
105
|
private readonly catalogRequests;
|
|
85
|
-
|
|
106
|
+
private readonly displayNames;
|
|
107
|
+
private readonly config;
|
|
108
|
+
constructor(accounts: AccountsService, sessions: SessionService, log: Logger, orgs: OrgsService, settings: SettingsService, prices: PricesService, purposes: ModelPurposesService, plugins: ExtensionAdmin, registry: ProviderRegistry, catalogRequests: CatalogRequestsService, displayNames: ExtensionDisplayNames, config: KernelConfigService);
|
|
86
109
|
/** 后台概览的四个数字(只读计数,不含任何对话内容)。 */
|
|
87
110
|
overview(): Promise<AdminOverview>;
|
|
88
111
|
/**
|
|
@@ -96,24 +119,32 @@ export declare class AdminController {
|
|
|
96
119
|
createAccount(principal: Principal, body: z.infer<typeof CreateAccountSchema>): Promise<{
|
|
97
120
|
account: Account;
|
|
98
121
|
}>;
|
|
99
|
-
/** 改显示名 / 状态 /
|
|
122
|
+
/** 改显示名 / 状态 / 超级管理员;停用时同时吊销该账号的全部会话与个人令牌。 */
|
|
100
123
|
updateAccount(principal: Principal, accountId: string, body: z.infer<typeof UpdateAccountSchema>): Promise<{
|
|
101
124
|
account: Account;
|
|
102
125
|
}>;
|
|
103
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* 全部组织的元数据与成员数(不含成员明细), with the deployment's defaults of the limits an org
|
|
128
|
+
* can be given its own value of (the org limits dialog shows them for the values left empty).
|
|
129
|
+
*/
|
|
104
130
|
listOrgs(): Promise<{
|
|
105
131
|
orgs: (Org & {
|
|
106
132
|
memberCount: number;
|
|
107
133
|
})[];
|
|
134
|
+
limitDefaults: LimitDefaults;
|
|
108
135
|
}>;
|
|
109
136
|
getSettings(): Promise<DeploymentSettings>;
|
|
137
|
+
private limitDefaults;
|
|
110
138
|
putSettings(principal: Principal, body: z.infer<typeof SettingsSchema>): Promise<DeploymentSettings>;
|
|
111
139
|
/**
|
|
112
140
|
* 模型供应商与模型(后台「模型」页):每个供应商带状态,列模型失败的标 `error`,不影响其他供应商;
|
|
113
|
-
* 一并返回价格表与币种(改价仍走 `PUT /admin/model-prices`)。
|
|
141
|
+
* 一并返回价格表与币种(改价仍走 `PUT /admin/model-prices`)。Each provider carries its extension's
|
|
142
|
+
* display name (null when it has none).
|
|
114
143
|
*/
|
|
115
144
|
getModels(): Promise<{
|
|
116
|
-
providers: ProviderStatus
|
|
145
|
+
providers: (ProviderStatus & {
|
|
146
|
+
displayName: LocalizedName | null;
|
|
147
|
+
})[];
|
|
117
148
|
prices: ModelPrice[];
|
|
118
149
|
currency: string;
|
|
119
150
|
}>;
|
|
@@ -129,11 +160,11 @@ export declare class AdminController {
|
|
|
129
160
|
}>;
|
|
130
161
|
/** 模型用途与部署默认映射(`override` 一律为 null;组织覆盖在组织侧接口)。 */
|
|
131
162
|
getModelPurposes(): Promise<{
|
|
132
|
-
purposes:
|
|
163
|
+
purposes: PurposeListing[];
|
|
133
164
|
}>;
|
|
134
165
|
/** 设置一个用途的部署默认,或 `target: null` 清除。 */
|
|
135
166
|
putModelPurpose(principal: Principal, purpose: string, body: PurposePut): Promise<{
|
|
136
|
-
purpose:
|
|
167
|
+
purpose: PurposeListing;
|
|
137
168
|
}>;
|
|
138
169
|
}
|
|
139
170
|
export {};
|
|
@@ -11,18 +11,20 @@ import { Controller, Get, HttpCode, Inject, Param, Patch, Post, Put } from "@nes
|
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { CatalogRequestsService } from "../catalog/requests.service.js";
|
|
13
13
|
import { ExtensionAdmin } from "../extensions/admin-view.js";
|
|
14
|
+
import { ExtensionDisplayNames } from "../extensions/display-name.js";
|
|
14
15
|
import { extensionNeedsAction } from "../extensions/permission-view.js";
|
|
15
16
|
import { AccountsService } from "../identity/accounts.js";
|
|
16
17
|
import { MAX_PASSWORD_LENGTH } from "../identity/login.js";
|
|
17
|
-
import { CurrentPrincipal,
|
|
18
|
+
import { CurrentPrincipal, patTokenId, requireUser, SuperAdmin, } from "../identity/principal.js";
|
|
18
19
|
import { SessionService } from "../identity/sessions.js";
|
|
19
20
|
import { DEPLOYMENT_SETTINGS_PATCH, SettingsService, } from "../identity/settings.js";
|
|
21
|
+
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
20
22
|
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
21
23
|
import { createZodDto } from "../infra/validation/create-zod-dto.js";
|
|
22
24
|
import { ZBody, ZQuery } from "../infra/validation/zod-params.js";
|
|
23
25
|
import { MODEL_PRICE_PUT, PricesService, } from "../models/prices.js";
|
|
24
26
|
import { purposeTargetOf } from "../models/purposes.controller.js";
|
|
25
|
-
import { ModelPurposesService, PurposePutDto, } from "../models/purposes.js";
|
|
27
|
+
import { ModelPurposesService, PurposePutDto, withDeclaredByNames, } from "../models/purposes.js";
|
|
26
28
|
import { OrgsService } from "../orgs/orgs.service.js";
|
|
27
29
|
import { ProviderRegistry } from "../runtime/providers.js";
|
|
28
30
|
const ListQuerySchema = z.object({
|
|
@@ -36,14 +38,14 @@ const CreateAccountSchema = z.object({
|
|
|
36
38
|
password: z.string().min(1).max(MAX_PASSWORD_LENGTH),
|
|
37
39
|
displayName: z.string().trim().min(1).max(100),
|
|
38
40
|
email: z.email().max(254).optional(),
|
|
39
|
-
|
|
41
|
+
superAdmin: z.boolean().optional(),
|
|
40
42
|
});
|
|
41
43
|
class CreateAccountBody extends createZodDto(CreateAccountSchema, "CreateAccountBody") {
|
|
42
44
|
}
|
|
43
45
|
const UpdateAccountSchema = z.object({
|
|
44
46
|
displayName: z.string().trim().min(1).max(100).optional(),
|
|
45
47
|
status: z.enum(["active", "disabled"]).optional(),
|
|
46
|
-
|
|
48
|
+
isSuperAdmin: z.boolean().optional(),
|
|
47
49
|
});
|
|
48
50
|
class UpdateAccountBody extends createZodDto(UpdateAccountSchema, "UpdateAccountBody") {
|
|
49
51
|
}
|
|
@@ -56,7 +58,7 @@ class DeploymentSettingsBody extends createZodDto(SettingsSchema, "DeploymentSet
|
|
|
56
58
|
// a union schema: a DTO value rather than a class (a class cannot extend a union instance type)
|
|
57
59
|
const ModelPriceBody = createZodDto(MODEL_PRICE_PUT, "ModelPricePut");
|
|
58
60
|
/**
|
|
59
|
-
*
|
|
61
|
+
* 超级管理员端点(`/api/v1/admin/*`):只接受超级管理员的 Web 会话或个人令牌;
|
|
60
62
|
* 服务令牌一律 `forbidden`(未标 `@AllowService`)。
|
|
61
63
|
*/
|
|
62
64
|
let AdminController = class AdminController {
|
|
@@ -70,7 +72,9 @@ let AdminController = class AdminController {
|
|
|
70
72
|
plugins;
|
|
71
73
|
registry;
|
|
72
74
|
catalogRequests;
|
|
73
|
-
|
|
75
|
+
displayNames;
|
|
76
|
+
config;
|
|
77
|
+
constructor(accounts, sessions, log, orgs, settings, prices, purposes, plugins, registry, catalogRequests, displayNames, config) {
|
|
74
78
|
this.accounts = accounts;
|
|
75
79
|
this.sessions = sessions;
|
|
76
80
|
this.log = log;
|
|
@@ -81,6 +85,8 @@ let AdminController = class AdminController {
|
|
|
81
85
|
this.plugins = plugins;
|
|
82
86
|
this.registry = registry;
|
|
83
87
|
this.catalogRequests = catalogRequests;
|
|
88
|
+
this.displayNames = displayNames;
|
|
89
|
+
this.config = config;
|
|
84
90
|
}
|
|
85
91
|
/** 后台概览的四个数字(只读计数,不含任何对话内容)。 */
|
|
86
92
|
async overview() {
|
|
@@ -117,17 +123,17 @@ let AdminController = class AdminController {
|
|
|
117
123
|
password: body.password,
|
|
118
124
|
displayName: body.displayName,
|
|
119
125
|
...(body.email !== undefined && { email: body.email }),
|
|
120
|
-
...(body.
|
|
126
|
+
...(body.superAdmin !== undefined && { superAdmin: body.superAdmin }),
|
|
121
127
|
}, actor.account.id, patTokenId(actor));
|
|
122
128
|
return { account };
|
|
123
129
|
}
|
|
124
|
-
/** 改显示名 / 状态 /
|
|
130
|
+
/** 改显示名 / 状态 / 超级管理员;停用时同时吊销该账号的全部会话与个人令牌。 */
|
|
125
131
|
async updateAccount(principal, accountId, body) {
|
|
126
132
|
const actor = requireUser(principal);
|
|
127
133
|
const patch = {
|
|
128
134
|
...(body.displayName !== undefined && { displayName: body.displayName }),
|
|
129
135
|
...(body.status !== undefined && { status: body.status }),
|
|
130
|
-
...(body.
|
|
136
|
+
...(body.isSuperAdmin !== undefined && { isSuperAdmin: body.isSuperAdmin }),
|
|
131
137
|
};
|
|
132
138
|
// 停用时账号状态、会话与个人令牌的吊销在同一个 PG 事务里完成
|
|
133
139
|
const { account, revokedSessionIds } = await this.accounts.updateAccount(accountId, patch, actor.account.id, patTokenId(actor));
|
|
@@ -143,27 +149,44 @@ let AdminController = class AdminController {
|
|
|
143
149
|
}
|
|
144
150
|
return { account };
|
|
145
151
|
}
|
|
146
|
-
/**
|
|
152
|
+
/**
|
|
153
|
+
* 全部组织的元数据与成员数(不含成员明细), with the deployment's defaults of the limits an org
|
|
154
|
+
* can be given its own value of (the org limits dialog shows them for the values left empty).
|
|
155
|
+
*/
|
|
147
156
|
async listOrgs() {
|
|
148
|
-
return { orgs: await this.orgs.listAll() };
|
|
157
|
+
return { orgs: await this.orgs.listAll(), limitDefaults: this.limitDefaults() };
|
|
149
158
|
}
|
|
150
159
|
async getSettings() {
|
|
151
160
|
return this.settings.get();
|
|
152
161
|
}
|
|
162
|
+
limitDefaults() {
|
|
163
|
+
const cfg = this.config.get();
|
|
164
|
+
const { maxDepth, maxConcurrentPerConversation, maxDispatchesPerRun, maxTokensPerRun } = cfg.subagents;
|
|
165
|
+
return {
|
|
166
|
+
runConcurrency: cfg.runtime.orgConcurrency,
|
|
167
|
+
sandbox: { cpu: cfg.sandbox.limits.cpu, memoryMb: cfg.sandbox.limits.memoryMb },
|
|
168
|
+
subagents: { maxDepth, maxConcurrentPerConversation, maxDispatchesPerRun, maxTokensPerRun },
|
|
169
|
+
};
|
|
170
|
+
}
|
|
153
171
|
async putSettings(principal, body) {
|
|
154
172
|
const actor = requireUser(principal);
|
|
155
173
|
return this.settings.update(body, actor.account.id, patTokenId(actor));
|
|
156
174
|
}
|
|
157
175
|
/**
|
|
158
176
|
* 模型供应商与模型(后台「模型」页):每个供应商带状态,列模型失败的标 `error`,不影响其他供应商;
|
|
159
|
-
* 一并返回价格表与币种(改价仍走 `PUT /admin/model-prices`)。
|
|
177
|
+
* 一并返回价格表与币种(改价仍走 `PUT /admin/model-prices`)。Each provider carries its extension's
|
|
178
|
+
* display name (null when it has none).
|
|
160
179
|
*/
|
|
161
180
|
async getModels() {
|
|
162
181
|
const [providers, prices] = await Promise.all([
|
|
163
182
|
this.registry.listWithStatus(),
|
|
164
183
|
this.getModelPrices(),
|
|
165
184
|
]);
|
|
166
|
-
|
|
185
|
+
const names = await this.displayNames.many(providers.map((p) => p.plugin));
|
|
186
|
+
return {
|
|
187
|
+
providers: providers.map((p) => ({ ...p, displayName: names.get(p.plugin) ?? null })),
|
|
188
|
+
...prices,
|
|
189
|
+
};
|
|
167
190
|
}
|
|
168
191
|
/** 模型价格表(每百万 token)与币种(部署设置 `priceCurrency`)。 */
|
|
169
192
|
async getModelPrices() {
|
|
@@ -178,14 +201,14 @@ let AdminController = class AdminController {
|
|
|
178
201
|
}
|
|
179
202
|
/** 模型用途与部署默认映射(`override` 一律为 null;组织覆盖在组织侧接口)。 */
|
|
180
203
|
async getModelPurposes() {
|
|
181
|
-
return { purposes: await this.purposes.list() };
|
|
204
|
+
return { purposes: await withDeclaredByNames(await this.purposes.list(), this.displayNames) };
|
|
182
205
|
}
|
|
183
206
|
/** 设置一个用途的部署默认,或 `target: null` 清除。 */
|
|
184
207
|
async putModelPurpose(principal, purpose, body) {
|
|
185
208
|
const actor = requireUser(principal);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
};
|
|
209
|
+
const view = await this.purposes.setDefault(purpose, purposeTargetOf(body), actor.account.id, patTokenId(actor));
|
|
210
|
+
const [listing] = await withDeclaredByNames([view], this.displayNames);
|
|
211
|
+
return { purpose: listing };
|
|
189
212
|
}
|
|
190
213
|
};
|
|
191
214
|
__decorate([
|
|
@@ -240,7 +263,7 @@ __decorate([
|
|
|
240
263
|
], AdminController.prototype, "putModelPurpose", null);
|
|
241
264
|
AdminController = __decorate([
|
|
242
265
|
Controller("api/v1/admin"),
|
|
243
|
-
|
|
266
|
+
SuperAdmin(),
|
|
244
267
|
__param(0, Inject(AccountsService)),
|
|
245
268
|
__param(1, Inject(SessionService)),
|
|
246
269
|
__param(2, Inject(KERNEL_LOGGER)),
|
|
@@ -250,6 +273,8 @@ AdminController = __decorate([
|
|
|
250
273
|
__param(6, Inject(ModelPurposesService)),
|
|
251
274
|
__param(7, Inject(ExtensionAdmin)),
|
|
252
275
|
__param(8, Inject(ProviderRegistry)),
|
|
253
|
-
__param(9, Inject(CatalogRequestsService))
|
|
276
|
+
__param(9, Inject(CatalogRequestsService)),
|
|
277
|
+
__param(10, Inject(ExtensionDisplayNames)),
|
|
278
|
+
__param(11, Inject(KernelConfigService))
|
|
254
279
|
], AdminController);
|
|
255
280
|
export { AdminController };
|
|
@@ -3,6 +3,7 @@ import { ExtensionAdminOps } from "../extensions/admin-ops.js";
|
|
|
3
3
|
import { ExtensionAdmin } from "../extensions/admin-view.js";
|
|
4
4
|
import { type DeploymentConfigView, ExtensionDeploymentConfigService } from "../extensions/deployment-config.js";
|
|
5
5
|
import { ExtensionInstalls, type PackageReview } from "../extensions/installs.js";
|
|
6
|
+
import { type OrgOverrideSummary, OrgOverrides } from "../extensions/org-overrides.js";
|
|
6
7
|
import type { AdminExtensionView } from "../extensions/permission-view.js";
|
|
7
8
|
import { type Principal } from "../identity/principal.js";
|
|
8
9
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
@@ -15,13 +16,23 @@ declare const InstallSchema: z.ZodObject<{
|
|
|
15
16
|
}, z.core.$strip>;
|
|
16
17
|
declare const ConfigSchema: z.ZodObject<{
|
|
17
18
|
values: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
19
|
+
secretEntries: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
20
|
+
path: z.ZodString;
|
|
21
|
+
key: z.ZodString;
|
|
22
|
+
value: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
+
renameFrom: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strict>>>;
|
|
18
25
|
}, z.core.$strip>;
|
|
19
26
|
declare const NpmSchema: z.ZodObject<{
|
|
20
27
|
package: z.ZodString;
|
|
21
28
|
version: z.ZodOptional<z.ZodString>;
|
|
22
29
|
}, z.core.$strip>;
|
|
30
|
+
/** The `:name` route parameter of the org-overrides list (decision R20). */
|
|
31
|
+
declare const NameParams: z.ZodObject<{
|
|
32
|
+
name: z.ZodString;
|
|
33
|
+
}, z.core.$strip>;
|
|
23
34
|
/**
|
|
24
|
-
* Deployment-level extension management (`/api/v1/admin/extensions/*`,
|
|
35
|
+
* Deployment-level extension management (`/api/v1/admin/extensions/*`, super admins): package
|
|
25
36
|
* import (upload / npm, returns the review), the extension list and detail, web permission approval
|
|
26
37
|
* (D8), install / enable / disable / uninstall (only writes the desired state and publishes
|
|
27
38
|
* `kernel.plugins.changed`; every replica reconciles, no restart; replicas may still be converging
|
|
@@ -33,7 +44,8 @@ export declare class AdminExtensionsController {
|
|
|
33
44
|
private readonly ops;
|
|
34
45
|
private readonly deploymentConfigs;
|
|
35
46
|
private readonly kernelConfig;
|
|
36
|
-
|
|
47
|
+
private readonly orgOverrides;
|
|
48
|
+
constructor(installs: ExtensionInstalls, admin: ExtensionAdmin, ops: ExtensionAdminOps, deploymentConfigs: ExtensionDeploymentConfigService, kernelConfig: KernelConfigService, orgOverrides: OrgOverrides);
|
|
37
49
|
/**
|
|
38
50
|
* 部署上的全部插件(内置、配置声明、安装记录)及其状态、权限与快照;`drainSeconds` 为停用 / 升级时
|
|
39
51
|
* 在途工具调用最多等待的秒数(`extensionHost.drainSeconds`,界面提示用)。
|
|
@@ -50,6 +62,14 @@ export declare class AdminExtensionsController {
|
|
|
50
62
|
* result. Unknown -> 404 `extension.not_found`.
|
|
51
63
|
*/
|
|
52
64
|
config(name: string): Promise<DeploymentConfigView>;
|
|
65
|
+
/**
|
|
66
|
+
* The orgs keeping their own copy of the extension's overridable config (spec A §5.7): when it
|
|
67
|
+
* was made, which non-secret fields differ from the platform, whether each secret is set; never
|
|
68
|
+
* a secret value. The super admin cannot edit or drop a copy.
|
|
69
|
+
*/
|
|
70
|
+
orgCopies({ name }: z.infer<typeof NameParams>): Promise<{
|
|
71
|
+
overrides: OrgOverrideSummary[];
|
|
72
|
+
}>;
|
|
53
73
|
/**
|
|
54
74
|
* Saves the deployment config (`values` keyed by field dot path; `null` clears, omitted keeps).
|
|
55
75
|
* A field present in the startup config -> 409 `extension.config_readonly`; unknown or invalid
|
|
@@ -57,7 +77,8 @@ export declare class AdminExtensionsController {
|
|
|
57
77
|
* (a value from the startup config) does not block the PUT: it saves anyway, the extension stays
|
|
58
78
|
* pending configuration and the startup config has to change. Every replica re-reads after saving:
|
|
59
79
|
* hot fields are replaced in place, other fields reload the extension, and a pending extension
|
|
60
|
-
* loads (no restart).
|
|
80
|
+
* loads (no restart). `secretEntries` set, rename or remove single keys of a secret record a
|
|
81
|
+
* config UI hint draws per item (a path no hint names -> 400 `validation_failed`).
|
|
61
82
|
*/
|
|
62
83
|
putConfig(principal: Principal, name: string, body: z.infer<typeof ConfigSchema>): Promise<DeploymentConfigView>;
|
|
63
84
|
/**
|
|
@@ -14,10 +14,11 @@ import { ExtensionAdminOps } from "../extensions/admin-ops.js";
|
|
|
14
14
|
import { ExtensionAdmin } from "../extensions/admin-view.js";
|
|
15
15
|
import { ExtensionDeploymentConfigService, } from "../extensions/deployment-config.js";
|
|
16
16
|
import { ExtensionInstalls } from "../extensions/installs.js";
|
|
17
|
-
import {
|
|
17
|
+
import { OrgOverrides } from "../extensions/org-overrides.js";
|
|
18
|
+
import { CurrentPrincipal, patTokenId, requireUser, SuperAdmin, } from "../identity/principal.js";
|
|
18
19
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
19
20
|
import { createZodDto } from "../infra/validation/create-zod-dto.js";
|
|
20
|
-
import { ZBody } from "../infra/validation/zod-params.js";
|
|
21
|
+
import { ZBody, ZParam } from "../infra/validation/zod-params.js";
|
|
21
22
|
const ApproveSchema = z.object({
|
|
22
23
|
/** 安装记录的包(审阅时的 sha256);配置声明的插件为 null。 */
|
|
23
24
|
sha256: z
|
|
@@ -30,9 +31,28 @@ const InstallSchema = z.object({
|
|
|
30
31
|
/** 包存储里的包(上传 / npm 导入返回的 sha256)。 */
|
|
31
32
|
sha256: z.string().regex(/^[0-9a-f]{64}$/),
|
|
32
33
|
});
|
|
34
|
+
const SecretEntrySchema = z
|
|
35
|
+
.object({
|
|
36
|
+
/** A secret record field some `x-ui.secrets[].path` names. */
|
|
37
|
+
path: z.string().min(1).max(256),
|
|
38
|
+
key: z.string().min(1).max(256),
|
|
39
|
+
/** A string sets the key, `null` removes it. */
|
|
40
|
+
value: z.string().max(65_536).nullable().optional(),
|
|
41
|
+
/** Moves the value at this key to `key` first. */
|
|
42
|
+
renameFrom: z.string().min(1).max(256).optional(),
|
|
43
|
+
})
|
|
44
|
+
.strict()
|
|
45
|
+
.refine((e) => e.value !== undefined || e.renameFrom !== undefined, {
|
|
46
|
+
message: "an entry needs value or renameFrom",
|
|
47
|
+
})
|
|
48
|
+
.refine((e) => e.key !== "__proto__" && e.renameFrom !== "__proto__", {
|
|
49
|
+
message: "__proto__ is not a valid key",
|
|
50
|
+
});
|
|
33
51
|
const ConfigSchema = z.object({
|
|
34
52
|
/** 字段点路径 → 新值(`null` 清除)。 */
|
|
35
53
|
values: z.record(z.string().min(1).max(256), z.unknown()),
|
|
54
|
+
/** Single keys of hinted secret records (extension config forms spec §4.3), applied in order. */
|
|
55
|
+
secretEntries: z.array(SecretEntrySchema).max(200).optional(),
|
|
36
56
|
});
|
|
37
57
|
const NpmSchema = z.object({
|
|
38
58
|
package: z.string().min(1).max(214),
|
|
@@ -46,8 +66,12 @@ class ExtensionConfigBody extends createZodDto(ConfigSchema, "ExtensionConfigBod
|
|
|
46
66
|
}
|
|
47
67
|
class ExtensionNpmImportBody extends createZodDto(NpmSchema, "ExtensionNpmImportBody") {
|
|
48
68
|
}
|
|
69
|
+
/** The `:name` route parameter of the org-overrides list (decision R20). */
|
|
70
|
+
const NameParams = z.object({ name: z.string().min(1).max(64) });
|
|
71
|
+
class AdminExtensionNameParamsDto extends createZodDto(NameParams, "AdminExtensionNameParams") {
|
|
72
|
+
}
|
|
49
73
|
/**
|
|
50
|
-
* Deployment-level extension management (`/api/v1/admin/extensions/*`,
|
|
74
|
+
* Deployment-level extension management (`/api/v1/admin/extensions/*`, super admins): package
|
|
51
75
|
* import (upload / npm, returns the review), the extension list and detail, web permission approval
|
|
52
76
|
* (D8), install / enable / disable / uninstall (only writes the desired state and publishes
|
|
53
77
|
* `kernel.plugins.changed`; every replica reconciles, no restart; replicas may still be converging
|
|
@@ -59,14 +83,16 @@ let AdminExtensionsController = class AdminExtensionsController {
|
|
|
59
83
|
ops;
|
|
60
84
|
deploymentConfigs;
|
|
61
85
|
kernelConfig;
|
|
86
|
+
orgOverrides;
|
|
62
87
|
constructor(installs, admin, ops, deploymentConfigs,
|
|
63
88
|
// 字段名不能与路由方法同名(如 `config`):实例字段会遮住原型上的处理函数
|
|
64
|
-
kernelConfig) {
|
|
89
|
+
kernelConfig, orgOverrides) {
|
|
65
90
|
this.installs = installs;
|
|
66
91
|
this.admin = admin;
|
|
67
92
|
this.ops = ops;
|
|
68
93
|
this.deploymentConfigs = deploymentConfigs;
|
|
69
94
|
this.kernelConfig = kernelConfig;
|
|
95
|
+
this.orgOverrides = orgOverrides;
|
|
70
96
|
}
|
|
71
97
|
/**
|
|
72
98
|
* 部署上的全部插件(内置、配置声明、安装记录)及其状态、权限与快照;`drainSeconds` 为停用 / 升级时
|
|
@@ -90,6 +116,14 @@ let AdminExtensionsController = class AdminExtensionsController {
|
|
|
90
116
|
config(name) {
|
|
91
117
|
return this.deploymentConfigs.view(name);
|
|
92
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* The orgs keeping their own copy of the extension's overridable config (spec A §5.7): when it
|
|
121
|
+
* was made, which non-secret fields differ from the platform, whether each secret is set; never
|
|
122
|
+
* a secret value. The super admin cannot edit or drop a copy.
|
|
123
|
+
*/
|
|
124
|
+
async orgCopies({ name }) {
|
|
125
|
+
return { overrides: await this.orgOverrides.listForPlugin(name) };
|
|
126
|
+
}
|
|
93
127
|
/**
|
|
94
128
|
* Saves the deployment config (`values` keyed by field dot path; `null` clears, omitted keeps).
|
|
95
129
|
* A field present in the startup config -> 409 `extension.config_readonly`; unknown or invalid
|
|
@@ -97,11 +131,12 @@ let AdminExtensionsController = class AdminExtensionsController {
|
|
|
97
131
|
* (a value from the startup config) does not block the PUT: it saves anyway, the extension stays
|
|
98
132
|
* pending configuration and the startup config has to change. Every replica re-reads after saving:
|
|
99
133
|
* hot fields are replaced in place, other fields reload the extension, and a pending extension
|
|
100
|
-
* loads (no restart).
|
|
134
|
+
* loads (no restart). `secretEntries` set, rename or remove single keys of a secret record a
|
|
135
|
+
* config UI hint draws per item (a path no hint names -> 400 `validation_failed`).
|
|
101
136
|
*/
|
|
102
137
|
putConfig(principal, name, body) {
|
|
103
138
|
const actor = requireUser(principal);
|
|
104
|
-
return this.deploymentConfigs.put(name, body.values, actor.account.id, patTokenId(actor));
|
|
139
|
+
return this.deploymentConfigs.put(name, body.values, actor.account.id, patTokenId(actor), body.secretEntries);
|
|
105
140
|
}
|
|
106
141
|
/**
|
|
107
142
|
* Web approval: writes the snapshot (source web), audits `extension.permissions_approved` and
|
|
@@ -177,6 +212,10 @@ __decorate([
|
|
|
177
212
|
Get(":name/config"),
|
|
178
213
|
__param(0, Param("name"))
|
|
179
214
|
], AdminExtensionsController.prototype, "config", null);
|
|
215
|
+
__decorate([
|
|
216
|
+
Get(":name/org-overrides"),
|
|
217
|
+
__param(0, ZParam(AdminExtensionNameParamsDto))
|
|
218
|
+
], AdminExtensionsController.prototype, "orgCopies", null);
|
|
180
219
|
__decorate([
|
|
181
220
|
Put(":name/config"),
|
|
182
221
|
__param(0, CurrentPrincipal()),
|
|
@@ -229,11 +268,12 @@ __decorate([
|
|
|
229
268
|
], AdminExtensionsController.prototype, "fromNpm", null);
|
|
230
269
|
AdminExtensionsController = __decorate([
|
|
231
270
|
Controller("api/v1/admin/extensions"),
|
|
232
|
-
|
|
271
|
+
SuperAdmin(),
|
|
233
272
|
__param(0, Inject(ExtensionInstalls)),
|
|
234
273
|
__param(1, Inject(ExtensionAdmin)),
|
|
235
274
|
__param(2, Inject(ExtensionAdminOps)),
|
|
236
275
|
__param(3, Inject(ExtensionDeploymentConfigService)),
|
|
237
|
-
__param(4, Inject(KernelConfigService))
|
|
276
|
+
__param(4, Inject(KernelConfigService)),
|
|
277
|
+
__param(5, Inject(OrgOverrides))
|
|
238
278
|
], AdminExtensionsController);
|
|
239
279
|
export { AdminExtensionsController };
|
|
@@ -2,7 +2,7 @@ import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
|
2
2
|
import { XactLock } from "../infra/database/xact-lock.js";
|
|
3
3
|
/**
|
|
4
4
|
* The deployment setup lock (one provider per transaction-scoped lock): serializes the web setup
|
|
5
|
-
* wizard and the CLI's `admin create --if-none`, so concurrent runs create exactly one
|
|
5
|
+
* wizard and the CLI's `admin create --if-none`, so concurrent runs create exactly one super
|
|
6
6
|
* admin. Joins the caller's transaction (`mandatory`), which holds it until it ends.
|
|
7
7
|
*/
|
|
8
8
|
export declare class SetupLock {
|
package/dist/admin/setup-lock.js
CHANGED
|
@@ -15,7 +15,7 @@ import { XactLock } from "../infra/database/xact-lock.js";
|
|
|
15
15
|
const SETUP_LOCK = "capybara.setup";
|
|
16
16
|
/**
|
|
17
17
|
* The deployment setup lock (one provider per transaction-scoped lock): serializes the web setup
|
|
18
|
-
* wizard and the CLI's `admin create --if-none`, so concurrent runs create exactly one
|
|
18
|
+
* wizard and the CLI's `admin create --if-none`, so concurrent runs create exactly one super
|
|
19
19
|
* admin. Joins the caller's transaction (`mandatory`), which holds it until it ends.
|
|
20
20
|
*/
|
|
21
21
|
let SetupLock = class SetupLock {
|
|
@@ -24,7 +24,7 @@ export declare class SetupController {
|
|
|
24
24
|
needsSetup: boolean;
|
|
25
25
|
}>;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* 建首个超级管理员(可选同时建组织),成功后直接登录(设会话 Cookie)。
|
|
28
28
|
* 配置了 `auth.setupToken` 时 body 中的 `setupToken` 必须与之相等,否则 `setup.token_invalid`;
|
|
29
29
|
* 核对前先占用限流额度,超限 → 429 `auth.rate_limited`,核对通过后退还。
|
|
30
30
|
*/
|