/** * Native execution-grant helpers (9.6.0). * * Grant request is per guardToolCall invocation (local vars). The token is not * a verdict input and is not folded into any fingerprint preimage. */ export type ExecutionGrantConfig = { enabled: true; resolveStateNonce?: (ctx: { artifactId: string | null; toolName: string; args: unknown; }) => string | Promise; /** Default 'v1' this wave. ATOMIC construction requires 'v2'. */ grantVersion?: 'v1' | 'v2'; /** * The V2 binding a grant request should carry (AUDIT P1 / RES-1). * * MEASURED before adding: the guard's authorize request sent only * `include_execution_grant` and `state_nonce`, and the SDK's * PreflightChangeSetRequest declares NEITHER these fields NOR `state_nonce` — * the guard builds its own request literal and posts it as `unknown`, so the * wire shape is guard-local. Adding them here is therefore a guard-side * config surface, not a claim that the SDK type endorses them. * * Every one is OPTIONAL and every one is sent only when set. A deployment * that does not configure a field gets it NAMED in the observation's * `v2_fields_absent`, never a placeholder on the wire. * * ── DEPRECATED ALIASES (1198) ──────────────────────────────────────────── * The canonical home is the TOP LEVEL of the withCodeRifts input, where * executorId/adapterId/targetUri already lived before this config existed * (with-coderifts.ts:394-396) and where the ATOMIC construction check reads * them. Setting them here still works and still reaches the wire — but a * value here that DISAGREES with the top level is an initialization error, * because the two used to feed different halves of the system with nothing * reconciling them. See resolveV2Fields. * * Unreleased when this was written — added after the 14.1.0 release and never * published — so no adopter depends on the nested spelling. */ executorId?: string; adapterId?: string; targetUri?: string; tenantId?: string; policyHash?: string; audienceHash?: string; expectedStateToken?: string; }; /** * THE CANONICAL V2 FIELD SET (roadmap 1198). * * MEASURED SPLIT-BRAIN, which is what this exists to end: * · executorId / adapterId / targetUri lived in BOTH the top-level input * (with-coderifts.ts:394-396 → the ATOMIC construction check and the * posture tuple) and the nested executionGrant config (→ the authorize * request). Nothing compared them, so a configuration could bind the * profile to one executor and put another — or none — on the wire. * · policyHash had a READER and no writer: atomic-profile.ts:247 passes * `input.policyHash` to the posture verifier and with-coderifts.ts:911-915 * never forwarded it, so that binding was permanently undefined. * · tenantId / audienceHash existed on the wire side only. * * This reads both spellings, REFUSES a disagreement, and returns one set that * the wire and the profile both use. A field neither side supplies stays * genuinely absent — the case 6bca531's named-absent was written for, and now * the only case it covers. */ export declare const V2_FIELD_KEYS: readonly ["executorId", "adapterId", "targetUri", "tenantId", "policyHash", "audienceHash", "expectedStateToken"]; export type V2FieldKey = typeof V2_FIELD_KEYS[number]; export type V2Fields = Partial>; /** * Resolve the canonical set from an input carrying either spelling. * * THROWS on disagreement. Preferring one silently is what produced the split: * a caller who set both would have one quietly ignored, with no way to see * which one survived. */ export declare function resolveV2Fields(input?: { expectedStateToken?: unknown; executorId?: unknown; adapterId?: unknown; targetUri?: unknown; tenantId?: unknown; policyHash?: unknown; audienceHash?: unknown; executionGrant?: ExecutionGrantConfig | null; } | null): V2Fields; /** The V2 request fields, in the wire spelling. One list, used to send and to report. */ export declare const V2_WIRE_FIELDS: readonly [readonly ["executor_id", "executorId"], readonly ["adapter_id", "adapterId"], readonly ["target_uri", "targetUri"], readonly ["tenant_id", "tenantId"], readonly ["policy_hash", "policyHash"], readonly ["expected_state_token", "expectedStateToken"]]; export type V2WireResult = { /** Wire-name -> value, for the fields this deployment actually configured. */ fields: Record; /** Wire-names this deployment did NOT configure. Named, never placeheld. */ absent: string[]; }; /** * Build the V2 field set for an authorize request. * * V1 sends nothing here: the fields describe a v2 binding, and attaching them * to a v1 request would assert a shape the grant does not have. * * A value that is not a non-empty string is ABSENT, not empty-string-sent. An * empty executor_id on the wire is indistinguishable from a real one that * happens to be blank, and the server would bind it. */ export declare function v2WireFields(config: { executionGrant?: ExecutionGrantConfig; } | null | undefined): V2WireResult; export type ExecutionGrantObservation = { requested: boolean; arrived: boolean; /** Which grant shape was requested. */ grant_version?: 'v1' | 'v2'; /** * The V2 binding this request actually carried, and what it could not. * `v2_fields_absent` is the honest half: a field the deployment never * configured is reported here rather than sent as an empty placeholder. */ v2_fields_sent?: string[]; v2_fields_absent?: string[]; }; export type ExecutionGrantCallContext = { execution_grant: string | null; }; export declare function isExecutionGrantEnabled(config: { executionGrant?: ExecutionGrantConfig; } | null | undefined): boolean; export declare function readExecutionGrantToken(response: unknown): string | null; export declare function firstArtifactId(artifacts: unknown): string | null; /** True when the thrown authorize error carries the named SIGNER_UNAVAILABLE code. */ export declare function isSignerUnavailableError(err: unknown): boolean; export declare function resolveStateNonceForCall(config: { executionGrant?: ExecutionGrantConfig; }, call: { toolName: string; arguments?: unknown; artifacts?: unknown; }, artifacts: unknown): Promise<{ ok: true; nonce?: string; } | { ok: false; }>; //# sourceMappingURL=execution-grant.d.ts.map