@oxy.so/contracts 4.14.0 → 4.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/index.js +15 -9
  3. package/dist/cjs/inference/money.js +10 -0
  4. package/dist/cjs/inference/version.js +1 -1
  5. package/dist/cjs/signIn.js +40 -1
  6. package/dist/esm/.tsbuildinfo +1 -1
  7. package/dist/esm/index.js +1 -1
  8. package/dist/esm/inference/money.js +10 -0
  9. package/dist/esm/inference/version.js +1 -1
  10. package/dist/esm/signIn.js +38 -0
  11. package/dist/types/.tsbuildinfo +1 -1
  12. package/dist/types/accountGraph.d.ts +22 -22
  13. package/dist/types/accountSubject.d.ts +4 -4
  14. package/dist/types/agency.d.ts +86 -86
  15. package/dist/types/deviceDirectory.d.ts +180 -180
  16. package/dist/types/email/messages.d.ts +78 -78
  17. package/dist/types/externalIdentity.d.ts +59 -59
  18. package/dist/types/index.d.ts +2 -2
  19. package/dist/types/inference/accountBilling.d.ts +36 -36
  20. package/dist/types/inference/catalogue.d.ts +19 -19
  21. package/dist/types/inference/decisions.d.ts +47 -47
  22. package/dist/types/inference/economics.d.ts +11 -11
  23. package/dist/types/inference/embeddings.d.ts +18 -18
  24. package/dist/types/inference/entitlement.d.ts +12 -12
  25. package/dist/types/inference/errors.d.ts +4 -4
  26. package/dist/types/inference/inbox.d.ts +17 -17
  27. package/dist/types/inference/money.d.ts +17 -8
  28. package/dist/types/inference/priceVersion.d.ts +20 -20
  29. package/dist/types/inference/privateAutoExecution.d.ts +12 -12
  30. package/dist/types/inference/providerConnection.d.ts +24 -24
  31. package/dist/types/inference/realtime.d.ts +50 -50
  32. package/dist/types/inference/request.d.ts +26 -26
  33. package/dist/types/inference/routingPolicy.d.ts +11 -11
  34. package/dist/types/inference/scopedExecution.d.ts +8 -8
  35. package/dist/types/inference/streamEvents.d.ts +30 -30
  36. package/dist/types/inference/usage.d.ts +36 -36
  37. package/dist/types/inference/version.d.ts +1 -1
  38. package/dist/types/keyRecovery.d.ts +4 -4
  39. package/dist/types/linkedAccounts.d.ts +16 -16
  40. package/dist/types/notifications.d.ts +4 -4
  41. package/dist/types/oauth.d.ts +40 -40
  42. package/dist/types/products/access.d.ts +18 -18
  43. package/dist/types/products/billing.d.ts +24 -24
  44. package/dist/types/products/plans.d.ts +6 -6
  45. package/dist/types/recommendations.d.ts +30 -30
  46. package/dist/types/safety.d.ts +2 -2
  47. package/dist/types/sessionStatus.d.ts +6 -6
  48. package/dist/types/signIn.d.ts +82 -1
  49. package/dist/types/stickers.d.ts +32 -32
  50. package/dist/types/userResponse.d.ts +108 -108
  51. package/package.json +1 -1
package/dist/esm/index.js CHANGED
@@ -100,7 +100,7 @@ export {
100
100
  EMAIL_VERIFICATION_PURPOSES, EMAIL_CODE_LENGTH, EMAIL_CODE_TTL_MS, EMAIL_CODE_MAX_ATTEMPTS, EMAIL_TICKET_TTL_MS, EMAIL_VERIFICATION_ERROR_CODES, emailAddressSchema, emailTicketSchema, emailVerificationStartRequestSchema, emailVerificationStartResponseSchema, emailVerificationConfirmRequestSchema, emailVerificationConfirmResponseSchema, } from './accountEmail.js';
