miladyai 2.0.0-alpha.27
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/_virtual/_rolldown/runtime.js +7 -0
- package/dist/actions/emote.js +64 -0
- package/dist/actions/restart.js +81 -0
- package/dist/actions/send-message.js +152 -0
- package/dist/agent-admin-routes.js +82 -0
- package/dist/agent-lifecycle-routes.js +79 -0
- package/dist/agent-transfer-routes.js +102 -0
- package/dist/api/agent-admin-routes.js +82 -0
- package/dist/api/agent-lifecycle-routes.js +79 -0
- package/dist/api/agent-transfer-routes.js +102 -0
- package/dist/api/apps-hyperscape-routes.js +58 -0
- package/dist/api/apps-routes.js +114 -0
- package/dist/api/auth-routes.js +56 -0
- package/dist/api/autonomy-routes.js +44 -0
- package/dist/api/bug-report-routes.js +111 -0
- package/dist/api/character-routes.js +195 -0
- package/dist/api/cloud-routes.js +330 -0
- package/dist/api/cloud-status-routes.js +155 -0
- package/dist/api/compat-utils.js +111 -0
- package/dist/api/database.js +735 -0
- package/dist/api/diagnostics-routes.js +205 -0
- package/dist/api/drop-service.js +134 -0
- package/dist/api/early-logs.js +86 -0
- package/dist/api/http-helpers.js +131 -0
- package/dist/api/knowledge-routes.js +534 -0
- package/dist/api/memory-bounds.js +71 -0
- package/dist/api/models-routes.js +28 -0
- package/dist/api/og-tracker.js +36 -0
- package/dist/api/permissions-routes.js +109 -0
- package/dist/api/plugin-validation.js +198 -0
- package/dist/api/provider-switch-config.js +41 -0
- package/dist/api/registry-routes.js +86 -0
- package/dist/api/registry-service.js +164 -0
- package/dist/api/sandbox-routes.js +1112 -0
- package/dist/api/server.js +7949 -0
- package/dist/api/subscription-routes.js +172 -0
- package/dist/api/terminal-run-limits.js +24 -0
- package/dist/api/training-routes.js +158 -0
- package/dist/api/trajectory-routes.js +300 -0
- package/dist/api/trigger-routes.js +246 -0
- package/dist/api/twitter-verify.js +134 -0
- package/dist/api/tx-service.js +108 -0
- package/dist/api/wallet-routes.js +266 -0
- package/dist/api/wallet.js +568 -0
- package/dist/api/whatsapp-routes.js +182 -0
- package/dist/api/zip-utils.js +109 -0
- package/dist/apps-hyperscape-routes.js +58 -0
- package/dist/apps-routes.js +114 -0
- package/dist/ascii.js +20 -0
- package/dist/auth/anthropic.js +44 -0
- package/dist/auth/apply-stealth.js +41 -0
- package/dist/auth/claude-code-stealth.js +78 -0
- package/dist/auth/credentials.js +156 -0
- package/dist/auth/index.js +5 -0
- package/dist/auth/openai-codex.js +66 -0
- package/dist/auth/types.js +9 -0
- package/dist/auth-routes.js +56 -0
- package/dist/autonomy-routes.js +44 -0
- package/dist/bug-report-routes.js +111 -0
- package/dist/build-info.json +6 -0
- package/dist/character-routes.js +195 -0
- package/dist/cli/argv.js +63 -0
- package/dist/cli/banner.js +34 -0
- package/dist/cli/cli-name.js +21 -0
- package/dist/cli/cli-utils.js +16 -0
- package/dist/cli/git-commit.js +78 -0
- package/dist/cli/parse-duration.js +15 -0
- package/dist/cli/plugins-cli.js +590 -0
- package/dist/cli/profile-utils.js +9 -0
- package/dist/cli/profile.js +95 -0
- package/dist/cli/program/build-program.js +17 -0
- package/dist/cli/program/command-registry.js +23 -0
- package/dist/cli/program/help.js +47 -0
- package/dist/cli/program/preaction.js +33 -0
- package/dist/cli/program/register.config.js +106 -0
- package/dist/cli/program/register.configure.js +20 -0
- package/dist/cli/program/register.dashboard.js +124 -0
- package/dist/cli/program/register.models.js +23 -0
- package/dist/cli/program/register.setup.js +36 -0
- package/dist/cli/program/register.start.js +22 -0
- package/dist/cli/program/register.subclis.js +70 -0
- package/dist/cli/program/register.tui.js +163 -0
- package/dist/cli/program/register.update.js +154 -0
- package/dist/cli/program.js +3 -0
- package/dist/cli/run-main.js +37 -0
- package/dist/cli/version.js +7 -0
- package/dist/cloud/validate-url.js +93 -0
- package/dist/cloud-routes.js +330 -0
- package/dist/cloud-status-routes.js +155 -0
- package/dist/compat-utils.js +111 -0
- package/dist/config/config.js +69 -0
- package/dist/config/env-vars.js +19 -0
- package/dist/config/includes.js +121 -0
- package/dist/config/object-utils.js +7 -0
- package/dist/config/paths.js +38 -0
- package/dist/config/plugin-auto-enable.js +231 -0
- package/dist/config/schema.js +864 -0
- package/dist/config/telegram-custom-commands.js +76 -0
- package/dist/config/zod-schema.agent-runtime.js +519 -0
- package/dist/config/zod-schema.core.js +538 -0
- package/dist/config/zod-schema.hooks.js +103 -0
- package/dist/config/zod-schema.js +488 -0
- package/dist/config/zod-schema.providers-core.js +785 -0
- package/dist/config/zod-schema.session.js +73 -0
- package/dist/core-plugins.js +37 -0
- package/dist/custom-actions.js +250 -0
- package/dist/database.js +735 -0
- package/dist/diagnostics/integration-observability.js +57 -0
- package/dist/diagnostics-routes.js +205 -0
- package/dist/drop-service.js +134 -0
- package/dist/early-logs.js +24 -0
- package/dist/eliza.js +2061 -0
- package/dist/emotes/catalog.js +271 -0
- package/dist/entry.js +40 -0
- package/dist/hooks/discovery.js +167 -0
- package/dist/hooks/eligibility.js +64 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/loader.js +147 -0
- package/dist/hooks/registry.js +55 -0
- package/dist/http-helpers.js +131 -0
- package/dist/index.js +49 -0
- package/dist/knowledge-routes.js +534 -0
- package/dist/memory-bounds.js +71 -0
- package/dist/milady-plugin.js +90 -0
- package/dist/models-routes.js +28 -0
- package/dist/onboarding-names.js +78 -0
- package/dist/onboarding-presets.js +922 -0
- package/dist/package.json +1 -0
- package/dist/permissions-routes.js +109 -0
- package/dist/plugin-validation.js +107 -0
- package/dist/plugins/whatsapp/actions.js +91 -0
- package/dist/plugins/whatsapp/index.js +16 -0
- package/dist/plugins/whatsapp/service.js +270 -0
- package/dist/provider-switch-config.js +41 -0
- package/dist/providers/admin-trust.js +46 -0
- package/dist/providers/autonomous-state.js +101 -0
- package/dist/providers/session-bridge.js +86 -0
- package/dist/providers/session-utils.js +36 -0
- package/dist/providers/simple-mode.js +50 -0
- package/dist/providers/ui-catalog.js +15 -0
- package/dist/providers/workspace-provider.js +93 -0
- package/dist/providers/workspace.js +348 -0
- package/dist/registry-routes.js +86 -0
- package/dist/registry-service.js +164 -0
- package/dist/restart.js +40 -0
- package/dist/runtime/core-plugins.js +37 -0
- package/dist/runtime/custom-actions.js +250 -0
- package/dist/runtime/eliza.js +2061 -0
- package/dist/runtime/embedding-manager-support.js +185 -0
- package/dist/runtime/embedding-manager.js +193 -0
- package/dist/runtime/embedding-presets.js +54 -0
- package/dist/runtime/embedding-state.js +8 -0
- package/dist/runtime/milady-plugin.js +90 -0
- package/dist/runtime/onboarding-names.js +78 -0
- package/dist/runtime/restart.js +40 -0
- package/dist/runtime/version.js +7 -0
- package/dist/sandbox-routes.js +1112 -0
- package/dist/security/audit-log.js +149 -0
- package/dist/security/network-policy.js +70 -0
- package/dist/server.js +7949 -0
- package/dist/services/agent-export.js +559 -0
- package/dist/services/app-manager.js +389 -0
- package/dist/services/browser-capture.js +86 -0
- package/dist/services/fallback-training-service.js +128 -0
- package/dist/services/mcp-marketplace.js +134 -0
- package/dist/services/plugin-installer.js +396 -0
- package/dist/services/plugin-manager-types.js +15 -0
- package/dist/services/registry-client-app-meta.js +144 -0
- package/dist/services/registry-client-endpoints.js +166 -0
- package/dist/services/registry-client-local.js +271 -0
- package/dist/services/registry-client-network.js +93 -0
- package/dist/services/registry-client-queries.js +70 -0
- package/dist/services/registry-client.js +157 -0
- package/dist/services/sandbox-engine.js +511 -0
- package/dist/services/sandbox-manager.js +297 -0
- package/dist/services/self-updater.js +175 -0
- package/dist/services/skill-catalog-client.js +119 -0
- package/dist/services/skill-marketplace.js +521 -0
- package/dist/services/stream-manager.js +236 -0
- package/dist/services/update-checker.js +121 -0
- package/dist/services/update-notifier.js +29 -0
- package/dist/services/version-compat.js +78 -0
- package/dist/services/whatsapp-pairing.js +196 -0
- package/dist/shared/ui-catalog-prompt.js +728 -0
- package/dist/subscription-routes.js +172 -0
- package/dist/terminal/links.js +19 -0
- package/dist/terminal/palette.js +14 -0
- package/dist/terminal/theme.js +25 -0
- package/dist/terminal-run-limits.js +24 -0
- package/dist/training-routes.js +158 -0
- package/dist/trajectory-routes.js +300 -0
- package/dist/trigger-routes.js +246 -0
- package/dist/triggers/action.js +218 -0
- package/dist/triggers/runtime.js +281 -0
- package/dist/triggers/scheduling.js +295 -0
- package/dist/triggers/types.js +5 -0
- package/dist/tui/components/assistant-message.js +76 -0
- package/dist/tui/components/chat-editor.js +34 -0
- package/dist/tui/components/embeddings-overlay.js +46 -0
- package/dist/tui/components/footer.js +60 -0
- package/dist/tui/components/index.js +15 -0
- package/dist/tui/components/modal-frame.js +45 -0
- package/dist/tui/components/modal-style.js +15 -0
- package/dist/tui/components/model-selector.js +70 -0
- package/dist/tui/components/pinned-chat-layout.js +46 -0
- package/dist/tui/components/plugins-endpoints-tab.js +196 -0
- package/dist/tui/components/plugins-installed-tab-view.js +69 -0
- package/dist/tui/components/plugins-installed-tab.js +319 -0
- package/dist/tui/components/plugins-overlay-catalog.js +81 -0
- package/dist/tui/components/plugins-overlay-data-api.js +21 -0
- package/dist/tui/components/plugins-overlay-data-shared.js +20 -0
- package/dist/tui/components/plugins-overlay-data.js +323 -0
- package/dist/tui/components/plugins-overlay.js +117 -0
- package/dist/tui/components/plugins-store-tab.js +148 -0
- package/dist/tui/components/settings-overlay.js +61 -0
- package/dist/tui/components/status-bar.js +64 -0
- package/dist/tui/components/tool-execution.js +68 -0
- package/dist/tui/components/user-message.js +22 -0
- package/dist/tui/eliza-tui-bridge.js +606 -0
- package/dist/tui/index.js +370 -0
- package/dist/tui/modal-presets.js +33 -0
- package/dist/tui/model-spec.js +46 -0
- package/dist/tui/sse-parser.js +78 -0
- package/dist/tui/theme.js +110 -0
- package/dist/tui/titlebar-spinner.js +62 -0
- package/dist/tui/tui-app.js +311 -0
- package/dist/tui/ws-client.js +215 -0
- package/dist/twitter-verify.js +134 -0
- package/dist/tx-service.js +108 -0
- package/dist/utils/exec-safety.js +17 -0
- package/dist/utils/globals.js +20 -0
- package/dist/utils/milady-root.js +61 -0
- package/dist/utils/number-parsing.js +37 -0
- package/dist/version-resolver.js +37 -0
- package/dist/version.js +7 -0
- package/dist/wallet-routes.js +266 -0
- package/dist/wallet.js +568 -0
- package/dist/whatsapp-routes.js +182 -0
- package/dist/zip-utils.js +109 -0
- package/milady.mjs +14 -0
- package/package.json +111 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//#region src/config/telegram-custom-commands.ts
|
|
2
|
+
const TELEGRAM_COMMAND_NAME_PATTERN = /^[a-z0-9_]{1,32}$/;
|
|
3
|
+
function normalizeTelegramCommandName(value) {
|
|
4
|
+
const trimmed = value.trim();
|
|
5
|
+
if (!trimmed) return "";
|
|
6
|
+
return (trimmed.startsWith("/") ? trimmed.slice(1) : trimmed).trim().toLowerCase();
|
|
7
|
+
}
|
|
8
|
+
function normalizeTelegramCommandDescription(value) {
|
|
9
|
+
return value.trim();
|
|
10
|
+
}
|
|
11
|
+
function resolveTelegramCustomCommands(params) {
|
|
12
|
+
const entries = Array.isArray(params.commands) ? params.commands : [];
|
|
13
|
+
const reserved = params.reservedCommands ?? /* @__PURE__ */ new Set();
|
|
14
|
+
const checkReserved = params.checkReserved !== false;
|
|
15
|
+
const checkDuplicates = params.checkDuplicates !== false;
|
|
16
|
+
const seen = /* @__PURE__ */ new Set();
|
|
17
|
+
const resolved = [];
|
|
18
|
+
const issues = [];
|
|
19
|
+
for (let index = 0; index < entries.length; index += 1) {
|
|
20
|
+
const entry = entries[index];
|
|
21
|
+
const normalized = normalizeTelegramCommandName(String(entry?.command ?? ""));
|
|
22
|
+
if (!normalized) {
|
|
23
|
+
issues.push({
|
|
24
|
+
index,
|
|
25
|
+
field: "command",
|
|
26
|
+
message: "Telegram custom command is missing a command name."
|
|
27
|
+
});
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (!TELEGRAM_COMMAND_NAME_PATTERN.test(normalized)) {
|
|
31
|
+
issues.push({
|
|
32
|
+
index,
|
|
33
|
+
field: "command",
|
|
34
|
+
message: `Telegram custom command "/${normalized}" is invalid (use a-z, 0-9, underscore; max 32 chars).`
|
|
35
|
+
});
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (checkReserved && reserved.has(normalized)) {
|
|
39
|
+
issues.push({
|
|
40
|
+
index,
|
|
41
|
+
field: "command",
|
|
42
|
+
message: `Telegram custom command "/${normalized}" conflicts with a native command.`
|
|
43
|
+
});
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (checkDuplicates && seen.has(normalized)) {
|
|
47
|
+
issues.push({
|
|
48
|
+
index,
|
|
49
|
+
field: "command",
|
|
50
|
+
message: `Telegram custom command "/${normalized}" is duplicated.`
|
|
51
|
+
});
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const description = normalizeTelegramCommandDescription(String(entry?.description ?? ""));
|
|
55
|
+
if (!description) {
|
|
56
|
+
issues.push({
|
|
57
|
+
index,
|
|
58
|
+
field: "description",
|
|
59
|
+
message: `Telegram custom command "/${normalized}" is missing a description.`
|
|
60
|
+
});
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (checkDuplicates) seen.add(normalized);
|
|
64
|
+
resolved.push({
|
|
65
|
+
command: normalized,
|
|
66
|
+
description
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
commands: resolved,
|
|
71
|
+
issues
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { normalizeTelegramCommandDescription, normalizeTelegramCommandName, resolveTelegramCustomCommands };
|
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
import { parseDurationMs } from "../cli/parse-duration.js";
|
|
2
|
+
import { BlockStreamingChunkSchema, BlockStreamingCoalesceSchema, CliBackendSchema, GroupChatSchema, HumanDelaySchema, IdentitySchema, ToolsLinksSchema, ToolsMediaSchema } from "./zod-schema.core.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/config/zod-schema.agent-runtime.ts
|
|
6
|
+
const HeartbeatSchema = z.object({
|
|
7
|
+
every: z.string().optional(),
|
|
8
|
+
activeHours: z.object({
|
|
9
|
+
start: z.string().optional(),
|
|
10
|
+
end: z.string().optional(),
|
|
11
|
+
timezone: z.string().optional()
|
|
12
|
+
}).strict().optional(),
|
|
13
|
+
model: z.string().optional(),
|
|
14
|
+
session: z.string().optional(),
|
|
15
|
+
includeReasoning: z.boolean().optional(),
|
|
16
|
+
target: z.string().optional(),
|
|
17
|
+
to: z.string().optional(),
|
|
18
|
+
prompt: z.string().optional(),
|
|
19
|
+
ackMaxChars: z.number().int().nonnegative().optional()
|
|
20
|
+
}).strict().superRefine((val, ctx) => {
|
|
21
|
+
if (!val.every) return;
|
|
22
|
+
try {
|
|
23
|
+
parseDurationMs(val.every, { defaultUnit: "m" });
|
|
24
|
+
} catch {
|
|
25
|
+
ctx.addIssue({
|
|
26
|
+
code: z.ZodIssueCode.custom,
|
|
27
|
+
path: ["every"],
|
|
28
|
+
message: "invalid duration (use ms, s, m, h)"
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const active = val.activeHours;
|
|
32
|
+
if (!active) return;
|
|
33
|
+
const timePattern = /^([01]\d|2[0-3]|24):([0-5]\d)$/;
|
|
34
|
+
const validateTime = (raw, opts, path) => {
|
|
35
|
+
if (!raw) return;
|
|
36
|
+
if (!timePattern.test(raw)) {
|
|
37
|
+
ctx.addIssue({
|
|
38
|
+
code: z.ZodIssueCode.custom,
|
|
39
|
+
path: ["activeHours", path],
|
|
40
|
+
message: "invalid time (use \"HH:MM\" 24h format)"
|
|
41
|
+
});
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const [hourStr, minuteStr] = raw.split(":");
|
|
45
|
+
const hour = Number(hourStr);
|
|
46
|
+
if (hour === 24 && Number(minuteStr) !== 0) {
|
|
47
|
+
ctx.addIssue({
|
|
48
|
+
code: z.ZodIssueCode.custom,
|
|
49
|
+
path: ["activeHours", path],
|
|
50
|
+
message: "invalid time (24:00 is the only allowed 24:xx value)"
|
|
51
|
+
});
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (hour === 24 && !opts.allow24) ctx.addIssue({
|
|
55
|
+
code: z.ZodIssueCode.custom,
|
|
56
|
+
path: ["activeHours", path],
|
|
57
|
+
message: "invalid time (start cannot be 24:00)"
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
validateTime(active.start, { allow24: false }, "start");
|
|
61
|
+
validateTime(active.end, { allow24: true }, "end");
|
|
62
|
+
}).optional();
|
|
63
|
+
const SandboxDockerSchema = z.object({
|
|
64
|
+
image: z.string().optional(),
|
|
65
|
+
containerPrefix: z.string().optional(),
|
|
66
|
+
workdir: z.string().optional(),
|
|
67
|
+
readOnlyRoot: z.boolean().optional(),
|
|
68
|
+
tmpfs: z.array(z.string()).optional(),
|
|
69
|
+
network: z.string().optional(),
|
|
70
|
+
user: z.string().optional(),
|
|
71
|
+
capDrop: z.array(z.string()).optional(),
|
|
72
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
73
|
+
setupCommand: z.string().optional(),
|
|
74
|
+
pidsLimit: z.number().int().positive().optional(),
|
|
75
|
+
memory: z.union([z.string(), z.number()]).optional(),
|
|
76
|
+
memorySwap: z.union([z.string(), z.number()]).optional(),
|
|
77
|
+
cpus: z.number().positive().optional(),
|
|
78
|
+
ulimits: z.record(z.string(), z.union([
|
|
79
|
+
z.string(),
|
|
80
|
+
z.number(),
|
|
81
|
+
z.object({
|
|
82
|
+
soft: z.number().int().nonnegative().optional(),
|
|
83
|
+
hard: z.number().int().nonnegative().optional()
|
|
84
|
+
}).strict()
|
|
85
|
+
])).optional(),
|
|
86
|
+
seccompProfile: z.string().optional(),
|
|
87
|
+
apparmorProfile: z.string().optional(),
|
|
88
|
+
dns: z.array(z.string()).optional(),
|
|
89
|
+
extraHosts: z.array(z.string()).optional(),
|
|
90
|
+
binds: z.array(z.string()).optional()
|
|
91
|
+
}).strict().optional();
|
|
92
|
+
const SandboxBrowserSchema = z.object({
|
|
93
|
+
enabled: z.boolean().optional(),
|
|
94
|
+
image: z.string().optional(),
|
|
95
|
+
containerPrefix: z.string().optional(),
|
|
96
|
+
cdpPort: z.number().int().positive().optional(),
|
|
97
|
+
vncPort: z.number().int().positive().optional(),
|
|
98
|
+
noVncPort: z.number().int().positive().optional(),
|
|
99
|
+
headless: z.boolean().optional(),
|
|
100
|
+
enableNoVnc: z.boolean().optional(),
|
|
101
|
+
allowHostControl: z.boolean().optional(),
|
|
102
|
+
autoStart: z.boolean().optional(),
|
|
103
|
+
autoStartTimeoutMs: z.number().int().positive().optional()
|
|
104
|
+
}).strict().optional();
|
|
105
|
+
const SandboxPruneSchema = z.object({
|
|
106
|
+
idleHours: z.number().int().nonnegative().optional(),
|
|
107
|
+
maxAgeDays: z.number().int().nonnegative().optional()
|
|
108
|
+
}).strict().optional();
|
|
109
|
+
const ToolPolicyBaseSchema = z.object({
|
|
110
|
+
allow: z.array(z.string()).optional(),
|
|
111
|
+
alsoAllow: z.array(z.string()).optional(),
|
|
112
|
+
deny: z.array(z.string()).optional()
|
|
113
|
+
}).strict();
|
|
114
|
+
const validateToolPolicyConflict = (scope, value, ctx) => {
|
|
115
|
+
if (value.allow && value.allow.length > 0 && value.alsoAllow && value.alsoAllow.length > 0) ctx.addIssue({
|
|
116
|
+
code: z.ZodIssueCode.custom,
|
|
117
|
+
message: `${scope} cannot set both allow and alsoAllow in the same scope (merge alsoAllow into allow, or remove allow and use profile + alsoAllow)`
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
const makeToolPolicySchema = (scope) => ToolPolicyBaseSchema.superRefine((value, ctx) => {
|
|
121
|
+
validateToolPolicyConflict(scope, value, ctx);
|
|
122
|
+
});
|
|
123
|
+
const ToolsWebSearchSchema = z.object({
|
|
124
|
+
enabled: z.boolean().optional(),
|
|
125
|
+
provider: z.union([z.literal("brave"), z.literal("perplexity")]).optional(),
|
|
126
|
+
apiKey: z.string().optional(),
|
|
127
|
+
maxResults: z.number().int().positive().optional(),
|
|
128
|
+
timeoutSeconds: z.number().int().positive().optional(),
|
|
129
|
+
cacheTtlMinutes: z.number().nonnegative().optional(),
|
|
130
|
+
perplexity: z.object({
|
|
131
|
+
apiKey: z.string().optional(),
|
|
132
|
+
baseUrl: z.string().optional(),
|
|
133
|
+
model: z.string().optional()
|
|
134
|
+
}).strict().optional()
|
|
135
|
+
}).strict().optional();
|
|
136
|
+
const ToolsWebFetchSchema = z.object({
|
|
137
|
+
enabled: z.boolean().optional(),
|
|
138
|
+
maxChars: z.number().int().positive().optional(),
|
|
139
|
+
maxCharsCap: z.number().int().positive().optional(),
|
|
140
|
+
timeoutSeconds: z.number().int().positive().optional(),
|
|
141
|
+
cacheTtlMinutes: z.number().nonnegative().optional(),
|
|
142
|
+
maxRedirects: z.number().int().nonnegative().optional(),
|
|
143
|
+
userAgent: z.string().optional()
|
|
144
|
+
}).strict().optional();
|
|
145
|
+
const ToolsWebSchema = z.object({
|
|
146
|
+
search: ToolsWebSearchSchema,
|
|
147
|
+
fetch: ToolsWebFetchSchema
|
|
148
|
+
}).strict().optional();
|
|
149
|
+
const ToolProfileSchema = z.union([
|
|
150
|
+
z.literal("minimal"),
|
|
151
|
+
z.literal("coding"),
|
|
152
|
+
z.literal("messaging"),
|
|
153
|
+
z.literal("full")
|
|
154
|
+
]).optional();
|
|
155
|
+
const ToolPolicySchema = makeToolPolicySchema("tools policy").optional();
|
|
156
|
+
const ToolPolicyWithProfileSchema = makeToolPolicySchema("tools.byProvider policy").extend({ profile: ToolProfileSchema }).strict();
|
|
157
|
+
const ElevatedAllowFromSchema = z.record(z.string(), z.array(z.union([z.string(), z.number()]))).optional();
|
|
158
|
+
const AgentSandboxSchema = z.object({
|
|
159
|
+
mode: z.union([
|
|
160
|
+
z.literal("off"),
|
|
161
|
+
z.literal("non-main"),
|
|
162
|
+
z.literal("all")
|
|
163
|
+
]).optional(),
|
|
164
|
+
workspaceAccess: z.union([
|
|
165
|
+
z.literal("none"),
|
|
166
|
+
z.literal("ro"),
|
|
167
|
+
z.literal("rw")
|
|
168
|
+
]).optional(),
|
|
169
|
+
sessionToolsVisibility: z.union([z.literal("spawned"), z.literal("all")]).optional(),
|
|
170
|
+
scope: z.union([
|
|
171
|
+
z.literal("session"),
|
|
172
|
+
z.literal("agent"),
|
|
173
|
+
z.literal("shared")
|
|
174
|
+
]).optional(),
|
|
175
|
+
perSession: z.boolean().optional(),
|
|
176
|
+
workspaceRoot: z.string().optional(),
|
|
177
|
+
docker: SandboxDockerSchema,
|
|
178
|
+
browser: SandboxBrowserSchema,
|
|
179
|
+
prune: SandboxPruneSchema
|
|
180
|
+
}).strict().optional();
|
|
181
|
+
const AgentToolsSchema = z.object({
|
|
182
|
+
profile: ToolProfileSchema,
|
|
183
|
+
allow: z.array(z.string()).optional(),
|
|
184
|
+
alsoAllow: z.array(z.string()).optional(),
|
|
185
|
+
deny: z.array(z.string()).optional(),
|
|
186
|
+
byProvider: z.record(z.string(), ToolPolicyWithProfileSchema).optional(),
|
|
187
|
+
elevated: z.object({
|
|
188
|
+
enabled: z.boolean().optional(),
|
|
189
|
+
allowFrom: ElevatedAllowFromSchema
|
|
190
|
+
}).strict().optional(),
|
|
191
|
+
exec: z.object({
|
|
192
|
+
host: z.enum([
|
|
193
|
+
"sandbox",
|
|
194
|
+
"gateway",
|
|
195
|
+
"node"
|
|
196
|
+
]).optional(),
|
|
197
|
+
security: z.enum([
|
|
198
|
+
"deny",
|
|
199
|
+
"allowlist",
|
|
200
|
+
"full"
|
|
201
|
+
]).optional(),
|
|
202
|
+
ask: z.enum([
|
|
203
|
+
"off",
|
|
204
|
+
"on-miss",
|
|
205
|
+
"always"
|
|
206
|
+
]).optional(),
|
|
207
|
+
node: z.string().optional(),
|
|
208
|
+
pathPrepend: z.array(z.string()).optional(),
|
|
209
|
+
safeBins: z.array(z.string()).optional(),
|
|
210
|
+
backgroundMs: z.number().int().positive().optional(),
|
|
211
|
+
timeoutSec: z.number().int().positive().optional(),
|
|
212
|
+
approvalRunningNoticeMs: z.number().int().nonnegative().optional(),
|
|
213
|
+
cleanupMs: z.number().int().positive().optional(),
|
|
214
|
+
notifyOnExit: z.boolean().optional(),
|
|
215
|
+
applyPatch: z.object({
|
|
216
|
+
enabled: z.boolean().optional(),
|
|
217
|
+
allowModels: z.array(z.string()).optional()
|
|
218
|
+
}).strict().optional()
|
|
219
|
+
}).strict().optional(),
|
|
220
|
+
sandbox: z.object({ tools: ToolPolicySchema }).strict().optional()
|
|
221
|
+
}).strict().superRefine((value, ctx) => {
|
|
222
|
+
validateToolPolicyConflict("agent tools", value, ctx);
|
|
223
|
+
}).optional();
|
|
224
|
+
const MemorySearchSchema = z.object({
|
|
225
|
+
enabled: z.boolean().optional(),
|
|
226
|
+
sources: z.array(z.union([z.literal("memory"), z.literal("sessions")])).optional(),
|
|
227
|
+
extraPaths: z.array(z.string()).optional(),
|
|
228
|
+
experimental: z.object({ sessionMemory: z.boolean().optional() }).strict().optional(),
|
|
229
|
+
provider: z.union([
|
|
230
|
+
z.literal("openai"),
|
|
231
|
+
z.literal("local"),
|
|
232
|
+
z.literal("gemini")
|
|
233
|
+
]).optional(),
|
|
234
|
+
remote: z.object({
|
|
235
|
+
baseUrl: z.string().optional(),
|
|
236
|
+
apiKey: z.string().optional(),
|
|
237
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
238
|
+
batch: z.object({
|
|
239
|
+
enabled: z.boolean().optional(),
|
|
240
|
+
wait: z.boolean().optional(),
|
|
241
|
+
concurrency: z.number().int().positive().optional(),
|
|
242
|
+
pollIntervalMs: z.number().int().nonnegative().optional(),
|
|
243
|
+
timeoutMinutes: z.number().int().positive().optional()
|
|
244
|
+
}).strict().optional()
|
|
245
|
+
}).strict().optional(),
|
|
246
|
+
fallback: z.union([
|
|
247
|
+
z.literal("openai"),
|
|
248
|
+
z.literal("gemini"),
|
|
249
|
+
z.literal("local"),
|
|
250
|
+
z.literal("none")
|
|
251
|
+
]).optional(),
|
|
252
|
+
model: z.string().optional(),
|
|
253
|
+
local: z.object({
|
|
254
|
+
modelPath: z.string().optional(),
|
|
255
|
+
modelCacheDir: z.string().optional()
|
|
256
|
+
}).strict().optional(),
|
|
257
|
+
store: z.object({
|
|
258
|
+
driver: z.literal("sqlite").optional(),
|
|
259
|
+
path: z.string().optional(),
|
|
260
|
+
vector: z.object({
|
|
261
|
+
enabled: z.boolean().optional(),
|
|
262
|
+
extensionPath: z.string().optional()
|
|
263
|
+
}).strict().optional()
|
|
264
|
+
}).strict().optional(),
|
|
265
|
+
chunking: z.object({
|
|
266
|
+
tokens: z.number().int().positive().optional(),
|
|
267
|
+
overlap: z.number().int().nonnegative().optional()
|
|
268
|
+
}).strict().optional(),
|
|
269
|
+
sync: z.object({
|
|
270
|
+
onSessionStart: z.boolean().optional(),
|
|
271
|
+
onSearch: z.boolean().optional(),
|
|
272
|
+
watch: z.boolean().optional(),
|
|
273
|
+
watchDebounceMs: z.number().int().nonnegative().optional(),
|
|
274
|
+
intervalMinutes: z.number().int().nonnegative().optional(),
|
|
275
|
+
sessions: z.object({
|
|
276
|
+
deltaBytes: z.number().int().nonnegative().optional(),
|
|
277
|
+
deltaMessages: z.number().int().nonnegative().optional()
|
|
278
|
+
}).strict().optional()
|
|
279
|
+
}).strict().optional(),
|
|
280
|
+
query: z.object({
|
|
281
|
+
maxResults: z.number().int().positive().optional(),
|
|
282
|
+
minScore: z.number().min(0).max(1).optional(),
|
|
283
|
+
hybrid: z.object({
|
|
284
|
+
enabled: z.boolean().optional(),
|
|
285
|
+
vectorWeight: z.number().min(0).max(1).optional(),
|
|
286
|
+
textWeight: z.number().min(0).max(1).optional(),
|
|
287
|
+
candidateMultiplier: z.number().int().positive().optional()
|
|
288
|
+
}).strict().optional()
|
|
289
|
+
}).strict().optional(),
|
|
290
|
+
cache: z.object({
|
|
291
|
+
enabled: z.boolean().optional(),
|
|
292
|
+
maxEntries: z.number().int().positive().optional()
|
|
293
|
+
}).strict().optional()
|
|
294
|
+
}).strict().optional();
|
|
295
|
+
const AgentModelSchema = z.union([z.string(), z.object({
|
|
296
|
+
primary: z.string().optional(),
|
|
297
|
+
fallbacks: z.array(z.string()).optional()
|
|
298
|
+
}).strict()]);
|
|
299
|
+
const AgentEntrySchema = z.object({
|
|
300
|
+
id: z.string(),
|
|
301
|
+
default: z.boolean().optional(),
|
|
302
|
+
name: z.string().optional(),
|
|
303
|
+
workspace: z.string().optional(),
|
|
304
|
+
agentDir: z.string().optional(),
|
|
305
|
+
model: AgentModelSchema.optional(),
|
|
306
|
+
skills: z.array(z.string()).optional(),
|
|
307
|
+
memorySearch: MemorySearchSchema,
|
|
308
|
+
humanDelay: HumanDelaySchema.optional(),
|
|
309
|
+
heartbeat: HeartbeatSchema,
|
|
310
|
+
identity: IdentitySchema,
|
|
311
|
+
groupChat: GroupChatSchema,
|
|
312
|
+
subagents: z.object({
|
|
313
|
+
allowAgents: z.array(z.string()).optional(),
|
|
314
|
+
model: z.union([z.string(), z.object({
|
|
315
|
+
primary: z.string().optional(),
|
|
316
|
+
fallbacks: z.array(z.string()).optional()
|
|
317
|
+
}).strict()]).optional(),
|
|
318
|
+
thinking: z.string().optional()
|
|
319
|
+
}).strict().optional(),
|
|
320
|
+
sandbox: AgentSandboxSchema,
|
|
321
|
+
tools: AgentToolsSchema
|
|
322
|
+
}).strict();
|
|
323
|
+
const ToolsSchema = z.object({
|
|
324
|
+
profile: ToolProfileSchema,
|
|
325
|
+
allow: z.array(z.string()).optional(),
|
|
326
|
+
alsoAllow: z.array(z.string()).optional(),
|
|
327
|
+
deny: z.array(z.string()).optional(),
|
|
328
|
+
byProvider: z.record(z.string(), ToolPolicyWithProfileSchema).optional(),
|
|
329
|
+
web: ToolsWebSchema,
|
|
330
|
+
media: ToolsMediaSchema,
|
|
331
|
+
links: ToolsLinksSchema,
|
|
332
|
+
message: z.object({
|
|
333
|
+
allowCrossContextSend: z.boolean().optional(),
|
|
334
|
+
crossContext: z.object({
|
|
335
|
+
allowWithinProvider: z.boolean().optional(),
|
|
336
|
+
allowAcrossProviders: z.boolean().optional(),
|
|
337
|
+
marker: z.object({
|
|
338
|
+
enabled: z.boolean().optional(),
|
|
339
|
+
prefix: z.string().optional(),
|
|
340
|
+
suffix: z.string().optional()
|
|
341
|
+
}).strict().optional()
|
|
342
|
+
}).strict().optional(),
|
|
343
|
+
broadcast: z.object({ enabled: z.boolean().optional() }).strict().optional()
|
|
344
|
+
}).strict().optional(),
|
|
345
|
+
agentToAgent: z.object({
|
|
346
|
+
enabled: z.boolean().optional(),
|
|
347
|
+
allow: z.array(z.string()).optional()
|
|
348
|
+
}).strict().optional(),
|
|
349
|
+
elevated: z.object({
|
|
350
|
+
enabled: z.boolean().optional(),
|
|
351
|
+
allowFrom: ElevatedAllowFromSchema
|
|
352
|
+
}).strict().optional(),
|
|
353
|
+
exec: z.object({
|
|
354
|
+
host: z.enum([
|
|
355
|
+
"sandbox",
|
|
356
|
+
"gateway",
|
|
357
|
+
"node"
|
|
358
|
+
]).optional(),
|
|
359
|
+
security: z.enum([
|
|
360
|
+
"deny",
|
|
361
|
+
"allowlist",
|
|
362
|
+
"full"
|
|
363
|
+
]).optional(),
|
|
364
|
+
ask: z.enum([
|
|
365
|
+
"off",
|
|
366
|
+
"on-miss",
|
|
367
|
+
"always"
|
|
368
|
+
]).optional(),
|
|
369
|
+
node: z.string().optional(),
|
|
370
|
+
pathPrepend: z.array(z.string()).optional(),
|
|
371
|
+
safeBins: z.array(z.string()).optional(),
|
|
372
|
+
backgroundMs: z.number().int().positive().optional(),
|
|
373
|
+
timeoutSec: z.number().int().positive().optional(),
|
|
374
|
+
cleanupMs: z.number().int().positive().optional(),
|
|
375
|
+
notifyOnExit: z.boolean().optional(),
|
|
376
|
+
applyPatch: z.object({
|
|
377
|
+
enabled: z.boolean().optional(),
|
|
378
|
+
allowModels: z.array(z.string()).optional()
|
|
379
|
+
}).strict().optional()
|
|
380
|
+
}).strict().optional(),
|
|
381
|
+
subagents: z.object({ tools: ToolPolicySchema }).strict().optional(),
|
|
382
|
+
sandbox: z.object({ tools: ToolPolicySchema }).strict().optional()
|
|
383
|
+
}).strict().superRefine((value, ctx) => {
|
|
384
|
+
validateToolPolicyConflict("tools", value, ctx);
|
|
385
|
+
}).optional();
|
|
386
|
+
const AgentDefaultsSchema = z.object({
|
|
387
|
+
model: z.object({
|
|
388
|
+
primary: z.string().optional(),
|
|
389
|
+
fallbacks: z.array(z.string()).optional()
|
|
390
|
+
}).strict().optional(),
|
|
391
|
+
imageModel: z.object({
|
|
392
|
+
primary: z.string().optional(),
|
|
393
|
+
fallbacks: z.array(z.string()).optional()
|
|
394
|
+
}).strict().optional(),
|
|
395
|
+
models: z.record(z.string(), z.object({
|
|
396
|
+
alias: z.string().optional(),
|
|
397
|
+
params: z.record(z.string(), z.unknown()).optional()
|
|
398
|
+
}).strict()).optional(),
|
|
399
|
+
workspace: z.string().optional(),
|
|
400
|
+
adminEntityId: z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, "invalid UUID format").optional(),
|
|
401
|
+
repoRoot: z.string().optional(),
|
|
402
|
+
skipBootstrap: z.boolean().optional(),
|
|
403
|
+
bootstrapMaxChars: z.number().int().positive().optional(),
|
|
404
|
+
enableBootstrapProviders: z.boolean().optional(),
|
|
405
|
+
userTimezone: z.string().optional(),
|
|
406
|
+
timeFormat: z.union([
|
|
407
|
+
z.literal("auto"),
|
|
408
|
+
z.literal("12"),
|
|
409
|
+
z.literal("24")
|
|
410
|
+
]).optional(),
|
|
411
|
+
envelopeTimezone: z.string().optional(),
|
|
412
|
+
envelopeTimestamp: z.union([z.literal("on"), z.literal("off")]).optional(),
|
|
413
|
+
envelopeElapsed: z.union([z.literal("on"), z.literal("off")]).optional(),
|
|
414
|
+
contextTokens: z.number().int().positive().optional(),
|
|
415
|
+
cliBackends: z.record(z.string(), CliBackendSchema).optional(),
|
|
416
|
+
memorySearch: MemorySearchSchema,
|
|
417
|
+
contextPruning: z.object({
|
|
418
|
+
mode: z.union([z.literal("off"), z.literal("cache-ttl")]).optional(),
|
|
419
|
+
ttl: z.string().optional(),
|
|
420
|
+
keepLastAssistants: z.number().int().nonnegative().optional(),
|
|
421
|
+
softTrimRatio: z.number().min(0).max(1).optional(),
|
|
422
|
+
hardClearRatio: z.number().min(0).max(1).optional(),
|
|
423
|
+
minPrunableToolChars: z.number().int().nonnegative().optional(),
|
|
424
|
+
tools: z.object({
|
|
425
|
+
allow: z.array(z.string()).optional(),
|
|
426
|
+
deny: z.array(z.string()).optional()
|
|
427
|
+
}).strict().optional(),
|
|
428
|
+
softTrim: z.object({
|
|
429
|
+
maxChars: z.number().int().nonnegative().optional(),
|
|
430
|
+
headChars: z.number().int().nonnegative().optional(),
|
|
431
|
+
tailChars: z.number().int().nonnegative().optional()
|
|
432
|
+
}).strict().optional(),
|
|
433
|
+
hardClear: z.object({
|
|
434
|
+
enabled: z.boolean().optional(),
|
|
435
|
+
placeholder: z.string().optional()
|
|
436
|
+
}).strict().optional()
|
|
437
|
+
}).strict().optional(),
|
|
438
|
+
compaction: z.object({
|
|
439
|
+
mode: z.union([z.literal("default"), z.literal("safeguard")]).optional(),
|
|
440
|
+
reserveTokensFloor: z.number().int().nonnegative().optional(),
|
|
441
|
+
maxHistoryShare: z.number().min(.1).max(.9).optional(),
|
|
442
|
+
memoryFlush: z.object({
|
|
443
|
+
enabled: z.boolean().optional(),
|
|
444
|
+
softThresholdTokens: z.number().int().nonnegative().optional(),
|
|
445
|
+
prompt: z.string().optional(),
|
|
446
|
+
systemPrompt: z.string().optional()
|
|
447
|
+
}).strict().optional()
|
|
448
|
+
}).strict().optional(),
|
|
449
|
+
thinkingDefault: z.union([
|
|
450
|
+
z.literal("off"),
|
|
451
|
+
z.literal("minimal"),
|
|
452
|
+
z.literal("low"),
|
|
453
|
+
z.literal("medium"),
|
|
454
|
+
z.literal("high"),
|
|
455
|
+
z.literal("xhigh")
|
|
456
|
+
]).optional(),
|
|
457
|
+
verboseDefault: z.union([
|
|
458
|
+
z.literal("off"),
|
|
459
|
+
z.literal("on"),
|
|
460
|
+
z.literal("full")
|
|
461
|
+
]).optional(),
|
|
462
|
+
elevatedDefault: z.union([
|
|
463
|
+
z.literal("off"),
|
|
464
|
+
z.literal("on"),
|
|
465
|
+
z.literal("ask"),
|
|
466
|
+
z.literal("full")
|
|
467
|
+
]).optional(),
|
|
468
|
+
blockStreamingDefault: z.union([z.literal("off"), z.literal("on")]).optional(),
|
|
469
|
+
blockStreamingBreak: z.union([z.literal("text_end"), z.literal("message_end")]).optional(),
|
|
470
|
+
blockStreamingChunk: BlockStreamingChunkSchema.optional(),
|
|
471
|
+
blockStreamingCoalesce: BlockStreamingCoalesceSchema.optional(),
|
|
472
|
+
humanDelay: HumanDelaySchema.optional(),
|
|
473
|
+
timeoutSeconds: z.number().int().positive().optional(),
|
|
474
|
+
mediaMaxMb: z.number().positive().optional(),
|
|
475
|
+
typingIntervalSeconds: z.number().int().positive().optional(),
|
|
476
|
+
typingMode: z.union([
|
|
477
|
+
z.literal("never"),
|
|
478
|
+
z.literal("instant"),
|
|
479
|
+
z.literal("thinking"),
|
|
480
|
+
z.literal("message")
|
|
481
|
+
]).optional(),
|
|
482
|
+
heartbeat: HeartbeatSchema,
|
|
483
|
+
maxConcurrent: z.number().int().positive().optional(),
|
|
484
|
+
subagents: z.object({
|
|
485
|
+
maxConcurrent: z.number().int().positive().optional(),
|
|
486
|
+
archiveAfterMinutes: z.number().int().positive().optional(),
|
|
487
|
+
model: z.union([z.string(), z.object({
|
|
488
|
+
primary: z.string().optional(),
|
|
489
|
+
fallbacks: z.array(z.string()).optional()
|
|
490
|
+
}).strict()]).optional(),
|
|
491
|
+
thinking: z.string().optional()
|
|
492
|
+
}).strict().optional(),
|
|
493
|
+
sandbox: z.object({
|
|
494
|
+
mode: z.union([
|
|
495
|
+
z.literal("off"),
|
|
496
|
+
z.literal("non-main"),
|
|
497
|
+
z.literal("all")
|
|
498
|
+
]).optional(),
|
|
499
|
+
workspaceAccess: z.union([
|
|
500
|
+
z.literal("none"),
|
|
501
|
+
z.literal("ro"),
|
|
502
|
+
z.literal("rw")
|
|
503
|
+
]).optional(),
|
|
504
|
+
sessionToolsVisibility: z.union([z.literal("spawned"), z.literal("all")]).optional(),
|
|
505
|
+
scope: z.union([
|
|
506
|
+
z.literal("session"),
|
|
507
|
+
z.literal("agent"),
|
|
508
|
+
z.literal("shared")
|
|
509
|
+
]).optional(),
|
|
510
|
+
perSession: z.boolean().optional(),
|
|
511
|
+
workspaceRoot: z.string().optional(),
|
|
512
|
+
docker: SandboxDockerSchema,
|
|
513
|
+
browser: SandboxBrowserSchema,
|
|
514
|
+
prune: SandboxPruneSchema
|
|
515
|
+
}).strict().optional()
|
|
516
|
+
}).strict().optional();
|
|
517
|
+
|
|
518
|
+
//#endregion
|
|
519
|
+
export { AgentDefaultsSchema, AgentEntrySchema, ToolPolicySchema, ToolsSchema };
|