witnora 0.9.0 → 0.9.2

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.
@@ -18,10 +18,15 @@ export function parseSchemaId(input) {
18
18
  value === "evidence-strength" ||
19
19
  value === "action-mandate" ||
20
20
  value === "trusted-action-record" ||
21
- value === "trusted-run-receipt") {
21
+ value === "trusted-run-receipt" ||
22
+ value === "agent-mutation" ||
23
+ value === "evolution-manifest" ||
24
+ value === "permission-diff" ||
25
+ value === "promotion-grant" ||
26
+ value === "promotion-receipt") {
22
27
  return value;
23
28
  }
24
- throw new Error(`Unsupported schema "${value}". Use evidence-bundle, result, corpus-record, failure-review, classifier-eval, monitor-snapshot, robustness-lab, release-gate, assurance-report, assurance-delivery, assurance-scope, evidence-signature, evidence-strength, action-mandate, trusted-action-record, or trusted-run-receipt.`);
29
+ throw new Error(`Unsupported schema "${value}". Use evidence-bundle, result, corpus-record, failure-review, classifier-eval, monitor-snapshot, robustness-lab, release-gate, assurance-report, assurance-delivery, assurance-scope, evidence-signature, evidence-strength, action-mandate, trusted-action-record, trusted-run-receipt, agent-mutation, evolution-manifest, permission-diff, promotion-grant, or promotion-receipt.`);
25
30
  }
26
31
  export function validateAgentCertSchema(schema, input) {
27
32
  const errors = [];
@@ -63,6 +68,16 @@ export function validateAgentCertSchema(schema, input) {
63
68
  validateTrustedActionRecord(value, errors);
64
69
  if (schema === "trusted-run-receipt")
65
70
  validateTrustedRunReceipt(value, errors);
71
+ if (schema === "agent-mutation")
72
+ validateAgentMutation(value, errors);
73
+ if (schema === "evolution-manifest")
74
+ validateEvolutionManifest(value, errors);
75
+ if (schema === "permission-diff")
76
+ validatePermissionDiff(value, errors);
77
+ if (schema === "promotion-grant")
78
+ validatePromotionGrant(value, errors);
79
+ if (schema === "promotion-receipt")
80
+ validatePromotionReceipt(value, errors);
66
81
  }
67
82
  return { schema, valid: errors.length === 0, errors };
68
83
  }
@@ -388,6 +403,97 @@ function optionalSha256At(value, key, path, errors) {
388
403
  if (value[key] !== undefined && (typeof value[key] !== "string" || !/^[0-9a-f]{64}$/.test(value[key])))
389
404
  errors.push(`${path} must be a lowercase SHA-256 digest.`);
390
405
  }
