@wildo-ai/platform-config-lib 1.1.12 → 1.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { CryptoKey_Scope, CryptoKey_VersionState, type CryptoKeyPinSet } from '@wildo-ai/saas-models';
2
+ import { type ApprovalSealSubjectCurrencyAssessment, CryptoKey_Scope, CryptoKey_VersionState, type CryptoKeyPinSet } from '@wildo-ai/saas-models';
3
3
  import { ES256_JWS_ALGORITHM, type P256PublicJwk } from './es256-jws';
4
4
  import { ApprovalSealDisclosureClaim, type ApprovalSealClaimsV1, type ApprovalSealDisclosureValue } from './approval-seal.contracts';
5
5
  /** One key that may have signed a seal: its STORED record (scope, issuer, state), as an export carries it. */
@@ -60,6 +60,12 @@ export interface ApprovalSealVerificationInput {
60
60
  readonly contentErased?: boolean;
61
61
  readonly bytes?: Uint8Array;
62
62
  };
63
+ /**
64
+ * The record the approval is about, as it is NOW (#2914): its fields as an export of the record states them, or null
65
+ * for a record that is gone. Compared with the sealed field set the disclosed presentation carries
66
+ * (`wildo seal verify --subject-record`).
67
+ */
68
+ readonly subjectRecord?: Readonly<Record<string, unknown>> | null;
63
69
  /** The operator's pin set for approval seals (#2932), from a channel the host does not control. */
64
70
  readonly pins?: CryptoKeyPinSet;
65
71
  /**
@@ -206,6 +212,12 @@ export interface ApprovalSealVerification {
206
212
  readonly locale?: string;
207
213
  readonly verificationUrl?: string;
208
214
  };
215
+ /**
216
+ * Whether the approval is still current over its record (#2914), when the record was given: CURRENT,
217
+ * NO_LONGER_CURRENT (never a failure), SUBJECT_GONE, or NO_SEALED_FIELD_SET when the presentation is not disclosed or
218
+ * covers no record field.
219
+ */
220
+ readonly subjectRecordCurrency?: ApprovalSealSubjectCurrencyAssessment;
209
221
  }
210
222
  /** See the file's header. Pure and offline. */
211
223
  export declare function verifyApprovalSeal(input: ApprovalSealVerificationInput): ApprovalSealVerification;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AAK,EAAE,6BAA6B,GAAG,wBAAwB,CA6EjG;AAED,qHAAqH;AACrH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;iBAA8B,CAAC;AAE7E;;;GAGG;AACH,eAAO,MAAM,+BAA+B;;;iBAAwF,CAAC;AAErI;;;;;;GAMG;AACH,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmB/C,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC"}
@@ -25,6 +25,10 @@
25
25
  * and must equal the bytes given, and the host's record of its hash when the bundle states one; its prefix must then open the seal's commitment
26
26
  * to the approved file, which ties the copy to the original without the original being supplied. One changed byte in
27
27
  * the approval page fails the seal. A copy the approver's erasure deleted is reported CONTENT_ERASED, never missing.
