/** * Builders for the richer Grok Bot `SendMessage` payloads. * * `SendMessage` takes a `type` that decides what the user actually sees, and * the interesting ones carry structure the host validates. Hand-writing that * object is easy to get subtly wrong, and the failure is silent: an unknown * `type`, or a shape the host rejects, is discarded without an error and the * user simply sees nothing. * * These builders return the exact object `SendMessage` expects, and throw on * the constraints the host enforces, so a mistake surfaces where it was made. */ /** Message types the host renders. An unknown type is dropped silently. */ export declare const SEND_MESSAGE_TYPES: readonly ["text", "attachment", "widget", "cursor-agent", "secret-request"]; export type SendMessageType = (typeof SEND_MESSAGE_TYPES)[number]; /** Visual weight of a choice. `danger` is for the destructive option. */ export type ChoiceStyle = "default" | "primary" | "danger"; export type ChoiceOption = { /** Button text. */ label: string; /** * What is sent back as the user's reply when this is picked. Defaults to the * label; write it as something they would naturally say, because it becomes * their message in the transcript. */ value?: string; /** Optional second line under the label. */ description?: string; style?: ChoiceStyle; }; export type ChoiceInput = { /** The question. Phrase it as a question, not a menu instruction. */ prompt: string; /** 1-6 options. */ options: ReadonlyArray; /** Optional help line under the prompt. */ helpText?: string; /** Let the user type their own answer instead of picking. */ allowCustom?: boolean; /** * Auto-dismiss the card if the user sends a newer message without answering. * Only for low-stakes questions that go moot; leave it off for a decision you * still need an answer to. */ dismissOnMoveOn?: boolean; }; export type ChoiceMessage = { type: "widget"; widget: { prompt: string; helpText?: string; options: Array<{ label: string; value?: string; description?: string; style?: ChoiceStyle; }>; allowCustom?: boolean; dismissOnMoveOn?: boolean; }; }; export type CursorAgentMessage = { type: "cursor-agent"; bcId: string; }; export type SecretRequestInput = { /** * What credential to ask for. Shown as the card title and echoed in the * field placeholder ("Paste your …"), e.g. "Slack bot token". */ label: string; /** * The connector the secret belongs to. The value is written to that * connector's per-agent credential file. */ connector: string; /** The credential field to store the value under, e.g. "token". */ field: string; /** Optional short help under the label. */ description?: string; }; export type SecretRequestMessage = { type: "secret-request"; secret: { label: string; connector: string; field: string; description?: string; }; }; /** The host accepts at most this many options on one card. */ export declare const MAX_CHOICE_OPTIONS = 6; /** * Build a multiple-choice card. * * The user picks one option and its `value` comes back as their reply, so this * replaces asking a multiple-choice question in prose and then parsing the * answer. A dismissal is reported as a decline: treat it as "no" and do not * re-ask. * * ```ts * choice({ prompt: "Ship it?", options: ["Ship", "Hold"] }); * choice({ * prompt: "Enable the remaining tools?", * helpText: "CreateAgent lets an agent sign on a new crewmate.", * options: [ * { label: "Enable", value: "Enable them", style: "primary" }, * { label: "Leave blocked", style: "danger" }, * ], * allowCustom: true, * }); * ``` */ export declare function choice(input: ChoiceInput): ChoiceMessage; /** Shorthand for a yes/no card. The affirmative is styled `primary`. */ export declare function confirm(prompt: string, options?: { yes?: string; no?: string; helpText?: string; danger?: boolean; }): ChoiceMessage; /** * Ask the user for a credential through a masked secure input. * * The value goes straight to the connector's per-agent credential file: it * never reaches the agent, the transcript, or the chat. You only learn that it * was provided. That is the whole point of this type, and the reason there is * deliberately no parameter here for the secret itself — this builder describes * what to ask for, and cannot carry a value even by mistake. * * Use it instead of asking for a token in a normal message. A secret pasted * into chat is stored in the transcript, is readable by anything that can read * the transcript, and cannot be un-sent. * * On submit the host writes `connector-secrets//.json` as * `{ : value }` — so `connector` names the file and `field` names the * key. Get either wrong and the value lands somewhere the connector will not * look for it, with nothing to indicate that happened. * * ```ts * secretRequest({ * label: "Slack bot token", * connector: "slack", * field: "token", * description: "Starts with xoxb-", * }); * ``` */ export declare function secretRequest(input: SecretRequestInput): SecretRequestMessage; /** * Reference a Cursor cloud agent so it renders as a card that opens the run in * Cursor. Launching one does not emit this: send it yourself once the launch * returns a bcId, or the user is left with a bare URL. */ export declare function cursorAgent(bcId: string): CursorAgentMessage; //# sourceMappingURL=messages.d.ts.map