@capybara-hq/kernel 0.1.0-rc.21 → 0.1.0-rc.23
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 +3 -3
- package/dist/admin/admin.controller.js +6 -2
- package/dist/admin/admin.schemas.d.ts +13 -0
- package/dist/agents/admin-agents.d.ts +16 -3
- package/dist/agents/admin-agents.js +65 -7
- package/dist/agents/agents.schemas.d.ts +24 -6
- package/dist/agents/agents.service.d.ts +4 -3
- package/dist/agents/agents.service.js +39 -26
- package/dist/agents/definition.d.ts +44 -6
- package/dist/agents/definition.js +86 -18
- package/dist/agents/from-template.d.ts +6 -3
- package/dist/agents/from-template.js +57 -44
- package/dist/agents/org-templates.js +97 -41
- package/dist/agents/templates.d.ts +6 -0
- package/dist/agents/templates.js +15 -1
- package/dist/background/launch.d.ts +43 -5
- package/dist/background/launch.js +88 -8
- package/dist/background/session.d.ts +14 -2
- package/dist/background/session.js +26 -4
- package/dist/background/status.d.ts +1 -1
- package/dist/background/status.js +3 -3
- package/dist/background/stop.d.ts +0 -2
- package/dist/background/stop.js +1 -21
- package/dist/catalog/admin-catalog.controller.d.ts +2 -4
- package/dist/catalog/admin-catalog.controller.js +2 -6
- package/dist/catalog/catalog-content.d.ts +5 -0
- package/dist/catalog/catalog-content.js +1 -0
- package/dist/catalog/catalog.module.js +3 -0
- package/dist/catalog/claude/report.d.ts +9 -2
- package/dist/catalog/claude/report.js +1 -0
- package/dist/catalog/claude/translate.js +1 -1
- package/dist/catalog/component-promotion.js +1 -2
- package/dist/catalog/component-state.d.ts +13 -1
- package/dist/catalog/component-state.js +14 -5
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/marketplaces.service.js +2 -1
- package/dist/catalog/org-catalog.controller.d.ts +13 -3
- package/dist/catalog/org-catalog.controller.js +26 -4
- package/dist/catalog/org-catalog.schemas.d.ts +13 -0
- package/dist/catalog/org-catalog.schemas.js +34 -0
- package/dist/catalog/org-plugin-uploads.controller.js +0 -1
- package/dist/catalog/org-plugin-uploads.d.ts +0 -1
- package/dist/catalog/org-plugin-uploads.js +0 -3
- package/dist/catalog/org-plugin-uploads.schemas.d.ts +0 -1
- package/dist/catalog/org-plugin-uploads.schemas.js +0 -2
- package/dist/catalog/platform-components.d.ts +0 -1
- package/dist/catalog/platform-components.js +3 -8
- package/dist/catalog/plugin-import.d.ts +0 -8
- package/dist/catalog/plugin-import.js +4 -35
- package/dist/catalog/plugin-install.d.ts +2 -2
- package/dist/catalog/plugin-install.js +2 -2
- package/dist/catalog/plugin-package.d.ts +7 -0
- package/dist/catalog/plugin-package.js +27 -1
- package/dist/catalog/plugin-upgrade.d.ts +5 -6
- package/dist/catalog/plugin-upgrade.js +5 -23
- package/dist/catalog/requests.service.d.ts +66 -10
- package/dist/catalog/requests.service.js +196 -15
- package/dist/channels/actions.d.ts +2 -0
- package/dist/channels/actions.js +19 -4
- package/dist/channels/cards.d.ts +16 -2
- package/dist/channels/cards.js +40 -7
- package/dist/channels/channels.module.js +3 -0
- package/dist/channels/outbound.d.ts +22 -1
- package/dist/channels/outbound.js +116 -7
- package/dist/channels/phrases.d.ts +25 -0
- package/dist/channels/phrases.js +19 -0
- package/dist/channels/threads.d.ts +12 -0
- package/dist/channels/threads.js +34 -0
- package/dist/config/schema.d.ts +23 -1
- package/dist/config/schema.js +107 -5
- package/dist/conversations/conversations.service.d.ts +42 -9
- package/dist/conversations/conversations.service.js +57 -25
- package/dist/conversations/events.d.ts +106 -11
- package/dist/conversations/events.js +121 -18
- package/dist/conversations/message-context.d.ts +6 -3
- package/dist/conversations/message-context.js +14 -10
- package/dist/conversations/queue.d.ts +15 -2
- package/dist/conversations/queue.js +22 -3
- package/dist/conversations/queue.service.d.ts +12 -6
- package/dist/conversations/queue.service.js +36 -13
- package/dist/db/kernel-schema.d.ts +105 -3
- package/dist/devices/conversation-devices.d.ts +8 -1
- package/dist/devices/conversation-devices.js +8 -0
- package/dist/devices/devices.controller.d.ts +21 -4
- package/dist/devices/devices.controller.js +46 -8
- package/dist/devices/devices.schemas.d.ts +9 -1
- package/dist/devices/devices.schemas.js +11 -3
- package/dist/devices/devices.service.d.ts +176 -4
- package/dist/devices/devices.service.js +347 -6
- package/dist/devices/dto.d.ts +56 -3
- package/dist/devices/dto.js +51 -1
- package/dist/devices/public-suffix.d.ts +6 -0
- package/dist/devices/public-suffix.js +79 -0
- package/dist/errors.d.ts +50 -5
- package/dist/errors.js +50 -5
- package/dist/evals/reconstruct.d.ts +18 -13
- package/dist/evals/reconstruct.js +50 -36
- package/dist/evals/recorded-tools.d.ts +7 -7
- package/dist/evals/recorded-tools.js +4 -3
- package/dist/evals/trajectory.d.ts +6 -1
- package/dist/evals/trajectory.js +7 -0
- package/dist/extensions/package.js +2 -2
- package/dist/http/api.module.js +5 -0
- package/dist/identity/settings.d.ts +53 -3
- package/dist/identity/settings.js +92 -9
- package/dist/inbox/inbox.module.js +2 -1
- package/dist/inbox/inbox.service.d.ts +19 -4
- package/dist/inbox/inbox.service.js +14 -3
- package/dist/infra/config/kernel-config.service.d.ts +7 -0
- package/dist/infra/config/kernel-config.service.js +31 -0
- package/dist/infra/events/kernel-events.d.ts +2 -1
- package/dist/local-devices/device-policy.service.d.ts +65 -0
- package/dist/local-devices/device-policy.service.js +217 -0
- package/dist/local-devices/local-device-gateway.d.ts +4 -2
- package/dist/local-devices/local-device-gateway.js +39 -11
- package/dist/local-devices/local-device-provider.d.ts +40 -3
- package/dist/local-devices/local-device-provider.js +109 -7
- package/dist/local-devices/local-devices.module.d.ts +2 -1
- package/dist/local-devices/local-devices.module.js +19 -3
- package/dist/local-devices/machines.d.ts +30 -3
- package/dist/local-devices/machines.js +79 -3
- package/dist/local-devices/network-grants.d.ts +104 -0
- package/dist/local-devices/network-grants.js +288 -0
- package/dist/local-devices/policy-summary.d.ts +20 -0
- package/dist/local-devices/policy-summary.js +63 -0
- package/dist/orgs/orgs.module.js +4 -10
- package/dist/orgs/roles.d.ts +1 -1
- package/dist/orgs/roles.js +4 -0
- package/dist/orgs/settings.controller.js +4 -3
- package/dist/orgs/settings.service.d.ts +172 -14
- package/dist/orgs/settings.service.js +229 -27
- package/dist/platform/exclusions.js +11 -1
- package/dist/platform/operation.js +4 -0
- package/dist/platform/ops/admin-items.ops.js +1 -1
- package/dist/platform/ops/admin.ops.js +32 -7
- package/dist/platform/ops/agent-skills.ops.js +2 -2
- package/dist/platform/ops/agent-templates.ops.js +2 -2
- package/dist/platform/ops/agents.ops.js +11 -15
- package/dist/platform/ops/devices.ops.js +3 -1
- package/dist/platform/ops/inbox.ops.js +19 -0
- package/dist/platform/ops/org-settings.ops.js +15 -6
- package/dist/platform/ops/orgs.ops.js +1 -0
- package/dist/platform/ops/platform.ops.d.ts +9 -1
- package/dist/platform/ops/platform.ops.js +34 -12
- package/dist/platform/ops/requests.ops.js +3 -2
- package/dist/platform/ops/schedules.ops.d.ts +21 -0
- package/dist/platform/ops/schedules.ops.js +470 -0
- package/dist/platform/ops/skills.ops.js +3 -3
- 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 +3 -0
- package/dist/roles/worker.module.js +3 -0
- package/dist/runtime/context/build.js +13 -4
- package/dist/runtime/context/compaction.js +6 -3
- package/dist/runtime/context/device-paths.d.ts +43 -21
- package/dist/runtime/context/device-paths.js +104 -21
- package/dist/runtime/context/run-context.d.ts +9 -0
- package/dist/runtime/context/run-context.js +8 -0
- package/dist/runtime/context/skills.d.ts +14 -1
- package/dist/runtime/context/skills.js +36 -5
- package/dist/runtime/maintenance.d.ts +4 -2
- package/dist/runtime/maintenance.js +16 -5
- package/dist/runtime/run-finish.d.ts +6 -1
- package/dist/runtime/run-finish.js +16 -2
- package/dist/runtime/run-queue.js +21 -2
- package/dist/runtime/run-worker.js +14 -33
- package/dist/runtime/runtime.module.js +3 -0
- package/dist/runtime/subagents/definition.d.ts +32 -14
- package/dist/runtime/subagents/definition.js +106 -109
- package/dist/runtime/subagents/dispatch.js +4 -3
- package/dist/runtime/subagents/preamble.d.ts +2 -1
- package/dist/runtime/subagents/preamble.js +2 -1
- package/dist/runtime/waits.js +14 -4
- package/dist/sandbox/platform-tiers.d.ts +86 -0
- package/dist/sandbox/platform-tiers.js +97 -0
- package/dist/sandbox/sandbox.service.d.ts +121 -11
- package/dist/sandbox/sandbox.service.js +351 -30
- package/dist/sandbox/tiers.d.ts +98 -0
- package/dist/sandbox/tiers.js +104 -0
- package/dist/schedules/effective-settings.d.ts +16 -0
- package/dist/schedules/effective-settings.js +17 -0
- package/dist/schedules/errors.d.ts +8 -0
- package/dist/schedules/errors.js +8 -0
- package/dist/schedules/fire.d.ts +118 -0
- package/dist/schedules/fire.js +625 -0
- package/dist/schedules/grant-rules.d.ts +94 -0
- package/dist/schedules/grant-rules.js +126 -0
- package/dist/schedules/job-ids.d.ts +32 -0
- package/dist/schedules/job-ids.js +27 -0
- package/dist/schedules/pause.d.ts +9 -0
- package/dist/schedules/pause.js +33 -0
- package/dist/schedules/run-tracker.d.ts +81 -0
- package/dist/schedules/run-tracker.js +333 -0
- package/dist/schedules/scan.job.d.ts +64 -0
- package/dist/schedules/scan.job.js +303 -0
- package/dist/schedules/schedule-math.d.ts +31 -0
- package/dist/schedules/schedule-math.js +223 -0
- package/dist/schedules/scheduled-tasks.service.d.ts +351 -0
- package/dist/schedules/scheduled-tasks.service.js +1193 -0
- package/dist/schedules/schedules.controller.d.ts +68 -0
- package/dist/schedules/schedules.controller.js +242 -0
- package/dist/schedules/schedules.module.d.ts +16 -0
- package/dist/schedules/schedules.module.js +65 -0
- package/dist/schedules/schedules.schemas.d.ts +316 -0
- package/dist/schedules/schedules.schemas.js +186 -0
- package/dist/schedules/store.d.ts +81 -0
- package/dist/schedules/store.js +390 -0
- package/dist/schedules/store.module.d.ts +6 -0
- package/dist/schedules/store.module.js +21 -0
- package/dist/schedules/types.d.ts +108 -0
- package/dist/schedules/types.js +1 -0
- package/dist/schedules/unattended.d.ts +117 -0
- package/dist/schedules/unattended.js +228 -0
- package/dist/setup/oauth-token-probe.js +8 -4
- package/dist/skills/agent-skills.service.d.ts +4 -8
- package/dist/skills/agent-skills.service.js +18 -53
- package/dist/skills/catalog.d.ts +65 -62
- package/dist/skills/catalog.js +109 -206
- package/dist/skills/conversation-catalog.d.ts +3 -3
- package/dist/skills/conversation-catalog.js +5 -12
- package/dist/skills/invoke.d.ts +2 -2
- package/dist/skills/skills.controller.d.ts +3 -1
- package/dist/skills/skills.service.d.ts +38 -37
- package/dist/skills/skills.service.js +168 -107
- package/dist/skills/usable.d.ts +57 -8
- package/dist/skills/usable.js +172 -38
- package/dist/tools/approvals.controller.d.ts +4 -2
- package/dist/tools/approvals.controller.js +17 -2
- package/dist/tools/approvals.schemas.d.ts +1 -0
- package/dist/tools/approvals.schemas.js +3 -1
- package/dist/tools/approvals.service.d.ts +182 -7
- package/dist/tools/approvals.service.js +597 -13
- package/dist/tools/builtin-names.d.ts +25 -4
- package/dist/tools/builtin-names.js +45 -4
- package/dist/tools/builtins/builtin-tools.d.ts +8 -0
- package/dist/tools/builtins/builtin-tools.js +23 -2
- package/dist/tools/builtins/sandbox/bash.js +16 -7
- package/dist/tools/builtins/sandbox/common.d.ts +1 -1
- package/dist/tools/builtins/sandbox/common.js +33 -10
- package/dist/tools/builtins/sandbox/edit.js +7 -3
- package/dist/tools/builtins/sandbox/file-state.d.ts +31 -1
- package/dist/tools/builtins/sandbox/file-state.js +33 -3
- package/dist/tools/builtins/sandbox/write.js +8 -4
- package/dist/tools/builtins/schedules.d.ts +107 -0
- package/dist/tools/builtins/schedules.js +789 -0
- package/dist/tools/elicitation.d.ts +2 -0
- package/dist/tools/elicitation.js +1 -1
- package/dist/tools/fixed-ask.d.ts +7 -0
- package/dist/tools/fixed-ask.js +9 -0
- package/dist/tools/network-asks.d.ts +109 -0
- package/dist/tools/network-asks.js +221 -0
- package/dist/tools/pipeline.d.ts +53 -6
- package/dist/tools/pipeline.js +202 -13
- package/dist/tools/policy.d.ts +21 -8
- package/dist/tools/policy.js +63 -9
- package/dist/tools/registry.d.ts +10 -1
- package/dist/tools/tools.module.js +12 -0
- package/package.json +2 -2
- package/src/migrations/0113_scheduled_tasks.sql +108 -0
- package/src/migrations/0114_network_asks.sql +23 -0
- package/src/migrations/0115_network_requests.sql +28 -0
- package/src/migrations/0116_skills_default_on.sql +37 -0
- package/src/migrations/0117_sandbox_tiers.sql +11 -0
|
@@ -5,7 +5,7 @@ import { PluginIcons } from "../extensions/plugin-icons.js";
|
|
|
5
5
|
import { type Account, AccountsService } from "../identity/accounts.js";
|
|
6
6
|
import { type Principal } from "../identity/principal.js";
|
|
7
7
|
import { SessionService } from "../identity/sessions.js";
|
|
8
|
-
import { type
|
|
8
|
+
import { type DeploymentSettingsView, SettingsService } from "../identity/settings.js";
|
|
9
9
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
10
10
|
import { type ModelDisabledPatch, type ModelProviderParams } from "../models/enablement.controller.js";
|
|
11
11
|
import { type ModelDisableResult, ModelEnablement } from "../models/enablement.js";
|
|
@@ -67,8 +67,8 @@ export declare class AdminController {
|
|
|
67
67
|
orgMembers({ orgId }: z.infer<typeof AdminOrgParams>): Promise<{
|
|
68
68
|
members: Member[];
|
|
69
69
|
}>;
|
|
70
|
-
getSettings(): Promise<
|
|
71
|
-
putSettings(principal: Principal, body: z.infer<typeof DeploymentSettingsBody>): Promise<
|
|
70
|
+
getSettings(): Promise<DeploymentSettingsView>;
|
|
71
|
+
putSettings(principal: Principal, body: z.infer<typeof DeploymentSettingsBody>): Promise<DeploymentSettingsView>;
|
|
72
72
|
/**
|
|
73
73
|
* 模型供应商与模型(后台「模型」页):每个供应商带状态,列模型失败的标 `error`,不影响其他供应商;
|
|
74
74
|
* 一并返回价格表与币种(改价仍走 `PUT /admin/model-prices`)。Each provider carries its extension's
|
|
@@ -142,11 +142,15 @@ let AdminController = class AdminController {
|
|
|
142
142
|
return { members: await this.members.list(orgId) };
|
|
143
143
|
}
|
|
144
144
|
async getSettings() {
|
|
145
|
-
return this.settings.
|
|
145
|
+
return this.settings.view();
|
|
146
146
|
}
|
|
147
147
|
async putSettings(principal, body) {
|
|
148
148
|
const actor = requireUser(principal);
|
|
149
|
-
|
|
149
|
+
const tokenId = patTokenId(actor);
|
|
150
|
+
// an API token may lower the platform's sandbox tiers, never raise them (dev tiers spec §2)
|
|
151
|
+
return this.settings.update(body, actor.account.id, tokenId, undefined, {
|
|
152
|
+
onlyNarrows: tokenId !== undefined,
|
|
153
|
+
});
|
|
150
154
|
}
|
|
151
155
|
/**
|
|
152
156
|
* 模型供应商与模型(后台「模型」页):每个供应商带状态,列模型失败的标 `error`,不影响其他供应商;
|
|
@@ -58,6 +58,19 @@ export declare const DeploymentSettingsBody: z.ZodObject<{
|
|
|
58
58
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
59
59
|
disabled: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
60
60
|
}, z.core.$strict>>;
|
|
61
|
+
sandboxTiers: z.ZodOptional<z.ZodObject<{
|
|
62
|
+
max: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
63
|
+
dev: "dev";
|
|
64
|
+
open: "open";
|
|
65
|
+
strict: "strict";
|
|
66
|
+
}>>>;
|
|
67
|
+
default: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
68
|
+
dev: "dev";
|
|
69
|
+
open: "open";
|
|
70
|
+
strict: "strict";
|
|
71
|
+
}>>>;
|
|
72
|
+
allowUnsandboxed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
73
|
+
}, z.core.$strict>>;
|
|
61
74
|
}, z.core.$strict>;
|
|
62
75
|
export declare const PurposeParams: z.ZodObject<{
|
|
63
76
|
purpose: z.ZodString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
2
2
|
import { AgentLookup, type AgentVisibility } from "./agent-lookup.js";
|
|
3
|
-
import type
|
|
3
|
+
import { type AgentDefinition } from "./definition.js";
|
|
4
4
|
import type { AgentAvatar } from "./profile.js";
|
|
5
5
|
/** One row of the super admin's cross-org agent list (admin agents spec §3.2). */
|
|
6
6
|
export interface AdminAgentRow {
|
|
@@ -18,6 +18,11 @@ export interface AdminAgentRow {
|
|
|
18
18
|
templateId: string;
|
|
19
19
|
name: string | null;
|
|
20
20
|
} | null;
|
|
21
|
+
/**
|
|
22
|
+
* How many of the skills on in the org it turns off (skills default-on spec §11): a builtin
|
|
23
|
+
* plugin's skill and an org skill it shared never count, as it always has them.
|
|
24
|
+
*/
|
|
25
|
+
skillsOff: number;
|
|
21
26
|
updatedAt: Date;
|
|
22
27
|
}
|
|
23
28
|
/**
|
|
@@ -38,8 +43,9 @@ export interface AdminAgentDetail extends AdminAgentRow {
|
|
|
38
43
|
versions: number;
|
|
39
44
|
createdAt: Date;
|
|
40
45
|
/**
|
|
41
|
-
* The skills it
|
|
42
|
-
*
|
|
46
|
+
* The skills it has now by name (skills default-on spec §3): every skill on in the org that its
|
|
47
|
+
* `disabledSkills` does not turn off, the org skills it shared and its own skills
|
|
48
|
+
* (`scope: "agent"`). Never a skill body.
|
|
43
49
|
*/
|
|
44
50
|
skills: {
|
|
45
51
|
id: string;
|
|
@@ -82,6 +88,13 @@ export declare class AdminAgents {
|
|
|
82
88
|
}>;
|
|
83
89
|
/** One live agent of a live org; otherwise `agent.not_found`. */
|
|
84
90
|
get(agentId: string): Promise<AdminAgentDetail>;
|
|
91
|
+
/**
|
|
92
|
+
* How many of the org's skills each agent turns off, by agent id (agents turning none off are
|
|
93
|
+
* left out): the org's usable skills are resolved once per org, then matched against each
|
|
94
|
+
* agent's `disabledSkills` by the rule of `agentSkills` (a builtin plugin's skill and an org
|
|
95
|
+
* skill the agent shared are never off).
|
|
96
|
+
*/
|
|
97
|
+
private skillsOff;
|
|
85
98
|
/**
|
|
86
99
|
* The org's live connectors by name, minus those the agent turns off as a whole: `tools: "all"`,
|
|
87
100
|
* or a list naming every tool the connector has (a connector without tools stays listed).
|
|
@@ -12,8 +12,9 @@ import { sql } from "kysely";
|
|
|
12
12
|
import { escapeLike } from "../conversations/conversations.service.js";
|
|
13
13
|
import { ApiError } from "../errors.js";
|
|
14
14
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
15
|
-
import {
|
|
15
|
+
import { agentSkills, builtinSkillIds, builtinSkillPlugins, linkedCopyIds, skillIdsOf, usableSkillVersions, } from "../skills/usable.js";
|
|
16
16
|
import { AgentLookup } from "./agent-lookup.js";
|
|
17
|
+
import { skillDisabled, } from "./definition.js";
|
|
17
18
|
const notFound = () => new ApiError("agent.not_found", "Agent not found");
|
|
18
19
|
/**
|
|
19
20
|
* Cross-org agent reads for the super admin (admin agents spec §3.2, §3.3): every org's live
|
|
@@ -41,7 +42,9 @@ let AdminAgents = class AdminAgents {
|
|
|
41
42
|
.orderBy("agents.id")
|
|
42
43
|
.limit(q.limit + 1)
|
|
43
44
|
.execute();
|
|
44
|
-
const
|
|
45
|
+
const kept = rows.slice(0, q.limit);
|
|
46
|
+
const off = await this.skillsOff(kept);
|
|
47
|
+
const page = kept.map((r) => toRow(r, off.get(r.id) ?? 0));
|
|
45
48
|
return { agents: page, next: rows.length > q.limit ? (page.at(-1)?.id ?? null) : null };
|
|
46
49
|
}
|
|
47
50
|
/** One live agent of a live org; otherwise `agent.not_found`. */
|
|
@@ -57,16 +60,17 @@ let AdminAgents = class AdminAgents {
|
|
|
57
60
|
.where("agent_id", "=", agentId)
|
|
58
61
|
.executeTakeFirstOrThrow(),
|
|
59
62
|
]);
|
|
60
|
-
const [skills, connectors] = await Promise.all([
|
|
61
|
-
|
|
63
|
+
const [skills, off, connectors] = await Promise.all([
|
|
64
|
+
agentSkills(this.db.db, {
|
|
62
65
|
orgId: row.org_id,
|
|
63
66
|
agentId,
|
|
64
|
-
|
|
67
|
+
disabledSkills: view.definition.disabledSkills ?? [],
|
|
65
68
|
}),
|
|
69
|
+
this.skillsOff([row]),
|
|
66
70
|
this.connectorsOf(row.org_id, view.definition.disabledTools),
|
|
67
71
|
]);
|
|
68
72
|
return {
|
|
69
|
-
...toRow(row),
|
|
73
|
+
...toRow(row, off.get(agentId) ?? 0),
|
|
70
74
|
skills: skills
|
|
71
75
|
.map((s) => ({ id: s.id, name: s.name, scope: s.scope }))
|
|
72
76
|
.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0)),
|
|
@@ -81,6 +85,58 @@ let AdminAgents = class AdminAgents {
|
|
|
81
85
|
createdAt: view.createdAt,
|
|
82
86
|
};
|
|
83
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* How many of the org's skills each agent turns off, by agent id (agents turning none off are
|
|
90
|
+
* left out): the org's usable skills are resolved once per org, then matched against each
|
|
91
|
+
* agent's `disabledSkills` by the rule of `agentSkills` (a builtin plugin's skill and an org
|
|
92
|
+
* skill the agent shared are never off).
|
|
93
|
+
*/
|
|
94
|
+
async skillsOff(rows) {
|
|
95
|
+
const out = new Map();
|
|
96
|
+
const byOrg = new Map();
|
|
97
|
+
for (const r of rows) {
|
|
98
|
+
const disabled = Array.isArray(r.disabled_skills)
|
|
99
|
+
? r.disabled_skills
|
|
100
|
+
: [];
|
|
101
|
+
if (disabled.length === 0)
|
|
102
|
+
continue;
|
|
103
|
+
byOrg.set(r.org_id, [...(byOrg.get(r.org_id) ?? []), { id: r.id, disabled }]);
|
|
104
|
+
}
|
|
105
|
+
if (byOrg.size === 0)
|
|
106
|
+
return out;
|
|
107
|
+
const db = this.db.db;
|
|
108
|
+
const builtinPlugins = await builtinSkillPlugins(db);
|
|
109
|
+
const agentIds = [...byOrg.values()].flat().map((a) => a.id);
|
|
110
|
+
const sharedRows = await db
|
|
111
|
+
.selectFrom("skills")
|
|
112
|
+
.select(["id", "origin_agent_id"])
|
|
113
|
+
.where("scope", "=", "org")
|
|
114
|
+
.where("deleted_at", "is", null)
|
|
115
|
+
.where("origin_agent_id", "in", agentIds)
|
|
116
|
+
.execute();
|
|
117
|
+
const shared = new Map();
|
|
118
|
+
for (const r of sharedRows) {
|
|
119
|
+
const a = r.origin_agent_id;
|
|
120
|
+
shared.set(a, (shared.get(a) ?? new Set()).add(r.id));
|
|
121
|
+
}
|
|
122
|
+
for (const [orgId, agents] of byOrg) {
|
|
123
|
+
const usable = await usableSkillVersions(db, orgId);
|
|
124
|
+
const linked = await linkedCopyIds(db, orgId, usable.flatMap((r) => (r.origin === "platform" ? [r.id] : [])));
|
|
125
|
+
const builtinIds = new Set(await builtinSkillIds(db, orgId));
|
|
126
|
+
const candidates = usable.flatMap((r) => {
|
|
127
|
+
const ids = skillIdsOf(r, linked);
|
|
128
|
+
const fixed = (r.plugin !== null && builtinPlugins.has(r.plugin) && r.origin === "platform") ||
|
|
129
|
+
ids.some((id) => builtinIds.has(id));
|
|
130
|
+
return fixed ? [] : [{ plugin: r.plugin, name: r.name, ids }];
|
|
131
|
+
});
|
|
132
|
+
for (const a of agents) {
|
|
133
|
+
const mine = shared.get(a.id) ?? new Set();
|
|
134
|
+
const n = candidates.filter((c) => !c.ids.some((id) => mine.has(id)) && skillDisabled(a.disabled, c)).length;
|
|
135
|
+
out.set(a.id, n);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return out;
|
|
139
|
+
}
|
|
84
140
|
/**
|
|
85
141
|
* The org's live connectors by name, minus those the agent turns off as a whole: `tools: "all"`,
|
|
86
142
|
* or a list naming every tool the connector has (a connector without tools stays listed).
|
|
@@ -132,6 +188,7 @@ let AdminAgents = class AdminAgents {
|
|
|
132
188
|
"agents.org_id",
|
|
133
189
|
"orgs.name as org_name",
|
|
134
190
|
sql `agent_versions.definition->>'name'`.as("name"),
|
|
191
|
+
sql `agent_versions.definition->'disabledSkills'`.as("disabled_skills"),
|
|
135
192
|
"agents.profile_avatar",
|
|
136
193
|
"agents.owner_account_id",
|
|
137
194
|
"accounts.display_name as owner_name",
|
|
@@ -151,7 +208,7 @@ AdminAgents = __decorate([
|
|
|
151
208
|
__param(1, Inject(AgentLookup))
|
|
152
209
|
], AdminAgents);
|
|
153
210
|
export { AdminAgents };
|
|
154
|
-
function toRow(r) {
|
|
211
|
+
function toRow(r, skillsOff) {
|
|
155
212
|
return {
|
|
156
213
|
id: r.id,
|
|
157
214
|
orgId: r.org_id,
|
|
@@ -165,6 +222,7 @@ function toRow(r) {
|
|
|
165
222
|
createdFrom: r.created_from_template_id === null
|
|
166
223
|
? null
|
|
167
224
|
: { templateId: r.created_from_template_id, name: r.created_from_template_name ?? null },
|
|
225
|
+
skillsOff,
|
|
168
226
|
updatedAt: r.updated_at,
|
|
169
227
|
};
|
|
170
228
|
}
|
|
@@ -37,13 +37,19 @@ export declare const AgentCreateDefinition: z.ZodObject<{
|
|
|
37
37
|
ask: "ask";
|
|
38
38
|
deny: "deny";
|
|
39
39
|
}>>>;
|
|
40
|
+
disabledSkills: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
41
|
+
kind: z.ZodLiteral<"plugin">;
|
|
42
|
+
plugin: z.ZodString;
|
|
43
|
+
skills: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>;
|
|
44
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
45
|
+
kind: z.ZodLiteral<"skill">;
|
|
46
|
+
skillId: z.ZodString;
|
|
47
|
+
}, z.core.$strict>], "kind">>>;
|
|
40
48
|
skills: z.ZodOptional<z.ZodObject<{
|
|
41
|
-
orgSkills: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
42
49
|
writePolicy: z.ZodOptional<z.ZodEnum<{
|
|
43
50
|
allow: "allow";
|
|
44
51
|
ask: "ask";
|
|
45
52
|
}>>;
|
|
46
|
-
pinned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
47
53
|
}, z.core.$strict>>;
|
|
48
54
|
subagents: z.ZodOptional<z.ZodObject<{
|
|
49
55
|
general: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -121,13 +127,19 @@ export declare const AgentCreateBody: z.ZodObject<{
|
|
|
121
127
|
ask: "ask";
|
|
122
128
|
deny: "deny";
|
|
123
129
|
}>>>;
|
|
130
|
+
disabledSkills: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
131
|
+
kind: z.ZodLiteral<"plugin">;
|
|
132
|
+
plugin: z.ZodString;
|
|
133
|
+
skills: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>;
|
|
134
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
135
|
+
kind: z.ZodLiteral<"skill">;
|
|
136
|
+
skillId: z.ZodString;
|
|
137
|
+
}, z.core.$strict>], "kind">>>;
|
|
124
138
|
skills: z.ZodOptional<z.ZodObject<{
|
|
125
|
-
orgSkills: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
126
139
|
writePolicy: z.ZodOptional<z.ZodEnum<{
|
|
127
140
|
allow: "allow";
|
|
128
141
|
ask: "ask";
|
|
129
142
|
}>>;
|
|
130
|
-
pinned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
131
143
|
}, z.core.$strict>>;
|
|
132
144
|
subagents: z.ZodOptional<z.ZodObject<{
|
|
133
145
|
general: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -237,13 +249,19 @@ export declare const AgentUpdateBody: z.ZodObject<{
|
|
|
237
249
|
ask: "ask";
|
|
238
250
|
deny: "deny";
|
|
239
251
|
}>>>;
|
|
252
|
+
disabledSkills: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
253
|
+
kind: z.ZodLiteral<"plugin">;
|
|
254
|
+
plugin: z.ZodString;
|
|
255
|
+
skills: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>;
|
|
256
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
257
|
+
kind: z.ZodLiteral<"skill">;
|
|
258
|
+
skillId: z.ZodString;
|
|
259
|
+
}, z.core.$strict>], "kind">>>;
|
|
240
260
|
skills: z.ZodOptional<z.ZodObject<{
|
|
241
|
-
orgSkills: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
242
261
|
writePolicy: z.ZodOptional<z.ZodEnum<{
|
|
243
262
|
allow: "allow";
|
|
244
263
|
ask: "ask";
|
|
245
264
|
}>>;
|
|
246
|
-
pinned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
247
265
|
}, z.core.$strict>>;
|
|
248
266
|
subagents: z.ZodOptional<z.ZodObject<{
|
|
249
267
|
general: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -40,7 +40,7 @@ export interface TemplateProvenance {
|
|
|
40
40
|
name: string;
|
|
41
41
|
}
|
|
42
42
|
/** Why a `subagents` block is refused (`agent.subagents_invalid` details). */
|
|
43
|
-
export type SubagentsProblem = "not_found" | "invalid_name" | "duplicate" | "tool_not_selected" | "
|
|
43
|
+
export type SubagentsProblem = "not_found" | "invalid_name" | "duplicate" | "tool_not_selected" | "skill_not_available" | "agent_not_available" | "self" | "too_many";
|
|
44
44
|
/**
|
|
45
45
|
* Checks `subagents` of an agent definition in the caller's transaction (spec §5.2); throws 400
|
|
46
46
|
* `agent.subagents_invalid` with one detail per problem (`{ reason, path, value? }`):
|
|
@@ -51,8 +51,9 @@ export type SubagentsProblem = "not_found" | "invalid_name" | "duplicate" | "too
|
|
|
51
51
|
* bare template type equal to an inline name, a template typed `general-purpose`);
|
|
52
52
|
* - `tool_not_selected`: an inline template's `tools`, `disallowedTools` or `toolPolicies` key that
|
|
53
53
|
* is not a tool key of this agent (`toolKeys`, from `ToolRegistry.checkRefs`);
|
|
54
|
-
* - `
|
|
55
|
-
* skill
|
|
54
|
+
* - `skill_not_available`: an inline skill id that is not one of this agent's skills (its own,
|
|
55
|
+
* the ones it shared, every skill on in the org its `disabledSkills` leaves on; skills default-on
|
|
56
|
+
* spec §4, §6.1);
|
|
56
57
|
* - `self`: this agent allowlisted; `agent_not_available`: an allowlisted agent that is not a live
|
|
57
58
|
* agent of the org visible to the person saving with `subagents.dispatchable: true` in its
|
|
58
59
|
* current version;
|
|
@@ -22,11 +22,12 @@ import { OrgLock } from "../orgs/org-lock.js";
|
|
|
22
22
|
import { can, roleAtLeast } from "../orgs/roles.js";
|
|
23
23
|
import { ProviderRegistry } from "../runtime/providers.js";
|
|
24
24
|
import { SkillChangesService } from "../skills/changes.service.js";
|
|
25
|
-
import {
|
|
25
|
+
import { assertDisabledSkills } from "../skills/skills.service.js";
|
|
26
|
+
import { agentSkills } from "../skills/usable.js";
|
|
26
27
|
import { legacyKeySaveText } from "../tools/legacy-keys.js";
|
|
27
28
|
import { ToolRegistry } from "../tools/registry.js";
|
|
28
29
|
import { AgentLookup, isAgentVisibleTo, visibleTo, } from "./agent-lookup.js";
|
|
29
|
-
import { canonicalDisabledTools, normalizeStoredDefinition, paramIssues, SUBAGENT_NAME_RE, SUBAGENT_ROSTER_MAX, withoutRemovedBuiltinPolicies, } from "./definition.js";
|
|
30
|
+
import { canonicalDisabledSkills, canonicalDisabledTools, normalizeStoredDefinition, paramIssues, SUBAGENT_NAME_RE, SUBAGENT_ROSTER_MAX, withoutRemovedBuiltinPolicies, } from "./definition.js";
|
|
30
31
|
import { deriveInstructions } from "./instruction-files.js";
|
|
31
32
|
import { PendingConnectorRequests } from "./pending-connector-requests.js";
|
|
32
33
|
import { randomPreset } from "./profile.js";
|
|
@@ -96,9 +97,16 @@ export function keepPendingConnectors(definition, given, current) {
|
|
|
96
97
|
}
|
|
97
98
|
return next.length > 0 ? { ...rest, pendingConnectors: [...next] } : rest;
|
|
98
99
|
}
|
|
99
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* `definition` with `disabledTools` and `disabledSkills` in their canonical forms (tools default-on
|
|
102
|
+
* spec §2, skills default-on spec §4).
|
|
103
|
+
*/
|
|
100
104
|
function withCanonicalTools(definition) {
|
|
101
|
-
return {
|
|
105
|
+
return {
|
|
106
|
+
...definition,
|
|
107
|
+
disabledTools: canonicalDisabledTools(definition.disabledTools ?? []),
|
|
108
|
+
disabledSkills: canonicalDisabledSkills(definition.disabledSkills ?? []),
|
|
109
|
+
};
|
|
102
110
|
}
|
|
103
111
|
/**
|
|
104
112
|
* Checks `subagents` of an agent definition in the caller's transaction (spec §5.2); throws 400
|
|
@@ -110,8 +118,9 @@ function withCanonicalTools(definition) {
|
|
|
110
118
|
* bare template type equal to an inline name, a template typed `general-purpose`);
|
|
111
119
|
* - `tool_not_selected`: an inline template's `tools`, `disallowedTools` or `toolPolicies` key that
|
|
112
120
|
* is not a tool key of this agent (`toolKeys`, from `ToolRegistry.checkRefs`);
|
|
113
|
-
* - `
|
|
114
|
-
* skill
|
|
121
|
+
* - `skill_not_available`: an inline skill id that is not one of this agent's skills (its own,
|
|
122
|
+
* the ones it shared, every skill on in the org its `disabledSkills` leaves on; skills default-on
|
|
123
|
+
* spec §4, §6.1);
|
|
115
124
|
* - `self`: this agent allowlisted; `agent_not_available`: an allowlisted agent that is not a live
|
|
116
125
|
* agent of the org visible to the person saving with `subagents.dispatchable: true` in its
|
|
117
126
|
* current version;
|
|
@@ -189,19 +198,15 @@ export async function assertSubagents(t, a) {
|
|
|
189
198
|
claim(type, path);
|
|
190
199
|
});
|
|
191
200
|
const inline = sub.inline ?? [];
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
const
|
|
201
|
+
const skillIds = [...new Set(inline.flatMap((x) => x.skills ?? []))];
|
|
202
|
+
// the agent's effective skills (an agent being created has no own or shared ones yet)
|
|
203
|
+
const available = skillIds.length === 0
|
|
195
204
|
? new Set()
|
|
196
|
-
: new Set((await t
|
|
197
|
-
.
|
|
198
|
-
.
|
|
199
|
-
.
|
|
200
|
-
|
|
201
|
-
.where("agent_id", "=", a.agentId)
|
|
202
|
-
.where("deleted_at", "is", null)
|
|
203
|
-
.where("id", "in", skillIds)
|
|
204
|
-
.execute()).map((r) => r.id));
|
|
205
|
+
: new Set((await agentSkills(t, {
|
|
206
|
+
orgId: a.orgId,
|
|
207
|
+
agentId: a.agentId ?? "",
|
|
208
|
+
disabledSkills: a.definition.disabledSkills ?? [],
|
|
209
|
+
})).flatMap((r) => (r.platformSkillId !== undefined ? [r.id, r.platformSkillId] : [r.id])));
|
|
205
210
|
inline.forEach((x, i) => {
|
|
206
211
|
const base = `subagents.inline.${i}`;
|
|
207
212
|
name(x.name, `${base}.name`);
|
|
@@ -222,8 +227,8 @@ export async function assertSubagents(t, a) {
|
|
|
222
227
|
tool(key, `${base}.toolPolicies.${key}`);
|
|
223
228
|
}
|
|
224
229
|
(x.skills ?? []).forEach((id, j) => {
|
|
225
|
-
if (!
|
|
226
|
-
add("
|
|
230
|
+
if (!available.has(id))
|
|
231
|
+
add("skill_not_available", `${base}.skills.${j}`, id);
|
|
227
232
|
});
|
|
228
233
|
});
|
|
229
234
|
const keptAgents = new Set((a.kept?.agents ?? []).map((x) => x.agentId));
|
|
@@ -424,6 +429,7 @@ let AgentsService = class AgentsService {
|
|
|
424
429
|
const given = withoutRemovedBuiltinPolicies(request.definition);
|
|
425
430
|
const input = {
|
|
426
431
|
...request,
|
|
432
|
+
givenDisabledSkills: given.disabledSkills ?? [],
|
|
427
433
|
// run context spec §3.5: version 1 carries the description (the profile's when the
|
|
428
434
|
// definition gives none)
|
|
429
435
|
definition: withCanonicalTools(withDescription(deriveInstructions(given, null), given.description ?? request.profile?.description, undefined)),
|
|
@@ -445,8 +451,11 @@ let AgentsService = class AgentsService {
|
|
|
445
451
|
if (template !== null && input.visibility !== "private" && !can(role, "agents.manage")) {
|
|
446
452
|
throw new ApiError("agent.visibility_forbidden", "Only an organization admin can create an agent from a template for others; create it private");
|
|
447
453
|
}
|
|
448
|
-
await
|
|
449
|
-
|
|
454
|
+
await assertDisabledSkills(t, {
|
|
455
|
+
orgId,
|
|
456
|
+
agentId: null,
|
|
457
|
+
disabled: input.givenDisabledSkills ?? input.definition.disabledSkills ?? [],
|
|
458
|
+
});
|
|
450
459
|
await assertSubagents(t, {
|
|
451
460
|
orgId,
|
|
452
461
|
agentId: null,
|
|
@@ -604,10 +613,14 @@ let AgentsService = class AgentsService {
|
|
|
604
613
|
.where("id", "=", agentId)
|
|
605
614
|
.execute();
|
|
606
615
|
}
|
|
607
|
-
//
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
616
|
+
// what the current version already turns off is not checked again (skills default-on §4)
|
|
617
|
+
await assertDisabledSkills(t, {
|
|
618
|
+
orgId,
|
|
619
|
+
agentId,
|
|
620
|
+
// as given, so `disabledSkills.<i>` names the caller's index; the canonical form is saved
|
|
621
|
+
disabled: patch.definition.disabledSkills ?? [],
|
|
622
|
+
kept: currentDefinition.disabledSkills ?? [],
|
|
623
|
+
});
|
|
611
624
|
await assertSubagents(t, {
|
|
612
625
|
orgId,
|
|
613
626
|
agentId,
|
|
@@ -44,6 +44,36 @@ export declare const connectorToolDisabled: (disabled: readonly DisabledToolRef[
|
|
|
44
44
|
* lists that turn off the same tools compare equal.
|
|
45
45
|
*/
|
|
46
46
|
export declare function canonicalDisabledTools(disabled: readonly DisabledToolRef[]): DisabledToolRef[];
|
|
47
|
+
/**
|
|
48
|
+
* A skill an agent turns off (skills default-on spec §4): a plugin's skills by name, or `"all"` to
|
|
49
|
+
* turn the plugin off as a unit (skills it gains later included); a skill without a plugin (the
|
|
50
|
+
* org's own, shared or promoted ones) by id, since its name may change under the same id.
|
|
51
|
+
*/
|
|
52
|
+
export declare const DisabledSkillRef: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
53
|
+
kind: z.ZodLiteral<"plugin">;
|
|
54
|
+
plugin: z.ZodString;
|
|
55
|
+
skills: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>;
|
|
56
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
57
|
+
kind: z.ZodLiteral<"skill">;
|
|
58
|
+
skillId: z.ZodString;
|
|
59
|
+
}, z.core.$strict>], "kind">;
|
|
60
|
+
export type DisabledSkillRef = z.output<typeof DisabledSkillRef>;
|
|
61
|
+
/**
|
|
62
|
+
* Is a skill turned off by `disabled`? `plugin` and `name` match a plugin entry; `ids` (the
|
|
63
|
+
* skill's id and, for a linked or promoted copy, the platform skill it serves) a skill entry.
|
|
64
|
+
*/
|
|
65
|
+
export declare function skillDisabled(disabled: readonly DisabledSkillRef[] | undefined, skill: {
|
|
66
|
+
plugin: string | null;
|
|
67
|
+
name: string;
|
|
68
|
+
ids: readonly string[];
|
|
69
|
+
}): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* `disabled` in its canonical form: one entry per plugin (sorted by plugin, `"all"` absorbing
|
|
72
|
+
* names, names deduplicated and sorted, an empty list dropped), then the skill entries deduplicated
|
|
73
|
+
* and sorted by id. Saving stores this form, so two lists that turn off the same skills compare
|
|
74
|
+
* equal.
|
|
75
|
+
*/
|
|
76
|
+
export declare function canonicalDisabledSkills(disabled: readonly DisabledSkillRef[]): DisabledSkillRef[];
|
|
47
77
|
/**
|
|
48
78
|
* A sub-agent's tool filter by tool key (tools default-on spec §4): written only into a child's
|
|
49
79
|
* effective definition at dispatch (never accepted on save). `deny` removes keys (the child-removed
|
|
@@ -60,8 +90,8 @@ export type SubagentTools = z.infer<typeof SubagentToolsSchema>;
|
|
|
60
90
|
export declare const SUBAGENT_NAME_RE: RegExp;
|
|
61
91
|
/**
|
|
62
92
|
* A sub-agent template written in the agent definition (phase C, spec §5.2): the fields of a
|
|
63
|
-
* plugin agent template (`AgentTemplate`, spec §16.1), with `skills` as skill ids (
|
|
64
|
-
*
|
|
93
|
+
* plugin agent template (`AgentTemplate`, spec §16.1), with `skills` as skill ids (skills the agent
|
|
94
|
+
* has, skills default-on spec §6.1) instead of names. Names and skills are checked on save
|
|
65
95
|
* (`agent.subagents_invalid`); the schema only bounds the input.
|
|
66
96
|
*/
|
|
67
97
|
export declare const InlineAgentTemplate: z.ZodObject<{
|
|
@@ -200,13 +230,19 @@ export declare const AgentDefinitionSchema: z.ZodObject<{
|
|
|
200
230
|
ask: "ask";
|
|
201
231
|
deny: "deny";
|
|
202
232
|
}>>>;
|
|
233
|
+
disabledSkills: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
234
|
+
kind: z.ZodLiteral<"plugin">;
|
|
235
|
+
plugin: z.ZodString;
|
|
236
|
+
skills: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>;
|
|
237
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
238
|
+
kind: z.ZodLiteral<"skill">;
|
|
239
|
+
skillId: z.ZodString;
|
|
240
|
+
}, z.core.$strict>], "kind">>>;
|
|
203
241
|
skills: z.ZodOptional<z.ZodObject<{
|
|
204
|
-
orgSkills: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
205
242
|
writePolicy: z.ZodOptional<z.ZodEnum<{
|
|
206
243
|
allow: "allow";
|
|
207
244
|
ask: "ask";
|
|
208
245
|
}>>;
|
|
209
|
-
pinned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
210
246
|
}, z.core.$strict>>;
|
|
211
247
|
subagents: z.ZodOptional<z.ZodObject<{
|
|
212
248
|
general: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -313,8 +349,10 @@ export declare function needsLegacyScope(definition: unknown): boolean;
|
|
|
313
349
|
* current keys ({@link normalizeToolKeys}: builtins always, `<x>__<tool>` keys with `scope`), and
|
|
314
350
|
* a definition from before tools were on by default (an enabled `tools` list, history only: the
|
|
315
351
|
* migration rewrote stored versions) reads as nothing turned off, which is what the migration
|
|
316
|
-
* writes (tools default-on spec §2, §3).
|
|
317
|
-
*
|
|
352
|
+
* writes (tools default-on spec §2, §3). Likewise a definition from before skills were on by
|
|
353
|
+
* default (`skills.orgSkills` / `skills.pinned`) reads as no skill turned off (skills default-on
|
|
354
|
+
* spec §4; migration 0116 rewrote stored versions). Other fields are kept; without old forms the
|
|
355
|
+
* same object is returned.
|
|
318
356
|
*/
|
|
319
357
|
export declare function normalizeStoredDefinition(def: unknown, scope?: LegacyScope): AgentDefinition;
|
|
320
358
|
/** 按模型声明严格校验一组参数,返回 `{ path: "<field>.<key>", message }[]`(评测候选也用它)。 */
|