@colophon-claims/verify 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +35 -0
  2. package/dist/admission/application.d.ts +18 -0
  3. package/dist/admission/application.js +53 -0
  4. package/dist/admission/contracts.d.ts +264 -0
  5. package/dist/admission/contracts.js +290 -0
  6. package/dist/admission/index.d.ts +5 -0
  7. package/dist/admission/index.js +5 -0
  8. package/dist/admission/intake.d.ts +75 -0
  9. package/dist/admission/intake.js +70 -0
  10. package/dist/admission/result-evaluation.d.ts +18 -0
  11. package/dist/admission/result-evaluation.js +71 -0
  12. package/dist/admission/screening-sample.d.ts +56 -0
  13. package/dist/admission/screening-sample.js +126 -0
  14. package/dist/admission/verification.d.ts +89 -0
  15. package/dist/admission/verification.js +709 -0
  16. package/dist/anchor/check.d.ts +95 -0
  17. package/dist/anchor/check.js +146 -0
  18. package/dist/anchor/ports.d.ts +6 -0
  19. package/dist/anchor/ports.js +354 -0
  20. package/dist/assets.d.ts +33 -0
  21. package/dist/assets.js +885 -0
  22. package/dist/bin.d.ts +2 -0
  23. package/dist/bin.js +20 -0
  24. package/dist/cli.d.ts +14 -0
  25. package/dist/cli.js +205 -0
  26. package/dist/comparison.d.ts +64 -0
  27. package/dist/comparison.js +235 -0
  28. package/dist/index.d.ts +23 -0
  29. package/dist/index.js +23 -0
  30. package/dist/manifest.d.ts +54 -0
  31. package/dist/manifest.js +240 -0
  32. package/dist/materialize.d.ts +4 -0
  33. package/dist/materialize.js +13 -0
  34. package/dist/profile/admission-receipts.d.ts +11 -0
  35. package/dist/profile/admission-receipts.js +24 -0
  36. package/dist/profile/anchor-claims.d.ts +157 -0
  37. package/dist/profile/anchor-claims.js +330 -0
  38. package/dist/profile/artifacts.d.ts +261 -0
  39. package/dist/profile/artifacts.js +139 -0
  40. package/dist/profile/assembly-ports.d.ts +19 -0
  41. package/dist/profile/assembly-ports.js +42 -0
  42. package/dist/profile/binary-judge-manifest.d.ts +121 -0
  43. package/dist/profile/binary-judge-manifest.js +106 -0
  44. package/dist/profile/binary-qualification.d.ts +9 -0
  45. package/dist/profile/binary-qualification.js +52 -0
  46. package/dist/profile/branding-assets.d.ts +5 -0
  47. package/dist/profile/branding-assets.js +5 -0
  48. package/dist/profile/branding.d.ts +24 -0
  49. package/dist/profile/branding.js +14 -0
  50. package/dist/profile/claim-consistency.d.ts +26 -0
  51. package/dist/profile/claim-consistency.js +91 -0
  52. package/dist/profile/claim.d.ts +324 -0
  53. package/dist/profile/claim.js +724 -0
  54. package/dist/profile/errors.d.ts +49 -0
  55. package/dist/profile/errors.js +78 -0
  56. package/dist/profile/inspect-assurance.d.ts +16 -0
  57. package/dist/profile/inspect-assurance.js +30 -0
  58. package/dist/profile/inspect-disclosure.d.ts +28 -0
  59. package/dist/profile/inspect-disclosure.js +54 -0
  60. package/dist/profile/inspect-manifest.d.ts +706 -0
  61. package/dist/profile/inspect-manifest.js +397 -0
  62. package/dist/profile/isolation.d.ts +21 -0
  63. package/dist/profile/isolation.js +31 -0
  64. package/dist/profile/pinning-evidence.d.ts +41 -0
  65. package/dist/profile/pinning-evidence.js +43 -0
  66. package/dist/profile/ports.d.ts +3 -0
  67. package/dist/profile/ports.js +11 -0
  68. package/dist/profile/preview-log.d.ts +4 -0
  69. package/dist/profile/preview-log.js +3 -0
  70. package/dist/profile/run-results.d.ts +17 -0
  71. package/dist/profile/run-results.js +23 -0
  72. package/dist/profile/signing.d.ts +10 -0
  73. package/dist/profile/signing.js +46 -0
  74. package/dist/profile/trust.d.ts +13 -0
  75. package/dist/profile/trust.js +35 -0
  76. package/dist/profile/venue.d.ts +2 -0
  77. package/dist/profile/venue.js +2 -0
  78. package/dist/profile/verdict.d.ts +28 -0
  79. package/dist/profile/verdict.js +51 -0
  80. package/dist/reader-instructions.d.ts +41 -0
  81. package/dist/reader-instructions.js +52 -0
  82. package/dist/schema.d.ts +370 -0
  83. package/dist/schema.js +484 -0
  84. package/dist/verify.d.ts +72 -0
  85. package/dist/verify.js +1573 -0
  86. package/dist/version.d.ts +2 -0
  87. package/dist/version.js +2 -0
  88. package/package.json +63 -3
  89. package/schemas/assembly-row.schema.json +194 -0
  90. package/schemas/bundle-manifest.schema.json +23 -0
  91. package/schemas/claim-package.schema.json +279 -0
  92. package/schemas/dsse-envelope.schema.json +25 -0
  93. package/schemas/evidence-catalog.schema.json +43 -0
  94. package/schemas/public-trust.schema.json +44 -0
  95. package/schemas/verdict-catalog.schema.json +27 -0
  96. package/scripts/external-verify.py +238 -0
