@capybara-hq/kernel 0.1.0-rc.6 → 0.1.0-rc.8
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 +8 -72
- package/dist/admin/admin.controller.js +21 -46
- 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 +13 -5
- package/dist/agents/agents.service.js +67 -13
- 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 +20 -3
- package/dist/agents/models.controller.d.ts +1 -2
- package/dist/agents/models.controller.js +1 -1
- 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/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/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 +9 -1
- package/dist/conversations/conversations.service.js +23 -18
- 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/db/kernel-schema.d.ts +20 -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 +3 -0
- package/dist/errors.js +3 -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 +13 -0
- package/dist/evals/runs.controller.d.ts +2 -57
- package/dist/evals/runs.controller.js +1 -42
- package/dist/evals/runs.service.d.ts +6 -6
- package/dist/evals/runs.service.js +32 -18
- 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/extensions/admin-ops.d.ts +5 -3
- package/dist/extensions/admin-ops.js +17 -12
- package/dist/extensions/deployment-config.d.ts +16 -1
- package/dist/extensions/deployment-config.js +83 -0
- package/dist/extensions/extensions.module.js +3 -0
- package/dist/extensions/host.d.ts +33 -2
- package/dist/extensions/host.js +107 -1
- 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/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 +2 -0
- 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 +12 -0
- package/dist/identity/me.controller.js +31 -1
- package/dist/identity/me.schemas.d.ts +14 -0
- package/dist/identity/me.schemas.js +17 -0
- 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/lifecycle/kernel-lifecycle.js +4 -0
- package/dist/models/enablement.d.ts +2 -0
- package/dist/models/enablement.js +1 -0
- package/dist/models/org-models.schemas.d.ts +8 -0
- package/dist/models/org-models.schemas.js +22 -0
- package/dist/models/prices.d.ts +3 -1
- package/dist/models/prices.js +7 -5
- package/dist/models/purposes.d.ts +12 -2
- package/dist/models/purposes.js +22 -8
- 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 +58 -849
- package/dist/platform/method.js +1 -1
- package/dist/platform/operation.d.ts +82 -5
- package/dist/platform/operation.js +63 -8
- 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 +11 -6
- package/dist/platform/ops/platform.ops.js +73 -27
- 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 +63 -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/model-call.js +2 -1
- package/dist/runtime/providers.js +8 -1
- 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 +5 -0
- package/dist/runtime/run-worker.js +31 -6
- package/dist/runtime/runtime.module.js +2 -0
- package/dist/runtime/subagents/definition.d.ts +15 -15
- package/dist/runtime/subagents/definition.js +46 -115
- 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 +3 -1
- package/dist/tools/registry.d.ts +48 -51
- package/dist/tools/registry.js +222 -233
- package/package.json +3 -3
- 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";
|
|
@@ -14,7 +14,8 @@ import { type ModelPrice, type ModelPricePut, PricesService } from "../models/pr
|
|
|
14
14
|
import { ModelPurposesService, type PurposeListing, type PurposePut } from "../models/purposes.js";
|
|
15
15
|
import { type Org, OrgsService } from "../orgs/orgs.service.js";
|
|
16
16
|
import { ProviderRegistry, type ProviderStatus } from "../runtime/providers.js";
|
|
17
|
-
import
|
|
17
|
+
import { AccountListQuery, AccountParams, CreateAccountBody, DeploymentSettingsBody, PurposeParams, UpdateAccountBody } from "./admin.schemas.js";
|
|
18
|
+
import { type LimitDefaults } from "./limit-defaults.js";
|
|
18
19
|
/** 后台概览(`GET /api/v1/admin/overview`)的计数。 */
|
|
19
20
|
export interface AdminOverview {
|
|
20
21
|
/**
|
|
@@ -27,69 +28,6 @@ export interface AdminOverview {
|
|
|
27
28
|
orgs: number;
|
|
28
29
|
accounts: number;
|
|
29
30
|
}
|
|
30
|
-
/**
|
|
31
|
-
* The deployment's defaults of the per-org limits (with `GET /api/v1/admin/orgs`): what an
|
|
32
|
-
* organization without an override gets, from the live config. `subagents.maxDispatchesPerRun` and
|
|
33
|
-
* `maxTokensPerRun` of 0 mean no limit.
|
|
34
|
-
*/
|
|
35
|
-
export interface LimitDefaults {
|
|
36
|
-
/** `runtime.orgConcurrency`. */
|
|
37
|
-
runConcurrency: number;
|
|
38
|
-
/** `sandbox.limits.cpu` / `memoryMb`. */
|
|
39
|
-
sandbox: {
|
|
40
|
-
cpu: number;
|
|
41
|
-
memoryMb: number;
|
|
42
|
-
};
|
|
43
|
-
/** `subagents.*`. */
|
|
44
|
-
subagents: SubagentLimits;
|
|
45
|
-
}
|
|
46
|
-
declare const ListQuerySchema: z.ZodObject<{
|
|
47
|
-
after: z.ZodOptional<z.ZodString>;
|
|
48
|
-
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
49
|
-
}, z.core.$strip>;
|
|
50
|
-
declare const CreateAccountSchema: z.ZodObject<{
|
|
51
|
-
login: z.ZodString;
|
|
52
|
-
password: z.ZodString;
|
|
53
|
-
displayName: z.ZodString;
|
|
54
|
-
email: z.ZodOptional<z.ZodEmail>;
|
|
55
|
-
superAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
56
|
-
}, z.core.$strip>;
|
|
57
|
-
declare const UpdateAccountSchema: z.ZodObject<{
|
|
58
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
59
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
60
|
-
active: "active";
|
|
61
|
-
disabled: "disabled";
|
|
62
|
-
}>>;
|
|
63
|
-
isSuperAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
-
}, z.core.$strip>;
|
|
65
|
-
/** 至少给出一个键;`runConcurrencyOverrides` 按组织合并,值为 null 删除该组织的覆盖。 */
|
|
66
|
-
declare const SettingsSchema: z.ZodObject<{
|
|
67
|
-
orgCreation: z.ZodOptional<z.ZodEnum<{
|
|
68
|
-
anyone: "anyone";
|
|
69
|
-
super_admin: "super_admin";
|
|
70
|
-
}>>;
|
|
71
|
-
runConcurrencyOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodNumber>>>;
|
|
72
|
-
priceCurrency: z.ZodOptional<z.ZodString>;
|
|
73
|
-
sandboxLimitOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
|
|
74
|
-
cpu: z.ZodOptional<z.ZodNumber>;
|
|
75
|
-
memoryMb: z.ZodOptional<z.ZodNumber>;
|
|
76
|
-
}, z.core.$strict>>>>;
|
|
77
|
-
subagentLimitOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
|
|
78
|
-
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
79
|
-
maxConcurrentPerConversation: z.ZodOptional<z.ZodNumber>;
|
|
80
|
-
maxDispatchesPerRun: z.ZodOptional<z.ZodNumber>;
|
|
81
|
-
maxTokensPerRun: z.ZodOptional<z.ZodNumber>;
|
|
82
|
-
}, z.core.$strict>>>>;
|
|
83
|
-
customConnectors: z.ZodOptional<z.ZodEnum<{
|
|
84
|
-
allow: "allow";
|
|
85
|
-
deny: "deny";
|
|
86
|
-
}>>;
|
|
87
|
-
customSkills: z.ZodOptional<z.ZodEnum<{
|
|
88
|
-
allow: "allow";
|
|
89
|
-
deny: "deny";
|
|
90
|
-
}>>;
|
|
91
|
-
orgMarketplaceBrowse: z.ZodOptional<z.ZodBoolean>;
|
|
92
|
-
}, z.core.$strict>;
|
|
93
31
|
/**
|
|
94
32
|
* 超级管理员端点(`/api/v1/admin/*`):只接受超级管理员的 Web 会话或个人令牌;
|
|
95
33
|
* 服务令牌一律 `forbidden`(未标 `@AllowService`)。
|
|
@@ -115,15 +53,15 @@ export declare class AdminController {
|
|
|
115
53
|
* 全部账号,按 id 升序分页:`next` 为下一页的游标(作为 `after` 传回),没有更多时为 null。
|
|
116
54
|
* 多取一条判断是否还有下一页。
|
|
117
55
|
*/
|
|
118
|
-
listAccounts(q: z.infer<typeof
|
|
56
|
+
listAccounts(q: z.infer<typeof AccountListQuery>): Promise<{
|
|
119
57
|
accounts: Account[];
|
|
120
58
|
next: string | null;
|
|
121
59
|
}>;
|
|
122
|
-
createAccount(principal: Principal, body: z.infer<typeof
|
|
60
|
+
createAccount(principal: Principal, body: z.infer<typeof CreateAccountBody>): Promise<{
|
|
123
61
|
account: Account;
|
|
124
62
|
}>;
|
|
125
63
|
/** 改显示名 / 状态 / 超级管理员;停用时同时吊销该账号的全部会话与个人令牌。 */
|
|
126
|
-
updateAccount(principal: Principal, accountId:
|
|
64
|
+
updateAccount(principal: Principal, { accountId }: z.infer<typeof AccountParams>, body: z.infer<typeof UpdateAccountBody>): Promise<{
|
|
127
65
|
account: Account;
|
|
128
66
|
}>;
|
|
129
67
|
/**
|
|
@@ -137,8 +75,7 @@ export declare class AdminController {
|
|
|
137
75
|
limitDefaults: LimitDefaults;
|
|
138
76
|
}>;
|
|
139
77
|
getSettings(): Promise<DeploymentSettings>;
|
|
140
|
-
|
|
141
|
-
putSettings(principal: Principal, body: z.infer<typeof SettingsSchema>): Promise<DeploymentSettings>;
|
|
78
|
+
putSettings(principal: Principal, body: z.infer<typeof DeploymentSettingsBody>): Promise<DeploymentSettings>;
|
|
142
79
|
/**
|
|
143
80
|
* 模型供应商与模型(后台「模型」页):每个供应商带状态,列模型失败的标 `error`,不影响其他供应商;
|
|
144
81
|
* 一并返回价格表与币种(改价仍走 `PUT /admin/model-prices`)。Each provider carries its extension's
|
|
@@ -174,8 +111,7 @@ export declare class AdminController {
|
|
|
174
111
|
purposes: PurposeListing[];
|
|
175
112
|
}>;
|
|
176
113
|
/** 设置一个用途的部署默认,或 `target: null` 清除。 */
|
|
177
|
-
putModelPurpose(principal: Principal, purpose:
|
|
114
|
+
putModelPurpose(principal: Principal, { purpose }: z.infer<typeof PurposeParams>, body: PurposePut): Promise<{
|
|
178
115
|
purpose: PurposeListing;
|
|
179
116
|
}>;
|
|
180
117
|
}
|
|
181
|
-
export {};
|
|
@@ -7,17 +7,15 @@ 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";
|
|
@@ -29,33 +27,19 @@ import { purposeTargetOf } from "../models/purposes.controller.js";
|
|
|
29
27
|
import { ModelPurposesService, PurposePutDto, withDeclaredByNames, } from "../models/purposes.js";
|
|
30
28
|
import { OrgsService } from "../orgs/orgs.service.js";
|
|
31
29
|
import { ProviderRegistry } from "../runtime/providers.js";
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
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") {
|
|
37
33
|
}
|
|
38
|
-
|
|
39
|
-
login: z.string().min(1).max(64),
|
|
40
|
-
password: z.string().min(1).max(MAX_PASSWORD_LENGTH),
|
|
41
|
-
displayName: z.string().trim().min(1).max(100),
|
|
42
|
-
email: z.email().max(254).optional(),
|
|
43
|
-
superAdmin: z.boolean().optional(),
|
|
44
|
-
});
|
|
45
|
-
class CreateAccountBody extends createZodDto(CreateAccountSchema, "CreateAccountBody") {
|
|
34
|
+
class CreateAccountBodyDto extends createZodDto(CreateAccountBody, "CreateAccountBody") {
|
|
46
35
|
}
|
|
47
|
-
|
|
48
|
-
displayName: z.string().trim().min(1).max(100).optional(),
|
|
49
|
-
status: z.enum(["active", "disabled"]).optional(),
|
|
50
|
-
isSuperAdmin: z.boolean().optional(),
|
|
51
|
-
});
|
|
52
|
-
class UpdateAccountBody extends createZodDto(UpdateAccountSchema, "UpdateAccountBody") {
|
|
36
|
+
class UpdateAccountBodyDto extends createZodDto(UpdateAccountBody, "UpdateAccountBody") {
|
|
53
37
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
class
|
|
38
|
+
class AccountParamsDto extends createZodDto(AccountParams, "AccountParams") {
|
|
39
|
+
}
|
|
40
|
+
class PurposeParamsDto extends createZodDto(PurposeParams, "PurposeParams") {
|
|
41
|
+
}
|
|
42
|
+
class DeploymentSettingsBodyDto extends createZodDto(DeploymentSettingsBody, "DeploymentSettingsPatch") {
|
|
59
43
|
}
|
|
60
44
|
// a union schema: a DTO value rather than a class (a class cannot extend a union instance type)
|
|
61
45
|
const ModelPriceBody = createZodDto(MODEL_PRICE_PUT, "ModelPricePut");
|
|
@@ -132,7 +116,7 @@ let AdminController = class AdminController {
|
|
|
132
116
|
return { account };
|
|
133
117
|
}
|
|
134
118
|
/** 改显示名 / 状态 / 超级管理员;停用时同时吊销该账号的全部会话与个人令牌。 */
|
|
135
|
-
async updateAccount(principal, accountId, body) {
|
|
119
|
+
async updateAccount(principal, { accountId }, body) {
|
|
136
120
|
const actor = requireUser(principal);
|
|
137
121
|
const patch = {
|
|
138
122
|
...(body.displayName !== undefined && { displayName: body.displayName }),
|
|
@@ -158,20 +142,11 @@ let AdminController = class AdminController {
|
|
|
158
142
|
* can be given its own value of (the org limits dialog shows them for the values left empty).
|
|
159
143
|
*/
|
|
160
144
|
async listOrgs() {
|
|
161
|
-
return { orgs: await this.orgs.listAll(), limitDefaults: this.
|
|
145
|
+
return { orgs: await this.orgs.listAll(), limitDefaults: limitDefaults(this.config) };
|
|
162
146
|
}
|
|
163
147
|
async getSettings() {
|
|
164
148
|
return this.settings.get();
|
|
165
149
|
}
|
|
166
|
-
limitDefaults() {
|
|
167
|
-
const cfg = this.config.get();
|
|
168
|
-
const { maxDepth, maxConcurrentPerConversation, maxDispatchesPerRun, maxTokensPerRun } = cfg.subagents;
|
|
169
|
-
return {
|
|
170
|
-
runConcurrency: cfg.runtime.orgConcurrency,
|
|
171
|
-
sandbox: { cpu: cfg.sandbox.limits.cpu, memoryMb: cfg.sandbox.limits.memoryMb },
|
|
172
|
-
subagents: { maxDepth, maxConcurrentPerConversation, maxDispatchesPerRun, maxTokensPerRun },
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
150
|
async putSettings(principal, body) {
|
|
176
151
|
const actor = requireUser(principal);
|
|
177
152
|
return this.settings.update(body, actor.account.id, patTokenId(actor));
|
|
@@ -222,7 +197,7 @@ let AdminController = class AdminController {
|
|
|
222
197
|
return { purposes: await withDeclaredByNames(await this.purposes.list(), this.displayNames) };
|
|
223
198
|
}
|
|
224
199
|
/** 设置一个用途的部署默认,或 `target: null` 清除。 */
|
|
225
|
-
async putModelPurpose(principal, purpose, body) {
|
|
200
|
+
async putModelPurpose(principal, { purpose }, body) {
|
|
226
201
|
const actor = requireUser(principal);
|
|
227
202
|
const view = await this.purposes.setDefault(purpose, purposeTargetOf(body), actor.account.id, patTokenId(actor));
|
|
228
203
|
const [listing] = await withDeclaredByNames([view], this.displayNames);
|
|
@@ -234,19 +209,19 @@ __decorate([
|
|
|
234
209
|
], AdminController.prototype, "overview", null);
|
|
235
210
|
__decorate([
|
|
236
211
|
Get("accounts"),
|
|
237
|
-
__param(0, ZQuery(
|
|
212
|
+
__param(0, ZQuery(AccountListQueryDto))
|
|
238
213
|
], AdminController.prototype, "listAccounts", null);
|
|
239
214
|
__decorate([
|
|
240
215
|
Post("accounts"),
|
|
241
216
|
HttpCode(201),
|
|
242
217
|
__param(0, CurrentPrincipal()),
|
|
243
|
-
__param(1, ZBody(
|
|
218
|
+
__param(1, ZBody(CreateAccountBodyDto))
|
|
244
219
|
], AdminController.prototype, "createAccount", null);
|
|
245
220
|
__decorate([
|
|
246
221
|
Patch("accounts/:accountId"),
|
|
247
222
|
__param(0, CurrentPrincipal()),
|
|
248
|
-
__param(1,
|
|
249
|
-
__param(2, ZBody(
|
|
223
|
+
__param(1, ZParam(AccountParamsDto)),
|
|
224
|
+
__param(2, ZBody(UpdateAccountBodyDto))
|
|
250
225
|
], AdminController.prototype, "updateAccount", null);
|
|
251
226
|
__decorate([
|
|
252
227
|
Get("orgs")
|
|
@@ -257,7 +232,7 @@ __decorate([
|
|
|
257
232
|
__decorate([
|
|
258
233
|
Put("settings"),
|
|
259
234
|
__param(0, CurrentPrincipal()),
|
|
260
|
-
__param(1, ZBody(
|
|
235
|
+
__param(1, ZBody(DeploymentSettingsBodyDto))
|
|
261
236
|
], AdminController.prototype, "putSettings", null);
|
|
262
237
|
__decorate([
|
|
263
238
|
Get("models")
|
|
@@ -282,7 +257,7 @@ __decorate([
|
|
|
282
257
|
__decorate([
|
|
283
258
|
Put("model-purposes/:purpose"),
|
|
284
259
|
__param(0, CurrentPrincipal()),
|
|
285
|
-
__param(1,
|
|
260
|
+
__param(1, ZParam(PurposeParamsDto)),
|
|
286
261
|
__param(2, ZBody(PurposePutDto))
|
|
287
262
|
], AdminController.prototype, "putModelPurpose", null);
|
|
288
263
|
AdminController = __decorate([
|
|
@@ -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
|
+
}
|
|
@@ -3,10 +3,11 @@ import { KernelDb } from "../infra/database/kernel-db.js";
|
|
|
3
3
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
4
4
|
import { AgentLookup } from "./agent-lookup.js";
|
|
5
5
|
import { AgentsService } from "./agents.service.js";
|
|
6
|
-
import type { AgentProfile,
|
|
6
|
+
import type { AgentProfile, ProfilePatch } from "./profile.js";
|
|
7
7
|
/**
|
|
8
|
-
* Writes an agent's profile (avatar,
|
|
9
|
-
*
|
|
8
|
+
* Writes an agent's profile (avatar, quick actions): display data stored beside the agent, never
|
|
9
|
+
* model-visible, so a change creates no agent version. The description is part of the definition
|
|
10
|
+
* (run context spec §3.5). The permission is the one of
|
|
10
11
|
* `AgentsService.update` (owner or org admin, checked under the org row lock).
|
|
11
12
|
*/
|
|
12
13
|
export declare class AgentProfileService {
|
|
@@ -19,11 +20,12 @@ export declare class AgentProfileService {
|
|
|
19
20
|
/**
|
|
20
21
|
* Applies `patch` (only the given fields) when `expectedUpdatedAt` is still the profile's
|
|
21
22
|
* `updatedAt`, else 409 `agent.profile_conflict` (never a silent overwrite). Audit
|
|
22
|
-
* `agent.profile_updated` `{ fields, channel }`: `api` for a personal access
|
|
23
|
+
* `agent.profile_updated` `{ fields, channel, ...auditDetail }`: `api` for a personal access
|
|
24
|
+
* token, `agent` for a write through the `Platform` tool (`auditDetail` given), else `web`.
|
|
23
25
|
* An `upload` avatar must be the actor's own upload that no other agent uses (else 404
|
|
24
26
|
* `attachment.not_found`): it is finalized first (outside the transaction, it reads the object
|
|
25
27
|
* store; 503 `storage.unavailable` without one) and bound to the agent inside it.
|
|
26
28
|
*/
|
|
27
|
-
update(orgId: string, agentId: string, actorAccountId: string, patch:
|
|
29
|
+
update(orgId: string, agentId: string, actorAccountId: string, patch: ProfilePatch, expectedUpdatedAt: string, actorTokenId?: string, auditDetail?: Record<string, unknown>): Promise<AgentProfile>;
|
|
28
30
|
private updateIn;
|
|
29
31
|
}
|
|
@@ -18,8 +18,9 @@ import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
|
18
18
|
import { AgentLookup } from "./agent-lookup.js";
|
|
19
19
|
import { AgentsService } from "./agents.service.js";
|
|
20
20
|
/**
|
|
21
|
-
* Writes an agent's profile (avatar,
|
|
22
|
-
*
|
|
21
|
+
* Writes an agent's profile (avatar, quick actions): display data stored beside the agent, never
|
|
22
|
+
* model-visible, so a change creates no agent version. The description is part of the definition
|
|
23
|
+
* (run context spec §3.5). The permission is the one of
|
|
23
24
|
* `AgentsService.update` (owner or org admin, checked under the org row lock).
|
|
24
25
|
*/
|
|
25
26
|
let AgentProfileService = class AgentProfileService {
|
|
@@ -38,18 +39,19 @@ let AgentProfileService = class AgentProfileService {
|
|
|
38
39
|
/**
|
|
39
40
|
* Applies `patch` (only the given fields) when `expectedUpdatedAt` is still the profile's
|
|
40
41
|
* `updatedAt`, else 409 `agent.profile_conflict` (never a silent overwrite). Audit
|
|
41
|
-
* `agent.profile_updated` `{ fields, channel }`: `api` for a personal access
|
|
42
|
+
* `agent.profile_updated` `{ fields, channel, ...auditDetail }`: `api` for a personal access
|
|
43
|
+
* token, `agent` for a write through the `Platform` tool (`auditDetail` given), else `web`.
|
|
42
44
|
* An `upload` avatar must be the actor's own upload that no other agent uses (else 404
|
|
43
45
|
* `attachment.not_found`): it is finalized first (outside the transaction, it reads the object
|
|
44
46
|
* store; 503 `storage.unavailable` without one) and bound to the agent inside it.
|
|
45
47
|
*/
|
|
46
|
-
async update(orgId, agentId, actorAccountId, patch, expectedUpdatedAt, actorTokenId) {
|
|
48
|
+
async update(orgId, agentId, actorAccountId, patch, expectedUpdatedAt, actorTokenId, auditDetail) {
|
|
47
49
|
if (patch.avatar?.kind === "upload") {
|
|
48
50
|
await this.attachments.prepareAgentAvatar(orgId, actorAccountId, patch.avatar.uploadId, agentId);
|
|
49
51
|
}
|
|
50
|
-
return this.updateIn(orgId, agentId, actorAccountId, patch, expectedUpdatedAt, actorTokenId);
|
|
52
|
+
return this.updateIn(orgId, agentId, actorAccountId, patch, expectedUpdatedAt, actorTokenId, auditDetail);
|
|
51
53
|
}
|
|
52
|
-
async updateIn(orgId, agentId, actorAccountId, patch, expectedUpdatedAt, actorTokenId) {
|
|
54
|
+
async updateIn(orgId, agentId, actorAccountId, patch, expectedUpdatedAt, actorTokenId, auditDetail) {
|
|
53
55
|
const t = this.db.db;
|
|
54
56
|
await this.agents.lockForWrite(orgId, agentId, actorAccountId);
|
|
55
57
|
const current = await t
|
|
@@ -63,7 +65,7 @@ let AgentProfileService = class AgentProfileService {
|
|
|
63
65
|
if (patch.avatar?.kind === "upload") {
|
|
64
66
|
await this.attachments.consumeAgentAvatar(orgId, actorAccountId, patch.avatar.uploadId, agentId);
|
|
65
67
|
}
|
|
66
|
-
const fields = ["avatar", "
|
|
68
|
+
const fields = ["avatar", "quickActions"].filter((f) => patch[f] !== undefined);
|
|
67
69
|
// nothing to write: no timestamp bump, no audit row
|
|
68
70
|
if (fields.length === 0)
|
|
69
71
|
return (await this.lookup.view(agentId)).profile;
|
|
@@ -73,7 +75,6 @@ let AgentProfileService = class AgentProfileService {
|
|
|
73
75
|
...(patch.avatar !== undefined && {
|
|
74
76
|
profile_avatar: patch.avatar === null ? sql `null` : JSON.stringify(patch.avatar),
|
|
75
77
|
}),
|
|
76
|
-
...(patch.description !== undefined && { profile_description: patch.description }),
|
|
77
78
|
...(patch.quickActions !== undefined && {
|
|
78
79
|
profile_quick_actions: JSON.stringify(patch.quickActions),
|
|
79
80
|
}),
|
|
@@ -98,7 +99,11 @@ let AgentProfileService = class AgentProfileService {
|
|
|
98
99
|
orgId,
|
|
99
100
|
action: "agent.profile_updated",
|
|
100
101
|
target: agentId,
|
|
101
|
-
detail: {
|
|
102
|
+
detail: {
|
|
103
|
+
fields,
|
|
104
|
+
channel: actorTokenId !== undefined ? "api" : auditDetail !== undefined ? "agent" : "web",
|
|
105
|
+
...auditDetail,
|
|
106
|
+
},
|
|
102
107
|
});
|
|
103
108
|
return (await this.lookup.view(agentId)).profile;
|
|
104
109
|
}
|