@fourier-labs/harbour-contracts 0.6.0 → 0.10.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 (134) hide show
  1. package/README.md +49 -4
  2. package/contract-release.json +146 -0
  3. package/dist/gen-ts/ai-budget-ledger-event.d.ts +21 -0
  4. package/dist/gen-ts/ai-budget-ledger-event.js +3 -0
  5. package/dist/gen-ts/ai-classification-stamp.d.ts +25 -0
  6. package/dist/gen-ts/ai-classification-stamp.js +3 -0
  7. package/dist/gen-ts/ai-composite-policy-digest-helper.d.ts +5 -0
  8. package/dist/gen-ts/ai-composite-policy-digest-helper.js +13 -0
  9. package/dist/gen-ts/ai-composite-policy-digest.d.ts +12 -0
  10. package/dist/gen-ts/ai-composite-policy-digest.js +3 -0
  11. package/dist/gen-ts/ai-deployment-gate-decision.d.ts +27 -0
  12. package/dist/gen-ts/ai-deployment-gate-decision.js +3 -0
  13. package/dist/gen-ts/ai-gateway-key-lifecycle-event.d.ts +49 -0
  14. package/dist/gen-ts/ai-gateway-key-lifecycle-event.js +16 -0
  15. package/dist/gen-ts/ai-governance-decision.d.ts +12 -0
  16. package/dist/gen-ts/ai-metering-policy.d.ts +16 -0
  17. package/dist/gen-ts/ai-metering-policy.js +3 -0
  18. package/dist/gen-ts/ai-pricing-revision.d.ts +29 -0
  19. package/dist/gen-ts/ai-pricing-revision.js +3 -0
  20. package/dist/gen-ts/ai-runtime-binding.d.ts +14 -0
  21. package/dist/gen-ts/ai-runtime-binding.js +3 -0
  22. package/dist/gen-ts/ai-runtime-contract.d.ts +15 -0
  23. package/dist/gen-ts/ai-trace-event-v2.d.ts +31 -0
  24. package/dist/gen-ts/ai-trace-event-v2.js +3 -0
  25. package/dist/gen-ts/ai-verification-evidence.d.ts +1 -0
  26. package/dist/gen-ts/binding-classification-digest-helper.d.ts +11 -0
  27. package/dist/gen-ts/binding-classification-digest-helper.js +47 -0
  28. package/dist/gen-ts/binding-classification-subject.d.ts +56 -0
  29. package/dist/gen-ts/binding-classification-subject.js +3 -0
  30. package/dist/gen-ts/contract-release.d.ts +7 -0
  31. package/dist/gen-ts/contract-release.js +9 -0
  32. package/dist/gen-ts/deploy-request.d.ts +52 -0
  33. package/dist/gen-ts/deploy-response.d.ts +8 -0
  34. package/dist/gen-ts/index.d.ts +15 -0
  35. package/dist/gen-ts/index.js +15 -0
  36. package/dist/gen-ts/promotion-request.d.ts +52 -0
  37. package/dist/gen-ts/promotion-response.d.ts +8 -0
  38. package/dist/gen-ts/sanitized-binding-digest-helper.d.ts +7 -0
  39. package/dist/gen-ts/sanitized-binding-digest-helper.js +58 -0
  40. package/dist/gen-ts/sanitized-binding-evidence.d.ts +47 -0
  41. package/dist/gen-ts/sanitized-binding-evidence.js +3 -0
  42. package/fixtures/ai/adversarial-binding-classification-value.json +28 -0
  43. package/fixtures/ai/adversarial-sanitized-binding-relabel.json +32 -0
  44. package/fixtures/ai/valid-binding-classification-subject.json +46 -0
  45. package/fixtures/ai/valid-blocked-trace-event.json +31 -0
  46. package/fixtures/ai/valid-budget-ledger-event.json +15 -0
  47. package/fixtures/ai/valid-classification-stamp.json +19 -0
  48. package/fixtures/ai/valid-composite-policy-digest.json +11 -0
  49. package/fixtures/ai/valid-deployment-gate-decision.json +18 -0
  50. package/fixtures/ai/valid-failed-trace-event.json +50 -0
  51. package/fixtures/ai/valid-gateway-key-lifecycle-event.json +16 -0
  52. package/fixtures/ai/valid-gateway-key-lookup.json +14 -0
  53. package/fixtures/ai/valid-governance-decision.json +53 -0
  54. package/fixtures/ai/valid-inventory.json +30 -0
  55. package/fixtures/ai/valid-metering-policy.json +8 -0
  56. package/fixtures/ai/valid-policy-snapshot.json +117 -0
  57. package/fixtures/ai/valid-pricing-revision.json +14 -0
  58. package/fixtures/ai/valid-runtime-binding.json +7 -0
  59. package/fixtures/ai/valid-runtime-contract.json +24 -0
  60. package/fixtures/ai/valid-sanitized-binding-evidence.json +32 -0
  61. package/fixtures/ai/valid-source-revision-digest.json +6 -0
  62. package/fixtures/ai/valid-trace-event-v2.json +24 -0
  63. package/fixtures/ai/valid-trace-event.json +41 -0
  64. package/fixtures/ai/valid-transform-event.json +32 -0
  65. package/fixtures/ai/valid-transform-result.json +23 -0
  66. package/fixtures/ai/valid-verification-evidence.json +33 -0
  67. package/gen-ts/ai-budget-ledger-event.ts +25 -0
  68. package/gen-ts/ai-callsite-inventory.ts +64 -0
  69. package/gen-ts/ai-classification-stamp.ts +28 -0
  70. package/gen-ts/ai-composite-policy-digest-helper.ts +18 -0
  71. package/gen-ts/ai-composite-policy-digest.ts +16 -0
  72. package/gen-ts/ai-deployment-gate-decision.ts +30 -0
  73. package/gen-ts/ai-gateway-key-lifecycle-event.ts +81 -0
  74. package/gen-ts/ai-gateway-key-lookup.ts +23 -0
  75. package/gen-ts/ai-gateway-key-token.ts +7 -0
  76. package/gen-ts/ai-governance-decision.ts +90 -0
  77. package/gen-ts/ai-metering-policy.ts +20 -0
  78. package/gen-ts/ai-policy-snapshot.ts +169 -0
  79. package/gen-ts/ai-pricing-revision.ts +33 -0
  80. package/gen-ts/ai-runtime-binding.ts +18 -0
  81. package/gen-ts/ai-runtime-contract.ts +46 -0
  82. package/gen-ts/ai-trace-event-v2.ts +35 -0
  83. package/gen-ts/ai-trace-event.ts +72 -0
  84. package/gen-ts/ai-transform-event.ts +51 -0
  85. package/gen-ts/ai-transform-result.ts +36 -0
  86. package/gen-ts/ai-verification-evidence.ts +54 -0
  87. package/gen-ts/api-error-response.ts +16 -0
  88. package/gen-ts/artifact-contract.ts +81 -0
  89. package/gen-ts/binding-classification-digest-helper.ts +44 -0
  90. package/gen-ts/binding-classification-subject.ts +60 -0
  91. package/gen-ts/contract-release.ts +10 -0
  92. package/gen-ts/data-dependency.ts +46 -0
  93. package/gen-ts/data-grant.ts +71 -0
  94. package/gen-ts/data-source.ts +78 -0
  95. package/gen-ts/deploy-request.ts +117 -0
  96. package/gen-ts/deploy-response.ts +33 -0
  97. package/gen-ts/deployment-environment.ts +7 -0
  98. package/gen-ts/deployment-source.ts +16 -0
  99. package/gen-ts/deployment-status-failure.ts +12 -0
  100. package/gen-ts/deployment-status-request.ts +11 -0
  101. package/gen-ts/deployment-status-response.ts +39 -0
  102. package/gen-ts/env-bindings.ts +64 -0
  103. package/gen-ts/error-category-registry.ts +108 -0
  104. package/gen-ts/error-category.ts +7 -0
  105. package/gen-ts/error-envelope.ts +49 -0
  106. package/gen-ts/index.ts +51 -0
  107. package/gen-ts/kvs-routing-entry.ts +30 -0
  108. package/gen-ts/promotion-request.ts +95 -0
  109. package/gen-ts/promotion-response.ts +28 -0
  110. package/gen-ts/sanitized-binding-digest-helper.ts +33 -0
  111. package/gen-ts/sanitized-binding-evidence.ts +51 -0
  112. package/gen-ts/secret-reference.ts +40 -0
  113. package/gen-ts/transform-report.ts +105 -0
  114. package/gen-ts/version-state-machine.ts +52 -0
  115. package/gen-ts/version-state.ts +19 -0
  116. package/package.json +8 -4
  117. package/schema/ai-budget-ledger-event.schema.json +29 -0
  118. package/schema/ai-classification-stamp.schema.json +40 -0
  119. package/schema/ai-composite-policy-digest.schema.json +27 -0
  120. package/schema/ai-deployment-gate-decision.schema.json +38 -0
  121. package/schema/ai-gateway-key-lifecycle-event.schema.json +61 -0
  122. package/schema/ai-governance-decision.schema.json +23 -2
  123. package/schema/ai-metering-policy.schema.json +18 -0
  124. package/schema/ai-pricing-revision.schema.json +38 -0
  125. package/schema/ai-runtime-binding.schema.json +26 -0
  126. package/schema/ai-runtime-contract.schema.json +24 -2
  127. package/schema/ai-trace-event-v2.schema.json +41 -0
  128. package/schema/ai-verification-evidence.schema.json +1 -0
  129. package/schema/binding-classification-subject.schema.json +119 -0
  130. package/schema/deploy-request.schema.json +37 -2
  131. package/schema/deploy-response.schema.json +11 -1
  132. package/schema/promotion-request.schema.json +5 -1
  133. package/schema/promotion-response.schema.json +11 -1
  134. package/schema/sanitized-binding-evidence.schema.json +102 -0
