@capybara-hq/kernel 0.1.0-rc.5 → 0.1.0-rc.7
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 +27 -3
- package/dist/admin/admin.controller.d.ts +21 -74
- package/dist/admin/admin.controller.js +50 -50
- package/dist/admin/admin.schemas.d.ts +57 -0
- package/dist/admin/admin.schemas.js +50 -0
- package/dist/admin/extensions.controller.d.ts +10 -0
- package/dist/admin/extensions.controller.js +18 -0
- package/dist/admin/extensions.schemas.d.ts +7 -0
- package/dist/admin/extensions.schemas.js +10 -0
- package/dist/admin/limit-defaults.d.ts +20 -0
- package/dist/admin/limit-defaults.js +10 -0
- package/dist/agents/agent-profile.service.d.ts +7 -5
- package/dist/agents/agent-profile.service.js +14 -9
- package/dist/agents/agents.controller.d.ts +7 -287
- package/dist/agents/agents.controller.js +7 -67
- package/dist/agents/agents.schemas.d.ts +389 -0
- package/dist/agents/agents.schemas.js +126 -0
- package/dist/agents/agents.service.d.ts +16 -6
- package/dist/agents/agents.service.js +75 -19
- package/dist/agents/definition.d.ts +47 -19
- package/dist/agents/definition.js +119 -38
- package/dist/agents/from-template.d.ts +2 -2
- package/dist/agents/from-template.js +76 -45
- package/dist/agents/from-template.service.d.ts +12 -0
- package/dist/agents/from-template.service.js +23 -6
- package/dist/agents/models.controller.d.ts +33 -5
- package/dist/agents/models.controller.js +50 -6
- package/dist/agents/org-templates.d.ts +13 -3
- package/dist/agents/org-templates.js +69 -28
- package/dist/agents/pending-connector-requests.d.ts +2 -0
- package/dist/agents/pending-connector-requests.js +1 -1
- package/dist/agents/pending-connectors.controller.d.ts +1 -1
- package/dist/agents/pending-connectors.controller.js +2 -2
- package/dist/agents/pending-connectors.service.d.ts +2 -2
- package/dist/agents/pending-connectors.service.js +19 -19
- package/dist/agents/profile.d.ts +18 -0
- package/dist/agents/profile.js +5 -1
- package/dist/agents/readiness.controller.d.ts +5 -5
- package/dist/agents/readiness.controller.js +6 -6
- package/dist/agents/templates.controller.d.ts +8 -17
- package/dist/agents/templates.controller.js +13 -31
- package/dist/agents/templates.schemas.d.ts +20 -0
- package/dist/agents/templates.schemas.js +45 -0
- package/dist/background/background.controller.js +3 -2
- package/dist/background/background.schemas.d.ts +10 -0
- package/dist/background/background.schemas.js +16 -0
- package/dist/background/tasks.service.d.ts +1 -1
- package/dist/background/tasks.service.js +7 -2
- package/dist/catalog/admin-catalog.controller.d.ts +4 -57
- package/dist/catalog/admin-catalog.controller.js +8 -45
- package/dist/catalog/admin-catalog.schemas.d.ts +72 -0
- package/dist/catalog/admin-catalog.schemas.js +92 -0
- package/dist/catalog/catalog-content.d.ts +12 -2
- package/dist/catalog/catalog-scope.service.js +8 -2
- package/dist/catalog/catalog.service.d.ts +2 -0
- package/dist/catalog/catalog.service.js +3 -0
- package/dist/catalog/component-scope.controller.d.ts +3 -65
- package/dist/catalog/component-scope.controller.js +3 -56
- package/dist/catalog/component-scope.schemas.d.ts +114 -0
- package/dist/catalog/component-scope.schemas.js +97 -0
- package/dist/catalog/component-scope.service.d.ts +28 -4
- package/dist/catalog/component-scope.service.js +55 -3
- package/dist/catalog/component-state.d.ts +9 -2
- package/dist/catalog/component-state.js +22 -13
- package/dist/catalog/marketplaces.controller.d.ts +5 -35
- package/dist/catalog/marketplaces.controller.js +6 -34
- package/dist/catalog/marketplaces.schemas.d.ts +48 -0
- package/dist/catalog/marketplaces.schemas.js +53 -0
- package/dist/catalog/marketplaces.service.d.ts +15 -1
- package/dist/catalog/marketplaces.service.js +22 -1
- package/dist/catalog/org-catalog.controller.d.ts +6 -62
- package/dist/catalog/org-catalog.controller.js +12 -66
- package/dist/catalog/org-catalog.schemas.d.ts +79 -0
- package/dist/catalog/org-catalog.schemas.js +82 -0
- package/dist/catalog/org-catalog.service.d.ts +9 -2
- package/dist/catalog/org-catalog.service.js +38 -5
- package/dist/catalog/org-extension.controller.d.ts +1 -12
- package/dist/catalog/org-extension.controller.js +1 -10
- package/dist/catalog/org-extension.schemas.d.ts +15 -0
- package/dist/catalog/org-extension.schemas.js +22 -0
- package/dist/catalog/org-plugin-uploads.controller.d.ts +2 -19
- package/dist/catalog/org-plugin-uploads.controller.js +15 -28
- package/dist/catalog/org-plugin-uploads.schemas.d.ts +20 -0
- package/dist/catalog/org-plugin-uploads.schemas.js +32 -0
- package/dist/catalog/owned-items.d.ts +6 -2
- package/dist/catalog/owned-items.js +16 -4
- package/dist/catalog/platform-components.d.ts +2 -0
- package/dist/catalog/platform-components.js +2 -0
- package/dist/catalog/plugin-import.js +1 -0
- package/dist/catalog/plugin-install.js +1 -1
- package/dist/catalog/requests.service.d.ts +2 -1
- package/dist/catalog/requests.service.js +6 -2
- package/dist/channels/channels.schemas.d.ts +33 -0
- package/dist/channels/channels.schemas.js +34 -0
- package/dist/channels/connections.controller.d.ts +2 -29
- package/dist/channels/connections.controller.js +1 -23
- package/dist/channels/connections.service.d.ts +8 -2
- package/dist/channels/connections.service.js +23 -5
- package/dist/channels/inbound.js +4 -0
- package/dist/config/schema.d.ts +4 -0
- package/dist/config/schema.js +24 -0
- package/dist/conversations/conversations.controller.d.ts +16 -37
- package/dist/conversations/conversations.controller.js +16 -56
- package/dist/conversations/conversations.schemas.d.ts +52 -0
- package/dist/conversations/conversations.schemas.js +79 -0
- package/dist/conversations/conversations.service.d.ts +13 -4
- package/dist/conversations/conversations.service.js +32 -26
- package/dist/conversations/events.d.ts +80 -6
- package/dist/conversations/events.js +60 -5
- package/dist/conversations/message-context.d.ts +28 -0
- package/dist/conversations/message-context.js +56 -0
- package/dist/conversations/queue.d.ts +2 -1
- package/dist/conversations/queue.js +11 -2
- package/dist/ctx/create-ctx.d.ts +15 -1
- package/dist/ctx/create-ctx.js +23 -2
- package/dist/db/kernel-schema.d.ts +44 -0
- package/dist/environments/environments.schemas.d.ts +3 -0
- package/dist/environments/environments.schemas.js +14 -0
- package/dist/environments/environments.service.d.ts +16 -4
- package/dist/environments/environments.service.js +58 -13
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +6 -0
- package/dist/evals/evals.schemas.d.ts +110 -0
- package/dist/evals/evals.schemas.js +107 -0
- package/dist/evals/reconstruct.js +18 -11
- package/dist/evals/recorded-tools.d.ts +2 -1
- package/dist/evals/recorded-tools.js +11 -3
- package/dist/evals/run-replay.d.ts +8 -1
- package/dist/evals/run-replay.js +17 -2
- package/dist/evals/runs.controller.d.ts +2 -57
- package/dist/evals/runs.controller.js +1 -42
- package/dist/evals/runs.service.d.ts +8 -7
- package/dist/evals/runs.service.js +45 -30
- package/dist/evals/sets.controller.d.ts +2 -28
- package/dist/evals/sets.controller.js +1 -31
- package/dist/evals/sets.service.d.ts +7 -7
- package/dist/evals/sets.service.js +23 -17
- package/dist/evals/snapshot.d.ts +3 -2
- package/dist/evals/snapshot.js +17 -4
- package/dist/evals/step-replay.d.ts +2 -1
- package/dist/evals/step-replay.js +3 -2
- package/dist/extensions/admin-ops.d.ts +5 -3
- package/dist/extensions/admin-ops.js +17 -12
- package/dist/extensions/config-hash.d.ts +10 -0
- package/dist/extensions/config-hash.js +38 -0
- package/dist/extensions/deployment-config.d.ts +16 -1
- package/dist/extensions/deployment-config.js +83 -0
- package/dist/extensions/extensions.module.js +9 -12
- package/dist/extensions/host.d.ts +39 -12
- package/dist/extensions/host.js +129 -51
- package/dist/extensions/installs.d.ts +5 -0
- package/dist/extensions/installs.js +12 -0
- package/dist/extensions/org-config.d.ts +17 -2
- package/dist/extensions/org-config.js +23 -4
- package/dist/extensions/point-defaults.controller.d.ts +2 -8
- package/dist/extensions/point-defaults.controller.js +1 -3
- package/dist/extensions/point-defaults.d.ts +3 -1
- package/dist/extensions/point-defaults.js +4 -2
- package/dist/extensions/point-defaults.schemas.d.ts +9 -0
- package/dist/extensions/point-defaults.schemas.js +14 -0
- package/dist/extensions/state.module.d.ts +9 -0
- package/dist/extensions/state.module.js +38 -0
- package/dist/extensions/unavailable.d.ts +49 -0
- package/dist/extensions/unavailable.js +113 -0
- package/dist/files/previewers.controller.js +2 -3
- package/dist/files/previewers.d.ts +1 -1
- package/dist/files/previewers.js +4 -4
- package/dist/files/previewers.schemas.d.ts +10 -0
- package/dist/files/previewers.schemas.js +9 -0
- package/dist/http/api.module.js +4 -0
- package/dist/http/plugin-dispatch.d.ts +4 -1
- package/dist/http/plugin-dispatch.js +14 -2
- package/dist/identity/accounts.d.ts +43 -4
- package/dist/identity/accounts.js +74 -6
- package/dist/identity/auth.guard.js +10 -1
- package/dist/identity/cookies.d.ts +6 -0
- package/dist/identity/cookies.js +14 -0
- package/dist/identity/identity.module.js +3 -0
- package/dist/identity/initial-passwords.controller.d.ts +22 -0
- package/dist/identity/initial-passwords.controller.js +49 -0
- package/dist/identity/initial-passwords.d.ts +61 -0
- package/dist/identity/initial-passwords.job.d.ts +16 -0
- package/dist/identity/initial-passwords.job.js +46 -0
- package/dist/identity/initial-passwords.js +159 -0
- package/dist/identity/me.controller.d.ts +14 -0
- package/dist/identity/me.controller.js +39 -1
- package/dist/identity/principal.d.ts +8 -0
- package/dist/identity/principal.js +8 -0
- package/dist/identity/settings.d.ts +3 -1
- package/dist/identity/settings.js +6 -4
- package/dist/inbox/inbox.schemas.d.ts +8 -0
- package/dist/inbox/inbox.schemas.js +11 -0
- package/dist/inbox/platform-inbox.controller.d.ts +1 -1
- package/dist/inbox/platform-inbox.controller.js +2 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -0
- package/dist/infra/config/kernel-config.service.js +3 -0
- package/dist/infra/events/kernel-events.d.ts +8 -0
- package/dist/lifecycle/kernel-lifecycle.js +4 -0
- package/dist/models/embeddings.d.ts +82 -0
- package/dist/models/embeddings.js +326 -0
- package/dist/models/enablement.controller.d.ts +40 -0
- package/dist/models/enablement.controller.js +74 -0
- package/dist/models/enablement.d.ts +101 -0
- package/dist/models/enablement.js +264 -0
- package/dist/models/models.module.d.ts +5 -1
- package/dist/models/models.module.js +16 -4
- package/dist/models/org-models.schemas.d.ts +8 -0
- package/dist/models/org-models.schemas.js +22 -0
- package/dist/models/prices.d.ts +3 -1
- package/dist/models/prices.js +7 -5
- package/dist/models/purposes.d.ts +30 -6
- package/dist/models/purposes.js +68 -17
- package/dist/orgs/orgs.controller.d.ts +2 -5
- package/dist/orgs/orgs.controller.js +3 -6
- package/dist/orgs/orgs.schemas.d.ts +8 -0
- package/dist/orgs/orgs.schemas.js +16 -0
- package/dist/orgs/orgs.service.d.ts +3 -1
- package/dist/orgs/orgs.service.js +6 -4
- package/dist/orgs/settings.service.d.ts +9 -1
- package/dist/orgs/settings.service.js +20 -5
- package/dist/overrides.d.ts +4 -0
- package/dist/overrides.js +2 -0
- package/dist/platform/errors.d.ts +21 -4
- package/dist/platform/errors.js +45 -6
- package/dist/platform/exclusions.d.ts +2 -3
- package/dist/platform/exclusions.js +68 -831
- package/dist/platform/method.js +1 -1
- package/dist/platform/operation.d.ts +82 -5
- package/dist/platform/operation.js +62 -7
- package/dist/platform/ops/accounts.ops.d.ts +32 -0
- package/dist/platform/ops/accounts.ops.js +291 -0
- package/dist/platform/ops/admin.ops.d.ts +36 -0
- package/dist/platform/ops/admin.ops.js +389 -0
- package/dist/platform/ops/agent-skills.ops.d.ts +24 -0
- package/dist/platform/ops/agent-skills.ops.js +226 -0
- package/dist/platform/ops/agent-templates.ops.d.ts +4 -1
- package/dist/platform/ops/agent-templates.ops.js +194 -14
- package/dist/platform/ops/agents.ops.d.ts +19 -1
- package/dist/platform/ops/agents.ops.js +481 -58
- package/dist/platform/ops/approvals.ops.d.ts +30 -0
- package/dist/platform/ops/approvals.ops.js +116 -0
- package/dist/platform/ops/background.ops.d.ts +14 -0
- package/dist/platform/ops/background.ops.js +134 -0
- package/dist/platform/ops/catalog-admin.ops.d.ts +74 -0
- package/dist/platform/ops/catalog-admin.ops.js +587 -0
- package/dist/platform/ops/channels.ops.d.ts +16 -0
- package/dist/platform/ops/channels.ops.js +195 -0
- package/dist/platform/ops/components.ops.d.ts +46 -0
- package/dist/platform/ops/components.ops.js +853 -0
- package/dist/platform/ops/connectors.ops.d.ts +4 -2
- package/dist/platform/ops/connectors.ops.js +68 -6
- package/dist/platform/ops/conversations.ops.d.ts +30 -0
- package/dist/platform/ops/conversations.ops.js +470 -0
- package/dist/platform/ops/environments.ops.d.ts +26 -0
- package/dist/platform/ops/environments.ops.js +289 -0
- package/dist/platform/ops/errors.d.ts +10 -5
- package/dist/platform/ops/errors.js +19 -11
- package/dist/platform/ops/evals.ops.d.ts +28 -0
- package/dist/platform/ops/evals.ops.js +783 -0
- package/dist/platform/ops/extensions-admin.ops.d.ts +25 -0
- package/dist/platform/ops/extensions-admin.ops.js +344 -0
- package/dist/platform/ops/extensions.ops.d.ts +7 -1
- package/dist/platform/ops/extensions.ops.js +248 -17
- package/dist/platform/ops/inbox.ops.d.ts +25 -0
- package/dist/platform/ops/inbox.ops.js +378 -0
- package/dist/platform/ops/marketplaces.ops.d.ts +7 -1
- package/dist/platform/ops/marketplaces.ops.js +326 -17
- package/dist/platform/ops/models.ops.d.ts +25 -0
- package/dist/platform/ops/models.ops.js +232 -0
- package/dist/platform/ops/org-plugins.ops.d.ts +29 -0
- package/dist/platform/ops/org-plugins.ops.js +329 -0
- package/dist/platform/ops/org-settings.ops.d.ts +16 -0
- package/dist/platform/ops/org-settings.ops.js +102 -0
- package/dist/platform/ops/orgs.ops.d.ts +28 -0
- package/dist/platform/ops/orgs.ops.js +295 -0
- package/dist/platform/ops/other-orgs.d.ts +20 -0
- package/dist/platform/ops/other-orgs.js +72 -0
- package/dist/platform/ops/platform.ops.d.ts +4 -4
- package/dist/platform/ops/platform.ops.js +23 -24
- package/dist/platform/ops/plugins.ops.d.ts +10 -8
- package/dist/platform/ops/plugins.ops.js +176 -77
- package/dist/platform/ops/previewers.ops.d.ts +14 -0
- package/dist/platform/ops/previewers.ops.js +109 -0
- package/dist/platform/ops/requests.ops.js +57 -19
- package/dist/platform/ops/skills.ops.d.ts +5 -1
- package/dist/platform/ops/skills.ops.js +129 -11
- package/dist/platform/ops/unavailable.d.ts +23 -0
- package/dist/platform/ops/unavailable.js +111 -0
- package/dist/platform/parity.d.ts +33 -0
- package/dist/platform/parity.js +272 -0
- package/dist/platform/platform-ops.module.d.ts +32 -0
- package/dist/platform/platform-ops.module.js +78 -11
- package/dist/platform/route-schemas.d.ts +18 -0
- package/dist/platform/route-schemas.js +60 -0
- package/dist/roles/worker.module.js +2 -0
- package/dist/runtime/context/build.d.ts +2 -0
- package/dist/runtime/context/build.js +28 -2
- package/dist/runtime/context/compaction.js +10 -1
- package/dist/runtime/context/run-context.d.ts +65 -0
- package/dist/runtime/context/run-context.js +215 -0
- package/dist/runtime/hook-calls.d.ts +8 -1
- package/dist/runtime/hook-calls.js +40 -9
- package/dist/runtime/model-call.d.ts +8 -3
- package/dist/runtime/model-call.js +30 -6
- package/dist/runtime/providers.d.ts +146 -32
- package/dist/runtime/providers.js +328 -67
- package/dist/runtime/run-context.service.d.ts +65 -0
- package/dist/runtime/run-context.service.js +220 -0
- package/dist/runtime/run-worker.d.ts +6 -1
- package/dist/runtime/run-worker.js +35 -10
- package/dist/runtime/runtime.module.js +2 -0
- package/dist/runtime/subagents/definition.d.ts +15 -15
- package/dist/runtime/subagents/definition.js +49 -118
- package/dist/runtime/usage-report-jobs.d.ts +88 -0
- package/dist/runtime/usage-report-jobs.js +158 -0
- package/dist/runtime/usage-report.d.ts +33 -38
- package/dist/runtime/usage-report.js +152 -84
- package/dist/skills/changes.controller.js +2 -1
- package/dist/skills/changes.service.d.ts +1 -1
- package/dist/skills/changes.service.js +4 -4
- package/dist/skills/invocable.controller.d.ts +1 -1
- package/dist/skills/invocable.controller.js +2 -2
- package/dist/skills/invoke.d.ts +2 -2
- package/dist/skills/invoke.js +8 -1
- package/dist/skills/skills.controller.d.ts +4 -13
- package/dist/skills/skills.controller.js +8 -24
- package/dist/skills/skills.schemas.d.ts +48 -0
- package/dist/skills/skills.schemas.js +61 -0
- package/dist/skills/skills.service.d.ts +11 -1
- package/dist/skills/skills.service.js +37 -14
- package/dist/time-zone.d.ts +5 -0
- package/dist/time-zone.js +19 -0
- package/dist/tools/approvals.controller.js +2 -3
- package/dist/tools/approvals.schemas.d.ts +21 -0
- package/dist/tools/approvals.schemas.js +15 -0
- package/dist/tools/builtin-names.d.ts +10 -8
- package/dist/tools/builtin-names.js +16 -11
- package/dist/tools/builtins/builtin-tools.d.ts +3 -1
- package/dist/tools/builtins/builtin-tools.js +15 -3
- package/dist/tools/builtins/current-time.d.ts +26 -0
- package/dist/tools/builtins/current-time.js +99 -0
- package/dist/tools/builtins/platform.d.ts +19 -2
- package/dist/tools/builtins/platform.js +105 -16
- package/dist/tools/connectors.controller.d.ts +1 -2
- package/dist/tools/connectors.controller.js +1 -4
- package/dist/tools/connectors.schemas.d.ts +12 -0
- package/dist/tools/connectors.schemas.js +19 -0
- package/dist/tools/connectors.service.d.ts +5 -2
- package/dist/tools/connectors.service.js +7 -5
- package/dist/tools/org-tool-switches.d.ts +16 -2
- package/dist/tools/org-tool-switches.js +26 -9
- package/dist/tools/pipeline.js +9 -1
- package/dist/tools/registry.d.ts +48 -51
- package/dist/tools/registry.js +222 -233
- package/package.json +3 -3
- package/src/migrations/0089_model_kinds_usage.sql +38 -0
- package/src/migrations/0090_initial_passwords.sql +27 -0
- package/src/migrations/0091_account_time_zone.sql +4 -0
- package/src/migrations/0092_tools_default_on.sql +27 -0
- package/dist/platform/redact-orgs.d.ts +0 -7
- package/dist/platform/redact-orgs.js +0 -52
package/bootstrap.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"schemaVersion": 1,
|
|
4
4
|
"marketplace": {
|
|
5
5
|
"url": "https://github.com/capybara-hq/plugins.git",
|
|
6
|
-
"commit": "
|
|
6
|
+
"commit": "0bd7fafa0572066198d64b5fde159f758123ef62"
|
|
7
7
|
},
|
|
8
8
|
"plugins": [
|
|
9
9
|
{
|
|
@@ -38,6 +38,30 @@
|
|
|
38
38
|
"integrity": "sha512-F714dJ023p8XcrPXYNZyjiow5BXza5KTdlJV4Uw8spgulgjPSF44n0SVMEA1iyYCwOFrr58NSvw51AqmOYg6Fw==",
|
|
39
39
|
"required": false
|
|
40
40
|
},
|
|
41
|
+
{
|
|
42
|
+
"name": "deepseek",
|
|
43
|
+
"source": "npm",
|
|
44
|
+
"npm": "@capybara-hq/plugin-deepseek",
|
|
45
|
+
"version": "0.1.0-rc.0",
|
|
46
|
+
"integrity": "sha512-/3+qpvDChcPpW6mL7EdMfdi6X56WDau2k725rXT79fvKI1P7q8tD5e7VVAn7eOKJuiNRx8UiH/704SzbmcVR6A==",
|
|
47
|
+
"required": false
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "bailian",
|
|
51
|
+
"source": "npm",
|
|
52
|
+
"npm": "@capybara-hq/plugin-bailian",
|
|
53
|
+
"version": "0.1.0-rc.0",
|
|
54
|
+
"integrity": "sha512-ggAM/56wS7bEEwM/ZYQOQeLtH8QvWAFZyd2BPgSBvkOECZXwggavY6357SoPEmLevyNQH6PxR42uwxF8EuvJNg==",
|
|
55
|
+
"required": false
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "ark",
|
|
59
|
+
"source": "npm",
|
|
60
|
+
"npm": "@capybara-hq/plugin-ark",
|
|
61
|
+
"version": "0.1.0-rc.0",
|
|
62
|
+
"integrity": "sha512-LqLgUj1MjtzBX9t6NR9YMEVOHSGTobQjtbbU1c0ifcKxEpxFg/2LqK12wyhV6eSaZJQGj9TPhkUfh14Y49PXwg==",
|
|
63
|
+
"required": false
|
|
64
|
+
},
|
|
41
65
|
{
|
|
42
66
|
"name": "connector-mcp",
|
|
43
67
|
"source": "npm",
|
|
@@ -66,8 +90,8 @@
|
|
|
66
90
|
"name": "sandbox-docker",
|
|
67
91
|
"source": "npm",
|
|
68
92
|
"npm": "@capybara-hq/plugin-sandbox-docker",
|
|
69
|
-
"version": "0.1.0-rc.
|
|
70
|
-
"integrity": "sha512-
|
|
93
|
+
"version": "0.1.0-rc.5",
|
|
94
|
+
"integrity": "sha512-Q+4s3lG/kii5cHaIfBStCqvK2Z1IVpjeAWUN3cuxIwhQHc2HNTYSpKO5R9JfC8J3ajC8KEO+LkED4iI9oCCcGg==",
|
|
71
95
|
"required": false
|
|
72
96
|
},
|
|
73
97
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LocalizedName, Logger } from "@capybara-hq/plugin-sdk";
|
|
2
|
-
import { z } from "zod";
|
|
2
|
+
import type { z } from "zod";
|
|
3
3
|
import { CatalogRequestsService } from "../catalog/requests.service.js";
|
|
4
4
|
import { ExtensionAdmin } from "../extensions/admin-view.js";
|
|
5
5
|
import { ExtensionDisplayNames } from "../extensions/display-name.js";
|
|
@@ -8,11 +8,14 @@ import { type Principal } from "../identity/principal.js";
|
|
|
8
8
|
import { SessionService } from "../identity/sessions.js";
|
|
9
9
|
import { type DeploymentSettings, SettingsService } from "../identity/settings.js";
|
|
10
10
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
11
|
+
import { type ModelDisabledPatch, type ModelProviderParams } from "../models/enablement.controller.js";
|
|
12
|
+
import { type ModelDisableResult, ModelEnablement } from "../models/enablement.js";
|
|
11
13
|
import { type ModelPrice, type ModelPricePut, PricesService } from "../models/prices.js";
|
|
12
14
|
import { ModelPurposesService, type PurposeListing, type PurposePut } from "../models/purposes.js";
|
|
13
15
|
import { type Org, OrgsService } from "../orgs/orgs.service.js";
|
|
14
16
|
import { ProviderRegistry, type ProviderStatus } from "../runtime/providers.js";
|
|
15
|
-
import
|
|
17
|
+
import { AccountListQuery, AccountParams, CreateAccountBody, DeploymentSettingsBody, PurposeParams, UpdateAccountBody } from "./admin.schemas.js";
|
|
18
|
+
import { type LimitDefaults } from "./limit-defaults.js";
|
|
16
19
|
/** 后台概览(`GET /api/v1/admin/overview`)的计数。 */
|
|
17
20
|
export interface AdminOverview {
|
|
18
21
|
/**
|
|
@@ -25,69 +28,6 @@ export interface AdminOverview {
|
|
|
25
28
|
orgs: number;
|
|
26
29
|
accounts: number;
|
|
27
30
|
}
|
|
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
|
-
}
|
|
44
|
-
declare const ListQuerySchema: z.ZodObject<{
|
|
45
|
-
after: z.ZodOptional<z.ZodString>;
|
|
46
|
-
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
47
|
-
}, z.core.$strip>;
|
|
48
|
-
declare const CreateAccountSchema: z.ZodObject<{
|
|
49
|
-
login: z.ZodString;
|
|
50
|
-
password: z.ZodString;
|
|
51
|
-
displayName: z.ZodString;
|
|
52
|
-
email: z.ZodOptional<z.ZodEmail>;
|
|
53
|
-
superAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
-
}, z.core.$strip>;
|
|
55
|
-
declare const UpdateAccountSchema: z.ZodObject<{
|
|
56
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
57
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
58
|
-
active: "active";
|
|
59
|
-
disabled: "disabled";
|
|
60
|
-
}>>;
|
|
61
|
-
isSuperAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
-
}, z.core.$strip>;
|
|
63
|
-
/** 至少给出一个键;`runConcurrencyOverrides` 按组织合并,值为 null 删除该组织的覆盖。 */
|
|
64
|
-
declare const SettingsSchema: z.ZodObject<{
|
|
65
|
-
orgCreation: z.ZodOptional<z.ZodEnum<{
|
|
66
|
-
anyone: "anyone";
|
|
67
|
-
super_admin: "super_admin";
|
|
68
|
-
}>>;
|
|
69
|
-
runConcurrencyOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodNumber>>>;
|
|
70
|
-
priceCurrency: z.ZodOptional<z.ZodString>;
|
|
71
|
-
sandboxLimitOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
|
|
72
|
-
cpu: z.ZodOptional<z.ZodNumber>;
|
|
73
|
-
memoryMb: z.ZodOptional<z.ZodNumber>;
|
|
74
|
-
}, z.core.$strict>>>>;
|
|
75
|
-
subagentLimitOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
|
|
76
|
-
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
77
|
-
maxConcurrentPerConversation: z.ZodOptional<z.ZodNumber>;
|
|
78
|
-
maxDispatchesPerRun: z.ZodOptional<z.ZodNumber>;
|
|
79
|
-
maxTokensPerRun: z.ZodOptional<z.ZodNumber>;
|
|
80
|
-
}, z.core.$strict>>>>;
|
|
81
|
-
customConnectors: z.ZodOptional<z.ZodEnum<{
|
|
82
|
-
allow: "allow";
|
|
83
|
-
deny: "deny";
|
|
84
|
-
}>>;
|
|
85
|
-
customSkills: z.ZodOptional<z.ZodEnum<{
|
|
86
|
-
allow: "allow";
|
|
87
|
-
deny: "deny";
|
|
88
|
-
}>>;
|
|
89
|
-
orgMarketplaceBrowse: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
-
}, z.core.$strict>;
|
|
91
31
|
/**
|
|
92
32
|
* 超级管理员端点(`/api/v1/admin/*`):只接受超级管理员的 Web 会话或个人令牌;
|
|
93
33
|
* 服务令牌一律 `forbidden`(未标 `@AllowService`)。
|
|
@@ -104,23 +44,24 @@ export declare class AdminController {
|
|
|
104
44
|
private readonly registry;
|
|
105
45
|
private readonly catalogRequests;
|
|
106
46
|
private readonly displayNames;
|
|
47
|
+
private readonly enablement;
|
|
107
48
|
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);
|
|
49
|
+
constructor(accounts: AccountsService, sessions: SessionService, log: Logger, orgs: OrgsService, settings: SettingsService, prices: PricesService, purposes: ModelPurposesService, plugins: ExtensionAdmin, registry: ProviderRegistry, catalogRequests: CatalogRequestsService, displayNames: ExtensionDisplayNames, enablement: ModelEnablement, config: KernelConfigService);
|
|
109
50
|
/** 后台概览的四个数字(只读计数,不含任何对话内容)。 */
|
|
110
51
|
overview(): Promise<AdminOverview>;
|
|
111
52
|
/**
|
|
112
53
|
* 全部账号,按 id 升序分页:`next` 为下一页的游标(作为 `after` 传回),没有更多时为 null。
|
|
113
54
|
* 多取一条判断是否还有下一页。
|
|
114
55
|
*/
|
|
115
|
-
listAccounts(q: z.infer<typeof
|
|
56
|
+
listAccounts(q: z.infer<typeof AccountListQuery>): Promise<{
|
|
116
57
|
accounts: Account[];
|
|
117
58
|
next: string | null;
|
|
118
59
|
}>;
|
|
119
|
-
createAccount(principal: Principal, body: z.infer<typeof
|
|
60
|
+
createAccount(principal: Principal, body: z.infer<typeof CreateAccountBody>): Promise<{
|
|
120
61
|
account: Account;
|
|
121
62
|
}>;
|
|
122
63
|
/** 改显示名 / 状态 / 超级管理员;停用时同时吊销该账号的全部会话与个人令牌。 */
|
|
123
|
-
updateAccount(principal: Principal, accountId:
|
|
64
|
+
updateAccount(principal: Principal, { accountId }: z.infer<typeof AccountParams>, body: z.infer<typeof UpdateAccountBody>): Promise<{
|
|
124
65
|
account: Account;
|
|
125
66
|
}>;
|
|
126
67
|
/**
|
|
@@ -134,12 +75,12 @@ export declare class AdminController {
|
|
|
134
75
|
limitDefaults: LimitDefaults;
|
|
135
76
|
}>;
|
|
136
77
|
getSettings(): Promise<DeploymentSettings>;
|
|
137
|
-
|
|
138
|
-
putSettings(principal: Principal, body: z.infer<typeof SettingsSchema>): Promise<DeploymentSettings>;
|
|
78
|
+
putSettings(principal: Principal, body: z.infer<typeof DeploymentSettingsBody>): Promise<DeploymentSettings>;
|
|
139
79
|
/**
|
|
140
80
|
* 模型供应商与模型(后台「模型」页):每个供应商带状态,列模型失败的标 `error`,不影响其他供应商;
|
|
141
81
|
* 一并返回价格表与币种(改价仍走 `PUT /admin/model-prices`)。Each provider carries its extension's
|
|
142
|
-
* display name (null when it has none)
|
|
82
|
+
* display name (null when it has none); every model of the platform's list carries `disabled`
|
|
83
|
+
* (the platform's disabled list, spec B §5.3).
|
|
143
84
|
*/
|
|
144
85
|
getModels(): Promise<{
|
|
145
86
|
providers: (ProviderStatus & {
|
|
@@ -148,6 +89,13 @@ export declare class AdminController {
|
|
|
148
89
|
prices: ModelPrice[];
|
|
149
90
|
currency: string;
|
|
150
91
|
}>;
|
|
92
|
+
/**
|
|
93
|
+
* The platform's disabled models of one provider (spec B §5.3): disables and enables the ids the
|
|
94
|
+
* body names (others keep their state); such a model is invisible to every org. The response
|
|
95
|
+
* lists the agents and purposes, across orgs, that now point at a newly disabled model (the
|
|
96
|
+
* disable is not refused for them).
|
|
97
|
+
*/
|
|
98
|
+
patchModelsDisabled(principal: Principal, params: z.infer<typeof ModelProviderParams>, body: z.infer<typeof ModelDisabledPatch>): Promise<ModelDisableResult>;
|
|
151
99
|
/** 模型价格表(每百万 token)与币种(部署设置 `priceCurrency`)。 */
|
|
152
100
|
getModelPrices(): Promise<{
|
|
153
101
|
prices: ModelPrice[];
|
|
@@ -163,8 +111,7 @@ export declare class AdminController {
|
|
|
163
111
|
purposes: PurposeListing[];
|
|
164
112
|
}>;
|
|
165
113
|
/** 设置一个用途的部署默认,或 `target: null` 清除。 */
|
|
166
|
-
putModelPurpose(principal: Principal, purpose:
|
|
114
|
+
putModelPurpose(principal: Principal, { purpose }: z.infer<typeof PurposeParams>, body: PurposePut): Promise<{
|
|
167
115
|
purpose: PurposeListing;
|
|
168
116
|
}>;
|
|
169
117
|
}
|
|
170
|
-
export {};
|
|
@@ -7,53 +7,39 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
|
-
import { Controller, Get, HttpCode, Inject,
|
|
11
|
-
import { z } from "zod";
|
|
10
|
+
import { Controller, Get, HttpCode, Inject, Patch, Post, Put } from "@nestjs/common";
|
|
12
11
|
import { CatalogRequestsService } from "../catalog/requests.service.js";
|
|
13
12
|
import { ExtensionAdmin } from "../extensions/admin-view.js";
|
|
14
13
|
import { ExtensionDisplayNames } from "../extensions/display-name.js";
|
|
15
14
|
import { extensionNeedsAction } from "../extensions/permission-view.js";
|
|
16
15
|
import { AccountsService } from "../identity/accounts.js";
|
|
17
|
-
import { MAX_PASSWORD_LENGTH } from "../identity/login.js";
|
|
18
16
|
import { CurrentPrincipal, patTokenId, requireUser, SuperAdmin, } from "../identity/principal.js";
|
|
19
17
|
import { SessionService } from "../identity/sessions.js";
|
|
20
|
-
import {
|
|
18
|
+
import { SettingsService } from "../identity/settings.js";
|
|
21
19
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
22
20
|
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
23
21
|
import { createZodDto } from "../infra/validation/create-zod-dto.js";
|
|
24
|
-
import { ZBody, ZQuery } from "../infra/validation/zod-params.js";
|
|
22
|
+
import { ZBody, ZParam, ZQuery } from "../infra/validation/zod-params.js";
|
|
23
|
+
import { ModelDisabledPatchDto, ModelProviderParamsDto, } from "../models/enablement.controller.js";
|
|
24
|
+
import { ModelEnablement } from "../models/enablement.js";
|
|
25
25
|
import { MODEL_PRICE_PUT, PricesService, } from "../models/prices.js";
|
|
26
26
|
import { purposeTargetOf } from "../models/purposes.controller.js";
|
|
27
27
|
import { ModelPurposesService, PurposePutDto, withDeclaredByNames, } from "../models/purposes.js";
|
|
28
28
|
import { OrgsService } from "../orgs/orgs.service.js";
|
|
29
29
|
import { ProviderRegistry } from "../runtime/providers.js";
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
class AccountListQuery extends createZodDto(ListQuerySchema, "AccountListQuery") {
|
|
30
|
+
import { AccountListQuery, AccountParams, CreateAccountBody, DeploymentSettingsBody, PurposeParams, UpdateAccountBody, } from "./admin.schemas.js";
|
|
31
|
+
import { limitDefaults } from "./limit-defaults.js";
|
|
32
|
+
class AccountListQueryDto extends createZodDto(AccountListQuery, "AccountListQuery") {
|
|
35
33
|
}
|
|
36
|
-
|
|
37
|
-
login: z.string().min(1).max(64),
|
|
38
|
-
password: z.string().min(1).max(MAX_PASSWORD_LENGTH),
|
|
39
|
-
displayName: z.string().trim().min(1).max(100),
|
|
40
|
-
email: z.email().max(254).optional(),
|
|
41
|
-
superAdmin: z.boolean().optional(),
|
|
42
|
-
});
|
|
43
|
-
class CreateAccountBody extends createZodDto(CreateAccountSchema, "CreateAccountBody") {
|
|
34
|
+
class CreateAccountBodyDto extends createZodDto(CreateAccountBody, "CreateAccountBody") {
|
|
44
35
|
}
|
|
45
|
-
|
|
46
|
-
displayName: z.string().trim().min(1).max(100).optional(),
|
|
47
|
-
status: z.enum(["active", "disabled"]).optional(),
|
|
48
|
-
isSuperAdmin: z.boolean().optional(),
|
|
49
|
-
});
|
|
50
|
-
class UpdateAccountBody extends createZodDto(UpdateAccountSchema, "UpdateAccountBody") {
|
|
36
|
+
class UpdateAccountBodyDto extends createZodDto(UpdateAccountBody, "UpdateAccountBody") {
|
|
51
37
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
class
|
|
38
|
+
class AccountParamsDto extends createZodDto(AccountParams, "AccountParams") {
|
|
39
|
+
}
|
|
40
|
+
class PurposeParamsDto extends createZodDto(PurposeParams, "PurposeParams") {
|
|
41
|
+
}
|
|
42
|
+
class DeploymentSettingsBodyDto extends createZodDto(DeploymentSettingsBody, "DeploymentSettingsPatch") {
|
|
57
43
|
}
|
|
58
44
|
// a union schema: a DTO value rather than a class (a class cannot extend a union instance type)
|
|
59
45
|
const ModelPriceBody = createZodDto(MODEL_PRICE_PUT, "ModelPricePut");
|
|
@@ -73,8 +59,9 @@ let AdminController = class AdminController {
|
|
|
73
59
|
registry;
|
|
74
60
|
catalogRequests;
|
|
75
61
|
displayNames;
|
|
62
|
+
enablement;
|
|
76
63
|
config;
|
|
77
|
-
constructor(accounts, sessions, log, orgs, settings, prices, purposes, plugins, registry, catalogRequests, displayNames, config) {
|
|
64
|
+
constructor(accounts, sessions, log, orgs, settings, prices, purposes, plugins, registry, catalogRequests, displayNames, enablement, config) {
|
|
78
65
|
this.accounts = accounts;
|
|
79
66
|
this.sessions = sessions;
|
|
80
67
|
this.log = log;
|
|
@@ -86,6 +73,7 @@ let AdminController = class AdminController {
|
|
|
86
73
|
this.registry = registry;
|
|
87
74
|
this.catalogRequests = catalogRequests;
|
|
88
75
|
this.displayNames = displayNames;
|
|
76
|
+
this.enablement = enablement;
|
|
89
77
|
this.config = config;
|
|
90
78
|
}
|
|
91
79
|
/** 后台概览的四个数字(只读计数,不含任何对话内容)。 */
|
|
@@ -128,7 +116,7 @@ let AdminController = class AdminController {
|
|
|
128
116
|
return { account };
|
|
129
117
|
}
|
|
130
118
|
/** 改显示名 / 状态 / 超级管理员;停用时同时吊销该账号的全部会话与个人令牌。 */
|
|
131
|
-
async updateAccount(principal, accountId, body) {
|
|
119
|
+
async updateAccount(principal, { accountId }, body) {
|
|
132
120
|
const actor = requireUser(principal);
|
|
133
121
|
const patch = {
|
|
134
122
|
...(body.displayName !== undefined && { displayName: body.displayName }),
|
|
@@ -154,20 +142,11 @@ let AdminController = class AdminController {
|
|
|
154
142
|
* can be given its own value of (the org limits dialog shows them for the values left empty).
|
|
155
143
|
*/
|
|
156
144
|
async listOrgs() {
|
|
157
|
-
return { orgs: await this.orgs.listAll(), limitDefaults: this.
|
|
145
|
+
return { orgs: await this.orgs.listAll(), limitDefaults: limitDefaults(this.config) };
|
|
158
146
|
}
|
|
159
147
|
async getSettings() {
|
|
160
148
|
return this.settings.get();
|
|
161
149
|
}
|
|
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
|
-
}
|
|
171
150
|
async putSettings(principal, body) {
|
|
172
151
|
const actor = requireUser(principal);
|
|
173
152
|
return this.settings.update(body, actor.account.id, patTokenId(actor));
|
|
@@ -175,7 +154,8 @@ let AdminController = class AdminController {
|
|
|
175
154
|
/**
|
|
176
155
|
* 模型供应商与模型(后台「模型」页):每个供应商带状态,列模型失败的标 `error`,不影响其他供应商;
|
|
177
156
|
* 一并返回价格表与币种(改价仍走 `PUT /admin/model-prices`)。Each provider carries its extension's
|
|
178
|
-
* display name (null when it has none)
|
|
157
|
+
* display name (null when it has none); every model of the platform's list carries `disabled`
|
|
158
|
+
* (the platform's disabled list, spec B §5.3).
|
|
179
159
|
*/
|
|
180
160
|
async getModels() {
|
|
181
161
|
const [providers, prices] = await Promise.all([
|
|
@@ -188,6 +168,19 @@ let AdminController = class AdminController {
|
|
|
188
168
|
...prices,
|
|
189
169
|
};
|
|
190
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* The platform's disabled models of one provider (spec B §5.3): disables and enables the ids the
|
|
173
|
+
* body names (others keep their state); such a model is invisible to every org. The response
|
|
174
|
+
* lists the agents and purposes, across orgs, that now point at a newly disabled model (the
|
|
175
|
+
* disable is not refused for them).
|
|
176
|
+
*/
|
|
177
|
+
async patchModelsDisabled(principal, params, body) {
|
|
178
|
+
const actor = requireUser(principal);
|
|
179
|
+
return this.enablement.setPlatform(params.provider, body, {
|
|
180
|
+
accountId: actor.account.id,
|
|
181
|
+
tokenId: patTokenId(actor),
|
|
182
|
+
});
|
|
183
|
+
}
|
|
191
184
|
/** 模型价格表(每百万 token)与币种(部署设置 `priceCurrency`)。 */
|
|
192
185
|
async getModelPrices() {
|
|
193
186
|
const [prices, settings] = await Promise.all([this.prices.list(), this.settings.get()]);
|
|
@@ -204,7 +197,7 @@ let AdminController = class AdminController {
|
|
|
204
197
|
return { purposes: await withDeclaredByNames(await this.purposes.list(), this.displayNames) };
|
|
205
198
|
}
|
|
206
199
|
/** 设置一个用途的部署默认,或 `target: null` 清除。 */
|
|
207
|
-
async putModelPurpose(principal, purpose, body) {
|
|
200
|
+
async putModelPurpose(principal, { purpose }, body) {
|
|
208
201
|
const actor = requireUser(principal);
|
|
209
202
|
const view = await this.purposes.setDefault(purpose, purposeTargetOf(body), actor.account.id, patTokenId(actor));
|
|
210
203
|
const [listing] = await withDeclaredByNames([view], this.displayNames);
|
|
@@ -216,19 +209,19 @@ __decorate([
|
|
|
216
209
|
], AdminController.prototype, "overview", null);
|
|
217
210
|
__decorate([
|
|
218
211
|
Get("accounts"),
|
|
219
|
-
__param(0, ZQuery(
|
|
212
|
+
__param(0, ZQuery(AccountListQueryDto))
|
|
220
213
|
], AdminController.prototype, "listAccounts", null);
|
|
221
214
|
__decorate([
|
|
222
215
|
Post("accounts"),
|
|
223
216
|
HttpCode(201),
|
|
224
217
|
__param(0, CurrentPrincipal()),
|
|
225
|
-
__param(1, ZBody(
|
|
218
|
+
__param(1, ZBody(CreateAccountBodyDto))
|
|
226
219
|
], AdminController.prototype, "createAccount", null);
|
|
227
220
|
__decorate([
|
|
228
221
|
Patch("accounts/:accountId"),
|
|
229
222
|
__param(0, CurrentPrincipal()),
|
|
230
|
-
__param(1,
|
|
231
|
-
__param(2, ZBody(
|
|
223
|
+
__param(1, ZParam(AccountParamsDto)),
|
|
224
|
+
__param(2, ZBody(UpdateAccountBodyDto))
|
|
232
225
|
], AdminController.prototype, "updateAccount", null);
|
|
233
226
|
__decorate([
|
|
234
227
|
Get("orgs")
|
|
@@ -239,11 +232,17 @@ __decorate([
|
|
|
239
232
|
__decorate([
|
|
240
233
|
Put("settings"),
|
|
241
234
|
__param(0, CurrentPrincipal()),
|
|
242
|
-
__param(1, ZBody(
|
|
235
|
+
__param(1, ZBody(DeploymentSettingsBodyDto))
|
|
243
236
|
], AdminController.prototype, "putSettings", null);
|
|
244
237
|
__decorate([
|
|
245
238
|
Get("models")
|
|
246
239
|
], AdminController.prototype, "getModels", null);
|
|
240
|
+
__decorate([
|
|
241
|
+
Patch("models/:provider/disabled"),
|
|
242
|
+
__param(0, CurrentPrincipal()),
|
|
243
|
+
__param(1, ZParam(ModelProviderParamsDto)),
|
|
244
|
+
__param(2, ZBody(ModelDisabledPatchDto))
|
|
245
|
+
], AdminController.prototype, "patchModelsDisabled", null);
|
|
247
246
|
__decorate([
|
|
248
247
|
Get("model-prices")
|
|
249
248
|
], AdminController.prototype, "getModelPrices", null);
|
|
@@ -258,7 +257,7 @@ __decorate([
|
|
|
258
257
|
__decorate([
|
|
259
258
|
Put("model-purposes/:purpose"),
|
|
260
259
|
__param(0, CurrentPrincipal()),
|
|
261
|
-
__param(1,
|
|
260
|
+
__param(1, ZParam(PurposeParamsDto)),
|
|
262
261
|
__param(2, ZBody(PurposePutDto))
|
|
263
262
|
], AdminController.prototype, "putModelPurpose", null);
|
|
264
263
|
AdminController = __decorate([
|
|
@@ -275,6 +274,7 @@ AdminController = __decorate([
|
|
|
275
274
|
__param(8, Inject(ProviderRegistry)),
|
|
276
275
|
__param(9, Inject(CatalogRequestsService)),
|
|
277
276
|
__param(10, Inject(ExtensionDisplayNames)),
|
|
278
|
-
__param(11, Inject(
|
|
277
|
+
__param(11, Inject(ModelEnablement)),
|
|
278
|
+
__param(12, Inject(KernelConfigService))
|
|
279
279
|
], AdminController);
|
|
280
280
|
export { AdminController };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { RouteSchemas } from "../platform/route-schemas.js";
|
|
3
|
+
/** `GET /api/v1/admin/accounts`: keyset paging by account id. */
|
|
4
|
+
export declare const AccountListQuery: z.ZodObject<{
|
|
5
|
+
after: z.ZodOptional<z.ZodString>;
|
|
6
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const CreateAccountBody: z.ZodObject<{
|
|
9
|
+
login: z.ZodString;
|
|
10
|
+
password: z.ZodString;
|
|
11
|
+
displayName: z.ZodString;
|
|
12
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
13
|
+
superAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare const AccountParams: z.ZodObject<{
|
|
16
|
+
accountId: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare const UpdateAccountBody: z.ZodObject<{
|
|
19
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
20
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
21
|
+
active: "active";
|
|
22
|
+
disabled: "disabled";
|
|
23
|
+
}>>;
|
|
24
|
+
isSuperAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
/** At least one key; `runConcurrencyOverrides` merges by org, a null value drops that org's. */
|
|
27
|
+
export declare const DeploymentSettingsBody: z.ZodObject<{
|
|
28
|
+
orgCreation: z.ZodOptional<z.ZodEnum<{
|
|
29
|
+
anyone: "anyone";
|
|
30
|
+
super_admin: "super_admin";
|
|
31
|
+
}>>;
|
|
32
|
+
runConcurrencyOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodNumber>>>;
|
|
33
|
+
priceCurrency: z.ZodOptional<z.ZodString>;
|
|
34
|
+
sandboxLimitOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
|
|
35
|
+
cpu: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
memoryMb: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
}, z.core.$strict>>>>;
|
|
38
|
+
subagentLimitOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
|
|
39
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
maxConcurrentPerConversation: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
maxDispatchesPerRun: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
maxTokensPerRun: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
}, z.core.$strict>>>>;
|
|
44
|
+
customConnectors: z.ZodOptional<z.ZodEnum<{
|
|
45
|
+
allow: "allow";
|
|
46
|
+
deny: "deny";
|
|
47
|
+
}>>;
|
|
48
|
+
customSkills: z.ZodOptional<z.ZodEnum<{
|
|
49
|
+
allow: "allow";
|
|
50
|
+
deny: "deny";
|
|
51
|
+
}>>;
|
|
52
|
+
orgMarketplaceBrowse: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
export declare const PurposeParams: z.ZodObject<{
|
|
55
|
+
purpose: z.ZodString;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
export declare const ADMIN_ROUTES: readonly RouteSchemas[];
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { MAX_PASSWORD_LENGTH } from "../identity/login.js";
|
|
3
|
+
import { DEPLOYMENT_SETTINGS_PATCH } from "../identity/settings.js";
|
|
4
|
+
import { ModelDisabledPatch, ModelProviderParams } from "../models/enablement.controller.js";
|
|
5
|
+
import { MODEL_PRICE_PUT } from "../models/prices.js";
|
|
6
|
+
import { PURPOSE_PUT } from "../models/purposes.js";
|
|
7
|
+
/** `GET /api/v1/admin/accounts`: keyset paging by account id. */
|
|
8
|
+
export const AccountListQuery = z.object({
|
|
9
|
+
after: z.string().min(1).optional(),
|
|
10
|
+
limit: z.coerce.number().int().min(1).max(200).default(50),
|
|
11
|
+
});
|
|
12
|
+
export const CreateAccountBody = z.object({
|
|
13
|
+
login: z.string().min(1).max(64),
|
|
14
|
+
password: z.string().min(1).max(MAX_PASSWORD_LENGTH),
|
|
15
|
+
displayName: z.string().trim().min(1).max(100),
|
|
16
|
+
email: z.email().max(254).optional(),
|
|
17
|
+
superAdmin: z.boolean().optional(),
|
|
18
|
+
});
|
|
19
|
+
export const AccountParams = z.object({ accountId: z.string().min(1).max(100) });
|
|
20
|
+
export const UpdateAccountBody = z.object({
|
|
21
|
+
displayName: z.string().trim().min(1).max(100).optional(),
|
|
22
|
+
status: z.enum(["active", "disabled"]).optional(),
|
|
23
|
+
isSuperAdmin: z.boolean().optional(),
|
|
24
|
+
});
|
|
25
|
+
/** At least one key; `runConcurrencyOverrides` merges by org, a null value drops that org's. */
|
|
26
|
+
export const DeploymentSettingsBody = DEPLOYMENT_SETTINGS_PATCH.refine((b) => Object.keys(b).length > 0, { message: "at least one setting is required" });
|
|
27
|
+
export const PurposeParams = z.object({ purpose: z.string().min(1).max(100) });
|
|
28
|
+
export const ADMIN_ROUTES = [
|
|
29
|
+
{ route: "GET /api/v1/admin/overview" },
|
|
30
|
+
{ route: "GET /api/v1/admin/accounts", query: AccountListQuery },
|
|
31
|
+
{ route: "POST /api/v1/admin/accounts", body: CreateAccountBody },
|
|
32
|
+
{
|
|
33
|
+
route: "PATCH /api/v1/admin/accounts/:accountId",
|
|
34
|
+
params: AccountParams,
|
|
35
|
+
body: UpdateAccountBody,
|
|
36
|
+
},
|
|
37
|
+
{ route: "GET /api/v1/admin/orgs" },
|
|
38
|
+
{ route: "GET /api/v1/admin/settings" },
|
|
39
|
+
{ route: "PUT /api/v1/admin/settings", body: DeploymentSettingsBody },
|
|
40
|
+
{ route: "GET /api/v1/admin/models" },
|
|
41
|
+
{
|
|
42
|
+
route: "PATCH /api/v1/admin/models/:provider/disabled",
|
|
43
|
+
params: ModelProviderParams,
|
|
44
|
+
body: ModelDisabledPatch,
|
|
45
|
+
},
|
|
46
|
+
{ route: "GET /api/v1/admin/model-prices" },
|
|
47
|
+
{ route: "PUT /api/v1/admin/model-prices", body: MODEL_PRICE_PUT },
|
|
48
|
+
{ route: "GET /api/v1/admin/model-purposes" },
|
|
49
|
+
{ route: "PUT /api/v1/admin/model-purposes/:purpose", params: PurposeParams, body: PURPOSE_PUT },
|
|
50
|
+
];
|
|
@@ -81,6 +81,16 @@ export declare class AdminExtensionsController {
|
|
|
81
81
|
* config UI hint draws per item (a path no hint names -> 400 `validation_failed`).
|
|
82
82
|
*/
|
|
83
83
|
putConfig(principal: Principal, name: string, body: z.infer<typeof ConfigSchema>): Promise<DeploymentConfigView>;
|
|
84
|
+
/**
|
|
85
|
+
* Clears the deployment config saved here: the stored fields and every stored secret value of
|
|
86
|
+
* the extension; audits `extension.config_cleared`. Fields from the startup config (file / Nacos
|
|
87
|
+
* / env) cannot be removed here: they stay in effect and the returned view still shows them
|
|
88
|
+
* (`readonly`, with their `source`). Every replica re-reads, the same way as after a PUT: the
|
|
89
|
+
* extension loads from what remains, or becomes pending configuration when that is missing or
|
|
90
|
+
* invalid (no restart). Nothing stored -> no change (no audit). Unknown -> 404
|
|
91
|
+
* `extension.not_found`.
|
|
92
|
+
*/
|
|
93
|
+
clearConfig(principal: Principal, name: string): Promise<DeploymentConfigView>;
|
|
84
94
|
/**
|
|
85
95
|
* Web approval: writes the snapshot (source web), audits `extension.permissions_approved` and
|
|
86
96
|
* publishes `kernel.plugins.changed`. Package or
|
|
@@ -138,6 +138,19 @@ let AdminExtensionsController = class AdminExtensionsController {
|
|
|
138
138
|
const actor = requireUser(principal);
|
|
139
139
|
return this.deploymentConfigs.put(name, body.values, actor.account.id, patTokenId(actor), body.secretEntries);
|
|
140
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Clears the deployment config saved here: the stored fields and every stored secret value of
|
|
143
|
+
* the extension; audits `extension.config_cleared`. Fields from the startup config (file / Nacos
|
|
144
|
+
* / env) cannot be removed here: they stay in effect and the returned view still shows them
|
|
145
|
+
* (`readonly`, with their `source`). Every replica re-reads, the same way as after a PUT: the
|
|
146
|
+
* extension loads from what remains, or becomes pending configuration when that is missing or
|
|
147
|
+
* invalid (no restart). Nothing stored -> no change (no audit). Unknown -> 404
|
|
148
|
+
* `extension.not_found`.
|
|
149
|
+
*/
|
|
150
|
+
clearConfig(principal, name) {
|
|
151
|
+
const actor = requireUser(principal);
|
|
152
|
+
return this.deploymentConfigs.clear(name, actor.account.id, patTokenId(actor));
|
|
153
|
+
}
|
|
141
154
|
/**
|
|
142
155
|
* Web approval: writes the snapshot (source web), audits `extension.permissions_approved` and
|
|
143
156
|
* publishes `kernel.plugins.changed`. Package or
|
|
@@ -222,6 +235,11 @@ __decorate([
|
|
|
222
235
|
__param(1, Param("name")),
|
|
223
236
|
__param(2, ZBody(ExtensionConfigBody))
|
|
224
237
|
], AdminExtensionsController.prototype, "putConfig", null);
|
|
238
|
+
__decorate([
|
|
239
|
+
Delete(":name/config"),
|
|
240
|
+
__param(0, CurrentPrincipal()),
|
|
241
|
+
__param(1, Param("name"))
|
|
242
|
+
], AdminExtensionsController.prototype, "clearConfig", null);
|
|
225
243
|
__decorate([
|
|
226
244
|
Post(":name/approve"),
|
|
227
245
|
HttpCode(200),
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { RouteSchemas } from "../platform/route-schemas.js";
|
|
3
|
+
/** `:name` as the lifecycle and detail routes take it (`@Param`). */
|
|
4
|
+
export declare const AdminExtensionNamePathParams: z.ZodObject<{
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export declare const ADMIN_EXTENSION_ROUTES: readonly RouteSchemas[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** `:name` as the lifecycle and detail routes take it (`@Param`). */
|
|
3
|
+
export const AdminExtensionNamePathParams = z.object({ name: z.string().min(1) });
|
|
4
|
+
export const ADMIN_EXTENSION_ROUTES = [
|
|
5
|
+
{ route: "GET /api/v1/admin/extensions" },
|
|
6
|
+
{ route: "GET /api/v1/admin/extensions/:name", params: AdminExtensionNamePathParams },
|
|
7
|
+
{ route: "POST /api/v1/admin/extensions/:name/enable", params: AdminExtensionNamePathParams },
|
|
8
|
+
{ route: "POST /api/v1/admin/extensions/:name/disable", params: AdminExtensionNamePathParams },
|
|
9
|
+
{ route: "DELETE /api/v1/admin/extensions/:name", params: AdminExtensionNamePathParams },
|
|
10
|
+
];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
2
|
+
import type { SubagentLimits } from "../runtime/subagents/limits.js";
|
|
3
|
+
/**
|
|
4
|
+
* The deployment's defaults of the per-org limits (with `GET /api/v1/admin/orgs`): what an
|
|
5
|
+
* organization without an override gets, from the live config. `subagents.maxDispatchesPerRun` and
|
|
6
|
+
* `maxTokensPerRun` of 0 mean no limit.
|
|
7
|
+
*/
|
|
8
|
+
export interface LimitDefaults {
|
|
9
|
+
/** `runtime.orgConcurrency`. */
|
|
10
|
+
runConcurrency: number;
|
|
11
|
+
/** `sandbox.limits.cpu` / `memoryMb`. */
|
|
12
|
+
sandbox: {
|
|
13
|
+
cpu: number;
|
|
14
|
+
memoryMb: number;
|
|
15
|
+
};
|
|
16
|
+
/** `subagents.*`. */
|
|
17
|
+
subagents: SubagentLimits;
|
|
18
|
+
}
|
|
19
|
+
/** {@link LimitDefaults} from the live config. */
|
|
20
|
+
export declare function limitDefaults(config: KernelConfigService): LimitDefaults;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** {@link LimitDefaults} from the live config. */
|
|
2
|
+
export function limitDefaults(config) {
|
|
3
|
+
const cfg = config.get();
|
|
4
|
+
const { maxDepth, maxConcurrentPerConversation, maxDispatchesPerRun, maxTokensPerRun } = cfg.subagents;
|
|
5
|
+
return {
|
|
6
|
+
runConcurrency: cfg.runtime.orgConcurrency,
|
|
7
|
+
sandbox: { cpu: cfg.sandbox.limits.cpu, memoryMb: cfg.sandbox.limits.memoryMb },
|
|
8
|
+
subagents: { maxDepth, maxConcurrentPerConversation, maxDispatchesPerRun, maxTokensPerRun },
|
|
9
|
+
};
|
|
10
|
+
}
|