@capybara-hq/kernel 0.1.0-rc.2 → 0.1.0-rc.4
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/dist/admin/admin.controller.d.ts +9 -4
- package/dist/admin/admin.controller.js +13 -4
- package/dist/admin/extensions.controller.d.ts +8 -1
- package/dist/admin/extensions.controller.js +22 -2
- package/dist/agents/agent-lookup.d.ts +3 -0
- package/dist/agents/agent-lookup.js +20 -2
- package/dist/agents/agent-profile.service.d.ts +29 -0
- package/dist/agents/agent-profile.service.js +117 -0
- package/dist/agents/agents.controller.d.ts +93 -3
- package/dist/agents/agents.controller.js +114 -4
- package/dist/agents/agents.module.js +6 -2
- package/dist/agents/agents.service.d.ts +13 -5
- package/dist/agents/agents.service.js +49 -13
- package/dist/agents/definition.d.ts +35 -8
- package/dist/agents/definition.js +203 -17
- package/dist/agents/instruction-files.d.ts +60 -0
- package/dist/agents/instruction-files.js +111 -0
- package/dist/agents/models.controller.d.ts +9 -3
- package/dist/agents/models.controller.js +19 -4
- package/dist/agents/profile.d.ts +96 -0
- package/dist/agents/profile.js +51 -0
- package/dist/agents/readiness.controller.d.ts +26 -0
- package/dist/agents/readiness.controller.js +56 -0
- package/dist/agents/templates.js +20 -5
- package/dist/background/background.controller.d.ts +38 -0
- package/dist/background/background.controller.js +87 -0
- package/dist/background/background.module.d.ts +10 -0
- package/dist/background/background.module.js +32 -0
- package/dist/background/finish.d.ts +43 -0
- package/dist/background/finish.js +94 -0
- package/dist/background/launch-lock.d.ts +14 -0
- package/dist/background/launch-lock.js +39 -0
- package/dist/background/launch.d.ts +36 -0
- package/dist/background/launch.js +70 -0
- package/dist/background/poll.job.d.ts +53 -0
- package/dist/background/poll.job.js +182 -0
- package/dist/background/render.d.ts +23 -0
- package/dist/background/render.js +48 -0
- package/dist/background/session.d.ts +37 -0
- package/dist/background/session.js +66 -0
- package/dist/background/status.d.ts +35 -0
- package/dist/background/status.js +57 -0
- package/dist/background/stop.d.ts +62 -0
- package/dist/background/stop.js +225 -0
- package/dist/background/store.d.ts +150 -0
- package/dist/background/store.js +351 -0
- package/dist/background/store.module.d.ts +6 -0
- package/dist/background/store.module.js +22 -0
- package/dist/background/tasks.service.d.ts +67 -0
- package/dist/background/tasks.service.js +186 -0
- package/dist/background/wake-rules.d.ts +57 -0
- package/dist/background/wake-rules.js +83 -0
- package/dist/background/wake.d.ts +28 -0
- package/dist/background/wake.js +57 -0
- package/dist/catalog/catalog-content.js +4 -1
- package/dist/catalog/claude/agents.js +15 -10
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/plugin-import.js +1 -1
- package/dist/catalog/plugin-upgrade.js +1 -1
- package/dist/channels/cards.d.ts +8 -2
- package/dist/channels/cards.js +17 -9
- package/dist/channels/connections.service.d.ts +16 -1
- package/dist/channels/connections.service.js +38 -4
- package/dist/channels/threads.d.ts +5 -0
- package/dist/channels/threads.js +8 -0
- package/dist/config/schema.d.ts +18 -0
- package/dist/config/schema.js +104 -2
- package/dist/conversations/access.js +2 -0
- package/dist/conversations/artifacts.d.ts +1 -1
- package/dist/conversations/artifacts.js +1 -1
- package/dist/conversations/attachments.service.d.ts +30 -0
- package/dist/conversations/attachments.service.js +130 -5
- package/dist/conversations/conversations.controller.d.ts +36 -5
- package/dist/conversations/conversations.controller.js +62 -12
- package/dist/conversations/conversations.module.js +3 -0
- package/dist/conversations/conversations.service.d.ts +44 -2
- package/dist/conversations/conversations.service.js +140 -12
- package/dist/conversations/event-log.d.ts +12 -1
- package/dist/conversations/event-log.js +29 -1
- package/dist/conversations/events.d.ts +81 -3
- package/dist/conversations/events.js +83 -16
- package/dist/conversations/queue.d.ts +3 -1
- package/dist/conversations/queue.js +13 -2
- package/dist/conversations/queue.service.js +3 -1
- package/dist/conversations/titles.d.ts +7 -0
- package/dist/conversations/titles.js +15 -0
- package/dist/db/kernel-schema.d.ts +60 -4
- package/dist/db/pool.d.ts +5 -0
- package/dist/db/pool.js +3 -0
- package/dist/errors.d.ts +8 -0
- package/dist/errors.js +8 -0
- package/dist/evals/recorded-tools.d.ts +27 -1
- package/dist/evals/recorded-tools.js +85 -10
- package/dist/evals/run-replay.d.ts +10 -2
- package/dist/evals/run-replay.js +49 -12
- package/dist/evals/step-replay.js +12 -6
- package/dist/evals/trajectory.d.ts +2 -2
- package/dist/evals/trajectory.js +1 -1
- package/dist/extensions/admin-ops.js +2 -0
- package/dist/extensions/admin-view.d.ts +3 -1
- package/dist/extensions/admin-view.js +10 -2
- package/dist/extensions/blobs.js +1 -0
- package/dist/extensions/config-issues.d.ts +13 -1
- package/dist/extensions/config-issues.js +22 -5
- package/dist/extensions/config-json-schema.d.ts +43 -7
- package/dist/extensions/config-json-schema.js +124 -58
- package/dist/extensions/deployment-config-store.d.ts +6 -0
- package/dist/extensions/deployment-config.d.ts +50 -3
- package/dist/extensions/deployment-config.js +125 -28
- package/dist/extensions/display-name.d.ts +22 -0
- package/dist/extensions/display-name.js +77 -0
- package/dist/extensions/extensions.module.js +6 -0
- package/dist/extensions/host.d.ts +26 -1
- package/dist/extensions/host.js +82 -9
- package/dist/extensions/org-config.controller.d.ts +11 -3
- package/dist/extensions/org-config.controller.js +14 -6
- package/dist/extensions/org-config.d.ts +6 -0
- package/dist/extensions/org-config.js +12 -13
- package/dist/extensions/package.d.ts +14 -1
- package/dist/extensions/package.js +51 -2
- package/dist/extensions/permission-view.d.ts +3 -0
- package/dist/extensions/point-defaults.controller.d.ts +34 -0
- package/dist/extensions/point-defaults.controller.js +71 -0
- package/dist/extensions/point-defaults.d.ts +64 -0
- package/dist/extensions/point-defaults.js +206 -0
- package/dist/extensions/registry.d.ts +1 -1
- package/dist/extensions/registry.js +2 -0
- package/dist/http/api.module.js +8 -0
- package/dist/http/nest-logger.d.ts +6 -5
- package/dist/http/nest-logger.js +24 -10
- package/dist/identity/auth.controller.js +9 -5
- package/dist/identity/cookies.d.ts +20 -5
- package/dist/identity/cookies.js +44 -6
- package/dist/identity/me.controller.d.ts +5 -1
- package/dist/identity/me.controller.js +12 -3
- package/dist/identity/sessions.d.ts +12 -0
- package/dist/identity/sessions.js +45 -0
- package/dist/identity/settings.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/infra/config/kernel-config.service.js +6 -0
- package/dist/infra/database/database.module.js +1 -0
- package/dist/infra/events/kernel-events.d.ts +8 -0
- package/dist/infra/lifecycle/process-guards.js +4 -0
- package/dist/infra/logging/logging.module.d.ts +4 -2
- package/dist/infra/logging/logging.module.js +24 -6
- package/dist/infra/queue/redis-connection.d.ts +6 -0
- package/dist/infra/queue/redis-connection.js +7 -0
- package/dist/infra/redis/redis.module.js +6 -2
- package/dist/infra/tokens.d.ts +6 -1
- package/dist/infra/tokens.js +6 -1
- package/dist/lifecycle/kernel-lifecycle.js +5 -0
- package/dist/log.d.ts +13 -1
- package/dist/log.js +93 -17
- package/dist/models/purposes.d.ts +23 -0
- package/dist/models/purposes.js +31 -10
- package/dist/orgs/offboarding.d.ts +3 -1
- package/dist/orgs/offboarding.js +26 -16
- package/dist/orgs/settings.service.d.ts +7 -2
- package/dist/orgs/settings.service.js +15 -4
- package/dist/roles/worker.module.js +6 -0
- package/dist/runtime/context/build.d.ts +15 -13
- package/dist/runtime/context/build.js +45 -27
- package/dist/runtime/context/claude-tools.d.ts +3 -1
- package/dist/runtime/context/claude-tools.js +12 -12
- package/dist/runtime/context/compaction.js +4 -0
- package/dist/runtime/context/legacy-text.d.ts +22 -0
- package/dist/runtime/context/legacy-text.js +37 -0
- package/dist/runtime/context/skills.d.ts +29 -11
- package/dist/runtime/context/skills.js +37 -30
- package/dist/runtime/langgraph-loop.js +3 -2
- package/dist/runtime/loop.d.ts +5 -4
- package/dist/runtime/maintenance.d.ts +4 -2
- package/dist/runtime/maintenance.js +17 -5
- package/dist/runtime/model-call.d.ts +17 -1
- package/dist/runtime/model-call.js +4 -3
- package/dist/runtime/providers.d.ts +6 -0
- package/dist/runtime/providers.js +8 -0
- package/dist/runtime/run-finish.d.ts +1 -1
- package/dist/runtime/run-queue.d.ts +28 -5
- package/dist/runtime/run-queue.js +131 -35
- package/dist/runtime/run-worker.d.ts +2 -2
- package/dist/runtime/run-worker.js +20 -7
- package/dist/runtime/runtime.module.js +8 -3
- package/dist/runtime/step-log.d.ts +6 -0
- package/dist/runtime/step-log.js +16 -2
- package/dist/runtime/subagents/definition.d.ts +1 -6
- package/dist/runtime/subagents/definition.js +14 -13
- package/dist/runtime/subagents/dispatch.d.ts +2 -2
- package/dist/runtime/subagents/dispatch.js +2 -2
- package/dist/runtime/subagents/org-agents.js +2 -1
- package/dist/runtime/subagents/roster.d.ts +1 -1
- package/dist/runtime/subagents/roster.js +1 -1
- package/dist/runtime/subagents/skill-fork.d.ts +2 -2
- package/dist/runtime/subagents/skill-fork.js +2 -2
- package/dist/runtime/subagents/subagents.service.d.ts +3 -3
- package/dist/runtime/subagents/subagents.service.js +3 -3
- package/dist/runtime/usage-report.d.ts +2 -1
- package/dist/runtime/usage-report.js +2 -1
- package/dist/runtime/waits.d.ts +13 -7
- package/dist/runtime/waits.js +42 -16
- package/dist/sandbox/sandbox.module.js +6 -1
- package/dist/sandbox/sandbox.service.d.ts +61 -3
- package/dist/sandbox/sandbox.service.js +141 -7
- package/dist/skills/catalog.d.ts +4 -4
- package/dist/skills/catalog.js +4 -4
- package/dist/skills/changes.service.d.ts +2 -2
- package/dist/skills/changes.service.js +5 -4
- package/dist/skills/invocation-keys.d.ts +1 -1
- package/dist/skills/invocation-keys.js +1 -1
- package/dist/skills/invoke.d.ts +1 -1
- package/dist/skills/invoke.js +5 -4
- package/dist/tools/approvals.service.d.ts +6 -0
- package/dist/tools/approvals.service.js +21 -1
- package/dist/tools/builtin-names.d.ts +91 -0
- package/dist/tools/builtin-names.js +143 -0
- package/dist/tools/builtins/agent.d.ts +7 -7
- package/dist/tools/builtins/agent.js +7 -11
- package/dist/tools/builtins/ask-user.d.ts +1 -1
- package/dist/tools/builtins/ask-user.js +2 -2
- package/dist/tools/builtins/builtin-tools.d.ts +17 -3
- package/dist/tools/builtins/builtin-tools.js +36 -4
- package/dist/tools/builtins/read-tool-output.d.ts +1 -1
- package/dist/tools/builtins/read-tool-output.js +2 -2
- package/dist/tools/builtins/sandbox/bash.d.ts +4 -4
- package/dist/tools/builtins/sandbox/bash.js +259 -29
- package/dist/tools/builtins/sandbox/common.d.ts +30 -7
- package/dist/tools/builtins/sandbox/common.js +9 -5
- package/dist/tools/builtins/sandbox/deliver.d.ts +1 -1
- package/dist/tools/builtins/sandbox/deliver.js +12 -12
- package/dist/tools/builtins/sandbox/edit.d.ts +1 -1
- package/dist/tools/builtins/sandbox/edit.js +41 -30
- package/dist/tools/builtins/sandbox/file-state.d.ts +34 -0
- package/dist/tools/builtins/sandbox/file-state.js +34 -0
- package/dist/tools/builtins/sandbox/glob-match.d.ts +1 -1
- package/dist/tools/builtins/sandbox/glob-match.js +1 -1
- package/dist/tools/builtins/sandbox/glob.d.ts +1 -1
- package/dist/tools/builtins/sandbox/glob.js +4 -4
- package/dist/tools/builtins/sandbox/grep.d.ts +7 -4
- package/dist/tools/builtins/sandbox/grep.js +147 -30
- package/dist/tools/builtins/sandbox/index.d.ts +3 -1
- package/dist/tools/builtins/sandbox/index.js +7 -1
- package/dist/tools/builtins/sandbox/read.d.ts +2 -2
- package/dist/tools/builtins/sandbox/read.js +21 -14
- package/dist/tools/builtins/sandbox/task-output.d.ts +63 -0
- package/dist/tools/builtins/sandbox/task-output.js +304 -0
- package/dist/tools/builtins/sandbox/task-stop.d.ts +10 -0
- package/dist/tools/builtins/sandbox/task-stop.js +112 -0
- package/dist/tools/builtins/sandbox/write.d.ts +1 -1
- package/dist/tools/builtins/sandbox/write.js +37 -33
- package/dist/tools/builtins/skill-load.d.ts +3 -3
- package/dist/tools/builtins/skill-load.js +32 -16
- package/dist/tools/builtins/skill-write.d.ts +4 -4
- package/dist/tools/builtins/skill-write.js +10 -10
- package/dist/tools/builtins/tool-search.d.ts +13 -9
- package/dist/tools/builtins/tool-search.js +25 -14
- package/dist/tools/builtins/web/errors.d.ts +8 -0
- package/dist/tools/builtins/web/errors.js +53 -0
- package/dist/tools/builtins/web/extract.d.ts +62 -0
- package/dist/tools/builtins/web/extract.js +267 -0
- package/dist/tools/builtins/web/fetch.d.ts +55 -0
- package/dist/tools/builtins/web/fetch.js +174 -0
- package/dist/tools/builtins/web/index.d.ts +13 -0
- package/dist/tools/builtins/web/index.js +12 -0
- package/dist/tools/builtins/web/page-cache.d.ts +25 -0
- package/dist/tools/builtins/web/page-cache.js +77 -0
- package/dist/tools/builtins/web/search.d.ts +25 -0
- package/dist/tools/builtins/web/search.js +209 -0
- package/dist/tools/builtins/web/url.d.ts +17 -0
- package/dist/tools/builtins/web/url.js +43 -0
- package/dist/tools/connectors.service.js +4 -4
- package/dist/tools/display-names.d.ts +9 -0
- package/dist/tools/display-names.js +24 -0
- package/dist/tools/drift.js +5 -5
- package/dist/tools/elicitation.js +1 -1
- package/dist/tools/info.d.ts +20 -4
- package/dist/tools/info.js +55 -32
- package/dist/tools/legacy-data.d.ts +34 -0
- package/dist/tools/legacy-data.js +76 -0
- package/dist/tools/legacy-keys.d.ts +51 -0
- package/dist/tools/legacy-keys.js +115 -0
- package/dist/tools/naming.d.ts +1 -5
- package/dist/tools/naming.js +1 -7
- package/dist/tools/oauth/flow-paths.d.ts +1 -1
- package/dist/tools/oauth/flow-paths.js +1 -1
- package/dist/tools/outputs.js +1 -1
- package/dist/tools/pipeline.d.ts +13 -7
- package/dist/tools/pipeline.js +112 -39
- package/dist/tools/policy.d.ts +1 -14
- package/dist/tools/policy.js +13 -19
- package/dist/tools/questions.controller.d.ts +1 -1
- package/dist/tools/questions.controller.js +1 -1
- package/dist/tools/questions.service.d.ts +1 -1
- package/dist/tools/registry.d.ts +38 -24
- package/dist/tools/registry.js +54 -47
- package/dist/tools/resources.d.ts +1 -1
- package/dist/tools/resources.js +1 -1
- package/dist/tools/tools.module.js +13 -1
- package/dist/tools/validate.js +1 -1
- package/package.json +3 -3
- package/src/migrations/0063_tool_keys_claude_code.sql +220 -0
- package/src/migrations/0064_account_last_org.sql +7 -0
- package/src/migrations/0065_conversation_archive.sql +8 -0
- package/src/migrations/0066_extension_display_name.sql +4 -0
- package/src/migrations/0067_agent_profiles.sql +20 -0
- package/src/migrations/0068_agent_avatar_uploads.sql +7 -0
- package/src/migrations/0069_attachments_agent_idx.sql +3 -0
- package/src/migrations/0070_background_tasks.sql +37 -0
- package/src/migrations/0071_background_tasks_reserve.sql +6 -0
- package/src/migrations/0072_background_tasks_stopping.sql +5 -0
- package/src/migrations/0073_org_extension_point_defaults.sql +11 -0
- package/dist/tools/builtins/sandbox/names.d.ts +0 -7
- package/dist/tools/builtins/sandbox/names.js +0 -20
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { Logger } from "@capybara-hq/plugin-sdk";
|
|
1
|
+
import type { LocalizedName, Logger } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { CatalogRequestsService } from "../catalog/requests.service.js";
|
|
4
4
|
import { ExtensionAdmin } from "../extensions/admin-view.js";
|
|
5
|
+
import { ExtensionDisplayNames } from "../extensions/display-name.js";
|
|
5
6
|
import { type Account, AccountsService } from "../identity/accounts.js";
|
|
6
7
|
import { type Principal } from "../identity/principal.js";
|
|
7
8
|
import { SessionService } from "../identity/sessions.js";
|
|
@@ -82,7 +83,8 @@ export declare class AdminController {
|
|
|
82
83
|
private readonly plugins;
|
|
83
84
|
private readonly registry;
|
|
84
85
|
private readonly catalogRequests;
|
|
85
|
-
|
|
86
|
+
private readonly displayNames;
|
|
87
|
+
constructor(accounts: AccountsService, sessions: SessionService, log: Logger, orgs: OrgsService, settings: SettingsService, prices: PricesService, purposes: ModelPurposesService, plugins: ExtensionAdmin, registry: ProviderRegistry, catalogRequests: CatalogRequestsService, displayNames: ExtensionDisplayNames);
|
|
86
88
|
/** 后台概览的四个数字(只读计数,不含任何对话内容)。 */
|
|
87
89
|
overview(): Promise<AdminOverview>;
|
|
88
90
|
/**
|
|
@@ -110,10 +112,13 @@ export declare class AdminController {
|
|
|
110
112
|
putSettings(principal: Principal, body: z.infer<typeof SettingsSchema>): Promise<DeploymentSettings>;
|
|
111
113
|
/**
|
|
112
114
|
* 模型供应商与模型(后台「模型」页):每个供应商带状态,列模型失败的标 `error`,不影响其他供应商;
|
|
113
|
-
* 一并返回价格表与币种(改价仍走 `PUT /admin/model-prices`)。
|
|
115
|
+
* 一并返回价格表与币种(改价仍走 `PUT /admin/model-prices`)。Each provider carries its extension's
|
|
116
|
+
* display name (null when it has none).
|
|
114
117
|
*/
|
|
115
118
|
getModels(): Promise<{
|
|
116
|
-
providers: ProviderStatus
|
|
119
|
+
providers: (ProviderStatus & {
|
|
120
|
+
displayName: LocalizedName | null;
|
|
121
|
+
})[];
|
|
117
122
|
prices: ModelPrice[];
|
|
118
123
|
currency: string;
|
|
119
124
|
}>;
|
|
@@ -11,6 +11,7 @@ import { Controller, Get, HttpCode, Inject, Param, Patch, Post, Put } from "@nes
|
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { CatalogRequestsService } from "../catalog/requests.service.js";
|
|
13
13
|
import { ExtensionAdmin } from "../extensions/admin-view.js";
|
|
14
|
+
import { ExtensionDisplayNames } from "../extensions/display-name.js";
|
|
14
15
|
import { extensionNeedsAction } from "../extensions/permission-view.js";
|
|
15
16
|
import { AccountsService } from "../identity/accounts.js";
|
|
16
17
|
import { MAX_PASSWORD_LENGTH } from "../identity/login.js";
|
|
@@ -70,7 +71,8 @@ let AdminController = class AdminController {
|
|
|
70
71
|
plugins;
|
|
71
72
|
registry;
|
|
72
73
|
catalogRequests;
|
|
73
|
-
|
|
74
|
+
displayNames;
|
|
75
|
+
constructor(accounts, sessions, log, orgs, settings, prices, purposes, plugins, registry, catalogRequests, displayNames) {
|
|
74
76
|
this.accounts = accounts;
|
|
75
77
|
this.sessions = sessions;
|
|
76
78
|
this.log = log;
|
|
@@ -81,6 +83,7 @@ let AdminController = class AdminController {
|
|
|
81
83
|
this.plugins = plugins;
|
|
82
84
|
this.registry = registry;
|
|
83
85
|
this.catalogRequests = catalogRequests;
|
|
86
|
+
this.displayNames = displayNames;
|
|
84
87
|
}
|
|
85
88
|
/** 后台概览的四个数字(只读计数,不含任何对话内容)。 */
|
|
86
89
|
async overview() {
|
|
@@ -156,14 +159,19 @@ let AdminController = class AdminController {
|
|
|
156
159
|
}
|
|
157
160
|
/**
|
|
158
161
|
* 模型供应商与模型(后台「模型」页):每个供应商带状态,列模型失败的标 `error`,不影响其他供应商;
|
|
159
|
-
* 一并返回价格表与币种(改价仍走 `PUT /admin/model-prices`)。
|
|
162
|
+
* 一并返回价格表与币种(改价仍走 `PUT /admin/model-prices`)。Each provider carries its extension's
|
|
163
|
+
* display name (null when it has none).
|
|
160
164
|
*/
|
|
161
165
|
async getModels() {
|
|
162
166
|
const [providers, prices] = await Promise.all([
|
|
163
167
|
this.registry.listWithStatus(),
|
|
164
168
|
this.getModelPrices(),
|
|
165
169
|
]);
|
|
166
|
-
|
|
170
|
+
const names = await this.displayNames.many(providers.map((p) => p.plugin));
|
|
171
|
+
return {
|
|
172
|
+
providers: providers.map((p) => ({ ...p, displayName: names.get(p.plugin) ?? null })),
|
|
173
|
+
...prices,
|
|
174
|
+
};
|
|
167
175
|
}
|
|
168
176
|
/** 模型价格表(每百万 token)与币种(部署设置 `priceCurrency`)。 */
|
|
169
177
|
async getModelPrices() {
|
|
@@ -250,6 +258,7 @@ AdminController = __decorate([
|
|
|
250
258
|
__param(6, Inject(ModelPurposesService)),
|
|
251
259
|
__param(7, Inject(ExtensionAdmin)),
|
|
252
260
|
__param(8, Inject(ProviderRegistry)),
|
|
253
|
-
__param(9, Inject(CatalogRequestsService))
|
|
261
|
+
__param(9, Inject(CatalogRequestsService)),
|
|
262
|
+
__param(10, Inject(ExtensionDisplayNames))
|
|
254
263
|
], AdminController);
|
|
255
264
|
export { AdminController };
|
|
@@ -15,6 +15,12 @@ declare const InstallSchema: z.ZodObject<{
|
|
|
15
15
|
}, z.core.$strip>;
|
|
16
16
|
declare const ConfigSchema: z.ZodObject<{
|
|
17
17
|
values: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
18
|
+
secretEntries: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
19
|
+
path: z.ZodString;
|
|
20
|
+
key: z.ZodString;
|
|
21
|
+
value: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
+
renameFrom: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strict>>>;
|
|
18
24
|
}, z.core.$strip>;
|
|
19
25
|
declare const NpmSchema: z.ZodObject<{
|
|
20
26
|
package: z.ZodString;
|
|
@@ -57,7 +63,8 @@ export declare class AdminExtensionsController {
|
|
|
57
63
|
* (a value from the startup config) does not block the PUT: it saves anyway, the extension stays
|
|
58
64
|
* pending configuration and the startup config has to change. Every replica re-reads after saving:
|
|
59
65
|
* hot fields are replaced in place, other fields reload the extension, and a pending extension
|
|
60
|
-
* loads (no restart).
|
|
66
|
+
* loads (no restart). `secretEntries` set, rename or remove single keys of a secret record a
|
|
67
|
+
* config UI hint draws per item (a path no hint names -> 400 `validation_failed`).
|
|
61
68
|
*/
|
|
62
69
|
putConfig(principal: Principal, name: string, body: z.infer<typeof ConfigSchema>): Promise<DeploymentConfigView>;
|
|
63
70
|
/**
|
|
@@ -30,9 +30,28 @@ const InstallSchema = z.object({
|
|
|
30
30
|
/** 包存储里的包(上传 / npm 导入返回的 sha256)。 */
|
|
31
31
|
sha256: z.string().regex(/^[0-9a-f]{64}$/),
|
|
32
32
|
});
|
|
33
|
+
const SecretEntrySchema = z
|
|
34
|
+
.object({
|
|
35
|
+
/** A secret record field some `x-ui.secrets[].path` names. */
|
|
36
|
+
path: z.string().min(1).max(256),
|
|
37
|
+
key: z.string().min(1).max(256),
|
|
38
|
+
/** A string sets the key, `null` removes it. */
|
|
39
|
+
value: z.string().max(65_536).nullable().optional(),
|
|
40
|
+
/** Moves the value at this key to `key` first. */
|
|
41
|
+
renameFrom: z.string().min(1).max(256).optional(),
|
|
42
|
+
})
|
|
43
|
+
.strict()
|
|
44
|
+
.refine((e) => e.value !== undefined || e.renameFrom !== undefined, {
|
|
45
|
+
message: "an entry needs value or renameFrom",
|
|
46
|
+
})
|
|
47
|
+
.refine((e) => e.key !== "__proto__" && e.renameFrom !== "__proto__", {
|
|
48
|
+
message: "__proto__ is not a valid key",
|
|
49
|
+
});
|
|
33
50
|
const ConfigSchema = z.object({
|
|
34
51
|
/** 字段点路径 → 新值(`null` 清除)。 */
|
|
35
52
|
values: z.record(z.string().min(1).max(256), z.unknown()),
|
|
53
|
+
/** Single keys of hinted secret records (extension config forms spec §4.3), applied in order. */
|
|
54
|
+
secretEntries: z.array(SecretEntrySchema).max(200).optional(),
|
|
36
55
|
});
|
|
37
56
|
const NpmSchema = z.object({
|
|
38
57
|
package: z.string().min(1).max(214),
|
|
@@ -97,11 +116,12 @@ let AdminExtensionsController = class AdminExtensionsController {
|
|
|
97
116
|
* (a value from the startup config) does not block the PUT: it saves anyway, the extension stays
|
|
98
117
|
* pending configuration and the startup config has to change. Every replica re-reads after saving:
|
|
99
118
|
* hot fields are replaced in place, other fields reload the extension, and a pending extension
|
|
100
|
-
* loads (no restart).
|
|
119
|
+
* loads (no restart). `secretEntries` set, rename or remove single keys of a secret record a
|
|
120
|
+
* config UI hint draws per item (a path no hint names -> 400 `validation_failed`).
|
|
101
121
|
*/
|
|
102
122
|
putConfig(principal, name, body) {
|
|
103
123
|
const actor = requireUser(principal);
|
|
104
|
-
return this.deploymentConfigs.put(name, body.values, actor.account.id, patTokenId(actor));
|
|
124
|
+
return this.deploymentConfigs.put(name, body.values, actor.account.id, patTokenId(actor), body.secretEntries);
|
|
105
125
|
}
|
|
106
126
|
/**
|
|
107
127
|
* Web approval: writes the snapshot (source web), audits `extension.permissions_approved` and
|
|
@@ -2,6 +2,7 @@ import { type ExpressionBuilder } from "kysely";
|
|
|
2
2
|
import type { KernelDatabase, KernelSchemaDb } from "../db/kernel-schema.js";
|
|
3
3
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
4
4
|
import { type AgentDefinition } from "./definition.js";
|
|
5
|
+
import type { AgentProfile } from "./profile.js";
|
|
5
6
|
export declare const AGENT_VISIBILITIES: readonly ["private", "org", "members"];
|
|
6
7
|
export type AgentVisibility = (typeof AGENT_VISIBILITIES)[number];
|
|
7
8
|
/** 对外的 agent 视图:当前版本的定义 + 元数据;`memberIds` 只在 visibility='members' 时为数组。 */
|
|
@@ -12,6 +13,8 @@ export interface AgentView {
|
|
|
12
13
|
visibility: AgentVisibility;
|
|
13
14
|
currentVersion: number;
|
|
14
15
|
definition: AgentDefinition;
|
|
16
|
+
/** Display data outside the versions (never model-visible). */
|
|
17
|
+
profile: AgentProfile;
|
|
15
18
|
memberIds: string[] | null;
|
|
16
19
|
/** 负责人离职后被转给组织所有者、等待管理员重新指派。 */
|
|
17
20
|
needsReassignment: boolean;
|
|
@@ -11,7 +11,8 @@ import { Inject, Injectable, Module } from "@nestjs/common";
|
|
|
11
11
|
import { sql } from "kysely";
|
|
12
12
|
import { ApiError } from "../errors.js";
|
|
13
13
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
14
|
-
import {
|
|
14
|
+
import { loadLegacyScope } from "../tools/legacy-data.js";
|
|
15
|
+
import { needsLegacyScope, normalizeStoredDefinition } from "./definition.js";
|
|
15
16
|
export const AGENT_VISIBILITIES = ["private", "org", "members"];
|
|
16
17
|
const notFound = () => new ApiError("agent.not_found", "Agent not found");
|
|
17
18
|
/**
|
|
@@ -131,6 +132,10 @@ let AgentLookup = class AgentLookup {
|
|
|
131
132
|
"agents.needs_reassignment",
|
|
132
133
|
"agents.created_at",
|
|
133
134
|
"agents.updated_at",
|
|
135
|
+
"agents.profile_avatar",
|
|
136
|
+
"agents.profile_description",
|
|
137
|
+
"agents.profile_quick_actions",
|
|
138
|
+
"agents.profile_updated_at",
|
|
134
139
|
"agent_versions.definition",
|
|
135
140
|
])
|
|
136
141
|
.where("agents.id", "in", ids)
|
|
@@ -142,6 +147,13 @@ let AgentLookup = class AgentLookup {
|
|
|
142
147
|
.orderBy("account_id")
|
|
143
148
|
.execute();
|
|
144
149
|
const byId = new Map(rows.map((r) => [r.id, r]));
|
|
150
|
+
// rc `<x>__<tool>` keys read with their org's scope, loaded once per org that needs it
|
|
151
|
+
const scopes = new Map();
|
|
152
|
+
for (const r of rows) {
|
|
153
|
+
if (!scopes.has(r.org_id) && needsLegacyScope(r.definition)) {
|
|
154
|
+
scopes.set(r.org_id, await loadLegacyScope(this.db.db, r.org_id));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
145
157
|
return ids.flatMap((id) => {
|
|
146
158
|
const r = byId.get(id);
|
|
147
159
|
if (!r)
|
|
@@ -153,7 +165,13 @@ let AgentLookup = class AgentLookup {
|
|
|
153
165
|
ownerAccountId: r.owner_account_id,
|
|
154
166
|
visibility: r.visibility,
|
|
155
167
|
currentVersion: r.current_version,
|
|
156
|
-
definition: normalizeStoredDefinition(r.definition),
|
|
168
|
+
definition: normalizeStoredDefinition(r.definition, scopes.get(r.org_id)),
|
|
169
|
+
profile: {
|
|
170
|
+
avatar: r.profile_avatar,
|
|
171
|
+
description: r.profile_description,
|
|
172
|
+
quickActions: r.profile_quick_actions,
|
|
173
|
+
updatedAt: r.profile_updated_at.toISOString(),
|
|
174
|
+
},
|
|
157
175
|
memberIds: r.visibility === "members"
|
|
158
176
|
? memberRows.filter((m) => m.agent_id === id).map((m) => m.account_id)
|
|
159
177
|
: null,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AttachmentsService } from "../conversations/attachments.service.js";
|
|
2
|
+
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
3
|
+
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
4
|
+
import { AgentLookup } from "./agent-lookup.js";
|
|
5
|
+
import { AgentsService } from "./agents.service.js";
|
|
6
|
+
import type { AgentProfile, ProfileInput } from "./profile.js";
|
|
7
|
+
/**
|
|
8
|
+
* Writes an agent's profile (avatar, description, quick actions): display data stored beside the
|
|
9
|
+
* agent, never model-visible, so a change creates no agent version. The permission is the one of
|
|
10
|
+
* `AgentsService.update` (owner or org admin, checked under the org row lock).
|
|
11
|
+
*/
|
|
12
|
+
export declare class AgentProfileService {
|
|
13
|
+
private readonly db;
|
|
14
|
+
private readonly lookup;
|
|
15
|
+
private readonly agents;
|
|
16
|
+
private readonly attachments;
|
|
17
|
+
readonly txHost: TransactionHost;
|
|
18
|
+
constructor(db: KernelDb, lookup: AgentLookup, agents: Pick<AgentsService, "lockForWrite">, attachments: Pick<AttachmentsService, "prepareAgentAvatar" | "consumeAgentAvatar">, txHost: TransactionHost);
|
|
19
|
+
/**
|
|
20
|
+
* Applies `patch` (only the given fields) when `expectedUpdatedAt` is still the profile's
|
|
21
|
+
* `updatedAt`, else 409 `agent.profile_conflict` (never a silent overwrite). Audit
|
|
22
|
+
* `agent.profile_updated` `{ fields, channel }`: `api` for a personal access token, else `web`.
|
|
23
|
+
* An `upload` avatar must be the actor's own upload that no other agent uses (else 404
|
|
24
|
+
* `attachment.not_found`): it is finalized first (outside the transaction, it reads the object
|
|
25
|
+
* store; 503 `storage.unavailable` without one) and bound to the agent inside it.
|
|
26
|
+
*/
|
|
27
|
+
update(orgId: string, agentId: string, actorAccountId: string, patch: ProfileInput, expectedUpdatedAt: string, actorTokenId?: string): Promise<AgentProfile>;
|
|
28
|
+
private updateIn;
|
|
29
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
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 { Inject, Injectable } from "@nestjs/common";
|
|
11
|
+
import { sql } from "kysely";
|
|
12
|
+
import { AttachmentsService } from "../conversations/attachments.service.js";
|
|
13
|
+
import { ApiError } from "../errors.js";
|
|
14
|
+
import { audit } from "../identity/audit.js";
|
|
15
|
+
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
16
|
+
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
17
|
+
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
18
|
+
import { AgentLookup } from "./agent-lookup.js";
|
|
19
|
+
import { AgentsService } from "./agents.service.js";
|
|
20
|
+
/**
|
|
21
|
+
* Writes an agent's profile (avatar, description, quick actions): display data stored beside the
|
|
22
|
+
* agent, never model-visible, so a change creates no agent version. The permission is the one of
|
|
23
|
+
* `AgentsService.update` (owner or org admin, checked under the org row lock).
|
|
24
|
+
*/
|
|
25
|
+
let AgentProfileService = class AgentProfileService {
|
|
26
|
+
db;
|
|
27
|
+
lookup;
|
|
28
|
+
agents;
|
|
29
|
+
attachments;
|
|
30
|
+
txHost;
|
|
31
|
+
constructor(db, lookup, agents, attachments, txHost) {
|
|
32
|
+
this.db = db;
|
|
33
|
+
this.lookup = lookup;
|
|
34
|
+
this.agents = agents;
|
|
35
|
+
this.attachments = attachments;
|
|
36
|
+
this.txHost = txHost;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Applies `patch` (only the given fields) when `expectedUpdatedAt` is still the profile's
|
|
40
|
+
* `updatedAt`, else 409 `agent.profile_conflict` (never a silent overwrite). Audit
|
|
41
|
+
* `agent.profile_updated` `{ fields, channel }`: `api` for a personal access token, else `web`.
|
|
42
|
+
* An `upload` avatar must be the actor's own upload that no other agent uses (else 404
|
|
43
|
+
* `attachment.not_found`): it is finalized first (outside the transaction, it reads the object
|
|
44
|
+
* store; 503 `storage.unavailable` without one) and bound to the agent inside it.
|
|
45
|
+
*/
|
|
46
|
+
async update(orgId, agentId, actorAccountId, patch, expectedUpdatedAt, actorTokenId) {
|
|
47
|
+
if (patch.avatar?.kind === "upload") {
|
|
48
|
+
await this.attachments.prepareAgentAvatar(orgId, actorAccountId, patch.avatar.uploadId, agentId);
|
|
49
|
+
}
|
|
50
|
+
return this.updateIn(orgId, agentId, actorAccountId, patch, expectedUpdatedAt, actorTokenId);
|
|
51
|
+
}
|
|
52
|
+
async updateIn(orgId, agentId, actorAccountId, patch, expectedUpdatedAt, actorTokenId) {
|
|
53
|
+
const t = this.db.db;
|
|
54
|
+
await this.agents.lockForWrite(orgId, agentId, actorAccountId);
|
|
55
|
+
const current = await t
|
|
56
|
+
.selectFrom("agents")
|
|
57
|
+
.select(sql `to_char(profile_updated_at at time zone 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"')`.as("at"))
|
|
58
|
+
.where("id", "=", agentId)
|
|
59
|
+
.executeTakeFirstOrThrow();
|
|
60
|
+
if (current.at !== expectedUpdatedAt) {
|
|
61
|
+
throw new ApiError("agent.profile_conflict", "The profile was changed by someone else; reload it and apply your changes again");
|
|
62
|
+
}
|
|
63
|
+
if (patch.avatar?.kind === "upload") {
|
|
64
|
+
await this.attachments.consumeAgentAvatar(orgId, actorAccountId, patch.avatar.uploadId, agentId);
|
|
65
|
+
}
|
|
66
|
+
const fields = ["avatar", "description", "quickActions"].filter((f) => patch[f] !== undefined);
|
|
67
|
+
// nothing to write: no timestamp bump, no audit row
|
|
68
|
+
if (fields.length === 0)
|
|
69
|
+
return (await this.lookup.view(agentId)).profile;
|
|
70
|
+
await t
|
|
71
|
+
.updateTable("agents")
|
|
72
|
+
.set({
|
|
73
|
+
...(patch.avatar !== undefined && {
|
|
74
|
+
profile_avatar: patch.avatar === null ? sql `null` : JSON.stringify(patch.avatar),
|
|
75
|
+
}),
|
|
76
|
+
...(patch.description !== undefined && { profile_description: patch.description }),
|
|
77
|
+
...(patch.quickActions !== undefined && {
|
|
78
|
+
profile_quick_actions: JSON.stringify(patch.quickActions),
|
|
79
|
+
}),
|
|
80
|
+
profile_updated_at: sql `greatest(date_trunc('milliseconds', now()), profile_updated_at + interval '1 millisecond')`,
|
|
81
|
+
})
|
|
82
|
+
.where("id", "=", agentId)
|
|
83
|
+
.execute();
|
|
84
|
+
if (patch.avatar !== undefined) {
|
|
85
|
+
// the avatar changed: every other upload bound to this agent is garbage; the cleanup job
|
|
86
|
+
// deletes it (and its object) once expired. Re-saving the same upload keeps it.
|
|
87
|
+
await t
|
|
88
|
+
.updateTable("attachments")
|
|
89
|
+
.set({ expires_at: sql `now()` })
|
|
90
|
+
.where("agent_id", "=", agentId)
|
|
91
|
+
.where("purpose", "=", "agent-avatar")
|
|
92
|
+
.$if(patch.avatar?.kind === "upload", (q) => q.where("id", "<>", patch.avatar.uploadId))
|
|
93
|
+
.execute();
|
|
94
|
+
}
|
|
95
|
+
await audit(t, {
|
|
96
|
+
actorAccountId,
|
|
97
|
+
...(actorTokenId !== undefined && { actorTokenId }),
|
|
98
|
+
orgId,
|
|
99
|
+
action: "agent.profile_updated",
|
|
100
|
+
target: agentId,
|
|
101
|
+
detail: { fields, channel: actorTokenId !== undefined ? "api" : "web" },
|
|
102
|
+
});
|
|
103
|
+
return (await this.lookup.view(agentId)).profile;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
__decorate([
|
|
107
|
+
Transactional()
|
|
108
|
+
], AgentProfileService.prototype, "updateIn", null);
|
|
109
|
+
AgentProfileService = __decorate([
|
|
110
|
+
Injectable(),
|
|
111
|
+
__param(0, Inject(KernelDb)),
|
|
112
|
+
__param(1, Inject(AgentLookup)),
|
|
113
|
+
__param(2, Inject(AgentsService)),
|
|
114
|
+
__param(3, Inject(AttachmentsService)),
|
|
115
|
+
__param(4, Inject(TransactionHost))
|
|
116
|
+
], AgentProfileService);
|
|
117
|
+
export { AgentProfileService };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type { FastifyReply } from "fastify";
|
|
1
2
|
import { z } from "zod";
|
|
3
|
+
import { AttachmentsService, type CreatedAttachment } from "../conversations/attachments.service.js";
|
|
2
4
|
import { type Principal } from "../identity/principal.js";
|
|
3
5
|
import { type OrgContext } from "../orgs/org.guard.js";
|
|
6
|
+
import { AgentProfileService } from "./agent-profile.service.js";
|
|
4
7
|
import { AgentsService, type AgentVersionSummary, type AgentView, type AgentWarning } from "./agents.service.js";
|
|
8
|
+
import { type AgentProfile } from "./profile.js";
|
|
5
9
|
declare const OwnerBody: z.ZodObject<{
|
|
6
10
|
accountId: z.ZodString;
|
|
7
11
|
}, z.core.$strict>;
|
|
@@ -9,7 +13,10 @@ declare const CreateBody: z.ZodObject<{
|
|
|
9
13
|
definition: z.ZodObject<{
|
|
10
14
|
name: z.ZodString;
|
|
11
15
|
avatarUrl: z.ZodDefault<z.ZodNullable<z.ZodURL>>;
|
|
12
|
-
|
|
16
|
+
instructionFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
content: z.ZodString;
|
|
19
|
+
}, z.core.$strict>>>;
|
|
13
20
|
model: z.ZodObject<{
|
|
14
21
|
provider: z.ZodString;
|
|
15
22
|
model: z.ZodString;
|
|
@@ -68,6 +75,7 @@ declare const CreateBody: z.ZodObject<{
|
|
|
68
75
|
}, z.core.$strict>>>;
|
|
69
76
|
dispatchable: z.ZodOptional<z.ZodBoolean>;
|
|
70
77
|
}, z.core.$strict>>;
|
|
78
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
71
79
|
tools: z.ZodDefault<z.ZodArray<z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
72
80
|
kind: z.ZodLiteral<"builtin">;
|
|
73
81
|
name: z.ZodString;
|
|
@@ -87,12 +95,75 @@ declare const CreateBody: z.ZodObject<{
|
|
|
87
95
|
private: "private";
|
|
88
96
|
}>;
|
|
89
97
|
memberIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
98
|
+
profile: z.ZodOptional<z.ZodObject<{
|
|
99
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
100
|
+
kind: z.ZodLiteral<"preset">;
|
|
101
|
+
id: z.ZodEnum<{
|
|
102
|
+
"black-bear": "black-bear";
|
|
103
|
+
capybara: "capybara";
|
|
104
|
+
elephant: "elephant";
|
|
105
|
+
fox: "fox";
|
|
106
|
+
owl: "owl";
|
|
107
|
+
panda: "panda";
|
|
108
|
+
penguin: "penguin";
|
|
109
|
+
rabbit: "rabbit";
|
|
110
|
+
turtle: "turtle";
|
|
111
|
+
whale: "whale";
|
|
112
|
+
}>;
|
|
113
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
114
|
+
kind: z.ZodLiteral<"upload">;
|
|
115
|
+
uploadId: z.ZodString;
|
|
116
|
+
}, z.core.$strict>], "kind">>>;
|
|
117
|
+
description: z.ZodOptional<z.ZodString>;
|
|
118
|
+
quickActions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
119
|
+
title: z.ZodString;
|
|
120
|
+
body: z.ZodString;
|
|
121
|
+
}, z.core.$strict>>>;
|
|
122
|
+
}, z.core.$strict>>;
|
|
123
|
+
}, z.core.$strict>;
|
|
124
|
+
declare const ProfileBody: z.ZodObject<{
|
|
125
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
126
|
+
kind: z.ZodLiteral<"preset">;
|
|
127
|
+
id: z.ZodEnum<{
|
|
128
|
+
"black-bear": "black-bear";
|
|
129
|
+
capybara: "capybara";
|
|
130
|
+
elephant: "elephant";
|
|
131
|
+
fox: "fox";
|
|
132
|
+
owl: "owl";
|
|
133
|
+
panda: "panda";
|
|
134
|
+
penguin: "penguin";
|
|
135
|
+
rabbit: "rabbit";
|
|
136
|
+
turtle: "turtle";
|
|
137
|
+
whale: "whale";
|
|
138
|
+
}>;
|
|
139
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
140
|
+
kind: z.ZodLiteral<"upload">;
|
|
141
|
+
uploadId: z.ZodString;
|
|
142
|
+
}, z.core.$strict>], "kind">>>;
|
|
143
|
+
description: z.ZodOptional<z.ZodString>;
|
|
144
|
+
quickActions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
145
|
+
title: z.ZodString;
|
|
146
|
+
body: z.ZodString;
|
|
147
|
+
}, z.core.$strict>>>;
|
|
148
|
+
expectedUpdatedAt: z.ZodString;
|
|
149
|
+
}, z.core.$strict>;
|
|
150
|
+
declare const AvatarUploadBody: z.ZodObject<{
|
|
151
|
+
name: z.ZodString;
|
|
152
|
+
contentType: z.ZodEnum<{
|
|
153
|
+
"image/jpeg": "image/jpeg";
|
|
154
|
+
"image/png": "image/png";
|
|
155
|
+
"image/webp": "image/webp";
|
|
156
|
+
}>;
|
|
157
|
+
size: z.ZodNumber;
|
|
90
158
|
}, z.core.$strict>;
|
|
91
159
|
declare const UpdateBody: z.ZodObject<{
|
|
92
160
|
definition: z.ZodOptional<z.ZodObject<{
|
|
93
161
|
name: z.ZodString;
|
|
94
162
|
avatarUrl: z.ZodDefault<z.ZodNullable<z.ZodURL>>;
|
|
95
|
-
|
|
163
|
+
instructionFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
164
|
+
name: z.ZodString;
|
|
165
|
+
content: z.ZodString;
|
|
166
|
+
}, z.core.$strict>>>;
|
|
96
167
|
model: z.ZodObject<{
|
|
97
168
|
provider: z.ZodString;
|
|
98
169
|
model: z.ZodString;
|
|
@@ -163,6 +234,7 @@ declare const UpdateBody: z.ZodObject<{
|
|
|
163
234
|
}, z.core.$strict>>>;
|
|
164
235
|
dispatchable: z.ZodOptional<z.ZodBoolean>;
|
|
165
236
|
}, z.core.$strict>>;
|
|
237
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
166
238
|
}, z.core.$strip>>;
|
|
167
239
|
visibility: z.ZodOptional<z.ZodEnum<{
|
|
168
240
|
members: "members";
|
|
@@ -178,7 +250,9 @@ declare const UpdateBody: z.ZodObject<{
|
|
|
178
250
|
*/
|
|
179
251
|
export declare class AgentsController {
|
|
180
252
|
private readonly agents;
|
|
181
|
-
|
|
253
|
+
private readonly profiles;
|
|
254
|
+
private readonly attachments;
|
|
255
|
+
constructor(agents: AgentsService, profiles: AgentProfileService, attachments: AttachmentsService);
|
|
182
256
|
create(principal: Principal, org: OrgContext, body: z.infer<typeof CreateBody>): Promise<{
|
|
183
257
|
agent: AgentView;
|
|
184
258
|
warnings: AgentWarning[];
|
|
@@ -193,6 +267,22 @@ export declare class AgentsController {
|
|
|
193
267
|
agent: AgentView;
|
|
194
268
|
warnings: AgentWarning[];
|
|
195
269
|
}>;
|
|
270
|
+
/** Display data only: no agent version. Same permission as `PATCH :agentId`. */
|
|
271
|
+
updateProfile(principal: Principal, org: OrgContext, agentId: string, body: z.infer<typeof ProfileBody>): Promise<{
|
|
272
|
+
profile: AgentProfile;
|
|
273
|
+
}>;
|
|
274
|
+
/**
|
|
275
|
+
* Registers an avatar image upload (presigned, like chat attachments and skill packages): the
|
|
276
|
+
* browser uploads straight to the object store, then saves `{ kind: "upload", uploadId }` with
|
|
277
|
+
* the profile PATCH, which finalizes it. 503 `storage.unavailable` without an object store.
|
|
278
|
+
*/
|
|
279
|
+
createAvatarUpload(principal: Principal, org: OrgContext, agentId: string, body: z.infer<typeof AvatarUploadBody>): Promise<CreatedAttachment>;
|
|
280
|
+
/**
|
|
281
|
+
* The avatar image: 302 to a short-lived presigned URL for an upload avatar, or to the stored
|
|
282
|
+
* URL of an external avatar when it is https; 404 for presets, no avatar, or an agent the
|
|
283
|
+
* reader cannot see.
|
|
284
|
+
*/
|
|
285
|
+
avatar(principal: Principal, org: OrgContext, agentId: string, reply: FastifyReply): Promise<void>;
|
|
196
286
|
remove(principal: Principal, org: OrgContext, agentId: string): Promise<void>;
|
|
197
287
|
/** 重新指派负责人(admin,如负责人离职后);清除 `needsReassignment`。 */
|
|
198
288
|
reassign(principal: Principal, org: OrgContext, agentId: string, body: z.infer<typeof OwnerBody>): Promise<{
|