28
+ * - The CURRENCY of the approval over its record (#2914), when the record as it is now is given: the values of the fields
29
+ * the approval covers, as the disclosed presentation carries them, compared with the record. A record changed since is
30
+ * NOT a failure: the seal still proves what was approved; it is reported NO_LONGER_CURRENT. Without the presentation
31
+ * disclosed there is nothing to compare, and it is reported as having no sealed field set, never as current.
28
32
  * - A COMPROMISED key: the signature may still verify, but the seal is not PROVABLE unless corroborated by evidence the
29
33
  * key's holder could not have forged: the decision's payload digest recorded outside the application before the
30
34
  * compromise instant (an exported audit event, an immutable sink).
@@ -42,7 +46,7 @@
42
46
  */
43
47
  import { createHash } from 'node:crypto';
44
48
  import { z } from 'zod';
45
- import { humanDecisionBoundDeliverableOf, singleJwsTypeOf, CryptoKey_Purpose, CryptoKey_Scope, CryptoKey_VersionState } from '@wildo-ai/saas-models';
49
+ import { approvalSealSubjectCurrencyOf, humanDecisionBoundDeliverableOf, singleJwsTypeOf, CryptoKey_Purpose, CryptoKey_Scope, CryptoKey_VersionState } from '@wildo-ai/saas-models';
46
50
  import { ES256_JWS_ALGORITHM, isP256PublicJwk, verifyEs256 } from './es256-jws.js';
47
51
  import { decisionPayloadDigestOf, sealClaimsDigestOf } from './signature-request.contracts.js';
48
52
  import { VerificationKeyRecordSchema, compareSigningLogExports, pinnedVerificationKeyOf, verifySigningLogExport } from './signing-log-export.contracts.js';
@@ -293,6 +297,10 @@ export function verifyApprovalSeal(input) {
293
297
  const statement = disclosureStanding(ApprovalSealDisclosureClaim.STATEMENT, claims.statementDigest, disclosures, erased, failures);
294
298
  const deliverableFile = deliverableFileStandingOf(input.deliverableFile, presentation, failures);
295
299
  const manifestedCopy = manifestedCopyStandingOf(input, approver, presentation, failures);
300
+ // #2914: never a failure; the presentation counts only when it opened its commitment.
301
+ const subjectRecordCurrency = input.subjectRecord !== undefined
302
+ ? approvalSealSubjectCurrencyOf(presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED ? presentation.value : undefined, input.subjectRecord)
303
+ : undefined;
296
304
  const decisionPayloadDigest = decisionPayloadDigestOf(committed);
297
305
  const valid = failures.length === 0;
298
306
  const compromised = key.state === CryptoKey_VersionState.COMPROMISED;
@@ -316,6 +324,7 @@ export function verifyApprovalSeal(input) {
316
324
  ...(statement ? { statement } : {}),
317
325
  ...(deliverableFile ? { deliverableFile } : {}),
318
326
  ...(manifestedCopy ? { manifestedCopy } : {}),
327
+ ...(subjectRecordCurrency ? { subjectRecordCurrency } : {}),
319
328
  };
320
329
  }
321
330
  /** A verification key as an export or a CLI file states it (dates as ISO strings): the one shape of a key record. */
@@ -1 +1 @@
1
- {"version":3,"file":"approval-seal-verifier.js","sourceRoot":"","sources":["../../../src/key-management/approval-seal-verifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,+BAA+B,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,sBAAsB,EAAwB,MAAM,uBAAuB,CAAC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EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC5F;;;OAGG;IACH,cAAc,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;SACxK,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,qFAAqF,EAAE,CAAC;SACxL,QAAQ,EAAE;CACd,CAAC,CAAC","sourcesContent":["/**\n * # Verifying an approval seal, offline (#2903)\n *\n * Everything a verifier needs travels with the seal: the compact JWS, the stored records of the keys that may have signed\n * it (their public half, scope and issuer, as an export carries them), and, when the person's content is to be shown,\n * the disclosures. Nothing here calls the application or the platform, so a seal verifies after the application is gone.\n *\n * ## What is checked, and on whose authority\n *\n * - The header: ES256 is pinned per key from the key RECORD, never read from the header (RFC 8725 §3.1); `jku`, `x5u`,\n * `jwk` and `x5c` are never followed (RFC 8725 §3.10, RFC 7515 §10.7); a `crit` naming anything is refused, since no\n * extension is understood (RFC 7515 §4.1.11); `typ` must be the approval seal's.\n * - The signature, under the key the `kid` names among those given.\n * - The issuer: the payload's `iss` must be the key record's, and the expected issuer when one is given.\n * - The claims: the version-1 shape, strict.\n * - The key's scope, from its stored record and never from a JWKS member: an organization-scoped key verifies only a seal\n * whose tenant is that organization.\n * - The disclosures: each must digest to the commitment its claim names; a commitment with no disclosure is reported as\n * erased (the person's content was removed, the seal stands).\n * - A FILE deliverable (#2904), when the seal attests one: the file's bytes, hashed and salted with the salt its row\n * kept, must give the commitment the disclosed presentation binds it by. One changed byte fails the seal; bytes not\n * given are reported as such (a missing file), never as a match.\n * - A MANIFESTED COPY (#2907), when the seal's deliverable has one: the copy is rebuilt from its own prefix, the JWS, the\n * inputs it carries (its words, its pinned font, its verification address) and the disclosed approver's printed name,\n * and must equal the bytes given, and the host's record of its hash when the bundle states one; its prefix must then open the seal's commitment\n * to the approved file, which ties the copy to the original without the original being supplied. One changed byte in\n * the approval page fails the seal. A copy the approver's erasure deleted is reported CONTENT_ERASED, never missing.\n * - A COMPROMISED key: the signature may still verify, but the seal is not PROVABLE unless corroborated by evidence the\n * key's holder could not have forged: the decision's payload digest recorded outside the application before the\n * compromise instant (an exported audit event, an immutable sink).\n * - The OPERATOR'S PIN SET, when one is given (#2932): the key must be pinned, by the RFC 7638 thumbprint of the public\n * half the verifier was handed (so a key record that names a pinned `kid` over another key is refused), and the pin's\n * state, scope and compromise instant are used instead of the record's. The record (from a bundle, from the host)\n * only supplies the public half and the issuer; the operator's pin decides whether that half is theirs and what became\n * of it. Without a pin set the records are trusted as given, as before.\n * - The OPERATOR'S KEPT SIGNING-LOG EXPORTS, when given (#2932): a seal under a key compromised after an export that lists\n * it is corroborated by that export, which the host could not have signed after the compromise without the operator's\n * copy disagreeing. Each export is verified here, with the operator's pin set for the export key.\n *\n * spec-cite: RFC 8725 §3.1 (algorithm verification), §3.10 (do not trust received URLs); RFC 7515 §4.1.11 (`crit`),\n * §10.7 (key selection from header parameters). Cited by section; the behaviour is this file's decision.\n */\nimport { createHash } from 'node:crypto';\nimport { z } from 'zod';\nimport { humanDecisionBoundDeliverableOf, singleJwsTypeOf, CryptoKey_Purpose, CryptoKey_Scope, CryptoKey_VersionState, type CryptoKeyPinSet } from '@wildo-ai/saas-models';\nimport { ES256_JWS_ALGORITHM, isP256PublicJwk, verifyEs256, type P256PublicJwk } from './es256-jws';\nimport { decisionPayloadDigestOf, sealClaimsDigestOf } from './signature-request.contracts';\nimport { VerificationKeyRecordSchema, compareSigningLogExports, pinnedVerificationKeyOf, verifySigningLogExport } from './signing-log-export.contracts';\nimport { checkApprovalSealManifestedCopy } from './approval-seal-manifested-copy';\nimport {\n ApprovalSealClaimsV1Schema,\n ApprovalSealDisclosureClaim,\n approvalSealDisclosureDigestOf,\n approvalSealFileCommitmentOf,\n type ApprovalSealClaimsV1,\n type ApprovalSealDisclosureValue,\n} from './approval-seal.contracts';\n\n/** The approval seal's JWS `typ`. */\nconst APPROVAL_SEAL_TYP = singleJwsTypeOf(CryptoKey_Purpose.APPROVAL_SEAL);\n\n/** The payload members the custodian sets; the rest is the decision's committed payload. */\nconst CUSTODIAN_SET_CLAIMS = ['iss', 'iat', 'lateSeal'] as const;\n\n/** One key that may have signed a seal: its STORED record (scope, issuer, state), as an export carries it. */\nexport interface ApprovalSealVerificationKey {\n readonly kid: string;\n readonly publicJwk: P256PublicJwk;\n /** The algorithm the key record pins. ES256 for every approval-seal key today. */\n readonly alg: typeof ES256_JWS_ALGORITHM;\n readonly scope: CryptoKey_Scope;\n /** The application's id for an APPLICATION key, the organization's for an ORGANIZATION key. */\n readonly scopeId: string;\n readonly iss: string;\n readonly state: CryptoKey_VersionState;\n /** ISO 8601, for a COMPROMISED key: the earliest instant its private half may have been exposed. */\n readonly compromiseInstant?: string;\n}\n\n/** Evidence recorded OUTSIDE the application that the decision's payload existed before a key's compromise. */\nexport interface ApprovalSealCorroboration {\n readonly decisionPayloadDigest: string;\n /** ISO 8601: when the evidence was recorded where the key's holder could not rewrite it. */\n readonly recordedAt: string;\n}\n\nexport interface ApprovalSealVerificationInput {\n readonly jws: string;\n readonly keys: readonly ApprovalSealVerificationKey[];\n /** The issuer the seal must carry, when the verifier knows which application it expects. */\n readonly expectedIssuer?: string;\n readonly disclosures?: readonly ApprovalSealDisclosureValue[];\n /**\n * The committed claims whose content the host no longer holds because an ERASURE removed it (#2924): the approver's\n * own erasure, or a later erasure of the requester or of a person the presentation named (#3001). The host's\n * statement, read as a reason and never as proof: a claim it names and does not give reads ERASED, one it neither\n * names nor gives reads WITHHELD, and either way the seal stands.\n */\n readonly erasedClaims?: readonly ApprovalSealDisclosureClaim[];\n readonly corroboration?: ApprovalSealCorroboration;\n /**\n * The file deliverable the seal attests (#2904): its id and the salt the seal's row kept (a bundle carries both), and\n * the file's BYTES, which the verifier is given by whoever holds the file (`wildo seal verify --deliverable`). Without\n * the bytes the file is reported NOT_GIVEN.\n */\n readonly deliverableFile?: { readonly fileId: string; readonly salt: string; readonly bytes?: Uint8Array };\n /**\n * The manifested copy of that deliverable (#2907): its id as the host names it, or the host's statement that the\n * approver's erasure deleted it (`contentErased`, read as a reason, never as proof), and the copy's BYTES from whoever\n * holds the file (`wildo seal verify --manifested-copy`). Checking it needs the approver disclosed (the copy prints\n * their name) and, to tie it to the approved file, the presentation and `deliverableFile`'s salt. `contentSha256` is\n * the host's record of the copy's hash: it binds what the rebuild takes from the copy itself (its words, its\n * verification address), so a copy reworded since does not verify.\n */\n readonly manifestedCopy?: { readonly fileId?: string; readonly contentSha256?: string; readonly contentErased?: boolean; readonly bytes?: Uint8Array };\n /** The operator's pin set for approval seals (#2932), from a channel the host does not control. */\n readonly pins?: CryptoKeyPinSet;\n /**\n * The signing-log exports the operator kept (#2932), with the records of the keys that signed them and the operator's\n * pin set for SIGNING_LOG_EXPORT. An export that does not verify, or was signed after its own key's compromise, is\n * ignored: it corroborates nothing.\n */\n readonly signingLogExports?: {\n readonly exports: readonly string[];\n readonly keys: readonly ApprovalSealVerificationKey[];\n readonly pins?: CryptoKeyPinSet;\n };\n}\n\n/** What corroborated a seal under a compromised key. */\nexport enum ApprovalSealCorroborationSource {\n /** The decision's payload digest, recorded outside the application before the compromise. */\n RECORDED_EVIDENCE = 'recorded_evidence',\n /** A signing-log export the operator kept, signed before the compromise, lists the seal. */\n SIGNING_LOG_EXPORT = 'signing_log_export',\n}\n\n/** Why a seal does not verify. */\nexport enum ApprovalSealVerificationFailure {\n /** Not a compact JWS with a JSON header and payload. */\n MALFORMED = 'malformed',\n /** The header's `alg` is not the one the key record pins. */\n ALGORITHM_NOT_PINNED = 'algorithm_not_pinned',\n /** The header names a critical extension, and none is understood. */\n CRITICAL_EXTENSION = 'critical_extension',\n /** The header's `typ` is not the approval seal's. */\n TYPE_MISMATCH = 'type_mismatch',\n /** No given key has the header's `kid`. */\n UNKNOWN_KEY = 'unknown_key',\n SIGNATURE_INVALID = 'signature_invalid',\n /** The payload's issuer is not the key record's, or not the expected one. */\n ISSUER_MISMATCH = 'issuer_mismatch',\n /** The payload is not the version-1 claims shape. */\n CLAIMS_INVALID = 'claims_invalid',\n /** The key's stored scope does not cover the seal's tenant (or is not a scope a seal is signed under). */\n TENANT_OUTSIDE_KEY_SCOPE = 'tenant_outside_key_scope',\n /** A disclosure does not digest to the commitment its claim names. */\n DISCLOSURE_MISMATCH = 'disclosure_mismatch',\n /** A pin set was given and does not pin the key, or the key handed over is not the one its pinned `kid` names. */\n UNPINNED = 'unpinned',\n /** A file deliverable's bytes were given and are not the ones the seal binds (#2904). */\n DELIVERABLE_FILE_MISMATCH = 'deliverable_file_mismatch',\n /**\n * A manifested copy was given and is not this seal's (#2907): its approval page, its attached JWS or its page tree is\n * not what the seal rebuilds, or what precedes them is not the file the seal binds.\n */\n MANIFESTED_COPY_MISMATCH = 'manifested_copy_mismatch',\n}\n\n/** What the seal says about the file deliverable it attests (#2904). */\nexport enum ApprovalSealDeliverableFileStanding {\n /** The bytes given hash, with the row's salt, to the commitment the presentation binds: the file approved. */\n MATCHES = 'matches',\n /** The bytes given are not the file approved: one changed byte is enough. The seal does not verify. */\n CHANGED = 'changed',\n /** The seal binds the file and its bytes were not given: the file is missing, or was not supplied. */\n NOT_GIVEN = 'not_given',\n /**\n * Nothing to compare with: the presentation that holds the commitment is not disclosed (erased with a person it\n * named, or withheld), or it binds no such file.\n */\n NOT_COMMITTED = 'not_committed',\n /**\n * A manifested copy (#2907) only: the host states the approver's erasure deleted it. The copy printed the approver's\n * name in clear and a file cannot be scrubbed, so it went; the seal and the original still prove the approval, and the\n * copy can be rebuilt from both should the name ever lawfully be needed again.\n */\n CONTENT_ERASED = 'content_erased',\n}\n\n/**\n * What the seal says about one committed disclosure: a person's (approver, requester), what they were shown, what they\n * answered. In none of the three is the seal failed: the signature covers the commitments, never the content (#2924).\n */\nexport enum ApprovalSealDisclosureStanding {\n /** Given, and it digests to the commitment. */\n DISCLOSED = 'disclosed',\n /**\n * Committed to, not given, and the bundle states an erasure removed it (`erasedClaims`): UNDISCLOSED (erased). For the\n * presentation this is PRESENTATION_ERASED: an erasure rewrote the stored presentation, and the seal still proves that\n * a presentation with this digest was shown.\n */\n ERASED = 'erased',\n /** Committed to, and not given, with no erasure stated: withheld, or a bundle that does not carry it. */\n WITHHELD = 'withheld',\n}\n\nexport interface ApprovalSealVerification {\n /** The signature verifies, under a key whose record covers the seal, over well-formed claims and matching disclosures. */\n readonly valid: boolean;\n readonly failures: readonly ApprovalSealVerificationFailure[];\n /**\n * The seal proves what it says: valid, and its key not compromised, or corroborated before the compromise. A valid seal\n * under a compromised key, uncorroborated, is reported valid and NOT provable.\n */\n readonly provable: boolean;\n /** For a seal under a compromised key, what corroborated it; absent when nothing did (or nothing needed to). */\n readonly corroboratedBy?: ApprovalSealCorroborationSource;\n readonly kid?: string;\n readonly keyState?: CryptoKey_VersionState;\n readonly claims?: ApprovalSealClaimsV1;\n readonly iss?: string;\n /** The signing instant, epoch seconds. */\n readonly iat?: number;\n readonly lateSeal?: boolean;\n /** Seconds between the decision and its signature: what the database held at signing is what is sealed. */\n readonly signingWindowSeconds?: number;\n /** The digest of the decision's committed payload, to compare with the RESOLVED row of an exported trail. */\n readonly decisionPayloadDigest?: string;\n readonly approver?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n readonly requester?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n /** What the person was shown (#2903 S6), when the seal binds it: DISCLOSED, ERASED (PRESENTATION_ERASED) or WITHHELD. */\n readonly presentation?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n /** What the person answered, when the seal binds it. */\n readonly statement?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n /** The file deliverable the seal attests, checked against its bytes (#2904), when one was named. */\n readonly deliverableFile?: { readonly fileId: string; readonly argument?: string; readonly standing: ApprovalSealDeliverableFileStanding };\n /**\n * The manifested copy (#2907), when one was named: MATCHES (the original the seal binds, followed by exactly this seal's\n * approval page naming the disclosed approver), CHANGED, NOT_GIVEN, NOT_COMMITTED (the approver or the commitment is\n * not disclosed, so there is nothing to rebuild or tie it to) or CONTENT_ERASED. `approverName` is the name it prints.\n */\n readonly manifestedCopy?: {\n readonly fileId?: string;\n readonly standing: ApprovalSealDeliverableFileStanding;\n readonly approverName?: string;\n /** What the copy states it was made with, when it rebuilt: its words' language, its verification address. */\n readonly locale?: string;\n readonly verificationUrl?: string;\n };\n}\n\nfunction decodeJson(part: string | undefined): Record<string, unknown> | null {\n if (!part) return null;\n try {\n const value: unknown = JSON.parse(Buffer.from(part, 'base64url').toString('utf8'));\n return value !== null && typeof value === 'object' && !Array.isArray(value) ? (value as Record<string, unknown>) : null;\n } catch {\n return null;\n }\n}\n\nfunction disclosureStanding(\n claimName: ApprovalSealDisclosureClaim,\n commitment: string | undefined,\n disclosures: readonly ApprovalSealDisclosureValue[],\n erasedClaims: readonly ApprovalSealDisclosureClaim[],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['approver'] {\n if (!commitment) return undefined;\n const given = disclosures.filter((disclosure) => disclosure.claimName === claimName);\n if (given.length === 0) {\n return { standing: erasedClaims.includes(claimName) ? ApprovalSealDisclosureStanding.ERASED : ApprovalSealDisclosureStanding.WITHHELD };\n }\n const matching = given.find((disclosure) => approvalSealDisclosureDigestOf(disclosure) === commitment);\n if (!matching) {\n // A disclosure that does not open its commitment is not the content: the seal fails, and nothing was disclosed.\n failures.push(ApprovalSealVerificationFailure.DISCLOSURE_MISMATCH);\n return { standing: ApprovalSealDisclosureStanding.WITHHELD };\n }\n return { standing: ApprovalSealDisclosureStanding.DISCLOSED, value: matching.value };\n}\n\n/**\n * The file deliverable against the commitment the disclosed presentation binds it by (#2904). A mismatch is a failure:\n * the seal does not attest those bytes.\n */\nfunction deliverableFileStandingOf(\n given: ApprovalSealVerificationInput['deliverableFile'],\n presentation: ApprovalSealVerification['presentation'],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['deliverableFile'] {\n if (!given) return undefined;\n const bound = presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED ? humanDecisionBoundDeliverableOf(presentation.value, given.fileId) : undefined;\n if (!bound) return { fileId: given.fileId, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED };\n if (!given.bytes) return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.NOT_GIVEN };\n const contentSha256 = createHash('sha256').update(given.bytes).digest('hex');\n if (approvalSealFileCommitmentOf(given.salt, contentSha256) === bound.commitment) {\n return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.MATCHES };\n }\n failures.push(ApprovalSealVerificationFailure.DELIVERABLE_FILE_MISMATCH);\n return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n}\n\n/**\n * The manifested copy against the seal (#2907): rebuilt and compared, then its prefix opened against the commitment the\n * disclosed presentation binds the deliverable by. A mismatch at either step is a failure.\n */\nfunction manifestedCopyStandingOf(\n input: ApprovalSealVerificationInput,\n approver: ApprovalSealVerification['approver'],\n presentation: ApprovalSealVerification['presentation'],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['manifestedCopy'] {\n const given = input.manifestedCopy;\n if (!given) return undefined;\n const named = given.fileId ? { fileId: given.fileId } : {};\n if (!given.bytes) {\n return { ...named, standing: given.contentErased ? ApprovalSealDeliverableFileStanding.CONTENT_ERASED : ApprovalSealDeliverableFileStanding.NOT_GIVEN };\n }\n if (approver?.standing !== ApprovalSealDisclosureStanding.DISCLOSED || !approver.value) return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED };\n const approverName = typeof approver.value.name === 'string' ? approver.value.name : undefined;\n const printed = approverName !== undefined ? { approverName } : {};\n const statedHash = given.contentSha256 === undefined || createHash('sha256').update(given.bytes).digest('hex') === given.contentSha256;\n const check = checkApprovalSealManifestedCopy(given.bytes, { jws: input.jws, ...printed });\n if (!check.matches || !statedHash) {\n failures.push(ApprovalSealVerificationFailure.MANIFESTED_COPY_MISMATCH);\n return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n }\n const deliverable = input.deliverableFile;\n const bound = deliverable && presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED\n ? humanDecisionBoundDeliverableOf(presentation.value, deliverable.fileId)\n : undefined;\n const stated = { locale: check.statement.locale, ...(check.statement.verificationUrl ? { verificationUrl: check.statement.verificationUrl } : {}) };\n if (!deliverable || !bound) return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED, ...printed, ...stated };\n if (approvalSealFileCommitmentOf(deliverable.salt, createHash('sha256').update(check.original).digest('hex')) !== bound.commitment) {\n failures.push(ApprovalSealVerificationFailure.MANIFESTED_COPY_MISMATCH);\n return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n }\n return { ...named, standing: ApprovalSealDeliverableFileStanding.MATCHES, ...printed, ...stated };\n}\n\n/**\n * What corroborates a seal under a compromised key, if anything: evidence of its payload recorded before the compromise,\n * or a kept export signed before the compromise that lists this exact seal (its issuer, its key, its signed claims).\n */\nfunction corroborationOf(\n input: ApprovalSealVerificationInput,\n key: ApprovalSealVerificationKey,\n payload: Readonly<Record<string, unknown>>,\n decisionPayloadDigest: string,\n): ApprovalSealCorroborationSource | undefined {\n if (key.compromiseInstant === undefined) return undefined;\n const compromisedFrom = Date.parse(key.compromiseInstant);\n if (input.corroboration && input.corroboration.decisionPayloadDigest === decisionPayloadDigest && Date.parse(input.corroboration.recordedAt) < compromisedFrom) {\n return ApprovalSealCorroborationSource.RECORDED_EVIDENCE;\n }\n const logged = input.signingLogExports;\n if (!logged) return undefined;\n const claimsDigest = sealClaimsDigestOf(payload);\n const evidence = logged.exports.flatMap((jws) => {\n const exported = verifySigningLogExport({ jws, keys: logged.keys, ...(logged.pins ? { pins: logged.pins } : {}), expectedIssuer: key.iss });\n return exported.provable && exported.claims ? [exported.claims] : [];\n });\n // The exports must agree with each other first (#2932 review M3): an export is dated by the instant it states for\n // itself, so a host holding the export key could sign one dated before the compromise; it disagrees with the operator's\n // kept exports (a different hash at some sequence, or a head behind an earlier one), and then none of them corroborates.\n if (!compareSigningLogExports(evidence).consistent) return undefined;\n for (const claims of evidence) {\n if (claims.iat * 1000 >= compromisedFrom) continue;\n const lists = claims.entries.some((entry) =>\n entry.purpose === CryptoKey_Purpose.APPROVAL_SEAL && entry.kid === key.kid && entry.iss === key.iss && entry.claimsDigest === claimsDigest);\n if (lists) return ApprovalSealCorroborationSource.SIGNING_LOG_EXPORT;\n }\n return undefined;\n}\n\n/** See the file's header. Pure and offline. */\nexport function verifyApprovalSeal(input: ApprovalSealVerificationInput): ApprovalSealVerification {\n const failures: ApprovalSealVerificationFailure[] = [];\n const fail = (failure: ApprovalSealVerificationFailure, extra: Partial<ApprovalSealVerification> = {}): ApprovalSealVerification =>\n ({ valid: false, provable: false, failures: [...failures, failure], ...extra });\n\n const parts = input.jws.split('.');\n const header = parts.length === 3 ? decodeJson(parts[0]) : null;\n const payload = parts.length === 3 ? decodeJson(parts[1]) : null;\n if (!header || !payload || !parts[2]) return fail(ApprovalSealVerificationFailure.MALFORMED);\n\n const kid = typeof header.kid === 'string' ? header.kid : undefined;\n // The key is chosen by `kid` among the keys the verifier was GIVEN; `jku`/`x5u`/`jwk`/`x5c` are never read.\n const record = kid ? input.keys.find((candidate) => candidate.kid === kid) : undefined;\n if (!record || !isP256PublicJwk(record.publicJwk)) return fail(ApprovalSealVerificationFailure.UNKNOWN_KEY, kid ? { kid } : {});\n // The operator's pin, when given: the key handed over must be the one the pinned thumbprint names, and the pin (not\n // the record) says what became of it.\n const key = pinnedVerificationKeyOf(record, input.pins);\n if (!key) return fail(ApprovalSealVerificationFailure.UNPINNED, { kid });\n if (header.alg !== key.alg || key.alg !== ES256_JWS_ALGORITHM) return fail(ApprovalSealVerificationFailure.ALGORITHM_NOT_PINNED, { kid });\n if (header.crit !== undefined) return fail(ApprovalSealVerificationFailure.CRITICAL_EXTENSION, { kid });\n if (header.typ !== APPROVAL_SEAL_TYP) return fail(ApprovalSealVerificationFailure.TYPE_MISMATCH, { kid });\n if (!verifyEs256(`${parts[0]}.${parts[1]}`, Buffer.from(parts[2], 'base64url'), key.publicJwk)) {\n return fail(ApprovalSealVerificationFailure.SIGNATURE_INVALID, { kid, keyState: key.state });\n }\n\n const iss = typeof payload.iss === 'string' ? payload.iss : undefined;\n const iat = typeof payload.iat === 'number' ? payload.iat : undefined;\n const lateSeal = payload.lateSeal === true;\n if (!iss || iss !== key.iss || (input.expectedIssuer !== undefined && iss !== input.expectedIssuer)) failures.push(ApprovalSealVerificationFailure.ISSUER_MISMATCH);\n\n const committed = Object.fromEntries(Object.entries(payload).filter(([name]) => !(CUSTODIAN_SET_CLAIMS as readonly string[]).includes(name)));\n const parsed = ApprovalSealClaimsV1Schema.safeParse(committed);\n if (!parsed.success) return fail(ApprovalSealVerificationFailure.CLAIMS_INVALID, { kid, keyState: key.state, ...(iss ? { iss } : {}) });\n const claims = parsed.data;\n\n // The key's scope from its RECORD: an organization key covers only that organization's decisions.\n const scopeCovers = key.scope === CryptoKey_Scope.APPLICATION || (key.scope === CryptoKey_Scope.ORGANIZATION && claims.tenant === key.scopeId);\n if (!scopeCovers) failures.push(ApprovalSealVerificationFailure.TENANT_OUTSIDE_KEY_SCOPE);\n\n const disclosures = input.disclosures ?? [];\n const erased = input.erasedClaims ?? [];\n const approver = disclosureStanding(ApprovalSealDisclosureClaim.APPROVER, claims.approver, disclosures, erased, failures);\n const requester = disclosureStanding(ApprovalSealDisclosureClaim.REQUESTER, claims.requester?.disclosure, disclosures, erased, failures);\n const presentation = disclosureStanding(ApprovalSealDisclosureClaim.PRESENTATION, claims.presentation?.digest, disclosures, erased, failures);\n const statement = disclosureStanding(ApprovalSealDisclosureClaim.STATEMENT, claims.statementDigest, disclosures, erased, failures);\n const deliverableFile = deliverableFileStandingOf(input.deliverableFile, presentation, failures);\n const manifestedCopy = manifestedCopyStandingOf(input, approver, presentation, failures);\n\n const decisionPayloadDigest = decisionPayloadDigestOf(committed);\n const valid = failures.length === 0;\n const compromised = key.state === CryptoKey_VersionState.COMPROMISED;\n const corroboratedBy = compromised ? corroborationOf(input, key, payload, decisionPayloadDigest) : undefined;\n const corroborated = !compromised || corroboratedBy !== undefined;\n return {\n valid,\n failures,\n provable: valid && corroborated,\n ...(corroboratedBy ? { corroboratedBy } : {}),\n kid,\n keyState: key.state,\n claims,\n iss,\n ...(iat !== undefined ? { iat, signingWindowSeconds: Math.max(0, iat - claims.decidedAt) } : {}),\n lateSeal,\n decisionPayloadDigest,\n ...(approver ? { approver } : {}),\n ...(requester ? { requester } : {}),\n ...(presentation ? { presentation } : {}),\n ...(statement ? { statement } : {}),\n ...(deliverableFile ? { deliverableFile } : {}),\n ...(manifestedCopy ? { manifestedCopy } : {}),\n };\n}\n\n/** A verification key as an export or a CLI file states it (dates as ISO strings): the one shape of a key record. */\nexport const ApprovalSealVerificationKeySchema = VerificationKeyRecordSchema;\n\n/**\n * Evidence recorded outside the application that a decision's payload existed before a key's compromise, as the file an\n * operator keeps it in (`wildo seal verify --corroboration <file>`).\n */\nexport const ApprovalSealCorroborationSchema = z.object({ decisionPayloadDigest: z.string().min(1), recordedAt: z.string().min(1) });\n\n/**\n * What `wildo seal verify` reads: one seal and everything it needs to verify, offline. A bundle is what the HOST exports,\n * so it carries no pin set, no signing-log exports and no corroboration: each is evidence against the host, and reaches\n * the verifier only from the operator's own files (`ApprovalSealVerificationInput.pins` / `signingLogExports` /\n * `corroboration`). The schema is not strict, so a bundle naming any of them has it stripped on parse rather than\n * believed (#2932 review H1, R1).\n */\nexport const ApprovalSealVerificationBundleSchema = z.object({\n jws: z.string().min(1),\n keys: z.array(ApprovalSealVerificationKeySchema).min(1),\n expectedIssuer: z.string().min(1).optional(),\n disclosures: z.array(z.object({ claimName: z.enum(ApprovalSealDisclosureClaim), salt: z.string().min(1), value: z.record(z.string(), z.unknown()) })).optional(),\n /** The committed claims an erasure removed from the host's row (#2924): see `ApprovalSealVerificationInput.erasedClaims`. */\n erasedClaims: z.array(z.enum(ApprovalSealDisclosureClaim)).optional(),\n /**\n * The file deliverable the seal attests (#2904): its id and the salt its row kept. Never the bytes, which the verifier\n * is given from the file itself (`--deliverable`), and never the clear hash.\n */\n deliverableFile: z.object({ fileId: z.string().min(1), salt: z.string().min(1) }).optional(),\n /**\n * The deliverable's manifested copy (#2907): its file id, or `contentErased` when the approver's erasure deleted it.\n * Never its bytes, which the verifier is given from the file itself (`--manifested-copy`).\n */\n manifestedCopy: z.object({ fileId: z.string().min(1).optional(), contentSha256: z.string().regex(/^[0-9a-f]{64}$/).optional(), contentErased: z.literal(true).optional() })\n .refine((copy) => (copy.fileId === undefined) !== (copy.contentErased === undefined), { message: 'A manifested copy is named by its file id, or stated erased: exactly one of the two' })\n .optional(),\n});\nexport type ApprovalSealVerificationBundle = z.infer<typeof ApprovalSealVerificationBundleSchema>;\n"]}
1
+ {"version":3,"file":"approval-seal-verifier.js","sourceRoot":"","sources":["../../../src/key-management/approval-seal-verifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,EAAE,UAAU,EAAE,MA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AAC;SACxL,QAAQ,EAAE;CACd,CAAC,CAAC","sourcesContent":["/**\n * # Verifying an approval seal, offline (#2903)\n *\n * Everything a verifier needs travels with the seal: the compact JWS, the stored records of the keys that may have signed\n * it (their public half, scope and issuer, as an export carries them), and, when the person's content is to be shown,\n * the disclosures. Nothing here calls the application or the platform, so a seal verifies after the application is gone.\n *\n * ## What is checked, and on whose authority\n *\n * - The header: ES256 is pinned per key from the key RECORD, never read from the header (RFC 8725 §3.1); `jku`, `x5u`,\n * `jwk` and `x5c` are never followed (RFC 8725 §3.10, RFC 7515 §10.7); a `crit` naming anything is refused, since no\n * extension is understood (RFC 7515 §4.1.11); `typ` must be the approval seal's.\n * - The signature, under the key the `kid` names among those given.\n * - The issuer: the payload's `iss` must be the key record's, and the expected issuer when one is given.\n * - The claims: the version-1 shape, strict.\n * - The key's scope, from its stored record and never from a JWKS member: an organization-scoped key verifies only a seal\n * whose tenant is that organization.\n * - The disclosures: each must digest to the commitment its claim names; a commitment with no disclosure is reported as\n * erased (the person's content was removed, the seal stands).\n * - A FILE deliverable (#2904), when the seal attests one: the file's bytes, hashed and salted with the salt its row\n * kept, must give the commitment the disclosed presentation binds it by. One changed byte fails the seal; bytes not\n * given are reported as such (a missing file), never as a match.\n * - A MANIFESTED COPY (#2907), when the seal's deliverable has one: the copy is rebuilt from its own prefix, the JWS, the\n * inputs it carries (its words, its pinned font, its verification address) and the disclosed approver's printed name,\n * and must equal the bytes given, and the host's record of its hash when the bundle states one; its prefix must then open the seal's commitment\n * to the approved file, which ties the copy to the original without the original being supplied. One changed byte in\n * the approval page fails the seal. A copy the approver's erasure deleted is reported CONTENT_ERASED, never missing.\n * - The CURRENCY of the approval over its record (#2914), when the record as it is now is given: the values of the fields\n * the approval covers, as the disclosed presentation carries them, compared with the record. A record changed since is\n * NOT a failure: the seal still proves what was approved; it is reported NO_LONGER_CURRENT. Without the presentation\n * disclosed there is nothing to compare, and it is reported as having no sealed field set, never as current.\n * - A COMPROMISED key: the signature may still verify, but the seal is not PROVABLE unless corroborated by evidence the\n * key's holder could not have forged: the decision's payload digest recorded outside the application before the\n * compromise instant (an exported audit event, an immutable sink).\n * - The OPERATOR'S PIN SET, when one is given (#2932): the key must be pinned, by the RFC 7638 thumbprint of the public\n * half the verifier was handed (so a key record that names a pinned `kid` over another key is refused), and the pin's\n * state, scope and compromise instant are used instead of the record's. The record (from a bundle, from the host)\n * only supplies the public half and the issuer; the operator's pin decides whether that half is theirs and what became\n * of it. Without a pin set the records are trusted as given, as before.\n * - The OPERATOR'S KEPT SIGNING-LOG EXPORTS, when given (#2932): a seal under a key compromised after an export that lists\n * it is corroborated by that export, which the host could not have signed after the compromise without the operator's\n * copy disagreeing. Each export is verified here, with the operator's pin set for the export key.\n *\n * spec-cite: RFC 8725 §3.1 (algorithm verification), §3.10 (do not trust received URLs); RFC 7515 §4.1.11 (`crit`),\n * §10.7 (key selection from header parameters). Cited by section; the behaviour is this file's decision.\n */\nimport { createHash } from 'node:crypto';\nimport { z } from 'zod';\nimport { approvalSealSubjectCurrencyOf, humanDecisionBoundDeliverableOf, singleJwsTypeOf, type ApprovalSealSubjectCurrencyAssessment, CryptoKey_Purpose, CryptoKey_Scope, CryptoKey_VersionState, type CryptoKeyPinSet } from '@wildo-ai/saas-models';\nimport { ES256_JWS_ALGORITHM, isP256PublicJwk, verifyEs256, type P256PublicJwk } from './es256-jws';\nimport { decisionPayloadDigestOf, sealClaimsDigestOf } from './signature-request.contracts';\nimport { VerificationKeyRecordSchema, compareSigningLogExports, pinnedVerificationKeyOf, verifySigningLogExport } from './signing-log-export.contracts';\nimport { checkApprovalSealManifestedCopy } from './approval-seal-manifested-copy';\nimport {\n ApprovalSealClaimsV1Schema,\n ApprovalSealDisclosureClaim,\n approvalSealDisclosureDigestOf,\n approvalSealFileCommitmentOf,\n type ApprovalSealClaimsV1,\n type ApprovalSealDisclosureValue,\n} from './approval-seal.contracts';\n\n/** The approval seal's JWS `typ`. */\nconst APPROVAL_SEAL_TYP = singleJwsTypeOf(CryptoKey_Purpose.APPROVAL_SEAL);\n\n/** The payload members the custodian sets; the rest is the decision's committed payload. */\nconst CUSTODIAN_SET_CLAIMS = ['iss', 'iat', 'lateSeal'] as const;\n\n/** One key that may have signed a seal: its STORED record (scope, issuer, state), as an export carries it. */\nexport interface ApprovalSealVerificationKey {\n readonly kid: string;\n readonly publicJwk: P256PublicJwk;\n /** The algorithm the key record pins. ES256 for every approval-seal key today. */\n readonly alg: typeof ES256_JWS_ALGORITHM;\n readonly scope: CryptoKey_Scope;\n /** The application's id for an APPLICATION key, the organization's for an ORGANIZATION key. */\n readonly scopeId: string;\n readonly iss: string;\n readonly state: CryptoKey_VersionState;\n /** ISO 8601, for a COMPROMISED key: the earliest instant its private half may have been exposed. */\n readonly compromiseInstant?: string;\n}\n\n/** Evidence recorded OUTSIDE the application that the decision's payload existed before a key's compromise. */\nexport interface ApprovalSealCorroboration {\n readonly decisionPayloadDigest: string;\n /** ISO 8601: when the evidence was recorded where the key's holder could not rewrite it. */\n readonly recordedAt: string;\n}\n\nexport interface ApprovalSealVerificationInput {\n readonly jws: string;\n readonly keys: readonly ApprovalSealVerificationKey[];\n /** The issuer the seal must carry, when the verifier knows which application it expects. */\n readonly expectedIssuer?: string;\n readonly disclosures?: readonly ApprovalSealDisclosureValue[];\n /**\n * The committed claims whose content the host no longer holds because an ERASURE removed it (#2924): the approver's\n * own erasure, or a later erasure of the requester or of a person the presentation named (#3001). The host's\n * statement, read as a reason and never as proof: a claim it names and does not give reads ERASED, one it neither\n * names nor gives reads WITHHELD, and either way the seal stands.\n */\n readonly erasedClaims?: readonly ApprovalSealDisclosureClaim[];\n readonly corroboration?: ApprovalSealCorroboration;\n /**\n * The file deliverable the seal attests (#2904): its id and the salt the seal's row kept (a bundle carries both), and\n * the file's BYTES, which the verifier is given by whoever holds the file (`wildo seal verify --deliverable`). Without\n * the bytes the file is reported NOT_GIVEN.\n */\n readonly deliverableFile?: { readonly fileId: string; readonly salt: string; readonly bytes?: Uint8Array };\n /**\n * The manifested copy of that deliverable (#2907): its id as the host names it, or the host's statement that the\n * approver's erasure deleted it (`contentErased`, read as a reason, never as proof), and the copy's BYTES from whoever\n * holds the file (`wildo seal verify --manifested-copy`). Checking it needs the approver disclosed (the copy prints\n * their name) and, to tie it to the approved file, the presentation and `deliverableFile`'s salt. `contentSha256` is\n * the host's record of the copy's hash: it binds what the rebuild takes from the copy itself (its words, its\n * verification address), so a copy reworded since does not verify.\n */\n readonly manifestedCopy?: { readonly fileId?: string; readonly contentSha256?: string; readonly contentErased?: boolean; readonly bytes?: Uint8Array };\n /**\n * The record the approval is about, as it is NOW (#2914): its fields as an export of the record states them, or null\n * for a record that is gone. Compared with the sealed field set the disclosed presentation carries\n * (`wildo seal verify --subject-record`).\n */\n readonly subjectRecord?: Readonly<Record<string, unknown>> | null;\n /** The operator's pin set for approval seals (#2932), from a channel the host does not control. */\n readonly pins?: CryptoKeyPinSet;\n /**\n * The signing-log exports the operator kept (#2932), with the records of the keys that signed them and the operator's\n * pin set for SIGNING_LOG_EXPORT. An export that does not verify, or was signed after its own key's compromise, is\n * ignored: it corroborates nothing.\n */\n readonly signingLogExports?: {\n readonly exports: readonly string[];\n readonly keys: readonly ApprovalSealVerificationKey[];\n readonly pins?: CryptoKeyPinSet;\n };\n}\n\n/** What corroborated a seal under a compromised key. */\nexport enum ApprovalSealCorroborationSource {\n /** The decision's payload digest, recorded outside the application before the compromise. */\n RECORDED_EVIDENCE = 'recorded_evidence',\n /** A signing-log export the operator kept, signed before the compromise, lists the seal. */\n SIGNING_LOG_EXPORT = 'signing_log_export',\n}\n\n/** Why a seal does not verify. */\nexport enum ApprovalSealVerificationFailure {\n /** Not a compact JWS with a JSON header and payload. */\n MALFORMED = 'malformed',\n /** The header's `alg` is not the one the key record pins. */\n ALGORITHM_NOT_PINNED = 'algorithm_not_pinned',\n /** The header names a critical extension, and none is understood. */\n CRITICAL_EXTENSION = 'critical_extension',\n /** The header's `typ` is not the approval seal's. */\n TYPE_MISMATCH = 'type_mismatch',\n /** No given key has the header's `kid`. */\n UNKNOWN_KEY = 'unknown_key',\n SIGNATURE_INVALID = 'signature_invalid',\n /** The payload's issuer is not the key record's, or not the expected one. */\n ISSUER_MISMATCH = 'issuer_mismatch',\n /** The payload is not the version-1 claims shape. */\n CLAIMS_INVALID = 'claims_invalid',\n /** The key's stored scope does not cover the seal's tenant (or is not a scope a seal is signed under). */\n TENANT_OUTSIDE_KEY_SCOPE = 'tenant_outside_key_scope',\n /** A disclosure does not digest to the commitment its claim names. */\n DISCLOSURE_MISMATCH = 'disclosure_mismatch',\n /** A pin set was given and does not pin the key, or the key handed over is not the one its pinned `kid` names. */\n UNPINNED = 'unpinned',\n /** A file deliverable's bytes were given and are not the ones the seal binds (#2904). */\n DELIVERABLE_FILE_MISMATCH = 'deliverable_file_mismatch',\n /**\n * A manifested copy was given and is not this seal's (#2907): its approval page, its attached JWS or its page tree is\n * not what the seal rebuilds, or what precedes them is not the file the seal binds.\n */\n MANIFESTED_COPY_MISMATCH = 'manifested_copy_mismatch',\n}\n\n/** What the seal says about the file deliverable it attests (#2904). */\nexport enum ApprovalSealDeliverableFileStanding {\n /** The bytes given hash, with the row's salt, to the commitment the presentation binds: the file approved. */\n MATCHES = 'matches',\n /** The bytes given are not the file approved: one changed byte is enough. The seal does not verify. */\n CHANGED = 'changed',\n /** The seal binds the file and its bytes were not given: the file is missing, or was not supplied. */\n NOT_GIVEN = 'not_given',\n /**\n * Nothing to compare with: the presentation that holds the commitment is not disclosed (erased with a person it\n * named, or withheld), or it binds no such file.\n */\n NOT_COMMITTED = 'not_committed',\n /**\n * A manifested copy (#2907) only: the host states the approver's erasure deleted it. The copy printed the approver's\n * name in clear and a file cannot be scrubbed, so it went; the seal and the original still prove the approval, and the\n * copy can be rebuilt from both should the name ever lawfully be needed again.\n */\n CONTENT_ERASED = 'content_erased',\n}\n\n/**\n * What the seal says about one committed disclosure: a person's (approver, requester), what they were shown, what they\n * answered. In none of the three is the seal failed: the signature covers the commitments, never the content (#2924).\n */\nexport enum ApprovalSealDisclosureStanding {\n /** Given, and it digests to the commitment. */\n DISCLOSED = 'disclosed',\n /**\n * Committed to, not given, and the bundle states an erasure removed it (`erasedClaims`): UNDISCLOSED (erased). For the\n * presentation this is PRESENTATION_ERASED: an erasure rewrote the stored presentation, and the seal still proves that\n * a presentation with this digest was shown.\n */\n ERASED = 'erased',\n /** Committed to, and not given, with no erasure stated: withheld, or a bundle that does not carry it. */\n WITHHELD = 'withheld',\n}\n\nexport interface ApprovalSealVerification {\n /** The signature verifies, under a key whose record covers the seal, over well-formed claims and matching disclosures. */\n readonly valid: boolean;\n readonly failures: readonly ApprovalSealVerificationFailure[];\n /**\n * The seal proves what it says: valid, and its key not compromised, or corroborated before the compromise. A valid seal\n * under a compromised key, uncorroborated, is reported valid and NOT provable.\n */\n readonly provable: boolean;\n /** For a seal under a compromised key, what corroborated it; absent when nothing did (or nothing needed to). */\n readonly corroboratedBy?: ApprovalSealCorroborationSource;\n readonly kid?: string;\n readonly keyState?: CryptoKey_VersionState;\n readonly claims?: ApprovalSealClaimsV1;\n readonly iss?: string;\n /** The signing instant, epoch seconds. */\n readonly iat?: number;\n readonly lateSeal?: boolean;\n /** Seconds between the decision and its signature: what the database held at signing is what is sealed. */\n readonly signingWindowSeconds?: number;\n /** The digest of the decision's committed payload, to compare with the RESOLVED row of an exported trail. */\n readonly decisionPayloadDigest?: string;\n readonly approver?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n readonly requester?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n /** What the person was shown (#2903 S6), when the seal binds it: DISCLOSED, ERASED (PRESENTATION_ERASED) or WITHHELD. */\n readonly presentation?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n /** What the person answered, when the seal binds it. */\n readonly statement?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n /** The file deliverable the seal attests, checked against its bytes (#2904), when one was named. */\n readonly deliverableFile?: { readonly fileId: string; readonly argument?: string; readonly standing: ApprovalSealDeliverableFileStanding };\n /**\n * The manifested copy (#2907), when one was named: MATCHES (the original the seal binds, followed by exactly this seal's\n * approval page naming the disclosed approver), CHANGED, NOT_GIVEN, NOT_COMMITTED (the approver or the commitment is\n * not disclosed, so there is nothing to rebuild or tie it to) or CONTENT_ERASED. `approverName` is the name it prints.\n */\n readonly manifestedCopy?: {\n readonly fileId?: string;\n readonly standing: ApprovalSealDeliverableFileStanding;\n readonly approverName?: string;\n /** What the copy states it was made with, when it rebuilt: its words' language, its verification address. */\n readonly locale?: string;\n readonly verificationUrl?: string;\n };\n /**\n * Whether the approval is still current over its record (#2914), when the record was given: CURRENT,\n * NO_LONGER_CURRENT (never a failure), SUBJECT_GONE, or NO_SEALED_FIELD_SET when the presentation is not disclosed or\n * covers no record field.\n */\n readonly subjectRecordCurrency?: ApprovalSealSubjectCurrencyAssessment;\n}\n\nfunction decodeJson(part: string | undefined): Record<string, unknown> | null {\n if (!part) return null;\n try {\n const value: unknown = JSON.parse(Buffer.from(part, 'base64url').toString('utf8'));\n return value !== null && typeof value === 'object' && !Array.isArray(value) ? (value as Record<string, unknown>) : null;\n } catch {\n return null;\n }\n}\n\nfunction disclosureStanding(\n claimName: ApprovalSealDisclosureClaim,\n commitment: string | undefined,\n disclosures: readonly ApprovalSealDisclosureValue[],\n erasedClaims: readonly ApprovalSealDisclosureClaim[],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['approver'] {\n if (!commitment) return undefined;\n const given = disclosures.filter((disclosure) => disclosure.claimName === claimName);\n if (given.length === 0) {\n return { standing: erasedClaims.includes(claimName) ? ApprovalSealDisclosureStanding.ERASED : ApprovalSealDisclosureStanding.WITHHELD };\n }\n const matching = given.find((disclosure) => approvalSealDisclosureDigestOf(disclosure) === commitment);\n if (!matching) {\n // A disclosure that does not open its commitment is not the content: the seal fails, and nothing was disclosed.\n failures.push(ApprovalSealVerificationFailure.DISCLOSURE_MISMATCH);\n return { standing: ApprovalSealDisclosureStanding.WITHHELD };\n }\n return { standing: ApprovalSealDisclosureStanding.DISCLOSED, value: matching.value };\n}\n\n/**\n * The file deliverable against the commitment the disclosed presentation binds it by (#2904). A mismatch is a failure:\n * the seal does not attest those bytes.\n */\nfunction deliverableFileStandingOf(\n given: ApprovalSealVerificationInput['deliverableFile'],\n presentation: ApprovalSealVerification['presentation'],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['deliverableFile'] {\n if (!given) return undefined;\n const bound = presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED ? humanDecisionBoundDeliverableOf(presentation.value, given.fileId) : undefined;\n if (!bound) return { fileId: given.fileId, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED };\n if (!given.bytes) return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.NOT_GIVEN };\n const contentSha256 = createHash('sha256').update(given.bytes).digest('hex');\n if (approvalSealFileCommitmentOf(given.salt, contentSha256) === bound.commitment) {\n return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.MATCHES };\n }\n failures.push(ApprovalSealVerificationFailure.DELIVERABLE_FILE_MISMATCH);\n return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n}\n\n/**\n * The manifested copy against the seal (#2907): rebuilt and compared, then its prefix opened against the commitment the\n * disclosed presentation binds the deliverable by. A mismatch at either step is a failure.\n */\nfunction manifestedCopyStandingOf(\n input: ApprovalSealVerificationInput,\n approver: ApprovalSealVerification['approver'],\n presentation: ApprovalSealVerification['presentation'],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['manifestedCopy'] {\n const given = input.manifestedCopy;\n if (!given) return undefined;\n const named = given.fileId ? { fileId: given.fileId } : {};\n if (!given.bytes) {\n return { ...named, standing: given.contentErased ? ApprovalSealDeliverableFileStanding.CONTENT_ERASED : ApprovalSealDeliverableFileStanding.NOT_GIVEN };\n }\n if (approver?.standing !== ApprovalSealDisclosureStanding.DISCLOSED || !approver.value) return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED };\n const approverName = typeof approver.value.name === 'string' ? approver.value.name : undefined;\n const printed = approverName !== undefined ? { approverName } : {};\n const statedHash = given.contentSha256 === undefined || createHash('sha256').update(given.bytes).digest('hex') === given.contentSha256;\n const check = checkApprovalSealManifestedCopy(given.bytes, { jws: input.jws, ...printed });\n if (!check.matches || !statedHash) {\n failures.push(ApprovalSealVerificationFailure.MANIFESTED_COPY_MISMATCH);\n return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n }\n const deliverable = input.deliverableFile;\n const bound = deliverable && presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED\n ? humanDecisionBoundDeliverableOf(presentation.value, deliverable.fileId)\n : undefined;\n const stated = { locale: check.statement.locale, ...(check.statement.verificationUrl ? { verificationUrl: check.statement.verificationUrl } : {}) };\n if (!deliverable || !bound) return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED, ...printed, ...stated };\n if (approvalSealFileCommitmentOf(deliverable.salt, createHash('sha256').update(check.original).digest('hex')) !== bound.commitment) {\n failures.push(ApprovalSealVerificationFailure.MANIFESTED_COPY_MISMATCH);\n return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n }\n return { ...named, standing: ApprovalSealDeliverableFileStanding.MATCHES, ...printed, ...stated };\n}\n\n/**\n * What corroborates a seal under a compromised key, if anything: evidence of its payload recorded before the compromise,\n * or a kept export signed before the compromise that lists this exact seal (its issuer, its key, its signed claims).\n */\nfunction corroborationOf(\n input: ApprovalSealVerificationInput,\n key: ApprovalSealVerificationKey,\n payload: Readonly<Record<string, unknown>>,\n decisionPayloadDigest: string,\n): ApprovalSealCorroborationSource | undefined {\n if (key.compromiseInstant === undefined) return undefined;\n const compromisedFrom = Date.parse(key.compromiseInstant);\n if (input.corroboration && input.corroboration.decisionPayloadDigest === decisionPayloadDigest && Date.parse(input.corroboration.recordedAt) < compromisedFrom) {\n return ApprovalSealCorroborationSource.RECORDED_EVIDENCE;\n }\n const logged = input.signingLogExports;\n if (!logged) return undefined;\n const claimsDigest = sealClaimsDigestOf(payload);\n const evidence = logged.exports.flatMap((jws) => {\n const exported = verifySigningLogExport({ jws, keys: logged.keys, ...(logged.pins ? { pins: logged.pins } : {}), expectedIssuer: key.iss });\n return exported.provable && exported.claims ? [exported.claims] : [];\n });\n // The exports must agree with each other first (#2932 review M3): an export is dated by the instant it states for\n // itself, so a host holding the export key could sign one dated before the compromise; it disagrees with the operator's\n // kept exports (a different hash at some sequence, or a head behind an earlier one), and then none of them corroborates.\n if (!compareSigningLogExports(evidence).consistent) return undefined;\n for (const claims of evidence) {\n if (claims.iat * 1000 >= compromisedFrom) continue;\n const lists = claims.entries.some((entry) =>\n entry.purpose === CryptoKey_Purpose.APPROVAL_SEAL && entry.kid === key.kid && entry.iss === key.iss && entry.claimsDigest === claimsDigest);\n if (lists) return ApprovalSealCorroborationSource.SIGNING_LOG_EXPORT;\n }\n return undefined;\n}\n\n/** See the file's header. Pure and offline. */\nexport function verifyApprovalSeal(input: ApprovalSealVerificationInput): ApprovalSealVerification {\n const failures: ApprovalSealVerificationFailure[] = [];\n const fail = (failure: ApprovalSealVerificationFailure, extra: Partial<ApprovalSealVerification> = {}): ApprovalSealVerification =>\n ({ valid: false, provable: false, failures: [...failures, failure], ...extra });\n\n const parts = input.jws.split('.');\n const header = parts.length === 3 ? decodeJson(parts[0]) : null;\n const payload = parts.length === 3 ? decodeJson(parts[1]) : null;\n if (!header || !payload || !parts[2]) return fail(ApprovalSealVerificationFailure.MALFORMED);\n\n const kid = typeof header.kid === 'string' ? header.kid : undefined;\n // The key is chosen by `kid` among the keys the verifier was GIVEN; `jku`/`x5u`/`jwk`/`x5c` are never read.\n const record = kid ? input.keys.find((candidate) => candidate.kid === kid) : undefined;\n if (!record || !isP256PublicJwk(record.publicJwk)) return fail(ApprovalSealVerificationFailure.UNKNOWN_KEY, kid ? { kid } : {});\n // The operator's pin, when given: the key handed over must be the one the pinned thumbprint names, and the pin (not\n // the record) says what became of it.\n const key = pinnedVerificationKeyOf(record, input.pins);\n if (!key) return fail(ApprovalSealVerificationFailure.UNPINNED, { kid });\n if (header.alg !== key.alg || key.alg !== ES256_JWS_ALGORITHM) return fail(ApprovalSealVerificationFailure.ALGORITHM_NOT_PINNED, { kid });\n if (header.crit !== undefined) return fail(ApprovalSealVerificationFailure.CRITICAL_EXTENSION, { kid });\n if (header.typ !== APPROVAL_SEAL_TYP) return fail(ApprovalSealVerificationFailure.TYPE_MISMATCH, { kid });\n if (!verifyEs256(`${parts[0]}.${parts[1]}`, Buffer.from(parts[2], 'base64url'), key.publicJwk)) {\n return fail(ApprovalSealVerificationFailure.SIGNATURE_INVALID, { kid, keyState: key.state });\n }\n\n const iss = typeof payload.iss === 'string' ? payload.iss : undefined;\n const iat = typeof payload.iat === 'number' ? payload.iat : undefined;\n const lateSeal = payload.lateSeal === true;\n if (!iss || iss !== key.iss || (input.expectedIssuer !== undefined && iss !== input.expectedIssuer)) failures.push(ApprovalSealVerificationFailure.ISSUER_MISMATCH);\n\n const committed = Object.fromEntries(Object.entries(payload).filter(([name]) => !(CUSTODIAN_SET_CLAIMS as readonly string[]).includes(name)));\n const parsed = ApprovalSealClaimsV1Schema.safeParse(committed);\n if (!parsed.success) return fail(ApprovalSealVerificationFailure.CLAIMS_INVALID, { kid, keyState: key.state, ...(iss ? { iss } : {}) });\n const claims = parsed.data;\n\n // The key's scope from its RECORD: an organization key covers only that organization's decisions.\n const scopeCovers = key.scope === CryptoKey_Scope.APPLICATION || (key.scope === CryptoKey_Scope.ORGANIZATION && claims.tenant === key.scopeId);\n if (!scopeCovers) failures.push(ApprovalSealVerificationFailure.TENANT_OUTSIDE_KEY_SCOPE);\n\n const disclosures = input.disclosures ?? [];\n const erased = input.erasedClaims ?? [];\n const approver = disclosureStanding(ApprovalSealDisclosureClaim.APPROVER, claims.approver, disclosures, erased, failures);\n const requester = disclosureStanding(ApprovalSealDisclosureClaim.REQUESTER, claims.requester?.disclosure, disclosures, erased, failures);\n const presentation = disclosureStanding(ApprovalSealDisclosureClaim.PRESENTATION, claims.presentation?.digest, disclosures, erased, failures);\n const statement = disclosureStanding(ApprovalSealDisclosureClaim.STATEMENT, claims.statementDigest, disclosures, erased, failures);\n const deliverableFile = deliverableFileStandingOf(input.deliverableFile, presentation, failures);\n const manifestedCopy = manifestedCopyStandingOf(input, approver, presentation, failures);\n // #2914: never a failure; the presentation counts only when it opened its commitment.\n const subjectRecordCurrency = input.subjectRecord !== undefined\n ? approvalSealSubjectCurrencyOf(presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED ? presentation.value : undefined, input.subjectRecord)\n : undefined;\n\n const decisionPayloadDigest = decisionPayloadDigestOf(committed);\n const valid = failures.length === 0;\n const compromised = key.state === CryptoKey_VersionState.COMPROMISED;\n const corroboratedBy = compromised ? corroborationOf(input, key, payload, decisionPayloadDigest) : undefined;\n const corroborated = !compromised || corroboratedBy !== undefined;\n return {\n valid,\n failures,\n provable: valid && corroborated,\n ...(corroboratedBy ? { corroboratedBy } : {}),\n kid,\n keyState: key.state,\n claims,\n iss,\n ...(iat !== undefined ? { iat, signingWindowSeconds: Math.max(0, iat - claims.decidedAt) } : {}),\n lateSeal,\n decisionPayloadDigest,\n ...(approver ? { approver } : {}),\n ...(requester ? { requester } : {}),\n ...(presentation ? { presentation } : {}),\n ...(statement ? { statement } : {}),\n ...(deliverableFile ? { deliverableFile } : {}),\n ...(manifestedCopy ? { manifestedCopy } : {}),\n ...(subjectRecordCurrency ? { subjectRecordCurrency } : {}),\n };\n}\n\n/** A verification key as an export or a CLI file states it (dates as ISO strings): the one shape of a key record. */\nexport const ApprovalSealVerificationKeySchema = VerificationKeyRecordSchema;\n\n/**\n * Evidence recorded outside the application that a decision's payload existed before a key's compromise, as the file an\n * operator keeps it in (`wildo seal verify --corroboration <file>`).\n */\nexport const ApprovalSealCorroborationSchema = z.object({ decisionPayloadDigest: z.string().min(1), recordedAt: z.string().min(1) });\n\n/**\n * What `wildo seal verify` reads: one seal and everything it needs to verify, offline. A bundle is what the HOST exports,\n * so it carries no pin set, no signing-log exports and no corroboration: each is evidence against the host, and reaches\n * the verifier only from the operator's own files (`ApprovalSealVerificationInput.pins` / `signingLogExports` /\n * `corroboration`). The schema is not strict, so a bundle naming any of them has it stripped on parse rather than\n * believed (#2932 review H1, R1).\n */\nexport const ApprovalSealVerificationBundleSchema = z.object({\n jws: z.string().min(1),\n keys: z.array(ApprovalSealVerificationKeySchema).min(1),\n expectedIssuer: z.string().min(1).optional(),\n disclosures: z.array(z.object({ claimName: z.enum(ApprovalSealDisclosureClaim), salt: z.string().min(1), value: z.record(z.string(), z.unknown()) })).optional(),\n /** The committed claims an erasure removed from the host's row (#2924): see `ApprovalSealVerificationInput.erasedClaims`. */\n erasedClaims: z.array(z.enum(ApprovalSealDisclosureClaim)).optional(),\n /**\n * The file deliverable the seal attests (#2904): its id and the salt its row kept. Never the bytes, which the verifier\n * is given from the file itself (`--deliverable`), and never the clear hash.\n */\n deliverableFile: z.object({ fileId: z.string().min(1), salt: z.string().min(1) }).optional(),\n /**\n * The deliverable's manifested copy (#2907): its file id, or `contentErased` when the approver's erasure deleted it.\n * Never its bytes, which the verifier is given from the file itself (`--manifested-copy`).\n */\n manifestedCopy: z.object({ fileId: z.string().min(1).optional(), contentSha256: z.string().regex(/^[0-9a-f]{64}$/).optional(), contentErased: z.literal(true).optional() })\n .refine((copy) => (copy.fileId === undefined) !== (copy.contentErased === undefined), { message: 'A manifested copy is named by its file id, or stated erased: exactly one of the two' })\n .optional(),\n});\nexport type ApprovalSealVerificationBundle = z.infer<typeof ApprovalSealVerificationBundleSchema>;\n"]}
@@ -401,6 +401,19 @@ declare const WILDO_INFRA_ENV_CONFIG_SHAPE: {
401
401
  sharedDomain: z.ZodOptional<z.ZodString>;
402
402
  }, z.core.$strict>>;
403
403
  }, z.core.$strict>>;
404
+ /**
405
+ * What THIS environment does with the agents' classifier-backed content guardrails (`contentGuardrails.promptInjection`,
406
+ * `.outputModeration`) where no `AI_CONTENT_SAFETY` classifier offers them. Absent means REFUSE: such an agent refuses
407
+ * every turn. `{ withoutClassifier: RUN_UNGUARDED, reason }` runs it unscreened and unmoderated, named at startup and, outside a
408
+ * local environment, listed by `wildo context launch-blockers`. Projected to `WILDO_AGENT_CONTENT_GUARDRAILS` by
409
+ * `env-vars-builder`. See {@link EnvironmentAgentContentGuardrailsSchema}.
410
+ */
411
+ agentContentGuardrails: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
412
+ withoutClassifier: z.ZodLiteral<import("@wildo-ai/saas-models").AgentContentGuardrailsWithoutClassifier.REFUSE>;
413
+ }, z.core.$strict>, z.ZodObject<{
414
+ withoutClassifier: z.ZodLiteral<import("@wildo-ai/saas-models").AgentContentGuardrailsWithoutClassifier.RUN_UNGUARDED>;
415
+ reason: z.ZodString;
416
+ }, z.core.$strict>], "withoutClassifier">>;
404
417
  /**
405
418
  * LOCAL-ONLY: the double that answers domain-ownership challenges for names nobody can publish (#2519). See
406
419
  * {@link WildoOwnershipDnsStandInConfigSchema}.
@@ -777,6 +790,12 @@ export declare const WildoInfraEnvConfigSchema: z.ZodPipe<z.ZodObject<{
777
790
  sharedDomain: z.ZodOptional<z.ZodString>;
778
791
  }, z.core.$strict>>;
779
792
  }, z.core.$strict>>;
793
+ agentContentGuardrails: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
794
+ withoutClassifier: z.ZodLiteral<import("@wildo-ai/saas-models").AgentContentGuardrailsWithoutClassifier.REFUSE>;
795
+ }, z.core.$strict>, z.ZodObject<{
796
+ withoutClassifier: z.ZodLiteral<import("@wildo-ai/saas-models").AgentContentGuardrailsWithoutClassifier.RUN_UNGUARDED>;
797
+ reason: z.ZodString;
798
+ }, z.core.$strict>], "withoutClassifier">>;
780
799
  ownershipDnsStandIn: z.ZodOptional<z.ZodObject<{
781
800
  baseUrl: z.ZodURL;
782
801
  }, z.core.$strict>>;
@@ -1012,6 +1031,12 @@ export declare const WildoInfraEnvConfigSchema: z.ZodPipe<z.ZodObject<{
1012
1031
  sharedDomain?: string;
1013
1032
  };
1014
1033
  };
1034
+ agentContentGuardrails: {
1035
+ withoutClassifier: import("@wildo-ai/saas-models").AgentContentGuardrailsWithoutClassifier.REFUSE;
1036
+ } | {
1037
+ withoutClassifier: import("@wildo-ai/saas-models").AgentContentGuardrailsWithoutClassifier.RUN_UNGUARDED;
1038
+ reason: string;
1039
+ };
1015
1040
  ownershipDnsStandIn: {
1016
1041
  baseUrl: string;
1017
1042
  };
@@ -1236,6 +1261,12 @@ export declare const WildoInfraEnvConfigSchema: z.ZodPipe<z.ZodObject<{
1236
1261
  sharedDomain?: string;
1237
1262
  };
1238
1263
  };
1264
+ agentContentGuardrails?: {
1265
+ withoutClassifier: import("@wildo-ai/saas-models").AgentContentGuardrailsWithoutClassifier.REFUSE;
1266
+ } | {
1267
+ withoutClassifier: import("@wildo-ai/saas-models").AgentContentGuardrailsWithoutClassifier.RUN_UNGUARDED;
1268
+ reason: string;
1269
+ };
1239
1270
  ownershipDnsStandIn?: {
1240
1271
  baseUrl: string;
1241
1272
  };
@@ -1558,6 +1589,12 @@ export declare const WildoHostedInfraEnvConfigSchema: z.ZodObject<{
1558
1589
  sharedDomain: z.ZodOptional<z.ZodString>;
1559
1590
  }, z.core.$strict>>;
1560
1591
  }, z.core.$strict>>;
1592
+ agentContentGuardrails: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1593
+ withoutClassifier: z.ZodLiteral<import("@wildo-ai/saas-models").AgentContentGuardrailsWithoutClassifier.REFUSE>;
1594
+ }, z.core.$strict>, z.ZodObject<{
1595
+ withoutClassifier: z.ZodLiteral<import("@wildo-ai/saas-models").AgentContentGuardrailsWithoutClassifier.RUN_UNGUARDED>;
1596
+ reason: z.ZodString;
1597
+ }, z.core.$strict>], "withoutClassifier">>;
1561
1598
  ownershipDnsStandIn: z.ZodOptional<z.ZodObject<{
1562
1599
  baseUrl: z.ZodURL;
1563
1600
  }, z.core.$strict>>;
@@ -1 +1 @@
1
- {"version":3,"file":"define-infra-env-config.d.ts","sourceRoot":"","sources":["../../../src/project-config/define-infra-env-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAsB,oBAAoB,EAAkC,MAAM,mCAAmC,CAAC;AAS7H,OAAO,EACL,cAAc,EAGd,sBAAsB,EAItB,iBAAiB,EACjB,qBAAqB,EAGrB,yBAAyB,EAWzB,qBAAqB,EAEtB,MAAM,8BAA8B,CAAC;AA6DtC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,2BAA2B;;;;kBAItC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEjF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oCAAoC;;kBAI/C,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAEnG;;;;;;;GAOG;AACH,QAAA,MAAM,4BAA4B;;;;;IAShC;;;;;;;;;;;OAWG;;IAEH;;;;;;;;;;;;;;;;;OAiBG;;IAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;;;;;;IAcH,6IAA6I;IAC7I;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;;;;IAMH;;;;;;;;;;;;;;;;;;OAkBG;IACH,kEAAkE;IAClE;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;;IAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;;;;;;;;;;;;;;;;;;;;;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ironment } from '@wildo-ai/saas-models';
2
2
  import { z } from 'zod';
3
3
  import { WildoAuthConfigSchema } from './shared/auth.schemas.js';
4
4
  import { ApplicationCreationVerificationConfigSchema } from './shared/application-creation-verification.schemas.js';
@@ -381,6 +381,14 @@ const WILDO_INFRA_ENV_CONFIG_SHAPE = {
381
381
  * per deployment. See {@link WildoInfraEmailConfigSchema}.
382
382
  */
