UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

81 lines (80 loc) • 3.35 kB
import { t as closedObject } from "./closed-object-B-B1FwhS.mjs"; import { t as stringLiteralUnion } from "./string-literal-union-C2qFTHSZ.mjs"; import { Type } from "typebox"; //#region packages/gateway-protocol/src/schema/cron-shared.ts const MAX_DATE_TIMESTAMP_MS = 864e13; const CronDateTimestampMsSchema = Type.Integer({ minimum: 0, maximum: MAX_DATE_TIMESTAMP_MS }); /** Builds create/patch payload variants while preserving per-call field optionality. */ function cronAgentTurnPayloadSchema(e) { return closedObject({ kind: Type.Literal("agentTurn"), message: e.message, model: Type.Optional(e.model), fallbacks: Type.Optional(e.fallbacks), thinking: Type.Optional(e.thinking), timeoutSeconds: Type.Optional(e.timeoutSeconds), allowUnsafeExternalContent: Type.Optional(Type.Boolean()), lightContext: Type.Optional(Type.Boolean()), skipIfScratchEmpty: Type.Optional(Type.Boolean()), includeReasoning: Type.Optional(Type.Boolean()), toolsAllow: Type.Optional(e.toolsAllow), toolsAllowIsDefault: Type.Optional(Type.Boolean()) }); } /** Builds command payload variants while preserving create/patch argv optionality. */ function cronCommandPayloadSchema(e) { return closedObject({ kind: Type.Literal("command"), argv: e.argv, cwd: Type.Optional(Type.String({ minLength: 1 })), env: Type.Optional(Type.Record(Type.String({ minLength: 1 }), Type.String())), input: Type.Optional(Type.String()), timeoutSeconds: Type.Optional(e.timeoutSeconds), noOutputTimeoutSeconds: Type.Optional(Type.Number({ minimum: 0 })), outputMaxBytes: Type.Optional(Type.Integer({ minimum: 1 })), toolsAllow: Type.Optional(e.toolsAllow), toolsAllowIsDefault: Type.Optional(Type.Boolean()) }); } function cronScriptPayloadSchema(e) { return closedObject({ kind: Type.Literal("script"), script: e.script, timeoutSeconds: Type.Optional(e.timeoutSeconds), toolBudget: Type.Optional(Type.Integer({ minimum: 1 })), toolsAllow: Type.Optional(e.toolsAllow), toolsAllowIsDefault: Type.Optional(Type.Boolean()) }); } //#endregion //#region packages/gateway-protocol/src/schema/cron-automation-result.ts const AutomationMeaningfulOutcomeSchema = stringLiteralUnion([ "progress", "done", "blocked", "needs_attention" ]); const AutomationOutcomeSchema = Type.Union([Type.Literal("no_change"), AutomationMeaningfulOutcomeSchema]); const AutomationResultSummarySchema = Type.String({ minLength: 1, maxLength: 2e3, pattern: "\\S" }); const AutomationMeaningfulResultSchema = closedObject({ outcome: AutomationMeaningfulOutcomeSchema, summary: AutomationResultSummarySchema }); /** A quiet check needs no prose; meaningful facts always carry a bounded summary. */ const AutomationResultSchema = Type.Union([closedObject({ outcome: Type.Literal("no_change"), summary: Type.Optional(AutomationResultSummarySchema) }), AutomationMeaningfulResultSchema]); const AutomationLastMeaningfulResultSchema = closedObject({ ...AutomationMeaningfulResultSchema.properties, atMs: CronDateTimestampMsSchema }); //#endregion export { CronDateTimestampMsSchema as a, cronCommandPayloadSchema as c, AutomationResultSummarySchema as i, cronScriptPayloadSchema as l, AutomationOutcomeSchema as n, MAX_DATE_TIMESTAMP_MS as o, AutomationResultSchema as r, cronAgentTurnPayloadSchema as s, AutomationLastMeaningfulResultSchema as t };