mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-08 22:54:02 +00:00
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
/**
|
|
* Agent-facing Canvas tool schema and allowed action/format enums.
|
|
*/
|
|
import {
|
|
optionalFiniteNumberSchema,
|
|
optionalNonNegativeIntegerSchema,
|
|
optionalPositiveIntegerSchema,
|
|
stringEnum,
|
|
} from "openclaw/plugin-sdk/channel-actions";
|
|
import { Type } from "typebox";
|
|
|
|
/** Agent tool actions supported by the Canvas plugin. */
|
|
export const CANVAS_ACTIONS = [
|
|
"present",
|
|
"hide",
|
|
"navigate",
|
|
"eval",
|
|
"snapshot",
|
|
"a2ui_push",
|
|
"a2ui_reset",
|
|
] as const;
|
|
|
|
/** Snapshot formats accepted by the Canvas tool. */
|
|
export const CANVAS_SNAPSHOT_FORMATS = ["png", "jpg", "jpeg"] as const;
|
|
|
|
/** TypeBox schema for the model-facing Canvas tool arguments. */
|
|
export const CanvasToolSchema = Type.Object({
|
|
action: stringEnum(CANVAS_ACTIONS),
|
|
gatewayUrl: Type.Optional(Type.String()),
|
|
gatewayToken: Type.Optional(Type.String()),
|
|
timeoutMs: optionalPositiveIntegerSchema(),
|
|
node: Type.Optional(Type.String()),
|
|
target: Type.Optional(Type.String()),
|
|
x: optionalFiniteNumberSchema(),
|
|
y: optionalFiniteNumberSchema(),
|
|
width: optionalFiniteNumberSchema(),
|
|
height: optionalFiniteNumberSchema(),
|
|
url: Type.Optional(Type.String()),
|
|
javaScript: Type.Optional(Type.String()),
|
|
outputFormat: Type.Optional(stringEnum(CANVAS_SNAPSHOT_FORMATS)),
|
|
maxWidth: optionalPositiveIntegerSchema(),
|
|
quality: optionalFiniteNumberSchema({ minimum: 0, maximum: 1 }),
|
|
delayMs: optionalNonNegativeIntegerSchema(),
|
|
jsonl: Type.Optional(Type.String()),
|
|
jsonlPath: Type.Optional(Type.String()),
|
|
});
|