From 0abc5be370247d1a411ec829c8f7002a1c3b151a Mon Sep 17 00:00:00 2001 From: Andrew Peris Date: Fri, 11 Sep 2026 11:03:04 -0400 Subject: [PATCH] Adopt immutable v1 contracts and prepare SDK 1.0.0 --- CHANGELOG.md | 11 ++ CONSTITUTION_CONFORMANCE.md | 15 ++ docs/prompt-sdk-v1.md | 10 +- package-lock.json | 4 +- package.json | 2 +- release/README.md | 19 ++- release/contract-lock.json | 154 ++++++++++++++++++ scripts/check-sdk-release.mjs | 60 +++---- scripts/generate-context-schema-validator.mjs | 2 +- .../generate-execution-schema-validator.mjs | 2 +- scripts/generate-prompt-schema-validator.mjs | 2 +- .../generate-provenance-schema-validator.mjs | 2 +- ...ate-structured-output-schema-validator.mjs | 2 +- src/prompt-sdk/diagnostics.js | 41 +---- .../generated/context-package-v1-schema.js | 2 +- .../generated/prompt-definition-v1-schema.js | 2 +- .../generated/provenance-v1-schema.js | 2 +- .../generated/provider-execution-v1-schema.js | 2 +- .../generated/structured-output-v1-schema.js | 2 +- src/prompt-sdk/release-contracts.js | 68 ++++++++ src/prompt-sdk/render.js | 6 +- src/prompt-sdk/structured-output.js | 2 +- src/prompt-sdk/validate.js | 4 +- tests/fixtures/golden/structured.json | 26 +-- tests/fixtures/golden/text.json | 18 +- tests/prompt-sdk/release-readiness.test.js | 40 ++++- tests/prompt-sdk/validate.test.js | 8 +- 27 files changed, 384 insertions(+), 124 deletions(-) create mode 100644 release/contract-lock.json create mode 100644 src/prompt-sdk/release-contracts.js diff --git a/CHANGELOG.md b/CHANGELOG.md index a6bcf04..8337428 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 1.0.0 — stable adoption candidate, artifact publication pending + +- Adopt all five published immutable Codex contracts with complete verified + schema/bundle manifests and exact source commit. +- Regenerate every validator from published assets; expose released runtime + references and permit stable prompt lifecycle. +- Align package, renderer and structured processor versions at 1.0.0. + Render/processing identities change because they include runtime provenance; + prompt messages, outputs, policy and algorithms are unchanged. +- Strengthen readiness checks and negative tests for all five dependency pins. + ## Unreleased — Prompt SDK v1 release preparation - Final API inventory, quick start, adapter guide, compatibility/deprecation diff --git a/CONSTITUTION_CONFORMANCE.md b/CONSTITUTION_CONFORMANCE.md index 368435f..f418224 100644 --- a/CONSTITUTION_CONFORMANCE.md +++ b/CONSTITUTION_CONFORMANCE.md @@ -1,5 +1,20 @@ # Constitution conformance record +## Issue #72 stable adoption — 2026-09-11 + +Owner: @andrewperis; Constitution v1.0.0 at +`a9cc8a503aa30e17820edc62ac95f7cbe10e0564`. +Five Codex contracts are now published with immutable releases at approved +commit `62e78b606986988518b9dc502c25ae1cd189684a`. GitHub immutability and tag +targets were checked; all 15 published assets match verified build bytes. +The dependency lock records release URLs, timestamps, complete asset tuples. +This candidate adopts those releases, regenerates validators, enables stable +prompt lifecycle and aligns SDK/runtime versions. Golden updates reflect only +version/contract metadata and resulting canonical identities. +Owner merge, CI and final Platform artifact publication remain outstanding; +dependency readiness does not itself approve the implementation release. +No new dependencies, visibility changes, provider calls or exceptions. + ## Issue #72 release preparation — 2026-09-11 Owner: @andrewperis. Constitution v1.0.0 at diff --git a/docs/prompt-sdk-v1.md b/docs/prompt-sdk-v1.md index 05727d8..82f719a 100644 --- a/docs/prompt-sdk-v1.md +++ b/docs/prompt-sdk-v1.md @@ -1,9 +1,11 @@ # Prompt SDK v1 release guide -This is the v1 release candidate documentation, not a claim of publication. -Package/runtime version stays 0.1.0 and contract pins remain visibly provisional -until Codex immutable artifacts and owner release approval are verified. -Studio #72 and Epic #4 must remain open until the actual releases exist. +The five Codex v1.0.0 contracts are published immutably at commit +`62e78b606986988518b9dc502c25ae1cd189684a`; their verified manifests are in +[contract-lock.json](../release/contract-lock.json). This adoption candidate +updates package/renderer/processor to 1.0.0 and permits stable prompt lifecycle. +The Platform artifact itself remains pending owner merge and publication: +Studio #72 and Epic #4 stay open until that final release is verified. ## Quick start diff --git a/package-lock.json b/package-lock.json index b6a7a0a..e117049 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@definitely-secure-studio/platform", - "version": "0.1.0", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@definitely-secure-studio/platform", - "version": "0.1.0", + "version": "1.0.0", "dependencies": { "ajv": "8.20.0", "ajv-formats": "3.0.1" diff --git a/package.json b/package.json index 4067cbd..cee34c3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@definitely-secure-studio/platform", - "version": "0.1.0", + "version": "1.0.0", "private": true, "type": "module", "exports": { diff --git a/release/README.md b/release/README.md index abe2f17..11aa80c 100644 --- a/release/README.md +++ b/release/README.md @@ -4,10 +4,10 @@ compatibility review; the test suite detects accidental export additions/removals. Run `node scripts/check-sdk-release.mjs` for a machine-readable readiness -report (exit 1 while blocked). Its current expected result is not ready. +report (exit 1 while blocked). The adopted references now pass this offline check. It never creates tags, uploads files, changes version/status or grants approval. -The later owner-reviewed adoption change adds `contract-lock.json`: +This owner-reviewed adoption candidate adds `contract-lock.json`: `{ "contracts": [ ...five downloaded Codex manifests... ] }`. Each manifest retains the builder's repository, contract, version, tag, commit, schema_id and assets with URI, media type, byte size and SHA-256. Add @@ -16,7 +16,14 @@ only after independently verifying GitHub immutable status, exact tag target, and downloaded asset bytes. Retain links to that evidence in the release review. This is an offline consistency check of reviewed evidence, not online proof. -The owner must verify evidence before adopting it. The script checks the four -public runtime metadata pins; the fifth provenance generator pin and every -compiled validator must additionally be checked against downloaded schema bytes -as specified in the [release guide](../docs/prompt-sdk-v1.md). +The owner must verify evidence before adopting it. The script checks all five +runtime metadata pins. Tests also check compiled validator commit/digest headers; +all five validators were regenerated from the downloaded published schema assets. +All tags resolve to `62e78b606986988518b9dc502c25ae1cd189684a`, GitHub reported +`immutable: true`, and all 15 downloaded published assets matched local build +bytes. The lock includes per-release URLs and verification times. + +Platform publication is still separate from dependency readiness. After owner +merge and successful CI, build/inspect the package/source artifacts, record +sizes/digests and the exact Platform commit, and publish the reviewed immutable +`prompt-sdk/v1.0.0` release. See the [release guide](../docs/prompt-sdk-v1.md). diff --git a/release/contract-lock.json b/release/contract-lock.json new file mode 100644 index 0000000..072870e --- /dev/null +++ b/release/contract-lock.json @@ -0,0 +1,154 @@ +{ + "contracts": [ + { + "repository": "DefinitelySecureStudio/codex", + "contract": "context-package", + "version": "1.0.0", + "tag": "contract/context-package/v1.0.0", + "commit": "62e78b606986988518b9dc502c25ae1cd189684a", + "constitution_commit": "a9cc8a503aa30e17820edc62ac95f7cbe10e0564", + "schema_id": "urn:definitely-secure:contract:context-package:1.0.0:context-package", + "assets": [ + { + "filename": "context-package-v1.0.0.schema.json", + "artifact_uri": "https://github.com/DefinitelySecureStudio/codex/releases/download/contract%2Fcontext-package%2Fv1.0.0/context-package-v1.0.0.schema.json", + "media_type": "application/schema+json", + "byte_size": 8390, + "sha256": "sha256:d81e88780511c31099b2dd925f31aff26d6ba75e1173e953b98a37298764b617" + }, + { + "filename": "context-package-v1.0.0.bundle.json", + "artifact_uri": "https://github.com/DefinitelySecureStudio/codex/releases/download/contract%2Fcontext-package%2Fv1.0.0/context-package-v1.0.0.bundle.json", + "media_type": "application/json", + "byte_size": 459899, + "sha256": "sha256:cb56c6c048e9af95e59c7053c9ce5cef2fecd74e864d828c3cc2482bd5f00c93" + } + ], + "publication": { + "immutable": true, + "verified_at": "2026-09-11T14:56:35.243Z", + "release_url": "https://github.com/DefinitelySecureStudio/codex/releases/tag/contract/context-package/v1.0.0" + } + }, + { + "repository": "DefinitelySecureStudio/codex", + "contract": "execution-provenance", + "version": "1.0.0", + "tag": "contract/execution-provenance/v1.0.0", + "commit": "62e78b606986988518b9dc502c25ae1cd189684a", + "constitution_commit": "a9cc8a503aa30e17820edc62ac95f7cbe10e0564", + "schema_id": "urn:definitely-secure:contract:execution-provenance:1.0.0:record", + "assets": [ + { + "filename": "execution-provenance-v1.0.0.schema.json", + "artifact_uri": "https://github.com/DefinitelySecureStudio/codex/releases/download/contract%2Fexecution-provenance%2Fv1.0.0/execution-provenance-v1.0.0.schema.json", + "media_type": "application/schema+json", + "byte_size": 13143, + "sha256": "sha256:d1f897fdd40c8a513f2f3dc9c44728ec124e53a57977a1b11b04e00953020118" + }, + { + "filename": "execution-provenance-v1.0.0.bundle.json", + "artifact_uri": "https://github.com/DefinitelySecureStudio/codex/releases/download/contract%2Fexecution-provenance%2Fv1.0.0/execution-provenance-v1.0.0.bundle.json", + "media_type": "application/json", + "byte_size": 459904, + "sha256": "sha256:2bef0c6c87844ec94835b2b3ae2b8d4a16a531c54953b86e306a6307fab5abf2" + } + ], + "publication": { + "immutable": true, + "verified_at": "2026-09-11T14:56:35.252Z", + "release_url": "https://github.com/DefinitelySecureStudio/codex/releases/tag/contract/execution-provenance/v1.0.0" + } + }, + { + "repository": "DefinitelySecureStudio/codex", + "contract": "prompt-definition", + "version": "1.0.0", + "tag": "contract/prompt-definition/v1.0.0", + "commit": "62e78b606986988518b9dc502c25ae1cd189684a", + "constitution_commit": "a9cc8a503aa30e17820edc62ac95f7cbe10e0564", + "schema_id": "urn:definitely-secure:contract:prompt-definition:1.0.0:prompt-definition", + "assets": [ + { + "filename": "prompt-definition-v1.0.0.schema.json", + "artifact_uri": "https://github.com/DefinitelySecureStudio/codex/releases/download/contract%2Fprompt-definition%2Fv1.0.0/prompt-definition-v1.0.0.schema.json", + "media_type": "application/schema+json", + "byte_size": 18384, + "sha256": "sha256:6ac345956582d25c2db9c81b85cab9c73b2cbcfc79b8aac7a43d847c07173cb9" + }, + { + "filename": "prompt-definition-v1.0.0.bundle.json", + "artifact_uri": "https://github.com/DefinitelySecureStudio/codex/releases/download/contract%2Fprompt-definition%2Fv1.0.0/prompt-definition-v1.0.0.bundle.json", + "media_type": "application/json", + "byte_size": 459901, + "sha256": "sha256:cd6577df588d50a8575910c398ce619dd84a6425ae199b480d94e68466b52800" + } + ], + "publication": { + "immutable": true, + "verified_at": "2026-09-11T14:56:35.253Z", + "release_url": "https://github.com/DefinitelySecureStudio/codex/releases/tag/contract/prompt-definition/v1.0.0" + } + }, + { + "repository": "DefinitelySecureStudio/codex", + "contract": "provider-execution", + "version": "1.0.0", + "tag": "contract/provider-execution/v1.0.0", + "commit": "62e78b606986988518b9dc502c25ae1cd189684a", + "constitution_commit": "a9cc8a503aa30e17820edc62ac95f7cbe10e0564", + "schema_id": "urn:definitely-secure:contract:provider-execution:1.0.0:provider-execution", + "assets": [ + { + "filename": "provider-execution-v1.0.0.schema.json", + "artifact_uri": "https://github.com/DefinitelySecureStudio/codex/releases/download/contract%2Fprovider-execution%2Fv1.0.0/provider-execution-v1.0.0.schema.json", + "media_type": "application/schema+json", + "byte_size": 25285, + "sha256": "sha256:4366665b89d7633974c4be15cac74f754e722b41031f708ca2f825ead892cb8b" + }, + { + "filename": "provider-execution-v1.0.0.bundle.json", + "artifact_uri": "https://github.com/DefinitelySecureStudio/codex/releases/download/contract%2Fprovider-execution%2Fv1.0.0/provider-execution-v1.0.0.bundle.json", + "media_type": "application/json", + "byte_size": 459902, + "sha256": "sha256:765902129220eec8440be3f7e9b3f6dc6c9ad162642200637bd3fcaae48ac9c9" + } + ], + "publication": { + "immutable": true, + "verified_at": "2026-09-11T14:56:35.254Z", + "release_url": "https://github.com/DefinitelySecureStudio/codex/releases/tag/contract/provider-execution/v1.0.0" + } + }, + { + "repository": "DefinitelySecureStudio/codex", + "contract": "structured-output", + "version": "1.0.0", + "tag": "contract/structured-output/v1.0.0", + "commit": "62e78b606986988518b9dc502c25ae1cd189684a", + "constitution_commit": "a9cc8a503aa30e17820edc62ac95f7cbe10e0564", + "schema_id": "urn:definitely-secure:contract:structured-output:1.0.0:processing", + "assets": [ + { + "filename": "structured-output-v1.0.0.schema.json", + "artifact_uri": "https://github.com/DefinitelySecureStudio/codex/releases/download/contract%2Fstructured-output%2Fv1.0.0/structured-output-v1.0.0.schema.json", + "media_type": "application/schema+json", + "byte_size": 8427, + "sha256": "sha256:6ea2c5d4804b92bbca386d2b64063d72980ca1d294d23338be6adc057caaeeb2" + }, + { + "filename": "structured-output-v1.0.0.bundle.json", + "artifact_uri": "https://github.com/DefinitelySecureStudio/codex/releases/download/contract%2Fstructured-output%2Fv1.0.0/structured-output-v1.0.0.bundle.json", + "media_type": "application/json", + "byte_size": 459901, + "sha256": "sha256:e0d91fc5c5b01d33bd665165306c1d0de6cc9cc9598e94831e9748cc450e562c" + } + ], + "publication": { + "immutable": true, + "verified_at": "2026-09-11T14:56:35.255Z", + "release_url": "https://github.com/DefinitelySecureStudio/codex/releases/tag/contract/structured-output/v1.0.0" + } + } + ] +} diff --git a/scripts/check-sdk-release.mjs b/scripts/check-sdk-release.mjs index 1553cc6..3f1de62 100644 --- a/scripts/check-sdk-release.mjs +++ b/scripts/check-sdk-release.mjs @@ -1,39 +1,41 @@ import { readFile } from 'node:fs/promises'; import { pathToFileURL } from 'node:url'; -import { CONTRACT, EXECUTION_CONTRACT, CONTEXT_PACKAGE_CONTRACT, STRUCTURED_OUTPUT_CONTRACT } from '../src/prompt-sdk/index.js'; -export async function releaseReadiness() { - const pkg = JSON.parse(await readFile(new URL('../package.json', import.meta.url))); +import { RELEASE_CONTRACTS } from '../src/prompt-sdk/release-contracts.js'; +const names = ['prompt-definition', 'provider-execution', 'context-package', 'structured-output', 'execution-provenance']; +export function checkReleaseInputs({ pkg, lock, pins = RELEASE_CONTRACTS }) { const blockers = []; - if (pkg.version !== '1.0.0') blockers.push('SDK package is not version 1.0.0.'); - for (const [name, pin] of Object.entries({ 'prompt-definition': CONTRACT, 'provider-execution': EXECUTION_CONTRACT, 'context-package': CONTEXT_PACKAGE_CONTRACT, 'structured-output': STRUCTURED_OUTPUT_CONTRACT })) { - if (pin.status !== 'released') blockers.push(name + ' remains provisional.'); - } - let lock; - try { lock = JSON.parse(await readFile(new URL('../release/contract-lock.json', import.meta.url))); } - catch { blockers.push('A reviewed immutable contract lock is missing or unreadable.'); } - const names = ['prompt-definition', 'provider-execution', 'context-package', 'structured-output', 'execution-provenance']; - if (lock) { - if (!Array.isArray(lock.contracts) || lock.contracts.length !== names.length) blockers.push('Contract lock must contain exactly five contracts.'); - for (const name of names) { - const entries = Array.isArray(lock.contracts) ? lock.contracts.filter(entry => entry?.contract === name) : []; - const entry = entries[0]; - const schema = Array.isArray(entry?.assets) ? entry.assets.find(asset => asset?.media_type === 'application/schema+json') : undefined; - if (entries.length !== 1 || entry.repository !== 'DefinitelySecureStudio/codex' || entry.version !== '1.0.0' || - entry.tag !== 'contract/' + name + '/v1.0.0' || !/^[0-9a-f]{40}$/.test(entry.commit ?? '') || - entry.publication?.immutable !== true || !Number.isFinite(Date.parse(entry.publication?.verified_at)) || - !schema || !Number.isSafeInteger(schema.byte_size) || schema.byte_size < 1 || - !/^sha256:[0-9a-f]{64}$/.test(schema.sha256 ?? '') || - !schema.artifact_uri?.startsWith('https://github.com/DefinitelySecureStudio/codex/releases/download/' + encodeURIComponent(entry.tag) + '/')) { - blockers.push(name + ' lacks a complete verified immutable reference.'); - } - const pin = { 'prompt-definition': CONTRACT, 'provider-execution': EXECUTION_CONTRACT, 'context-package': CONTEXT_PACKAGE_CONTRACT, 'structured-output': STRUCTURED_OUTPUT_CONTRACT }[name]; - if (pin && (pin.commit !== entry?.commit || pin.schema_sha256 !== schema?.sha256 || pin.schema_byte_size !== schema?.byte_size)) blockers.push(name + ' runtime pin differs from the dependency lock.'); + if (pkg?.version !== '1.0.0') blockers.push('SDK package is not version 1.0.0.'); + if (!Array.isArray(lock?.contracts) || lock.contracts.length !== names.length) blockers.push('Immutable contract lock must contain exactly five contracts.'); + for (const name of names) { + const matches = Array.isArray(lock?.contracts) ? lock.contracts.filter(entry => entry?.contract === name) : []; + const entry = matches[0], pin = pins?.[name]; + const assets = Array.isArray(entry?.assets) ? entry.assets.filter(asset => asset?.media_type === 'application/schema+json') : []; + const schema = assets[0]; + const tag = 'contract/' + name + '/v1.0.0'; + const prefix = 'https://github.com/DefinitelySecureStudio/codex/releases/download/' + encodeURIComponent(tag) + '/'; + if (matches.length !== 1 || entry?.repository !== 'DefinitelySecureStudio/codex' || entry?.version !== '1.0.0' || + entry?.tag !== tag || !/^[0-9a-f]{40}$/.test(entry?.commit ?? '') || + entry?.publication?.immutable !== true || typeof entry?.publication?.verified_at !== 'string' || + !Number.isFinite(Date.parse(entry.publication.verified_at)) || + entry.publication.release_url !== 'https://github.com/DefinitelySecureStudio/codex/releases/tag/' + tag || + assets.length !== 1 || !Number.isSafeInteger(schema?.byte_size) || schema.byte_size < 1 || + !/^sha256:[0-9a-f]{64}$/.test(schema?.sha256 ?? '') || + typeof schema?.artifact_uri !== 'string' || schema.artifact_uri !== prefix + name + '-v1.0.0.schema.json') { + blockers.push(name + ' lacks a complete verified immutable reference.'); } + if (pin?.status !== 'released') blockers.push(name + ' remains provisional.'); + if (!pin || pin.commit !== entry?.commit || pin.schema_sha256 !== schema?.sha256 || pin.schema_byte_size !== schema?.byte_size || + pin.artifact_uri !== schema?.artifact_uri || pin.media_type !== schema?.media_type || pin.tag !== tag || pin.version !== '1.0.0' || + pin.repository !== 'DefinitelySecureStudio/codex' || pin.contract !== name) blockers.push(name + ' runtime pin differs from the dependency lock.'); } - // Offline readiness checks the reviewed evidence; it is not a substitute for - // independently verifying GitHub publication and downloaded asset bytes. return { ready: blockers.length === 0, blockers }; } +export async function releaseReadiness() { + const pkg = JSON.parse(await readFile(new URL('../package.json', import.meta.url))); + let lock; + try { lock = JSON.parse(await readFile(new URL('../release/contract-lock.json', import.meta.url))); } catch { /* fail closed */ } + return checkReleaseInputs({ pkg, lock }); +} if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { const report = await releaseReadiness(); console.log(JSON.stringify(report, null, 2)); diff --git a/scripts/generate-context-schema-validator.mjs b/scripts/generate-context-schema-validator.mjs index 0a4951e..9cc46fd 100644 --- a/scripts/generate-context-schema-validator.mjs +++ b/scripts/generate-context-schema-validator.mjs @@ -4,7 +4,7 @@ import Ajv2020 from "ajv/dist/2020.js"; import addFormats from "ajv-formats"; import standaloneCode from "ajv/dist/standalone/index.js"; -const CONTRACT_COMMIT = "cb76a9343312d0245b388381e318aa58463303cb"; +const CONTRACT_COMMIT = "62e78b606986988518b9dc502c25ae1cd189684a"; const SCHEMA_SHA256 = "d81e88780511c31099b2dd925f31aff26d6ba75e1173e953b98a37298764b617"; const sourcePath = process.argv[2]; const outputPath = process.argv[3] ?? new URL("../src/prompt-sdk/generated/context-package-v1-schema.js", import.meta.url); diff --git a/scripts/generate-execution-schema-validator.mjs b/scripts/generate-execution-schema-validator.mjs index 8cd3534..b3a143e 100644 --- a/scripts/generate-execution-schema-validator.mjs +++ b/scripts/generate-execution-schema-validator.mjs @@ -4,7 +4,7 @@ import Ajv2020 from "ajv/dist/2020.js"; import addFormats from "ajv-formats"; import standaloneCode from "ajv/dist/standalone/index.js"; -const CONTRACT_COMMIT = "dfd31a693674dc03dec4784dcdd1345f647cff1e"; +const CONTRACT_COMMIT = "62e78b606986988518b9dc502c25ae1cd189684a"; const SCHEMA_SHA256 = "4366665b89d7633974c4be15cac74f754e722b41031f708ca2f825ead892cb8b"; const sourcePath = process.argv[2]; const outputPath = process.argv[3] ?? new URL("../src/prompt-sdk/generated/provider-execution-v1-schema.js", import.meta.url); diff --git a/scripts/generate-prompt-schema-validator.mjs b/scripts/generate-prompt-schema-validator.mjs index 84fe266..fe8292e 100644 --- a/scripts/generate-prompt-schema-validator.mjs +++ b/scripts/generate-prompt-schema-validator.mjs @@ -4,7 +4,7 @@ import Ajv2020 from "ajv/dist/2020.js"; import addFormats from "ajv-formats"; import standaloneCode from "ajv/dist/standalone/index.js"; -const CONTRACT_COMMIT = "bd31b6249e068d3317306afb857d68024f2929be"; +const CONTRACT_COMMIT = "62e78b606986988518b9dc502c25ae1cd189684a"; const SCHEMA_SHA256 = "6ac345956582d25c2db9c81b85cab9c73b2cbcfc79b8aac7a43d847c07173cb9"; const sourcePath = process.argv[2]; const outputPath = process.argv[3] ?? new URL("../src/prompt-sdk/generated/prompt-definition-v1-schema.js", import.meta.url); diff --git a/scripts/generate-provenance-schema-validator.mjs b/scripts/generate-provenance-schema-validator.mjs index 2c5ba4b..8f5bf70 100644 --- a/scripts/generate-provenance-schema-validator.mjs +++ b/scripts/generate-provenance-schema-validator.mjs @@ -4,7 +4,7 @@ import Ajv from 'ajv/dist/2020.js'; import addFormats from 'ajv-formats'; import standaloneCode from 'ajv/dist/standalone/index.js'; const bytes = await readFile(process.argv[2]); -const commit = '416f0493d5b7932b818387ea23030f6d0f89c395'; +const commit = '62e78b606986988518b9dc502c25ae1cd189684a'; const hash = 'd1f897fdd40c8a513f2f3dc9c44728ec124e53a57977a1b11b04e00953020118'; if (bytes.length !== 13143 || createHash('sha256').update(bytes).digest('hex') !== hash) throw new Error('Provenance schema identity mismatch'); const ajv = new Ajv({ allErrors: true, strict: true, strictRequired: false, code: { source: true, esm: true } }); diff --git a/scripts/generate-structured-output-schema-validator.mjs b/scripts/generate-structured-output-schema-validator.mjs index 77344e1..6db5646 100644 --- a/scripts/generate-structured-output-schema-validator.mjs +++ b/scripts/generate-structured-output-schema-validator.mjs @@ -4,7 +4,7 @@ import Ajv2020 from "ajv/dist/2020.js"; import addFormats from "ajv-formats"; import standaloneCode from "ajv/dist/standalone/index.js"; -const CONTRACT_COMMIT = "275e0cda2e699fbcb1cdd56323a4d58e3f65e507"; +const CONTRACT_COMMIT = "62e78b606986988518b9dc502c25ae1cd189684a"; const SCHEMA_SHA256 = "6ea2c5d4804b92bbca386d2b64063d72980ca1d294d23338be6adc057caaeeb2"; const sourcePath = process.argv[2]; const outputPath = process.argv[3] ?? new URL("../src/prompt-sdk/generated/structured-output-v1-schema.js", import.meta.url); diff --git a/src/prompt-sdk/diagnostics.js b/src/prompt-sdk/diagnostics.js index 2ead0a3..369b5fc 100644 --- a/src/prompt-sdk/diagnostics.js +++ b/src/prompt-sdk/diagnostics.js @@ -1,40 +1,9 @@ -export const CONTRACT = Object.freeze({ - repository: "DefinitelySecureStudio/codex", - commit: "bd31b6249e068d3317306afb857d68024f2929be", - spec_version: "1.0.0", - schema_sha256: "sha256:6ac345956582d25c2db9c81b85cab9c73b2cbcfc79b8aac7a43d847c07173cb9", - schema_byte_size: 18384, - status: "provisional-unreleased" -}); - +import { RELEASE_CONTRACTS } from './release-contracts.js'; +export const CONTRACT = RELEASE_CONTRACTS['prompt-definition']; export const PROMPT_DEFINITION_CONTRACT = CONTRACT; - -export const EXECUTION_CONTRACT = Object.freeze({ - repository: "DefinitelySecureStudio/codex", - commit: "dfd31a693674dc03dec4784dcdd1345f647cff1e", - spec_version: "1.0.0", - schema_sha256: "sha256:4366665b89d7633974c4be15cac74f754e722b41031f708ca2f825ead892cb8b", - schema_byte_size: 25285, - status: "provisional-unreleased" -}); - -export const CONTEXT_PACKAGE_CONTRACT = Object.freeze({ - repository: "DefinitelySecureStudio/codex", - commit: "cb76a9343312d0245b388381e318aa58463303cb", - spec_version: "1.0.0", - schema_sha256: "sha256:d81e88780511c31099b2dd925f31aff26d6ba75e1173e953b98a37298764b617", - schema_byte_size: 8390, - status: "provisional-unreleased" -}); - -export const STRUCTURED_OUTPUT_CONTRACT = Object.freeze({ - repository: "DefinitelySecureStudio/codex", - commit: "275e0cda2e699fbcb1cdd56323a4d58e3f65e507", - spec_version: "1.0.0", - schema_sha256: "sha256:6ea2c5d4804b92bbca386d2b64063d72980ca1d294d23338be6adc057caaeeb2", - schema_byte_size: 8427, - status: "provisional-unreleased" -}); +export const EXECUTION_CONTRACT = RELEASE_CONTRACTS['provider-execution']; +export const CONTEXT_PACKAGE_CONTRACT = RELEASE_CONTRACTS['context-package']; +export const STRUCTURED_OUTPUT_CONTRACT = RELEASE_CONTRACTS['structured-output']; export function pointer(segments) { if (typeof segments === "string") return segments || ""; diff --git a/src/prompt-sdk/generated/context-package-v1-schema.js b/src/prompt-sdk/generated/context-package-v1-schema.js index ce9f403..ab7c155 100644 --- a/src/prompt-sdk/generated/context-package-v1-schema.js +++ b/src/prompt-sdk/generated/context-package-v1-schema.js @@ -1,4 +1,4 @@ -// Generated from DefinitelySecureStudio/codex@cb76a9343312d0245b388381e318aa58463303cb +// Generated from DefinitelySecureStudio/codex@62e78b606986988518b9dc502c25ae1cd189684a // Source SHA-256: d81e88780511c31099b2dd925f31aff26d6ba75e1173e953b98a37298764b617 // Rebuild with scripts/generate-context-schema-validator.mjs; do not edit manually. import { createRequire } from "node:module"; diff --git a/src/prompt-sdk/generated/prompt-definition-v1-schema.js b/src/prompt-sdk/generated/prompt-definition-v1-schema.js index 13fce53..f51b4d5 100644 --- a/src/prompt-sdk/generated/prompt-definition-v1-schema.js +++ b/src/prompt-sdk/generated/prompt-definition-v1-schema.js @@ -1,4 +1,4 @@ -// Generated from DefinitelySecureStudio/codex@bd31b6249e068d3317306afb857d68024f2929be +// Generated from DefinitelySecureStudio/codex@62e78b606986988518b9dc502c25ae1cd189684a // Source SHA-256: 6ac345956582d25c2db9c81b85cab9c73b2cbcfc79b8aac7a43d847c07173cb9 // Rebuild with scripts/generate-prompt-schema-validator.mjs; do not edit manually. import { createRequire } from "node:module"; diff --git a/src/prompt-sdk/generated/provenance-v1-schema.js b/src/prompt-sdk/generated/provenance-v1-schema.js index 76963da..adf252f 100644 --- a/src/prompt-sdk/generated/provenance-v1-schema.js +++ b/src/prompt-sdk/generated/provenance-v1-schema.js @@ -1,4 +1,4 @@ -// Generated from DefinitelySecureStudio/codex@416f0493d5b7932b818387ea23030f6d0f89c395; SHA256 d1f897fdd40c8a513f2f3dc9c44728ec124e53a57977a1b11b04e00953020118 +// Generated from DefinitelySecureStudio/codex@62e78b606986988518b9dc502c25ae1cd189684a; SHA256 d1f897fdd40c8a513f2f3dc9c44728ec124e53a57977a1b11b04e00953020118 import { createRequire } from 'node:module'; const require = createRequire(import.meta.url); "use strict";export const validate = validate20;export default validate20;const schema31 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"urn:definitely-secure:contract:execution-provenance:1.0.0:record","type":"object","additionalProperties":false,"required":["spec_version","kind","record","identity"],"properties":{"spec_version":{"const":"1.0.0"},"kind":{"const":"execution-provenance"},"record":{"type":"object","additionalProperties":false,"required":["execution_id","prompt","contexts","redacted_context_count","target","identity","parameters","parameters_status","stop_sequence_count","timing","status","finish_reason","validation","structured_output","policy"],"properties":{"execution_id":{"type":"string"},"correlation_id":{"type":"string"},"prompt":{"type":"object","additionalProperties":false,"required":["id","version","spec_version"],"properties":{"id":{"type":"string"},"version":{"type":"string"},"spec_version":{"type":"string"}}},"rendered":{"type":"object","additionalProperties":false,"required":["byte_size","sha256"],"properties":{"byte_size":{"type":"integer","minimum":0},"sha256":{"type":"string","pattern":"^sha256:[0-9a-f]{64}$"}}},"contexts":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["slot","classification"],"properties":{"slot":{"type":"string"},"classification":{"const":"public"},"package":{"type":"object","additionalProperties":false,"required":["id","version","instance_id","manifest_sha256"],"properties":{"id":{"type":"string"},"version":{"type":"string"},"instance_id":{"type":"string"},"manifest_sha256":{"type":"string"}}},"sources":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["source_id","version","kind","classification"],"properties":{"source_id":{"type":"string"},"version":{"type":"string"},"kind":{"type":"string"},"classification":{"const":"public"}}}}}}},"redacted_context_count":{"type":"integer","minimum":0},"target":{"type":"object","additionalProperties":false,"required":["adapter_id","provider_id","model_id"],"properties":{"adapter_id":{"type":"string"},"provider_id":{"type":"string"},"model_id":{"type":"string"}}},"identity":{"type":"object","additionalProperties":false,"required":["adapter_id","adapter_version","provider_id","model_id"],"properties":{"adapter_id":{"type":"string"},"adapter_version":{"type":"string"},"provider_id":{"type":"string"},"model_id":{"type":"string"},"model_revision":{"type":"string"}}},"parameters":{"type":"object","additionalProperties":false,"required":[],"properties":{"max_output_tokens":{"type":"integer","minimum":1},"temperature":{"type":"number","minimum":0,"maximum":2},"top_p":{"type":"number","exclusiveMinimum":0,"maximum":1},"seed":{"type":"integer","minimum":0,"maximum":9007199254740991}}},"parameters_status":{"enum":["resolved","not-resolved"]},"stop_sequence_count":{"type":"integer","minimum":0},"timing":{"type":"object","additionalProperties":false,"required":["started_at","completed_at","duration_ms"],"properties":{"started_at":{"type":"string","format":"date-time"},"completed_at":{"type":"string","format":"date-time"},"duration_ms":{"type":"integer","minimum":0}}},"status":{"enum":["succeeded","failed","cancelled","timed-out"]},"finish_reason":{"enum":["stop","length","content-filter","cancelled","error","unknown"]},"usage":{"type":"object","additionalProperties":false,"required":["provider_reported"],"properties":{"provider_reported":{"type":"boolean"},"input_tokens":{"type":"integer","minimum":0},"output_tokens":{"type":"integer","minimum":0},"total_tokens":{"type":"integer","minimum":0}}},"output":{"type":"object","additionalProperties":false,"required":["byte_size","sha256"],"properties":{"byte_size":{"type":"integer","minimum":0},"sha256":{"type":"string","pattern":"^sha256:[0-9a-f]{64}$"}}},"validation":{"type":"object","additionalProperties":false,"required":["status","errors","warnings"],"properties":{"status":{"enum":["not-run","passed","failed"]},"errors":{"type":"integer","minimum":0},"warnings":{"type":"integer","minimum":0}}},"structured_output":{"type":"object","additionalProperties":false,"required":["status"],"properties":{"status":{"enum":["not-run","validated","failed"]},"processing_id":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$"}},"allOf":[{"if":{"properties":{"status":{"const":"not-run"}},"required":["status"]},"then":{"not":{"required":["processing_id"]}},"else":{"required":["processing_id"]}}]},"policy":{"type":"object","additionalProperties":false,"required":["content_identities","bodies"],"properties":{"content_identities":{"enum":["public-only","omit"]},"bodies":{"const":"omitted"}}}},"allOf":[{"if":{"properties":{"policy":{"type":"object","properties":{"content_identities":{"const":"omit"}},"required":["content_identities"]}},"required":["policy"]},"then":{"properties":{"contexts":{"type":"array","maxItems":0},"rendered":false,"output":false}}},{"if":{"properties":{"status":{"const":"succeeded"}},"required":["status"]},"then":{"properties":{"finish_reason":{"enum":["stop","length","content-filter","unknown"]}}}},{"if":{"properties":{"status":{"const":"failed"}},"required":["status"]},"then":{"properties":{"finish_reason":{"enum":["error"]}}}},{"if":{"properties":{"status":{"const":"cancelled"}},"required":["status"]},"then":{"properties":{"finish_reason":{"enum":["cancelled"]}}}},{"if":{"properties":{"status":{"const":"timed-out"}},"required":["status"]},"then":{"properties":{"finish_reason":{"enum":["error"]}}}}]},"identity":{"type":"object","additionalProperties":false,"required":["byte_size","sha256"],"properties":{"byte_size":{"type":"integer","minimum":0},"sha256":{"type":"string","pattern":"^sha256:[0-9a-f]{64}$"}}}}};const func1 = Object.prototype.hasOwnProperty;const pattern4 = new RegExp("^sha256:[0-9a-f]{64}$", "u");const pattern6 = new RegExp("^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$", "u");const formats0 = require("ajv-formats/dist/formats").fullFormats["date-time"];function validate20(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="urn:definitely-secure:contract:execution-provenance:1.0.0:record" */;let vErrors = null;let errors = 0;const evaluated0 = validate20.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.spec_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "spec_version"},message:"must have required property '"+"spec_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.kind === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.record === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "record"},message:"must have required property '"+"record"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.identity === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "identity"},message:"must have required property '"+"identity"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data){if(!((((key0 === "spec_version") || (key0 === "kind")) || (key0 === "record")) || (key0 === "identity"))){const err4 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.spec_version !== undefined){if("1.0.0" !== data.spec_version){const err5 = {instancePath:instancePath+"/spec_version",schemaPath:"#/properties/spec_version/const",keyword:"const",params:{allowedValue: "1.0.0"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.kind !== undefined){if("execution-provenance" !== data.kind){const err6 = {instancePath:instancePath+"/kind",schemaPath:"#/properties/kind/const",keyword:"const",params:{allowedValue: "execution-provenance"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.record !== undefined){let data2 = data.record;const _errs7 = errors;let valid2 = true;const _errs8 = errors;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){let missing0;if((data2.policy === undefined) && (missing0 = "policy")){const err7 = {};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}else {if(data2.policy !== undefined){let data3 = data2.policy;const _errs9 = errors;if(errors === _errs9){if(data3 && typeof data3 == "object" && !Array.isArray(data3)){let missing1;if((data3.content_identities === undefined) && (missing1 = "content_identities")){const err8 = {};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}else {if(data3.content_identities !== undefined){if("omit" !== data3.content_identities){const err9 = {};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}}}else {const err10 = {};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}}}}var _valid0 = _errs8 === errors;errors = _errs7;if(vErrors !== null){if(_errs7){vErrors.length = _errs7;}else {vErrors = null;}}if(_valid0){const _errs12 = errors;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.contexts !== undefined){let data5 = data2.contexts;if(Array.isArray(data5)){if(data5.length > 0){const err11 = {instancePath:instancePath+"/record/contexts",schemaPath:"#/properties/record/allOf/0/then/properties/contexts/maxItems",keyword:"maxItems",params:{limit: 0},message:"must NOT have more than 0 items"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/record/contexts",schemaPath:"#/properties/record/allOf/0/then/properties/contexts/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.rendered !== undefined){const err13 = {instancePath:instancePath+"/record/rendered",schemaPath:"#/properties/record/allOf/0/then/properties/rendered/false schema",keyword:"false schema",params:{},message:"boolean schema is false"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(data2.output !== undefined){const err14 = {instancePath:instancePath+"/record/output",schemaPath:"#/properties/record/allOf/0/then/properties/output/false schema",keyword:"false schema",params:{},message:"boolean schema is false"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}var _valid0 = _errs12 === errors;valid2 = _valid0;if(valid2){var props0 = {};props0.contexts = true;props0.rendered = true;props0.output = true;props0.policy = true;}}if(!valid2){const err15 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/allOf/0/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}const _errs16 = errors;let valid6 = true;const _errs17 = errors;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){let missing2;if((data2.status === undefined) && (missing2 = "status")){const err16 = {};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}else {if(data2.status !== undefined){if("succeeded" !== data2.status){const err17 = {};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}}}var _valid1 = _errs17 === errors;errors = _errs16;if(vErrors !== null){if(_errs16){vErrors.length = _errs16;}else {vErrors = null;}}if(_valid1){const _errs19 = errors;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.finish_reason !== undefined){let data9 = data2.finish_reason;if(!((((data9 === "stop") || (data9 === "length")) || (data9 === "content-filter")) || (data9 === "unknown"))){const err18 = {instancePath:instancePath+"/record/finish_reason",schemaPath:"#/properties/record/allOf/1/then/properties/finish_reason/enum",keyword:"enum",params:{allowedValues: schema31.properties.record.allOf[1].then.properties.finish_reason.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}}var _valid1 = _errs19 === errors;valid6 = _valid1;if(valid6){var props1 = {};props1.finish_reason = true;props1.status = true;}}if(!valid6){const err19 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/allOf/1/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if(props0 !== true && props1 !== undefined){if(props1 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props1);}}const _errs22 = errors;let valid9 = true;const _errs23 = errors;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){let missing3;if((data2.status === undefined) && (missing3 = "status")){const err20 = {};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}else {if(data2.status !== undefined){if("failed" !== data2.status){const err21 = {};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}}}var _valid2 = _errs23 === errors;errors = _errs22;if(vErrors !== null){if(_errs22){vErrors.length = _errs22;}else {vErrors = null;}}if(_valid2){const _errs25 = errors;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.finish_reason !== undefined){if(!(data2.finish_reason === "error")){const err22 = {instancePath:instancePath+"/record/finish_reason",schemaPath:"#/properties/record/allOf/2/then/properties/finish_reason/enum",keyword:"enum",params:{allowedValues: schema31.properties.record.allOf[2].then.properties.finish_reason.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}}var _valid2 = _errs25 === errors;valid9 = _valid2;if(valid9){var props2 = {};props2.finish_reason = true;props2.status = true;}}if(!valid9){const err23 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/allOf/2/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}if(props0 !== true && props2 !== undefined){if(props2 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props2);}}const _errs28 = errors;let valid12 = true;const _errs29 = errors;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){let missing4;if((data2.status === undefined) && (missing4 = "status")){const err24 = {};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}else {if(data2.status !== undefined){if("cancelled" !== data2.status){const err25 = {};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}}}var _valid3 = _errs29 === errors;errors = _errs28;if(vErrors !== null){if(_errs28){vErrors.length = _errs28;}else {vErrors = null;}}if(_valid3){const _errs31 = errors;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.finish_reason !== undefined){if(!(data2.finish_reason === "cancelled")){const err26 = {instancePath:instancePath+"/record/finish_reason",schemaPath:"#/properties/record/allOf/3/then/properties/finish_reason/enum",keyword:"enum",params:{allowedValues: schema31.properties.record.allOf[3].then.properties.finish_reason.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}}var _valid3 = _errs31 === errors;valid12 = _valid3;if(valid12){var props3 = {};props3.finish_reason = true;props3.status = true;}}if(!valid12){const err27 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/allOf/3/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(props0 !== true && props3 !== undefined){if(props3 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props3);}}const _errs34 = errors;let valid15 = true;const _errs35 = errors;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){let missing5;if((data2.status === undefined) && (missing5 = "status")){const err28 = {};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}else {if(data2.status !== undefined){if("timed-out" !== data2.status){const err29 = {};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}}}var _valid4 = _errs35 === errors;errors = _errs34;if(vErrors !== null){if(_errs34){vErrors.length = _errs34;}else {vErrors = null;}}if(_valid4){const _errs37 = errors;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.finish_reason !== undefined){if(!(data2.finish_reason === "error")){const err30 = {instancePath:instancePath+"/record/finish_reason",schemaPath:"#/properties/record/allOf/4/then/properties/finish_reason/enum",keyword:"enum",params:{allowedValues: schema31.properties.record.allOf[4].then.properties.finish_reason.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}}var _valid4 = _errs37 === errors;valid15 = _valid4;if(valid15){var props4 = {};props4.finish_reason = true;props4.status = true;}}if(!valid15){const err31 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/allOf/4/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(props0 !== true && props4 !== undefined){if(props4 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props4);}}if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.execution_id === undefined){const err32 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/required",keyword:"required",params:{missingProperty: "execution_id"},message:"must have required property '"+"execution_id"+"'"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if(data2.prompt === undefined){const err33 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/required",keyword:"required",params:{missingProperty: "prompt"},message:"must have required property '"+"prompt"+"'"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}if(data2.contexts === undefined){const err34 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/required",keyword:"required",params:{missingProperty: "contexts"},message:"must have required property '"+"contexts"+"'"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}if(data2.redacted_context_count === undefined){const err35 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/required",keyword:"required",params:{missingProperty: "redacted_context_count"},message:"must have required property '"+"redacted_context_count"+"'"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}if(data2.target === undefined){const err36 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/required",keyword:"required",params:{missingProperty: "target"},message:"must have required property '"+"target"+"'"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}if(data2.identity === undefined){const err37 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/required",keyword:"required",params:{missingProperty: "identity"},message:"must have required property '"+"identity"+"'"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}if(data2.parameters === undefined){const err38 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/required",keyword:"required",params:{missingProperty: "parameters"},message:"must have required property '"+"parameters"+"'"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(data2.parameters_status === undefined){const err39 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/required",keyword:"required",params:{missingProperty: "parameters_status"},message:"must have required property '"+"parameters_status"+"'"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}if(data2.stop_sequence_count === undefined){const err40 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/required",keyword:"required",params:{missingProperty: "stop_sequence_count"},message:"must have required property '"+"stop_sequence_count"+"'"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}if(data2.timing === undefined){const err41 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/required",keyword:"required",params:{missingProperty: "timing"},message:"must have required property '"+"timing"+"'"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}if(data2.status === undefined){const err42 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}if(data2.finish_reason === undefined){const err43 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/required",keyword:"required",params:{missingProperty: "finish_reason"},message:"must have required property '"+"finish_reason"+"'"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}if(data2.validation === undefined){const err44 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/required",keyword:"required",params:{missingProperty: "validation"},message:"must have required property '"+"validation"+"'"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}if(data2.structured_output === undefined){const err45 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/required",keyword:"required",params:{missingProperty: "structured_output"},message:"must have required property '"+"structured_output"+"'"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(data2.policy === undefined){const err46 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/required",keyword:"required",params:{missingProperty: "policy"},message:"must have required property '"+"policy"+"'"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}for(const key1 in data2){if(!(func1.call(schema31.properties.record.properties, key1))){const err47 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data2.execution_id !== undefined){if(typeof data2.execution_id !== "string"){const err48 = {instancePath:instancePath+"/record/execution_id",schemaPath:"#/properties/record/properties/execution_id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}if(data2.correlation_id !== undefined){if(typeof data2.correlation_id !== "string"){const err49 = {instancePath:instancePath+"/record/correlation_id",schemaPath:"#/properties/record/properties/correlation_id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data2.prompt !== undefined){let data18 = data2.prompt;if(data18 && typeof data18 == "object" && !Array.isArray(data18)){if(data18.id === undefined){const err50 = {instancePath:instancePath+"/record/prompt",schemaPath:"#/properties/record/properties/prompt/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}if(data18.version === undefined){const err51 = {instancePath:instancePath+"/record/prompt",schemaPath:"#/properties/record/properties/prompt/required",keyword:"required",params:{missingProperty: "version"},message:"must have required property '"+"version"+"'"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}if(data18.spec_version === undefined){const err52 = {instancePath:instancePath+"/record/prompt",schemaPath:"#/properties/record/properties/prompt/required",keyword:"required",params:{missingProperty: "spec_version"},message:"must have required property '"+"spec_version"+"'"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}for(const key2 in data18){if(!(((key2 === "id") || (key2 === "version")) || (key2 === "spec_version"))){const err53 = {instancePath:instancePath+"/record/prompt",schemaPath:"#/properties/record/properties/prompt/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}if(data18.id !== undefined){if(typeof data18.id !== "string"){const err54 = {instancePath:instancePath+"/record/prompt/id",schemaPath:"#/properties/record/properties/prompt/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data18.version !== undefined){if(typeof data18.version !== "string"){const err55 = {instancePath:instancePath+"/record/prompt/version",schemaPath:"#/properties/record/properties/prompt/properties/version/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data18.spec_version !== undefined){if(typeof data18.spec_version !== "string"){const err56 = {instancePath:instancePath+"/record/prompt/spec_version",schemaPath:"#/properties/record/properties/prompt/properties/spec_version/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}}else {const err57 = {instancePath:instancePath+"/record/prompt",schemaPath:"#/properties/record/properties/prompt/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}if(data2.rendered !== undefined){let data22 = data2.rendered;if(data22 && typeof data22 == "object" && !Array.isArray(data22)){if(data22.byte_size === undefined){const err58 = {instancePath:instancePath+"/record/rendered",schemaPath:"#/properties/record/properties/rendered/required",keyword:"required",params:{missingProperty: "byte_size"},message:"must have required property '"+"byte_size"+"'"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}if(data22.sha256 === undefined){const err59 = {instancePath:instancePath+"/record/rendered",schemaPath:"#/properties/record/properties/rendered/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}for(const key3 in data22){if(!((key3 === "byte_size") || (key3 === "sha256"))){const err60 = {instancePath:instancePath+"/record/rendered",schemaPath:"#/properties/record/properties/rendered/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}if(data22.byte_size !== undefined){let data23 = data22.byte_size;if(!(((typeof data23 == "number") && (!(data23 % 1) && !isNaN(data23))) && (isFinite(data23)))){const err61 = {instancePath:instancePath+"/record/rendered/byte_size",schemaPath:"#/properties/record/properties/rendered/properties/byte_size/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}if((typeof data23 == "number") && (isFinite(data23))){if(data23 < 0 || isNaN(data23)){const err62 = {instancePath:instancePath+"/record/rendered/byte_size",schemaPath:"#/properties/record/properties/rendered/properties/byte_size/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}}if(data22.sha256 !== undefined){let data24 = data22.sha256;if(typeof data24 === "string"){if(!pattern4.test(data24)){const err63 = {instancePath:instancePath+"/record/rendered/sha256",schemaPath:"#/properties/record/properties/rendered/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^sha256:[0-9a-f]{64}$"},message:"must match pattern \""+"^sha256:[0-9a-f]{64}$"+"\""};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}else {const err64 = {instancePath:instancePath+"/record/rendered/sha256",schemaPath:"#/properties/record/properties/rendered/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}}else {const err65 = {instancePath:instancePath+"/record/rendered",schemaPath:"#/properties/record/properties/rendered/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data2.contexts !== undefined){let data25 = data2.contexts;if(Array.isArray(data25)){const len0 = data25.length;for(let i0=0; i0=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}}if(data2.target !== undefined){let data41 = data2.target;if(data41 && typeof data41 == "object" && !Array.isArray(data41)){if(data41.adapter_id === undefined){const err96 = {instancePath:instancePath+"/record/target",schemaPath:"#/properties/record/properties/target/required",keyword:"required",params:{missingProperty: "adapter_id"},message:"must have required property '"+"adapter_id"+"'"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}if(data41.provider_id === undefined){const err97 = {instancePath:instancePath+"/record/target",schemaPath:"#/properties/record/properties/target/required",keyword:"required",params:{missingProperty: "provider_id"},message:"must have required property '"+"provider_id"+"'"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}if(data41.model_id === undefined){const err98 = {instancePath:instancePath+"/record/target",schemaPath:"#/properties/record/properties/target/required",keyword:"required",params:{missingProperty: "model_id"},message:"must have required property '"+"model_id"+"'"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}for(const key7 in data41){if(!(((key7 === "adapter_id") || (key7 === "provider_id")) || (key7 === "model_id"))){const err99 = {instancePath:instancePath+"/record/target",schemaPath:"#/properties/record/properties/target/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}if(data41.adapter_id !== undefined){if(typeof data41.adapter_id !== "string"){const err100 = {instancePath:instancePath+"/record/target/adapter_id",schemaPath:"#/properties/record/properties/target/properties/adapter_id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}}if(data41.provider_id !== undefined){if(typeof data41.provider_id !== "string"){const err101 = {instancePath:instancePath+"/record/target/provider_id",schemaPath:"#/properties/record/properties/target/properties/provider_id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}if(data41.model_id !== undefined){if(typeof data41.model_id !== "string"){const err102 = {instancePath:instancePath+"/record/target/model_id",schemaPath:"#/properties/record/properties/target/properties/model_id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}}else {const err103 = {instancePath:instancePath+"/record/target",schemaPath:"#/properties/record/properties/target/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}if(data2.identity !== undefined){let data45 = data2.identity;if(data45 && typeof data45 == "object" && !Array.isArray(data45)){if(data45.adapter_id === undefined){const err104 = {instancePath:instancePath+"/record/identity",schemaPath:"#/properties/record/properties/identity/required",keyword:"required",params:{missingProperty: "adapter_id"},message:"must have required property '"+"adapter_id"+"'"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}if(data45.adapter_version === undefined){const err105 = {instancePath:instancePath+"/record/identity",schemaPath:"#/properties/record/properties/identity/required",keyword:"required",params:{missingProperty: "adapter_version"},message:"must have required property '"+"adapter_version"+"'"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}if(data45.provider_id === undefined){const err106 = {instancePath:instancePath+"/record/identity",schemaPath:"#/properties/record/properties/identity/required",keyword:"required",params:{missingProperty: "provider_id"},message:"must have required property '"+"provider_id"+"'"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}if(data45.model_id === undefined){const err107 = {instancePath:instancePath+"/record/identity",schemaPath:"#/properties/record/properties/identity/required",keyword:"required",params:{missingProperty: "model_id"},message:"must have required property '"+"model_id"+"'"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}for(const key8 in data45){if(!(((((key8 === "adapter_id") || (key8 === "adapter_version")) || (key8 === "provider_id")) || (key8 === "model_id")) || (key8 === "model_revision"))){const err108 = {instancePath:instancePath+"/record/identity",schemaPath:"#/properties/record/properties/identity/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}if(data45.adapter_id !== undefined){if(typeof data45.adapter_id !== "string"){const err109 = {instancePath:instancePath+"/record/identity/adapter_id",schemaPath:"#/properties/record/properties/identity/properties/adapter_id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}if(data45.adapter_version !== undefined){if(typeof data45.adapter_version !== "string"){const err110 = {instancePath:instancePath+"/record/identity/adapter_version",schemaPath:"#/properties/record/properties/identity/properties/adapter_version/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}if(data45.provider_id !== undefined){if(typeof data45.provider_id !== "string"){const err111 = {instancePath:instancePath+"/record/identity/provider_id",schemaPath:"#/properties/record/properties/identity/properties/provider_id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}}if(data45.model_id !== undefined){if(typeof data45.model_id !== "string"){const err112 = {instancePath:instancePath+"/record/identity/model_id",schemaPath:"#/properties/record/properties/identity/properties/model_id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}}if(data45.model_revision !== undefined){if(typeof data45.model_revision !== "string"){const err113 = {instancePath:instancePath+"/record/identity/model_revision",schemaPath:"#/properties/record/properties/identity/properties/model_revision/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}}else {const err114 = {instancePath:instancePath+"/record/identity",schemaPath:"#/properties/record/properties/identity/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}if(data2.parameters !== undefined){let data51 = data2.parameters;if(data51 && typeof data51 == "object" && !Array.isArray(data51)){for(const key9 in data51){if(!((((key9 === "max_output_tokens") || (key9 === "temperature")) || (key9 === "top_p")) || (key9 === "seed"))){const err115 = {instancePath:instancePath+"/record/parameters",schemaPath:"#/properties/record/properties/parameters/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}if(data51.max_output_tokens !== undefined){let data52 = data51.max_output_tokens;if(!(((typeof data52 == "number") && (!(data52 % 1) && !isNaN(data52))) && (isFinite(data52)))){const err116 = {instancePath:instancePath+"/record/parameters/max_output_tokens",schemaPath:"#/properties/record/properties/parameters/properties/max_output_tokens/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}if((typeof data52 == "number") && (isFinite(data52))){if(data52 < 1 || isNaN(data52)){const err117 = {instancePath:instancePath+"/record/parameters/max_output_tokens",schemaPath:"#/properties/record/properties/parameters/properties/max_output_tokens/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}}}if(data51.temperature !== undefined){let data53 = data51.temperature;if((typeof data53 == "number") && (isFinite(data53))){if(data53 > 2 || isNaN(data53)){const err118 = {instancePath:instancePath+"/record/parameters/temperature",schemaPath:"#/properties/record/properties/parameters/properties/temperature/maximum",keyword:"maximum",params:{comparison: "<=", limit: 2},message:"must be <= 2"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}if(data53 < 0 || isNaN(data53)){const err119 = {instancePath:instancePath+"/record/parameters/temperature",schemaPath:"#/properties/record/properties/parameters/properties/temperature/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}else {const err120 = {instancePath:instancePath+"/record/parameters/temperature",schemaPath:"#/properties/record/properties/parameters/properties/temperature/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}}if(data51.top_p !== undefined){let data54 = data51.top_p;if((typeof data54 == "number") && (isFinite(data54))){if(data54 > 1 || isNaN(data54)){const err121 = {instancePath:instancePath+"/record/parameters/top_p",schemaPath:"#/properties/record/properties/parameters/properties/top_p/maximum",keyword:"maximum",params:{comparison: "<=", limit: 1},message:"must be <= 1"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}if(data54 <= 0 || isNaN(data54)){const err122 = {instancePath:instancePath+"/record/parameters/top_p",schemaPath:"#/properties/record/properties/parameters/properties/top_p/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison: ">", limit: 0},message:"must be > 0"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}}else {const err123 = {instancePath:instancePath+"/record/parameters/top_p",schemaPath:"#/properties/record/properties/parameters/properties/top_p/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}if(data51.seed !== undefined){let data55 = data51.seed;if(!(((typeof data55 == "number") && (!(data55 % 1) && !isNaN(data55))) && (isFinite(data55)))){const err124 = {instancePath:instancePath+"/record/parameters/seed",schemaPath:"#/properties/record/properties/parameters/properties/seed/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}if((typeof data55 == "number") && (isFinite(data55))){if(data55 > 9007199254740991 || isNaN(data55)){const err125 = {instancePath:instancePath+"/record/parameters/seed",schemaPath:"#/properties/record/properties/parameters/properties/seed/maximum",keyword:"maximum",params:{comparison: "<=", limit: 9007199254740991},message:"must be <= 9007199254740991"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}if(data55 < 0 || isNaN(data55)){const err126 = {instancePath:instancePath+"/record/parameters/seed",schemaPath:"#/properties/record/properties/parameters/properties/seed/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}}}else {const err127 = {instancePath:instancePath+"/record/parameters",schemaPath:"#/properties/record/properties/parameters/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}}if(data2.parameters_status !== undefined){let data56 = data2.parameters_status;if(!((data56 === "resolved") || (data56 === "not-resolved"))){const err128 = {instancePath:instancePath+"/record/parameters_status",schemaPath:"#/properties/record/properties/parameters_status/enum",keyword:"enum",params:{allowedValues: schema31.properties.record.properties.parameters_status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}if(data2.stop_sequence_count !== undefined){let data57 = data2.stop_sequence_count;if(!(((typeof data57 == "number") && (!(data57 % 1) && !isNaN(data57))) && (isFinite(data57)))){const err129 = {instancePath:instancePath+"/record/stop_sequence_count",schemaPath:"#/properties/record/properties/stop_sequence_count/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}if((typeof data57 == "number") && (isFinite(data57))){if(data57 < 0 || isNaN(data57)){const err130 = {instancePath:instancePath+"/record/stop_sequence_count",schemaPath:"#/properties/record/properties/stop_sequence_count/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}}}if(data2.timing !== undefined){let data58 = data2.timing;if(data58 && typeof data58 == "object" && !Array.isArray(data58)){if(data58.started_at === undefined){const err131 = {instancePath:instancePath+"/record/timing",schemaPath:"#/properties/record/properties/timing/required",keyword:"required",params:{missingProperty: "started_at"},message:"must have required property '"+"started_at"+"'"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}if(data58.completed_at === undefined){const err132 = {instancePath:instancePath+"/record/timing",schemaPath:"#/properties/record/properties/timing/required",keyword:"required",params:{missingProperty: "completed_at"},message:"must have required property '"+"completed_at"+"'"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}if(data58.duration_ms === undefined){const err133 = {instancePath:instancePath+"/record/timing",schemaPath:"#/properties/record/properties/timing/required",keyword:"required",params:{missingProperty: "duration_ms"},message:"must have required property '"+"duration_ms"+"'"};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}for(const key10 in data58){if(!(((key10 === "started_at") || (key10 === "completed_at")) || (key10 === "duration_ms"))){const err134 = {instancePath:instancePath+"/record/timing",schemaPath:"#/properties/record/properties/timing/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}}if(data58.started_at !== undefined){let data59 = data58.started_at;if(typeof data59 === "string"){if(!(formats0.validate(data59))){const err135 = {instancePath:instancePath+"/record/timing/started_at",schemaPath:"#/properties/record/properties/timing/properties/started_at/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}}else {const err136 = {instancePath:instancePath+"/record/timing/started_at",schemaPath:"#/properties/record/properties/timing/properties/started_at/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}}if(data58.completed_at !== undefined){let data60 = data58.completed_at;if(typeof data60 === "string"){if(!(formats0.validate(data60))){const err137 = {instancePath:instancePath+"/record/timing/completed_at",schemaPath:"#/properties/record/properties/timing/properties/completed_at/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}}else {const err138 = {instancePath:instancePath+"/record/timing/completed_at",schemaPath:"#/properties/record/properties/timing/properties/completed_at/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}}if(data58.duration_ms !== undefined){let data61 = data58.duration_ms;if(!(((typeof data61 == "number") && (!(data61 % 1) && !isNaN(data61))) && (isFinite(data61)))){const err139 = {instancePath:instancePath+"/record/timing/duration_ms",schemaPath:"#/properties/record/properties/timing/properties/duration_ms/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}if((typeof data61 == "number") && (isFinite(data61))){if(data61 < 0 || isNaN(data61)){const err140 = {instancePath:instancePath+"/record/timing/duration_ms",schemaPath:"#/properties/record/properties/timing/properties/duration_ms/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}}}}else {const err141 = {instancePath:instancePath+"/record/timing",schemaPath:"#/properties/record/properties/timing/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}if(data2.status !== undefined){let data62 = data2.status;if(!((((data62 === "succeeded") || (data62 === "failed")) || (data62 === "cancelled")) || (data62 === "timed-out"))){const err142 = {instancePath:instancePath+"/record/status",schemaPath:"#/properties/record/properties/status/enum",keyword:"enum",params:{allowedValues: schema31.properties.record.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}if(data2.finish_reason !== undefined){let data63 = data2.finish_reason;if(!((((((data63 === "stop") || (data63 === "length")) || (data63 === "content-filter")) || (data63 === "cancelled")) || (data63 === "error")) || (data63 === "unknown"))){const err143 = {instancePath:instancePath+"/record/finish_reason",schemaPath:"#/properties/record/properties/finish_reason/enum",keyword:"enum",params:{allowedValues: schema31.properties.record.properties.finish_reason.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}if(data2.usage !== undefined){let data64 = data2.usage;if(data64 && typeof data64 == "object" && !Array.isArray(data64)){if(data64.provider_reported === undefined){const err144 = {instancePath:instancePath+"/record/usage",schemaPath:"#/properties/record/properties/usage/required",keyword:"required",params:{missingProperty: "provider_reported"},message:"must have required property '"+"provider_reported"+"'"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}for(const key11 in data64){if(!((((key11 === "provider_reported") || (key11 === "input_tokens")) || (key11 === "output_tokens")) || (key11 === "total_tokens"))){const err145 = {instancePath:instancePath+"/record/usage",schemaPath:"#/properties/record/properties/usage/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}if(data64.provider_reported !== undefined){if(typeof data64.provider_reported !== "boolean"){const err146 = {instancePath:instancePath+"/record/usage/provider_reported",schemaPath:"#/properties/record/properties/usage/properties/provider_reported/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}}if(data64.input_tokens !== undefined){let data66 = data64.input_tokens;if(!(((typeof data66 == "number") && (!(data66 % 1) && !isNaN(data66))) && (isFinite(data66)))){const err147 = {instancePath:instancePath+"/record/usage/input_tokens",schemaPath:"#/properties/record/properties/usage/properties/input_tokens/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}if((typeof data66 == "number") && (isFinite(data66))){if(data66 < 0 || isNaN(data66)){const err148 = {instancePath:instancePath+"/record/usage/input_tokens",schemaPath:"#/properties/record/properties/usage/properties/input_tokens/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}}}if(data64.output_tokens !== undefined){let data67 = data64.output_tokens;if(!(((typeof data67 == "number") && (!(data67 % 1) && !isNaN(data67))) && (isFinite(data67)))){const err149 = {instancePath:instancePath+"/record/usage/output_tokens",schemaPath:"#/properties/record/properties/usage/properties/output_tokens/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}if((typeof data67 == "number") && (isFinite(data67))){if(data67 < 0 || isNaN(data67)){const err150 = {instancePath:instancePath+"/record/usage/output_tokens",schemaPath:"#/properties/record/properties/usage/properties/output_tokens/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}}if(data64.total_tokens !== undefined){let data68 = data64.total_tokens;if(!(((typeof data68 == "number") && (!(data68 % 1) && !isNaN(data68))) && (isFinite(data68)))){const err151 = {instancePath:instancePath+"/record/usage/total_tokens",schemaPath:"#/properties/record/properties/usage/properties/total_tokens/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}if((typeof data68 == "number") && (isFinite(data68))){if(data68 < 0 || isNaN(data68)){const err152 = {instancePath:instancePath+"/record/usage/total_tokens",schemaPath:"#/properties/record/properties/usage/properties/total_tokens/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}}}}else {const err153 = {instancePath:instancePath+"/record/usage",schemaPath:"#/properties/record/properties/usage/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}}if(data2.output !== undefined){let data69 = data2.output;if(data69 && typeof data69 == "object" && !Array.isArray(data69)){if(data69.byte_size === undefined){const err154 = {instancePath:instancePath+"/record/output",schemaPath:"#/properties/record/properties/output/required",keyword:"required",params:{missingProperty: "byte_size"},message:"must have required property '"+"byte_size"+"'"};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}if(data69.sha256 === undefined){const err155 = {instancePath:instancePath+"/record/output",schemaPath:"#/properties/record/properties/output/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}for(const key12 in data69){if(!((key12 === "byte_size") || (key12 === "sha256"))){const err156 = {instancePath:instancePath+"/record/output",schemaPath:"#/properties/record/properties/output/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key12},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}}if(data69.byte_size !== undefined){let data70 = data69.byte_size;if(!(((typeof data70 == "number") && (!(data70 % 1) && !isNaN(data70))) && (isFinite(data70)))){const err157 = {instancePath:instancePath+"/record/output/byte_size",schemaPath:"#/properties/record/properties/output/properties/byte_size/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err157];}else {vErrors.push(err157);}errors++;}if((typeof data70 == "number") && (isFinite(data70))){if(data70 < 0 || isNaN(data70)){const err158 = {instancePath:instancePath+"/record/output/byte_size",schemaPath:"#/properties/record/properties/output/properties/byte_size/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}}}if(data69.sha256 !== undefined){let data71 = data69.sha256;if(typeof data71 === "string"){if(!pattern4.test(data71)){const err159 = {instancePath:instancePath+"/record/output/sha256",schemaPath:"#/properties/record/properties/output/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^sha256:[0-9a-f]{64}$"},message:"must match pattern \""+"^sha256:[0-9a-f]{64}$"+"\""};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}}else {const err160 = {instancePath:instancePath+"/record/output/sha256",schemaPath:"#/properties/record/properties/output/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}}}else {const err161 = {instancePath:instancePath+"/record/output",schemaPath:"#/properties/record/properties/output/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}}if(data2.validation !== undefined){let data72 = data2.validation;if(data72 && typeof data72 == "object" && !Array.isArray(data72)){if(data72.status === undefined){const err162 = {instancePath:instancePath+"/record/validation",schemaPath:"#/properties/record/properties/validation/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}if(data72.errors === undefined){const err163 = {instancePath:instancePath+"/record/validation",schemaPath:"#/properties/record/properties/validation/required",keyword:"required",params:{missingProperty: "errors"},message:"must have required property '"+"errors"+"'"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}if(data72.warnings === undefined){const err164 = {instancePath:instancePath+"/record/validation",schemaPath:"#/properties/record/properties/validation/required",keyword:"required",params:{missingProperty: "warnings"},message:"must have required property '"+"warnings"+"'"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}for(const key13 in data72){if(!(((key13 === "status") || (key13 === "errors")) || (key13 === "warnings"))){const err165 = {instancePath:instancePath+"/record/validation",schemaPath:"#/properties/record/properties/validation/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key13},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}}if(data72.status !== undefined){let data73 = data72.status;if(!(((data73 === "not-run") || (data73 === "passed")) || (data73 === "failed"))){const err166 = {instancePath:instancePath+"/record/validation/status",schemaPath:"#/properties/record/properties/validation/properties/status/enum",keyword:"enum",params:{allowedValues: schema31.properties.record.properties.validation.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}}if(data72.errors !== undefined){let data74 = data72.errors;if(!(((typeof data74 == "number") && (!(data74 % 1) && !isNaN(data74))) && (isFinite(data74)))){const err167 = {instancePath:instancePath+"/record/validation/errors",schemaPath:"#/properties/record/properties/validation/properties/errors/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}if((typeof data74 == "number") && (isFinite(data74))){if(data74 < 0 || isNaN(data74)){const err168 = {instancePath:instancePath+"/record/validation/errors",schemaPath:"#/properties/record/properties/validation/properties/errors/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}}if(data72.warnings !== undefined){let data75 = data72.warnings;if(!(((typeof data75 == "number") && (!(data75 % 1) && !isNaN(data75))) && (isFinite(data75)))){const err169 = {instancePath:instancePath+"/record/validation/warnings",schemaPath:"#/properties/record/properties/validation/properties/warnings/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}if((typeof data75 == "number") && (isFinite(data75))){if(data75 < 0 || isNaN(data75)){const err170 = {instancePath:instancePath+"/record/validation/warnings",schemaPath:"#/properties/record/properties/validation/properties/warnings/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}}}}else {const err171 = {instancePath:instancePath+"/record/validation",schemaPath:"#/properties/record/properties/validation/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}}if(data2.structured_output !== undefined){let data76 = data2.structured_output;const _errs169 = errors;let valid36 = true;const _errs170 = errors;if(data76 && typeof data76 == "object" && !Array.isArray(data76)){let missing6;if((data76.status === undefined) && (missing6 = "status")){const err172 = {};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}else {if(data76.status !== undefined){if("not-run" !== data76.status){const err173 = {};if(vErrors === null){vErrors = [err173];}else {vErrors.push(err173);}errors++;}}}}var _valid5 = _errs170 === errors;errors = _errs169;if(vErrors !== null){if(_errs169){vErrors.length = _errs169;}else {vErrors = null;}}let ifClause0;if(_valid5){const _errs172 = errors;const _errs173 = errors;const _errs174 = errors;if(data76 && typeof data76 == "object" && !Array.isArray(data76)){let missing7;if((data76.processing_id === undefined) && (missing7 = "processing_id")){const err174 = {};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}}var valid38 = _errs174 === errors;if(valid38){const err175 = {instancePath:instancePath+"/record/structured_output",schemaPath:"#/properties/record/properties/structured_output/allOf/0/then/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}else {errors = _errs173;if(vErrors !== null){if(_errs173){vErrors.length = _errs173;}else {vErrors = null;}}}var _valid5 = _errs172 === errors;valid36 = _valid5;ifClause0 = "then";}else {const _errs175 = errors;if(data76 && typeof data76 == "object" && !Array.isArray(data76)){if(data76.processing_id === undefined){const err176 = {instancePath:instancePath+"/record/structured_output",schemaPath:"#/properties/record/properties/structured_output/allOf/0/else/required",keyword:"required",params:{missingProperty: "processing_id"},message:"must have required property '"+"processing_id"+"'"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}}var _valid5 = _errs175 === errors;valid36 = _valid5;ifClause0 = "else";}if(!valid36){const err177 = {instancePath:instancePath+"/record/structured_output",schemaPath:"#/properties/record/properties/structured_output/allOf/0/if",keyword:"if",params:{failingKeyword: ifClause0},message:"must match \""+ifClause0+"\" schema"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}if(data76 && typeof data76 == "object" && !Array.isArray(data76)){if(data76.status === undefined){const err178 = {instancePath:instancePath+"/record/structured_output",schemaPath:"#/properties/record/properties/structured_output/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}for(const key14 in data76){if(!((key14 === "status") || (key14 === "processing_id"))){const err179 = {instancePath:instancePath+"/record/structured_output",schemaPath:"#/properties/record/properties/structured_output/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key14},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}}if(data76.status !== undefined){let data78 = data76.status;if(!(((data78 === "not-run") || (data78 === "validated")) || (data78 === "failed"))){const err180 = {instancePath:instancePath+"/record/structured_output/status",schemaPath:"#/properties/record/properties/structured_output/properties/status/enum",keyword:"enum",params:{allowedValues: schema31.properties.record.properties.structured_output.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}}if(data76.processing_id !== undefined){let data79 = data76.processing_id;if(typeof data79 === "string"){if(!pattern6.test(data79)){const err181 = {instancePath:instancePath+"/record/structured_output/processing_id",schemaPath:"#/properties/record/properties/structured_output/properties/processing_id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$"+"\""};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}}else {const err182 = {instancePath:instancePath+"/record/structured_output/processing_id",schemaPath:"#/properties/record/properties/structured_output/properties/processing_id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}}}else {const err183 = {instancePath:instancePath+"/record/structured_output",schemaPath:"#/properties/record/properties/structured_output/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}}if(data2.policy !== undefined){let data80 = data2.policy;if(data80 && typeof data80 == "object" && !Array.isArray(data80)){if(data80.content_identities === undefined){const err184 = {instancePath:instancePath+"/record/policy",schemaPath:"#/properties/record/properties/policy/required",keyword:"required",params:{missingProperty: "content_identities"},message:"must have required property '"+"content_identities"+"'"};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}if(data80.bodies === undefined){const err185 = {instancePath:instancePath+"/record/policy",schemaPath:"#/properties/record/properties/policy/required",keyword:"required",params:{missingProperty: "bodies"},message:"must have required property '"+"bodies"+"'"};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}for(const key15 in data80){if(!((key15 === "content_identities") || (key15 === "bodies"))){const err186 = {instancePath:instancePath+"/record/policy",schemaPath:"#/properties/record/properties/policy/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key15},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}}if(data80.content_identities !== undefined){let data81 = data80.content_identities;if(!((data81 === "public-only") || (data81 === "omit"))){const err187 = {instancePath:instancePath+"/record/policy/content_identities",schemaPath:"#/properties/record/properties/policy/properties/content_identities/enum",keyword:"enum",params:{allowedValues: schema31.properties.record.properties.policy.properties.content_identities.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}}if(data80.bodies !== undefined){if("omitted" !== data80.bodies){const err188 = {instancePath:instancePath+"/record/policy/bodies",schemaPath:"#/properties/record/properties/policy/properties/bodies/const",keyword:"const",params:{allowedValue: "omitted"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err188];}else {vErrors.push(err188);}errors++;}}}else {const err189 = {instancePath:instancePath+"/record/policy",schemaPath:"#/properties/record/properties/policy/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}}}else {const err190 = {instancePath:instancePath+"/record",schemaPath:"#/properties/record/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}}if(data.identity !== undefined){let data83 = data.identity;if(data83 && typeof data83 == "object" && !Array.isArray(data83)){if(data83.byte_size === undefined){const err191 = {instancePath:instancePath+"/identity",schemaPath:"#/properties/identity/required",keyword:"required",params:{missingProperty: "byte_size"},message:"must have required property '"+"byte_size"+"'"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}if(data83.sha256 === undefined){const err192 = {instancePath:instancePath+"/identity",schemaPath:"#/properties/identity/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}for(const key16 in data83){if(!((key16 === "byte_size") || (key16 === "sha256"))){const err193 = {instancePath:instancePath+"/identity",schemaPath:"#/properties/identity/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key16},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err193];}else {vErrors.push(err193);}errors++;}}if(data83.byte_size !== undefined){let data84 = data83.byte_size;if(!(((typeof data84 == "number") && (!(data84 % 1) && !isNaN(data84))) && (isFinite(data84)))){const err194 = {instancePath:instancePath+"/identity/byte_size",schemaPath:"#/properties/identity/properties/byte_size/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err194];}else {vErrors.push(err194);}errors++;}if((typeof data84 == "number") && (isFinite(data84))){if(data84 < 0 || isNaN(data84)){const err195 = {instancePath:instancePath+"/identity/byte_size",schemaPath:"#/properties/identity/properties/byte_size/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err195];}else {vErrors.push(err195);}errors++;}}}if(data83.sha256 !== undefined){let data85 = data83.sha256;if(typeof data85 === "string"){if(!pattern4.test(data85)){const err196 = {instancePath:instancePath+"/identity/sha256",schemaPath:"#/properties/identity/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^sha256:[0-9a-f]{64}$"},message:"must match pattern \""+"^sha256:[0-9a-f]{64}$"+"\""};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}}else {const err197 = {instancePath:instancePath+"/identity/sha256",schemaPath:"#/properties/identity/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err197];}else {vErrors.push(err197);}errors++;}}}else {const err198 = {instancePath:instancePath+"/identity",schemaPath:"#/properties/identity/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err198];}else {vErrors.push(err198);}errors++;}}}else {const err199 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err199];}else {vErrors.push(err199);}errors++;}validate20.errors = vErrors;return errors === 0;}validate20.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false}; \ No newline at end of file diff --git a/src/prompt-sdk/generated/provider-execution-v1-schema.js b/src/prompt-sdk/generated/provider-execution-v1-schema.js index 544d7e1..6ffac03 100644 --- a/src/prompt-sdk/generated/provider-execution-v1-schema.js +++ b/src/prompt-sdk/generated/provider-execution-v1-schema.js @@ -1,4 +1,4 @@ -// Generated from DefinitelySecureStudio/codex@dfd31a693674dc03dec4784dcdd1345f647cff1e +// Generated from DefinitelySecureStudio/codex@62e78b606986988518b9dc502c25ae1cd189684a // Source SHA-256: 4366665b89d7633974c4be15cac74f754e722b41031f708ca2f825ead892cb8b // Rebuild with scripts/generate-execution-schema-validator.mjs; do not edit manually. import { createRequire } from "node:module"; diff --git a/src/prompt-sdk/generated/structured-output-v1-schema.js b/src/prompt-sdk/generated/structured-output-v1-schema.js index ec1dd71..ef7e031 100644 --- a/src/prompt-sdk/generated/structured-output-v1-schema.js +++ b/src/prompt-sdk/generated/structured-output-v1-schema.js @@ -1,4 +1,4 @@ -// Generated from DefinitelySecureStudio/codex@275e0cda2e699fbcb1cdd56323a4d58e3f65e507 +// Generated from DefinitelySecureStudio/codex@62e78b606986988518b9dc502c25ae1cd189684a // Source SHA-256: 6ea2c5d4804b92bbca386d2b64063d72980ca1d294d23338be6adc057caaeeb2 // Rebuild with scripts/generate-structured-output-schema-validator.mjs; do not edit manually. import { createRequire } from "node:module"; diff --git a/src/prompt-sdk/release-contracts.js b/src/prompt-sdk/release-contracts.js new file mode 100644 index 0000000..b943165 --- /dev/null +++ b/src/prompt-sdk/release-contracts.js @@ -0,0 +1,68 @@ +const pins = { + "context-package": { + "repository": "DefinitelySecureStudio/codex", + "contract": "context-package", + "version": "1.0.0", + "spec_version": "1.0.0", + "tag": "contract/context-package/v1.0.0", + "commit": "62e78b606986988518b9dc502c25ae1cd189684a", + "artifact_uri": "https://github.com/DefinitelySecureStudio/codex/releases/download/contract%2Fcontext-package%2Fv1.0.0/context-package-v1.0.0.schema.json", + "media_type": "application/schema+json", + "schema_sha256": "sha256:d81e88780511c31099b2dd925f31aff26d6ba75e1173e953b98a37298764b617", + "schema_byte_size": 8390, + "status": "released" + }, + "execution-provenance": { + "repository": "DefinitelySecureStudio/codex", + "contract": "execution-provenance", + "version": "1.0.0", + "spec_version": "1.0.0", + "tag": "contract/execution-provenance/v1.0.0", + "commit": "62e78b606986988518b9dc502c25ae1cd189684a", + "artifact_uri": "https://github.com/DefinitelySecureStudio/codex/releases/download/contract%2Fexecution-provenance%2Fv1.0.0/execution-provenance-v1.0.0.schema.json", + "media_type": "application/schema+json", + "schema_sha256": "sha256:d1f897fdd40c8a513f2f3dc9c44728ec124e53a57977a1b11b04e00953020118", + "schema_byte_size": 13143, + "status": "released" + }, + "prompt-definition": { + "repository": "DefinitelySecureStudio/codex", + "contract": "prompt-definition", + "version": "1.0.0", + "spec_version": "1.0.0", + "tag": "contract/prompt-definition/v1.0.0", + "commit": "62e78b606986988518b9dc502c25ae1cd189684a", + "artifact_uri": "https://github.com/DefinitelySecureStudio/codex/releases/download/contract%2Fprompt-definition%2Fv1.0.0/prompt-definition-v1.0.0.schema.json", + "media_type": "application/schema+json", + "schema_sha256": "sha256:6ac345956582d25c2db9c81b85cab9c73b2cbcfc79b8aac7a43d847c07173cb9", + "schema_byte_size": 18384, + "status": "released" + }, + "provider-execution": { + "repository": "DefinitelySecureStudio/codex", + "contract": "provider-execution", + "version": "1.0.0", + "spec_version": "1.0.0", + "tag": "contract/provider-execution/v1.0.0", + "commit": "62e78b606986988518b9dc502c25ae1cd189684a", + "artifact_uri": "https://github.com/DefinitelySecureStudio/codex/releases/download/contract%2Fprovider-execution%2Fv1.0.0/provider-execution-v1.0.0.schema.json", + "media_type": "application/schema+json", + "schema_sha256": "sha256:4366665b89d7633974c4be15cac74f754e722b41031f708ca2f825ead892cb8b", + "schema_byte_size": 25285, + "status": "released" + }, + "structured-output": { + "repository": "DefinitelySecureStudio/codex", + "contract": "structured-output", + "version": "1.0.0", + "spec_version": "1.0.0", + "tag": "contract/structured-output/v1.0.0", + "commit": "62e78b606986988518b9dc502c25ae1cd189684a", + "artifact_uri": "https://github.com/DefinitelySecureStudio/codex/releases/download/contract%2Fstructured-output%2Fv1.0.0/structured-output-v1.0.0.schema.json", + "media_type": "application/schema+json", + "schema_sha256": "sha256:6ea2c5d4804b92bbca386d2b64063d72980ca1d294d23338be6adc057caaeeb2", + "schema_byte_size": 8427, + "status": "released" + } +}; +export const RELEASE_CONTRACTS = Object.freeze(Object.fromEntries(Object.entries(pins).map(([name, pin]) => [name, Object.freeze(pin)]))); diff --git a/src/prompt-sdk/render.js b/src/prompt-sdk/render.js index 7b9ea21..3b9a272 100644 --- a/src/prompt-sdk/render.js +++ b/src/prompt-sdk/render.js @@ -7,13 +7,13 @@ const ROLES = new Set(["instruction", "user", "assistant-example"]); const TYPES = new Set(["string", "integer", "number", "boolean", "object", "array"]); const RENDERER = Object.freeze({ name: "@definitely-secure-studio/platform/prompt-sdk", - version: "0.1.0", + version: "1.0.0", algorithm: "typed-parts-v1", canonical_json: "studio-json-v1", contract: Object.freeze({ repository: "DefinitelySecureStudio/codex", - commit: "dfd31a693674dc03dec4784dcdd1345f647cff1e", - status: "provisional-unreleased" + commit: "62e78b606986988518b9dc502c25ae1cd189684a", + status: "released" }) }); diff --git a/src/prompt-sdk/structured-output.js b/src/prompt-sdk/structured-output.js index cb5ec2f..626533f 100644 --- a/src/prompt-sdk/structured-output.js +++ b/src/prompt-sdk/structured-output.js @@ -8,7 +8,7 @@ import { parseJsonDocument } from "./parse-json.js"; import { StructuredOutputError } from "./structured-output-errors.js"; import { validateExecutionDocument } from "./validate-execution.js"; -const VALIDATOR = Object.freeze({ name: "studio.prompt-sdk", version: "0.1.0", algorithm: "parse-once-validate-v1", json_schema_draft: "2020-12" }); +const VALIDATOR = Object.freeze({ name: "studio.prompt-sdk", version: "1.0.0", algorithm: "parse-once-validate-v1", json_schema_draft: "2020-12" }); const CLASSIFICATIONS = ["public", "internal", "confidential", "restricted"]; function sha256(value) { return `sha256:${createHash("sha256").update(value).digest("hex")}`; } diff --git a/src/prompt-sdk/validate.js b/src/prompt-sdk/validate.js index 5ff15d6..08f9d73 100644 --- a/src/prompt-sdk/validate.js +++ b/src/prompt-sdk/validate.js @@ -1,6 +1,6 @@ import validateSchema from "./generated/prompt-definition-v1-schema.js"; import { canonicalJson } from "./canonical-json.js"; -import { diagnostic, pointer, report } from "./diagnostics.js"; +import { CONTRACT, diagnostic, pointer, report } from "./diagnostics.js"; const CORE_CAPABILITIES = Object.freeze(["text-generation", "structured-output"]); const CONSTRAINTS = Object.freeze({ @@ -167,7 +167,7 @@ function semanticDiagnostics(definition, options) { const supportUntil = Date.parse(deprecation.support_until); if (Number.isFinite(deprecatedAt) && Number.isFinite(supportUntil) && supportUntil < deprecatedAt) diagnostics.push(diagnostic("error", "INVALID_SUPPORT_WINDOW", "Deprecation support_until must not precede deprecated_at.", ["lifecycle", "deprecation", "support_until"])); } - if (definition.lifecycle?.status === "stable") diagnostics.push(diagnostic("error", "UNRELEASED_CONTRACT_STABLE_LIFECYCLE", "A prompt cannot be stable while Prompt Definition v1 remains unreleased.", ["lifecycle", "status"], { contract_status: "provisional-unreleased" })); + if (definition.lifecycle?.status === "stable" && CONTRACT.status !== "released") diagnostics.push(diagnostic("error", "UNRELEASED_CONTRACT_STABLE_LIFECYCLE", "A prompt cannot be stable while Prompt Definition v1 remains unreleased.", ["lifecycle", "status"], { contract_status: CONTRACT.status })); const requiredCapabilities = Array.isArray(definition.capabilities?.required) ? definition.capabilities.required : []; const optionalCapabilities = Array.isArray(definition.capabilities?.optional) ? definition.capabilities.optional : []; diff --git a/tests/fixtures/golden/structured.json b/tests/fixtures/golden/structured.json index 12756da..ce79dc2 100644 --- a/tests/fixtures/golden/structured.json +++ b/tests/fixtures/golden/structured.json @@ -13,13 +13,13 @@ }, "renderer": { "name": "@definitely-secure-studio/platform/prompt-sdk", - "version": "0.1.0", + "version": "1.0.0", "algorithm": "typed-parts-v1", "canonical_json": "studio-json-v1", "contract": { "repository": "DefinitelySecureStudio/codex", - "commit": "dfd31a693674dc03dec4784dcdd1345f647cff1e", - "status": "provisional-unreleased" + "commit": "62e78b606986988518b9dc502c25ae1cd189684a", + "status": "released" } }, "classification": "public", @@ -52,9 +52,9 @@ ], "contexts": [] }, - "canonical": "{\"classification\":\"public\",\"contexts\":[],\"definition\":{\"id\":\"prompt.reference.structured\",\"spec_version\":\"1.0.0\",\"version\":\"1.0.0\"},\"format\":\"studio-rendered-messages-v1\",\"inputs\":[{\"classification\":\"public\",\"name\":\"item\",\"source\":\"provided\"},{\"classification\":\"public\",\"name\":\"attributes\",\"source\":\"provided\"},{\"classification\":\"public\",\"name\":\"concise\",\"source\":\"default\"}],\"messages\":[{\"content\":\"Describe only the supplied synthetic item.\",\"role\":\"instruction\"},{\"content\":\"Item: blue cube\\nAttributes: {\\\"color\\\":\\\"blue\\\"}\\nConcise: true\\nNotes: \",\"role\":\"user\"}],\"renderer\":{\"algorithm\":\"typed-parts-v1\",\"canonical_json\":\"studio-json-v1\",\"contract\":{\"commit\":\"dfd31a693674dc03dec4784dcdd1345f647cff1e\",\"repository\":\"DefinitelySecureStudio/codex\",\"status\":\"provisional-unreleased\"},\"name\":\"@definitely-secure-studio/platform/prompt-sdk\",\"version\":\"0.1.0\"}}", - "byteSize": 861, - "sha256": "sha256:44f8e51b9400f966145091d66feed3f96eab772989d0b4186154f3fbd25dde14" + "canonical": "{\"classification\":\"public\",\"contexts\":[],\"definition\":{\"id\":\"prompt.reference.structured\",\"spec_version\":\"1.0.0\",\"version\":\"1.0.0\"},\"format\":\"studio-rendered-messages-v1\",\"inputs\":[{\"classification\":\"public\",\"name\":\"item\",\"source\":\"provided\"},{\"classification\":\"public\",\"name\":\"attributes\",\"source\":\"provided\"},{\"classification\":\"public\",\"name\":\"concise\",\"source\":\"default\"}],\"messages\":[{\"content\":\"Describe only the supplied synthetic item.\",\"role\":\"instruction\"},{\"content\":\"Item: blue cube\\nAttributes: {\\\"color\\\":\\\"blue\\\"}\\nConcise: true\\nNotes: \",\"role\":\"user\"}],\"renderer\":{\"algorithm\":\"typed-parts-v1\",\"canonical_json\":\"studio-json-v1\",\"contract\":{\"commit\":\"62e78b606986988518b9dc502c25ae1cd189684a\",\"repository\":\"DefinitelySecureStudio/codex\",\"status\":\"released\"},\"name\":\"@definitely-secure-studio/platform/prompt-sdk\",\"version\":\"1.0.0\"}}", + "byteSize": 847, + "sha256": "sha256:c1955b96e6523d8509294bf9b0655fb55578b9eb440b964703c2752a8243cda8" }, "structured": { "spec_version": "1.0.0", @@ -86,7 +86,7 @@ }, "validator": { "name": "studio.prompt-sdk", - "version": "0.1.0", + "version": "1.0.0", "algorithm": "parse-once-validate-v1", "json_schema_draft": "2020-12" }, @@ -173,8 +173,8 @@ "total_tokens": 22 }, "rendered": { - "byte_size": 861, - "sha256": "sha256:44f8e51b9400f966145091d66feed3f96eab772989d0b4186154f3fbd25dde14" + "byte_size": 847, + "sha256": "sha256:c1955b96e6523d8509294bf9b0655fb55578b9eb440b964703c2752a8243cda8" }, "output": { "byte_size": 64, @@ -183,7 +183,7 @@ }, "identity": { "byte_size": 1206, - "sha256": "sha256:8bf58936a678d8cc548934b44e61640760f22fba8480818efd4175657f50c82f" + "sha256": "sha256:797abf26dfb6c0bc4b6ae4200fde5c0c152d56d1de0a8e871aa426040a8859f7" } }, { @@ -241,8 +241,8 @@ "total_tokens": 22 }, "rendered": { - "byte_size": 861, - "sha256": "sha256:44f8e51b9400f966145091d66feed3f96eab772989d0b4186154f3fbd25dde14" + "byte_size": 847, + "sha256": "sha256:c1955b96e6523d8509294bf9b0655fb55578b9eb440b964703c2752a8243cda8" }, "output": { "byte_size": 64, @@ -251,7 +251,7 @@ }, "identity": { "byte_size": 1202, - "sha256": "sha256:3364efe9c95b91ef44885fe791f7e90047593ca8c104a63d7846fab14c6bc569" + "sha256": "sha256:e2a2960d86d18523558b002c03f4647f6e5b7e2d2be3091de206107b13869863" } } ] diff --git a/tests/fixtures/golden/text.json b/tests/fixtures/golden/text.json index 7000dfb..ee112da 100644 --- a/tests/fixtures/golden/text.json +++ b/tests/fixtures/golden/text.json @@ -13,13 +13,13 @@ }, "renderer": { "name": "@definitely-secure-studio/platform/prompt-sdk", - "version": "0.1.0", + "version": "1.0.0", "algorithm": "typed-parts-v1", "canonical_json": "studio-json-v1", "contract": { "repository": "DefinitelySecureStudio/codex", - "commit": "dfd31a693674dc03dec4784dcdd1345f647cff1e", - "status": "provisional-unreleased" + "commit": "62e78b606986988518b9dc502c25ae1cd189684a", + "status": "released" } }, "classification": "public", @@ -52,9 +52,9 @@ ], "contexts": [] }, - "canonical": "{\"classification\":\"public\",\"contexts\":[],\"definition\":{\"id\":\"prompt.reference.text\",\"spec_version\":\"1.0.0\",\"version\":\"1.0.0\"},\"format\":\"studio-rendered-messages-v1\",\"inputs\":[{\"classification\":\"public\",\"name\":\"item\",\"source\":\"provided\"},{\"classification\":\"public\",\"name\":\"attributes\",\"source\":\"provided\"},{\"classification\":\"public\",\"name\":\"concise\",\"source\":\"default\"}],\"messages\":[{\"content\":\"Describe only the supplied synthetic item.\",\"role\":\"instruction\"},{\"content\":\"Item: blue cube\\nAttributes: {\\\"color\\\":\\\"blue\\\"}\\nConcise: true\\nNotes: \",\"role\":\"user\"}],\"renderer\":{\"algorithm\":\"typed-parts-v1\",\"canonical_json\":\"studio-json-v1\",\"contract\":{\"commit\":\"dfd31a693674dc03dec4784dcdd1345f647cff1e\",\"repository\":\"DefinitelySecureStudio/codex\",\"status\":\"provisional-unreleased\"},\"name\":\"@definitely-secure-studio/platform/prompt-sdk\",\"version\":\"0.1.0\"}}", - "byteSize": 855, - "sha256": "sha256:d9367251a4b481a4c365f09d6293ca4c8d14d0b461adcc6ff7c1bbdc3f2020a2" + "canonical": "{\"classification\":\"public\",\"contexts\":[],\"definition\":{\"id\":\"prompt.reference.text\",\"spec_version\":\"1.0.0\",\"version\":\"1.0.0\"},\"format\":\"studio-rendered-messages-v1\",\"inputs\":[{\"classification\":\"public\",\"name\":\"item\",\"source\":\"provided\"},{\"classification\":\"public\",\"name\":\"attributes\",\"source\":\"provided\"},{\"classification\":\"public\",\"name\":\"concise\",\"source\":\"default\"}],\"messages\":[{\"content\":\"Describe only the supplied synthetic item.\",\"role\":\"instruction\"},{\"content\":\"Item: blue cube\\nAttributes: {\\\"color\\\":\\\"blue\\\"}\\nConcise: true\\nNotes: \",\"role\":\"user\"}],\"renderer\":{\"algorithm\":\"typed-parts-v1\",\"canonical_json\":\"studio-json-v1\",\"contract\":{\"commit\":\"62e78b606986988518b9dc502c25ae1cd189684a\",\"repository\":\"DefinitelySecureStudio/codex\",\"status\":\"released\"},\"name\":\"@definitely-secure-studio/platform/prompt-sdk\",\"version\":\"1.0.0\"}}", + "byteSize": 841, + "sha256": "sha256:834f10292ae45c58ee87af016a81196f802e268efd4ec096a0b115f6c5b4caa7" }, "provenance": [ { @@ -115,8 +115,8 @@ "total_tokens": 22 }, "rendered": { - "byte_size": 855, - "sha256": "sha256:d9367251a4b481a4c365f09d6293ca4c8d14d0b461adcc6ff7c1bbdc3f2020a2" + "byte_size": 841, + "sha256": "sha256:834f10292ae45c58ee87af016a81196f802e268efd4ec096a0b115f6c5b4caa7" }, "output": { "byte_size": 22, @@ -125,7 +125,7 @@ }, "identity": { "byte_size": 1194, - "sha256": "sha256:62891e191cf45921384993c58e57e8198a3d402d9ef31d86eaba32a32c97a65c" + "sha256": "sha256:15750613f69020d5400976d17ed85a51978d5e7e4b35b8256729258e2f36013c" } } ] diff --git a/tests/prompt-sdk/release-readiness.test.js b/tests/prompt-sdk/release-readiness.test.js index cfa2934..a0a0ddb 100644 --- a/tests/prompt-sdk/release-readiness.test.js +++ b/tests/prompt-sdk/release-readiness.test.js @@ -2,14 +2,44 @@ import test from 'node:test'; import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import * as sdk from '../../src/prompt-sdk/index.js'; -import { releaseReadiness } from '../../scripts/check-sdk-release.mjs'; +import { releaseReadiness, checkReleaseInputs } from '../../scripts/check-sdk-release.mjs'; +import { RELEASE_CONTRACTS } from '../../src/prompt-sdk/release-contracts.js'; test('documented v1 API inventory exactly matches public exports', async () => { const inventory = JSON.parse(await readFile(new URL('../../release/api-v1.json', import.meta.url))); assert.deepEqual(Object.keys(sdk).sort(), inventory); }); -test('unpublished SDK is explicitly blocked from stable release', async () => { +test('SDK adopts all five verified immutable releases', async () => { const report = await releaseReadiness(); - assert.equal(report.ready, false); - assert.ok(report.blockers.some(message => message.includes('immutable'))); - assert.ok(report.blockers.some(message => message.includes('provisional'))); + assert.deepEqual(report, { ready: true, blockers: [] }); +}); +test('release checks reject missing, duplicated, malformed and unverified lock data', async () => { + const lock = JSON.parse(await readFile(new URL('../../release/contract-lock.json', import.meta.url))); + const pkg = { version: '1.0.0' }; + for (const mutate of [ + value => { value.contracts = []; }, + value => { value.contracts[0] = value.contracts[1]; }, + value => { value.contracts[0] = null; }, + value => { value.contracts[0].publication.immutable = false; }, + value => { value.contracts[0].commit = 'a'.repeat(40); }, + value => { value.contracts[0].assets[0].sha256 = 'sha256:' + '0'.repeat(64); }, + value => { value.contracts[0].assets = {}; } + ]) { + const candidate = structuredClone(lock); mutate(candidate); + assert.equal(checkReleaseInputs({ pkg, lock: candidate }).ready, false); + } + const pins = structuredClone(RELEASE_CONTRACTS); + pins['execution-provenance'].status = 'provisional-unreleased'; + assert.equal(checkReleaseInputs({ pkg, lock, pins }).ready, false); + assert.equal(checkReleaseInputs({ pkg: { version: '0.1.0' }, lock }).ready, false); + assert.equal(checkReleaseInputs({ pkg }).ready, false); +}); +test('all compiled validators name the released source commit and schema digest', async () => { + for (const [name, file] of Object.entries({ + 'prompt-definition': 'prompt-definition', 'provider-execution': 'provider-execution', + 'context-package': 'context-package', 'structured-output': 'structured-output', 'execution-provenance': 'provenance' + })) { + const text = await readFile(new URL('../../src/prompt-sdk/generated/' + file + '-v1-schema.js', import.meta.url), 'utf8'); + assert.ok(text.includes(RELEASE_CONTRACTS[name].commit)); + assert.ok(text.includes(RELEASE_CONTRACTS[name].schema_sha256.slice(7))); + } }); diff --git a/tests/prompt-sdk/validate.test.js b/tests/prompt-sdk/validate.test.js index 99b4f42..0957602 100644 --- a/tests/prompt-sdk/validate.test.js +++ b/tests/prompt-sdk/validate.test.js @@ -17,7 +17,7 @@ test("accepts a schema-conformant, semantically complete prompt", () => { const result = validatePromptDefinition(valid); assert.equal(result.valid, true); assert.deepEqual(result.summary, { errors: 0, warnings: 0 }); - assert.equal(result.contract.commit, "bd31b6249e068d3317306afb857d68024f2929be"); + assert.equal(result.contract.commit, "62e78b606986988518b9dc502c25ae1cd189684a"); assert.equal(result.contract.schema_byte_size, 18384); }); @@ -139,14 +139,16 @@ test("checks capability and extension compatibility", () => { assert.ok(codes(result).includes("UNSUPPORTED_OPTIONAL_EXTENSION")); }); -test("requires structured-output for JSON output and blocks stable use before contract release", () => { +test("requires structured-output for JSON output while permitting stable released contracts", () => { const definition = clone(); definition.output = { kind: "json", media_type: "application/json", description: "Synthetic JSON output." }; definition.lifecycle.status = "stable"; const result = validatePromptDefinition(definition); assert.equal(result.valid, false); assert.ok(codes(result).includes("JSON_OUTPUT_MISSING_CAPABILITY")); - assert.ok(codes(result).includes("UNRELEASED_CONTRACT_STABLE_LIFECYCLE")); + assert.ok(!codes(result).includes("UNRELEASED_CONTRACT_STABLE_LIFECYCLE")); + definition.capabilities.required.push("structured-output"); + assert.equal(validatePromptDefinition(definition).valid, true); }); test("detects exact duplicate prompt identity/version across a set", () => {