@fourier-labs/harbour-contracts 0.4.0 → 0.6.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.
- package/dist/gen-ts/ai-callsite-inventory.d.ts +49 -0
- package/dist/gen-ts/ai-gateway-key-lookup.d.ts +20 -0
- package/dist/gen-ts/ai-gateway-key-token.d.ts +4 -0
- package/dist/gen-ts/ai-gateway-key-token.js +6 -0
- package/dist/gen-ts/ai-governance-decision.d.ts +74 -0
- package/dist/gen-ts/ai-policy-snapshot.d.ts +165 -0
- package/dist/gen-ts/ai-runtime-contract.d.ts +27 -0
- package/dist/gen-ts/ai-trace-event.d.ts +68 -0
- package/dist/gen-ts/ai-transform-event.d.ts +47 -0
- package/dist/gen-ts/ai-transform-result.d.ts +32 -0
- package/dist/gen-ts/ai-verification-evidence.d.ts +49 -0
- package/dist/gen-ts/data-dependency.d.ts +42 -0
- package/dist/gen-ts/data-grant.d.ts +58 -0
- package/dist/gen-ts/data-grant.js +12 -0
- package/dist/gen-ts/data-source.d.ts +74 -0
- package/dist/{deploy-request.d.ts → gen-ts/deploy-request.d.ts} +30 -0
- package/dist/gen-ts/deployment-source.js +3 -0
- package/dist/gen-ts/deployment-status-failure.js +3 -0
- package/dist/gen-ts/deployment-status-request.js +3 -0
- package/dist/gen-ts/deployment-status-response.js +3 -0
- package/dist/gen-ts/env-bindings.js +3 -0
- package/dist/{error-category-registry.d.ts → gen-ts/error-category-registry.d.ts} +5 -0
- package/dist/{error-category-registry.js → gen-ts/error-category-registry.js} +10 -0
- package/dist/gen-ts/error-category.js +3 -0
- package/dist/gen-ts/error-envelope.js +3 -0
- package/dist/{index.d.ts → gen-ts/index.d.ts} +15 -0
- package/dist/{index.js → gen-ts/index.js} +15 -0
- package/dist/gen-ts/kvs-routing-entry.d.ts +27 -0
- package/dist/gen-ts/kvs-routing-entry.js +3 -0
- package/dist/gen-ts/promotion-request.d.ts +40 -0
- package/dist/gen-ts/promotion-request.js +3 -0
- package/dist/gen-ts/promotion-response.js +3 -0
- package/dist/gen-ts/secret-reference.d.ts +36 -0
- package/dist/gen-ts/secret-reference.js +3 -0
- package/dist/gen-ts/transform-report.d.ts +102 -0
- package/dist/gen-ts/transform-report.js +3 -0
- package/dist/gen-ts/version-state.js +3 -0
- package/dist/resolver/index.d.ts +256 -0
- package/dist/resolver/index.js +679 -0
- package/package.json +14 -4
- package/schema/ai-callsite-inventory.schema.json +138 -0
- package/schema/ai-gateway-key-lookup.schema.json +53 -0
- package/schema/ai-governance-decision.schema.json +105 -0
- package/schema/ai-policy-snapshot.schema.json +340 -0
- package/schema/ai-runtime-contract.schema.json +85 -0
- package/schema/ai-trace-event.schema.json +178 -0
- package/schema/ai-transform-event.schema.json +72 -0
- package/schema/ai-transform-result.schema.json +46 -0
- package/schema/ai-verification-evidence.schema.json +57 -0
- package/schema/data-dependency.schema.json +89 -0
- package/schema/data-grant.schema.json +107 -0
- package/schema/data-source.schema.json +151 -0
- package/schema/deploy-request.schema.json +60 -0
- package/schema/error-category.enum.json +6 -1
- package/schema/kvs-routing-entry.schema.json +28 -8
- package/schema/promotion-request.schema.json +38 -0
- package/schema/secret-reference.schema.json +70 -0
- package/schema/transform-report.schema.json +204 -0
- package/dist/kvs-routing-entry.d.ts +0 -13
- package/dist/promotion-request.d.ts +0 -17
- /package/dist/{api-error-response.js → gen-ts/ai-callsite-inventory.js} +0 -0
- /package/dist/{artifact-contract.js → gen-ts/ai-gateway-key-lookup.js} +0 -0
- /package/dist/{deploy-request.js → gen-ts/ai-governance-decision.js} +0 -0
- /package/dist/{deploy-response.js → gen-ts/ai-policy-snapshot.js} +0 -0
- /package/dist/{deployment-environment.js → gen-ts/ai-runtime-contract.js} +0 -0
- /package/dist/{deployment-source.js → gen-ts/ai-trace-event.js} +0 -0
- /package/dist/{deployment-status-failure.js → gen-ts/ai-transform-event.js} +0 -0
- /package/dist/{deployment-status-request.js → gen-ts/ai-transform-result.js} +0 -0
- /package/dist/{deployment-status-response.js → gen-ts/ai-verification-evidence.js} +0 -0
- /package/dist/{api-error-response.d.ts → gen-ts/api-error-response.d.ts} +0 -0
- /package/dist/{env-bindings.js → gen-ts/api-error-response.js} +0 -0
- /package/dist/{artifact-contract.d.ts → gen-ts/artifact-contract.d.ts} +0 -0
- /package/dist/{error-category.js → gen-ts/artifact-contract.js} +0 -0
- /package/dist/{error-envelope.js → gen-ts/data-dependency.js} +0 -0
- /package/dist/{kvs-routing-entry.js → gen-ts/data-source.js} +0 -0
- /package/dist/{promotion-request.js → gen-ts/deploy-request.js} +0 -0
- /package/dist/{deploy-response.d.ts → gen-ts/deploy-response.d.ts} +0 -0
- /package/dist/{promotion-response.js → gen-ts/deploy-response.js} +0 -0
- /package/dist/{deployment-environment.d.ts → gen-ts/deployment-environment.d.ts} +0 -0
- /package/dist/{version-state.js → gen-ts/deployment-environment.js} +0 -0
- /package/dist/{deployment-source.d.ts → gen-ts/deployment-source.d.ts} +0 -0
- /package/dist/{deployment-status-failure.d.ts → gen-ts/deployment-status-failure.d.ts} +0 -0
- /package/dist/{deployment-status-request.d.ts → gen-ts/deployment-status-request.d.ts} +0 -0
- /package/dist/{deployment-status-response.d.ts → gen-ts/deployment-status-response.d.ts} +0 -0
- /package/dist/{env-bindings.d.ts → gen-ts/env-bindings.d.ts} +0 -0
- /package/dist/{error-category.d.ts → gen-ts/error-category.d.ts} +0 -0
- /package/dist/{error-envelope.d.ts → gen-ts/error-envelope.d.ts} +0 -0
- /package/dist/{promotion-response.d.ts → gen-ts/promotion-response.d.ts} +0 -0
- /package/dist/{version-state-machine.d.ts → gen-ts/version-state-machine.d.ts} +0 -0
- /package/dist/{version-state-machine.js → gen-ts/version-state-machine.js} +0 -0
- /package/dist/{version-state.d.ts → gen-ts/version-state.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fourier-labs/harbour-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Single source of truth for every data shape that crosses a boundary between Harbour components.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
@@ -13,12 +13,22 @@
|
|
|
13
13
|
"dist",
|
|
14
14
|
"schema"
|
|
15
15
|
],
|
|
16
|
-
"main": "dist/index.js",
|
|
17
|
-
"types": "dist/index.d.ts",
|
|
16
|
+
"main": "dist/gen-ts/index.js",
|
|
17
|
+
"types": "dist/gen-ts/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/gen-ts/index.d.ts",
|
|
21
|
+
"default": "./dist/gen-ts/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./resolver": {
|
|
24
|
+
"types": "./dist/resolver/index.d.ts",
|
|
25
|
+
"default": "./dist/resolver/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
18
28
|
"scripts": {
|
|
19
29
|
"gen": "node tools/gen/gen.mjs",
|
|
20
30
|
"build": "tsc -p tsconfig.json",
|
|
21
|
-
"test": "node --test tools/gen/*.test.mjs",
|
|
31
|
+
"test": "node --test tools/gen/*.test.mjs resolver/*.test.mjs",
|
|
22
32
|
"verify": "node tools/gen/gen.mjs && { [ -z \"$(git status --porcelain -- gen-ts gen-go)\" ] || { echo 'STALE: generated code out of date or uncommitted — run make gen and commit'; exit 1; }; }"
|
|
23
33
|
},
|
|
24
34
|
"devDependencies": {
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://schemas.harbour.dev/ai-callsite-inventory.schema.json",
|
|
4
|
+
"title": "AiCallsiteInventory",
|
|
5
|
+
"description": "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.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"schema",
|
|
10
|
+
"tenantId",
|
|
11
|
+
"appId",
|
|
12
|
+
"environment",
|
|
13
|
+
"versionId",
|
|
14
|
+
"sourceRevision",
|
|
15
|
+
"analyzerVersion",
|
|
16
|
+
"coverage",
|
|
17
|
+
"scanStatus",
|
|
18
|
+
"callsites"
|
|
19
|
+
],
|
|
20
|
+
"properties": {
|
|
21
|
+
"schema": { "type": "string", "const": "harbour.ai-callsite-inventory/1.0" },
|
|
22
|
+
"tenantId": { "$ref": "#/definitions/AiInventoryIdentifier" },
|
|
23
|
+
"appId": { "$ref": "#/definitions/AiInventoryIdentifier" },
|
|
24
|
+
"environment": { "$ref": "#/definitions/AiInventoryIdentifier" },
|
|
25
|
+
"versionId": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"minLength": 7,
|
|
28
|
+
"maxLength": 320,
|
|
29
|
+
"pattern": "^[^#]+#[^#]+#[^#]+#[0-9]{6,}$"
|
|
30
|
+
},
|
|
31
|
+
"sourceRevision": { "type": "string", "minLength": 7, "maxLength": 128 },
|
|
32
|
+
"analyzerVersion": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
33
|
+
"coverage": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"enum": ["complete_for_supported_sdks", "partial"]
|
|
36
|
+
},
|
|
37
|
+
"scanStatus": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"enum": ["completed", "cybersecurity_scan_unavailable"],
|
|
40
|
+
"description": "Required and never defaulted. Unavailable security evidence is not represented as a clean scan."
|
|
41
|
+
},
|
|
42
|
+
"callsites": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"maxItems": 1000,
|
|
45
|
+
"description": "Canonical order is ascending by fingerprint, then path, then line. Producers MUST serialize this order before digesting or publishing the inventory.",
|
|
46
|
+
"items": { "$ref": "#/definitions/AiInventoryCallsite" }
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"definitions": {
|
|
50
|
+
"AiInventoryIdentifier": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"minLength": 1,
|
|
53
|
+
"maxLength": 128,
|
|
54
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]*$"
|
|
55
|
+
},
|
|
56
|
+
"AiInventoryDigest": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
59
|
+
},
|
|
60
|
+
"AiInventoryEvidence": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"additionalProperties": false,
|
|
63
|
+
"required": ["fingerprint", "excerpt"],
|
|
64
|
+
"properties": {
|
|
65
|
+
"fingerprint": { "$ref": "#/definitions/AiInventoryDigest" },
|
|
66
|
+
"excerpt": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"minLength": 1,
|
|
69
|
+
"maxLength": 240,
|
|
70
|
+
"pattern": "^[^\\r\\n]*$",
|
|
71
|
+
"description": "Sanitized single-line evidence; never raw source or a prompt."
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"AiInventoryCallsite": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"additionalProperties": false,
|
|
78
|
+
"required": [
|
|
79
|
+
"fingerprint",
|
|
80
|
+
"path",
|
|
81
|
+
"sourceFileSha256",
|
|
82
|
+
"line",
|
|
83
|
+
"language",
|
|
84
|
+
"sdk",
|
|
85
|
+
"method",
|
|
86
|
+
"strategy",
|
|
87
|
+
"status",
|
|
88
|
+
"securityFindingIds",
|
|
89
|
+
"evidence"
|
|
90
|
+
],
|
|
91
|
+
"properties": {
|
|
92
|
+
"fingerprint": { "$ref": "#/definitions/AiInventoryDigest" },
|
|
93
|
+
"path": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"minLength": 1,
|
|
96
|
+
"maxLength": 512,
|
|
97
|
+
"pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))[^\\u0000]+$"
|
|
98
|
+
},
|
|
99
|
+
"sourceFileSha256": { "$ref": "#/definitions/AiInventoryDigest" },
|
|
100
|
+
"line": { "type": "integer", "minimum": 1 },
|
|
101
|
+
"language": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"enum": ["javascript", "typescript", "python", "go", "unknown"]
|
|
104
|
+
},
|
|
105
|
+
"sdk": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"enum": [
|
|
108
|
+
"openai",
|
|
109
|
+
"openai-compatible",
|
|
110
|
+
"anthropic",
|
|
111
|
+
"google-genai",
|
|
112
|
+
"mistral",
|
|
113
|
+
"bedrock",
|
|
114
|
+
"cohere",
|
|
115
|
+
"ollama",
|
|
116
|
+
"legacy-gemini",
|
|
117
|
+
"direct-provider-rest",
|
|
118
|
+
"unknown"
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
"method": { "type": "string", "minLength": 1, "maxLength": 160 },
|
|
122
|
+
"requestedModel": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
123
|
+
"strategy": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"enum": ["deployment_injection", "deterministic_adapter", "unsupported"]
|
|
126
|
+
},
|
|
127
|
+
"status": { "type": "string", "const": "detected" },
|
|
128
|
+
"securityFindingIds": {
|
|
129
|
+
"type": "array",
|
|
130
|
+
"maxItems": 64,
|
|
131
|
+
"uniqueItems": true,
|
|
132
|
+
"items": { "type": "string", "minLength": 1, "maxLength": 160 }
|
|
133
|
+
},
|
|
134
|
+
"evidence": { "$ref": "#/definitions/AiInventoryEvidence" }
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://schemas.harbour.dev/ai-gateway-key-lookup.schema.json",
|
|
4
|
+
"title": "AiGatewayKeyLookup",
|
|
5
|
+
"description": "Value-free Gateway authentication metadata for one version-scoped Harbour key.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["schema", "keyId", "tenantId", "appId", "environment", "versionId", "tokenPrefix", "status", "createdAt"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"schema": { "type": "string", "const": "harbour.ai-gateway-key-lookup/1.0" },
|
|
11
|
+
"keyId": { "type": "string", "pattern": "^[0-9a-f]{32}$" },
|
|
12
|
+
"tenantId": { "$ref": "#/definitions/AiGatewayKeyIdentifier" },
|
|
13
|
+
"appId": { "$ref": "#/definitions/AiGatewayKeyIdentifier" },
|
|
14
|
+
"environment": { "$ref": "#/definitions/AiGatewayKeyIdentifier" },
|
|
15
|
+
"versionId": { "type": "string", "minLength": 7, "maxLength": 320, "pattern": "^[^#]+#[^#]+#[^#]+#[0-9]{6,}$" },
|
|
16
|
+
"tokenPrefix": { "type": "string", "enum": ["hbr_live_", "hbr_test_"] },
|
|
17
|
+
"status": { "type": "string", "enum": ["PENDING", "ACTIVE", "REVOKED"] },
|
|
18
|
+
"keyMac": { "type": "string", "pattern": "^[A-Za-z0-9+/]{43}=$" },
|
|
19
|
+
"createdAt": { "type": "string", "format": "date-time" },
|
|
20
|
+
"activatedAt": { "type": "string", "format": "date-time" },
|
|
21
|
+
"expiresAt": { "type": "string", "format": "date-time" },
|
|
22
|
+
"overlapExpiresAt": { "type": "string", "format": "date-time" },
|
|
23
|
+
"revokedAt": { "type": "string", "format": "date-time" }
|
|
24
|
+
},
|
|
25
|
+
"allOf": [
|
|
26
|
+
{
|
|
27
|
+
"if": { "properties": { "tokenPrefix": { "const": "hbr_live_" } }, "required": ["tokenPrefix"] },
|
|
28
|
+
"then": { "properties": { "environment": { "const": "production" } } },
|
|
29
|
+
"else": { "properties": { "environment": { "not": { "const": "production" } } } }
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"if": { "properties": { "status": { "enum": ["ACTIVE", "REVOKED"] } }, "required": ["status"] },
|
|
33
|
+
"then": { "required": ["keyMac", "activatedAt"] }
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"if": { "properties": { "status": { "const": "REVOKED" } }, "required": ["status"] },
|
|
37
|
+
"then": { "required": ["revokedAt"] }
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"definitions": {
|
|
41
|
+
"AiGatewayKeyIdentifier": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"minLength": 1,
|
|
44
|
+
"maxLength": 128,
|
|
45
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]*$"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"x-key-token": {
|
|
49
|
+
"productionPrefix": "hbr_live_",
|
|
50
|
+
"nonProductionPrefix": "hbr_test_",
|
|
51
|
+
"pattern": "^hbr_(live|test)_([0-9a-f]{32})\\.([A-Za-z0-9_-]{43})$"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://schemas.harbour.dev/ai-governance-decision.schema.json",
|
|
4
|
+
"title": "AiGovernanceDecision",
|
|
5
|
+
"description": "Digest-bound PLAN or VERIFY decision returned to the deployment control plane.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["schema", "phase", "tenantId", "appId", "environment", "versionId", "sourceRevision", "decision", "interceptionPath", "reasonCodes", "uncoveredCallsiteFingerprints", "inventoryDigest", "policyDigest", "interceptionPlan", "interceptionPlanDigest", "decidedAt"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"schema": { "type": "string", "const": "harbour.ai-governance-decision/1.0" },
|
|
11
|
+
"phase": { "type": "string", "enum": ["PLAN", "VERIFY"] },
|
|
12
|
+
"tenantId": { "$ref": "#/definitions/AiDecisionIdentifier" },
|
|
13
|
+
"appId": { "$ref": "#/definitions/AiDecisionIdentifier" },
|
|
14
|
+
"environment": { "$ref": "#/definitions/AiDecisionIdentifier" },
|
|
15
|
+
"versionId": { "type": "string", "minLength": 7, "maxLength": 320, "pattern": "^[^#]+#[^#]+#[^#]+#[0-9]{6,}$" },
|
|
16
|
+
"sourceRevision": { "type": "string", "minLength": 7, "maxLength": 128 },
|
|
17
|
+
"decision": { "type": "string", "enum": ["PASS", "BLOCKED"] },
|
|
18
|
+
"interceptionPath": { "type": "string", "enum": ["NO_AI_CALLS", "DEPLOYMENT_INJECTION", "DETERMINISTIC_ADAPTER", "BLOCKED"] },
|
|
19
|
+
"reasonCodes": { "type": "array", "maxItems": 64, "uniqueItems": true, "items": { "$ref": "#/definitions/AiDecisionIdentifier" } },
|
|
20
|
+
"uncoveredCallsiteFingerprints": { "type": "array", "maxItems": 1000, "uniqueItems": true, "items": { "$ref": "#/definitions/AiDecisionDigest" } },
|
|
21
|
+
"inventoryDigest": { "$ref": "#/definitions/AiDecisionDigest" },
|
|
22
|
+
"policyDigest": { "$ref": "#/definitions/AiDecisionDigest" },
|
|
23
|
+
"runtimeContractDigest": { "$ref": "#/definitions/AiDecisionDigest" },
|
|
24
|
+
"interceptionPlan": { "type": "array", "maxItems": 1000, "items": { "$ref": "#/definitions/AiInterceptionPlanEntry" } },
|
|
25
|
+
"interceptionPlanDigest": { "$ref": "#/definitions/AiDecisionDigest" },
|
|
26
|
+
"evidenceDigest": { "$ref": "#/definitions/AiDecisionDigest" },
|
|
27
|
+
"runtimeContract": { "$ref": "#/definitions/AiDecisionRuntimeContract" },
|
|
28
|
+
"decidedAt": { "type": "string", "format": "date-time" }
|
|
29
|
+
},
|
|
30
|
+
"allOf": [
|
|
31
|
+
{
|
|
32
|
+
"if": { "properties": { "decision": { "const": "BLOCKED" } }, "required": ["decision"] },
|
|
33
|
+
"then": { "properties": { "interceptionPath": { "const": "BLOCKED" } } },
|
|
34
|
+
"else": { "properties": { "interceptionPath": { "enum": ["NO_AI_CALLS", "DEPLOYMENT_INJECTION", "DETERMINISTIC_ADAPTER"] } } }
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"if": { "properties": { "interceptionPath": { "enum": ["DEPLOYMENT_INJECTION", "DETERMINISTIC_ADAPTER"] } }, "required": ["interceptionPath"] },
|
|
38
|
+
"then": { "required": ["runtimeContract", "runtimeContractDigest"] }
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"if": { "properties": { "interceptionPath": { "const": "NO_AI_CALLS" } }, "required": ["interceptionPath"] },
|
|
42
|
+
"then": { "properties": { "interceptionPlan": { "maxItems": 0 } }, "not": { "anyOf": [{ "required": ["runtimeContract"] }, { "required": ["runtimeContractDigest"] }] } }
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"definitions": {
|
|
46
|
+
"AiDecisionIdentifier": { "type": "string", "minLength": 1, "maxLength": 160, "pattern": "^[A-Za-z0-9][A-Za-z0-9_.@/-]*$" },
|
|
47
|
+
"AiDecisionDigest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
|
|
48
|
+
"AiDecisionRuntimeContract": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"additionalProperties": false,
|
|
51
|
+
"required": ["schema", "tenantId", "appId", "environment", "versionId", "sourceRevision", "mode", "gatewayBaseUrl", "gatewayKeySecretRef", "modelAliases", "policyDigest", "requiredStrategies"],
|
|
52
|
+
"properties": {
|
|
53
|
+
"schema": { "type": "string", "const": "harbour.ai-runtime-contract/1.0" },
|
|
54
|
+
"tenantId": { "$ref": "#/definitions/AiDecisionIdentifier" },
|
|
55
|
+
"appId": { "$ref": "#/definitions/AiDecisionIdentifier" },
|
|
56
|
+
"environment": { "$ref": "#/definitions/AiDecisionIdentifier" },
|
|
57
|
+
"versionId": { "type": "string", "minLength": 7, "maxLength": 320, "pattern": "^[^#]+#[^#]+#[^#]+#[0-9]{6,}$" },
|
|
58
|
+
"sourceRevision": { "type": "string", "minLength": 7, "maxLength": 128 },
|
|
59
|
+
"mode": { "type": "string", "enum": ["observe", "enforce"] },
|
|
60
|
+
"gatewayBaseUrl": { "type": "string", "format": "uri", "maxLength": 512, "pattern": "^https://[^?#]+/v1$" },
|
|
61
|
+
"gatewayKeySecretRef": { "type": "string", "maxLength": 512, "pattern": "^aws-sm://[A-Za-z0-9/_+=.@-]+$" },
|
|
62
|
+
"modelAliases": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"additionalProperties": false,
|
|
65
|
+
"minProperties": 1,
|
|
66
|
+
"properties": {
|
|
67
|
+
"generation": { "type": "string", "minLength": 3, "maxLength": 160 },
|
|
68
|
+
"embeddings": { "type": "string", "minLength": 3, "maxLength": 160 }
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"policyDigest": { "$ref": "#/definitions/AiDecisionDigest" },
|
|
72
|
+
"requiredStrategies": { "type": "array", "minItems": 1, "maxItems": 2, "uniqueItems": true, "items": { "type": "string", "enum": ["deployment_injection", "deterministic_adapter"] } }
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"AiInterceptionPlanEntry": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"additionalProperties": false,
|
|
78
|
+
"required": ["callSiteFingerprint", "sourcePath", "expectedSourceFileSha256", "strategy", "allowedSyntaxKinds"],
|
|
79
|
+
"properties": {
|
|
80
|
+
"callSiteFingerprint": { "$ref": "#/definitions/AiDecisionDigest" },
|
|
81
|
+
"sourcePath": { "type": "string", "minLength": 1, "maxLength": 512, "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))[^\\u0000]+$" },
|
|
82
|
+
"expectedSourceFileSha256": { "$ref": "#/definitions/AiDecisionDigest" },
|
|
83
|
+
"strategy": { "type": "string", "enum": ["deployment_injection", "deterministic_adapter"] },
|
|
84
|
+
"allowedSyntaxKinds": { "type": "array", "minItems": 1, "maxItems": 32, "uniqueItems": true, "items": { "$ref": "#/definitions/AiDecisionIdentifier" } },
|
|
85
|
+
"configurationMappingId": { "$ref": "#/definitions/AiDecisionIdentifier" },
|
|
86
|
+
"configurationMappingVersion": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
87
|
+
"transformId": { "$ref": "#/definitions/AiDecisionIdentifier" },
|
|
88
|
+
"transformVersion": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
89
|
+
"runtimeShimName": { "type": "string", "minLength": 1, "maxLength": 160, "pattern": "^@?[A-Za-z0-9][A-Za-z0-9_.@/-]*$" },
|
|
90
|
+
"runtimeShimVersion": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
91
|
+
"runtimeShimDigest": { "$ref": "#/definitions/AiDecisionDigest" }
|
|
92
|
+
},
|
|
93
|
+
"allOf": [
|
|
94
|
+
{
|
|
95
|
+
"if": { "properties": { "strategy": { "const": "deployment_injection" } }, "required": ["strategy"] },
|
|
96
|
+
"then": { "required": ["configurationMappingId", "configurationMappingVersion"] }
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"if": { "properties": { "strategy": { "const": "deterministic_adapter" } }, "required": ["strategy"] },
|
|
100
|
+
"then": { "required": ["transformId", "transformVersion", "runtimeShimName", "runtimeShimVersion", "runtimeShimDigest"] }
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|