101
101
  export {
102
102
  // Email code/link, password and authenticator sign-in
103
- EMAIL_SIGNIN_LINK_TTL_MS, SIGNIN_SECOND_FACTOR_TTL_MS, SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS, PASSWORD_MIN_LENGTH, PASSWORD_MAX_LENGTH, TOTP_DIGITS, TOTP_PERIOD_SECONDS, TOTP_BACKUP_CODE_COUNT, SIGN_IN_ERROR_CODES, signInIdentifierSchema, passwordInputSchema, newPasswordSchema, secondFactorCodeSchema, emailSignInStartRequestSchema, emailSignInStartResponseSchema, emailSignInConfirmRequestSchema, emailSignInCodeSchema, normalizeEmailSignInCode, EMAIL_SIGNIN_LONG_CODE_ALPHABET, EMAIL_SIGNIN_LONG_CODE_LENGTH, emailSignInCollectRequestSchema, emailSignInLinkRequestSchema, emailSignInLinkResponseSchema, emailSignInPendingSchema, passwordSignInRequestSchema, secondFactorSignInRequestSchema, secondFactorRequiredSchema, signUpRequestSchema, isSecondFactorRequired, reauthProofSchema, emailReauthProofSchema, REAUTH_ACTIONS, reauthEmailStartRequestSchema, passwordSetRequestSchema, signInMethodsSchema, totpEnrollResponseSchema, totpConfirmRequestSchema, totpReauthRequestSchema, totpBackupCodesResponseSchema, } from './signIn.js';
103
+ EMAIL_SIGNIN_LINK_TTL_MS, SIGNIN_SECOND_FACTOR_TTL_MS, SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS, PASSWORD_MIN_LENGTH, PASSWORD_MAX_LENGTH, TOTP_DIGITS, TOTP_PERIOD_SECONDS, TOTP_BACKUP_CODE_COUNT, SIGN_IN_ERROR_CODES, signInIdentifierSchema, passwordInputSchema, newPasswordSchema, secondFactorCodeSchema, emailSignInStartRequestSchema, emailSignInStartResponseSchema, emailSignInConfirmRequestSchema, emailSignInCodeSchema, normalizeEmailSignInCode, EMAIL_SIGNIN_LONG_CODE_ALPHABET, EMAIL_SIGNIN_LONG_CODE_LENGTH, emailSignInCollectRequestSchema, emailSignInLinkRequestSchema, emailSignInLinkResponseSchema, emailSignInPendingSchema, EMAIL_SIGNIN_CHOICE_TTL_MS, EMAIL_ACCOUNTS_MAX, emailSignInAccountOptionSchema, emailSignInChooseAccountSchema, emailSignInChooseRequestSchema, isEmailSignInChooseAccount, passwordSignInRequestSchema, secondFactorSignInRequestSchema, secondFactorRequiredSchema, signUpRequestSchema, isSecondFactorRequired, reauthProofSchema, emailReauthProofSchema, REAUTH_ACTIONS, reauthEmailStartRequestSchema, passwordSetRequestSchema, signInMethodsSchema, totpEnrollResponseSchema, totpConfirmRequestSchema, totpReauthRequestSchema, totpBackupCodesResponseSchema, } from './signIn.js';
104
104
  export {
105
105
  // Linking Commons to an account without a key (ADR 0029 D3)
106
106
  IDENTITY_LINK_STATUSES, IDENTITY_LINK_QR_PREFIX, identityLinkIdSchema, buildIdentityLinkQrPayload, parseIdentityLinkQrPayload, identityLinkCreateResponseSchema, identityLinkStateSchema, identityLinkProofRequestSchema, identityLinkCompleteRequestSchema, } from './identityLink.js';
@@ -144,6 +144,15 @@ export const moneySchema = z
144
144
  * estimated from the audio, and a provider billed by the audio it carries (or
145
145
  * by tokens) never reports it.
146
146
  *
