@fourier-labs/harbour-contracts 0.5.0 → 0.9.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/README.md +44 -4
- package/contract-release.json +134 -0
- package/dist/gen-ts/ai-budget-ledger-event.d.ts +21 -0
- package/dist/gen-ts/ai-budget-ledger-event.js +3 -0
- package/dist/gen-ts/ai-classification-stamp.d.ts +25 -0
- package/dist/gen-ts/ai-classification-stamp.js +3 -0
- package/dist/gen-ts/ai-composite-policy-digest-helper.d.ts +5 -0
- package/dist/gen-ts/ai-composite-policy-digest-helper.js +13 -0
- package/dist/gen-ts/ai-composite-policy-digest.d.ts +12 -0
- package/dist/gen-ts/ai-composite-policy-digest.js +3 -0
- package/dist/gen-ts/ai-deployment-gate-decision.d.ts +27 -0
- package/dist/gen-ts/ai-deployment-gate-decision.js +3 -0
- package/dist/gen-ts/ai-gateway-key-lifecycle-event.d.ts +49 -0
- package/dist/gen-ts/ai-gateway-key-lifecycle-event.js +16 -0
- package/dist/gen-ts/ai-governance-decision.d.ts +14 -2
- package/dist/gen-ts/ai-metering-policy.d.ts +16 -0
- package/dist/gen-ts/ai-metering-policy.js +3 -0
- package/dist/gen-ts/ai-policy-snapshot.d.ts +5 -269
- package/dist/gen-ts/ai-pricing-revision.d.ts +29 -0
- package/dist/gen-ts/ai-pricing-revision.js +3 -0
- package/dist/gen-ts/ai-runtime-binding.d.ts +14 -0
- package/dist/gen-ts/ai-runtime-binding.js +3 -0
- package/dist/gen-ts/ai-runtime-contract.d.ts +16 -1
- package/dist/gen-ts/ai-trace-event-v2.d.ts +31 -0
- package/dist/gen-ts/ai-trace-event-v2.js +3 -0
- package/dist/gen-ts/ai-transform-event.d.ts +2 -21
- package/dist/gen-ts/ai-transform-result.d.ts +1 -1
- package/dist/gen-ts/ai-verification-evidence.d.ts +2 -1
- package/dist/gen-ts/contract-release.d.ts +7 -0
- package/dist/gen-ts/contract-release.js +9 -0
- package/dist/gen-ts/data-grant.d.ts +1 -1
- package/dist/gen-ts/error-category-registry.d.ts +5 -0
- package/dist/gen-ts/error-category-registry.js +10 -0
- package/dist/gen-ts/index.d.ts +12 -0
- package/dist/gen-ts/index.js +12 -0
- package/dist/gen-ts/kvs-routing-entry.d.ts +19 -5
- package/dist/gen-ts/promotion-request.d.ts +23 -0
- package/dist/gen-ts/transform-report.d.ts +102 -0
- package/dist/gen-ts/transform-report.js +3 -0
- package/fixtures/ai/valid-blocked-trace-event.json +31 -0
- package/fixtures/ai/valid-budget-ledger-event.json +15 -0
- package/fixtures/ai/valid-classification-stamp.json +19 -0
- package/fixtures/ai/valid-composite-policy-digest.json +11 -0
- package/fixtures/ai/valid-deployment-gate-decision.json +18 -0
- package/fixtures/ai/valid-failed-trace-event.json +50 -0
- package/fixtures/ai/valid-gateway-key-lifecycle-event.json +16 -0
- package/fixtures/ai/valid-gateway-key-lookup.json +14 -0
- package/fixtures/ai/valid-governance-decision.json +53 -0
- package/fixtures/ai/valid-inventory.json +30 -0
- package/fixtures/ai/valid-metering-policy.json +8 -0
- package/fixtures/ai/valid-policy-snapshot.json +117 -0
- package/fixtures/ai/valid-pricing-revision.json +14 -0
- package/fixtures/ai/valid-runtime-binding.json +7 -0
- package/fixtures/ai/valid-runtime-contract.json +24 -0
- package/fixtures/ai/valid-trace-event-v2.json +24 -0
- package/fixtures/ai/valid-trace-event.json +41 -0
- package/fixtures/ai/valid-transform-event.json +32 -0
- package/fixtures/ai/valid-transform-result.json +23 -0
- package/fixtures/ai/valid-verification-evidence.json +33 -0
- package/gen-ts/ai-budget-ledger-event.ts +25 -0
- package/gen-ts/ai-callsite-inventory.ts +64 -0
- package/gen-ts/ai-classification-stamp.ts +28 -0
- package/gen-ts/ai-composite-policy-digest-helper.ts +18 -0
- package/gen-ts/ai-composite-policy-digest.ts +16 -0
- package/gen-ts/ai-deployment-gate-decision.ts +30 -0
- package/gen-ts/ai-gateway-key-lifecycle-event.ts +81 -0
- package/gen-ts/ai-gateway-key-lookup.ts +23 -0
- package/gen-ts/ai-gateway-key-token.ts +7 -0
- package/gen-ts/ai-governance-decision.ts +90 -0
- package/gen-ts/ai-metering-policy.ts +20 -0
- package/gen-ts/ai-policy-snapshot.ts +169 -0
- package/gen-ts/ai-pricing-revision.ts +33 -0
- package/gen-ts/ai-runtime-binding.ts +18 -0
- package/gen-ts/ai-runtime-contract.ts +46 -0
- package/gen-ts/ai-trace-event-v2.ts +35 -0
- package/gen-ts/ai-trace-event.ts +72 -0
- package/gen-ts/ai-transform-event.ts +51 -0
- package/gen-ts/ai-transform-result.ts +36 -0
- package/gen-ts/ai-verification-evidence.ts +54 -0
- package/gen-ts/api-error-response.ts +16 -0
- package/gen-ts/artifact-contract.ts +81 -0
- package/gen-ts/contract-release.ts +10 -0
- package/gen-ts/data-dependency.ts +46 -0
- package/gen-ts/data-grant.ts +71 -0
- package/gen-ts/data-source.ts +78 -0
- package/gen-ts/deploy-request.ts +66 -0
- package/gen-ts/deploy-response.ts +25 -0
- package/gen-ts/deployment-environment.ts +7 -0
- package/gen-ts/deployment-source.ts +16 -0
- package/gen-ts/deployment-status-failure.ts +12 -0
- package/gen-ts/deployment-status-request.ts +11 -0
- package/gen-ts/deployment-status-response.ts +39 -0
- package/gen-ts/env-bindings.ts +64 -0
- package/gen-ts/error-category-registry.ts +108 -0
- package/gen-ts/error-category.ts +7 -0
- package/gen-ts/error-envelope.ts +49 -0
- package/gen-ts/index.ts +47 -0
- package/gen-ts/kvs-routing-entry.ts +30 -0
- package/gen-ts/promotion-request.ts +43 -0
- package/gen-ts/promotion-response.ts +20 -0
- package/gen-ts/secret-reference.ts +40 -0
- package/gen-ts/transform-report.ts +105 -0
- package/gen-ts/version-state-machine.ts +52 -0
- package/gen-ts/version-state.ts +19 -0
- package/package.json +8 -4
- package/schema/ai-budget-ledger-event.schema.json +29 -0
- package/schema/ai-classification-stamp.schema.json +40 -0
- package/schema/ai-composite-policy-digest.schema.json +27 -0
- package/schema/ai-deployment-gate-decision.schema.json +38 -0
- package/schema/ai-gateway-key-lifecycle-event.schema.json +61 -0
- package/schema/ai-governance-decision.schema.json +23 -2
- package/schema/ai-metering-policy.schema.json +18 -0
- package/schema/ai-pricing-revision.schema.json +38 -0
- package/schema/ai-runtime-binding.schema.json +26 -0
- package/schema/ai-runtime-contract.schema.json +24 -2
- package/schema/ai-trace-event-v2.schema.json +41 -0
- package/schema/ai-verification-evidence.schema.json +1 -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/transform-report.schema.json +204 -0
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
export type AiTraceV2Digest = string;
|
|
5
|
+
export type AiTraceV2Identifier = string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Additive metering projection linked to a readable v1 trace. It carries dimension-level reported or estimated usage without changing the v1 event.
|
|
9
|
+
*/
|
|
10
|
+
export interface AiTraceEventV2 {
|
|
11
|
+
schema: 'harbour.ai-trace-event/2.0';
|
|
12
|
+
traceId: string;
|
|
13
|
+
requestId: string;
|
|
14
|
+
policyDigest: AiTraceV2Digest;
|
|
15
|
+
outcome: 'succeeded' | 'blocked' | 'failed' | 'cancelled';
|
|
16
|
+
/**
|
|
17
|
+
* @maxItems 256
|
|
18
|
+
*/
|
|
19
|
+
usageLineItems: UsageLineItem[];
|
|
20
|
+
totalCostMicroUsd: number;
|
|
21
|
+
reservationId?: string;
|
|
22
|
+
meteringStatus: 'settled' | 'reserved' | 'unknown' | 'repaired';
|
|
23
|
+
occurredAt: string;
|
|
24
|
+
}
|
|
25
|
+
export interface UsageLineItem {
|
|
26
|
+
attempt: number;
|
|
27
|
+
dimension: AiTraceV2Identifier;
|
|
28
|
+
direction: 'input' | 'output';
|
|
29
|
+
quantity: number;
|
|
30
|
+
unit: AiTraceV2Identifier;
|
|
31
|
+
priceRevisionDigest: AiTraceV2Digest;
|
|
32
|
+
scale: number;
|
|
33
|
+
costMicroUsd: number;
|
|
34
|
+
provenance: 'reported' | 'estimated';
|
|
35
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Value-free asynchronous AI Gateway trace metadata. Raw prompts and responses never enter the queue; captured content is referenced only after successful encrypted storage.
|
|
6
|
+
*/
|
|
7
|
+
export type AiTraceEvent = {
|
|
8
|
+
schema: 'harbour.ai-trace-event/1.0';
|
|
9
|
+
traceId: string;
|
|
10
|
+
requestId: string;
|
|
11
|
+
tenantId: AiTraceIdentifier;
|
|
12
|
+
appId: AiTraceIdentifier;
|
|
13
|
+
environment: AiTraceIdentifier;
|
|
14
|
+
versionId: string;
|
|
15
|
+
callsiteFingerprint?: AiTraceDigest;
|
|
16
|
+
policyDigest: AiTraceDigest;
|
|
17
|
+
routeRevision?: string;
|
|
18
|
+
requestedModel?: string;
|
|
19
|
+
governedModelAlias?: string;
|
|
20
|
+
provider?: 'openai' | 'anthropic' | 'gemini' | 'openrouter';
|
|
21
|
+
providerModel?: string;
|
|
22
|
+
outcome: 'succeeded' | 'blocked' | 'failed' | 'cancelled';
|
|
23
|
+
usage?: AiTraceUsage;
|
|
24
|
+
priceRevision?: AiTraceIdentifier;
|
|
25
|
+
costMicroUsd: number;
|
|
26
|
+
latencyMs: number;
|
|
27
|
+
retryCount: number;
|
|
28
|
+
fallbackUsed: boolean;
|
|
29
|
+
reservationId?: string;
|
|
30
|
+
/**
|
|
31
|
+
* @minItems 0
|
|
32
|
+
* @maxItems 32
|
|
33
|
+
*/
|
|
34
|
+
attempts: AiTraceAttempt[];
|
|
35
|
+
/**
|
|
36
|
+
* @maxItems 128
|
|
37
|
+
*/
|
|
38
|
+
guardrailResults: AiTraceGuardrailResult[];
|
|
39
|
+
contentCaptureStatus: 'off' | 'captured' | 'capture_failed';
|
|
40
|
+
contentRef?: string;
|
|
41
|
+
retentionExpiresAt?: string;
|
|
42
|
+
occurredAt: string;
|
|
43
|
+
};
|
|
44
|
+
export type AiTraceIdentifier = string;
|
|
45
|
+
export type AiTraceDigest = string;
|
|
46
|
+
export type AiTraceAttempt = {
|
|
47
|
+
attempt: number;
|
|
48
|
+
provider: 'openai' | 'anthropic' | 'gemini' | 'openrouter';
|
|
49
|
+
providerModel: string;
|
|
50
|
+
priceRevision: AiTraceIdentifier;
|
|
51
|
+
outcome: 'succeeded' | 'failed' | 'timed_out' | 'cancelled';
|
|
52
|
+
/**
|
|
53
|
+
* Provider-reported token usage, or null when the attempt did not succeed and the provider reported none. Null states that usage is UNKNOWN — estimates are never fabricated. A succeeded attempt always reports real usage.
|
|
54
|
+
*/
|
|
55
|
+
usage: AiTraceUsage | null;
|
|
56
|
+
costMicroUsd: number;
|
|
57
|
+
latencyMs: number;
|
|
58
|
+
errorCode?: string;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export interface AiTraceUsage {
|
|
62
|
+
inputTokens: number;
|
|
63
|
+
outputTokens: number;
|
|
64
|
+
}
|
|
65
|
+
export interface AiTraceGuardrailResult {
|
|
66
|
+
ruleId: string;
|
|
67
|
+
detectorId: string;
|
|
68
|
+
detectorVersion: string;
|
|
69
|
+
phase: 'input' | 'output';
|
|
70
|
+
action: 'ALLOW' | 'OBSERVE' | 'REDACT' | 'BLOCK';
|
|
71
|
+
result: 'passed' | 'matched' | 'blocked' | 'redacted';
|
|
72
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
export type AiTransformIdentifier = string;
|
|
5
|
+
export type AiTransformDigest = string;
|
|
6
|
+
export type AiTransformPlanEntry = {
|
|
7
|
+
callSiteFingerprint: AiTransformDigest;
|
|
8
|
+
sourcePath: string;
|
|
9
|
+
expectedSourceFileSha256: AiTransformDigest;
|
|
10
|
+
strategy: 'deployment_injection' | 'deterministic_adapter';
|
|
11
|
+
configurationMappingId?: AiTransformIdentifier;
|
|
12
|
+
configurationMappingVersion?: string;
|
|
13
|
+
transformId?: AiTransformIdentifier;
|
|
14
|
+
transformVersion?: string;
|
|
15
|
+
/**
|
|
16
|
+
* @minItems 1
|
|
17
|
+
* @maxItems 32
|
|
18
|
+
*/
|
|
19
|
+
allowedSyntaxKinds: AiTransformIdentifier[];
|
|
20
|
+
runtimeShimName?: string;
|
|
21
|
+
runtimeShimVersion?: string;
|
|
22
|
+
runtimeShimDigest?: AiTransformDigest;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Checksum-bound deterministic AI interception task input. Entries are the complete ordered PLAN interception plan so the task can verify the governance plan digest before applying its deterministic subset; source and patches are referenced, never embedded.
|
|
27
|
+
*/
|
|
28
|
+
export interface AiTransformEvent {
|
|
29
|
+
schema: 'harbour.ai-transform-event/1.0';
|
|
30
|
+
tenantId: AiTransformIdentifier;
|
|
31
|
+
appId: AiTransformIdentifier;
|
|
32
|
+
environment: AiTransformIdentifier;
|
|
33
|
+
versionId: string;
|
|
34
|
+
sourceRevision: string;
|
|
35
|
+
workspace: AiTransformWorkspace;
|
|
36
|
+
inventoryDigest: AiTransformDigest;
|
|
37
|
+
policyDigest: AiTransformDigest;
|
|
38
|
+
runtimeContractDigest: AiTransformDigest;
|
|
39
|
+
interceptionPlanDigest: AiTransformDigest;
|
|
40
|
+
/**
|
|
41
|
+
* @minItems 1
|
|
42
|
+
* @maxItems 1000
|
|
43
|
+
*/
|
|
44
|
+
entries: AiTransformPlanEntry[];
|
|
45
|
+
}
|
|
46
|
+
export interface AiTransformWorkspace {
|
|
47
|
+
bucket: string;
|
|
48
|
+
key: string;
|
|
49
|
+
sha256: AiTransformDigest;
|
|
50
|
+
size: number;
|
|
51
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
export type AiTransformResultDigest = string;
|
|
5
|
+
export type AiTransformResultIdentifier = string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Bounded deterministic interception result; contains descriptors and digest evidence only.
|
|
9
|
+
*/
|
|
10
|
+
export interface AiTransformResult {
|
|
11
|
+
schema: 'harbour.ai-transform-result/1.0';
|
|
12
|
+
workspace: AiTransformResultWorkspace;
|
|
13
|
+
interceptionPlanDigest: AiTransformResultDigest;
|
|
14
|
+
transformerVersion: string;
|
|
15
|
+
/**
|
|
16
|
+
* @minItems 1
|
|
17
|
+
* @maxItems 1000
|
|
18
|
+
*/
|
|
19
|
+
applied: AiTransformApplied[];
|
|
20
|
+
}
|
|
21
|
+
export interface AiTransformResultWorkspace {
|
|
22
|
+
bucket: string;
|
|
23
|
+
key: string;
|
|
24
|
+
sha256: AiTransformResultDigest;
|
|
25
|
+
size: number;
|
|
26
|
+
}
|
|
27
|
+
export interface AiTransformApplied {
|
|
28
|
+
callSiteFingerprint: AiTransformResultDigest;
|
|
29
|
+
transformId: AiTransformResultIdentifier;
|
|
30
|
+
transformVersion: string;
|
|
31
|
+
sourcePath: string;
|
|
32
|
+
beforeSha256: AiTransformResultDigest;
|
|
33
|
+
afterSha256: AiTransformResultDigest;
|
|
34
|
+
governedBoundaryFingerprint: AiTransformResultDigest;
|
|
35
|
+
runtimeShimDigest: AiTransformResultDigest;
|
|
36
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
export type AiVerificationIdentifier = string;
|
|
5
|
+
export type AiVerificationDigest = string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Bounded, value-free evidence submitted by deployment verification for one governed version.
|
|
9
|
+
*/
|
|
10
|
+
export interface AiVerificationEvidence {
|
|
11
|
+
schema: 'harbour.ai-verification-evidence/1.0';
|
|
12
|
+
tenantId: AiVerificationIdentifier;
|
|
13
|
+
appId: AiVerificationIdentifier;
|
|
14
|
+
environment: AiVerificationIdentifier;
|
|
15
|
+
versionId: string;
|
|
16
|
+
sourceRevision: string;
|
|
17
|
+
inventoryDigest: AiVerificationDigest;
|
|
18
|
+
interceptionPlanDigest: AiVerificationDigest;
|
|
19
|
+
runtimeContractDigest: AiVerificationDigest;
|
|
20
|
+
policyDigest: AiVerificationDigest;
|
|
21
|
+
runtimeBindingDigest?: AiVerificationDigest;
|
|
22
|
+
finalWorkspaceDigest: AiVerificationDigest;
|
|
23
|
+
/**
|
|
24
|
+
* @maxItems 1000
|
|
25
|
+
*/
|
|
26
|
+
verifiedCallsiteFingerprints: AiVerificationDigest[];
|
|
27
|
+
/**
|
|
28
|
+
* @maxItems 1000
|
|
29
|
+
*/
|
|
30
|
+
appliedTransforms: AiVerificationTransform[];
|
|
31
|
+
/**
|
|
32
|
+
* @minItems 1
|
|
33
|
+
* @maxItems 32
|
|
34
|
+
*/
|
|
35
|
+
endpointChecks: AiVerificationEndpointCheck[];
|
|
36
|
+
providerCredentialsAbsent: true;
|
|
37
|
+
smokeTraceId: string;
|
|
38
|
+
evidenceDigest: AiVerificationDigest;
|
|
39
|
+
verifiedAt: string;
|
|
40
|
+
}
|
|
41
|
+
export interface AiVerificationTransform {
|
|
42
|
+
callSiteFingerprint: AiVerificationDigest;
|
|
43
|
+
governedBoundaryFingerprint: AiVerificationDigest;
|
|
44
|
+
transformId: AiVerificationIdentifier;
|
|
45
|
+
transformVersion: string;
|
|
46
|
+
beforeSha256: AiVerificationDigest;
|
|
47
|
+
afterSha256: AiVerificationDigest;
|
|
48
|
+
runtimeShimDigest: AiVerificationDigest;
|
|
49
|
+
}
|
|
50
|
+
export interface AiVerificationEndpointCheck {
|
|
51
|
+
name: AiVerificationIdentifier;
|
|
52
|
+
passed: true;
|
|
53
|
+
configurationMappingVersion: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Safe JSON error body returned by the Deploy and Status Lambdas for API-level 4xx and 5xx responses. It is distinct from the internal pipeline ErrorEnvelope, which requires a version and evidence reference.
|
|
6
|
+
*/
|
|
7
|
+
export interface ApiErrorResponse {
|
|
8
|
+
code: string;
|
|
9
|
+
message: string;
|
|
10
|
+
correlationId: string;
|
|
11
|
+
requestId?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Present when a version was minted before the API-level failure.
|
|
14
|
+
*/
|
|
15
|
+
versionId?: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The build output contract (LLD §3) — the provider-portability seam. Emitted by the build (`artifact.json`) and consumed by every deploy stage below build. Deploy stages read ONLY this document plus the blobs it references. Secret REFERENCES only — never values.
|
|
6
|
+
*/
|
|
7
|
+
export interface ArtifactContract {
|
|
8
|
+
contract_version: 1;
|
|
9
|
+
app_id: string;
|
|
10
|
+
commit: string;
|
|
11
|
+
/**
|
|
12
|
+
* sha256 of the canonical bundle; the immutable identity that promotion pins to (invariant §1.3.2).
|
|
13
|
+
*/
|
|
14
|
+
artifact_digest: string;
|
|
15
|
+
backend: {
|
|
16
|
+
type: 'oci-image' | 'zip';
|
|
17
|
+
/**
|
|
18
|
+
* ECR uri@digest (oci-image) or S3 key (zip).
|
|
19
|
+
*/
|
|
20
|
+
ref: string;
|
|
21
|
+
entrypoint: string;
|
|
22
|
+
runtime: string;
|
|
23
|
+
};
|
|
24
|
+
static: {
|
|
25
|
+
/**
|
|
26
|
+
* e.g. builds/<digest>/
|
|
27
|
+
*/
|
|
28
|
+
path: string;
|
|
29
|
+
/**
|
|
30
|
+
* true when static assets carry no env-specific values (no static rebuild needed on promotion).
|
|
31
|
+
*/
|
|
32
|
+
env_agnostic: boolean;
|
|
33
|
+
};
|
|
34
|
+
routes: {
|
|
35
|
+
path: string;
|
|
36
|
+
target: 'backend' | 'static';
|
|
37
|
+
}[];
|
|
38
|
+
env: {
|
|
39
|
+
/**
|
|
40
|
+
* Non-secret env vars, e.g. {"PORT":"8080"}.
|
|
41
|
+
*/
|
|
42
|
+
vars: {
|
|
43
|
+
[k: string]: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Secrets Manager references only, e.g. harbour/<org>/<app>/<env>/STRIPE_KEY. Never values.
|
|
47
|
+
*/
|
|
48
|
+
secret_refs: string[];
|
|
49
|
+
};
|
|
50
|
+
storage_bindings: {
|
|
51
|
+
kind: 'sql' | 'kv' | 'files';
|
|
52
|
+
/**
|
|
53
|
+
* Logical name, e.g. "default".
|
|
54
|
+
*/
|
|
55
|
+
logical?: string;
|
|
56
|
+
/**
|
|
57
|
+
* e.g. aurora-sv2.
|
|
58
|
+
*/
|
|
59
|
+
provider: string;
|
|
60
|
+
}[];
|
|
61
|
+
/**
|
|
62
|
+
* Post-MVP (migration tooling is post-MVP, LLD §4.6); MVP emits an empty array.
|
|
63
|
+
*/
|
|
64
|
+
migrations: {
|
|
65
|
+
seq: number;
|
|
66
|
+
sha: string;
|
|
67
|
+
destructive: boolean;
|
|
68
|
+
path: string;
|
|
69
|
+
}[];
|
|
70
|
+
/**
|
|
71
|
+
* MVP emits an empty array.
|
|
72
|
+
*/
|
|
73
|
+
scheduled_tasks: {}[];
|
|
74
|
+
transform_report: {
|
|
75
|
+
/**
|
|
76
|
+
* Transformed surfaces, e.g. ["secrets","storage.sql"].
|
|
77
|
+
*/
|
|
78
|
+
surfaces: string[];
|
|
79
|
+
static_rebuild_required: boolean;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
export const ContractRepositoryVersion = "0.9.0.0" as const;
|
|
5
|
+
export const ContractPublishVersion = "0.9.0" as const;
|
|
6
|
+
export const ContractPublishTag = "v0.9.0" as const;
|
|
7
|
+
export const ContractSchemasDigest = "sha256:df73090b9fbbac8a39d0ec92e929f4d687bd7920de583fb2463bf8570dc68ebb" as const;
|
|
8
|
+
export const ContractAiFixturesDigest = "sha256:180a5f30cf0b6d93fa4c812a217d2365ffe22ac54d11626e71f8072fcf8f67c6" as const;
|
|
9
|
+
export const ContractGeneratedGoDigest = "sha256:be376911aec8ee6359a38fdafebf343ce157255e19c544617b7bcccd4329e5de" as const;
|
|
10
|
+
export const ContractGeneratedTypeScriptDigest = "sha256:857288e60b476b42dce0304ec05aff6af1f2719278959ed03740ef88af5e736b" as const;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* database = a SQL/warehouse connection; api = an HTTP(S) service; app_owned_external = infrastructure the app owns outside Harbour.
|
|
6
|
+
*/
|
|
7
|
+
export type DataDependencyKind = 'database' | 'api' | 'app_owned_external';
|
|
8
|
+
/**
|
|
9
|
+
* matched = resolved to a registered source; out_of_scope = resolved but not requestable; unknown = unresolvable; inventory = registered but unused; app_owned_external = app-owned, outside Harbour's remit.
|
|
10
|
+
*/
|
|
11
|
+
export type DataDependencyClassification = 'matched' | 'out_of_scope' | 'unknown' | 'inventory' | 'app_owned_external';
|
|
12
|
+
/**
|
|
13
|
+
* declared = stated by the builder; detected = found by analysis.
|
|
14
|
+
*/
|
|
15
|
+
export type DataDependencyOrigin = 'declared' | 'detected';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A single external data dependency of an app, either declared by the builder or detected during analysis. Classification records how the dependency resolved against the tenant's registered data-source inventory; matchedSourceId is present only when classification is matched.
|
|
19
|
+
*/
|
|
20
|
+
export interface DataDependency {
|
|
21
|
+
kind: DataDependencyKind;
|
|
22
|
+
identifiers: DataDependencyIdentifiers;
|
|
23
|
+
classification: DataDependencyClassification;
|
|
24
|
+
/**
|
|
25
|
+
* sourceId of the registered data source this dependency matched; present only when classification is matched.
|
|
26
|
+
*/
|
|
27
|
+
matchedSourceId?: string;
|
|
28
|
+
origin: DataDependencyOrigin;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Evidence identifying the dependency; used to match it against the registered source inventory.
|
|
32
|
+
*/
|
|
33
|
+
export interface DataDependencyIdentifiers {
|
|
34
|
+
/**
|
|
35
|
+
* Hostnames the dependency was observed or declared against.
|
|
36
|
+
*/
|
|
37
|
+
hosts: string[];
|
|
38
|
+
/**
|
|
39
|
+
* Client driver/library that surfaced the dependency (e.g. pg, snowflake-sdk).
|
|
40
|
+
*/
|
|
41
|
+
driver?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Environment-variable names the app reads to configure this dependency.
|
|
44
|
+
*/
|
|
45
|
+
envNames: string[];
|
|
46
|
+
}
|