/** * Credentials never show on an activity row. * * Tool calls carry signed storage links, tokens and keys in their arguments * and output. Everything a row shows is passed through `redactSignedUrls`, * which hides credential values whatever shape the text takes while leaving * ordinary links, queries and prose readable. Display only: nothing here * changes what a tool ran or what the model saw. * * Three kinds of rule run, in this order of trust: * - a secret reference (`secret:Item/field` in double braces) names a vault * item and is never touched: references are set aside before any rule * runs and put back afterwards, so a row still shows which item an agent * used; * - shape rules hide what is a credential by its form wherever it shows: * signed links, link passwords, webhook paths, known token formats, * private keys, `Authorization` and cookie headers; * - name rules hide a value because of the name it is given (`TOKEN=…`, * `--password …`, `"api_key": "…"`). They read a text as a command (what * an agent or person typed, where any value under a credential's name is * hidden) or as printed text (output, file contents, patches, prose, where * code such as `password: string` and prose must stay readable, so only a * quoted literal, a `NAME=value` line, a `name: value` config line or a * value shaped like a credential is hidden). */ import type { ToolCallItem } from "./types.js"; /** How name rules read a text (see the module comment). */ export type CredentialContext = "command" | "text"; /** Replaces the query of a signed or token-bearing link, so the credential is never shown. */ export declare const SIGNED_LINK_QUERY_PLACEHOLDER = "?[signature hidden]"; /** * Whether a value looks like a credential rather than a word: long, with no * spaces, and mixing letters with digits (or long and mixing cases). Only such * values are hidden wherever else they occur, so `?token=settings` never * erases the word "settings" from a row. */ export declare function credentialShaped(value: string): boolean; /** * The credential-shaped values in `text` (signature, token and key parameter * values, secret-named fields, passwords in links, webhook paths), raw and * URL-decoded, so the same value can be hidden wherever else it shows up, such * as in a command's output. */ export declare function signedValues(text: string): string[]; /** * Hide every credential in `text`, whatever shape it takes, read as a command * (the default) or as printed text (see the module comment): * - a signed or token-bearing link loses its query or fragment, keeping the * host and path so it is still recognisable; * - a signature, token or key parameter anywhere else (`GET /a.json?sig=…`, * `\u0026token=…` in JSON, `#access_token=…`), a secret-named header, field or * variable, a `Bearer` token, `curl -u` and link passwords, and the path of a * webhook link keep their name and lose their value; * - a known token format, a private key, an `Authorization` or cookie header's * value, a `.netrc` password and a token used as a link's user name are * hidden; in a command, so are `sshpass -p`, registry login and `mysql -p` * passwords; * - any of `values` (see `signedValues`, by default those found in `text`) is * hidden wherever it occurs. * Ambiguous names (`code`, `key`, `policy`) are hidden only when their value * looks like a credential, so ordinary queries and prose stay readable. A * secret reference is never changed. */ export declare function redactSignedUrls(text: string, values?: readonly string[], context?: CredentialContext): string; /** * Every credential-shaped value in a nested value's strings, including the * values of secret-named fields (`{access_token: …}`, `{"X-Api-Key": …}`). */ export declare function signedValuesDeep(value: unknown): string[]; /** * A copy of a nested value with every string redacted and every secret-named * field's value hidden (see `hidesField`); other leaves are kept as they are. * Field names are kept, so `{password: "…"}` shows as `{password: "[hidden]"}`. * A command field (`cmd`, `command`, `script`, `args`) is read as a command, * any other string (output, file contents, a patch) as printed text, and a * string holding a JSON object (a call's arguments) field by field. */ export declare function redactDeep(value: T, values: readonly string[]): T; /** * A tool call's arguments or output as a payload view shows them, with every * credential hidden field by field (see `redactDeep`), so code in a patch or * a file stays readable while a command's or a field's credential does not. */ export declare function redactPayload(value: T): T; /** * A tool call as every renderer sees it: its arguments, output, provider item * and display metadata with every credential hidden, including any credential * value found in one of them and repeated in another. The timeline hands only * this copy to tool renderers, so no current or future renderer can show an * unredacted signature, token or key. Returns the same item when there is * nothing to hide; results are cached per item. */ export declare function redactToolCall(item: ToolCallItem): ToolCallItem;