@oxy.so/contracts 5.8.0 → 6.0.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/cjs/accountAccess.js +6 -5
- package/dist/cjs/accountEmail.js +13 -5
- package/dist/cjs/accountGraph.js +10 -9
- package/dist/cjs/accountName.js +3 -2
- package/dist/cjs/agency.js +91 -34
- package/dist/cjs/agentKeys.js +21 -17
- package/dist/cjs/appAssertions.js +14 -13
- package/dist/cjs/applicationRoles.js +19 -12
- package/dist/cjs/civic.js +10 -9
- package/dist/cjs/client/check.js +61 -53
- package/dist/cjs/consoleOnboarding.js +9 -4
- package/dist/cjs/contentClaims.js +23 -14
- package/dist/cjs/deviceDirectory.js +11 -9
- package/dist/cjs/deviceSession.js +27 -25
- package/dist/cjs/email/messages.js +20 -18
- package/dist/cjs/emailAgentContext.js +11 -9
- package/dist/cjs/externalIdentity.js +15 -11
- package/dist/cjs/federationInstanceFetch.js +12 -7
- package/dist/cjs/identity.js +19 -17
- package/dist/cjs/identityLink.js +6 -4
- package/dist/cjs/identityProof.js +6 -4
- package/dist/cjs/inboxPush.js +5 -4
- package/dist/cjs/index.js +15 -6
- package/dist/cjs/inference/accountBilling.js +35 -33
- package/dist/cjs/inference/aliaModelRelease.js +9 -7
- package/dist/cjs/inference/attribution.js +14 -12
- package/dist/cjs/inference/catalogue.js +35 -29
- package/dist/cjs/inference/economics.js +24 -19
- package/dist/cjs/inference/embeddings.js +9 -7
- package/dist/cjs/inference/entitlement.js +17 -15
- package/dist/cjs/inference/errors.js +15 -8
- package/dist/cjs/inference/identifiers.js +33 -21
- package/dist/cjs/inference/inbox.js +37 -35
- package/dist/cjs/inference/modelDocumentation.js +16 -14
- package/dist/cjs/inference/money.js +5 -4
- package/dist/cjs/inference/priceVersion.js +10 -5
- package/dist/cjs/inference/providerConnection.js +21 -14
- package/dist/cjs/inference/realtime.js +88 -47
- package/dist/cjs/inference/request.js +27 -25
- package/dist/cjs/inference/routingPolicy.js +12 -10
- package/dist/cjs/inference/streamEvents.js +22 -16
- package/dist/cjs/inference/usage.js +32 -15
- package/dist/cjs/keyRecovery.js +8 -6
- package/dist/cjs/keyRotation.js +5 -4
- package/dist/cjs/linkedAccounts.js +22 -18
- package/dist/cjs/moderationReputation.js +29 -27
- package/dist/cjs/notifications.js +25 -9
- package/dist/cjs/numberChecks.js +45 -0
- package/dist/cjs/oauth.js +14 -12
- package/dist/cjs/organizations.js +23 -21
- package/dist/cjs/products/access.js +10 -8
- package/dist/cjs/products/billing.js +10 -8
- package/dist/cjs/products/checkout.js +22 -10
- package/dist/cjs/products/plans.js +15 -10
- package/dist/cjs/protocol.js +6 -5
- package/dist/cjs/recommendations.js +27 -19
- package/dist/cjs/reputation.js +15 -13
- package/dist/cjs/safety.js +43 -27
- package/dist/cjs/serviceToken.js +81 -2
- package/dist/cjs/sessionRevocation.js +8 -6
- package/dist/cjs/signIn.js +42 -24
- package/dist/cjs/stickers.js +19 -15
- package/dist/cjs/stringChecks.js +70 -0
- package/dist/cjs/transparency.js +14 -12
- package/dist/cjs/updates.js +24 -22
- package/dist/cjs/userInvalidation.js +7 -5
- package/dist/cjs/userResponse.js +8 -7
- package/dist/cjs/username.js +7 -6
- package/dist/esm/accountAccess.js +4 -3
- package/dist/esm/accountEmail.js +13 -5
- package/dist/esm/accountGraph.js +8 -7
- package/dist/esm/accountName.js +3 -2
- package/dist/esm/agency.js +90 -33
- package/dist/esm/agentKeys.js +21 -17
- package/dist/esm/appAssertions.js +11 -10
- package/dist/esm/applicationRoles.js +16 -9
- package/dist/esm/civic.js +8 -7
- package/dist/esm/client/check.js +61 -53
- package/dist/esm/consoleOnboarding.js +7 -2
- package/dist/esm/contentClaims.js +23 -14
- package/dist/esm/deviceDirectory.js +11 -9
- package/dist/esm/deviceSession.js +27 -25
- package/dist/esm/email/messages.js +18 -16
- package/dist/esm/emailAgentContext.js +11 -9
- package/dist/esm/externalIdentity.js +15 -11
- package/dist/esm/federationInstanceFetch.js +10 -5
- package/dist/esm/identity.js +17 -15
- package/dist/esm/identityLink.js +6 -4
- package/dist/esm/identityProof.js +6 -4
- package/dist/esm/inboxPush.js +3 -2
- package/dist/esm/index.js +4 -2
- package/dist/esm/inference/accountBilling.js +33 -31
- package/dist/esm/inference/aliaModelRelease.js +7 -5
- package/dist/esm/inference/attribution.js +14 -12
- package/dist/esm/inference/catalogue.js +33 -27
- package/dist/esm/inference/economics.js +22 -17
- package/dist/esm/inference/embeddings.js +9 -7
- package/dist/esm/inference/entitlement.js +15 -13
- package/dist/esm/inference/errors.js +13 -6
- package/dist/esm/inference/identifiers.js +31 -19
- package/dist/esm/inference/inbox.js +37 -35
- package/dist/esm/inference/modelDocumentation.js +14 -12
- package/dist/esm/inference/money.js +3 -2
- package/dist/esm/inference/priceVersion.js +8 -3
- package/dist/esm/inference/providerConnection.js +19 -12
- package/dist/esm/inference/realtime.js +85 -44
- package/dist/esm/inference/request.js +25 -23
- package/dist/esm/inference/routingPolicy.js +9 -7
- package/dist/esm/inference/streamEvents.js +20 -14
- package/dist/esm/inference/usage.js +30 -13
- package/dist/esm/keyRecovery.js +8 -6
- package/dist/esm/keyRotation.js +5 -4
- package/dist/esm/linkedAccounts.js +20 -16
- package/dist/esm/moderationReputation.js +27 -25
- package/dist/esm/notifications.js +23 -7
- package/dist/esm/numberChecks.js +41 -0
- package/dist/esm/oauth.js +14 -12
- package/dist/esm/organizations.js +23 -21
- package/dist/esm/products/access.js +10 -8
- package/dist/esm/products/billing.js +10 -8
- package/dist/esm/products/checkout.js +22 -10
- package/dist/esm/products/plans.js +15 -10
- package/dist/esm/protocol.js +4 -3
- package/dist/esm/recommendations.js +25 -17
- package/dist/esm/reputation.js +13 -11
- package/dist/esm/safety.js +43 -27
- package/dist/esm/serviceToken.js +80 -1
- package/dist/esm/sessionRevocation.js +6 -4
- package/dist/esm/signIn.js +42 -24
- package/dist/esm/stickers.js +17 -13
- package/dist/esm/stringChecks.js +63 -0
- package/dist/esm/transparency.js +14 -12
- package/dist/esm/updates.js +22 -20
- package/dist/esm/userInvalidation.js +4 -2
- package/dist/esm/userResponse.js +4 -3
- package/dist/esm/username.js +3 -2
- package/dist/types/accountAccess.d.ts +29 -70
- package/dist/types/accountEmail.d.ts +2 -14
- package/dist/types/accountGraph.d.ts +179 -171
- package/dist/types/accountName.d.ts +1 -1
- package/dist/types/accountSubject.d.ts +20 -93
- package/dist/types/agency.d.ts +528 -2924
- package/dist/types/agentKeys.d.ts +48 -421
- package/dist/types/appAssertions.d.ts +56 -210
- package/dist/types/applicationRoles.d.ts +30 -276
- package/dist/types/avatarCharacter.d.ts +1 -1
- package/dist/types/civic.d.ts +1 -13
- package/dist/types/client/agentKeys.d.ts +18 -18
- package/dist/types/client/appAssertions.d.ts +3 -3
- package/dist/types/client/check.d.ts +13 -13
- package/dist/types/client/deviceDirectory.d.ts +51 -51
- package/dist/types/client/deviceSession.d.ts +14 -14
- package/dist/types/client/organizations.d.ts +25 -25
- package/dist/types/client/products.d.ts +33 -33
- package/dist/types/client/recommendations.d.ts +2 -2
- package/dist/types/client/safety.d.ts +45 -45
- package/dist/types/client/sessionStatus.d.ts +4 -4
- package/dist/types/client/signIn.d.ts +1 -1
- package/dist/types/commonsSignIn.d.ts +4 -1
- package/dist/types/consoleOnboarding.d.ts +24 -44
- package/dist/types/contentClaims.d.ts +24 -180
- package/dist/types/deviceDirectory.d.ts +109 -1040
- package/dist/types/deviceSession.d.ts +36 -298
- package/dist/types/email/messages.d.ts +212 -1793
- package/dist/types/emailAgentContext.d.ts +10 -194
- package/dist/types/externalIdentity.d.ts +121 -615
- package/dist/types/federationInstanceFetch.d.ts +3 -32
- package/dist/types/identity.d.ts +15 -92
- package/dist/types/identityLink.d.ts +6 -84
- package/dist/types/identityProof.d.ts +5 -17
- package/dist/types/inboxPush.d.ts +1 -9
- package/dist/types/index.d.ts +5 -3
- package/dist/types/inference/accountBilling.d.ts +151 -488
- package/dist/types/inference/aliaModelRelease.d.ts +42 -439
- package/dist/types/inference/attribution.d.ts +75 -104
- package/dist/types/inference/catalogue.d.ts +417 -1599
- package/dist/types/inference/economics.d.ts +69 -276
- package/dist/types/inference/embeddings.d.ts +110 -406
- package/dist/types/inference/entitlement.d.ts +80 -335
- package/dist/types/inference/errors.d.ts +90 -102
- package/dist/types/inference/identifiers.d.ts +12 -4
- package/dist/types/inference/inbox.d.ts +105 -420
- package/dist/types/inference/modelDocumentation.d.ts +201 -1390
- package/dist/types/inference/money.d.ts +65 -32
- package/dist/types/inference/priceVersion.d.ts +53 -120
- package/dist/types/inference/providerConnection.d.ts +253 -710
- package/dist/types/inference/realtime.d.ts +954 -6825
- package/dist/types/inference/request.d.ts +300 -2572
- package/dist/types/inference/routingPolicy.d.ts +95 -503
- package/dist/types/inference/streamEvents.d.ts +253 -721
- package/dist/types/inference/usage.d.ts +317 -950
- package/dist/types/keyRecovery.d.ts +3 -51
- package/dist/types/keyRotation.d.ts +3 -38
- package/dist/types/linkedAccounts.d.ts +50 -236
- package/dist/types/moderationReputation.d.ts +81 -14
- package/dist/types/notifications.d.ts +19 -51
- package/dist/types/numberChecks.d.ts +9 -0
- package/dist/types/oauth.d.ts +101 -809
- package/dist/types/organizations.d.ts +268 -921
- package/dist/types/oxyRecordTypes.d.ts +11 -1
- package/dist/types/products/access.d.ts +125 -775
- package/dist/types/products/billing.d.ts +67 -503
- package/dist/types/products/checkout.d.ts +16 -69
- package/dist/types/products/plans.d.ts +33 -366
- package/dist/types/recommendations.d.ts +76 -389
- package/dist/types/reputation.d.ts +37 -5
- package/dist/types/safety.d.ts +408 -2048
- package/dist/types/serviceToken.d.ts +247 -7
- package/dist/types/sessionRevocation.d.ts +2 -17
- package/dist/types/sessionStatus.d.ts +27 -115
- package/dist/types/signIn.d.ts +53 -553
- package/dist/types/stickers.d.ts +67 -819
- package/dist/types/stringChecks.d.ts +16 -0
- package/dist/types/transparency.d.ts +14 -302
- package/dist/types/updates.d.ts +60 -316
- package/dist/types/userInvalidation.d.ts +4 -13
- package/dist/types/userResponse.d.ts +302 -2400
- package/dist/types/username.d.ts +3 -3
- package/package.json +2 -2
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.meteredGenerationSchema = exports.costCenterUsageSchema = exports.providerCostSourceSchema = exports.PROVIDER_COST_SOURCES = exports.inferenceEconomicTreatmentSchema = exports.INFERENCE_ECONOMIC_TREATMENTS = void 0;
|
|
4
|
+
const numberChecks_1 = require("../numberChecks");
|
|
5
|
+
const stringChecks_1 = require("../stringChecks");
|
|
2
6
|
/**
|
|
3
7
|
* Economic treatment and durable usage/cost reporting for inference
|
|
4
8
|
* (issue #1526, plan item I09).
|
|
@@ -27,8 +31,6 @@
|
|
|
27
31
|
* (`customerCharge`, from settled receipts only). A tariff is not a cost, and an
|
|
28
32
|
* UNKNOWN cost is reported as unknown — counted, never summed as zero.
|
|
29
33
|
*/
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.meteredGenerationSchema = exports.costCenterUsageSchema = exports.providerCostSourceSchema = exports.PROVIDER_COST_SOURCES = exports.inferenceEconomicTreatmentSchema = exports.INFERENCE_ECONOMIC_TREATMENTS = void 0;
|
|
32
34
|
const zod_1 = require("zod");
|
|
33
35
|
const entitlement_1 = require("./entitlement");
|
|
34
36
|
const money_1 = require("./money");
|
|
@@ -44,7 +46,7 @@ exports.inferenceEconomicTreatmentSchema = zod_1.z.enum(exports.INFERENCE_ECONOM
|
|
|
44
46
|
*/
|
|
45
47
|
exports.PROVIDER_COST_SOURCES = ['provider_reported', 'rate_card', 'unknown'];
|
|
46
48
|
exports.providerCostSourceSchema = zod_1.z.enum(exports.PROVIDER_COST_SOURCES);
|
|
47
|
-
const nonNegativeCount = zod_1.z.number().
|
|
49
|
+
const nonNegativeCount = zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().check((0, numberChecks_1.safeNumberCheck)());
|
|
48
50
|
/** One amount family, with the rows it could not include counted beside it. */
|
|
49
51
|
const knownAmountSchema = zod_1.z
|
|
50
52
|
.object({
|
|
@@ -69,8 +71,8 @@ exports.costCenterUsageSchema = zod_1.z
|
|
|
69
71
|
costCenter: entitlement_1.costCenterSchema.nullable(),
|
|
70
72
|
treatment: exports.inferenceEconomicTreatmentSchema,
|
|
71
73
|
currency: money_1.currencyCodeSchema,
|
|
72
|
-
periodStart: zod_1.z.string().
|
|
73
|
-
periodEnd: zod_1.z.string().
|
|
74
|
+
periodStart: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
75
|
+
periodEnd: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
74
76
|
/** Requests settled in the window (completed, failed, cancelled or partial). */
|
|
75
77
|
requestCount: nonNegativeCount,
|
|
76
78
|
/** Requests admitted and not yet settled when the report was read. */
|
|
@@ -90,10 +92,10 @@ exports.costCenterUsageSchema = zod_1.z
|
|
|
90
92
|
/** Attempts priced in a different currency, excluded without currency conversion. */
|
|
91
93
|
otherCurrencyCount: nonNegativeCount.default(0),
|
|
92
94
|
/** Amount stated by the provider; this is not a copy of its invoice. */
|
|
93
|
-
providerReportedAmount: money_1.exactDecimalSchema.
|
|
95
|
+
providerReportedAmount: money_1.exactDecimalSchema.prefault('0'),
|
|
94
96
|
providerReportedCount: nonNegativeCount.default(0),
|
|
95
97
|
/** Amount estimated from Kaana's immutable rate card, never described as invoiced. */
|
|
96
|
-
estimatedAmount: money_1.exactDecimalSchema.
|
|
98
|
+
estimatedAmount: money_1.exactDecimalSchema.prefault('0'),
|
|
97
99
|
estimatedCount: nonNegativeCount.default(0),
|
|
98
100
|
}),
|
|
99
101
|
/**
|
|
@@ -111,35 +113,38 @@ exports.meteredGenerationSchema = zod_1.z
|
|
|
111
113
|
.object({
|
|
112
114
|
schemaVersion: zod_1.z.literal(2),
|
|
113
115
|
kind: zod_1.z.literal('metered_usage'),
|
|
114
|
-
meteredUsageId: zod_1.z.string().
|
|
115
|
-
requestId: zod_1.z.string().
|
|
116
|
-
generationId: zod_1.z.string().
|
|
117
|
-
parentRequestId: zod_1.z.string().
|
|
118
|
-
applicationId: zod_1.z.string().
|
|
119
|
-
credentialId: zod_1.z.string().
|
|
120
|
-
delegatedUserId: zod_1.z.string().
|
|
116
|
+
meteredUsageId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
117
|
+
requestId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
118
|
+
generationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
|
|
119
|
+
parentRequestId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
|
|
120
|
+
applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
121
|
+
credentialId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
122
|
+
delegatedUserId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
|
|
121
123
|
environment: identifiers_1.inferenceEnvironmentSchema,
|
|
122
124
|
economicTreatment: zod_1.z.literal('internal_metered'),
|
|
123
|
-
economicPolicyVersion: zod_1.z.string().
|
|
125
|
+
economicPolicyVersion: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
124
126
|
outcome: usage_1.inferenceRequestOutcomeSchema,
|
|
125
127
|
usageSource: money_1.usageSourceSchema,
|
|
126
128
|
units: zod_1.z.array(money_1.usageQuantitySchema),
|
|
127
129
|
resolvedModelReference: identifiers_1.modelReferenceSchema,
|
|
128
|
-
servingProvider: zod_1.z.string().
|
|
130
|
+
servingProvider: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
129
131
|
tariff: zod_1.z.discriminatedUnion('status', [
|
|
130
132
|
zod_1.z
|
|
131
133
|
.object({
|
|
132
134
|
status: zod_1.z.literal('quoted'),
|
|
133
135
|
amount: money_1.exactDecimalSchema,
|
|
134
136
|
currency: money_1.currencyCodeSchema,
|
|
135
|
-
priceVersionId: zod_1.z.string().
|
|
137
|
+
priceVersionId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
136
138
|
})
|
|
137
139
|
.strict(),
|
|
138
140
|
zod_1.z
|
|
139
|
-
.object({
|
|
141
|
+
.object({
|
|
142
|
+
status: zod_1.z.literal('unpriced'),
|
|
143
|
+
priceVersionId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).nullable(),
|
|
144
|
+
})
|
|
140
145
|
.strict(),
|
|
141
146
|
]),
|
|
142
147
|
customerCharge: zod_1.z.object({ status: zod_1.z.literal('not_charged') }).strict(),
|
|
143
|
-
settledAt: zod_1.z.string().
|
|
148
|
+
settledAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
144
149
|
})
|
|
145
150
|
.strict();
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.embeddingResponseSchema = exports.embeddingFailureSchema = exports.embeddingSuccessSchema = exports.embeddingUsageSchema = exports.embeddingVectorSchema = void 0;
|
|
4
|
+
const numberChecks_1 = require("../numberChecks");
|
|
5
|
+
const stringChecks_1 = require("../stringChecks");
|
|
4
6
|
const zod_1 = require("zod");
|
|
5
7
|
const errors_1 = require("./errors");
|
|
6
8
|
exports.embeddingVectorSchema = zod_1.z
|
|
7
9
|
.object({
|
|
8
|
-
index: zod_1.z.number().
|
|
10
|
+
index: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
|
|
9
11
|
embedding: zod_1.z.array(zod_1.z.number().finite()).min(1).max(1024),
|
|
10
12
|
})
|
|
11
13
|
.strict();
|
|
12
14
|
exports.embeddingUsageSchema = zod_1.z
|
|
13
15
|
.object({
|
|
14
|
-
inputTokens: zod_1.z.number().
|
|
15
|
-
totalTokens: zod_1.z.number().
|
|
16
|
+
inputTokens: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
|
|
17
|
+
totalTokens: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
|
|
16
18
|
})
|
|
17
19
|
.strict()
|
|
18
20
|
.refine((usage) => usage.totalTokens >= usage.inputTokens, {
|
|
@@ -22,9 +24,9 @@ exports.embeddingUsageSchema = zod_1.z
|
|
|
22
24
|
exports.embeddingSuccessSchema = zod_1.z
|
|
23
25
|
.object({
|
|
24
26
|
schemaVersion: zod_1.z.literal(1),
|
|
25
|
-
requestId: zod_1.z.string().
|
|
26
|
-
model: zod_1.z.string().
|
|
27
|
-
dimension: zod_1.z.number().
|
|
27
|
+
requestId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)),
|
|
28
|
+
model: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(255)),
|
|
29
|
+
dimension: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive().max(1024),
|
|
28
30
|
data: zod_1.z.array(exports.embeddingVectorSchema).min(1).max(2048),
|
|
29
31
|
usage: exports.embeddingUsageSchema,
|
|
30
32
|
})
|
|
@@ -50,7 +52,7 @@ exports.embeddingSuccessSchema = zod_1.z
|
|
|
50
52
|
exports.embeddingFailureSchema = zod_1.z
|
|
51
53
|
.object({
|
|
52
54
|
schemaVersion: zod_1.z.literal(1),
|
|
53
|
-
requestId: zod_1.z.string().
|
|
55
|
+
requestId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)),
|
|
54
56
|
error: errors_1.inferenceErrorSchema,
|
|
55
57
|
})
|
|
56
58
|
.strict();
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.productEntitlementSchema = exports.costCenterSpendSchema = exports.costCenterSchema = exports.costCenterStatusSchema = exports.COST_CENTER_STATUSES = exports.payAsYouGoEntitlementSchema = exports.productPlanSchema = exports.planAllowanceSchema = exports.LIVE_PRODUCT_PLAN_STATUSES = exports.productPlanStatusSchema = exports.PRODUCT_PLAN_STATUSES = void 0;
|
|
4
|
+
const numberChecks_1 = require("../numberChecks");
|
|
5
|
+
const stringChecks_1 = require("../stringChecks");
|
|
2
6
|
/**
|
|
3
7
|
* Product entitlements — the interface a first-party product (Alia) queries to
|
|
4
8
|
* learn what an account is entitled to, WITHOUT learning anything it could
|
|
@@ -42,8 +46,6 @@
|
|
|
42
46
|
*
|
|
43
47
|
* Decided in: docs/adr/0014-account-billing-and-entitlements.md.
|
|
44
48
|
*/
|
|
45
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.productEntitlementSchema = exports.costCenterSpendSchema = exports.costCenterSchema = exports.costCenterStatusSchema = exports.COST_CENTER_STATUSES = exports.payAsYouGoEntitlementSchema = exports.productPlanSchema = exports.planAllowanceSchema = exports.LIVE_PRODUCT_PLAN_STATUSES = exports.productPlanStatusSchema = exports.PRODUCT_PLAN_STATUSES = void 0;
|
|
47
49
|
const zod_1 = require("zod");
|
|
48
50
|
const identifiers_1 = require("./identifiers");
|
|
49
51
|
const accountBilling_1 = require("./accountBilling");
|
|
@@ -90,8 +92,8 @@ exports.planAllowanceSchema = zod_1.z
|
|
|
90
92
|
/** A stable machine name, e.g. `api_credits_per_month`. */
|
|
91
93
|
key: zod_1.z.string().regex(/^[a-z][a-z0-9_]{0,62}$/),
|
|
92
94
|
/** Whole units included per period. Never money. */
|
|
93
|
-
included: zod_1.z.number().
|
|
94
|
-
remaining: zod_1.z.number().
|
|
95
|
+
included: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().check((0, numberChecks_1.safeNumberCheck)()),
|
|
96
|
+
remaining: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().check((0, numberChecks_1.safeNumberCheck)()).optional(),
|
|
95
97
|
})
|
|
96
98
|
.strict();
|
|
97
99
|
/**
|
|
@@ -104,12 +106,12 @@ exports.planAllowanceSchema = zod_1.z
|
|
|
104
106
|
*/
|
|
105
107
|
exports.productPlanSchema = zod_1.z
|
|
106
108
|
.object({
|
|
107
|
-
id: zod_1.z.string().
|
|
108
|
-
name: zod_1.z.string().
|
|
109
|
+
id: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
|
|
110
|
+
name: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(120)),
|
|
109
111
|
status: exports.productPlanStatusSchema,
|
|
110
112
|
live: zod_1.z.boolean(),
|
|
111
|
-
currentPeriodStart: zod_1.z.string().
|
|
112
|
-
currentPeriodEnd: zod_1.z.string().
|
|
113
|
+
currentPeriodStart: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
114
|
+
currentPeriodEnd: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
113
115
|
cancelAtPeriodEnd: zod_1.z.boolean(),
|
|
114
116
|
allowances: zod_1.z.array(exports.planAllowanceSchema),
|
|
115
117
|
})
|
|
@@ -159,10 +161,10 @@ exports.costCenterSchema = zod_1.z
|
|
|
159
161
|
schemaVersion: zod_1.z.literal(1),
|
|
160
162
|
accountId: identifiers_1.oxyAccountIdSchema,
|
|
161
163
|
slug: zod_1.z.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/),
|
|
162
|
-
label: zod_1.z.string().
|
|
164
|
+
label: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(120)),
|
|
163
165
|
status: exports.costCenterStatusSchema,
|
|
164
|
-
createdAt: zod_1.z.string().
|
|
165
|
-
updatedAt: zod_1.z.string().
|
|
166
|
+
createdAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
167
|
+
updatedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
166
168
|
})
|
|
167
169
|
.strict();
|
|
168
170
|
/**
|
|
@@ -178,10 +180,10 @@ exports.costCenterSpendSchema = zod_1.z
|
|
|
178
180
|
schemaVersion: zod_1.z.literal(1),
|
|
179
181
|
costCenter: exports.costCenterSchema,
|
|
180
182
|
currency: money_1.currencyCodeSchema,
|
|
181
|
-
periodStart: zod_1.z.string().
|
|
182
|
-
periodEnd: zod_1.z.string().
|
|
183
|
+
periodStart: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
184
|
+
periodEnd: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
183
185
|
billedAmount: money_1.exactDecimalSchema,
|
|
184
|
-
requestCount: zod_1.z.number().
|
|
186
|
+
requestCount: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().check((0, numberChecks_1.safeNumberCheck)()),
|
|
185
187
|
})
|
|
186
188
|
.strict();
|
|
187
189
|
/* -------------------------------------------------------------------------- */
|
|
@@ -212,6 +214,6 @@ exports.productEntitlementSchema = zod_1.z
|
|
|
212
214
|
payAsYouGo: exports.payAsYouGoEntitlementSchema.nullable(),
|
|
213
215
|
costCenter: exports.costCenterSchema.nullable(),
|
|
214
216
|
/** When this view was computed. Entitlements are eventually consistent. */
|
|
215
|
-
resolvedAt: zod_1.z.string().
|
|
217
|
+
resolvedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
216
218
|
})
|
|
217
219
|
.strict();
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inferenceErrorSchema = exports.providerErrorPassthroughSchema = exports.upstreamErrorCategorySchema = exports.safeErrorTextSchema = exports.NON_RETRYABLE_INFERENCE_ERROR_CODES = exports.inferenceErrorCodeSchema = exports.INFERENCE_ERROR_CODES = void 0;
|
|
4
|
+
const numberChecks_1 = require("../numberChecks");
|
|
5
|
+
const stringChecks_1 = require("../stringChecks");
|
|
2
6
|
/**
|
|
3
7
|
* Inference errors and retryability.
|
|
4
8
|
*
|
|
@@ -23,8 +27,6 @@
|
|
|
23
27
|
*
|
|
24
28
|
* Decided in: docs/adr/0010-public-api-compatibility.md.
|
|
25
29
|
*/
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.inferenceErrorSchema = exports.providerErrorPassthroughSchema = exports.upstreamErrorCategorySchema = exports.safeErrorTextSchema = exports.NON_RETRYABLE_INFERENCE_ERROR_CODES = exports.inferenceErrorCodeSchema = exports.INFERENCE_ERROR_CODES = void 0;
|
|
28
30
|
const zod_1 = require("zod");
|
|
29
31
|
const identifiers_1 = require("./identifiers");
|
|
30
32
|
/**
|
|
@@ -226,8 +228,8 @@ const CREDENTIAL_PATTERNS = [
|
|
|
226
228
|
*/
|
|
227
229
|
exports.safeErrorTextSchema = zod_1.z
|
|
228
230
|
.string()
|
|
229
|
-
.
|
|
230
|
-
.
|
|
231
|
+
.check((0, stringChecks_1.utf16MinLength)(1))
|
|
232
|
+
.check((0, stringChecks_1.utf16MaxLength)(2000))
|
|
231
233
|
.refine((value) => !CREDENTIAL_PATTERNS.some((pattern) => pattern.test(value)), 'error text must not contain credential-shaped material');
|
|
232
234
|
/**
|
|
233
235
|
* A coarse classification of an upstream failure (ADR 0010's `upstreamCategory`).
|
|
@@ -261,9 +263,9 @@ exports.providerErrorPassthroughSchema = zod_1.z
|
|
|
261
263
|
.object({
|
|
262
264
|
provider: identifiers_1.inferenceProviderSlugSchema,
|
|
263
265
|
/** The upstream HTTP status, when the upstream spoke HTTP. */
|
|
264
|
-
status: zod_1.z.number().
|
|
266
|
+
status: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).min(100).max(599).optional(),
|
|
265
267
|
/** The upstream's own error code, verbatim and uninterpreted. */
|
|
266
|
-
code: zod_1.z.string().
|
|
268
|
+
code: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(128)).optional(),
|
|
267
269
|
/** The upstream's message, subject to the same credential refusal. */
|
|
268
270
|
message: exports.safeErrorTextSchema.optional(),
|
|
269
271
|
})
|
|
@@ -284,9 +286,14 @@ exports.inferenceErrorSchema = zod_1.z
|
|
|
284
286
|
retryable: zod_1.z.boolean(),
|
|
285
287
|
requestId: identifiers_1.requestIdSchema,
|
|
286
288
|
/** How long to wait before retrying. Only meaningful when `retryable`. */
|
|
287
|
-
retryAfterMs: zod_1.z
|
|
289
|
+
retryAfterMs: zod_1.z
|
|
290
|
+
.number()
|
|
291
|
+
.check((0, numberChecks_1.integerCheck)())
|
|
292
|
+
.nonnegative()
|
|
293
|
+
.check((0, numberChecks_1.safeNumberCheck)())
|
|
294
|
+
.optional(),
|
|
288
295
|
/** The request field at fault, for `invalid_request`. */
|
|
289
|
-
param: zod_1.z.string().
|
|
296
|
+
param: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(128)).optional(),
|
|
290
297
|
/** Present only when an upstream provider was reached and failed. */
|
|
291
298
|
upstreamCategory: exports.upstreamErrorCategorySchema.optional(),
|
|
292
299
|
providerError: exports.providerErrorPassthroughSchema.optional(),
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inferenceFundingTierSchema = exports.RESERVED_ALIA_PUBLISHER = exports.inferenceRegionSchema = exports.deploymentIdSchema = exports.inferenceProviderSlugSchema = exports.routingProfileIdSchema = exports.routingProfileSlugSchema = exports.modelReferenceSchema = exports.modelRevisionLabelSchema = exports.modelIdSchema = exports.modelSlugSchema = exports.publisherSlugSchema = exports.PADDED_BASE64_PATTERN = exports.sha256DigestSchema = exports.inferenceHttpsUrlSchema = exports.inferenceDateSchema = exports.inferenceTimestampSchema = exports.inferenceEnvironmentSchema = exports.idempotencyKeySchema = exports.generationIdSchema = exports.requestIdSchema = exports.oxyCredentialIdSchema = exports.oxyApplicationIdSchema = exports.delegatedUserIdSchema = exports.oxyAccountIdSchema = void 0;
|
|
4
|
+
const stringChecks_1 = require("../stringChecks");
|
|
2
5
|
/**
|
|
3
6
|
* Identifiers, references and wire primitives shared by every Oxy↔data-plane
|
|
4
7
|
* inference contract.
|
|
@@ -18,8 +21,6 @@
|
|
|
18
21
|
*
|
|
19
22
|
* Decided in: docs/adr/0007-canonical-request-attribution.md, docs/adr/0008-catalogue-concept-separation.md.
|
|
20
23
|
*/
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.inferenceFundingTierSchema = exports.RESERVED_ALIA_PUBLISHER = exports.inferenceRegionSchema = exports.deploymentIdSchema = exports.inferenceProviderSlugSchema = exports.routingProfileIdSchema = exports.routingProfileSlugSchema = exports.modelReferenceSchema = exports.modelRevisionLabelSchema = exports.modelIdSchema = exports.modelSlugSchema = exports.publisherSlugSchema = exports.PADDED_BASE64_PATTERN = exports.sha256DigestSchema = exports.inferenceHttpsUrlSchema = exports.inferenceDateSchema = exports.inferenceTimestampSchema = exports.inferenceEnvironmentSchema = exports.idempotencyKeySchema = exports.generationIdSchema = exports.requestIdSchema = exports.oxyCredentialIdSchema = exports.oxyApplicationIdSchema = exports.delegatedUserIdSchema = exports.oxyAccountIdSchema = void 0;
|
|
23
24
|
const zod_1 = require("zod");
|
|
24
25
|
/* -------------------------------------------------------------------------- */
|
|
25
26
|
/* Principal identifiers */
|
|
@@ -35,7 +36,11 @@ const zod_1 = require("zod");
|
|
|
35
36
|
* of a header, a JWT claim or a request body — is not assignable to it; the
|
|
36
37
|
* only way to obtain one is to parse a value through this schema.
|
|
37
38
|
*/
|
|
38
|
-
exports.oxyAccountIdSchema = zod_1.z
|
|
39
|
+
exports.oxyAccountIdSchema = zod_1.z
|
|
40
|
+
.string()
|
|
41
|
+
.check((0, stringChecks_1.utf16MinLength)(1))
|
|
42
|
+
.check((0, stringChecks_1.utf16MaxLength)(64))
|
|
43
|
+
.brand();
|
|
39
44
|
/**
|
|
40
45
|
* A delegated end-user identity (Alia's `X-Oxy-User-Id`), branded with a
|
|
41
46
|
* DIFFERENT brand from {@link oxyAccountIdSchema} so the two cannot be
|
|
@@ -46,16 +51,20 @@ exports.oxyAccountIdSchema = zod_1.z.string().min(1).max(64).brand();
|
|
|
46
51
|
* a billing principal, never an access-control principal, and its presence
|
|
47
52
|
* never changes which account is charged.
|
|
48
53
|
*/
|
|
49
|
-
exports.delegatedUserIdSchema = zod_1.z
|
|
54
|
+
exports.delegatedUserIdSchema = zod_1.z
|
|
55
|
+
.string()
|
|
56
|
+
.check((0, stringChecks_1.utf16MinLength)(1))
|
|
57
|
+
.check((0, stringChecks_1.utf16MaxLength)(64))
|
|
58
|
+
.brand();
|
|
50
59
|
/**
|
|
51
60
|
* An Oxy `Application._id`. Not branded: no invariant in this contract turns on
|
|
52
61
|
* confusing it with another id, and brand inflation costs every producer a
|
|
53
62
|
* parse call for no safety. The two ids above are branded because ADR 0007's
|
|
54
63
|
* rule is exactly that they must not be interchangeable.
|
|
55
64
|
*/
|
|
56
|
-
exports.oxyApplicationIdSchema = zod_1.z.string().
|
|
65
|
+
exports.oxyApplicationIdSchema = zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64));
|
|
57
66
|
/** An Oxy `ApplicationCredential._id` — the credential used for this request. */
|
|
58
|
-
exports.oxyCredentialIdSchema = zod_1.z.string().
|
|
67
|
+
exports.oxyCredentialIdSchema = zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64));
|
|
59
68
|
/**
|
|
60
69
|
* A request id allocated by the Oxy EDGE, at admission and BEFORE
|
|
61
70
|
* authentication, so that a request rejected for a bad credential is as
|
|
@@ -77,18 +86,18 @@ exports.oxyCredentialIdSchema = zod_1.z.string().min(1).max(64);
|
|
|
77
86
|
* customer-visible receipt, so it appears on every stream event and every
|
|
78
87
|
* ledger record.
|
|
79
88
|
*/
|
|
80
|
-
exports.requestIdSchema = zod_1.z.string().
|
|
89
|
+
exports.requestIdSchema = zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128));
|
|
81
90
|
/**
|
|
82
91
|
* A generation id generated by the data plane, present when a request produced
|
|
83
92
|
* a generation that can be looked up later (`GET /v1/generations/:id`).
|
|
84
93
|
*/
|
|
85
|
-
exports.generationIdSchema = zod_1.z.string().
|
|
94
|
+
exports.generationIdSchema = zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128));
|
|
86
95
|
/**
|
|
87
96
|
* A caller-supplied idempotency key. Every reserve/settle/refund call is keyed
|
|
88
97
|
* on one so a retry, a redelivered event or a duplicated webhook can never
|
|
89
98
|
* charge twice.
|
|
90
99
|
*/
|
|
91
|
-
exports.idempotencyKeySchema = zod_1.z.string().
|
|
100
|
+
exports.idempotencyKeySchema = zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(255));
|
|
92
101
|
/** Credential environments. A credential is issued into exactly one of them. */
|
|
93
102
|
exports.inferenceEnvironmentSchema = zod_1.z.enum(['development', 'staging', 'production']);
|
|
94
103
|
/* -------------------------------------------------------------------------- */
|
|
@@ -103,7 +112,7 @@ exports.inferenceEnvironmentSchema = zod_1.z.enum(['development', 'staging', 'pr
|
|
|
103
112
|
* settled. One canonical spelling (UTC, `Z`) so two records that describe the
|
|
104
113
|
* same moment compare and sort as equal, which a mix of offsets would not.
|
|
105
114
|
*/
|
|
106
|
-
exports.inferenceTimestampSchema = zod_1.z.string().
|
|
115
|
+
exports.inferenceTimestampSchema = zod_1.z.string().check((0, stringChecks_1.isoDateTime)());
|
|
107
116
|
/**
|
|
108
117
|
* A calendar DATE with no instant attached (`2026-05-01`) — a knowledge cutoff
|
|
109
118
|
* or a release date, which are published as days and become wrong when a
|
|
@@ -115,7 +124,7 @@ exports.inferenceDateSchema = zod_1.z
|
|
|
115
124
|
/** An absolute https URL, for model cards, licenses and provider documentation. */
|
|
116
125
|
exports.inferenceHttpsUrlSchema = zod_1.z
|
|
117
126
|
.string()
|
|
118
|
-
.
|
|
127
|
+
.check((0, stringChecks_1.utf16MaxLength)(2048))
|
|
119
128
|
.regex(/^https:\/\/[^\s]+$/, 'must be an absolute https URL');
|
|
120
129
|
/**
|
|
121
130
|
* A content digest, `sha256:<64 lowercase hex>`.
|
|
@@ -141,12 +150,12 @@ const REVISION_PATTERN = '[a-zA-Z0-9](?:[a-zA-Z0-9._-]*[a-zA-Z0-9])?';
|
|
|
141
150
|
/** A publisher slug, e.g. `openai`, `anthropic`, `meta`, `alia`. */
|
|
142
151
|
exports.publisherSlugSchema = zod_1.z
|
|
143
152
|
.string()
|
|
144
|
-
.
|
|
153
|
+
.check((0, stringChecks_1.utf16MaxLength)(64))
|
|
145
154
|
.regex(new RegExp(`^${SLUG_PATTERN}$`), 'publisher must be a lowercase URL-safe slug');
|
|
146
155
|
/** A model slug within its publisher's namespace, e.g. `gpt-5`, `llama-3.1-70b`. */
|
|
147
156
|
exports.modelSlugSchema = zod_1.z
|
|
148
157
|
.string()
|
|
149
|
-
.
|
|
158
|
+
.check((0, stringChecks_1.utf16MaxLength)(64))
|
|
150
159
|
.regex(new RegExp(`^${SLUG_PATTERN}$`), 'model must be a lowercase URL-safe slug');
|
|
151
160
|
/**
|
|
152
161
|
* A canonical model id, `<publisher>/<model>`. This names a MODEL — a
|
|
@@ -155,12 +164,12 @@ exports.modelSlugSchema = zod_1.z
|
|
|
155
164
|
*/
|
|
156
165
|
exports.modelIdSchema = zod_1.z
|
|
157
166
|
.string()
|
|
158
|
-
.
|
|
167
|
+
.check((0, stringChecks_1.utf16MaxLength)(129))
|
|
159
168
|
.regex(new RegExp(`^${SLUG_PATTERN}/${SLUG_PATTERN}$`), 'model id must be <publisher>/<model>');
|
|
160
169
|
/** An immutable revision label, unique within its model, e.g. `2026-05-01`. */
|
|
161
170
|
exports.modelRevisionLabelSchema = zod_1.z
|
|
162
171
|
.string()
|
|
163
|
-
.
|
|
172
|
+
.check((0, stringChecks_1.utf16MaxLength)(64))
|
|
164
173
|
.regex(new RegExp(`^${REVISION_PATTERN}$`), 'revision must be a URL-safe label');
|
|
165
174
|
/**
|
|
166
175
|
* A model reference as a customer writes it: `<publisher>/<model>` (the model's
|
|
@@ -174,7 +183,7 @@ exports.modelRevisionLabelSchema = zod_1.z
|
|
|
174
183
|
*/
|
|
175
184
|
exports.modelReferenceSchema = zod_1.z
|
|
176
185
|
.string()
|
|
177
|
-
.
|
|
186
|
+
.check((0, stringChecks_1.utf16MaxLength)(194))
|
|
178
187
|
.regex(new RegExp(`^${SLUG_PATTERN}/${SLUG_PATTERN}(?:@${REVISION_PATTERN})?$`), 'model reference must be <publisher>/<model> or <publisher>/<model>@<revision>');
|
|
179
188
|
/**
|
|
180
189
|
* A routing-profile slug, e.g. `auto`, `fast`, `quality`.
|
|
@@ -186,7 +195,7 @@ exports.modelReferenceSchema = zod_1.z
|
|
|
186
195
|
*/
|
|
187
196
|
exports.routingProfileSlugSchema = zod_1.z
|
|
188
197
|
.string()
|
|
189
|
-
.
|
|
198
|
+
.check((0, stringChecks_1.utf16MaxLength)(64))
|
|
190
199
|
.regex(new RegExp(`^${SLUG_PATTERN}$`), 'routing profile must be a lowercase URL-safe slug');
|
|
191
200
|
/**
|
|
192
201
|
* The opaque PostgreSQL identity of one routing profile.
|
|
@@ -194,11 +203,14 @@ exports.routingProfileSlugSchema = zod_1.z
|
|
|
194
203
|
* No trim, case-folding or format heuristic: callers selecting by id must name
|
|
195
204
|
* the exact stored bytes. The database lookup is the authority for existence.
|
|
196
205
|
*/
|
|
197
|
-
exports.routingProfileIdSchema = zod_1.z
|
|
206
|
+
exports.routingProfileIdSchema = zod_1.z
|
|
207
|
+
.string()
|
|
208
|
+
.check((0, stringChecks_1.utf16MinLength)(1))
|
|
209
|
+
.check((0, stringChecks_1.utf16MaxLength)(128));
|
|
198
210
|
/** An inference provider slug, e.g. `openai`, `bedrock`, `oxy-hosted`. */
|
|
199
211
|
exports.inferenceProviderSlugSchema = zod_1.z
|
|
200
212
|
.string()
|
|
201
|
-
.
|
|
213
|
+
.check((0, stringChecks_1.utf16MaxLength)(64))
|
|
202
214
|
.regex(new RegExp(`^${SLUG_PATTERN}$`), 'provider must be a lowercase URL-safe slug');
|
|
203
215
|
/**
|
|
204
216
|
* A deployment/endpoint id. Opaque to customers: which concrete endpoint served
|
|
@@ -206,7 +218,7 @@ exports.inferenceProviderSlugSchema = zod_1.z
|
|
|
206
218
|
* subset of it is ever attributed back (see the catalogue's serving-boundary
|
|
207
219
|
* rules).
|
|
208
220
|
*/
|
|
209
|
-
exports.deploymentIdSchema = zod_1.z.string().
|
|
221
|
+
exports.deploymentIdSchema = zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128));
|
|
210
222
|
/**
|
|
211
223
|
* A region identifier, e.g. `us-west-2`, `eu-central-1`. Free-form rather than
|
|
212
224
|
* a closed enum because the set is provider-defined and grows without any
|
|
@@ -214,7 +226,7 @@ exports.deploymentIdSchema = zod_1.z.string().min(1).max(128);
|
|
|
214
226
|
*/
|
|
215
227
|
exports.inferenceRegionSchema = zod_1.z
|
|
216
228
|
.string()
|
|
217
|
-
.
|
|
229
|
+
.check((0, stringChecks_1.utf16MaxLength)(64))
|
|
218
230
|
.regex(new RegExp(`^${SLUG_PATTERN}$`), 'region must be a lowercase URL-safe slug');
|
|
219
231
|
/**
|
|
220
232
|
* The publisher namespace reserved for models Alia actually owns or derives.
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.inboxInferenceStreamEventSchema = exports.inboxThreadSummaryResponseSchema = exports.inboxSmartRepliesResponseSchema = exports.inboxDailyBriefResponseSchema = exports.INBOX_DAILY_BRIEF_SECTIONS = exports.inboxNaturalSearchResponseSchema = exports.inboxInferenceTextResponseSchema = exports.inboxMessageInferenceParamsSchema = exports.inboxNaturalSearchRequestSchema = exports.inboxDailyBriefRequestSchema = exports.inboxComposeRequestSchema = void 0;
|
|
4
|
+
const numberChecks_1 = require("../numberChecks");
|
|
5
|
+
const stringChecks_1 = require("../stringChecks");
|
|
4
6
|
const zod_1 = require("zod");
|
|
5
7
|
const errors_1 = require("./errors");
|
|
6
|
-
const inboxTextSchema = zod_1.z.string().trim().
|
|
7
|
-
const inboxMessageIdSchema = zod_1.z.string().
|
|
8
|
+
const inboxTextSchema = zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(20000));
|
|
9
|
+
const inboxMessageIdSchema = zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128));
|
|
8
10
|
const DAILY_BRIEF_MIN_WINDOW_MS = 23 * 60 * 60 * 1000;
|
|
9
11
|
const DAILY_BRIEF_MAX_WINDOW_MS = 25 * 60 * 60 * 1000;
|
|
10
12
|
const inboxUtcTimestampSchema = zod_1.z
|
|
11
13
|
.string()
|
|
12
|
-
.
|
|
14
|
+
.check((0, stringChecks_1.isoDateTime)({ offset: false }))
|
|
13
15
|
.refine((value) => value.endsWith('Z'), 'Timestamp must use the UTC Z suffix');
|
|
14
16
|
exports.inboxComposeRequestSchema = zod_1.z.discriminatedUnion('operation', [
|
|
15
17
|
zod_1.z.object({
|
|
@@ -41,7 +43,7 @@ exports.inboxDailyBriefRequestSchema = zod_1.z.object({
|
|
|
41
43
|
startAt: inboxUtcTimestampSchema,
|
|
42
44
|
endAt: inboxUtcTimestampSchema,
|
|
43
45
|
/** BCP 47 tag of the language the brief is written in; English when absent. */
|
|
44
|
-
locale: zod_1.z.string().regex(/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/).
|
|
46
|
+
locale: zod_1.z.string().regex(/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/).check((0, stringChecks_1.utf16MaxLength)(35)).optional(),
|
|
45
47
|
}).strict().superRefine((value, context) => {
|
|
46
48
|
const durationMs = Date.parse(value.endAt) - Date.parse(value.startAt);
|
|
47
49
|
if (!Number.isFinite(durationMs) || durationMs <= 0) {
|
|
@@ -60,20 +62,20 @@ exports.inboxDailyBriefRequestSchema = zod_1.z.object({
|
|
|
60
62
|
});
|
|
61
63
|
}
|
|
62
64
|
});
|
|
63
|
-
exports.inboxNaturalSearchRequestSchema = zod_1.z.object({ query: zod_1.z.string().trim().
|
|
65
|
+
exports.inboxNaturalSearchRequestSchema = zod_1.z.object({ query: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(512)) }).strict();
|
|
64
66
|
exports.inboxMessageInferenceParamsSchema = zod_1.z.object({ messageId: inboxMessageIdSchema }).strict();
|
|
65
67
|
exports.inboxInferenceTextResponseSchema = zod_1.z.object({
|
|
66
68
|
schemaVersion: zod_1.z.literal(1),
|
|
67
|
-
requestId: zod_1.z.string().
|
|
68
|
-
generationId: zod_1.z.string().
|
|
69
|
-
text: zod_1.z.string().
|
|
69
|
+
requestId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)),
|
|
70
|
+
generationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)).optional(),
|
|
71
|
+
text: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(40000)),
|
|
70
72
|
}).strict();
|
|
71
73
|
exports.inboxNaturalSearchResponseSchema = zod_1.z.object({
|
|
72
74
|
query: zod_1.z.object({
|
|
73
|
-
q: zod_1.z.string().
|
|
74
|
-
from: zod_1.z.string().
|
|
75
|
-
to: zod_1.z.string().
|
|
76
|
-
subject: zod_1.z.string().
|
|
75
|
+
q: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(512)).optional(),
|
|
76
|
+
from: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(320)).optional(),
|
|
77
|
+
to: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(320)).optional(),
|
|
78
|
+
subject: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(512)).optional(),
|
|
77
79
|
hasAttachment: zod_1.z.boolean().optional(),
|
|
78
80
|
starred: zod_1.z.boolean().optional(),
|
|
79
81
|
unread: zod_1.z.boolean().optional(),
|
|
@@ -81,7 +83,7 @@ exports.inboxNaturalSearchResponseSchema = zod_1.z.object({
|
|
|
81
83
|
before: zod_1.z.string().date().optional(),
|
|
82
84
|
mailbox: zod_1.z.enum(['inbox', 'sent', 'drafts', 'trash', 'spam', 'archive']).optional(),
|
|
83
85
|
}).strict(),
|
|
84
|
-
interpretation: zod_1.z.string().
|
|
86
|
+
interpretation: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(1000)),
|
|
85
87
|
}).strict();
|
|
86
88
|
/** Where the brief puts a message: it asks something of the owner, it is today's news, or it is still unread from before. */
|
|
87
89
|
exports.INBOX_DAILY_BRIEF_SECTIONS = ['needs_you', 'today', 'earlier'];
|
|
@@ -93,50 +95,50 @@ exports.INBOX_DAILY_BRIEF_SECTIONS = ['needs_you', 'today', 'earlier'];
|
|
|
93
95
|
*/
|
|
94
96
|
exports.inboxDailyBriefResponseSchema = zod_1.z.object({
|
|
95
97
|
schemaVersion: zod_1.z.literal(1),
|
|
96
|
-
requestId: zod_1.z.string().
|
|
97
|
-
generationId: zod_1.z.string().
|
|
98
|
-
summary: zod_1.z.string().
|
|
98
|
+
requestId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)),
|
|
99
|
+
generationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)).optional(),
|
|
100
|
+
summary: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(400)),
|
|
99
101
|
/** Returned only when the caller opts in with `?includeActions=true`. */
|
|
100
102
|
actions: zod_1.z.array(zod_1.z.object({
|
|
101
|
-
label: zod_1.z.string().trim().
|
|
102
|
-
prompt: zod_1.z.string().trim().
|
|
103
|
+
label: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(40)),
|
|
104
|
+
prompt: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(600)),
|
|
103
105
|
messageIds: zod_1.z.array(inboxMessageIdSchema).min(1).max(10),
|
|
104
106
|
}).strict()).min(2).max(5).optional(),
|
|
105
107
|
counts: zod_1.z.object({
|
|
106
|
-
received: zod_1.z.number().
|
|
107
|
-
unread: zod_1.z.number().
|
|
108
|
-
starred: zod_1.z.number().
|
|
109
|
-
earlierUnread: zod_1.z.number().
|
|
108
|
+
received: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
|
|
109
|
+
unread: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
|
|
110
|
+
starred: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
|
|
111
|
+
earlierUnread: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
|
|
110
112
|
}).strict(),
|
|
111
113
|
items: zod_1.z.array(zod_1.z.object({
|
|
112
114
|
messageId: inboxMessageIdSchema,
|
|
113
115
|
section: zod_1.z.enum(exports.INBOX_DAILY_BRIEF_SECTIONS),
|
|
114
|
-
note: zod_1.z.string().
|
|
115
|
-
from: zod_1.z.object({ name: zod_1.z.string().
|
|
116
|
-
subject: zod_1.z.string().
|
|
117
|
-
receivedAt: zod_1.z.string().
|
|
116
|
+
note: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(200)),
|
|
117
|
+
from: zod_1.z.object({ name: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(998)).nullable(), address: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(320)) }).strict(),
|
|
118
|
+
subject: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(998)),
|
|
119
|
+
receivedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
118
120
|
unread: zod_1.z.boolean(),
|
|
119
121
|
hasAttachments: zod_1.z.boolean(),
|
|
120
122
|
}).strict()).max(20),
|
|
121
123
|
}).strict();
|
|
122
124
|
exports.inboxSmartRepliesResponseSchema = zod_1.z.object({
|
|
123
|
-
replies: zod_1.z.array(zod_1.z.string().trim().
|
|
125
|
+
replies: zod_1.z.array(zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(500))).max(3),
|
|
124
126
|
}).strict();
|
|
125
127
|
exports.inboxThreadSummaryResponseSchema = zod_1.z.object({
|
|
126
|
-
summary: zod_1.z.string().
|
|
127
|
-
keyPoints: zod_1.z.array(zod_1.z.string().
|
|
128
|
+
summary: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(4000)),
|
|
129
|
+
keyPoints: zod_1.z.array(zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(1000))).max(12),
|
|
128
130
|
actionItems: zod_1.z.array(zod_1.z.object({
|
|
129
|
-
text: zod_1.z.string().
|
|
130
|
-
owner: zod_1.z.string().
|
|
131
|
-
deadline: zod_1.z.string().
|
|
131
|
+
text: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(1000)),
|
|
132
|
+
owner: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(320)).nullable(),
|
|
133
|
+
deadline: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(128)).nullable(),
|
|
132
134
|
}).strict()).max(12),
|
|
133
135
|
}).strict();
|
|
134
136
|
exports.inboxInferenceStreamEventSchema = zod_1.z.discriminatedUnion('type', [
|
|
135
|
-
zod_1.z.object({ type: zod_1.z.literal('delta'), text: zod_1.z.string().
|
|
137
|
+
zod_1.z.object({ type: zod_1.z.literal('delta'), text: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(16384)) }).strict(),
|
|
136
138
|
zod_1.z.object({
|
|
137
139
|
type: zod_1.z.literal('done'),
|
|
138
|
-
requestId: zod_1.z.string().
|
|
139
|
-
generationId: zod_1.z.string().
|
|
140
|
+
requestId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)),
|
|
141
|
+
generationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)).optional(),
|
|
140
142
|
}).strict(),
|
|
141
143
|
zod_1.z.object({ type: zod_1.z.literal('error'), error: errors_1.inferenceErrorSchema }).strict(),
|
|
142
144
|
]);
|