383
383
  email: WildoInfraEmailConfigSchema.optional(),
384
+ /**
385
+ * What THIS environment does with the agents' classifier-backed content guardrails (`contentGuardrails.promptInjection`,
386
+ * `.outputModeration`) where no `AI_CONTENT_SAFETY` classifier offers them. Absent means REFUSE: such an agent refuses
387
+ * every turn. `{ withoutClassifier: RUN_UNGUARDED, reason }` runs it unscreened and unmoderated, named at startup and, outside a
388
+ * local environment, listed by `wildo context launch-blockers`. Projected to `WILDO_AGENT_CONTENT_GUARDRAILS` by
389
+ * `env-vars-builder`. See {@link EnvironmentAgentContentGuardrailsSchema}.
390
+ */
391
+ agentContentGuardrails: EnvironmentAgentContentGuardrailsSchema.optional(),
384
392
  /**
385
393
  * LOCAL-ONLY: the double that answers domain-ownership challenges for names nobody can publish (#2519). See
386
394
  * {@link WildoOwnershipDnsStandInConfigSchema}.
@@ -844,6 +852,7 @@ export const WildoInfraEnvConfigSchema = WildoInfraEnvConfigInputSchema.transfor
844
852
  providerSelection: config.providerSelection,
845
853
  providerConfigurations: config.providerConfigurations,
846
854
  email: config.email,
855
+ agentContentGuardrails: config.agentContentGuardrails,
847
856
  ownershipDnsStandIn: config.ownershipDnsStandIn,
848
857
  applicationCreationVerification: config.applicationCreationVerification,
849
858
  serviceAuth: config.serviceAuth,
@@ -945,6 +954,11 @@ export const INFRA_ENV_FIELD_OWNERSHIP = {
945
954
  * another tenant's organizations.
946
955
  */
