@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
36 lines • 2.41 kB
TypeScript
/**
* The trust annotation on agent-shell results (omo#10762, design r13 6.7). Under a fallback generation a
* command that exits non-zero carries a trusted status taken from the adopted record and, only when its
* output looks like a certificate verification error, an untrusted hint naming the matched catalog pattern.
* The output never supplies a reason or an action: any command can print any text, including a forged
* Bun footer or trust line (design M16). Like `adopted.ts`, this module does not load the marker parser.
*/
import { type EngineTrustActionId } from "./actions.ts";
import type { ENGINE_TRUST_FALLBACK_REASONS } from "./marker.ts";
/** Catalog order decides which entry a hint names when several match. */
declare const SHELL_TRUST_PATTERNS: readonly [readonly ["UNABLE_TO_GET_ISSUER_CERT_LOCALLY", RegExp], readonly ["UNABLE_TO_GET_ISSUER_CERT", RegExp], readonly ["UNABLE_TO_VERIFY_LEAF_SIGNATURE", RegExp], readonly ["SELF_SIGNED_CERT_IN_CHAIN", RegExp], readonly ["DEPTH_ZERO_SELF_SIGNED_CERT", RegExp], readonly ["CERT_UNTRUSTED", RegExp], readonly ["unable-to-verify-the-first-certificate", RegExp], readonly ["unable-to-get-local-issuer-certificate", RegExp], readonly ["unable-to-get-issuer-certificate", RegExp], readonly ["self-signed-certificate-in-certificate-chain", RegExp], readonly ["self-signed-certificate", RegExp], readonly ["certificate-not-trusted", RegExp]];
export type ShellTrustPatternId = (typeof SHELL_TRUST_PATTERNS)[number][0];
export type ShellTrust = {
readonly status: {
readonly code: "trust-import-degraded";
readonly reason: (typeof ENGINE_TRUST_FALLBACK_REASONS)[number];
readonly action: EngineTrustActionId;
};
readonly hint?: {
readonly code: "tls-verify-text-in-output";
readonly heuristic: true;
readonly pattern: ShellTrustPatternId;
};
};
export type ShellTrustAnnotation = {
readonly trust: ShellTrust;
/** The one fixed line appended for the model, only with a hint; it never echoes output. */
readonly text: string | undefined;
};
/** Nothing without an adopted fallback generation, on exit 0, or for a command that has no exit code. */
export declare function annotateShellTrust({ exitCode, output, }: {
readonly exitCode: number | null;
readonly output: string;
}): ShellTrustAnnotation | undefined;
export {};
//# sourceMappingURL=shell-trust.d.ts.map