import type { CompositeAction } from "../../messaging"; import type { SettingsSchema } from "../SettingsSchema"; import type { ActionContextType } from "./ActionContextType"; /** * A command tool, which as a sort of template for a command chain. */ export interface DesignerCommandTool extends DesignerCommandToolBase { /** * A signature based on definition. Used for identifying if an action * matches the tool. */ signature: string; } /** * Base interface for a tool. */ export interface DesignerCommandToolBase { /** * The type of the context that gets passed in as an argument to the command * chain. */ contextType: ActionContextType; /** * Default arguments for the tool. Note default arguments with a value of * 'undefined' will not be serialized. Use 'null' if you want to force * serialization. */ defaultArguments?: Partial; /** * The underlying command chain definition of the tool. */ definition: CompositeAction; /** * The description of the tool. */ description: string; /** * The friendly display name of the tool. */ displayName: string; /** * Used to create the object that populates the tool's settings schema. This * is not required if the keys of the SettingsSchema match up exactly with * the tokens in the tools definition. */ getSettings?: (action: CompositeAction) => Partial; /** * A unique id for the tool. */ id: string; /** * The icon for the tool. */ icon: string; /** * The settings schema defining the schema for any input arguments to the * tool. */ settingsSchema?: SettingsSchema; /** * The expected output type of the operation. An operation is always * expected to return a value, so "none" is not an allowed context type for * this property. */ outputType?: ActionContextType; } /** * Represents a valid token for CommandChain tokens. */ export type Token = `{${string}}`; /** * Replacement tokens in tool definitions. */ export interface TokenArgs extends Record { } /** * Determines if the argument is a Token used in {@link DesignerCommandTool} * definitions. * * @param input The input to test. */ export declare function isDesignerCommandToken(input: unknown): input is Token;