mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-23 22:55:24 +00:00
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { Type } from "@sinclair/typebox";
|
|
import { SESSION_LABEL_MAX_LENGTH } from "../../../sessions/session-label.js";
|
|
import { GATEWAY_CLIENT_IDS, GATEWAY_CLIENT_MODES } from "../client-info.js";
|
|
|
|
export const NonEmptyString = Type.String({ minLength: 1 });
|
|
export const CHAT_SEND_SESSION_KEY_MAX_LENGTH = 512;
|
|
export const ChatSendSessionKeyString = Type.String({
|
|
minLength: 1,
|
|
maxLength: CHAT_SEND_SESSION_KEY_MAX_LENGTH,
|
|
});
|
|
export const SessionLabelString = Type.String({
|
|
minLength: 1,
|
|
maxLength: SESSION_LABEL_MAX_LENGTH,
|
|
});
|
|
|
|
export const GatewayClientIdSchema = Type.Union(
|
|
Object.values(GATEWAY_CLIENT_IDS).map((value) => Type.Literal(value)),
|
|
);
|
|
|
|
export const GatewayClientModeSchema = Type.Union(
|
|
Object.values(GATEWAY_CLIENT_MODES).map((value) => Type.Literal(value)),
|
|
);
|
|
|
|
export const SecretRefSourceSchema = Type.Union([
|
|
Type.Literal("env"),
|
|
Type.Literal("file"),
|
|
Type.Literal("exec"),
|
|
]);
|
|
|
|
export const SecretRefSchema = Type.Object(
|
|
{
|
|
source: SecretRefSourceSchema,
|
|
provider: NonEmptyString,
|
|
id: NonEmptyString,
|
|
},
|
|
{ additionalProperties: false },
|
|
);
|
|
|
|
export const SecretInputSchema = Type.Union([Type.String(), SecretRefSchema]);
|