147
+ * **`input_transcription_milliseconds` is a second model's reading** (added in
148
+ * contract set 3.9.0, mirroring `@kaana.ai/contracts` 4.1.0): milliseconds of a
149
+ * realtime session's input audio that the deployment's own TRANSCRIPTION model
150
+ * transcribed, when the provider bills that model apart from the session model
151
+ * (OpenAI bills input transcription at the ASR model's price). The session
152
+ * model's `audio_input_tokens` and this unit are two charges for two models,
153
+ * each read once, so the partition rule holds. A provider whose session price
154
+ * already includes the transcription (xAI's Voice Agent) never reports it.
155
+ *
147
156
  * No refinement in this package can enforce it, and saying so is part of the
148
157
  * rule: a nested report and a disjoint one are the same four non-negative
149
158
  * integers, so no predicate over a single report can tell them apart. The two
@@ -181,6 +190,7 @@ export const USAGE_UNITS = [
181
190
  'cached_audio_input_tokens',
182
191
  'audio_output_tokens',
183
192
  'session_milliseconds',
193
+ 'input_transcription_milliseconds',
184
194
  ];
185
195
  export const usageUnitSchema = z.enum(USAGE_UNITS);
186
196
  /**
@@ -99,4 +99,4 @@
99
99
  * change to, say, the catalogue reject every in-flight inference request; the
100
100
  * per-shape `schemaVersion` is what a message is validated against.
101
101
  */
102
- export const INFERENCE_CONTRACT_VERSION = '3.8.0';
102
+ export const INFERENCE_CONTRACT_VERSION = '3.9.0';
@@ -18,6 +18,11 @@
18
18
  * one-use second-factor challenge instead of a session, and
19
19
  * `POST /auth/signin/second-factor` takes the TOTP (or a backup code).
20
20
  *
21
+ * An email may hold several accounts (up to `EMAIL_ACCOUNTS_MAX`). Signing in
22
+ * with the email, once the code or the link proves it, answers the accounts to
23
+ * choose from when there are several, and `POST /auth/signin/email/choose`
24
+ * names one. A username always names one account.
25
+ *
21
26
  * `POST /auth/signup` creates an account from a username and an email confirmed
22
27
  * with `POST /auth/email/verify/{start,confirm}` (purpose `signup`).
23
28
  *
@@ -188,10 +193,41 @@ export const emailSignInPendingSchema = z.object({
188
193
  status: z.literal('pending'),
189
194
  expiresAt: z.number().int().positive(),
190
195
  });
196
+ /**
197
+ * How long, once the email is proven, the person has to choose which of its
198
+ * accounts signs in.
199
+ */
200
+ export const EMAIL_SIGNIN_CHOICE_TTL_MS = 5 * 60 * 1000;
201
+ /** Most accounts one email can hold; sign-up refuses another past it. */
202
+ export const EMAIL_ACCOUNTS_MAX = 20;
203
+ export const emailSignInAccountOptionSchema = z.object({
204
+ id: z.string().min(1).max(64),
205
+ username: z.string().min(1).optional(),
206
+ displayName: z.string().min(1).optional(),
207
+ avatar: z.string().min(1).optional(),
208
+ });
209
+ export const emailSignInChooseAccountSchema = z.object({
210
+ chooseAccount: z.literal(true),
211
+ accounts: z.array(emailSignInAccountOptionSchema).min(2).max(EMAIL_ACCOUNTS_MAX),
212
+ expiresAt: z.number().int().positive(),
213
+ });
214
+ /** `POST /auth/signin/email/choose` — the account, from those {@link EmailSignInChooseAccount} listed. */
215
+ export const emailSignInChooseRequestSchema = z
216
+ .object({
217
+ requestId: z.string().trim().min(1).max(64),
218
+ requestSecret: opaqueTokenSchema,
219
+ userId: z.string().trim().min(1).max(64),
220
+ ...sessionEnvelope,
221
+ })
222
+ .strict();
191
223
  /** Narrow a {@link SignInStepResult}. */
192
224
  export function isSecondFactorRequired(result) {
193
225
  return result.secondFactorRequired === true;
194
226
  }
227
+ /** Narrow an {@link EmailSignInStepResult}. */
228
+ export function isEmailSignInChooseAccount(result) {
229
+ return result.chooseAccount === true;
230
+ }
195
231
  /**
196
232
  * What a re-verification email code confirms. The code is bound to it: a code
197
233
  * asked for one change never authorises another, and the email names it.
@@ -309,4 +345,6 @@ export const SIGN_IN_ERROR_CODES = {
309
345
  originNotAllowed: 'SIGNIN_ORIGIN_NOT_ALLOWED',
310
346
  /** The username is taken. */
311
347
  usernameTaken: 'USERNAME_TAKEN',
348
+ /** The email already holds `EMAIL_ACCOUNTS_MAX` accounts: no sign-up adds another. */
349
+ emailAccountsFull: 'EMAIL_ACCOUNTS_FULL',
312
350
  };