@@ -0,0 +1,397 @@
1
+ import { z } from "zod";
2
+ import { VerdictRuleSchema } from "@jinn-network/task-execution-profiles";
3
+ export const INSPECT_ADAPTER_ID = "inspect";
4
+ export const SUPPORTED_INSPECT_VERSION = "0.3.255";
5
+ export const SUPPORTED_INSPECT_WHEEL_SHA256 = "958e773a8d0cc8873314e3f96d1143cbb4e0b9e4bacc2cbec6b4d5576ceecf2c";
6
+ export const SUPPORTED_INSPECT_EVALS_VERSION = "0.16.0";
7
+ export const SUPPORTED_OPENAI_SDK_VERSION = "2.53.0";
8
+ export const SUPPORTED_OCI_PYTHON_VERSION = "3.11.9";
9
+ export const SUPPORTED_OCI_PLATFORM = "linux/amd64";
10
+ export const INSPECT_SELECTION_SCHEMA = "jinn.network/benchmark-product/inspect-selection/1";
11
+ export const INSPECT_SANDBOX_SELECTION_SCHEMA = "jinn.network/benchmark-product/inspect-selection/2";
12
+ export const INSPECT_MULTI_SCORER_SELECTION_SCHEMA = "jinn.network/benchmark-product/inspect-selection/3";
13
+ export const INSPECT_MULTI_SCORER_SANDBOX_SELECTION_SCHEMA = "jinn.network/benchmark-product/inspect-selection/4";
14
+ export const INSPECT_SANDBOX_PROTOCOL = "jinn.network/inspect-sandbox-host/1";
15
+ export const INSPECT_SANDBOX_PROVIDER = "jinn-oci";
16
+ export const INSPECT_SANDBOX_PACKAGE_VERSION = "0.1.0";
17
+ export const INSPECT_ARM_REQUIREMENT_KEY = "jinn.network/inspect-arm";
18
+ const Sha256Schema = z.string().regex(/^[a-f0-9]{64}$/);
19
+ const JsonScalarSchema = z.union([z.string(), z.number().finite(), z.boolean(), z.null()]);
20
+ const SafeJsonSchema = z.lazy(() => z.union([
21
+ JsonScalarSchema,
22
+ z.array(SafeJsonSchema),
23
+ z.record(z.string(), SafeJsonSchema),
24
+ ]));
25
+ const PublicMeasurementNameSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._-]{0,63}$/);
26
+ export const InspectScoreProjectionSchema = z.object({
27
+ measurementName: PublicMeasurementNameSchema,
28
+ scorerName: z.string().min(1),
29
+ subScoreKey: z.string().min(1).optional(),
30
+ passValue: JsonScalarSchema,
31
+ }).strict();
32
+ function verdictRuleMeasurements(rule, names = new Set()) {
33
+ if ("threshold" in rule)
34
+ names.add(rule.threshold.measurement);
35
+ else if ("all" in rule)
36
+ rule.all.forEach((child) => verdictRuleMeasurements(child, names));
37
+ else if ("any" in rule)
38
+ rule.any.forEach((child) => verdictRuleMeasurements(child, names));
39
+ else if ("not" in rule)
40
+ verdictRuleMeasurements(rule.not, names);
41
+ else if ("inconclusiveWhen" in rule)
42
+ verdictRuleMeasurements(rule.inconclusiveWhen, names);
43
+ return names;
44
+ }
45
+ function validateScoringPolicy(scoring, context) {
46
+ const projectionNames = scoring.projections.map((projection) => projection.measurementName);
47
+ if (new Set(projectionNames).size !== projectionNames.length) {
48
+ context.addIssue({ code: "custom", path: ["projections"], message: "measurement names must be unique" });
49
+ }
50
+ const referencedNames = verdictRuleMeasurements(scoring.verdictRule);
51
+ const projected = new Set(projectionNames);
52
+ if (referencedNames.size !== projected.size
53
+ || [...referencedNames].some((name) => !projected.has(name))) {
54
+ context.addIssue({
55
+ code: "custom",
56
+ path: ["verdictRule"],
57
+ message: "verdictRule measurement references must exactly match the configured projections",
58
+ });
59
+ }
60
+ }
61
+ export const InspectScoringRequestSchema = z.object({
62
+ projections: z.array(InspectScoreProjectionSchema).min(1),
63
+ verdictRule: VerdictRuleSchema,
64
+ }).strict().superRefine(validateScoringPolicy);
65
+ export const InspectArmConfigurationSchema = z.object({
66
+ armId: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/),
67
+ model: z.string().min(1),
68
+ modelArgs: z.record(z.string(), SafeJsonSchema).optional(),
69
+ modelRoles: z.record(z.string(), z.string().min(1)).optional(),
70
+ provider: z.object({
71
+ surface: z.literal("openai-responses"),
72
+ upstreamModel: z.literal("gpt-5.6-luna"),
73
+ reasoningEffort: z.enum(["none", "low"]),
74
+ maxOutputTokens: z.literal(128),
75
+ store: z.literal(false),
76
+ background: z.literal(false),
77
+ stream: z.literal(false),
78
+ serviceTier: z.literal("default"),
79
+ tools: z.tuple([]),
80
+ fallbackModels: z.tuple([]),
81
+ retries: z.literal(0),
82
+ persistedConversation: z.literal(false),
83
+ metadata: z.null(),
84
+ promptCacheIdentifier: z.null(),
85
+ }).strict().optional(),
86
+ }).superRefine((arm, context) => {
87
+ if (arm.provider === undefined)
88
+ return;
89
+ if (arm.model !== "jinn-openai/gpt-5.6-luna") {
90
+ context.addIssue({ code: "custom", path: ["model"], message: "provider-backed arms require jinn-openai/gpt-5.6-luna" });
91
+ }
92
+ if (arm.modelArgs !== undefined || arm.modelRoles !== undefined) {
93
+ context.addIssue({ code: "custom", message: "provider-backed arms refuse modelArgs and modelRoles outside the sealed generation block" });
94
+ }
95
+ });
96
+ export const InspectRunOptionsSchema = z.object({
97
+ sampleId: z.union([z.string().min(1), z.number().int()]).optional(),
98
+ maxSamples: z.number().int().positive().optional(),
99
+ maxSubprocesses: z.number().int().positive().optional(),
100
+ maxSandboxes: z.number().int().positive().optional(),
101
+ retryOnError: z.number().int().nonnegative().optional(),
102
+ failOnError: z.union([z.boolean(), z.number().int().nonnegative()]).optional(),
103
+ messageLimit: z.number().int().positive().optional(),
104
+ tokenLimit: z.union([z.number().int().positive(), z.string().min(1)]).optional(),
105
+ timeLimit: z.number().int().positive().optional(),
106
+ }).strict();
107
+ const InspectOciIsolationSchema = z.object({
108
+ readOnlyRoot: z.literal(true),
109
+ network: z.enum(["none", "broker-only"]),
110
+ capabilities: z.tuple([]),
111
+ noNewPrivileges: z.literal(true),
112
+ cpuCount: z.number().positive(),
113
+ memoryBytes: z.number().int().positive(),
114
+ pidsLimit: z.number().int().positive(),
115
+ scratchBytes: z.number().int().positive(),
116
+ user: z.string().regex(/^[0-9]+:[0-9]+$/),
117
+ mounts: z.union([
118
+ z.tuple([
119
+ z.literal("project:ro"),
120
+ z.literal("dataset-cache:ro"),
121
+ z.literal("attempt-input:ro"),
122
+ z.literal("attempt-output:rw"),
123
+ ]),
124
+ z.tuple([
125
+ z.literal("project:ro"),
126
+ z.literal("dataset-cache:ro"),
127
+ z.literal("attempt-input:ro"),
128
+ z.literal("attempt-output:rw"),
129
+ z.literal("broker-capability:ro"),
130
+ ]),
131
+ ]),
132
+ }).strict();
133
+ const InspectBrokerPolicySchema = z.object({
134
+ protocol: z.literal("jinn.network/model-broker/1"),
135
+ requestEndpoint: z.literal("https://api.openai.com/v1/responses"),
136
+ network: z.literal("bridge-plus-private-internal"),
137
+ secretMount: z.literal("credential-volume:/run/secrets:ro"),
138
+ capabilityMount: z.literal("capability-volume:/run/jinn:ro"),
139
+ readOnlyRoot: z.literal(true),
140
+ capabilities: z.tuple([]),
141
+ noNewPrivileges: z.literal(true),
142
+ cpuCount: z.literal(1),
143
+ memoryBytes: z.literal(268_435_456),
144
+ pidsLimit: z.literal(32),
145
+ scratchBytes: z.literal(67_108_864),
146
+ }).strict();
147
+ export const InspectSandboxPolicySchema = z.object({
148
+ provider: z.literal(INSPECT_SANDBOX_PROVIDER),
149
+ platform: z.literal(SUPPORTED_OCI_PLATFORM),
150
+ user: z.literal("65532:65532"),
151
+ readOnlyRoot: z.literal(true),
152
+ network: z.literal("none"),
153
+ capabilities: z.tuple([]),
154
+ noNewPrivileges: z.literal(true),
155
+ cpuCount: z.literal(1),
156
+ memoryBytes: z.literal(536_870_912),
157
+ pidsLimit: z.literal(32),
158
+ scratchBytes: z.literal(268_435_456),
159
+ maxEnvironments: z.literal(1),
160
+ maxOperations: z.literal(64),
161
+ commandTimeoutSeconds: z.literal(30),
162
+ totalTimeoutSeconds: z.literal(120),
163
+ maxInputBytes: z.literal(16 * 1024 * 1024),
164
+ maxOutputBytes: z.literal(20 * 1024 * 1024),
165
+ maxReadFileBytes: z.literal(100 * 1024 * 1024),
166
+ }).strict();
167
+ const InspectSandboxRuntimeSchema = z.object({
168
+ protocol: z.literal(INSPECT_SANDBOX_PROTOCOL),
169
+ provider: z.literal(INSPECT_SANDBOX_PROVIDER),
170
+ packageVersion: z.literal(INSPECT_SANDBOX_PACKAGE_VERSION),
171
+ providerSourceSha256: Sha256Schema,
172
+ controllerSourceSha256: Sha256Schema,
173
+ imageDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/),
174
+ platform: z.literal(SUPPORTED_OCI_PLATFORM),
175
+ policySha256: Sha256Schema,
176
+ policy: InspectSandboxPolicySchema,
177
+ }).strict();
178
+ export const InspectOciRuntimeIdentitySchema = z.object({
179
+ kind: z.literal("oci"),
180
+ imageDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/),
181
+ platform: z.literal(SUPPORTED_OCI_PLATFORM),
182
+ inspectEvalsVersion: z.literal(SUPPORTED_INSPECT_EVALS_VERSION),
183
+ openaiSdkVersion: z.literal(SUPPORTED_OPENAI_SDK_VERSION),
184
+ workerSourceSha256: Sha256Schema,
185
+ runtimeHostSourceSha256: Sha256Schema,
186
+ brokerSourceSha256: Sha256Schema,
187
+ modelProviderSourceSha256: Sha256Schema,
188
+ dockerExecutableSha256: Sha256Schema,
189
+ dockerEngineVersion: z.string().min(1),
190
+ dockerApiVersion: z.string().min(1),
191
+ datasetCacheSha256: Sha256Schema,
192
+ isolation: InspectOciIsolationSchema,
193
+ broker: InspectBrokerPolicySchema.optional(),
194
+ sandbox: InspectSandboxRuntimeSchema.optional(),
195
+ }).strict();
196
+ const InspectResolvedSandboxSchema = z.object({
197
+ type: z.literal(INSPECT_SANDBOX_PROVIDER),
198
+ config: z.object({
199
+ schema: z.literal("jinn.network/benchmark-product/inspect-sandbox/1"),
200
+ imageDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/),
201
+ platform: z.literal(SUPPORTED_OCI_PLATFORM),
202
+ policySha256: Sha256Schema,
203
+ }).strict(),
204
+ }).strict();
205
+ const InspectDeclaredSandboxSchema = z.object({
206
+ type: z.literal("docker"),
207
+ config: z.null(),
208
+ }).strict();
209
+ const InspectSelectionManifestBaseFields = {
210
+ runtime: z.object({
211
+ adapterVersion: z.literal("1"),
212
+ workerSha256: Sha256Schema,
213
+ inspectVersion: z.literal(SUPPORTED_INSPECT_VERSION),
214
+ inspectWheelSha256: z.literal(SUPPORTED_INSPECT_WHEEL_SHA256),
215
+ pythonVersion: z.string().regex(/^3\.1[1-9](?:\.|$)/),
216
+ pythonExecutableSha256: Sha256Schema,
217
+ pythonEnvironmentSha256: Sha256Schema,
218
+ inspectDistributionSha256: Sha256Schema,
219
+ execution: InspectOciRuntimeIdentitySchema.optional(),
220
+ }).superRefine((runtime, context) => {
221
+ if (runtime.execution === undefined)
222
+ return;
223
+ if (runtime.pythonVersion !== SUPPORTED_OCI_PYTHON_VERSION) {
224
+ context.addIssue({ code: "custom", path: ["pythonVersion"], message: `OCI execution requires Python ${SUPPORTED_OCI_PYTHON_VERSION}` });
225
+ }
226
+ if (runtime.execution.workerSourceSha256 !== runtime.workerSha256) {
227
+ context.addIssue({ code: "custom", path: ["execution", "workerSourceSha256"], message: "OCI worker source digest must match the executed worker" });
228
+ }
229
+ }),
230
+ task: z.object({
231
+ reference: z.string().min(1),
232
+ args: z.record(z.string(), SafeJsonSchema),
233
+ resolvedName: z.string().min(1),
234
+ resolvedVersion: z.string().nullable(),
235
+ declaredSandbox: InspectDeclaredSandboxSchema.optional(),
236
+ resolvedSandbox: z.union([z.null(), InspectResolvedSandboxSchema]),
237
+ source: z.object({
238
+ kind: z.enum(["project-file", "installed-package"]),
239
+ path: z.string().min(1),
240
+ sha256: Sha256Schema,
241
+ projectTreeSha256: Sha256Schema.optional(),
242
+ distribution: z.object({
243
+ name: z.string().min(1),
244
+ version: z.string().min(1),
245
+ sha256: Sha256Schema,
246
+ }).optional(),
247
+ }).superRefine((source, context) => {
248
+ if (source.kind === "project-file" && source.projectTreeSha256 === undefined) {
249
+ context.addIssue({ code: "custom", message: "project-file sources require a project tree digest" });
250
+ }
251
+ if (source.kind === "installed-package" && source.distribution === undefined) {
252
+ context.addIssue({ code: "custom", message: "installed-package sources require distribution identity" });
253
+ }
254
+ }),
255
+ dataset: z.object({
256
+ name: z.string().nullable(),
257
+ location: z.string().nullable(),
258
+ samples: z.number().int().nonnegative().nullable(),
259
+ selectedSampleId: z.union([z.string().min(1), z.number().int()]).optional(),
260
+ orderedSampleSha256: Sha256Schema.optional(),
261
+ }),
262
+ }),
263
+ arms: z.array(InspectArmConfigurationSchema).min(2),
264
+ runOptions: InspectRunOptionsSchema,
265
+ };
266
+ const LegacyInspectSelectionManifestSchema = z.object({
267
+ schema: z.union([z.literal(INSPECT_SELECTION_SCHEMA), z.literal(INSPECT_SANDBOX_SELECTION_SCHEMA)]),
268
+ ...InspectSelectionManifestBaseFields,
269
+ scorer: z.object({
270
+ name: z.string().min(1),
271
+ passValue: JsonScalarSchema,
272
+ definition: SafeJsonSchema,
273
+ }).strict(),
274
+ }).strict();
275
+ const ResolvedInspectScoringSchema = z.object({
276
+ projections: z.array(InspectScoreProjectionSchema).min(1),
277
+ verdictRule: VerdictRuleSchema,
278
+ inspectMetrics: SafeJsonSchema.nullable(),
279
+ inspectEpochReducers: z.array(z.string().min(1)).nullable(),
280
+ }).strict().superRefine(validateScoringPolicy);
281
+ const MultiScorerInspectSelectionManifestSchema = z.object({
282
+ schema: z.union([
283
+ z.literal(INSPECT_MULTI_SCORER_SELECTION_SCHEMA),
284
+ z.literal(INSPECT_MULTI_SCORER_SANDBOX_SELECTION_SCHEMA),
285
+ ]),
286
+ ...InspectSelectionManifestBaseFields,
287
+ scorers: z.array(z.object({
288
+ name: z.string().min(1),
289
+ definition: SafeJsonSchema,
290
+ }).strict()).min(1),
291
+ scoring: ResolvedInspectScoringSchema,
292
+ }).strict().superRefine((manifest, context) => {
293
+ const scorerNames = manifest.scorers.map((scorer) => scorer.name);
294
+ if (new Set(scorerNames).size !== scorerNames.length) {
295
+ context.addIssue({ code: "custom", path: ["scorers"], message: "resolved Inspect scorer names must be distinct" });
296
+ }
297
+ const knownScorers = new Set(scorerNames);
298
+ manifest.scoring.projections.forEach((projection, index) => {
299
+ if (!knownScorers.has(projection.scorerName)) {
300
+ context.addIssue({
301
+ code: "custom",
302
+ path: ["scoring", "projections", index, "scorerName"],
303
+ message: "projection must reference a resolved Inspect scorer",
304
+ });
305
+ }
306
+ });
307
+ });
308
+ export const InspectSelectionManifestSchema = z.union([
309
+ LegacyInspectSelectionManifestSchema,
310
+ MultiScorerInspectSelectionManifestSchema,
311
+ ]).superRefine((manifest, context) => {
312
+ const providerBacked = manifest.arms.some((arm) => arm.provider !== undefined);
313
+ const sandboxed = manifest.runtime.execution?.sandbox !== undefined;
314
+ const sandboxSchema = manifest.schema === INSPECT_SANDBOX_SELECTION_SCHEMA
315
+ || manifest.schema === INSPECT_MULTI_SCORER_SANDBOX_SELECTION_SCHEMA;
316
+ if (sandboxed !== sandboxSchema) {
317
+ context.addIssue({ code: "custom", path: ["schema"], message: "sandbox selections require their sandbox selection schema" });
318
+ }
319
+ if (sandboxed !== (manifest.task.resolvedSandbox !== null) || sandboxed !== (manifest.task.declaredSandbox !== undefined)) {
320
+ context.addIssue({ code: "custom", path: ["task", "resolvedSandbox"], message: "sandbox runtime, declared sandbox, and effective sandbox must be present together" });
321
+ }
322
+ if (sandboxed) {
323
+ const selected = manifest.runtime.execution?.sandbox;
324
+ const resolved = manifest.task.resolvedSandbox;
325
+ if (selected === undefined
326
+ || resolved === null
327
+ || resolved.config.imageDigest !== selected.imageDigest
328
+ || resolved.config.platform !== selected.platform
329
+ || resolved.config.policySha256 !== selected.policySha256) {
330
+ context.addIssue({ code: "custom", path: ["task", "resolvedSandbox"], message: "effective sandbox must match the sealed sandbox runtime" });
331
+ }
332
+ }
333
+ if (manifest.runtime.execution === undefined) {
334
+ if (providerBacked) {
335
+ context.addIssue({ code: "custom", path: ["runtime", "execution"], message: "provider-backed arms require OCI execution" });
336
+ }
337
+ return;
338
+ }
339
+ if (manifest.runOptions.sampleId === undefined) {
340
+ context.addIssue({ code: "custom", path: ["runOptions", "sampleId"], message: "OCI execution requires one exact sampleId" });
341
+ }
342
+ if (manifest.task.dataset.selectedSampleId !== manifest.runOptions.sampleId) {
343
+ context.addIssue({ code: "custom", path: ["task", "dataset", "selectedSampleId"], message: "selected dataset sample must match runOptions.sampleId" });
344
+ }
345
+ if (manifest.task.dataset.orderedSampleSha256 === undefined) {
346
+ context.addIssue({ code: "custom", path: ["task", "dataset", "orderedSampleSha256"], message: "OCI execution requires an ordered selected-sample digest" });
347
+ }
348
+ if (providerBacked && manifest.runtime.execution.isolation.network !== "broker-only") {
349
+ context.addIssue({ code: "custom", path: ["runtime", "execution", "isolation", "network"], message: "provider-backed arms require the broker-only OCI network" });
350
+ }
351
+ if (providerBacked && !manifest.runtime.execution.isolation.mounts.includes("broker-capability:ro")) {
352
+ context.addIssue({ code: "custom", path: ["runtime", "execution", "isolation", "mounts"], message: "provider-backed arms require the per-attempt broker capability mount" });
353
+ }
354
+ if (providerBacked && manifest.runtime.execution.broker === undefined) {
355
+ context.addIssue({ code: "custom", path: ["runtime", "execution", "broker"], message: "provider-backed arms require the sealed broker policy" });
356
+ }
357
+ if (!providerBacked && manifest.runtime.execution.broker !== undefined) {
358
+ context.addIssue({ code: "custom", path: ["runtime", "execution", "broker"], message: "credential-free OCI selections cannot carry a broker policy" });
359
+ }
360
+ if (providerBacked && manifest.runOptions.retryOnError !== 0) {
361
+ context.addIssue({ code: "custom", path: ["runOptions", "retryOnError"], message: "provider-backed arms require retryOnError: 0" });
362
+ }
363
+ });
364
+ export function isInspectMultiScorerSelection(manifest) {
365
+ return manifest.schema === INSPECT_MULTI_SCORER_SELECTION_SCHEMA
366
+ || manifest.schema === INSPECT_MULTI_SCORER_SANDBOX_SELECTION_SCHEMA;
367
+ }
368
+ const SECRETISH_KEY = /(?:^|[_-])(api[_-]?key|authorization|credential|password|private[_-]?key|secret|token)(?:$|[_-])/iu;
369
+ const SECRETISH_VALUES = [
370
+ /(?:^|\s)sk-(?:proj-)?[A-Za-z0-9_-]{16,}(?:$|\s)/u,
371
+ /(?:^|\s)(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})(?:$|\s)/u,
372
+ /(?:^|\s)AKIA[A-Z0-9]{16}(?:$|\s)/u,
373
+ /-----BEGIN (?:EC |OPENSSH |RSA )?PRIVATE KEY-----/u,
374
+ /(?:^|\s)Bearer\s+[A-Za-z0-9._~-]{16,}(?:$|\s)/u,
375
+ /(?:^|\s)eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:$|\s)/u,
376
+ ];
377
+ /** Sealed runtime configuration is public-safe metadata, never a credential carrier. */
378
+ export function assertNoSecretLikeConfiguration(value, path = "selection") {
379
+ if (typeof value === "string") {
380
+ if (SECRETISH_VALUES.some((pattern) => pattern.test(value))) {
381
+ throw new TypeError(`${path} contains a credential-shaped value and cannot be sealed into an Inspect selection`);
382
+ }
383
+ return;
384
+ }
385
+ if (Array.isArray(value)) {
386
+ value.forEach((entry, index) => assertNoSecretLikeConfiguration(entry, `${path}.${index}`));
387
+ return;
388
+ }
389
+ if (value === null || typeof value !== "object")
390
+ return;
391
+ for (const [key, entry] of Object.entries(value)) {
392
+ if (SECRETISH_KEY.test(key)) {
393
+ throw new TypeError(`${path}.${key} looks credential-bearing and cannot be sealed into an Inspect selection`);
394
+ }
395
+ assertNoSecretLikeConfiguration(entry, `${path}.${key}`);
396
+ }
397
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Product-local isolation posture shared by venue capability advertisement and Matrix
3
+ * re-derivation. The local venue always retains its unrestricted native launchers; selecting
4
+ * an OCI Inspect runtime adds container execution rather than replacing those launchers.
5
+ */
6
+ export declare const VENUE_ISOLATION_POLICY: "unrestricted";
7
+ export declare const INSPECT_OCI_ISOLATION_POLICY: "oci-container";
8
+ type VenueIsolationPolicy = typeof VENUE_ISOLATION_POLICY | typeof INSPECT_OCI_ISOLATION_POLICY;
9
+ export interface VenueIsolationPosture {
10
+ readonly inventory: readonly VenueIsolationPolicy[];
11
+ readonly provisionerCapabilities: readonly string[];
12
+ }
13
+ /** Deduplicates into the product's stable policy order rather than caller or locale order. */
14
+ export declare function deriveVenueIsolationPosture(policies: readonly VenueIsolationPolicy[]): VenueIsolationPosture;
15
+ /**
16
+ * Converts the one policy sealed into a Run's submission baseline into the inventory of the
17
+ * product venue that can execute it. Unknown values gain no capability and therefore fall back
18
+ * to the native venue's conservative singleton inventory.
19
+ */
20
+ export declare function venueIsolationPostureForPolicy(policy: unknown): VenueIsolationPosture;
21
+ export {};
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Product-local isolation posture shared by venue capability advertisement and Matrix
3
+ * re-derivation. The local venue always retains its unrestricted native launchers; selecting
4
+ * an OCI Inspect runtime adds container execution rather than replacing those launchers.
5
+ */
6
+ export const VENUE_ISOLATION_POLICY = "unrestricted";
7
+ export const INSPECT_OCI_ISOLATION_POLICY = "oci-container";
8
+ const POLICY_ORDER = [
9
+ VENUE_ISOLATION_POLICY,
10
+ INSPECT_OCI_ISOLATION_POLICY,
11
+ ];
12
+ /** Deduplicates into the product's stable policy order rather than caller or locale order. */
13
+ export function deriveVenueIsolationPosture(policies) {
14
+ const selected = new Set(policies);
15
+ const inventory = POLICY_ORDER.filter((policy) => selected.has(policy));
16
+ return {
17
+ inventory,
18
+ provisionerCapabilities: inventory.map((policy) => policy === VENUE_ISOLATION_POLICY ? "process" : policy),
19
+ };
20
+ }
21
+ /**
22
+ * Converts the one policy sealed into a Run's submission baseline into the inventory of the
23
+ * product venue that can execute it. Unknown values gain no capability and therefore fall back
24
+ * to the native venue's conservative singleton inventory.
25
+ */
26
+ export function venueIsolationPostureForPolicy(policy) {
27
+ return deriveVenueIsolationPosture([
28
+ VENUE_ISOLATION_POLICY,
29
+ ...(policy === INSPECT_OCI_ISOLATION_POLICY ? [INSPECT_OCI_ISOLATION_POLICY] : []),
30
+ ]);
31
+ }
@@ -0,0 +1,41 @@
1
+ import type { LocalCellPinningEvidence } from "@jinn-network/benchmarking-local";
2
+ import { z } from "zod";
3
+ /**
4
+ * Product-private evidence artifact stored by digest in the existing sealed-bytes CAS.
5
+ *
6
+ * This is not a Benchmarking record kind and carries no publication-tier semantics. It is the
7
+ * exact assembly input needed to recompute the Matrix pinning statuses. An artifact must carry
8
+ * at least one real fact; an empty object cannot become an evidence reference.
9
+ */
10
+ export declare const RunPinningEvidenceSchema: z.ZodObject<{
11
+ submissionDigest: z.ZodString;
12
+ admission: z.ZodOptional<z.ZodObject<{
13
+ ready: z.ZodBoolean;
14
+ detail: z.ZodOptional<z.ZodString>;
15
+ checkedRequirementsDigest: z.ZodString;
16
+ }, z.core.$strict>>;
17
+ observations: z.ZodOptional<z.ZodArray<z.ZodObject<{
18
+ axis: z.ZodEnum<{
19
+ harness: "harness";
20
+ model: "model";
21
+ loadout: "loadout";
22
+ isolation: "isolation";
23
+ }>;
24
+ value: z.ZodUnknown;
25
+ source: z.ZodEnum<{
26
+ "runtime-observation": "runtime-observation";
27
+ materialization: "materialization";
28
+ "admission-probe": "admission-probe";
29
+ }>;
30
+ }, z.core.$strict>>>;
31
+ }, z.core.$strict>;
32
+ export type RunPinningEvidence = z.infer<typeof RunPinningEvidenceSchema>;
33
+ export interface VerifiedRunPinningCheck {
34
+ readonly ready: boolean;
35
+ readonly detail?: string;
36
+ readonly checkedRequirementsDigest: `sha256:${string}`;
37
+ }
38
+ export declare function canonicalRunPinningEvidenceBytes(check: VerifiedRunPinningCheck, submissionDigest: `sha256:${string}`): Uint8Array;
39
+ export declare function parseRunPinningEvidenceArtifact(bytes: Uint8Array): RunPinningEvidence;
40
+ export declare function pinningEvidenceFacts(artifact: RunPinningEvidence): LocalCellPinningEvidence;
41
+ export declare function parseRunPinningEvidence(bytes: Uint8Array): LocalCellPinningEvidence;
@@ -0,0 +1,43 @@
1
+ import { serializeCanonicalJson } from "@jinn-network/task-execution-protocol";
2
+ import { z } from "zod";
3
+ const Sha256RefSchema = z.string().regex(/^sha256:[a-f0-9]{64}$/u);
4
+ const RunPinningCheckSchema = z.object({
5
+ ready: z.boolean(),
6
+ detail: z.string().optional(),
7
+ checkedRequirementsDigest: Sha256RefSchema,
8
+ }).strict();
9
+ const AxisObservationSchema = z.object({
10
+ axis: z.enum(["harness", "model", "loadout", "isolation"]),
11
+ value: z.unknown(),
12
+ source: z.enum(["runtime-observation", "materialization", "admission-probe"]),
13
+ }).strict();
14
+ /**
15
+ * Product-private evidence artifact stored by digest in the existing sealed-bytes CAS.
16
+ *
17
+ * This is not a Benchmarking record kind and carries no publication-tier semantics. It is the
18
+ * exact assembly input needed to recompute the Matrix pinning statuses. An artifact must carry
19
+ * at least one real fact; an empty object cannot become an evidence reference.
20
+ */
21
+ export const RunPinningEvidenceSchema = z.object({
22
+ /** Exact accepted sealed Submission whose admission/observations this artifact describes. */
23
+ submissionDigest: Sha256RefSchema,
24
+ admission: RunPinningCheckSchema.optional(),
25
+ observations: z.array(AxisObservationSchema).min(1).optional(),
26
+ }).strict().refine((evidence) => evidence.admission !== undefined || evidence.observations !== undefined, "run-pinning evidence must carry an admission check or an observation");
27
+ export function canonicalRunPinningEvidenceBytes(check, submissionDigest) {
28
+ const evidence = RunPinningEvidenceSchema.parse({ submissionDigest, admission: check });
29
+ return serializeCanonicalJson(evidence);
30
+ }
31
+ export function parseRunPinningEvidenceArtifact(bytes) {
32
+ const value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
33
+ return RunPinningEvidenceSchema.parse(value);
34
+ }
35
+ export function pinningEvidenceFacts(artifact) {
36
+ return {
37
+ ...(artifact.admission === undefined ? {} : { admission: artifact.admission }),
38
+ ...(artifact.observations === undefined ? {} : { observations: artifact.observations }),
39
+ };
40
+ }
41
+ export function parseRunPinningEvidence(bytes) {
42
+ return pinningEvidenceFacts(parseRunPinningEvidenceArtifact(bytes));
43
+ }
@@ -0,0 +1,3 @@
1
+ import { type MethodPorts } from "@jinn-network/benchmarking-aggregate";
2
+ /** Public byte-resolver adapter used to re-verify a bundle-carried Report. */
3
+ export declare function buildMethodPortsFromResolver(resolveBytes: (digest: string) => Uint8Array | undefined): MethodPorts;
@@ -0,0 +1,11 @@
1
+ import { BENCHMARKING_METHOD_REGISTRY } from "@jinn-network/benchmarking-aggregate";
2
+ /** Public byte-resolver adapter used to re-verify a bundle-carried Report. */
3
+ export function buildMethodPortsFromResolver(resolveBytes) {
4
+ return {
5
+ registry: BENCHMARKING_METHOD_REGISTRY,
6
+ resolveVerdictBytes: resolveBytes,
7
+ resolveRunBytes: resolveBytes,
8
+ resolveTaskBytes: resolveBytes,
9
+ resolveRecordBytes: resolveBytes,
10
+ };
11
+ }
@@ -0,0 +1,4 @@
1
+ export declare function previewDisclosureSummaryLine(summary: {
2
+ readonly previewCount: number;
3
+ readonly timestamps: readonly string[];
4
+ }): string;
@@ -0,0 +1,3 @@
1
+ export function previewDisclosureSummaryLine(summary) {
2
+ return `${summary.previewCount} disposable preview rehearsal(s) of this benchmark ran before lock (at ${summary.timestamps.join(", ")}); preview results are rehearsal only and never entered official results.`;
3
+ }
@@ -0,0 +1,17 @@
1
+ import type { MatrixCell, RunRecord } from "@jinn-network/benchmarking-records";
2
+ import { type ClaimAnchor } from "./anchor-claims.js";
3
+ export declare const LOCAL_VENUE_LIMITS: readonly string[];
4
+ export declare function localVenueLimitsForRun(run: Pick<RunRecord, "policy">): readonly string[];
5
+ /** `anchors` is the same derived section the producer used (anchor-evidence §7.4); the conditional
6
+ * copy is the same pure function on both sides, so claim-consistency stays an exact byte-compare. */
7
+ export declare function buildLocalVenueHonesty(cells: readonly MatrixCell[], run: Pick<RunRecord, "policy">, anchors?: readonly ClaimAnchor[]): {
8
+ venue: "self-run";
9
+ preRegistration: "structural-and-append-order-only" | "structural-append-order-and-anchored-time";
10
+ limits: readonly string[];
11
+ unverifiableAxisCounts: {
12
+ harness: number;
13
+ model: number;
14
+ loadout: number;
15
+ isolation: number;
16
+ };
17
+ };
@@ -0,0 +1,23 @@
1
+ import { venueIsolationPostureForPolicy } from "./isolation.js";
2
+ import { anchoredPreRegistration, anchoredVenueLimits } from "./anchor-claims.js";
3
+ export const LOCAL_VENUE_LIMITS = [
4
+ "This is a local, self-run venue: the same operator controls task dispatch, execution, and evaluation.",
5
+ "Pre-registration here is a discipline enforced by this tool, not a proof against the run's own owner — nothing prevents the owner from having altered the record before publishing it.",
6
+ "Run pinning on the harness, model, and loadout axes is enforced by an admission gate at dispatch time. The isolation axis is vacuous: this venue's launchers admit only one isolation policy, so matching it proves nothing about containment strength.",
7
+ "Cost figures, where present, are self-reported by this venue and were never independently settled.",
8
+ "Distinct solver and evaluator identities prove agent-distinctness only — each evaluator identity is backed by its own workspace-minted signing key, whose verdict signature this product verifies — not that they are independent real-world parties.",
9
+ ];
10
+ const MULTI = "Run pinning on the harness, model, and loadout axes is enforced by an admission gate at dispatch time. The isolation axis is unverifiable: this configured venue admits both unrestricted and OCI-container execution, so its multi-policy inventory cannot establish containment from admission alone.";
11
+ export function localVenueLimitsForRun(run) {
12
+ return venueIsolationPostureForPolicy(run.policy.submissionBaseline?.isolationPolicy).inventory.length === 1 ? LOCAL_VENUE_LIMITS : [LOCAL_VENUE_LIMITS[0], LOCAL_VENUE_LIMITS[1], MULTI, ...LOCAL_VENUE_LIMITS.slice(3)];
13
+ }
14
+ /** `anchors` is the same derived section the producer used (anchor-evidence §7.4); the conditional
15
+ * copy is the same pure function on both sides, so claim-consistency stays an exact byte-compare. */
16
+ export function buildLocalVenueHonesty(cells, run, anchors = []) {
17
+ const counts = { harness: 0, model: 0, loadout: 0, isolation: 0 };
18
+ for (const cell of cells)
19
+ for (const axis of Object.keys(counts))
20
+ if (cell.verification[axis] === "unverifiable")
21
+ counts[axis] += 1;
22
+ return { venue: "self-run", preRegistration: anchoredPreRegistration(anchors), limits: anchoredVenueLimits(localVenueLimitsForRun(run), anchors), unverifiableAxisCounts: counts };
23
+ }
@@ -0,0 +1,10 @@
1
+ import { type KeyObject } from "node:crypto";
2
+ /** Derives the public did:key identifier from an Ed25519 SPKI. */
3
+ export declare function didKeyFromEd25519PublicKey(publicKey: KeyObject): string;
4
+ /** Fail-closed verification of the Report envelope against the bundle-carried author key. */
5
+ export declare function verifyReportEnvelopeSignatures(envelopeBytes: Uint8Array, key: {
6
+ readonly keyId: string;
7
+ readonly publicKey: KeyObject;
8
+ }): {
9
+ validSignerKeyids: readonly string[];
10
+ };