import type { GeneratePasswordSpec, HumanInputAnswer, HumanInputQuestion, HumanInputSecretAnswer, HumanInputSecretAnswerResult, HumanInputSecretSaveTo, HumanInputSecretSpec } from "@opengeni/sdk"; import { type OpenGeniText } from "./messages/runtime.js"; export type HumanInputAnswerDraft = { values: string[]; other: string; otherSelected: boolean; }; export type HumanInputFormMessages = { title: string; description: string; submit: string; skip: string; submitting: string; other: string; deadlineLabel: string; formatDeadline: (value: string) => string; required: string; otherRequired: string; minSelections: (count: number) => string; maxSelections: (count: number) => string; optional: string; /** Shown when the question list overflows the card and more content is below. */ moreBelow: string; questionCount: (count: number) => string; collapse: string; expand: string; selectionHint: (min: number | null | undefined, max: number | null | undefined) => string | null; /** Secret questions (`kind: "secret"`). */ secretShow: string; secretHide: string; secretGenerate: string; /** Shown in place of the input when the server will generate the value. */ secretWillGenerate: string; secretUndo: string; secretSaveTo: string; secretSaveToOptions: Record; /** One line under Save to: where the value goes. `vault` is the agent's named vault, if any. */ secretVaultHint: (saveTo: HumanInputSecretSaveTo, vault: string | null) => string; /** The requested Save to is not allowed for this person. */ secretSaveToDowngraded: (requested: HumanInputSecretSaveTo, actual: HumanInputSecretSaveTo) => string; secretLooksLike: (example: string) => string; /** Soft warning only: the value does not match the agent's pattern. */ secretPatternWarning: (looksLike: string | null) => string; /** The answered chip: "Saved to Private › GitHub". */ secretSaved: (vaultName: string, itemName: string) => string; }; export declare const defaultHumanInputFormMessages: (t: OpenGeniText) => HumanInputFormMessages; /** * Text, single- and multi-select drafts. Secret questions are not drafted: * their value lives only in an uncontrolled input and is collected with * {@link secretAnswerFromReading} at submit time. */ export declare function answersFromDrafts(t: OpenGeniText, questions: HumanInputQuestion[], drafts: Record, messageOverrides?: Partial): { answers: HumanInputAnswer[]; errors: Record; }; export declare function initialDrafts(questions: HumanInputQuestion[]): Record; export declare function emptyDraft(): HumanInputAnswerDraft; export declare function formatDeadline(t: OpenGeniText, value: string): string; /** The form heading: a single question leads with its own label/prompt. */ export declare function humanInputHeading(questions: readonly HumanInputQuestion[], messages: Pick): { title: string; description: string | null; }; export declare const SECRET_SAVE_TO_ORDER: readonly HumanInputSecretSaveTo[]; export type SecretAutocomplete = "current-password" | "new-password" | "one-time-code" | "off"; /** * The `autocomplete` token for the secret input. The contract defaults * `autocomplete` to "current-password", so that value is treated as "not * chosen": a TOTP field asks for a one-time code, and a field the person may * generate is a new password (password managers offer to create and save it). */ export declare function secretAutocomplete(spec: HumanInputSecretSpec): SecretAutocomplete; /** Digits keyboard on phones for one-time codes. */ export declare function secretInputMode(spec: HumanInputSecretSpec): "numeric" | undefined; /** A plain-text field kind is not concealed (no show/hide). */ export declare function secretConcealed(spec: HumanInputSecretSpec): boolean; /** Generate is offered for concealed values the agent allows to be generated. */ export declare function secretCanGenerate(spec: HumanInputSecretSpec): boolean; /** The input's label: "Password", "API key", "One-time code", or the field name. */ export declare function secretFieldLabel(t: OpenGeniText, spec: HumanInputSecretSpec): string; export type SecretSaveToChoice = { /** What the agent asked for (contract default: "user"). */ requested: HumanInputSecretSaveTo; /** The initial selection: the request, or the best allowed target. */ initial: HumanInputSecretSaveTo; /** True when the request is not allowed and was replaced. */ downgraded: boolean; /** Allowed choices in display order. */ options: HumanInputSecretSaveTo[]; }; /** * Filter Save to by what this person may write. A request that is not allowed * falls back to the most private allowed target (Only me, then This task). */ export declare function resolveSecretSaveTo(spec: HumanInputSecretSpec, allowed?: readonly HumanInputSecretSaveTo[]): SecretSaveToChoice; /** The vault the agent named applies only to the scope it asked for. */ export declare function secretVaultForTarget(spec: HumanInputSecretSpec, saveTo: HumanInputSecretSaveTo): string | null; /** * Soft check against the agent's `pattern` (a regular expression searched in * the value, not anchored). Never blocks submit; an invalid pattern is ignored. */ export declare function secretPatternMismatch(pattern: string | null | undefined, value: string): boolean; /** What a secret field holds at submit time. `value` exists only for this call. */ export type SecretFieldReading = { value: string | null; generate: GeneratePasswordSpec | null; username: string | null; saveTo: HumanInputSecretSaveTo; }; /** * Build the write-only `secretAnswers` entry and the public answer for one * secret question. The public answer has no values: the server adds the * saved reference. Returns null for an unanswered optional question. */ export declare function secretAnswerFromReading(t: OpenGeniText, question: HumanInputQuestion, reading: SecretFieldReading, messageOverrides?: Partial): { answer: HumanInputAnswer; secretAnswer: HumanInputSecretAnswer; } | { error: string; } | null; /** The answered chip label, never a value. */ export declare function secretAnswerLabel(t: OpenGeniText, result: HumanInputSecretAnswerResult, messageOverrides?: Partial): string;