@oxyhq/contracts 0.25.0 → 0.27.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/NOTICE +10 -9
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/accountGraph.js +4 -3
- package/dist/cjs/browserHub.js +215 -0
- package/dist/cjs/deviceDirectory.js +189 -0
- package/dist/cjs/index.js +172 -2
- package/dist/cjs/inference/attribution.js +101 -0
- package/dist/cjs/inference/catalogue.js +482 -0
- package/dist/cjs/inference/errors.js +195 -0
- package/dist/cjs/inference/identifiers.js +189 -0
- package/dist/cjs/inference/money.js +145 -0
- package/dist/cjs/inference/priceVersion.js +110 -0
- package/dist/cjs/inference/providerConnection.js +142 -0
- package/dist/cjs/inference/request.js +288 -0
- package/dist/cjs/inference/routingPolicy.js +213 -0
- package/dist/cjs/inference/streamEvents.js +219 -0
- package/dist/cjs/inference/usage.js +291 -0
- package/dist/cjs/inference/version.js +57 -0
- package/dist/cjs/oauth.js +66 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/accountGraph.js +4 -3
- package/dist/esm/browserHub.js +212 -0
- package/dist/esm/deviceDirectory.js +186 -0
- package/dist/esm/index.js +48 -0
- package/dist/esm/inference/attribution.js +98 -0
- package/dist/esm/inference/catalogue.js +479 -0
- package/dist/esm/inference/errors.js +192 -0
- package/dist/esm/inference/identifiers.js +186 -0
- package/dist/esm/inference/money.js +142 -0
- package/dist/esm/inference/priceVersion.js +107 -0
- package/dist/esm/inference/providerConnection.js +139 -0
- package/dist/esm/inference/request.js +285 -0
- package/dist/esm/inference/routingPolicy.js +210 -0
- package/dist/esm/inference/streamEvents.js +216 -0
- package/dist/esm/inference/usage.js +288 -0
- package/dist/esm/inference/version.js +54 -0
- package/dist/esm/oauth.js +63 -0
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/accountGraph.d.ts +6 -5
- package/dist/types/browserHub.d.ts +856 -0
- package/dist/types/deviceDirectory.d.ts +1317 -0
- package/dist/types/deviceSession.d.ts +46 -46
- package/dist/types/index.d.ts +29 -0
- package/dist/types/inference/attribution.d.ts +171 -0
- package/dist/types/inference/catalogue.d.ts +1612 -0
- package/dist/types/inference/errors.d.ts +193 -0
- package/dist/types/inference/identifiers.d.ts +149 -0
- package/dist/types/inference/money.d.ts +142 -0
- package/dist/types/inference/priceVersion.d.ts +182 -0
- package/dist/types/inference/providerConnection.d.ts +297 -0
- package/dist/types/inference/request.d.ts +2364 -0
- package/dist/types/inference/routingPolicy.d.ts +426 -0
- package/dist/types/inference/streamEvents.d.ts +906 -0
- package/dist/types/inference/usage.d.ts +1133 -0
- package/dist/types/inference/version.d.ts +54 -0
- package/dist/types/oauth.d.ts +86 -0
- package/dist/types/sessionStatus.d.ts +8 -8
- package/dist/types/userResponse.d.ts +8 -8
- package/package.json +1 -1
|
@@ -5,13 +5,13 @@ export declare const sessionAccountSchema: z.ZodObject<{
|
|
|
5
5
|
authuser: z.ZodNumber;
|
|
6
6
|
operatedByUserId: z.ZodOptional<z.ZodString>;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
|
-
sessionId: string;
|
|
9
8
|
accountId: string;
|
|
9
|
+
sessionId: string;
|
|
10
10
|
authuser: number;
|
|
11
11
|
operatedByUserId?: string | undefined;
|
|
12
12
|
}, {
|
|
13
|
-
sessionId: string;
|
|
14
13
|
accountId: string;
|
|
14
|
+
sessionId: string;
|
|
15
15
|
authuser: number;
|
|
16
16
|
operatedByUserId?: string | undefined;
|
|
17
17
|
}>;
|
|
@@ -23,13 +23,13 @@ export declare const deviceSessionStateSchema: z.ZodObject<{
|
|
|
23
23
|
authuser: z.ZodNumber;
|
|
24
24
|
operatedByUserId: z.ZodOptional<z.ZodString>;
|
|
25
25
|
}, "strip", z.ZodTypeAny, {
|
|
26
|
-
sessionId: string;
|
|
27
26
|
accountId: string;
|
|
27
|
+
sessionId: string;
|
|
28
28
|
authuser: number;
|
|
29
29
|
operatedByUserId?: string | undefined;
|
|
30
30
|
}, {
|
|
31
|
-
sessionId: string;
|
|
32
31
|
accountId: string;
|
|
32
|
+
sessionId: string;
|
|
33
33
|
authuser: number;
|
|
34
34
|
operatedByUserId?: string | undefined;
|
|
35
35
|
}>, "many">;
|
|
@@ -37,37 +37,37 @@ export declare const deviceSessionStateSchema: z.ZodObject<{
|
|
|
37
37
|
revision: z.ZodNumber;
|
|
38
38
|
updatedAt: z.ZodNumber;
|
|
39
39
|
}, "strip", z.ZodTypeAny, {
|
|
40
|
-
updatedAt: number;
|
|
41
40
|
deviceId: string;
|
|
42
41
|
accounts: {
|
|
43
|
-
sessionId: string;
|
|
44
42
|
accountId: string;
|
|
43
|
+
sessionId: string;
|
|
45
44
|
authuser: number;
|
|
46
45
|
operatedByUserId?: string | undefined;
|
|
47
46
|
}[];
|
|
48
47
|
activeAccountId: string | null;
|
|
49
48
|
revision: number;
|
|
50
|
-
}, {
|
|
51
49
|
updatedAt: number;
|
|
50
|
+
}, {
|
|
52
51
|
deviceId: string;
|
|
53
52
|
accounts: {
|
|
54
|
-
sessionId: string;
|
|
55
53
|
accountId: string;
|
|
54
|
+
sessionId: string;
|
|
56
55
|
authuser: number;
|
|
57
56
|
operatedByUserId?: string | undefined;
|
|
58
57
|
}[];
|
|
59
58
|
activeAccountId: string | null;
|
|
60
59
|
revision: number;
|
|
60
|
+
updatedAt: number;
|
|
61
61
|
}>;
|
|
62
62
|
export declare const activeTokenSchema: z.ZodObject<{
|
|
63
63
|
accessToken: z.ZodString;
|
|
64
64
|
expiresAt: z.ZodString;
|
|
65
65
|
}, "strip", z.ZodTypeAny, {
|
|
66
|
-
expiresAt: string;
|
|
67
66
|
accessToken: string;
|
|
68
|
-
}, {
|
|
69
67
|
expiresAt: string;
|
|
68
|
+
}, {
|
|
70
69
|
accessToken: string;
|
|
70
|
+
expiresAt: string;
|
|
71
71
|
}>;
|
|
72
72
|
export declare const deviceSessionSyncSchema: z.ZodObject<{
|
|
73
73
|
state: z.ZodObject<{
|
|
@@ -78,13 +78,13 @@ export declare const deviceSessionSyncSchema: z.ZodObject<{
|
|
|
78
78
|
authuser: z.ZodNumber;
|
|
79
79
|
operatedByUserId: z.ZodOptional<z.ZodString>;
|
|
80
80
|
}, "strip", z.ZodTypeAny, {
|
|
81
|
-
sessionId: string;
|
|
82
81
|
accountId: string;
|
|
82
|
+
sessionId: string;
|
|
83
83
|
authuser: number;
|
|
84
84
|
operatedByUserId?: string | undefined;
|
|
85
85
|
}, {
|
|
86
|
-
sessionId: string;
|
|
87
86
|
accountId: string;
|
|
87
|
+
sessionId: string;
|
|
88
88
|
authuser: number;
|
|
89
89
|
operatedByUserId?: string | undefined;
|
|
90
90
|
}>, "many">;
|
|
@@ -92,71 +92,71 @@ export declare const deviceSessionSyncSchema: z.ZodObject<{
|
|
|
92
92
|
revision: z.ZodNumber;
|
|
93
93
|
updatedAt: z.ZodNumber;
|
|
94
94
|
}, "strip", z.ZodTypeAny, {
|
|
95
|
-
updatedAt: number;
|
|
96
95
|
deviceId: string;
|
|
97
96
|
accounts: {
|
|
98
|
-
sessionId: string;
|
|
99
97
|
accountId: string;
|
|
98
|
+
sessionId: string;
|
|
100
99
|
authuser: number;
|
|
101
100
|
operatedByUserId?: string | undefined;
|
|
102
101
|
}[];
|
|
103
102
|
activeAccountId: string | null;
|
|
104
103
|
revision: number;
|
|
105
|
-
}, {
|
|
106
104
|
updatedAt: number;
|
|
105
|
+
}, {
|
|
107
106
|
deviceId: string;
|
|
108
107
|
accounts: {
|
|
109
|
-
sessionId: string;
|
|
110
108
|
accountId: string;
|
|
109
|
+
sessionId: string;
|
|
111
110
|
authuser: number;
|
|
112
111
|
operatedByUserId?: string | undefined;
|
|
113
112
|
}[];
|
|
114
113
|
activeAccountId: string | null;
|
|
115
114
|
revision: number;
|
|
115
|
+
updatedAt: number;
|
|
116
116
|
}>;
|
|
117
117
|
activeToken: z.ZodNullable<z.ZodObject<{
|
|
118
118
|
accessToken: z.ZodString;
|
|
119
119
|
expiresAt: z.ZodString;
|
|
120
120
|
}, "strip", z.ZodTypeAny, {
|
|
121
|
-
expiresAt: string;
|
|
122
121
|
accessToken: string;
|
|
123
|
-
}, {
|
|
124
122
|
expiresAt: string;
|
|
123
|
+
}, {
|
|
125
124
|
accessToken: string;
|
|
125
|
+
expiresAt: string;
|
|
126
126
|
}>>;
|
|
127
127
|
}, "strip", z.ZodTypeAny, {
|
|
128
128
|
state: {
|
|
129
|
-
updatedAt: number;
|
|
130
129
|
deviceId: string;
|
|
131
130
|
accounts: {
|
|
132
|
-
sessionId: string;
|
|
133
131
|
accountId: string;
|
|
132
|
+
sessionId: string;
|
|
134
133
|
authuser: number;
|
|
135
134
|
operatedByUserId?: string | undefined;
|
|
136
135
|
}[];
|
|
137
136
|
activeAccountId: string | null;
|
|
138
137
|
revision: number;
|
|
138
|
+
updatedAt: number;
|
|
139
139
|
};
|
|
140
140
|
activeToken: {
|
|
141
|
-
expiresAt: string;
|
|
142
141
|
accessToken: string;
|
|
142
|
+
expiresAt: string;
|
|
143
143
|
} | null;
|
|
144
144
|
}, {
|
|
145
145
|
state: {
|
|
146
|
-
updatedAt: number;
|
|
147
146
|
deviceId: string;
|
|
148
147
|
accounts: {
|
|
149
|
-
sessionId: string;
|
|
150
148
|
accountId: string;
|
|
149
|
+
sessionId: string;
|
|
151
150
|
authuser: number;
|
|
152
151
|
operatedByUserId?: string | undefined;
|
|
153
152
|
}[];
|
|
154
153
|
activeAccountId: string | null;
|
|
155
154
|
revision: number;
|
|
155
|
+
updatedAt: number;
|
|
156
156
|
};
|
|
157
157
|
activeToken: {
|
|
158
|
-
expiresAt: string;
|
|
159
158
|
accessToken: string;
|
|
159
|
+
expiresAt: string;
|
|
160
160
|
} | null;
|
|
161
161
|
}>;
|
|
162
162
|
export type SessionAccount = z.infer<typeof sessionAccountSchema>;
|
|
@@ -211,13 +211,13 @@ export declare const deviceTokenMintResponseSchema: z.ZodObject<{
|
|
|
211
211
|
authuser: z.ZodNumber;
|
|
212
212
|
operatedByUserId: z.ZodOptional<z.ZodString>;
|
|
213
213
|
}, "strip", z.ZodTypeAny, {
|
|
214
|
-
sessionId: string;
|
|
215
214
|
accountId: string;
|
|
215
|
+
sessionId: string;
|
|
216
216
|
authuser: number;
|
|
217
217
|
operatedByUserId?: string | undefined;
|
|
218
218
|
}, {
|
|
219
|
-
sessionId: string;
|
|
220
219
|
accountId: string;
|
|
220
|
+
sessionId: string;
|
|
221
221
|
authuser: number;
|
|
222
222
|
operatedByUserId?: string | undefined;
|
|
223
223
|
}>, "many">;
|
|
@@ -225,58 +225,58 @@ export declare const deviceTokenMintResponseSchema: z.ZodObject<{
|
|
|
225
225
|
revision: z.ZodNumber;
|
|
226
226
|
updatedAt: z.ZodNumber;
|
|
227
227
|
}, "strip", z.ZodTypeAny, {
|
|
228
|
-
updatedAt: number;
|
|
229
228
|
deviceId: string;
|
|
230
229
|
accounts: {
|
|
231
|
-
sessionId: string;
|
|
232
230
|
accountId: string;
|
|
231
|
+
sessionId: string;
|
|
233
232
|
authuser: number;
|
|
234
233
|
operatedByUserId?: string | undefined;
|
|
235
234
|
}[];
|
|
236
235
|
activeAccountId: string | null;
|
|
237
236
|
revision: number;
|
|
238
|
-
}, {
|
|
239
237
|
updatedAt: number;
|
|
238
|
+
}, {
|
|
240
239
|
deviceId: string;
|
|
241
240
|
accounts: {
|
|
242
|
-
sessionId: string;
|
|
243
241
|
accountId: string;
|
|
242
|
+
sessionId: string;
|
|
244
243
|
authuser: number;
|
|
245
244
|
operatedByUserId?: string | undefined;
|
|
246
245
|
}[];
|
|
247
246
|
activeAccountId: string | null;
|
|
248
247
|
revision: number;
|
|
248
|
+
updatedAt: number;
|
|
249
249
|
}>;
|
|
250
250
|
}, "strip", z.ZodTypeAny, {
|
|
251
|
-
expiresAt: string;
|
|
252
251
|
accessToken: string;
|
|
252
|
+
expiresAt: string;
|
|
253
253
|
state: {
|
|
254
|
-
updatedAt: number;
|
|
255
254
|
deviceId: string;
|
|
256
255
|
accounts: {
|
|
257
|
-
sessionId: string;
|
|
258
256
|
accountId: string;
|
|
257
|
+
sessionId: string;
|
|
259
258
|
authuser: number;
|
|
260
259
|
operatedByUserId?: string | undefined;
|
|
261
260
|
}[];
|
|
262
261
|
activeAccountId: string | null;
|
|
263
262
|
revision: number;
|
|
263
|
+
updatedAt: number;
|
|
264
264
|
};
|
|
265
265
|
nextDeviceSecret: string;
|
|
266
266
|
}, {
|
|
267
|
-
expiresAt: string;
|
|
268
267
|
accessToken: string;
|
|
268
|
+
expiresAt: string;
|
|
269
269
|
state: {
|
|
270
|
-
updatedAt: number;
|
|
271
270
|
deviceId: string;
|
|
272
271
|
accounts: {
|
|
273
|
-
sessionId: string;
|
|
274
272
|
accountId: string;
|
|
273
|
+
sessionId: string;
|
|
275
274
|
authuser: number;
|
|
276
275
|
operatedByUserId?: string | undefined;
|
|
277
276
|
}[];
|
|
278
277
|
activeAccountId: string | null;
|
|
279
278
|
revision: number;
|
|
279
|
+
updatedAt: number;
|
|
280
280
|
};
|
|
281
281
|
nextDeviceSecret: string;
|
|
282
282
|
}>;
|
|
@@ -314,13 +314,13 @@ export declare const sessionAccountsChangedEventSchema: z.ZodObject<{
|
|
|
314
314
|
revision: z.ZodNumber;
|
|
315
315
|
reason: z.ZodEnum<["login", "add", "switch", "signout", "revoke"]>;
|
|
316
316
|
}, "strip", z.ZodTypeAny, {
|
|
317
|
+
revision: number;
|
|
317
318
|
userId: string;
|
|
318
319
|
reason: "login" | "add" | "switch" | "signout" | "revoke";
|
|
319
|
-
revision: number;
|
|
320
320
|
}, {
|
|
321
|
+
revision: number;
|
|
321
322
|
userId: string;
|
|
322
323
|
reason: "login" | "add" | "switch" | "signout" | "revoke";
|
|
323
|
-
revision: number;
|
|
324
324
|
}>;
|
|
325
325
|
export type SessionAccountsChangedReason = z.infer<typeof sessionAccountsChangedReasonSchema>;
|
|
326
326
|
export type SessionAccountsChangedEvent = z.infer<typeof sessionAccountsChangedEventSchema>;
|
|
@@ -353,14 +353,14 @@ export declare const deviceBackgroundCredentialResponseSchema: z.ZodObject<{
|
|
|
353
353
|
accountId: z.ZodString;
|
|
354
354
|
expiresAt: z.ZodString;
|
|
355
355
|
}, "strip", z.ZodTypeAny, {
|
|
356
|
-
expiresAt: string;
|
|
357
|
-
deviceId: string;
|
|
358
356
|
accountId: string;
|
|
357
|
+
deviceId: string;
|
|
358
|
+
expiresAt: string;
|
|
359
359
|
secret: string;
|
|
360
360
|
}, {
|
|
361
|
-
expiresAt: string;
|
|
362
|
-
deviceId: string;
|
|
363
361
|
accountId: string;
|
|
362
|
+
deviceId: string;
|
|
363
|
+
expiresAt: string;
|
|
364
364
|
secret: string;
|
|
365
365
|
}>;
|
|
366
366
|
/**
|
|
@@ -398,13 +398,13 @@ export declare const deviceBackgroundTokenResponseSchema: z.ZodObject<{
|
|
|
398
398
|
expiresAt: z.ZodString;
|
|
399
399
|
accountId: z.ZodString;
|
|
400
400
|
}, "strip", z.ZodTypeAny, {
|
|
401
|
-
expiresAt: string;
|
|
402
|
-
accessToken: string;
|
|
403
401
|
accountId: string;
|
|
404
|
-
}, {
|
|
405
|
-
expiresAt: string;
|
|
406
402
|
accessToken: string;
|
|
403
|
+
expiresAt: string;
|
|
404
|
+
}, {
|
|
407
405
|
accountId: string;
|
|
406
|
+
accessToken: string;
|
|
407
|
+
expiresAt: string;
|
|
408
408
|
}>;
|
|
409
409
|
export type DeviceBackgroundCredentialResponse = z.infer<typeof deviceBackgroundCredentialResponseSchema>;
|
|
410
410
|
export type DeviceBackgroundTokenRequest = z.infer<typeof deviceBackgroundTokenRequestSchema>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -40,6 +40,12 @@ export type { LinkPreviewStatus, LinkPreview, LinkPreviewBatchRequest, LinkPrevi
|
|
|
40
40
|
export type { FollowTargetKind, FollowState, FollowEffectiveState, FollowApplicationMode, FollowTarget, FollowRecord, FollowStatus, FollowMutation, UnfollowMutation, FollowListPage, FollowOptions, } from './followGraph';
|
|
41
41
|
export { sessionAccountSchema, deviceSessionStateSchema, activeTokenSchema, deviceSessionSyncSchema, deviceTokenMintRequestSchema, deviceTokenMintResponseSchema, deviceBackgroundCredentialResponseSchema, deviceBackgroundTokenRequestSchema, deviceBackgroundTokenResponseSchema, SESSION_ACCOUNTS_CHANGED_EVENT, sessionAccountsChangedReasonSchema, sessionAccountsChangedEventSchema, } from './deviceSession';
|
|
42
42
|
export type { SessionAccount, DeviceSessionState, ActiveToken, DeviceSessionSync, DeviceTokenMintRequest, DeviceTokenMintResponse, DeviceBackgroundCredentialResponse, DeviceBackgroundTokenRequest, DeviceBackgroundTokenResponse, SessionAccountsChangedReason, SessionAccountsChangedEvent, } from './deviceSession';
|
|
43
|
+
export { deviceContextRelationshipSchema, deviceDirectoryProfileSchema, deviceAccountContextSchema, devicePrincipalSchema, deviceDirectorySchema, deviceActivateRequestSchema, deviceActivateResponseSchema, deviceDirectorySyncSchema, } from './deviceDirectory';
|
|
44
|
+
export type { DeviceContextRelationship, DeviceDirectoryProfile, DeviceAccountContext, DevicePrincipal, DeviceDirectory, DeviceActivateRequest, DeviceActivateResponse, DeviceDirectorySync, } from './deviceDirectory';
|
|
45
|
+
export { oauthConsentDecisionSchema, oauthAuthorizeCodeResponseSchema, } from './oauth';
|
|
46
|
+
export type { OauthConsentDecision, OauthAuthorizeCodeResponse, } from './oauth';
|
|
47
|
+
export { BROWSER_HUB_COOKIE_NAME, BROWSER_HUB_COOKIE_ATTRIBUTES, BROWSER_HUB_HANDLE_TTL_MS, browserHubHandleSchema, browserHubHandleRequestSchema, browserHubHandleResponseSchema, browserHubResolveResponseSchema, browserHubErrorSchema, browserHubRevokeResponseSchema, hubSessionSchema, hubClaimRequestSchema, hubActivateRequestSchema, hubAuthorizeRequestSchema, hubAuthorizeResultSchema, } from './browserHub';
|
|
48
|
+
export type { BrowserHubHandleRequest, BrowserHubHandleResponse, BrowserHubResolveResponse, BrowserHubError, BrowserHubRevokeResponse, HubSession, HubClaimRequest, HubActivateRequest, HubAuthorizeRequest, HubAuthorizeResult, } from './browserHub';
|
|
43
49
|
export { loginResultSchema, } from './deviceBoot';
|
|
44
50
|
export type { LoginSessionResult, LoginResult, SecurityAlert, SecurityAlertAnomaly, } from './deviceBoot';
|
|
45
51
|
export { rotateKeyChallengeResponseSchema, rotateKeyCompleteRequestSchema, rotateKeyCompleteResponseSchema, } from './keyRotation';
|
|
@@ -54,3 +60,26 @@ export { devicePairingStatusSchema, deviceTransferInitRequestSchema, deviceTrans
|
|
|
54
60
|
export type { DevicePairingStatus, DeviceTransferInitRequest, DeviceTransferInitResponse, DeviceTransferInfoResponse, DeviceTransferApproveRequest, DeviceTransferApproveResponse, DeviceTransferDenyResponse, } from './devicePairing';
|
|
55
61
|
export { transparencyCheckpointSignatureSchema, transparencyAnchorSchema, transparencyCheckpointSchema, transparencyInclusionProofSchema, transparencyCheckpointListSchema, } from './transparency';
|
|
56
62
|
export type { TransparencyCheckpointSignature, TransparencyAnchor, TransparencyCheckpoint, TransparencyInclusionProof, TransparencyCheckpointList, } from './transparency';
|
|
63
|
+
export { INFERENCE_CONTRACT_VERSION, } from './inference/version';
|
|
64
|
+
export { oxyAccountIdSchema, delegatedUserIdSchema, oxyApplicationIdSchema, oxyCredentialIdSchema, requestIdSchema, generationIdSchema, idempotencyKeySchema, inferenceEnvironmentSchema, inferenceTimestampSchema, inferenceDateSchema, inferenceHttpsUrlSchema, publisherSlugSchema, modelSlugSchema, modelIdSchema, modelRevisionLabelSchema, modelReferenceSchema, routingProfileSlugSchema, inferenceProviderSlugSchema, deploymentIdSchema, inferenceRegionSchema, RESERVED_ALIA_PUBLISHER, } from './inference/identifiers';
|
|
65
|
+
export type { OxyAccountId, DelegatedUserId, InferenceEnvironment, ModelReference, ModelId, } from './inference/identifiers';
|
|
66
|
+
export { currencyCodeSchema, INFERENCE_MONEY_SCALE, exactDecimalSchema, moneySchema, USAGE_UNITS, usageUnitSchema, USAGE_SOURCES, usageSourceSchema, usageQuantitySchema, unitPriceSchema, } from './inference/money';
|
|
67
|
+
export type { CurrencyCode, ExactDecimal, Money, UsageUnit, UsageSource, UsageQuantity, UnitPrice, } from './inference/money';
|
|
68
|
+
export { INFERENCE_SCOPES, inferenceScopeSchema, billingPrincipalSchema, authenticatedPrincipalSchema, inferenceAttributionSchema, } from './inference/attribution';
|
|
69
|
+
export type { InferenceScope, BillingPrincipal, AuthenticatedPrincipal, InferenceAttribution, } from './inference/attribution';
|
|
70
|
+
export { INFERENCE_ERROR_CODES, NON_RETRYABLE_INFERENCE_ERROR_CODES, inferenceErrorCodeSchema, upstreamErrorCategorySchema, safeErrorTextSchema, providerErrorPassthroughSchema, inferenceErrorSchema, } from './inference/errors';
|
|
71
|
+
export type { InferenceErrorCode, UpstreamErrorCategory, ProviderErrorPassthrough, InferenceError, } from './inference/errors';
|
|
72
|
+
export { priceVersionStatusSchema, priceVersionSchema, priceSnapshotSchema, } from './inference/priceVersion';
|
|
73
|
+
export type { PriceVersionStatus, PriceVersion, PriceSnapshot, } from './inference/priceVersion';
|
|
74
|
+
export { inferenceModalitySchema, modelCapabilitiesSchema, modelLicenseSchema, modelProvenanceSchema, inferenceDataPolicySchema, availabilityScopeSchema, commercialPermissionSchema, modelDeprecationSchema, modelEvaluationResultSchema, modelSafetyMetadataSchema, modelPublisherSchema, catalogueModelSchema, modelRevisionSchema, inferenceProviderSchema, modelDeploymentSchema, routingProfileCandidateSchema, routingProfileSchema, cataloguePublisherSummarySchema, catalogueServingProviderSummarySchema, modelCatalogueEntrySchema, } from './inference/catalogue';
|
|
75
|
+
export type { InferenceModality, ModelCapabilities, ModelLicense, ModelProvenance, InferenceDataPolicy, AvailabilityScope, CommercialPermission, ModelDeprecation, ModelEvaluationResult, ModelSafetyMetadata, ModelPublisher, CatalogueModel, ModelRevision, InferenceProvider, ModelDeployment, RoutingProfileCandidate, RoutingProfile, CataloguePublisherSummary, CatalogueServingProviderSummary, ModelCatalogueEntry, } from './inference/catalogue';
|
|
76
|
+
export { routingTargetSchema, routingPolicyScopeSchema, routingFallbackPolicySchema, routingPolicySchema, routingPolicyReferenceSchema, } from './inference/routingPolicy';
|
|
77
|
+
export type { RoutingTarget, RoutingPolicyScope, RoutingFallbackPolicy, RoutingPolicy, RoutingPolicyReference, } from './inference/routingPolicy';
|
|
78
|
+
export { inferenceContentSourceSchema, inferenceContentPartSchema, inferenceToolCallSchema, inferenceMessageRoleSchema, inferenceMessageSchema, inferenceInputSchema, samplingParametersSchema, toolDefinitionSchema, toolChoiceSchema, responseFormatSchema, clientRequestMetadataSchema, inferenceRequestSchema, } from './inference/request';
|
|
79
|
+
export type { InferenceContentSource, InferenceContentPart, InferenceToolCall, InferenceMessageRole, InferenceMessage, InferenceInput, SamplingParameters, ToolDefinition, ToolChoice, ResponseFormat, ClientRequestMetadata, InferenceRequest, } from './inference/request';
|
|
80
|
+
export { inferenceStreamStartEventSchema, inferenceStreamDeltaEventSchema, inferenceStreamToolCallEventSchema, inferenceStreamUsageEventSchema, inferenceRouteSwitchDetailSchema, inferenceRouteSwitchReasonSchema, inferenceStreamRouteSwitchEventSchema, inferenceStreamErrorEventSchema, inferenceFinishReasonSchema, inferenceStreamDoneEventSchema, inferenceStreamEventSchema, } from './inference/streamEvents';
|
|
81
|
+
export type { InferenceStreamStartEvent, InferenceStreamDeltaEvent, InferenceStreamToolCallEvent, InferenceStreamUsageEvent, InferenceRouteSwitchDetail, InferenceRouteSwitchReason, InferenceStreamRouteSwitchEvent, InferenceStreamErrorEvent, InferenceFinishReason, InferenceStreamDoneEvent, InferenceStreamEvent, } from './inference/streamEvents';
|
|
82
|
+
export { usageReservationRequestSchema, usageReservationStatusSchema, usageReservationSchema, inferenceRequestOutcomeSchema, normalizedUsageReportSchema, usageReceiptSchema, usageRefundSubjectSchema, usageRefundReasonSchema, usageRefundSchema, } from './inference/usage';
|
|
83
|
+
export type { UsageReservationRequest, UsageReservationStatus, UsageReservation, InferenceRequestOutcome, NormalizedUsageReport, UsageReceipt, UsageRefundSubject, UsageRefundReason, UsageRefund, } from './inference/usage';
|
|
84
|
+
export { providerConnectionScopeSchema, providerSecretReferenceSchema, providerConnectionValidationSchema, providerConnectionStatusSchema, providerConnectionSchema, } from './inference/providerConnection';
|
|
85
|
+
export type { ProviderConnectionScope, ProviderConnectionValidation, ProviderConnectionStatus, ProviderConnection, } from './inference/providerConnection';
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical attribution for an inference request.
|
|
3
|
+
*
|
|
4
|
+
* Every accepted request resolves to an Oxy account, an Oxy application, the
|
|
5
|
+
* Oxy credential that authenticated it, an optional delegated end user, and the
|
|
6
|
+
* ids that correlate it across the edge, the data plane and the ledger. The
|
|
7
|
+
* data plane may store these as immutable references; it never owns or mutates
|
|
8
|
+
* them, and it never mints a customer identity of its own.
|
|
9
|
+
*
|
|
10
|
+
* The rule this file encodes structurally, rather than restating in prose:
|
|
11
|
+
* **the delegated `userId` can never be the billing identity.** Two independent
|
|
12
|
+
* mechanisms enforce it, one at compile time and one at parse time, because a
|
|
13
|
+
* delegated identity being charged for somebody else's workload is the kind of
|
|
14
|
+
* mistake that produces a correct-looking invoice for the wrong customer:
|
|
15
|
+
*
|
|
16
|
+
* 1. `accountId` and `userId` carry DIFFERENT brands, so neither is assignable
|
|
17
|
+
* to the other in any consumer without a cast.
|
|
18
|
+
* 2. {@link billingPrincipalSchema} is `.strict()` and holds exactly one field,
|
|
19
|
+
* so a payload that smuggles `userId` into the billing block is rejected at
|
|
20
|
+
* the parse rather than stripped and forgotten.
|
|
21
|
+
*
|
|
22
|
+
* These shapes are EMBEDDED — they ride inside a request envelope, a receipt or
|
|
23
|
+
* a ledger record and inherit its `schemaVersion`. Versioning them separately
|
|
24
|
+
* would let one message claim two versions.
|
|
25
|
+
*
|
|
26
|
+
* Decided in: docs/adr/0007-canonical-request-attribution.md.
|
|
27
|
+
*/
|
|
28
|
+
import { z } from 'zod';
|
|
29
|
+
/**
|
|
30
|
+
* The inference capability scopes the data plane needs to know about.
|
|
31
|
+
*
|
|
32
|
+
* A credential may carry many other Oxy scopes; only these cross the boundary,
|
|
33
|
+
* because the data plane's authorization questions are exactly "may this caller
|
|
34
|
+
* invoke", "may it read the catalogue", "may it read usage", "may it read or
|
|
35
|
+
* write routing", "may it read or write provider connections". Everything else
|
|
36
|
+
* is the control plane's business and is not the data plane's to hold.
|
|
37
|
+
*/
|
|
38
|
+
export declare const INFERENCE_SCOPES: readonly ["inference:invoke", "inference:models:read", "inference:usage:read", "inference:routing:read", "inference:routing:write", "inference:providers:read", "inference:providers:write"];
|
|
39
|
+
export declare const inferenceScopeSchema: z.ZodEnum<["inference:invoke", "inference:models:read", "inference:usage:read", "inference:routing:read", "inference:routing:write", "inference:providers:read", "inference:providers:write"]>;
|
|
40
|
+
/**
|
|
41
|
+
* The financially responsible principal, and the ONLY identity a charge may be
|
|
42
|
+
* booked against.
|
|
43
|
+
*
|
|
44
|
+
* It is its own type — not a field on a larger principal object — precisely so
|
|
45
|
+
* that a function taking "who pays" cannot be handed a user, a session, a
|
|
46
|
+
* device or an application. It cannot be constructed from a delegated user id:
|
|
47
|
+
* the brands differ, and this object accepts no other key.
|
|
48
|
+
*/
|
|
49
|
+
export declare const billingPrincipalSchema: z.ZodObject<{
|
|
50
|
+
accountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
|
|
51
|
+
}, "strict", z.ZodTypeAny, {
|
|
52
|
+
accountId: string & z.BRAND<"OxyAccountId">;
|
|
53
|
+
}, {
|
|
54
|
+
accountId: string;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Who authenticated, as resolved by the Oxy edge before a request is forwarded.
|
|
58
|
+
*
|
|
59
|
+
* Mirrors what a verified Oxy service token carries (`appId`, `credentialId`,
|
|
60
|
+
* `ownerAccountId`, `environment`, effective scopes) so that the two
|
|
61
|
+
* authentication paths — a machine API key and a first-party service token —
|
|
62
|
+
* produce one shape downstream. The data plane authorizes against this
|
|
63
|
+
* envelope; it does not re-derive access from its own database, because it has
|
|
64
|
+
* no account graph to re-derive it from.
|
|
65
|
+
*/
|
|
66
|
+
export declare const authenticatedPrincipalSchema: z.ZodObject<{
|
|
67
|
+
billing: z.ZodObject<{
|
|
68
|
+
accountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
|
|
69
|
+
}, "strict", z.ZodTypeAny, {
|
|
70
|
+
accountId: string & z.BRAND<"OxyAccountId">;
|
|
71
|
+
}, {
|
|
72
|
+
accountId: string;
|
|
73
|
+
}>;
|
|
74
|
+
applicationId: z.ZodString;
|
|
75
|
+
credentialId: z.ZodString;
|
|
76
|
+
environment: z.ZodEnum<["development", "staging", "production"]>;
|
|
77
|
+
inferenceScopes: z.ZodArray<z.ZodEnum<["inference:invoke", "inference:models:read", "inference:usage:read", "inference:routing:read", "inference:routing:write", "inference:providers:read", "inference:providers:write"]>, "many">;
|
|
78
|
+
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
environment: "development" | "staging" | "production";
|
|
80
|
+
credentialId: string;
|
|
81
|
+
applicationId: string;
|
|
82
|
+
billing: {
|
|
83
|
+
accountId: string & z.BRAND<"OxyAccountId">;
|
|
84
|
+
};
|
|
85
|
+
inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
|
|
86
|
+
}, {
|
|
87
|
+
environment: "development" | "staging" | "production";
|
|
88
|
+
credentialId: string;
|
|
89
|
+
applicationId: string;
|
|
90
|
+
billing: {
|
|
91
|
+
accountId: string;
|
|
92
|
+
};
|
|
93
|
+
inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* The attribution block carried by every request, receipt and ledger record.
|
|
97
|
+
*
|
|
98
|
+
* `userId` is the OPTIONAL delegated end user — Alia's `X-Oxy-User-Id`. It is
|
|
99
|
+
* attribution only: it never changes which account is charged, never grants
|
|
100
|
+
* access, and lives outside {@link billingPrincipalSchema} so that no code path
|
|
101
|
+
* can read it as the payer.
|
|
102
|
+
*
|
|
103
|
+
* `requestId` is generated by the data plane and always present; `generationId`
|
|
104
|
+
* is present
|
|
105
|
+
* once a generation exists, which is why it is optional on a request and
|
|
106
|
+
* expected on a receipt.
|
|
107
|
+
*/
|
|
108
|
+
export declare const inferenceAttributionSchema: z.ZodObject<{
|
|
109
|
+
principal: z.ZodObject<{
|
|
110
|
+
billing: z.ZodObject<{
|
|
111
|
+
accountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
|
|
112
|
+
}, "strict", z.ZodTypeAny, {
|
|
113
|
+
accountId: string & z.BRAND<"OxyAccountId">;
|
|
114
|
+
}, {
|
|
115
|
+
accountId: string;
|
|
116
|
+
}>;
|
|
117
|
+
applicationId: z.ZodString;
|
|
118
|
+
credentialId: z.ZodString;
|
|
119
|
+
environment: z.ZodEnum<["development", "staging", "production"]>;
|
|
120
|
+
inferenceScopes: z.ZodArray<z.ZodEnum<["inference:invoke", "inference:models:read", "inference:usage:read", "inference:routing:read", "inference:routing:write", "inference:providers:read", "inference:providers:write"]>, "many">;
|
|
121
|
+
}, "strip", z.ZodTypeAny, {
|
|
122
|
+
environment: "development" | "staging" | "production";
|
|
123
|
+
credentialId: string;
|
|
124
|
+
applicationId: string;
|
|
125
|
+
billing: {
|
|
126
|
+
accountId: string & z.BRAND<"OxyAccountId">;
|
|
127
|
+
};
|
|
128
|
+
inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
|
|
129
|
+
}, {
|
|
130
|
+
environment: "development" | "staging" | "production";
|
|
131
|
+
credentialId: string;
|
|
132
|
+
applicationId: string;
|
|
133
|
+
billing: {
|
|
134
|
+
accountId: string;
|
|
135
|
+
};
|
|
136
|
+
inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
|
|
137
|
+
}>;
|
|
138
|
+
userId: z.ZodOptional<z.ZodBranded<z.ZodString, "DelegatedUserId">>;
|
|
139
|
+
requestId: z.ZodString;
|
|
140
|
+
generationId: z.ZodOptional<z.ZodString>;
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
142
|
+
requestId: string;
|
|
143
|
+
principal: {
|
|
144
|
+
environment: "development" | "staging" | "production";
|
|
145
|
+
credentialId: string;
|
|
146
|
+
applicationId: string;
|
|
147
|
+
billing: {
|
|
148
|
+
accountId: string & z.BRAND<"OxyAccountId">;
|
|
149
|
+
};
|
|
150
|
+
inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
|
|
151
|
+
};
|
|
152
|
+
userId?: (string & z.BRAND<"DelegatedUserId">) | undefined;
|
|
153
|
+
generationId?: string | undefined;
|
|
154
|
+
}, {
|
|
155
|
+
requestId: string;
|
|
156
|
+
principal: {
|
|
157
|
+
environment: "development" | "staging" | "production";
|
|
158
|
+
credentialId: string;
|
|
159
|
+
applicationId: string;
|
|
160
|
+
billing: {
|
|
161
|
+
accountId: string;
|
|
162
|
+
};
|
|
163
|
+
inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
|
|
164
|
+
};
|
|
165
|
+
userId?: string | undefined;
|
|
166
|
+
generationId?: string | undefined;
|
|
167
|
+
}>;
|
|
168
|
+
export type InferenceScope = z.infer<typeof inferenceScopeSchema>;
|
|
169
|
+
export type BillingPrincipal = z.infer<typeof billingPrincipalSchema>;
|
|
170
|
+
export type AuthenticatedPrincipal = z.infer<typeof authenticatedPrincipalSchema>;
|
|
171
|
+
export type InferenceAttribution = z.infer<typeof inferenceAttributionSchema>;
|