406
+ function validateAgentMutation(value, errors) {
407
+ requiredConst(value, "schemaVersion", "witnora.agent_mutation.v0.1", errors);
408
+ for (const key of ["id", "projectId", "assuranceCaseId", "lineageId", "manifestSha256", "createdBy", "createdAt", "updatedAt"])
409
+ requiredString(value, key, errors);
410
+ requiredSha256At(value, "manifestSha256", "manifestSha256", errors);
411
+ requiredEnum(value, "status", ["REVIEW_REQUIRED", "GRANT_ISSUED", "GRANT_CLAIMED", "DEPLOYMENT_VERIFIED", "REJECTED"], errors);
412
+ const manifest = recordValue(value.manifest);
413
+ if (!manifest)
414
+ errors.push("manifest must be an object.");
415
+ else
416
+ validateEvolutionManifest(manifest, errors);
417
+ const permissionDiff = recordValue(value.permissionDiff);
418
+ if (!permissionDiff)
419
+ errors.push("permissionDiff must be an object.");
420
+ else
421
+ validatePermissionDiff(permissionDiff, errors);
422
+ validateTimestamp(value.createdAt, "createdAt", errors);
423
+ validateTimestamp(value.updatedAt, "updatedAt", errors);
424
+ }
425
+ function validateEvolutionManifest(value, errors) {
426
+ requiredConst(value, "schemaVersion", "witnora.evolution_manifest.v0.1", errors);
427
+ for (const key of ["mutationId", "lineageId", "assuranceCaseId", "createdAt"])
428
+ requiredString(value, key, errors);
429
+ for (const key of ["parent", "candidate", "changes", "buildProvenance", "capabilities", "target"])
430
+ requiredObject(value, key, errors);
431
+ for (const key of ["dataSources"])
432
+ requiredArray(value, key, errors);
433
+ for (const key of ["parent", "candidate"]) {
434
+ const artifact = recordValue(value[key]);
435
+ if (artifact) {
436
+ requiredStringAt(artifact, "id", `${key}.id`, errors);
437
+ requiredStringAt(artifact, "version", `${key}.version`, errors);
438
+ requiredSha256At(artifact, "digestSha256", `${key}.digestSha256`, errors);
439
+ }
440
+ }
441
+ const changes = recordValue(value.changes);
442
+ if (changes) {
443
+ const entries = ["code", "prompt", "model", "tools", "policy"].filter((key) => changes[key] !== undefined);
444
+ if (entries.length === 0)
445
+ errors.push("changes must declare at least one changed component.");
446
+ for (const key of entries) {
447
+ const change = recordValue(changes[key]);
448
+ if (!change)
449
+ errors.push(`changes.${key} must be an object.`);
450
+ else {
451
+ requiredSha256At(change, "afterSha256", `changes.${key}.afterSha256`, errors);
452
+ optionalSha256At(change, "beforeSha256", `changes.${key}.beforeSha256`, errors);
453
+ requiredStringAt(change, "summary", `changes.${key}.summary`, errors);
454
+ }
455
+ }
456
+ }
457
+ const capabilities = recordValue(value.capabilities);
458
+ if (capabilities) {
459
+ stringArray(capabilities.parent, "capabilities.parent", errors);
460
+ stringArray(capabilities.requested, "capabilities.requested", errors);
461
+ }
462
+ validateTimestamp(value.createdAt, "createdAt", errors);
463
+ }
464
+ function validatePermissionDiff(value, errors) {
465
+ requiredConst(value, "schemaVersion", "witnora.permission_inheritance_diff.v0.1", errors);
466
+ for (const key of ["inherited", "removed", "additions", "approvedAdditions", "deniedAdditions"]) {
467
+ requiredArray(value, key, errors);
468
+ stringArray(value[key], key, errors);
469
+ }
470
+ requiredConst(value, "defaultDecision", "DENY_NEW_CAPABILITIES", errors);
471
+ }
472
+ function validatePromotionGrant(value, errors) {
473
+ requiredConst(value, "schemaVersion", "witnora.promotion_grant.v0.1", errors);
474
+ for (const key of ["grantId", "projectId", "mutationId", "lineageId", "manifestSha256", "approvedBy", "rationale", "issuedAt", "notBefore", "expiresAt", "nonce"])
475
+ requiredString(value, key, errors);
476
+ requiredSha256At(value, "manifestSha256", "manifestSha256", errors);
477
+ for (const key of ["candidateArtifact", "target"])
478
+ requiredObject(value, key, errors);
479
+ requiredArray(value, "permittedCapabilities", errors);
480
+ stringArray(value.permittedCapabilities, "permittedCapabilities", errors);
481
+ if (value.maxUses !== 1)
482
+ errors.push("maxUses must equal 1.");
483
+ for (const key of ["issuedAt", "notBefore", "expiresAt"])
484
+ validateTimestamp(value[key], key, errors);
485
+ }
486
+ function validatePromotionReceipt(value, errors) {
487
+ requiredConst(value, "schemaVersion", "witnora.promotion_receipt.v0.1", errors);
488
+ for (const key of ["receiptId", "projectId", "mutationId", "grantId", "lineageId", "manifestSha256", "expectedArtifactDigestSha256", "observedArtifactDigestSha256", "deploymentUri", "verifiedAt"])
489
+ requiredString(value, key, errors);
490
+ for (const key of ["manifestSha256", "expectedArtifactDigestSha256", "observedArtifactDigestSha256"])
491
+ requiredSha256At(value, key, key, errors);
492
+ requiredEnum(value, "outcome", ["PROMOTED", "DIGEST_MISMATCH"], errors);
493
+ for (const key of ["observer", "continuousAssurance"])
494
+ requiredObject(value, key, errors);
495
+ validateTimestamp(value.verifiedAt, "verifiedAt", errors);
496
+ }
391
497
  function validateFailureReview(value, errors) {
392
498
  requiredConst(value, "schemaVersion", "1", errors);
393
499
  requiredConst(value, "kind", "agentcert.failure_review", errors);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "witnora",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "Witnora evidence, assurance release gates, runtime records, and regression CI for autonomous AI systems.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -13,6 +13,10 @@
13
13
  "bugs": {
14
14
  "url": "https://github.com/Kakarottoooo/agentcert/issues"
15
15
  },
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "provenance": true
19
+ },
16
20
  "keywords": [
17
21
  "agent",
18
22
  "browser-agent",