@elizaos/autonomous 2.0.0-alpha.10
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/LICENSE +21 -0
- package/package.json +270 -0
- package/src/actions/emote.ts +101 -0
- package/src/actions/restart.ts +101 -0
- package/src/actions/send-message.ts +168 -0
- package/src/actions/stream-control.ts +439 -0
- package/src/actions/switch-stream-source.ts +126 -0
- package/src/actions/terminal.ts +186 -0
- package/src/api/agent-admin-routes.ts +178 -0
- package/src/api/agent-lifecycle-routes.ts +129 -0
- package/src/api/agent-model.ts +143 -0
- package/src/api/agent-transfer-routes.ts +211 -0
- package/src/api/apps-routes.ts +210 -0
- package/src/api/auth-routes.ts +90 -0
- package/src/api/bsc-trade.ts +736 -0
- package/src/api/bug-report-routes.ts +161 -0
- package/src/api/character-routes.ts +421 -0
- package/src/api/cloud-billing-routes.ts +598 -0
- package/src/api/cloud-compat-routes.ts +192 -0
- package/src/api/cloud-routes.ts +529 -0
- package/src/api/cloud-status-routes.ts +234 -0
- package/src/api/compat-utils.ts +154 -0
- package/src/api/connector-health.ts +135 -0
- package/src/api/coordinator-wiring.ts +179 -0
- package/src/api/credit-detection.ts +47 -0
- package/src/api/database.ts +1357 -0
- package/src/api/diagnostics-routes.ts +389 -0
- package/src/api/drop-service.ts +205 -0
- package/src/api/early-logs.ts +111 -0
- package/src/api/http-helpers.ts +252 -0
- package/src/api/index.ts +85 -0
- package/src/api/knowledge-routes.ts +1189 -0
- package/src/api/knowledge-service-loader.ts +92 -0
- package/src/api/memory-bounds.ts +121 -0
- package/src/api/memory-routes.ts +349 -0
- package/src/api/merkle-tree.ts +239 -0
- package/src/api/models-routes.ts +72 -0
- package/src/api/nfa-routes.ts +169 -0
- package/src/api/nft-verify.ts +188 -0
- package/src/api/og-tracker.ts +72 -0
- package/src/api/parse-action-block.ts +145 -0
- package/src/api/permissions-routes.ts +222 -0
- package/src/api/plugin-validation.ts +355 -0
- package/src/api/provider-switch-config.ts +455 -0
- package/src/api/registry-routes.ts +165 -0
- package/src/api/registry-service.ts +292 -0
- package/src/api/route-helpers.ts +21 -0
- package/src/api/sandbox-routes.ts +1480 -0
- package/src/api/server.ts +17674 -0
- package/src/api/signal-routes.ts +265 -0
- package/src/api/stream-persistence.ts +297 -0
- package/src/api/stream-route-state.ts +48 -0
- package/src/api/stream-routes.ts +1046 -0
- package/src/api/stream-voice-routes.ts +208 -0
- package/src/api/streaming-text.ts +129 -0
- package/src/api/streaming-types.ts +23 -0
- package/src/api/subscription-routes.ts +283 -0
- package/src/api/terminal-run-limits.ts +31 -0
- package/src/api/training-backend-check.ts +40 -0
- package/src/api/training-routes.ts +314 -0
- package/src/api/training-service-like.ts +46 -0
- package/src/api/trajectory-routes.ts +714 -0
- package/src/api/trigger-routes.ts +438 -0
- package/src/api/twitter-verify.ts +226 -0
- package/src/api/tx-service.ts +193 -0
- package/src/api/wallet-dex-prices.ts +206 -0
- package/src/api/wallet-evm-balance.ts +989 -0
- package/src/api/wallet-routes.ts +505 -0
- package/src/api/wallet-rpc.ts +523 -0
- package/src/api/wallet-trading-profile.ts +694 -0
- package/src/api/wallet.ts +745 -0
- package/src/api/whatsapp-routes.ts +282 -0
- package/src/api/zip-utils.ts +130 -0
- package/src/auth/anthropic.ts +63 -0
- package/src/auth/apply-stealth.ts +38 -0
- package/src/auth/claude-code-stealth.ts +141 -0
- package/src/auth/credentials.ts +226 -0
- package/src/auth/index.ts +18 -0
- package/src/auth/openai-codex.ts +94 -0
- package/src/auth/types.ts +24 -0
- package/src/awareness/registry.ts +220 -0
- package/src/bin.ts +10 -0
- package/src/cli/index.ts +36 -0
- package/src/cli/parse-duration.ts +43 -0
- package/src/cloud/auth.test.ts +370 -0
- package/src/cloud/auth.ts +176 -0
- package/src/cloud/backup.test.ts +150 -0
- package/src/cloud/backup.ts +50 -0
- package/src/cloud/base-url.ts +45 -0
- package/src/cloud/bridge-client.test.ts +481 -0
- package/src/cloud/bridge-client.ts +307 -0
- package/src/cloud/cloud-manager.test.ts +223 -0
- package/src/cloud/cloud-manager.ts +151 -0
- package/src/cloud/cloud-proxy.test.ts +122 -0
- package/src/cloud/cloud-proxy.ts +52 -0
- package/src/cloud/index.ts +23 -0
- package/src/cloud/reconnect.test.ts +178 -0
- package/src/cloud/reconnect.ts +108 -0
- package/src/cloud/validate-url.test.ts +147 -0
- package/src/cloud/validate-url.ts +176 -0
- package/src/config/character-schema.ts +44 -0
- package/src/config/config.ts +149 -0
- package/src/config/env-vars.ts +86 -0
- package/src/config/includes.ts +196 -0
- package/src/config/index.ts +15 -0
- package/src/config/object-utils.ts +10 -0
- package/src/config/paths.ts +92 -0
- package/src/config/plugin-auto-enable.ts +520 -0
- package/src/config/schema.ts +1342 -0
- package/src/config/telegram-custom-commands.ts +99 -0
- package/src/config/types.agent-defaults.ts +342 -0
- package/src/config/types.agents.ts +112 -0
- package/src/config/types.gateway.ts +243 -0
- package/src/config/types.hooks.ts +124 -0
- package/src/config/types.messages.ts +201 -0
- package/src/config/types.milady.ts +791 -0
- package/src/config/types.tools.ts +416 -0
- package/src/config/types.ts +7 -0
- package/src/config/zod-schema.agent-runtime.ts +777 -0
- package/src/config/zod-schema.core.ts +778 -0
- package/src/config/zod-schema.hooks.ts +139 -0
- package/src/config/zod-schema.providers-core.ts +1126 -0
- package/src/config/zod-schema.session.ts +98 -0
- package/src/config/zod-schema.ts +865 -0
- package/src/contracts/apps.ts +46 -0
- package/src/contracts/awareness.ts +56 -0
- package/src/contracts/config.ts +172 -0
- package/src/contracts/drop.ts +21 -0
- package/src/contracts/index.ts +8 -0
- package/src/contracts/onboarding.ts +592 -0
- package/src/contracts/permissions.ts +52 -0
- package/src/contracts/verification.ts +9 -0
- package/src/contracts/wallet.ts +503 -0
- package/src/diagnostics/integration-observability.ts +132 -0
- package/src/emotes/catalog.ts +655 -0
- package/src/external-modules.d.ts +7 -0
- package/src/hooks/discovery.test.ts +357 -0
- package/src/hooks/discovery.ts +231 -0
- package/src/hooks/eligibility.ts +146 -0
- package/src/hooks/hooks.test.ts +320 -0
- package/src/hooks/index.ts +8 -0
- package/src/hooks/loader.test.ts +418 -0
- package/src/hooks/loader.ts +256 -0
- package/src/hooks/registry.test.ts +168 -0
- package/src/hooks/registry.ts +74 -0
- package/src/hooks/types.ts +121 -0
- package/src/index.ts +19 -0
- package/src/onboarding-presets.ts +828 -0
- package/src/plugins/custom-rtmp/index.ts +40 -0
- package/src/providers/admin-trust.ts +76 -0
- package/src/providers/session-bridge.ts +143 -0
- package/src/providers/session-utils.ts +42 -0
- package/src/providers/simple-mode.ts +113 -0
- package/src/providers/ui-catalog.ts +135 -0
- package/src/providers/workspace-provider.ts +213 -0
- package/src/providers/workspace.ts +497 -0
- package/src/runtime/agent-event-service.ts +57 -0
- package/src/runtime/cloud-onboarding.test.ts +489 -0
- package/src/runtime/cloud-onboarding.ts +408 -0
- package/src/runtime/core-plugins.ts +53 -0
- package/src/runtime/custom-actions.ts +605 -0
- package/src/runtime/eliza.ts +4941 -0
- package/src/runtime/embedding-presets.ts +73 -0
- package/src/runtime/index.ts +8 -0
- package/src/runtime/milady-plugin.ts +180 -0
- package/src/runtime/onboarding-names.ts +76 -0
- package/src/runtime/release-plugin-policy.ts +119 -0
- package/src/runtime/restart.ts +59 -0
- package/src/runtime/trajectory-persistence.ts +2584 -0
- package/src/runtime/version.ts +6 -0
- package/src/security/audit-log.ts +222 -0
- package/src/security/network-policy.ts +91 -0
- package/src/server/index.ts +6 -0
- package/src/services/agent-export.ts +976 -0
- package/src/services/app-manager.ts +755 -0
- package/src/services/browser-capture.ts +215 -0
- package/src/services/coding-agent-context.ts +355 -0
- package/src/services/fallback-training-service.ts +196 -0
- package/src/services/index.ts +17 -0
- package/src/services/mcp-marketplace.ts +327 -0
- package/src/services/plugin-manager-types.ts +185 -0
- package/src/services/privy-wallets.ts +352 -0
- package/src/services/registry-client-app-meta.ts +201 -0
- package/src/services/registry-client-endpoints.ts +253 -0
- package/src/services/registry-client-local.ts +485 -0
- package/src/services/registry-client-network.ts +173 -0
- package/src/services/registry-client-queries.ts +176 -0
- package/src/services/registry-client-types.ts +104 -0
- package/src/services/registry-client.ts +366 -0
- package/src/services/remote-signing-service.ts +261 -0
- package/src/services/sandbox-engine.ts +753 -0
- package/src/services/sandbox-manager.ts +503 -0
- package/src/services/self-updater.ts +213 -0
- package/src/services/signal-pairing.ts +189 -0
- package/src/services/signing-policy.ts +230 -0
- package/src/services/skill-catalog-client.ts +195 -0
- package/src/services/skill-marketplace.ts +909 -0
- package/src/services/stream-manager.ts +707 -0
- package/src/services/tts-stream-bridge.ts +465 -0
- package/src/services/update-checker.ts +163 -0
- package/src/services/version-compat.ts +367 -0
- package/src/services/whatsapp-pairing.ts +279 -0
- package/src/shared/ui-catalog-prompt.ts +1158 -0
- package/src/test-support/process-helpers.ts +35 -0
- package/src/test-support/route-test-helpers.ts +113 -0
- package/src/test-support/test-helpers.ts +304 -0
- package/src/testing/index.ts +3 -0
- package/src/triggers/action.ts +342 -0
- package/src/triggers/runtime.ts +432 -0
- package/src/triggers/scheduling.ts +472 -0
- package/src/triggers/types.ts +133 -0
- package/src/types/app-hyperscape-routes-shim.d.ts +29 -0
- package/src/types/external-modules.d.ts +7 -0
- package/src/utils/exec-safety.ts +23 -0
- package/src/utils/number-parsing.ts +112 -0
- package/src/utils/spoken-text.ts +65 -0
- package/src/version-resolver.ts +60 -0
- package/test/api/agent-admin-routes.test.ts +160 -0
- package/test/api/agent-lifecycle-routes.test.ts +164 -0
- package/test/api/agent-transfer-routes.test.ts +136 -0
- package/test/api/apps-routes.test.ts +140 -0
- package/test/api/auth-routes.test.ts +160 -0
- package/test/api/bug-report-routes.test.ts +88 -0
- package/test/api/knowledge-routes.test.ts +73 -0
- package/test/api/lifecycle.test.ts +342 -0
- package/test/api/memory-routes.test.ts +74 -0
- package/test/api/models-routes.test.ts +112 -0
- package/test/api/nfa-routes.test.ts +78 -0
- package/test/api/permissions-routes.test.ts +185 -0
- package/test/api/registry-routes.test.ts +157 -0
- package/test/api/signal-routes.test.ts +113 -0
- package/test/api/subscription-routes.test.ts +90 -0
- package/test/api/trigger-routes.test.ts +87 -0
- package/test/api/wallet-routes.observability.test.ts +191 -0
- package/test/api/wallet-routes.test.ts +502 -0
- package/test/diagnostics/integration-observability.test.ts +135 -0
- package/test/security/audit-log.test.ts +229 -0
- package/test/security/network-policy.test.ts +143 -0
- package/test/services/version-compat.test.ts +127 -0
- package/tsconfig.build.json +21 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { isSafeExecutableValue } from "../utils/exec-safety";
|
|
3
|
+
|
|
4
|
+
export const ModelApiSchema = z.union([
|
|
5
|
+
z.literal("openai-completions"),
|
|
6
|
+
z.literal("openai-responses"),
|
|
7
|
+
z.literal("anthropic-messages"),
|
|
8
|
+
z.literal("google-generative-ai"),
|
|
9
|
+
z.literal("bedrock-converse-stream"),
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
export const ModelCompatSchema = z
|
|
13
|
+
.object({
|
|
14
|
+
supportsStore: z.boolean().optional(),
|
|
15
|
+
supportsDeveloperRole: z.boolean().optional(),
|
|
16
|
+
supportsReasoningEffort: z.boolean().optional(),
|
|
17
|
+
maxTokensField: z
|
|
18
|
+
.union([z.literal("max_completion_tokens"), z.literal("max_tokens")])
|
|
19
|
+
.optional(),
|
|
20
|
+
})
|
|
21
|
+
.strict()
|
|
22
|
+
.optional();
|
|
23
|
+
|
|
24
|
+
export const ModelDefinitionSchema = z
|
|
25
|
+
.object({
|
|
26
|
+
id: z.string().min(1),
|
|
27
|
+
name: z.string().min(1),
|
|
28
|
+
api: ModelApiSchema.optional(),
|
|
29
|
+
reasoning: z.boolean().optional(),
|
|
30
|
+
input: z.array(z.union([z.literal("text"), z.literal("image")])).optional(),
|
|
31
|
+
cost: z
|
|
32
|
+
.object({
|
|
33
|
+
input: z.number().optional(),
|
|
34
|
+
output: z.number().optional(),
|
|
35
|
+
cacheRead: z.number().optional(),
|
|
36
|
+
cacheWrite: z.number().optional(),
|
|
37
|
+
})
|
|
38
|
+
.strict()
|
|
39
|
+
.optional(),
|
|
40
|
+
contextWindow: z.number().positive().optional(),
|
|
41
|
+
maxTokens: z.number().positive().optional(),
|
|
42
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
43
|
+
compat: ModelCompatSchema,
|
|
44
|
+
})
|
|
45
|
+
.strict();
|
|
46
|
+
|
|
47
|
+
export const ModelProviderSchema = z
|
|
48
|
+
.object({
|
|
49
|
+
baseUrl: z.string().min(1),
|
|
50
|
+
apiKey: z.string().optional(),
|
|
51
|
+
auth: z
|
|
52
|
+
.union([
|
|
53
|
+
z.literal("api-key"),
|
|
54
|
+
z.literal("aws-sdk"),
|
|
55
|
+
z.literal("oauth"),
|
|
56
|
+
z.literal("token"),
|
|
57
|
+
])
|
|
58
|
+
.optional(),
|
|
59
|
+
api: ModelApiSchema.optional(),
|
|
60
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
61
|
+
authHeader: z.boolean().optional(),
|
|
62
|
+
models: z.array(ModelDefinitionSchema),
|
|
63
|
+
})
|
|
64
|
+
.strict();
|
|
65
|
+
|
|
66
|
+
export const BedrockDiscoverySchema = z
|
|
67
|
+
.object({
|
|
68
|
+
enabled: z.boolean().optional(),
|
|
69
|
+
region: z.string().optional(),
|
|
70
|
+
providerFilter: z.array(z.string()).optional(),
|
|
71
|
+
refreshInterval: z.number().int().nonnegative().optional(),
|
|
72
|
+
defaultContextWindow: z.number().int().positive().optional(),
|
|
73
|
+
defaultMaxTokens: z.number().int().positive().optional(),
|
|
74
|
+
})
|
|
75
|
+
.strict()
|
|
76
|
+
.optional();
|
|
77
|
+
|
|
78
|
+
export const ModelsConfigSchema = z
|
|
79
|
+
.object({
|
|
80
|
+
mode: z.union([z.literal("merge"), z.literal("replace")]).optional(),
|
|
81
|
+
providers: z.record(z.string(), ModelProviderSchema).optional(),
|
|
82
|
+
bedrockDiscovery: BedrockDiscoverySchema,
|
|
83
|
+
})
|
|
84
|
+
.strict()
|
|
85
|
+
.optional();
|
|
86
|
+
|
|
87
|
+
export const GroupChatSchema = z
|
|
88
|
+
.object({
|
|
89
|
+
mentionPatterns: z.array(z.string()).optional(),
|
|
90
|
+
historyLimit: z.number().int().positive().optional(),
|
|
91
|
+
})
|
|
92
|
+
.strict()
|
|
93
|
+
.optional();
|
|
94
|
+
|
|
95
|
+
export const DmConfigSchema = z
|
|
96
|
+
.object({
|
|
97
|
+
historyLimit: z.number().int().min(0).optional(),
|
|
98
|
+
})
|
|
99
|
+
.strict();
|
|
100
|
+
|
|
101
|
+
export const IdentitySchema = z
|
|
102
|
+
.object({
|
|
103
|
+
name: z.string().optional(),
|
|
104
|
+
theme: z.string().optional(),
|
|
105
|
+
emoji: z.string().optional(),
|
|
106
|
+
avatar: z.string().optional(),
|
|
107
|
+
})
|
|
108
|
+
.strict()
|
|
109
|
+
.optional();
|
|
110
|
+
|
|
111
|
+
export const QueueModeSchema = z.union([
|
|
112
|
+
z.literal("steer"),
|
|
113
|
+
z.literal("followup"),
|
|
114
|
+
z.literal("collect"),
|
|
115
|
+
z.literal("steer-backlog"),
|
|
116
|
+
z.literal("steer+backlog"),
|
|
117
|
+
z.literal("queue"),
|
|
118
|
+
z.literal("interrupt"),
|
|
119
|
+
]);
|
|
120
|
+
export const QueueDropSchema = z.union([
|
|
121
|
+
z.literal("old"),
|
|
122
|
+
z.literal("new"),
|
|
123
|
+
z.literal("summarize"),
|
|
124
|
+
]);
|
|
125
|
+
export const ReplyToModeSchema = z.union([
|
|
126
|
+
z.literal("off"),
|
|
127
|
+
z.literal("first"),
|
|
128
|
+
z.literal("all"),
|
|
129
|
+
]);
|
|
130
|
+
|
|
131
|
+
// GroupPolicySchema: controls how group messages are handled
|
|
132
|
+
// Used with .default("allowlist").optional() pattern:
|
|
133
|
+
// - .optional() allows field omission in input config
|
|
134
|
+
// - .default("allowlist") ensures runtime always resolves to "allowlist" if not provided
|
|
135
|
+
export const GroupPolicySchema = z.enum(["open", "disabled", "allowlist"]);
|
|
136
|
+
|
|
137
|
+
export const DmPolicySchema = z.enum([
|
|
138
|
+
"pairing",
|
|
139
|
+
"allowlist",
|
|
140
|
+
"open",
|
|
141
|
+
"disabled",
|
|
142
|
+
]);
|
|
143
|
+
|
|
144
|
+
export const BlockStreamingCoalesceSchema = z
|
|
145
|
+
.object({
|
|
146
|
+
minChars: z.number().int().positive().optional(),
|
|
147
|
+
maxChars: z.number().int().positive().optional(),
|
|
148
|
+
idleMs: z.number().int().nonnegative().optional(),
|
|
149
|
+
})
|
|
150
|
+
.strict();
|
|
151
|
+
|
|
152
|
+
export const BlockStreamingChunkSchema = z
|
|
153
|
+
.object({
|
|
154
|
+
minChars: z.number().int().positive().optional(),
|
|
155
|
+
maxChars: z.number().int().positive().optional(),
|
|
156
|
+
breakPreference: z
|
|
157
|
+
.union([
|
|
158
|
+
z.literal("paragraph"),
|
|
159
|
+
z.literal("newline"),
|
|
160
|
+
z.literal("sentence"),
|
|
161
|
+
])
|
|
162
|
+
.optional(),
|
|
163
|
+
})
|
|
164
|
+
.strict();
|
|
165
|
+
|
|
166
|
+
export const MarkdownTableModeSchema = z.enum(["off", "bullets", "code"]);
|
|
167
|
+
|
|
168
|
+
export const MarkdownConfigSchema = z
|
|
169
|
+
.object({
|
|
170
|
+
tables: MarkdownTableModeSchema.optional(),
|
|
171
|
+
})
|
|
172
|
+
.strict()
|
|
173
|
+
.optional();
|
|
174
|
+
|
|
175
|
+
export const TtsProviderSchema = z.enum(["elevenlabs", "openai", "edge"]);
|
|
176
|
+
export const TtsModeSchema = z.enum(["final", "all"]);
|
|
177
|
+
export const TtsAutoSchema = z.enum(["off", "always", "inbound", "tagged"]);
|
|
178
|
+
export const TtsConfigSchema = z
|
|
179
|
+
.object({
|
|
180
|
+
auto: TtsAutoSchema.optional(),
|
|
181
|
+
enabled: z.boolean().optional(),
|
|
182
|
+
mode: TtsModeSchema.optional(),
|
|
183
|
+
provider: TtsProviderSchema.optional(),
|
|
184
|
+
summaryModel: z.string().optional(),
|
|
185
|
+
modelOverrides: z
|
|
186
|
+
.object({
|
|
187
|
+
enabled: z.boolean().optional(),
|
|
188
|
+
allowText: z.boolean().optional(),
|
|
189
|
+
allowProvider: z.boolean().optional(),
|
|
190
|
+
allowVoice: z.boolean().optional(),
|
|
191
|
+
allowModelId: z.boolean().optional(),
|
|
192
|
+
allowVoiceSettings: z.boolean().optional(),
|
|
193
|
+
allowNormalization: z.boolean().optional(),
|
|
194
|
+
allowSeed: z.boolean().optional(),
|
|
195
|
+
})
|
|
196
|
+
.strict()
|
|
197
|
+
.optional(),
|
|
198
|
+
elevenlabs: z
|
|
199
|
+
.object({
|
|
200
|
+
apiKey: z.string().optional(),
|
|
201
|
+
baseUrl: z.string().optional(),
|
|
202
|
+
voiceId: z.string().optional(),
|
|
203
|
+
modelId: z.string().optional(),
|
|
204
|
+
seed: z.number().int().min(0).max(4294967295).optional(),
|
|
205
|
+
applyTextNormalization: z.enum(["auto", "on", "off"]).optional(),
|
|
206
|
+
languageCode: z.string().optional(),
|
|
207
|
+
voiceSettings: z
|
|
208
|
+
.object({
|
|
209
|
+
stability: z.number().min(0).max(1).optional(),
|
|
210
|
+
similarityBoost: z.number().min(0).max(1).optional(),
|
|
211
|
+
style: z.number().min(0).max(1).optional(),
|
|
212
|
+
useSpeakerBoost: z.boolean().optional(),
|
|
213
|
+
speed: z.number().min(0.5).max(2).optional(),
|
|
214
|
+
})
|
|
215
|
+
.strict()
|
|
216
|
+
.optional(),
|
|
217
|
+
})
|
|
218
|
+
.strict()
|
|
219
|
+
.optional(),
|
|
220
|
+
openai: z
|
|
221
|
+
.object({
|
|
222
|
+
apiKey: z.string().optional(),
|
|
223
|
+
model: z.string().optional(),
|
|
224
|
+
voice: z.string().optional(),
|
|
225
|
+
})
|
|
226
|
+
.strict()
|
|
227
|
+
.optional(),
|
|
228
|
+
edge: z
|
|
229
|
+
.object({
|
|
230
|
+
enabled: z.boolean().optional(),
|
|
231
|
+
voice: z.string().optional(),
|
|
232
|
+
lang: z.string().optional(),
|
|
233
|
+
outputFormat: z.string().optional(),
|
|
234
|
+
pitch: z.string().optional(),
|
|
235
|
+
rate: z.string().optional(),
|
|
236
|
+
volume: z.string().optional(),
|
|
237
|
+
saveSubtitles: z.boolean().optional(),
|
|
238
|
+
proxy: z.string().optional(),
|
|
239
|
+
timeoutMs: z.number().int().min(1000).max(120000).optional(),
|
|
240
|
+
})
|
|
241
|
+
.strict()
|
|
242
|
+
.optional(),
|
|
243
|
+
prefsPath: z.string().optional(),
|
|
244
|
+
maxTextLength: z.number().int().min(1).optional(),
|
|
245
|
+
timeoutMs: z.number().int().min(1000).max(120000).optional(),
|
|
246
|
+
})
|
|
247
|
+
.strict()
|
|
248
|
+
.optional();
|
|
249
|
+
|
|
250
|
+
export const HumanDelaySchema = z
|
|
251
|
+
.object({
|
|
252
|
+
mode: z
|
|
253
|
+
.union([z.literal("off"), z.literal("natural"), z.literal("custom")])
|
|
254
|
+
.optional(),
|
|
255
|
+
minMs: z.number().int().nonnegative().optional(),
|
|
256
|
+
maxMs: z.number().int().nonnegative().optional(),
|
|
257
|
+
})
|
|
258
|
+
.strict();
|
|
259
|
+
|
|
260
|
+
export const CliBackendSchema = z
|
|
261
|
+
.object({
|
|
262
|
+
command: z.string(),
|
|
263
|
+
args: z.array(z.string()).optional(),
|
|
264
|
+
output: z
|
|
265
|
+
.union([z.literal("json"), z.literal("text"), z.literal("jsonl")])
|
|
266
|
+
.optional(),
|
|
267
|
+
resumeOutput: z
|
|
268
|
+
.union([z.literal("json"), z.literal("text"), z.literal("jsonl")])
|
|
269
|
+
.optional(),
|
|
270
|
+
input: z.union([z.literal("arg"), z.literal("stdin")]).optional(),
|
|
271
|
+
maxPromptArgChars: z.number().int().positive().optional(),
|
|
272
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
273
|
+
clearEnv: z.array(z.string()).optional(),
|
|
274
|
+
modelArg: z.string().optional(),
|
|
275
|
+
modelAliases: z.record(z.string(), z.string()).optional(),
|
|
276
|
+
sessionArg: z.string().optional(),
|
|
277
|
+
sessionArgs: z.array(z.string()).optional(),
|
|
278
|
+
resumeArgs: z.array(z.string()).optional(),
|
|
279
|
+
sessionMode: z
|
|
280
|
+
.union([z.literal("always"), z.literal("existing"), z.literal("none")])
|
|
281
|
+
.optional(),
|
|
282
|
+
sessionIdFields: z.array(z.string()).optional(),
|
|
283
|
+
systemPromptArg: z.string().optional(),
|
|
284
|
+
systemPromptMode: z
|
|
285
|
+
.union([z.literal("append"), z.literal("replace")])
|
|
286
|
+
.optional(),
|
|
287
|
+
systemPromptWhen: z
|
|
288
|
+
.union([z.literal("first"), z.literal("always"), z.literal("never")])
|
|
289
|
+
.optional(),
|
|
290
|
+
imageArg: z.string().optional(),
|
|
291
|
+
imageMode: z.union([z.literal("repeat"), z.literal("list")]).optional(),
|
|
292
|
+
serialize: z.boolean().optional(),
|
|
293
|
+
})
|
|
294
|
+
.strict();
|
|
295
|
+
|
|
296
|
+
export const normalizeAllowFrom = (values?: Array<string | number>): string[] =>
|
|
297
|
+
(values ?? []).map((v) => String(v).trim()).filter(Boolean);
|
|
298
|
+
|
|
299
|
+
export const requireOpenAllowFrom = (params: {
|
|
300
|
+
policy?: string;
|
|
301
|
+
allowFrom?: Array<string | number>;
|
|
302
|
+
ctx: z.RefinementCtx;
|
|
303
|
+
path: Array<string | number>;
|
|
304
|
+
message: string;
|
|
305
|
+
}) => {
|
|
306
|
+
if (params.policy !== "open") {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
const allow = normalizeAllowFrom(params.allowFrom);
|
|
310
|
+
if (allow.includes("*")) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
params.ctx.addIssue({
|
|
314
|
+
code: z.ZodIssueCode.custom,
|
|
315
|
+
path: params.path,
|
|
316
|
+
message: params.message,
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
export const MSTeamsReplyStyleSchema = z.enum(["thread", "top-level"]);
|
|
321
|
+
|
|
322
|
+
export const RetryConfigSchema = z
|
|
323
|
+
.object({
|
|
324
|
+
attempts: z.number().int().min(1).optional(),
|
|
325
|
+
minDelayMs: z.number().int().min(0).optional(),
|
|
326
|
+
maxDelayMs: z.number().int().min(0).optional(),
|
|
327
|
+
jitter: z.number().min(0).max(1).optional(),
|
|
328
|
+
})
|
|
329
|
+
.strict()
|
|
330
|
+
.optional();
|
|
331
|
+
|
|
332
|
+
export const QueueModeBySurfaceSchema = z
|
|
333
|
+
.object({
|
|
334
|
+
whatsapp: QueueModeSchema.optional(),
|
|
335
|
+
telegram: QueueModeSchema.optional(),
|
|
336
|
+
discord: QueueModeSchema.optional(),
|
|
337
|
+
slack: QueueModeSchema.optional(),
|
|
338
|
+
mattermost: QueueModeSchema.optional(),
|
|
339
|
+
signal: QueueModeSchema.optional(),
|
|
340
|
+
imessage: QueueModeSchema.optional(),
|
|
341
|
+
msteams: QueueModeSchema.optional(),
|
|
342
|
+
webchat: QueueModeSchema.optional(),
|
|
343
|
+
})
|
|
344
|
+
.strict()
|
|
345
|
+
.optional();
|
|
346
|
+
|
|
347
|
+
export const DebounceMsBySurfaceSchema = z
|
|
348
|
+
.record(z.string(), z.number().int().nonnegative())
|
|
349
|
+
.optional();
|
|
350
|
+
|
|
351
|
+
export const QueueSchema = z
|
|
352
|
+
.object({
|
|
353
|
+
mode: QueueModeSchema.optional(),
|
|
354
|
+
byChannel: QueueModeBySurfaceSchema,
|
|
355
|
+
debounceMs: z.number().int().nonnegative().optional(),
|
|
356
|
+
debounceMsByChannel: DebounceMsBySurfaceSchema,
|
|
357
|
+
cap: z.number().int().positive().optional(),
|
|
358
|
+
drop: QueueDropSchema.optional(),
|
|
359
|
+
})
|
|
360
|
+
.strict()
|
|
361
|
+
.optional();
|
|
362
|
+
|
|
363
|
+
export const InboundDebounceSchema = z
|
|
364
|
+
.object({
|
|
365
|
+
debounceMs: z.number().int().nonnegative().optional(),
|
|
366
|
+
byChannel: DebounceMsBySurfaceSchema,
|
|
367
|
+
})
|
|
368
|
+
.strict()
|
|
369
|
+
.optional();
|
|
370
|
+
|
|
371
|
+
export const TranscribeAudioSchema = z
|
|
372
|
+
.object({
|
|
373
|
+
command: z.array(z.string()).superRefine((value, ctx) => {
|
|
374
|
+
const executable = value[0];
|
|
375
|
+
if (!isSafeExecutableValue(executable)) {
|
|
376
|
+
ctx.addIssue({
|
|
377
|
+
code: z.ZodIssueCode.custom,
|
|
378
|
+
path: [0],
|
|
379
|
+
message: "expected safe executable name or path",
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
}),
|
|
383
|
+
timeoutSeconds: z.number().int().positive().optional(),
|
|
384
|
+
})
|
|
385
|
+
.strict()
|
|
386
|
+
.optional();
|
|
387
|
+
|
|
388
|
+
export const HexColorSchema = z
|
|
389
|
+
.string()
|
|
390
|
+
.regex(/^#?[0-9a-fA-F]{6}$/, "expected hex color (RRGGBB)");
|
|
391
|
+
|
|
392
|
+
export const ExecutableTokenSchema = z
|
|
393
|
+
.string()
|
|
394
|
+
.refine(isSafeExecutableValue, "expected safe executable name or path");
|
|
395
|
+
|
|
396
|
+
const MessagePolicyMatchSchema = z
|
|
397
|
+
.object({
|
|
398
|
+
channel: z.string().optional(),
|
|
399
|
+
chatType: z
|
|
400
|
+
.union([z.literal("direct"), z.literal("group"), z.literal("channel")])
|
|
401
|
+
.optional(),
|
|
402
|
+
keyPrefix: z.string().optional(),
|
|
403
|
+
})
|
|
404
|
+
.strict()
|
|
405
|
+
.optional();
|
|
406
|
+
|
|
407
|
+
const MessagePolicySchemaBase = z
|
|
408
|
+
.object({
|
|
409
|
+
default: z.union([z.literal("allow"), z.literal("deny")]).optional(),
|
|
410
|
+
rules: z
|
|
411
|
+
.array(
|
|
412
|
+
z
|
|
413
|
+
.object({
|
|
414
|
+
action: z.union([z.literal("allow"), z.literal("deny")]),
|
|
415
|
+
match: MessagePolicyMatchSchema,
|
|
416
|
+
})
|
|
417
|
+
.strict(),
|
|
418
|
+
)
|
|
419
|
+
.optional(),
|
|
420
|
+
})
|
|
421
|
+
.strict()
|
|
422
|
+
.optional();
|
|
423
|
+
|
|
424
|
+
export const MediaUnderstandingScopeSchema = MessagePolicySchemaBase;
|
|
425
|
+
export const MessagePolicySchema = MessagePolicySchemaBase;
|
|
426
|
+
|
|
427
|
+
export const MediaUnderstandingCapabilitiesSchema = z
|
|
428
|
+
.array(z.union([z.literal("image"), z.literal("audio"), z.literal("video")]))
|
|
429
|
+
.optional();
|
|
430
|
+
|
|
431
|
+
export const MediaUnderstandingAttachmentsSchema = z
|
|
432
|
+
.object({
|
|
433
|
+
mode: z.union([z.literal("first"), z.literal("all")]).optional(),
|
|
434
|
+
maxAttachments: z.number().int().positive().optional(),
|
|
435
|
+
prefer: z
|
|
436
|
+
.union([
|
|
437
|
+
z.literal("first"),
|
|
438
|
+
z.literal("last"),
|
|
439
|
+
z.literal("path"),
|
|
440
|
+
z.literal("url"),
|
|
441
|
+
])
|
|
442
|
+
.optional(),
|
|
443
|
+
})
|
|
444
|
+
.strict()
|
|
445
|
+
.optional();
|
|
446
|
+
|
|
447
|
+
const DeepgramAudioSchema = z
|
|
448
|
+
.object({
|
|
449
|
+
detectLanguage: z.boolean().optional(),
|
|
450
|
+
punctuate: z.boolean().optional(),
|
|
451
|
+
smartFormat: z.boolean().optional(),
|
|
452
|
+
})
|
|
453
|
+
.strict()
|
|
454
|
+
.optional();
|
|
455
|
+
|
|
456
|
+
const ProviderOptionValueSchema = z.union([
|
|
457
|
+
z.string(),
|
|
458
|
+
z.number(),
|
|
459
|
+
z.boolean(),
|
|
460
|
+
]);
|
|
461
|
+
const ProviderOptionsSchema = z
|
|
462
|
+
.record(z.string(), z.record(z.string(), ProviderOptionValueSchema))
|
|
463
|
+
.optional();
|
|
464
|
+
|
|
465
|
+
export const MediaUnderstandingModelSchema = z
|
|
466
|
+
.object({
|
|
467
|
+
provider: z.string().optional(),
|
|
468
|
+
model: z.string().optional(),
|
|
469
|
+
capabilities: MediaUnderstandingCapabilitiesSchema,
|
|
470
|
+
type: z.union([z.literal("provider"), z.literal("cli")]).optional(),
|
|
471
|
+
command: z.string().optional(),
|
|
472
|
+
args: z.array(z.string()).optional(),
|
|
473
|
+
prompt: z.string().optional(),
|
|
474
|
+
maxChars: z.number().int().positive().optional(),
|
|
475
|
+
maxBytes: z.number().int().positive().optional(),
|
|
476
|
+
timeoutSeconds: z.number().int().positive().optional(),
|
|
477
|
+
language: z.string().optional(),
|
|
478
|
+
providerOptions: ProviderOptionsSchema,
|
|
479
|
+
deepgram: DeepgramAudioSchema,
|
|
480
|
+
baseUrl: z.string().optional(),
|
|
481
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
482
|
+
profile: z.string().optional(),
|
|
483
|
+
preferredProfile: z.string().optional(),
|
|
484
|
+
})
|
|
485
|
+
.strict()
|
|
486
|
+
.optional();
|
|
487
|
+
|
|
488
|
+
export const ToolsMediaUnderstandingSchema = z
|
|
489
|
+
.object({
|
|
490
|
+
enabled: z.boolean().optional(),
|
|
491
|
+
scope: MediaUnderstandingScopeSchema,
|
|
492
|
+
maxBytes: z.number().int().positive().optional(),
|
|
493
|
+
maxChars: z.number().int().positive().optional(),
|
|
494
|
+
prompt: z.string().optional(),
|
|
495
|
+
timeoutSeconds: z.number().int().positive().optional(),
|
|
496
|
+
language: z.string().optional(),
|
|
497
|
+
providerOptions: ProviderOptionsSchema,
|
|
498
|
+
deepgram: DeepgramAudioSchema,
|
|
499
|
+
baseUrl: z.string().optional(),
|
|
500
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
501
|
+
attachments: MediaUnderstandingAttachmentsSchema,
|
|
502
|
+
models: z.array(MediaUnderstandingModelSchema).optional(),
|
|
503
|
+
})
|
|
504
|
+
.strict()
|
|
505
|
+
.optional();
|
|
506
|
+
|
|
507
|
+
export const ToolsMediaSchema = z
|
|
508
|
+
.object({
|
|
509
|
+
models: z.array(MediaUnderstandingModelSchema).optional(),
|
|
510
|
+
concurrency: z.number().int().positive().optional(),
|
|
511
|
+
image: ToolsMediaUnderstandingSchema.optional(),
|
|
512
|
+
audio: ToolsMediaUnderstandingSchema.optional(),
|
|
513
|
+
video: ToolsMediaUnderstandingSchema.optional(),
|
|
514
|
+
})
|
|
515
|
+
.strict()
|
|
516
|
+
.optional();
|
|
517
|
+
|
|
518
|
+
export const LinkModelSchema = z
|
|
519
|
+
.object({
|
|
520
|
+
type: z.literal("cli").optional(),
|
|
521
|
+
command: z.string().min(1),
|
|
522
|
+
args: z.array(z.string()).optional(),
|
|
523
|
+
timeoutSeconds: z.number().int().positive().optional(),
|
|
524
|
+
})
|
|
525
|
+
.strict();
|
|
526
|
+
|
|
527
|
+
export const ToolsLinksSchema = z
|
|
528
|
+
.object({
|
|
529
|
+
enabled: z.boolean().optional(),
|
|
530
|
+
scope: MediaUnderstandingScopeSchema,
|
|
531
|
+
maxLinks: z.number().int().positive().optional(),
|
|
532
|
+
timeoutSeconds: z.number().int().positive().optional(),
|
|
533
|
+
models: z.array(LinkModelSchema).optional(),
|
|
534
|
+
})
|
|
535
|
+
.strict()
|
|
536
|
+
.optional();
|
|
537
|
+
|
|
538
|
+
export const NativeCommandsSettingSchema = z.union([
|
|
539
|
+
z.boolean(),
|
|
540
|
+
z.literal("auto"),
|
|
541
|
+
]);
|
|
542
|
+
|
|
543
|
+
export const ProviderCommandsSchema = z
|
|
544
|
+
.object({
|
|
545
|
+
native: NativeCommandsSettingSchema.optional(),
|
|
546
|
+
nativeSkills: NativeCommandsSettingSchema.optional(),
|
|
547
|
+
})
|
|
548
|
+
.strict()
|
|
549
|
+
.optional();
|
|
550
|
+
|
|
551
|
+
export const ChannelHeartbeatVisibilitySchema = z
|
|
552
|
+
.object({
|
|
553
|
+
showOk: z.boolean().optional(),
|
|
554
|
+
showAlerts: z.boolean().optional(),
|
|
555
|
+
useIndicator: z.boolean().optional(),
|
|
556
|
+
})
|
|
557
|
+
.strict()
|
|
558
|
+
.optional();
|
|
559
|
+
|
|
560
|
+
// ============================================================================
|
|
561
|
+
// Media Generation Schemas
|
|
562
|
+
// ============================================================================
|
|
563
|
+
|
|
564
|
+
export const MediaModeSchema = z.enum(["cloud", "own-key"]);
|
|
565
|
+
|
|
566
|
+
// --- Image Generation ---
|
|
567
|
+
|
|
568
|
+
export const ImageProviderSchema = z.enum([
|
|
569
|
+
"cloud",
|
|
570
|
+
"fal",
|
|
571
|
+
"openai",
|
|
572
|
+
"google",
|
|
573
|
+
"xai",
|
|
574
|
+
]);
|
|
575
|
+
|
|
576
|
+
export const ImageFalConfigSchema = z
|
|
577
|
+
.object({
|
|
578
|
+
apiKey: z.string().optional(),
|
|
579
|
+
model: z.string().optional(),
|
|
580
|
+
baseUrl: z.string().optional(),
|
|
581
|
+
})
|
|
582
|
+
.strict()
|
|
583
|
+
.optional();
|
|
584
|
+
|
|
585
|
+
export const ImageOpenaiConfigSchema = z
|
|
586
|
+
.object({
|
|
587
|
+
apiKey: z.string().optional(),
|
|
588
|
+
model: z.string().optional(),
|
|
589
|
+
quality: z.enum(["standard", "hd"]).optional(),
|
|
590
|
+
style: z.enum(["natural", "vivid"]).optional(),
|
|
591
|
+
})
|
|
592
|
+
.strict()
|
|
593
|
+
.optional();
|
|
594
|
+
|
|
595
|
+
export const ImageGoogleConfigSchema = z
|
|
596
|
+
.object({
|
|
597
|
+
apiKey: z.string().optional(),
|
|
598
|
+
model: z.string().optional(),
|
|
599
|
+
aspectRatio: z.string().optional(),
|
|
600
|
+
})
|
|
601
|
+
.strict()
|
|
602
|
+
.optional();
|
|
603
|
+
|
|
604
|
+
export const ImageXaiConfigSchema = z
|
|
605
|
+
.object({
|
|
606
|
+
apiKey: z.string().optional(),
|
|
607
|
+
model: z.string().optional(),
|
|
608
|
+
})
|
|
609
|
+
.strict()
|
|
610
|
+
.optional();
|
|
611
|
+
|
|
612
|
+
export const ImageConfigSchema = z
|
|
613
|
+
.object({
|
|
614
|
+
enabled: z.boolean().optional(),
|
|
615
|
+
mode: MediaModeSchema.optional(),
|
|
616
|
+
provider: ImageProviderSchema.optional(),
|
|
617
|
+
defaultSize: z.string().optional(),
|
|
618
|
+
fal: ImageFalConfigSchema,
|
|
619
|
+
openai: ImageOpenaiConfigSchema,
|
|
620
|
+
google: ImageGoogleConfigSchema,
|
|
621
|
+
xai: ImageXaiConfigSchema,
|
|
622
|
+
})
|
|
623
|
+
.strict()
|
|
624
|
+
.optional();
|
|
625
|
+
|
|
626
|
+
// --- Video Generation ---
|
|
627
|
+
|
|
628
|
+
export const VideoProviderSchema = z.enum(["cloud", "fal", "openai", "google"]);
|
|
629
|
+
|
|
630
|
+
export const VideoFalConfigSchema = z
|
|
631
|
+
.object({
|
|
632
|
+
apiKey: z.string().optional(),
|
|
633
|
+
model: z.string().optional(),
|
|
634
|
+
baseUrl: z.string().optional(),
|
|
635
|
+
})
|
|
636
|
+
.strict()
|
|
637
|
+
.optional();
|
|
638
|
+
|
|
639
|
+
export const VideoOpenaiConfigSchema = z
|
|
640
|
+
.object({
|
|
641
|
+
apiKey: z.string().optional(),
|
|
642
|
+
model: z.string().optional(),
|
|
643
|
+
})
|
|
644
|
+
.strict()
|
|
645
|
+
.optional();
|
|
646
|
+
|
|
647
|
+
export const VideoGoogleConfigSchema = z
|
|
648
|
+
.object({
|
|
649
|
+
apiKey: z.string().optional(),
|
|
650
|
+
model: z.string().optional(),
|
|
651
|
+
})
|
|
652
|
+
.strict()
|
|
653
|
+
.optional();
|
|
654
|
+
|
|
655
|
+
export const VideoConfigSchema = z
|
|
656
|
+
.object({
|
|
657
|
+
enabled: z.boolean().optional(),
|
|
658
|
+
mode: MediaModeSchema.optional(),
|
|
659
|
+
provider: VideoProviderSchema.optional(),
|
|
660
|
+
defaultDuration: z.number().int().positive().optional(),
|
|
661
|
+
fal: VideoFalConfigSchema,
|
|
662
|
+
openai: VideoOpenaiConfigSchema,
|
|
663
|
+
google: VideoGoogleConfigSchema,
|
|
664
|
+
})
|
|
665
|
+
.strict()
|
|
666
|
+
.optional();
|
|
667
|
+
|
|
668
|
+
// --- Audio/Music Generation ---
|
|
669
|
+
|
|
670
|
+
export const AudioGenProviderSchema = z.enum(["cloud", "suno", "elevenlabs"]);
|
|
671
|
+
|
|
672
|
+
export const AudioSunoConfigSchema = z
|
|
673
|
+
.object({
|
|
674
|
+
apiKey: z.string().optional(),
|
|
675
|
+
model: z.string().optional(),
|
|
676
|
+
baseUrl: z.string().optional(),
|
|
677
|
+
})
|
|
678
|
+
.strict()
|
|
679
|
+
.optional();
|
|
680
|
+
|
|
681
|
+
export const AudioElevenlabsSfxConfigSchema = z
|
|
682
|
+
.object({
|
|
683
|
+
apiKey: z.string().optional(),
|
|
684
|
+
duration: z.number().min(0.5).max(22).optional(),
|
|
685
|
+
})
|
|
686
|
+
.strict()
|
|
687
|
+
.optional();
|
|
688
|
+
|
|
689
|
+
export const AudioGenConfigSchema = z
|
|
690
|
+
.object({
|
|
691
|
+
enabled: z.boolean().optional(),
|
|
692
|
+
mode: MediaModeSchema.optional(),
|
|
693
|
+
provider: AudioGenProviderSchema.optional(),
|
|
694
|
+
suno: AudioSunoConfigSchema,
|
|
695
|
+
elevenlabs: AudioElevenlabsSfxConfigSchema,
|
|
696
|
+
})
|
|
697
|
+
.strict()
|
|
698
|
+
.optional();
|
|
699
|
+
|
|
700
|
+
// --- Vision (Image Analysis) ---
|
|
701
|
+
|
|
702
|
+
export const VisionProviderSchema = z.enum([
|
|
703
|
+
"cloud",
|
|
704
|
+
"openai",
|
|
705
|
+
"google",
|
|
706
|
+
"anthropic",
|
|
707
|
+
"xai",
|
|
708
|
+
"ollama",
|
|
709
|
+
]);
|
|
710
|
+
|
|
711
|
+
export const VisionOpenaiConfigSchema = z
|
|
712
|
+
.object({
|
|
713
|
+
apiKey: z.string().optional(),
|
|
714
|
+
model: z.string().optional(),
|
|
715
|
+
maxTokens: z.number().int().positive().optional(),
|
|
716
|
+
})
|
|
717
|
+
.strict()
|
|
718
|
+
.optional();
|
|
719
|
+
|
|
720
|
+
export const VisionGoogleConfigSchema = z
|
|
721
|
+
.object({
|
|
722
|
+
apiKey: z.string().optional(),
|
|
723
|
+
model: z.string().optional(),
|
|
724
|
+
})
|
|
725
|
+
.strict()
|
|
726
|
+
.optional();
|
|
727
|
+
|
|
728
|
+
export const VisionAnthropicConfigSchema = z
|
|
729
|
+
.object({
|
|
730
|
+
apiKey: z.string().optional(),
|
|
731
|
+
model: z.string().optional(),
|
|
732
|
+
})
|
|
733
|
+
.strict()
|
|
734
|
+
.optional();
|
|
735
|
+
|
|
736
|
+
export const VisionXaiConfigSchema = z
|
|
737
|
+
.object({
|
|
738
|
+
apiKey: z.string().optional(),
|
|
739
|
+
model: z.string().optional(),
|
|
740
|
+
})
|
|
741
|
+
.strict()
|
|
742
|
+
.optional();
|
|
743
|
+
|
|
744
|
+
export const VisionOllamaConfigSchema = z
|
|
745
|
+
.object({
|
|
746
|
+
baseUrl: z.string().url().optional(),
|
|
747
|
+
model: z.string().optional(),
|
|
748
|
+
maxTokens: z.number().int().positive().optional(),
|
|
749
|
+
autoDownload: z.boolean().optional(),
|
|
750
|
+
})
|
|
751
|
+
.strict()
|
|
752
|
+
.optional();
|
|
753
|
+
|
|
754
|
+
export const VisionConfigSchema = z
|
|
755
|
+
.object({
|
|
756
|
+
enabled: z.boolean().optional(),
|
|
757
|
+
mode: MediaModeSchema.optional(),
|
|
758
|
+
provider: VisionProviderSchema.optional(),
|
|
759
|
+
openai: VisionOpenaiConfigSchema,
|
|
760
|
+
google: VisionGoogleConfigSchema,
|
|
761
|
+
anthropic: VisionAnthropicConfigSchema,
|
|
762
|
+
xai: VisionXaiConfigSchema,
|
|
763
|
+
ollama: VisionOllamaConfigSchema,
|
|
764
|
+
})
|
|
765
|
+
.strict()
|
|
766
|
+
.optional();
|
|
767
|
+
|
|
768
|
+
// --- Combined Media Config ---
|
|
769
|
+
|
|
770
|
+
export const MediaConfigSchema = z
|
|
771
|
+
.object({
|
|
772
|
+
image: ImageConfigSchema,
|
|
773
|
+
video: VideoConfigSchema,
|
|
774
|
+
audio: AudioGenConfigSchema,
|
|
775
|
+
vision: VisionConfigSchema,
|
|
776
|
+
})
|
|
777
|
+
.strict()
|
|
778
|
+
.optional();
|