947
956
  email: InfraEnvFieldOwner.APPLICATION,
957
+ /*
958
+ * APPLICATION. Whether THIS application's agents run unguarded where no classifier offers a guardrail is a decision about its
959
+ * own agents; an application hosted on another's platform does not inherit its host's.
960
+ */
961
+ agentContentGuardrails: InfraEnvFieldOwner.APPLICATION,
948
962
  /*
949
963
  * APPLICATION. The stand-in answers for the domains THIS application's tenants prove they own on a developer machine —
950
964
  * the double standing in for their corporate IT. A hosted application inheriting its host's would verify its tenants'
@@ -1091,6 +1105,7 @@ export const WildoHostedInfraEnvConfigSchema = z.strictObject({
1091
1105
  providerSelection: WILDO_INFRA_ENV_CONFIG_SHAPE.providerSelection,
1092
1106
  providerConfigurations: WILDO_INFRA_ENV_CONFIG_SHAPE.providerConfigurations,
1093
1107
  email: WILDO_INFRA_ENV_CONFIG_SHAPE.email,
1108
+ agentContentGuardrails: WILDO_INFRA_ENV_CONFIG_SHAPE.agentContentGuardrails,
1094
1109
  ownershipDnsStandIn: WILDO_INFRA_ENV_CONFIG_SHAPE.ownershipDnsStandIn,
1095
1110
  systemsOfRecord: WILDO_INFRA_ENV_CONFIG_SHAPE.systemsOfRecord,
1096
1111
  documentationSite: WILDO_INFRA_ENV_CONFIG_SHAPE.documentationSite,