@capybara-hq/kernel 0.1.0-rc.19 → 0.1.0-rc.20
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 +25 -25
- package/dist/admin/admin-agents.controller.d.ts +28 -0
- package/dist/admin/admin-agents.controller.js +79 -0
- package/dist/admin/admin-connectors.controller.d.ts +29 -0
- package/dist/admin/admin-connectors.controller.js +79 -0
- package/dist/admin/admin-items.schemas.d.ts +42 -0
- package/dist/admin/admin-items.schemas.js +48 -0
- package/dist/admin/admin.controller.d.ts +11 -20
- package/dist/admin/admin.controller.js +28 -34
- package/dist/admin/admin.module.d.ts +4 -1
- package/dist/admin/admin.module.js +50 -4
- package/dist/admin/admin.schemas.d.ts +4 -0
- package/dist/admin/admin.schemas.js +4 -1
- package/dist/admin/audit.controller.d.ts +14 -0
- package/dist/admin/audit.controller.js +42 -0
- package/dist/admin/audit.schemas.d.ts +8 -0
- package/dist/admin/audit.schemas.js +17 -0
- package/dist/admin/health.service.d.ts +104 -0
- package/dist/admin/health.service.js +246 -0
- package/dist/admin/overview.controller.d.ts +31 -0
- package/dist/admin/overview.controller.js +78 -0
- package/dist/admin/overview.schemas.d.ts +8 -0
- package/dist/admin/overview.schemas.js +13 -0
- package/dist/admin/overview.service.d.ts +112 -0
- package/dist/admin/overview.service.js +223 -0
- package/dist/admin/platform-audit.service.d.ts +41 -0
- package/dist/admin/platform-audit.service.js +70 -0
- package/dist/admin/usage.service.d.ts +149 -0
- package/dist/admin/usage.service.js +321 -0
- package/dist/agents/admin-agents.d.ts +92 -0
- package/dist/agents/admin-agents.js +170 -0
- package/dist/agents/agents.module.d.ts +4 -3
- package/dist/agents/agents.module.js +7 -3
- package/dist/agents/agents.service.d.ts +41 -3
- package/dist/agents/agents.service.js +113 -27
- package/dist/agents/definition.d.ts +16 -0
- package/dist/agents/definition.js +32 -2
- package/dist/agents/org-templates.js +4 -0
- package/dist/background/launch.d.ts +1 -1
- package/dist/background/launch.js +3 -3
- package/dist/background/tasks.service.d.ts +35 -3
- package/dist/background/tasks.service.js +91 -36
- package/dist/catalog/catalog.module.js +8 -2
- package/dist/channels/channels.module.js +11 -2
- package/dist/channels/supervisor.d.ts +2 -0
- package/dist/channels/supervisor.js +4 -0
- package/dist/conversations/events.js +1 -1
- package/dist/conversations/titles.js +4 -8
- package/dist/db/kernel-schema.d.ts +8 -1
- package/dist/devices/devices.module.js +5 -2
- package/dist/errors.d.ts +22 -2
- package/dist/errors.js +22 -2
- package/dist/evals/evals.module.js +11 -2
- package/dist/extensions/permission-view.js +3 -3
- package/dist/http/api.module.js +10 -1
- package/dist/identity/settings.js +3 -2
- package/dist/identity/write-actor.d.ts +11 -0
- package/dist/identity/write-actor.js +7 -0
- package/dist/inbox/inbox.service.d.ts +2 -1
- package/dist/inbox/platform-inbox.service.d.ts +7 -1
- package/dist/inbox/platform-inbox.service.js +20 -2
- package/dist/infra/presence/presence.module.d.ts +6 -0
- package/dist/infra/presence/presence.module.js +22 -0
- package/dist/infra/presence/replica-presence.d.ts +87 -0
- package/dist/infra/presence/replica-presence.js +189 -0
- package/dist/kernel.module.js +3 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +3 -1
- package/dist/lifecycle/kernel-lifecycle.js +17 -3
- package/dist/local-devices/local-device-gateway.d.ts +6 -0
- package/dist/local-devices/local-device-gateway.js +12 -0
- package/dist/overrides.d.ts +7 -1
- package/dist/overrides.js +4 -0
- package/dist/platform/exclusions.js +15 -0
- package/dist/platform/operation.d.ts +1 -1
- package/dist/platform/operation.js +1 -1
- package/dist/platform/ops/admin-items.ops.d.ts +37 -0
- package/dist/platform/ops/admin-items.ops.js +278 -0
- package/dist/platform/ops/admin.ops.d.ts +10 -10
- package/dist/platform/ops/admin.ops.js +111 -42
- package/dist/platform/ops/agent-skills.ops.d.ts +29 -3
- package/dist/platform/ops/agent-skills.ops.js +290 -7
- package/dist/platform/ops/inbox.ops.js +7 -4
- package/dist/platform/ops/platform.ops.js +1 -1
- package/dist/platform/ops/skills.ops.js +1 -57
- package/dist/platform/platform-ops.module.d.ts +2 -1
- package/dist/platform/platform-ops.module.js +5 -0
- package/dist/platform/route-schemas.js +8 -0
- package/dist/roles/gateway-role.d.ts +4 -0
- package/dist/roles/gateway-role.js +8 -0
- package/dist/runtime/run-jobs.js +4 -2
- package/dist/sandbox/sandbox-file-reader.d.ts +35 -0
- package/dist/sandbox/sandbox-file-reader.js +98 -0
- package/dist/skills/agent-skills.controller.d.ts +48 -0
- package/dist/skills/agent-skills.controller.js +131 -0
- package/dist/skills/agent-skills.service.d.ts +262 -0
- package/dist/skills/agent-skills.service.js +996 -0
- package/dist/skills/catalog.d.ts +8 -6
- package/dist/skills/catalog.js +8 -4
- package/dist/skills/changes.controller.d.ts +5 -22
- package/dist/skills/changes.controller.js +7 -55
- package/dist/skills/changes.service.d.ts +69 -115
- package/dist/skills/changes.service.js +249 -599
- package/dist/skills/conversation-catalog.d.ts +53 -0
- package/dist/skills/conversation-catalog.js +149 -0
- package/dist/skills/invocation-keys.d.ts +1 -1
- package/dist/skills/invocation-keys.js +1 -1
- package/dist/skills/package.d.ts +0 -5
- package/dist/skills/package.js +0 -14
- package/dist/skills/skills.controller.js +1 -10
- package/dist/skills/skills.module.js +15 -2
- package/dist/skills/skills.schemas.d.ts +11 -15
- package/dist/skills/skills.schemas.js +27 -20
- package/dist/skills/skills.service.d.ts +37 -30
- package/dist/skills/skills.service.js +107 -59
- package/dist/skills/usable.d.ts +4 -3
- package/dist/skills/usable.js +13 -4
- package/dist/tools/admin-connectors.d.ts +69 -0
- package/dist/tools/admin-connectors.js +135 -0
- package/dist/tools/builtin-names.d.ts +9 -14
- package/dist/tools/builtin-names.js +13 -22
- package/dist/tools/builtins/builtin-tools.d.ts +2 -3
- package/dist/tools/builtins/builtin-tools.js +21 -26
- package/dist/tools/builtins/sandbox/bash.js +2 -2
- package/dist/tools/builtins/skill-load.js +1 -0
- package/dist/tools/connectors.controller.d.ts +5 -1
- package/dist/tools/connectors.controller.js +17 -3
- package/dist/tools/connectors.service.d.ts +20 -1
- package/dist/tools/connectors.service.js +61 -0
- package/dist/tools/legacy-keys.js +0 -1
- package/dist/tools/org-tool-switches.d.ts +3 -2
- package/dist/tools/org-tool-switches.js +4 -4
- package/dist/tools/policy.d.ts +7 -9
- package/dist/tools/policy.js +11 -22
- package/dist/tools/tools.module.js +3 -0
- package/package.json +1 -1
- package/src/migrations/0109_audit_platform_idx.sql +5 -0
- package/src/migrations/0110_usage_time_idx.sql +8 -0
- package/src/migrations/0111_agent_skill_sharing.sql +22 -0
- package/src/migrations/0112_skill_share_requests.sql +4 -0
- package/dist/tools/builtins/skill-write.d.ts +0 -59
- package/dist/tools/builtins/skill-write.js +0 -244
package/bootstrap.json
CHANGED
|
@@ -3,103 +3,103 @@
|
|
|
3
3
|
"schemaVersion": 1,
|
|
4
4
|
"marketplace": {
|
|
5
5
|
"url": "https://github.com/capybara-hq/plugins.git",
|
|
6
|
-
"commit": "
|
|
6
|
+
"commit": "14c73d5c51415223326d89414d62b7278ad60745"
|
|
7
7
|
},
|
|
8
8
|
"plugins": [
|
|
9
9
|
{
|
|
10
10
|
"name": "openai-compatible",
|
|
11
11
|
"source": "npm",
|
|
12
12
|
"npm": "@capybara-hq/plugin-openai-compatible",
|
|
13
|
-
"version": "0.1.0-rc.
|
|
14
|
-
"integrity": "sha512-
|
|
13
|
+
"version": "0.1.0-rc.7",
|
|
14
|
+
"integrity": "sha512-EVsWj0bJns6DirtzTXIbXrrktoiJbZi+8NeLzYpZ53Gwo4hNoNAaIhnfHge9RBhSgZ0xMTKEAP/PlyQ6uasAVA==",
|
|
15
15
|
"required": true
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "object-store-s3",
|
|
19
19
|
"source": "npm",
|
|
20
20
|
"npm": "@capybara-hq/plugin-object-store-s3",
|
|
21
|
-
"version": "0.1.0-rc.
|
|
22
|
-
"integrity": "sha512-
|
|
21
|
+
"version": "0.1.0-rc.6",
|
|
22
|
+
"integrity": "sha512-zoJ0DDzeZ1WHxZZyHL/D855FTI2Mdjb0Z5RCqWu745eHA4+5DbboBiHsxSwyzQHp7LixyVQLoWxjFgdXCOkcFw==",
|
|
23
23
|
"required": true
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"name": "anthropic",
|
|
27
27
|
"source": "npm",
|
|
28
28
|
"npm": "@capybara-hq/plugin-anthropic",
|
|
29
|
-
"version": "0.1.0-rc.
|
|
30
|
-
"integrity": "sha512-
|
|
29
|
+
"version": "0.1.0-rc.6",
|
|
30
|
+
"integrity": "sha512-x3/vR09Rlcw+kikk9ztmD4fqG0ThscAjAP+R2IOfQxqMNLfcppF0S6zGAWibof3qJ0LG/dr3o0yyH3j20TGlRg==",
|
|
31
31
|
"required": false
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"name": "openai",
|
|
35
35
|
"source": "npm",
|
|
36
36
|
"npm": "@capybara-hq/plugin-openai",
|
|
37
|
-
"version": "0.1.0-rc.
|
|
38
|
-
"integrity": "sha512-
|
|
37
|
+
"version": "0.1.0-rc.7",
|
|
38
|
+
"integrity": "sha512-67wjrPJd8/CUzTLOxK+rw1dBL2iCzQ5nj9Zg4R6M6K046i/yp8RGLJiYfFags8SFk3yHCBdQIigBWRsFF7HOfg==",
|
|
39
39
|
"required": false
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"name": "deepseek",
|
|
43
43
|
"source": "npm",
|
|
44
44
|
"npm": "@capybara-hq/plugin-deepseek",
|
|
45
|
-
"version": "0.1.0-rc.
|
|
46
|
-
"integrity": "sha512-
|
|
45
|
+
"version": "0.1.0-rc.6",
|
|
46
|
+
"integrity": "sha512-MO04BQm08JexZ+Pns/I8x6zWG5lSlXuADM2tZaE6/61hA3L1qKnZly9vmE8H6tt+JgbPZda+lMrINhbQ4biv2A==",
|
|
47
47
|
"required": false
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
"name": "bailian",
|
|
51
51
|
"source": "npm",
|
|
52
52
|
"npm": "@capybara-hq/plugin-bailian",
|
|
53
|
-
"version": "0.1.0-rc.
|
|
54
|
-
"integrity": "sha512-
|
|
53
|
+
"version": "0.1.0-rc.6",
|
|
54
|
+
"integrity": "sha512-dqj7fnUkjs5PnsJsqolkZMZ/a+MWz2yMSORiecyRPoM5hNNgc1LY0jtoTLTOFxG6b5sMJJ0iqyISDrZeV4ScyQ==",
|
|
55
55
|
"required": false
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"name": "ark",
|
|
59
59
|
"source": "npm",
|
|
60
60
|
"npm": "@capybara-hq/plugin-ark",
|
|
61
|
-
"version": "0.1.0-rc.
|
|
62
|
-
"integrity": "sha512-
|
|
61
|
+
"version": "0.1.0-rc.6",
|
|
62
|
+
"integrity": "sha512-VamP4U4zU6d9uvSAIo9KLxqh0Vt05EnexOF+78W3oY35YrNRXevk/ABFGMVwGEflq9LiJYJ6xisl38t3Aq5fDA==",
|
|
63
63
|
"required": false
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
"name": "connector-mcp",
|
|
67
67
|
"source": "npm",
|
|
68
68
|
"npm": "@capybara-hq/plugin-connector-mcp",
|
|
69
|
-
"version": "0.1.0-rc.
|
|
70
|
-
"integrity": "sha512-
|
|
69
|
+
"version": "0.1.0-rc.6",
|
|
70
|
+
"integrity": "sha512-p8YmmutRTdj5auF5Ua5ox77S1tht+2URguehopjFaK8Cl34rURM4hY0f7WSJ5Xj884156HBua4AmsBTaDMiasQ==",
|
|
71
71
|
"required": false
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
"name": "connector-openapi",
|
|
75
75
|
"source": "npm",
|
|
76
76
|
"npm": "@capybara-hq/plugin-connector-openapi",
|
|
77
|
-
"version": "0.1.0-rc.
|
|
78
|
-
"integrity": "sha512-
|
|
77
|
+
"version": "0.1.0-rc.7",
|
|
78
|
+
"integrity": "sha512-hcLe9Ay6ho6C1dFXtVk7VU6kL9NYmjjbh2+7dXl4BJYglGwrGbfVr0FN7TNRQ+Bsy2ni4BuSsJSGv6BYOp6/EA==",
|
|
79
79
|
"required": false
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
"name": "jina",
|
|
83
83
|
"source": "npm",
|
|
84
84
|
"npm": "@capybara-hq/plugin-jina",
|
|
85
|
-
"version": "0.1.0-rc.
|
|
86
|
-
"integrity": "sha512-
|
|
85
|
+
"version": "0.1.0-rc.6",
|
|
86
|
+
"integrity": "sha512-ViVwzmq4Ic4iJ7vnwYFSRHm3ON96npVDvcLQH7CqIkpUAKabt8GNBVuD5yAeadKmXY3Gn76VkfjjfmHzJgbOMw==",
|
|
87
87
|
"required": false
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
"name": "sandbox-docker",
|
|
91
91
|
"source": "npm",
|
|
92
92
|
"npm": "@capybara-hq/plugin-sandbox-docker",
|
|
93
|
-
"version": "0.1.0-rc.
|
|
94
|
-
"integrity": "sha512-
|
|
93
|
+
"version": "0.1.0-rc.10",
|
|
94
|
+
"integrity": "sha512-nDdaWCgrGoAfOiaKMVGheCLTlbFtSo10+8sgPSmJCO4z2LJW0qDMuN7rPwd3QnFsBReNeBwDB5fT6eHscNWDqw==",
|
|
95
95
|
"required": false
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
98
|
"name": "todo",
|
|
99
99
|
"source": "npm",
|
|
100
100
|
"npm": "@capybara-hq/plugin-todo",
|
|
101
|
-
"version": "0.1.0-rc.
|
|
102
|
-
"integrity": "sha512-
|
|
101
|
+
"version": "0.1.0-rc.6",
|
|
102
|
+
"integrity": "sha512-AOKLpoaBfOQUWnP9nszg9DQWR+6z5gl+ZHoTlHysA9LAeC2h/zipjGE9hY69HF9rueSHzM2kGESJLvXIuQODAA==",
|
|
103
103
|
"required": false
|
|
104
104
|
}
|
|
105
105
|
]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import { type AdminAgentDetail, type AdminAgentRow, AdminAgents } from "../agents/admin-agents.js";
|
|
3
|
+
import { AgentsService } from "../agents/agents.service.js";
|
|
4
|
+
import { type Principal } from "../identity/principal.js";
|
|
5
|
+
import { AdminAgentListQuery, AgentIdParams, OwnerBody } from "./admin-items.schemas.js";
|
|
6
|
+
/**
|
|
7
|
+
* Every org's agents for the super admin (admin agents and connectors spec §4.1): read any agent,
|
|
8
|
+
* transfer its owner, delete it. The super admin need not be a member of the agent's org; each
|
|
9
|
+
* write is audited in that org with `detail.via = "platform"`.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AdminAgentsController {
|
|
12
|
+
private readonly admin;
|
|
13
|
+
private readonly agents;
|
|
14
|
+
constructor(admin: AdminAgents, agents: AgentsService);
|
|
15
|
+
/** Live agents of live orgs by id; `next` is the `after` of the next page, null at the end. */
|
|
16
|
+
list(q: z.infer<typeof AdminAgentListQuery>): Promise<{
|
|
17
|
+
agents: AdminAgentRow[];
|
|
18
|
+
next: string | null;
|
|
19
|
+
}>;
|
|
20
|
+
get({ agentId }: z.infer<typeof AgentIdParams>): Promise<{
|
|
21
|
+
agent: AdminAgentDetail;
|
|
22
|
+
}>;
|
|
23
|
+
/** Gives the agent to another member of its org; clears `needsReassignment`. */
|
|
24
|
+
transfer(principal: Principal, { agentId }: z.infer<typeof AgentIdParams>, body: z.infer<typeof OwnerBody>): Promise<{
|
|
25
|
+
agent: AdminAgentDetail;
|
|
26
|
+
}>;
|
|
27
|
+
remove(principal: Principal, { agentId }: z.infer<typeof AgentIdParams>): Promise<void>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Controller, Delete, Get, HttpCode, Inject, Post } from "@nestjs/common";
|
|
11
|
+
import { AdminAgents } from "../agents/admin-agents.js";
|
|
12
|
+
import { AgentsService } from "../agents/agents.service.js";
|
|
13
|
+
import { CurrentPrincipal, SuperAdmin } from "../identity/principal.js";
|
|
14
|
+
import { writeActorOf } from "../identity/write-actor.js";
|
|
15
|
+
import { createZodDto } from "../infra/validation/create-zod-dto.js";
|
|
16
|
+
import { ZBody, ZParam, ZQuery } from "../infra/validation/zod-params.js";
|
|
17
|
+
import { AdminAgentListQuery, AgentIdParams, OwnerBody } from "./admin-items.schemas.js";
|
|
18
|
+
class AdminAgentListQueryDto extends createZodDto(AdminAgentListQuery, "AdminAgentListQuery") {
|
|
19
|
+
}
|
|
20
|
+
class AdminAgentIdParamsDto extends createZodDto(AgentIdParams, "AdminAgentIdParams") {
|
|
21
|
+
}
|
|
22
|
+
class AdminOwnerBodyDto extends createZodDto(OwnerBody, "AdminAgentOwnerBody") {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Every org's agents for the super admin (admin agents and connectors spec §4.1): read any agent,
|
|
26
|
+
* transfer its owner, delete it. The super admin need not be a member of the agent's org; each
|
|
27
|
+
* write is audited in that org with `detail.via = "platform"`.
|
|
28
|
+
*/
|
|
29
|
+
let AdminAgentsController = class AdminAgentsController {
|
|
30
|
+
admin;
|
|
31
|
+
agents;
|
|
32
|
+
constructor(admin, agents) {
|
|
33
|
+
this.admin = admin;
|
|
34
|
+
this.agents = agents;
|
|
35
|
+
}
|
|
36
|
+
/** Live agents of live orgs by id; `next` is the `after` of the next page, null at the end. */
|
|
37
|
+
list(q) {
|
|
38
|
+
return this.admin.list(q);
|
|
39
|
+
}
|
|
40
|
+
async get({ agentId }) {
|
|
41
|
+
return { agent: await this.admin.get(agentId) };
|
|
42
|
+
}
|
|
43
|
+
/** Gives the agent to another member of its org; clears `needsReassignment`. */
|
|
44
|
+
async transfer(principal, { agentId }, body) {
|
|
45
|
+
await this.agents.reassignOwnerAsPlatform(agentId, body.accountId, writeActorOf(principal));
|
|
46
|
+
return { agent: await this.admin.get(agentId) };
|
|
47
|
+
}
|
|
48
|
+
async remove(principal, { agentId }) {
|
|
49
|
+
await this.agents.softDeleteAsPlatform(agentId, writeActorOf(principal));
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
__decorate([
|
|
53
|
+
Get(),
|
|
54
|
+
__param(0, ZQuery(AdminAgentListQueryDto))
|
|
55
|
+
], AdminAgentsController.prototype, "list", null);
|
|
56
|
+
__decorate([
|
|
57
|
+
Get(":agentId"),
|
|
58
|
+
__param(0, ZParam(AdminAgentIdParamsDto))
|
|
59
|
+
], AdminAgentsController.prototype, "get", null);
|
|
60
|
+
__decorate([
|
|
61
|
+
Post(":agentId/owner"),
|
|
62
|
+
HttpCode(200),
|
|
63
|
+
__param(0, CurrentPrincipal()),
|
|
64
|
+
__param(1, ZParam(AdminAgentIdParamsDto)),
|
|
65
|
+
__param(2, ZBody(AdminOwnerBodyDto))
|
|
66
|
+
], AdminAgentsController.prototype, "transfer", null);
|
|
67
|
+
__decorate([
|
|
68
|
+
Delete(":agentId"),
|
|
69
|
+
HttpCode(204),
|
|
70
|
+
__param(0, CurrentPrincipal()),
|
|
71
|
+
__param(1, ZParam(AdminAgentIdParamsDto))
|
|
72
|
+
], AdminAgentsController.prototype, "remove", null);
|
|
73
|
+
AdminAgentsController = __decorate([
|
|
74
|
+
Controller("api/v1/admin/agents"),
|
|
75
|
+
SuperAdmin(),
|
|
76
|
+
__param(0, Inject(AdminAgents)),
|
|
77
|
+
__param(1, Inject(AgentsService))
|
|
78
|
+
], AdminAgentsController);
|
|
79
|
+
export { AdminAgentsController };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import { type Principal } from "../identity/principal.js";
|
|
3
|
+
import { type AdminConnectorDetail, type AdminConnectorRow, AdminConnectors } from "../tools/admin-connectors.js";
|
|
4
|
+
import { ConnectorsService } from "../tools/connectors.service.js";
|
|
5
|
+
import { AdminConnectorListQuery, ConnectorIdParams, ConnectorStatusBody } from "./admin-items.schemas.js";
|
|
6
|
+
/**
|
|
7
|
+
* Every org's connectors for the super admin (admin agents and connectors spec §4.1): read any
|
|
8
|
+
* connector without its credentials, disable or enable it, delete it. The super admin need not be
|
|
9
|
+
* a member of the connector's org; each write is audited there with `detail.via = "platform"`.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AdminConnectorsController {
|
|
12
|
+
private readonly admin;
|
|
13
|
+
private readonly connectors;
|
|
14
|
+
constructor(admin: AdminConnectors, connectors: ConnectorsService);
|
|
15
|
+
/** Live connectors of live orgs by id; `next` is the `after` of the next page, null at the end. */
|
|
16
|
+
list(q: z.infer<typeof AdminConnectorListQuery>): Promise<{
|
|
17
|
+
connectors: AdminConnectorRow[];
|
|
18
|
+
next: string | null;
|
|
19
|
+
}>;
|
|
20
|
+
get({ connectorId }: z.infer<typeof ConnectorIdParams>): Promise<{
|
|
21
|
+
connector: AdminConnectorDetail;
|
|
22
|
+
}>;
|
|
23
|
+
/** Disables or enables the connector (its endpoint and auth stay the org's to edit). */
|
|
24
|
+
setStatus(principal: Principal, { connectorId }: z.infer<typeof ConnectorIdParams>, body: z.infer<typeof ConnectorStatusBody>): Promise<{
|
|
25
|
+
connector: AdminConnectorDetail;
|
|
26
|
+
}>;
|
|
27
|
+
/** Deletes the connector and every credential of it. */
|
|
28
|
+
remove(principal: Principal, { connectorId }: z.infer<typeof ConnectorIdParams>): Promise<void>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Controller, Delete, Get, HttpCode, Inject, Patch } from "@nestjs/common";
|
|
11
|
+
import { CurrentPrincipal, SuperAdmin } from "../identity/principal.js";
|
|
12
|
+
import { writeActorOf } from "../identity/write-actor.js";
|
|
13
|
+
import { createZodDto } from "../infra/validation/create-zod-dto.js";
|
|
14
|
+
import { ZBody, ZParam, ZQuery } from "../infra/validation/zod-params.js";
|
|
15
|
+
import { AdminConnectors, } from "../tools/admin-connectors.js";
|
|
16
|
+
import { ConnectorsService } from "../tools/connectors.service.js";
|
|
17
|
+
import { AdminConnectorListQuery, ConnectorIdParams, ConnectorStatusBody, } from "./admin-items.schemas.js";
|
|
18
|
+
class AdminConnectorListQueryDto extends createZodDto(AdminConnectorListQuery, "AdminConnectorListQuery") {
|
|
19
|
+
}
|
|
20
|
+
class AdminConnectorIdParamsDto extends createZodDto(ConnectorIdParams, "AdminConnectorIdParams") {
|
|
21
|
+
}
|
|
22
|
+
class ConnectorStatusBodyDto extends createZodDto(ConnectorStatusBody, "AdminConnectorStatusBody") {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Every org's connectors for the super admin (admin agents and connectors spec §4.1): read any
|
|
26
|
+
* connector without its credentials, disable or enable it, delete it. The super admin need not be
|
|
27
|
+
* a member of the connector's org; each write is audited there with `detail.via = "platform"`.
|
|
28
|
+
*/
|
|
29
|
+
let AdminConnectorsController = class AdminConnectorsController {
|
|
30
|
+
admin;
|
|
31
|
+
connectors;
|
|
32
|
+
constructor(admin, connectors) {
|
|
33
|
+
this.admin = admin;
|
|
34
|
+
this.connectors = connectors;
|
|
35
|
+
}
|
|
36
|
+
/** Live connectors of live orgs by id; `next` is the `after` of the next page, null at the end. */
|
|
37
|
+
list(q) {
|
|
38
|
+
return this.admin.list(q);
|
|
39
|
+
}
|
|
40
|
+
async get({ connectorId }) {
|
|
41
|
+
return { connector: await this.admin.get(connectorId) };
|
|
42
|
+
}
|
|
43
|
+
/** Disables or enables the connector (its endpoint and auth stay the org's to edit). */
|
|
44
|
+
async setStatus(principal, { connectorId }, body) {
|
|
45
|
+
await this.connectors.setStatusAsPlatform(connectorId, body.status, writeActorOf(principal));
|
|
46
|
+
return { connector: await this.admin.get(connectorId) };
|
|
47
|
+
}
|
|
48
|
+
/** Deletes the connector and every credential of it. */
|
|
49
|
+
async remove(principal, { connectorId }) {
|
|
50
|
+
await this.connectors.removeAsPlatform(connectorId, writeActorOf(principal));
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
__decorate([
|
|
54
|
+
Get(),
|
|
55
|
+
__param(0, ZQuery(AdminConnectorListQueryDto))
|
|
56
|
+
], AdminConnectorsController.prototype, "list", null);
|
|
57
|
+
__decorate([
|
|
58
|
+
Get(":connectorId"),
|
|
59
|
+
__param(0, ZParam(AdminConnectorIdParamsDto))
|
|
60
|
+
], AdminConnectorsController.prototype, "get", null);
|
|
61
|
+
__decorate([
|
|
62
|
+
Patch(":connectorId"),
|
|
63
|
+
__param(0, CurrentPrincipal()),
|
|
64
|
+
__param(1, ZParam(AdminConnectorIdParamsDto)),
|
|
65
|
+
__param(2, ZBody(ConnectorStatusBodyDto))
|
|
66
|
+
], AdminConnectorsController.prototype, "setStatus", null);
|
|
67
|
+
__decorate([
|
|
68
|
+
Delete(":connectorId"),
|
|
69
|
+
HttpCode(204),
|
|
70
|
+
__param(0, CurrentPrincipal()),
|
|
71
|
+
__param(1, ZParam(AdminConnectorIdParamsDto))
|
|
72
|
+
], AdminConnectorsController.prototype, "remove", null);
|
|
73
|
+
AdminConnectorsController = __decorate([
|
|
74
|
+
Controller("api/v1/admin/connectors"),
|
|
75
|
+
SuperAdmin(),
|
|
76
|
+
__param(0, Inject(AdminConnectors)),
|
|
77
|
+
__param(1, Inject(ConnectorsService))
|
|
78
|
+
], AdminConnectorsController);
|
|
79
|
+
export { AdminConnectorsController };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { RouteSchemas } from "../platform/route-schemas.js";
|
|
3
|
+
/** `GET /api/v1/admin/agents`: org filter, name search, id paging. */
|
|
4
|
+
export declare const AdminAgentListQuery: z.ZodObject<{
|
|
5
|
+
after: z.ZodOptional<z.ZodString>;
|
|
6
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
7
|
+
orgId: z.ZodOptional<z.ZodString>;
|
|
8
|
+
q: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
/** `GET /api/v1/admin/connectors`: org and status filters, name search, id paging. */
|
|
11
|
+
export declare const AdminConnectorListQuery: z.ZodObject<{
|
|
12
|
+
after: z.ZodOptional<z.ZodString>;
|
|
13
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
14
|
+
orgId: z.ZodOptional<z.ZodString>;
|
|
15
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
16
|
+
active: "active";
|
|
17
|
+
disabled: "disabled";
|
|
18
|
+
}>>;
|
|
19
|
+
q: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export declare const AgentIdParams: z.ZodObject<{
|
|
22
|
+
agentId: z.ZodString;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const ConnectorIdParams: z.ZodObject<{
|
|
25
|
+
connectorId: z.ZodString;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
/** The new owner: a member of the agent's org, not its anonymous guest. */
|
|
28
|
+
export declare const OwnerBody: z.ZodObject<{
|
|
29
|
+
accountId: z.ZodString;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
/** Only the status: a connector's endpoint and auth stay the org's. */
|
|
32
|
+
export declare const ConnectorStatusBody: z.ZodObject<{
|
|
33
|
+
status: z.ZodEnum<{
|
|
34
|
+
active: "active";
|
|
35
|
+
disabled: "disabled";
|
|
36
|
+
}>;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
/**
|
|
39
|
+
* The routes a Platform operation mirrors. The owner transfer is excluded (human-only, as the org's
|
|
40
|
+
* own transfer route), so it is not listed.
|
|
41
|
+
*/
|
|
42
|
+
export declare const ADMIN_ITEM_ROUTES: readonly RouteSchemas[];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Schemas of the super admin's routes for every org's agents and connectors (admin agents and
|
|
4
|
+
* connectors spec §4.1). Ids are `text` columns, so a malformed id cannot fail the query: it is
|
|
5
|
+
* bounded here (400 `validation_failed` past 100 characters) and otherwise reads as not found.
|
|
6
|
+
*/
|
|
7
|
+
const Id = z.string().min(1).max(100);
|
|
8
|
+
const Paging = {
|
|
9
|
+
/** The last id of the previous page (the `next` of the previous response). */
|
|
10
|
+
after: Id.optional(),
|
|
11
|
+
limit: z.coerce.number().int().min(1).max(200).default(50),
|
|
12
|
+
};
|
|
13
|
+
/** `GET /api/v1/admin/agents`: org filter, name search, id paging. */
|
|
14
|
+
export const AdminAgentListQuery = z.object({
|
|
15
|
+
orgId: Id.optional(),
|
|
16
|
+
q: z.string().max(200).optional(),
|
|
17
|
+
...Paging,
|
|
18
|
+
});
|
|
19
|
+
/** `GET /api/v1/admin/connectors`: org and status filters, name search, id paging. */
|
|
20
|
+
export const AdminConnectorListQuery = z.object({
|
|
21
|
+
orgId: Id.optional(),
|
|
22
|
+
status: z.enum(["active", "disabled"]).optional(),
|
|
23
|
+
q: z.string().max(200).optional(),
|
|
24
|
+
...Paging,
|
|
25
|
+
});
|
|
26
|
+
export const AgentIdParams = z.object({ agentId: Id });
|
|
27
|
+
export const ConnectorIdParams = z.object({ connectorId: Id });
|
|
28
|
+
/** The new owner: a member of the agent's org, not its anonymous guest. */
|
|
29
|
+
export const OwnerBody = z.object({ accountId: Id }).strict();
|
|
30
|
+
/** Only the status: a connector's endpoint and auth stay the org's. */
|
|
31
|
+
export const ConnectorStatusBody = z.object({ status: z.enum(["active", "disabled"]) }).strict();
|
|
32
|
+
/**
|
|
33
|
+
* The routes a Platform operation mirrors. The owner transfer is excluded (human-only, as the org's
|
|
34
|
+
* own transfer route), so it is not listed.
|
|
35
|
+
*/
|
|
36
|
+
export const ADMIN_ITEM_ROUTES = [
|
|
37
|
+
{ route: "GET /api/v1/admin/agents", query: AdminAgentListQuery },
|
|
38
|
+
{ route: "GET /api/v1/admin/agents/:agentId", params: AgentIdParams },
|
|
39
|
+
{ route: "DELETE /api/v1/admin/agents/:agentId", params: AgentIdParams },
|
|
40
|
+
{ route: "GET /api/v1/admin/connectors", query: AdminConnectorListQuery },
|
|
41
|
+
{ route: "GET /api/v1/admin/connectors/:connectorId", params: ConnectorIdParams },
|
|
42
|
+
{
|
|
43
|
+
route: "PATCH /api/v1/admin/connectors/:connectorId",
|
|
44
|
+
params: ConnectorIdParams,
|
|
45
|
+
body: ConnectorStatusBody,
|
|
46
|
+
},
|
|
47
|
+
{ route: "DELETE /api/v1/admin/connectors/:connectorId", params: ConnectorIdParams },
|
|
48
|
+
];
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { LocalizedName, Logger } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import type { z } from "zod";
|
|
3
|
-
import { CatalogRequestsService } from "../catalog/requests.service.js";
|
|
4
|
-
import { ExtensionAdmin } from "../extensions/admin-view.js";
|
|
5
3
|
import { ExtensionDisplayNames } from "../extensions/display-name.js";
|
|
6
4
|
import { PluginIcons } from "../extensions/plugin-icons.js";
|
|
7
5
|
import { type Account, AccountsService } from "../identity/accounts.js";
|
|
@@ -13,22 +11,11 @@ import { type ModelDisabledPatch, type ModelProviderParams } from "../models/ena
|
|
|
13
11
|
import { type ModelDisableResult, ModelEnablement } from "../models/enablement.js";
|
|
14
12
|
import { type ModelPrice, type ModelPricePut, PricesService } from "../models/prices.js";
|
|
15
13
|
import { ModelPurposesService, type PurposeListing, type PurposePut } from "../models/purposes.js";
|
|
14
|
+
import { type Member, MembersService } from "../orgs/members.service.js";
|
|
16
15
|
import { type Org, OrgsService } from "../orgs/orgs.service.js";
|
|
17
16
|
import { ProviderRegistry, type ProviderStatus } from "../runtime/providers.js";
|
|
18
|
-
import { AccountListQuery, AccountParams, CreateAccountBody, DeploymentSettingsBody, PurposeParams, UpdateAccountBody } from "./admin.schemas.js";
|
|
17
|
+
import { AccountListQuery, AccountParams, AdminOrgParams, CreateAccountBody, DeploymentSettingsBody, PurposeParams, UpdateAccountBody } from "./admin.schemas.js";
|
|
19
18
|
import { type LimitDefaults } from "./limit-defaults.js";
|
|
20
|
-
/** 后台概览(`GET /api/v1/admin/overview`)的计数。 */
|
|
21
|
-
export interface AdminOverview {
|
|
22
|
-
/**
|
|
23
|
-
* Extensions a super admin has to act on (pending approval or configuration, failed, missing
|
|
24
|
-
* dependency, replicas disagree); see `extensionNeedsAction`.
|
|
25
|
-
*/
|
|
26
|
-
extensionsNeedingAction: number;
|
|
27
|
-
/** Catalog requests waiting for a super admin (stage deployment, pending). */
|
|
28
|
-
catalogRequestsPending: number;
|
|
29
|
-
orgs: number;
|
|
30
|
-
accounts: number;
|
|
31
|
-
}
|
|
32
19
|
/**
|
|
33
20
|
* 超级管理员端点(`/api/v1/admin/*`):只接受超级管理员的 Web 会话或个人令牌;
|
|
34
21
|
* 服务令牌一律 `forbidden`(未标 `@AllowService`)。
|
|
@@ -41,16 +28,13 @@ export declare class AdminController {
|
|
|
41
28
|
private readonly settings;
|
|
42
29
|
private readonly prices;
|
|
43
30
|
private readonly purposes;
|
|
44
|
-
private readonly plugins;
|
|
45
31
|
private readonly registry;
|
|
46
|
-
private readonly catalogRequests;
|
|
47
32
|
private readonly displayNames;
|
|
48
33
|
private readonly enablement;
|
|
49
34
|
private readonly config;
|
|
50
35
|
private readonly icons;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
overview(): Promise<AdminOverview>;
|
|
36
|
+
private readonly members;
|
|
37
|
+
constructor(accounts: AccountsService, sessions: SessionService, log: Logger, orgs: OrgsService, settings: SettingsService, prices: PricesService, purposes: ModelPurposesService, registry: ProviderRegistry, displayNames: ExtensionDisplayNames, enablement: ModelEnablement, config: KernelConfigService, icons: PluginIcons, members: MembersService);
|
|
54
38
|
/**
|
|
55
39
|
* 全部账号,按 id 升序分页:`next` 为下一页的游标(作为 `after` 传回),没有更多时为 null。
|
|
56
40
|
* 多取一条判断是否还有下一页。
|
|
@@ -76,6 +60,13 @@ export declare class AdminController {
|
|
|
76
60
|
})[];
|
|
77
61
|
limitDefaults: LimitDefaults;
|
|
78
62
|
}>;
|
|
63
|
+
/**
|
|
64
|
+
* The members of any live org (the agent owner transfer picks the new owner from them); the super
|
|
65
|
+
* admin need not be a member. A missing or deleted org → `org.not_found`.
|
|
66
|
+
*/
|
|
67
|
+
orgMembers({ orgId }: z.infer<typeof AdminOrgParams>): Promise<{
|
|
68
|
+
members: Member[];
|
|
69
|
+
}>;
|
|
79
70
|
getSettings(): Promise<DeploymentSettings>;
|
|
80
71
|
putSettings(principal: Principal, body: z.infer<typeof DeploymentSettingsBody>): Promise<DeploymentSettings>;
|
|
81
72
|
/**
|
|
@@ -8,10 +8,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
10
|
import { Controller, Get, HttpCode, Inject, Patch, Post, Put } from "@nestjs/common";
|
|
11
|
-
import {
|
|
12
|
-
import { ExtensionAdmin } from "../extensions/admin-view.js";
|
|
11
|
+
import { ApiError } from "../errors.js";
|
|
13
12
|
import { ExtensionDisplayNames } from "../extensions/display-name.js";
|
|
14
|
-
import { extensionNeedsAction } from "../extensions/permission-view.js";
|
|
15
13
|
import { PluginIcons } from "../extensions/plugin-icons.js";
|
|
16
14
|
import { AccountsService } from "../identity/accounts.js";
|
|
17
15
|
import { CurrentPrincipal, patTokenId, requireUser, SuperAdmin, } from "../identity/principal.js";
|
|
@@ -26,9 +24,10 @@ import { ModelEnablement } from "../models/enablement.js";
|
|
|
26
24
|
import { MODEL_PRICE_PUT, PricesService, } from "../models/prices.js";
|
|
27
25
|
import { purposeTargetOf } from "../models/purposes.controller.js";
|
|
28
26
|
import { ModelPurposesService, PurposePutDto, withDeclaredByNames, } from "../models/purposes.js";
|
|
27
|
+
import { MembersService } from "../orgs/members.service.js";
|
|
29
28
|
import { OrgsService } from "../orgs/orgs.service.js";
|
|
30
29
|
import { ProviderRegistry } from "../runtime/providers.js";
|
|
31
|
-
import { AccountListQuery, AccountParams, CreateAccountBody, DeploymentSettingsBody, PurposeParams, UpdateAccountBody, } from "./admin.schemas.js";
|
|
30
|
+
import { AccountListQuery, AccountParams, AdminOrgParams, CreateAccountBody, DeploymentSettingsBody, PurposeParams, UpdateAccountBody, } from "./admin.schemas.js";
|
|
32
31
|
import { limitDefaults } from "./limit-defaults.js";
|
|
33
32
|
class AccountListQueryDto extends createZodDto(AccountListQuery, "AccountListQuery") {
|
|
34
33
|
}
|
|
@@ -38,6 +37,8 @@ class UpdateAccountBodyDto extends createZodDto(UpdateAccountBody, "UpdateAccoun
|
|
|
38
37
|
}
|
|
39
38
|
class AccountParamsDto extends createZodDto(AccountParams, "AccountParams") {
|
|
40
39
|
}
|
|
40
|
+
class AdminOrgParamsDto extends createZodDto(AdminOrgParams, "AdminOrgParams") {
|
|
41
|
+
}
|
|
41
42
|
class PurposeParamsDto extends createZodDto(PurposeParams, "PurposeParams") {
|
|
42
43
|
}
|
|
43
44
|
class DeploymentSettingsBodyDto extends createZodDto(DeploymentSettingsBody, "DeploymentSettingsPatch") {
|
|
@@ -56,14 +57,13 @@ let AdminController = class AdminController {
|
|
|
56
57
|
settings;
|
|
57
58
|
prices;
|
|
58
59
|
purposes;
|
|
59
|
-
plugins;
|
|
60
60
|
registry;
|
|
61
|
-
catalogRequests;
|
|
62
61
|
displayNames;
|
|
63
62
|
enablement;
|
|
64
63
|
config;
|
|
65
64
|
icons;
|
|
66
|
-
|
|
65
|
+
members;
|
|
66
|
+
constructor(accounts, sessions, log, orgs, settings, prices, purposes, registry, displayNames, enablement, config, icons, members) {
|
|
67
67
|
this.accounts = accounts;
|
|
68
68
|
this.sessions = sessions;
|
|
69
69
|
this.log = log;
|
|
@@ -71,28 +71,12 @@ let AdminController = class AdminController {
|
|
|
71
71
|
this.settings = settings;
|
|
72
72
|
this.prices = prices;
|
|
73
73
|
this.purposes = purposes;
|
|
74
|
-
this.plugins = plugins;
|
|
75
74
|
this.registry = registry;
|
|
76
|
-
this.catalogRequests = catalogRequests;
|
|
77
75
|
this.displayNames = displayNames;
|
|
78
76
|
this.enablement = enablement;
|
|
79
77
|
this.config = config;
|
|
80
78
|
this.icons = icons;
|
|
81
|
-
|
|
82
|
-
/** 后台概览的四个数字(只读计数,不含任何对话内容)。 */
|
|
83
|
-
async overview() {
|
|
84
|
-
const [plugins, orgs, accounts, catalogRequestsPending] = await Promise.all([
|
|
85
|
-
this.plugins.list(),
|
|
86
|
-
this.orgs.listAll(),
|
|
87
|
-
this.accounts.count(),
|
|
88
|
-
this.catalogRequests.countPendingDeployment(),
|
|
89
|
-
]);
|
|
90
|
-
return {
|
|
91
|
-
extensionsNeedingAction: plugins.filter((p) => extensionNeedsAction(p.status)).length,
|
|
92
|
-
catalogRequestsPending,
|
|
93
|
-
orgs: orgs.length,
|
|
94
|
-
accounts,
|
|
95
|
-
};
|
|
79
|
+
this.members = members;
|
|
96
80
|
}
|
|
97
81
|
/**
|
|
98
82
|
* 全部账号,按 id 升序分页:`next` 为下一页的游标(作为 `after` 传回),没有更多时为 null。
|
|
@@ -147,6 +131,16 @@ let AdminController = class AdminController {
|
|
|
147
131
|
async listOrgs() {
|
|
148
132
|
return { orgs: await this.orgs.listAll(), limitDefaults: limitDefaults(this.config) };
|
|
149
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* The members of any live org (the agent owner transfer picks the new owner from them); the super
|
|
136
|
+
* admin need not be a member. A missing or deleted org → `org.not_found`.
|
|
137
|
+
*/
|
|
138
|
+
async orgMembers({ orgId }) {
|
|
139
|
+
if ((await this.orgs.get(orgId)) === undefined) {
|
|
140
|
+
throw new ApiError("org.not_found", "Organization not found");
|
|
141
|
+
}
|
|
142
|
+
return { members: await this.members.list(orgId) };
|
|
143
|
+
}
|
|
150
144
|
async getSettings() {
|
|
151
145
|
return this.settings.get();
|
|
152
146
|
}
|
|
@@ -215,9 +209,6 @@ let AdminController = class AdminController {
|
|
|
215
209
|
return { purpose: listing };
|
|
216
210
|
}
|
|
217
211
|
};
|
|
218
|
-
__decorate([
|
|
219
|
-
Get("overview")
|
|
220
|
-
], AdminController.prototype, "overview", null);
|
|
221
212
|
__decorate([
|
|
222
213
|
Get("accounts"),
|
|
223
214
|
__param(0, ZQuery(AccountListQueryDto))
|
|
@@ -237,6 +228,10 @@ __decorate([
|
|
|
237
228
|
__decorate([
|
|
238
229
|
Get("orgs")
|
|
239
230
|
], AdminController.prototype, "listOrgs", null);
|
|
231
|
+
__decorate([
|
|
232
|
+
Get("orgs/:orgId/members"),
|
|
233
|
+
__param(0, ZParam(AdminOrgParamsDto))
|
|
234
|
+
], AdminController.prototype, "orgMembers", null);
|
|
240
235
|
__decorate([
|
|
241
236
|
Get("settings")
|
|
242
237
|
], AdminController.prototype, "getSettings", null);
|
|
@@ -281,12 +276,11 @@ AdminController = __decorate([
|
|
|
281
276
|
__param(4, Inject(SettingsService)),
|
|
282
277
|
__param(5, Inject(PricesService)),
|
|
283
278
|
__param(6, Inject(ModelPurposesService)),
|
|
284
|
-
__param(7, Inject(
|
|
285
|
-
__param(8, Inject(
|
|
286
|
-
__param(9, Inject(
|
|
287
|
-
__param(10, Inject(
|
|
288
|
-
__param(11, Inject(
|
|
289
|
-
__param(12, Inject(
|
|
290
|
-
__param(13, Inject(PluginIcons))
|
|
279
|
+
__param(7, Inject(ProviderRegistry)),
|
|
280
|
+
__param(8, Inject(ExtensionDisplayNames)),
|
|
281
|
+
__param(9, Inject(ModelEnablement)),
|
|
282
|
+
__param(10, Inject(KernelConfigService)),
|
|
283
|
+
__param(11, Inject(PluginIcons)),
|
|
284
|
+
__param(12, Inject(MembersService))
|
|
291
285
|
], AdminController);
|
|
292
286
|
export { AdminController };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Deployment administration: the setup wizard, the platform-level audit log and the admin overview
|
|
3
|
+
* with its health read and seven-day usage aggregate (its controllers are the api role's, `ApiModule`).
|
|
4
|
+
*/
|
|
2
5
|
export declare class AdminModule {
|
|
3
6
|
}
|