@@ -0,0 +1,25 @@
1
+ /* eslint-disable */
2
+ // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
+
4
+ export type AiBudgetIdentifier = string;
5
+ export type AiBudgetDigest = string;
6
+
7
+ /**
8
+ * Append-only v2 committed-exposure ledger event. Amounts are integer micro-USD and replay is identified by idempotencyKey.
9
+ */
10
+ export interface AiBudgetLedgerEvent {
11
+ schema: 'harbour.ai-budget-ledger-event/2.0';
12
+ eventId: AiBudgetIdentifier;
13
+ idempotencyKey: AiBudgetIdentifier;
14
+ budgetScope: AiBudgetIdentifier;
15
+ period: AiBudgetIdentifier;
16
+ eventType: 'RESERVED' | 'SETTLED' | 'REPAIRED' | 'ADJUSTED';
17
+ reservationId: AiBudgetIdentifier;
18
+ requestId?: AiBudgetIdentifier;
19
+ amountMicroUsd: number;
20
+ committedMicroUsdAfter: number;
21
+ pricingRevisionDigest?: AiBudgetDigest;
22
+ supersedesEventId?: AiBudgetIdentifier;
23
+ eventDigest: AiBudgetDigest;
24
+ occurredAt: string;
25
+ }
@@ -0,0 +1,64 @@
1
+ /* eslint-disable */
2
+ // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
+
4
+ export type AiInventoryIdentifier = string;
5
+ export type AiInventoryDigest = string;
6
+
7
+ /**
8
+ * Immutable, sanitized AI call-site discovery for one exact Harbour deployment version. Inventory records detection only; planning, transformation, and verification outcomes are separate append-only records.
9
+ */
10
+ export interface AiCallsiteInventory {
11
+ schema: 'harbour.ai-callsite-inventory/1.0';
12
+ tenantId: AiInventoryIdentifier;
13
+ appId: AiInventoryIdentifier;
14
+ environment: AiInventoryIdentifier;
15
+ versionId: string;
16
+ sourceRevision: string;
17
+ analyzerVersion: string;
18
+ coverage: 'complete_for_supported_sdks' | 'partial';
19
+ /**
20
+ * Required and never defaulted. Unavailable security evidence is not represented as a clean scan.
21
+ */
22
+ scanStatus: 'completed' | 'cybersecurity_scan_unavailable';
23
+ /**
24
+ * Canonical order is ascending by fingerprint, then path, then line. Producers MUST serialize this order before digesting or publishing the inventory.
25
+ *
26
+ * @maxItems 1000
27
+ */
28
+ callsites: AiInventoryCallsite[];
29
+ }
30
+ export interface AiInventoryCallsite {
31
+ fingerprint: AiInventoryDigest;
32
+ path: string;
33
+ sourceFileSha256: AiInventoryDigest;
34
+ line: number;
35
+ language: 'javascript' | 'typescript' | 'python' | 'go' | 'unknown';
36
+ sdk:
37
+ | 'openai'
38
+ | 'openai-compatible'
39
+ | 'anthropic'
40
+ | 'google-genai'
41
+ | 'mistral'
42
+ | 'bedrock'
43
+ | 'cohere'
44
+ | 'ollama'
45
+ | 'legacy-gemini'
46
+ | 'direct-provider-rest'
47
+ | 'unknown';
48
+ method: string;
49
+ requestedModel?: string;
50
+ strategy: 'deployment_injection' | 'deterministic_adapter' | 'unsupported';
51
+ status: 'detected';
52
+ /**
53
+ * @maxItems 64
54
+ */
55
+ securityFindingIds: string[];
56
+ evidence: AiInventoryEvidence;
57
+ }
58
+ export interface AiInventoryEvidence {
59
+ fingerprint: AiInventoryDigest;
60
+ /**
61
+ * Sanitized single-line evidence; never raw source or a prompt.
62
+ */
63
+ excerpt: string;
64
+ }
@@ -0,0 +1,28 @@
1
+ /* eslint-disable */
2
+ // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
+
4
+ /**
5
+ * Immutable, value-free classification evidence for one exact version and source revision. Unavailable evidence is explicit and never interpreted as clean.
6
+ */
7
+ export type AiClassificationStamp = {
8
+ schema: 'harbour.ai-classification-stamp/1.0';
9
+ stampId: AiClassificationIdentifier;
10
+ tenantId: AiClassificationIdentifier;
11
+ appId: AiClassificationIdentifier;
12
+ environment: AiClassificationIdentifier;
13
+ versionId: string;
14
+ sourceRevision: string;
15
+ status: 'AVAILABLE' | 'UNAVAILABLE';
16
+ classification?: 'Green' | 'Yellow' | 'Orange' | 'Red';
17
+ classifierId: AiClassificationIdentifier;
18
+ classifierVersion: string;
19
+ sourceDigest: AiClassificationDigest;
20
+ inventoryDigest?: AiClassificationDigest;
21
+ securityEvidenceDigest?: AiClassificationDigest;
22
+ evidenceDigest: AiClassificationDigest;
23
+ stampDigest: AiClassificationDigest;
24
+ unavailableReason?: AiClassificationIdentifier;
25
+ stampedAt: string;
26
+ };
27
+ export type AiClassificationIdentifier = string;
28
+ export type AiClassificationDigest = string;
@@ -0,0 +1,18 @@
1
+ /* eslint-disable */
2
+ // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
+
4
+ import { createHash } from 'node:crypto';
5
+ import type { AiCompositePolicyDigestInput } from './ai-composite-policy-digest.js';
6
+
7
+ const domain = "harbour.ai-composite-policy-digest/1";
8
+ const absent = "-";
9
+
10
+ /** Exact UTF-8 digest preimage. Field order is fixed by schema x-digest; absence is the literal hyphen. */
11
+ export function compositePolicyDigestPreimage(input: AiCompositePolicyDigestInput): string {
12
+ return [domain, input.baselineDigest ?? absent, input.classificationStampDigest ?? absent, input.tenantPolicyDigest ?? absent, input.applicationPolicyDigest ?? absent, input.versionOverrideDigest ?? absent].join('\n');
13
+ }
14
+
15
+ /** Canonical composite policy digest including sha256: prefix. */
16
+ export function computeCompositePolicyDigest(input: AiCompositePolicyDigestInput): string {
17
+ return 'sha256:' + createHash('sha256').update(compositePolicyDigestPreimage(input), 'utf8').digest('hex');
18
+ }
@@ -0,0 +1,16 @@
1
+ /* eslint-disable */
2
+ // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
+
4
+ export type AiCompositePolicyDigest = string;
5
+
6
+ /**
7
+ * The complete ordered identity input for one composite policy digest. The digest is SHA-256 over the UTF-8 preimage specified by x-digest; missing optional layer digests use the literal hyphen sentinel.
8
+ */
9
+ export interface AiCompositePolicyDigestInput {
10
+ schema: 'harbour.ai-composite-policy-digest/1.0';
11
+ baselineDigest: AiCompositePolicyDigest;
12
+ classificationStampDigest: AiCompositePolicyDigest;
13
+ tenantPolicyDigest?: AiCompositePolicyDigest;
14
+ applicationPolicyDigest?: AiCompositePolicyDigest;
15
+ versionOverrideDigest?: AiCompositePolicyDigest;
16
+ }
@@ -0,0 +1,30 @@
1
+ /* eslint-disable */
2
+ // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
+
4
+ /**
5
+ * One append-only deployment gate decision. Corrections are new records linked by supersedesDecisionId; existing records are never overwritten.
6
+ */
7
+ export type AiDeploymentGateDecision = {
8
+ schema: 'harbour.ai-deployment-gate-decision/1.0';
9
+ decisionId: AiGateIdentifier;
10
+ sequence: number;
11
+ supersedesDecisionId?: AiGateIdentifier;
12
+ tenantId: AiGateIdentifier;
13
+ appId: AiGateIdentifier;
14
+ environment: AiGateIdentifier;
15
+ versionId: string;
16
+ sourceRevision: string;
17
+ decision: 'PASS' | 'BLOCKED';
18
+ /**
19
+ * @maxItems 64
20
+ */
21
+ reasonCodes: AiGateIdentifier[];
22
+ classificationStampDigest: AiGateDigest;
23
+ planDigest: AiGateDigest;
24
+ policyDigest: AiGateDigest;
25
+ evidenceDigest: AiGateDigest;
26
+ decisionDigest: AiGateDigest;
27
+ decidedAt: string;
28
+ };
29
+ export type AiGateIdentifier = string;
30
+ export type AiGateDigest = string;
@@ -0,0 +1,81 @@
1
+ /* eslint-disable */
2
+ // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
+
4
+ /**
5
+ * Append-only, value-free lifecycle evidence for one version-scoped Gateway key.
6
+ */
7
+ export type AiGatewayKeyLifecycleEvent = (
8
+ | {
9
+ fromStatus?: 'NONE';
10
+ toStatus?: 'PENDING';
11
+ }
12
+ | {
13
+ fromStatus?: 'PENDING';
14
+ toStatus?: 'ACTIVE';
15
+ }
16
+ | {
17
+ fromStatus?: 'PENDING';
18
+ toStatus?: 'REVOKED';
19
+ }
20
+ | {
21
+ fromStatus?: 'ACTIVE';
22
+ toStatus?: 'REVOKED';
23
+ }
24
+ | {
25
+ fromStatus?: 'REVOKED';
26
+ toStatus?: 'DELETION_SCHEDULED';
27
+ }
28
+ | {
29
+ fromStatus?: 'DELETION_SCHEDULED';
30
+ toStatus?: 'DELETED';
31
+ }
32
+ ) & {
33
+ schema: 'harbour.ai-gateway-key-lifecycle-event/1.0';
34
+ eventId: AiKeyLifecycleIdentifier;
35
+ sequence: number;
36
+ keyId: string;
37
+ tenantId: AiKeyLifecycleIdentifier;
38
+ appId: AiKeyLifecycleIdentifier;
39
+ environment: AiKeyLifecycleIdentifier;
40
+ versionId: string;
41
+ fromStatus: AiKeyLifecycleStatus;
42
+ toStatus: AiKeyLifecycleStatus;
43
+ cause:
44
+ | 'PLAN'
45
+ | 'ACTIVATION'
46
+ | 'FAILED'
47
+ | 'STALE'
48
+ | 'SUPERSEDED'
49
+ | 'VERSION_DELETED'
50
+ | 'MANUAL_REVOKE'
51
+ | 'OVERLAP_EXPIRED'
52
+ | 'RECONCILIATION';
53
+ secretRef?: AiKeyLifecycleSafeReference;
54
+ overlapExpiresAt?: string;
55
+ eventDigest: AiKeyLifecycleDigest;
56
+ occurredAt: string;
57
+ };
58
+ export type AiKeyLifecycleIdentifier = string;
59
+ export type AiKeyLifecycleStatus = 'NONE' | 'PENDING' | 'ACTIVE' | 'REVOKED' | 'DELETION_SCHEDULED' | 'DELETED';
60
+ /**
61
+ * Value-free hierarchical secret reference using the additive reviewed scheme registry; no userinfo, query, fragment, port or percent encoding.
62
+ */
63
+ export type AiKeyLifecycleSafeReference = string;
64
+ export type AiKeyLifecycleDigest = string;
65
+
66
+ const legalAiKeyLifecycleStatusTransitions: Record<string, Record<string, true>> = {
67
+ "NONE": { "PENDING": true },
68
+ "PENDING": { "ACTIVE": true, "REVOKED": true },
69
+ "ACTIVE": { "REVOKED": true },
70
+ "REVOKED": { "DELETION_SCHEDULED": true },
71
+ "DELETION_SCHEDULED": { "DELETED": true },
72
+ };
73
+ const terminalAiKeyLifecycleStatusStates = new Set<string>(["DELETED"]);
74
+
75
+ /** True iff from→to is a legal AiKeyLifecycleStatus edge (schema x-transitions). */
76
+ export function canTransitionAiKeyLifecycleStatus(from: string, to: string): boolean {
77
+ return Boolean(legalAiKeyLifecycleStatusTransitions[from]?.[to]);
78
+ }
79
+
80
+ /** True iff the AiKeyLifecycleStatus is terminal (DELETED). */
81
+ export function isTerminalAiKeyLifecycleStatus(state: string): boolean { return terminalAiKeyLifecycleStatusStates.has(state); }
@@ -0,0 +1,23 @@
1
+ /* eslint-disable */
2
+ // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
+
4
+ /**
5
+ * Value-free Gateway authentication metadata for one version-scoped Harbour key.
6
+ */
7
+ export type AiGatewayKeyLookup = {
8
+ schema: 'harbour.ai-gateway-key-lookup/1.0';
9
+ keyId: string;
10
+ tenantId: AiGatewayKeyIdentifier;
11
+ appId: AiGatewayKeyIdentifier;
12
+ environment: AiGatewayKeyIdentifier;
13
+ versionId: string;
14
+ tokenPrefix: 'hbr_live_' | 'hbr_test_';
15
+ status: 'PENDING' | 'ACTIVE' | 'REVOKED';
16
+ keyMac?: string;
17
+ createdAt: string;
18
+ activatedAt?: string;
19
+ expiresAt?: string;
20
+ overlapExpiresAt?: string;
21
+ revokedAt?: string;
22
+ };
23
+ export type AiGatewayKeyIdentifier = string;
@@ -0,0 +1,7 @@
1
+ /* eslint-disable */
2
+ // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
+
4
+ export const AiGatewayKeyProductionPrefix = "hbr_live_" as const;
5
+ export const AiGatewayKeyNonProductionPrefix = "hbr_test_" as const;
6
+ export const AiGatewayKeyTokenPatternSource = "^hbr_(live|test)_([0-9a-f]{32})\\.([A-Za-z0-9_-]{43})$" as const;
7
+ export const AiGatewayKeyTokenPattern = new RegExp(AiGatewayKeyTokenPatternSource);
@@ -0,0 +1,90 @@
1
+ /* eslint-disable */
2
+ // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
+
4
+ /**
5
+ * Digest-bound PLAN or VERIFY decision returned to the deployment control plane.
6
+ */
7
+ export type AiGovernanceDecision = {
8
+ schema: 'harbour.ai-governance-decision/1.0';
9
+ phase: 'PLAN' | 'VERIFY';
10
+ tenantId: AiDecisionIdentifier;
11
+ appId: AiDecisionIdentifier;
12
+ environment: AiDecisionIdentifier;
13
+ versionId: string;
14
+ sourceRevision: string;
15
+ decision: 'PASS' | 'BLOCKED';
16
+ interceptionPath: 'NO_AI_CALLS' | 'DEPLOYMENT_INJECTION' | 'DETERMINISTIC_ADAPTER' | 'BLOCKED';
17
+ /**
18
+ * @maxItems 64
19
+ */
20
+ reasonCodes: AiDecisionIdentifier[];
21
+ /**
22
+ * @maxItems 1000
23
+ */
24
+ uncoveredCallsiteFingerprints: AiDecisionDigest[];
25
+ inventoryDigest: AiDecisionDigest;
26
+ policyDigest: AiDecisionDigest;
27
+ runtimeContractDigest?: AiDecisionDigest;
28
+ /**
29
+ * @maxItems 1000
30
+ */
31
+ interceptionPlan: AiInterceptionPlanEntry[];
32
+ interceptionPlanDigest: AiDecisionDigest;
33
+ evidenceDigest?: AiDecisionDigest;
34
+ runtimeContract?: AiDecisionRuntimeContract;
35
+ decidedAt: string;
36
+ };
37
+ export type AiDecisionIdentifier = string;
38
+ export type AiDecisionDigest = string;
39
+ export type AiInterceptionPlanEntry = {
40
+ callSiteFingerprint: AiDecisionDigest;
41
+ sourcePath: string;
42
+ expectedSourceFileSha256: AiDecisionDigest;
43
+ strategy: 'deployment_injection' | 'deterministic_adapter';
44
+ /**
45
+ * @minItems 1
46
+ * @maxItems 32
47
+ */
48
+ allowedSyntaxKinds: AiDecisionIdentifier[];
49
+ configurationMappingId?: AiDecisionIdentifier;
50
+ configurationMappingVersion?: string;
51
+ transformId?: AiDecisionIdentifier;
52
+ transformVersion?: string;
53
+ runtimeShimName?: string;
54
+ runtimeShimVersion?: string;
55
+ runtimeShimDigest?: AiDecisionDigest;
56
+ };
57
+ /**
58
+ * Platform-neutral value-free hierarchical reference using the additive reviewed scheme registry; no userinfo, query, fragment, port or percent encoding.
59
+ */
60
+ export type AiDecisionSafeReference = string;
61
+
62
+ export interface AiDecisionRuntimeContract {
63
+ schema: 'harbour.ai-runtime-contract/1.0';
64
+ tenantId: AiDecisionIdentifier;
65
+ appId: AiDecisionIdentifier;
66
+ environment: AiDecisionIdentifier;
67
+ versionId: string;
68
+ sourceRevision: string;
69
+ mode: 'observe' | 'enforce';
70
+ gatewayBaseUrl: string;
71
+ gatewayKeySecretRef: string;
72
+ modelAliases: {
73
+ generation?: string;
74
+ embeddings?: string;
75
+ };
76
+ policyDigest: AiDecisionDigest;
77
+ runtimeBinding?: AiDecisionRuntimeBinding;
78
+ /**
79
+ * @minItems 1
80
+ * @maxItems 2
81
+ */
82
+ requiredStrategies: ('deployment_injection' | 'deterministic_adapter')[];
83
+ }
84
+ export interface AiDecisionRuntimeBinding {
85
+ schema: 'harbour.ai-runtime-binding/1.0';
86
+ platform: string;
87
+ workloadIdentityRef: AiDecisionSafeReference;
88
+ secretRef: AiDecisionSafeReference;
89
+ runtimeBindingDigest: AiDecisionDigest;
90
+ }
@@ -0,0 +1,20 @@
1
+ /* eslint-disable */
2
+ // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
+
4
+ export type AiMeteringPolicyDigest = string;
5
+
6
+ /**
7
+ * Additive v2 metering-policy binding. It binds a composite policy to immutable pricing revisions without changing the v1 policy snapshot.
8
+ */
9
+ export interface AiMeteringPolicy {
10
+ schema: 'harbour.ai-metering-policy/2.0';
11
+ policyDigest: AiMeteringPolicyDigest;
12
+ /**
13
+ * @minItems 1
14
+ * @maxItems 512
15
+ */
16
+ pricingRevisionDigests: AiMeteringPolicyDigest[];
17
+ reservationMode: 'committed_exposure';
18
+ policyDigestV2: AiMeteringPolicyDigest;
19
+ publishedAt: string;
20
+ }
@@ -0,0 +1,169 @@
1
+ /* eslint-disable */
2
+ // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
+
4
+ export type AiPolicyScope = {
5
+ level: 'tenant' | 'application_environment';
6
+ tenantId: AiPolicyIdentifier;
7
+ appId?: AiPolicyIdentifier;
8
+ environment?: AiPolicyIdentifier;
9
+ };
10
+ export type AiPolicyIdentifier = string;
11
+ export type AiPolicyDigest = string;
12
+ export type AiPolicyGuardrailRule = {
13
+ ruleId: AiPolicyIdentifier;
14
+ detectorId: AiPolicyIdentifier;
15
+ detectorVersion: string;
16
+ phase: 'input' | 'output';
17
+ action: 'ALLOW' | 'OBSERVE' | 'REDACT' | 'BLOCK';
18
+ parameters?: AiPolicyGuardrailParameters;
19
+ };
20
+ /**
21
+ * Bounded, closed JSON Schema subset carried by an output.json_schema guardrail. Every node is a closed object over an enumerated keyword set; object nodes must state additionalProperties: false, so the validated output shape is closed too. Size is bounded per node (maxProperties/maxLength/maxItems); the consuming validator additionally enforces an overall byte budget at policy load.
22
+ */
23
+ export type AiPolicyEmbeddedJsonSchema = {
24
+ type: 'object' | 'array' | 'string' | 'number' | 'integer' | 'boolean' | 'null';
25
+ description?: string;
26
+ properties?: {
27
+ [k: string]: AiPolicyEmbeddedJsonSchema;
28
+ };
29
+ /**
30
+ * @maxItems 64
31
+ */
32
+ required?: string[];
33
+ additionalProperties?: false;
34
+ items?: AiPolicyEmbeddedJsonSchema;
35
+ /**
36
+ * @minItems 1
37
+ * @maxItems 64
38
+ */
39
+ enum?: (string | number | boolean | null)[];
40
+ minimum?: number;
41
+ maximum?: number;
42
+ minLength?: number;
43
+ maxLength?: number;
44
+ minItems?: number;
45
+ maxItems?: number;
46
+ };
47
+
48
+ /**
49
+ * Immutable, content-addressed AI policy snapshot consumed by the Harbour AI Gateway. Provider credentials are represented only by Secrets Manager references.
50
+ */
51
+ export interface AiPolicySnapshot {
52
+ schema: 'harbour.ai-policy-snapshot/1.0';
53
+ scope: AiPolicyScope;
54
+ revision: number;
55
+ publishedAt: string;
56
+ contentDigest: AiPolicyDigest;
57
+ baselineDigest: AiPolicyDigest;
58
+ classificationMinimum?: AiPolicyClassificationMinimum;
59
+ /**
60
+ * @maxItems 64
61
+ */
62
+ providers: AiPolicyProvider[];
63
+ /**
64
+ * @maxItems 512
65
+ */
66
+ models: AiPolicyModel[];
67
+ /**
68
+ * @maxItems 256
69
+ */
70
+ routes: AiPolicyRoute[];
71
+ /**
72
+ * @maxItems 256
73
+ */
74
+ policies: AiPolicyRuleSet[];
75
+ /**
76
+ * @maxItems 128
77
+ */
78
+ limits: AiPolicyLimit[];
79
+ retention: AiPolicyRetention;
80
+ }
81
+ export interface AiPolicyClassificationMinimum {
82
+ classification: 'Green' | 'Yellow' | 'Orange' | 'Red';
83
+ mappingDigest: AiPolicyDigest;
84
+ }
85
+ export interface AiPolicyProvider {
86
+ id: AiPolicyIdentifier;
87
+ provider: 'openai' | 'anthropic' | 'gemini' | 'openrouter';
88
+ baseUrl?: string;
89
+ credentialSecretRef: string;
90
+ enabled: boolean;
91
+ }
92
+ export interface AiPolicyModel {
93
+ id: AiPolicyIdentifier;
94
+ providerId: AiPolicyIdentifier;
95
+ providerModel: string;
96
+ /**
97
+ * @minItems 1
98
+ * @maxItems 2
99
+ */
100
+ capabilities: ('generation' | 'embeddings')[];
101
+ approved: boolean;
102
+ pricing: AiPolicyPricing;
103
+ }
104
+ export interface AiPolicyPricing {
105
+ revision: AiPolicyIdentifier;
106
+ inputMicroUsdPerMillion: number;
107
+ outputMicroUsdPerMillion: number;
108
+ }
109
+ export interface AiPolicyRoute {
110
+ alias: AiPolicyIdentifier;
111
+ version: number;
112
+ capability: 'generation' | 'embeddings';
113
+ /**
114
+ * @minItems 1
115
+ * @maxItems 16
116
+ */
117
+ targets: AiPolicyRouteTarget[];
118
+ retryCount: number;
119
+ timeoutMs: number;
120
+ }
121
+ export interface AiPolicyRouteTarget {
122
+ modelId: AiPolicyIdentifier;
123
+ priority: number;
124
+ weight: number;
125
+ }
126
+ export interface AiPolicyRuleSet {
127
+ name: AiPolicyIdentifier;
128
+ version: number;
129
+ maxRequestBytes: number;
130
+ maxInputTokens: number;
131
+ maxOutputTokens: number;
132
+ bufferedDelivery: boolean;
133
+ permittedRequestFields: AiPolicyPermittedRequestFields;
134
+ /**
135
+ * @maxItems 128
136
+ */
137
+ guardrails: AiPolicyGuardrailRule[];
138
+ }
139
+ export interface AiPolicyPermittedRequestFields {
140
+ temperature: boolean;
141
+ maxOutputTokens: boolean;
142
+ responseFormat: boolean;
143
+ tools: boolean;
144
+ }
145
+ export interface AiPolicyGuardrailParameters {
146
+ /**
147
+ * @minItems 1
148
+ * @maxItems 64
149
+ */
150
+ allowedTools?: string[];
151
+ jsonSchema?: AiPolicyEmbeddedJsonSchema;
152
+ jsonSchemaRef?: AiPolicyDigest;
153
+ }
154
+ export interface AiPolicyLimit {
155
+ name: AiPolicyIdentifier;
156
+ enabled: boolean;
157
+ scope: 'tenant' | 'application';
158
+ requestsPerMinute: number;
159
+ tokensPerMinute: number;
160
+ monthlyBudgetMicroUsd: number;
161
+ }
162
+ export interface AiPolicyRetention {
163
+ captureMode: 'OFF' | 'BEST_EFFORT' | 'REQUIRED';
164
+ retentionDays: number;
165
+ /**
166
+ * @maxItems 16
167
+ */
168
+ revealRoles: AiPolicyIdentifier[];
169
+ }
@@ -0,0 +1,33 @@
1
+ /* eslint-disable */
2
+ // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
+
4
+ export type AiPricingIdentifier = string;
5
+ export type AiPricingDigest = string;
6
+
7
+ /**
8
+ * Immutable v2 line-item pricing revision. A correction is a new revision; published records are never edited.
9
+ */
10
+ export interface AiPricingRevision {
11
+ schema: 'harbour.ai-pricing-revision/2.0';
12
+ revisionId: AiPricingIdentifier;
13
+ provider: 'openai' | 'anthropic' | 'gemini' | 'openrouter';
14
+ providerModel: string;
15
+ region?: AiPricingIdentifier;
16
+ currency: 'USD';
17
+ /**
18
+ * @minItems 1
19
+ * @maxItems 64
20
+ */
21
+ dimensions: PriceDimension[];
22
+ supersedesRevisionId?: AiPricingIdentifier;
23
+ revisionDigest: AiPricingDigest;
24
+ effectiveAt: string;
25
+ publishedAt: string;
26
+ }
27
+ export interface PriceDimension {
28
+ dimension: AiPricingIdentifier;
29
+ direction: 'input' | 'output';
30
+ unit: AiPricingIdentifier;
31
+ scale: number;
32
+ microUsdPerScale: number;
33
+ }
@@ -0,0 +1,18 @@
1
+ /* eslint-disable */
2
+ // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
+
4
+ /**
5
+ * A value-free hierarchical identifier. Schemes are an additive reviewed registry; userinfo, ports, percent encoding, query strings, fragments and empty path segments are unrepresentable.
6
+ */
7
+ export type AiRuntimeSafeReference = string;
8
+
9
+ /**
10
+ * Platform-neutral, value-free binding of one workload identity to one version-scoped Harbour Gateway secret. Platform adapters may add implementation details internally; they never enter this contract.
11
+ */
12
+ export interface AiRuntimeBinding {
13
+ schema: 'harbour.ai-runtime-binding/1.0';
14
+ platform: string;
15
+ workloadIdentityRef: AiRuntimeSafeReference;
16
+ secretRef: AiRuntimeSafeReference;
17
+ runtimeBindingDigest: string;
18
+ }
@@ -0,0 +1,46 @@
1
+ /* eslint-disable */
2
+ // Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
3
+
4
+ export type AiRuntimeIdentifier = string;
5
+ export type AiRuntimeModelAlias = string;
6
+ export type AiRuntimeDigest = string;
7
+ /**
8
+ * Platform-neutral value-free hierarchical reference using the additive reviewed scheme registry; no userinfo, query, fragment, port or percent encoding.
9
+ */
10
+ export type AiRuntimeContractSafeReference = string;
11
+
12
+ /**
13
+ * Immutable deployment runtime contract derived by an AI Governance PLAN decision. Contains only scoped configuration and a Secrets Manager reference, never key plaintext.
14
+ */
15
+ export interface AiRuntimeContract {
16
+ schema: 'harbour.ai-runtime-contract/1.0';
17
+ tenantId: AiRuntimeIdentifier;
18
+ appId: AiRuntimeIdentifier;
19
+ environment: AiRuntimeIdentifier;
20
+ versionId: string;
21
+ sourceRevision: string;
22
+ mode: 'observe' | 'enforce';
23
+ gatewayBaseUrl: string;
24
+ gatewayKeySecretRef: string;
25
+ modelAliases: {
26
+ generation?: AiRuntimeModelAlias;
27
+ embeddings?: AiRuntimeModelAlias;
28
+ };
29
+ policyDigest: AiRuntimeDigest;
30
+ runtimeBinding?: AiRuntimeContractBinding;
31
+ /**
32
+ * @minItems 1
33
+ * @maxItems 2
34
+ */
35
+ requiredStrategies: ('deployment_injection' | 'deterministic_adapter')[];
36
+ }
37
+ /**
38
+ * Optional additive platform-neutral binding. Existing 1.0 records without it remain valid.
39
+ */
40
+ export interface AiRuntimeContractBinding {
41
+ schema: 'harbour.ai-runtime-binding/1.0';
42
+ platform: string;
43
+ workloadIdentityRef: AiRuntimeContractSafeReference;
44
+ secretRef: AiRuntimeContractSafeReference;
45
+ runtimeBindingDigest: AiRuntimeDigest;
46
+ }