|
| 1 | +import { Type } from "@sinclair/typebox"; |
| 2 | +import { NonEmptyString } from "./primitives.js"; |
| 3 | + |
| 4 | +export const CommandSourceSchema = Type.Union([ |
| 5 | + Type.Literal("native"), |
| 6 | + Type.Literal("skill"), |
| 7 | + Type.Literal("plugin"), |
| 8 | +]); |
| 9 | + |
| 10 | +export const CommandScopeSchema = Type.Union([ |
| 11 | + Type.Literal("text"), |
| 12 | + Type.Literal("native"), |
| 13 | + Type.Literal("both"), |
| 14 | +]); |
| 15 | + |
| 16 | +export const CommandCategorySchema = Type.Union([ |
| 17 | + Type.Literal("session"), |
| 18 | + Type.Literal("options"), |
| 19 | + Type.Literal("status"), |
| 20 | + Type.Literal("management"), |
| 21 | + Type.Literal("media"), |
| 22 | + Type.Literal("tools"), |
| 23 | + Type.Literal("docks"), |
| 24 | +]); |
| 25 | + |
| 26 | +export const CommandArgChoiceSchema = Type.Object( |
| 27 | + { |
| 28 | + value: Type.String(), |
| 29 | + label: Type.String(), |
| 30 | + }, |
| 31 | + { additionalProperties: false }, |
| 32 | +); |
| 33 | + |
| 34 | +export const CommandArgSchema = Type.Object( |
| 35 | + { |
| 36 | + name: NonEmptyString, |
| 37 | + description: Type.String(), |
| 38 | + type: Type.Union([Type.Literal("string"), Type.Literal("number"), Type.Literal("boolean")]), |
| 39 | + required: Type.Optional(Type.Boolean()), |
| 40 | + choices: Type.Optional(Type.Array(CommandArgChoiceSchema)), |
| 41 | + dynamic: Type.Optional(Type.Boolean()), |
| 42 | + }, |
| 43 | + { additionalProperties: false }, |
| 44 | +); |
| 45 | + |
| 46 | +export const CommandEntrySchema = Type.Object( |
| 47 | + { |
| 48 | + name: NonEmptyString, |
| 49 | + nativeName: Type.Optional(NonEmptyString), |
| 50 | + textAliases: Type.Optional(Type.Array(NonEmptyString)), |
| 51 | + description: Type.String(), |
| 52 | + category: Type.Optional(CommandCategorySchema), |
| 53 | + source: CommandSourceSchema, |
| 54 | + scope: CommandScopeSchema, |
| 55 | + acceptsArgs: Type.Boolean(), |
| 56 | + args: Type.Optional(Type.Array(CommandArgSchema)), |
| 57 | + }, |
| 58 | + { additionalProperties: false }, |
| 59 | +); |
| 60 | + |
| 61 | +export const CommandsListParamsSchema = Type.Object( |
| 62 | + { |
| 63 | + agentId: Type.Optional(NonEmptyString), |
| 64 | + provider: Type.Optional(NonEmptyString), |
| 65 | + scope: Type.Optional(CommandScopeSchema), |
| 66 | + includeArgs: Type.Optional(Type.Boolean()), |
| 67 | + }, |
| 68 | + { additionalProperties: false }, |
| 69 | +); |
| 70 | + |
| 71 | +export const CommandsListResultSchema = Type.Object( |
| 72 | + { |
| 73 | + commands: Type.Array(CommandEntrySchema), |
| 74 | + }, |
| 75 | + { additionalProperties: false }, |
| 76 | +); |
0 commit comments