@tokensrc/codex 1.14.3 → 1.14.5

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 (38) hide show
  1. package/dist/client.d.ts +6 -1
  2. package/dist/client.js +44 -5
  3. package/dist/client.js.map +1 -1
  4. package/dist/command-directory.js +2 -2
  5. package/dist/command-directory.js.map +1 -1
  6. package/dist/commands.js +181 -255
  7. package/dist/commands.js.map +1 -1
  8. package/dist/index.d.ts +3 -0
  9. package/dist/index.js +3 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/managed-credential-v3-assignment.d.ts +38 -0
  12. package/dist/managed-credential-v3-assignment.js +68 -0
  13. package/dist/managed-credential-v3-assignment.js.map +1 -0
  14. package/dist/managed-credential-v3-envelope.d.ts +18 -1
  15. package/dist/managed-credential-v3-envelope.js +38 -5
  16. package/dist/managed-credential-v3-envelope.js.map +1 -1
  17. package/dist/managed-credential-v3-flow.d.ts +9 -0
  18. package/dist/managed-credential-v3-flow.js +56 -4
  19. package/dist/managed-credential-v3-flow.js.map +1 -1
  20. package/dist/managed-credential-v3-journal.d.ts +17 -0
  21. package/dist/managed-credential-v3-journal.js +43 -0
  22. package/dist/managed-credential-v3-journal.js.map +1 -1
  23. package/dist/profile.d.ts +2 -0
  24. package/dist/profile.js +31 -5
  25. package/dist/profile.js.map +1 -1
  26. package/dist/protocol.d.ts +165 -13
  27. package/dist/protocol.js +117 -13
  28. package/dist/protocol.js.map +1 -1
  29. package/dist/selection.d.ts +1 -1
  30. package/dist/selection.js +3 -3
  31. package/dist/selection.js.map +1 -1
  32. package/dist/token-pool-v4-upload-flow.d.ts +29 -0
  33. package/dist/token-pool-v4-upload-flow.js +162 -0
  34. package/dist/token-pool-v4-upload-flow.js.map +1 -0
  35. package/dist/token-pool-v4-upload-journal.d.ts +36 -0
  36. package/dist/token-pool-v4-upload-journal.js +76 -0
  37. package/dist/token-pool-v4-upload-journal.js.map +1 -0
  38. package/package.json +2 -2
@@ -13,11 +13,20 @@ export declare const CODEX_ASSIGNMENT_RETIREMENTS_PATH = "/v2/codex/assignment-r
13
13
  export declare const CODEX_ADMIN_MIGRATION_PLANS_PATH = "/v2/admin/codex/migration-plans";
14
14
  export declare const CODEX_MANAGED_CREDENTIALS_V3_SCHEMA_VERSION: 3;
15
15
  export declare const CODEX_MANAGED_CREDENTIALS_V3_PATH = "/v3/codex";
16
- export declare const CODEX_V3_ENROLLMENT_CONFIGURATION_PATH = "/v3/codex/enrollment-configuration";
16
+ export declare const CODEX_V3_ENROLLMENT_CONFIGURATION_PATH = "/v4/codex/enrollment-configuration";
17
17
  export declare const CODEX_V3_ENROLLMENTS_PATH = "/v3/codex/enrollments";
18
- export declare const CODEX_V3_CREDENTIAL_ASSIGNMENTS_PATH = "/v3/codex/credential-assignments";
19
- export declare const CODEX_V3_FULL_CREDENTIAL_DELIVERIES_PATH = "/v3/codex/full-credential-deliveries";
20
- export declare const CODEX_V3_CREDENTIAL_LINEAGES_PATH = "/v3/codex/credential-lineages";
18
+ export declare const CODEX_V3_CREDENTIAL_ASSIGNMENTS_PATH = "/v4/codex/credential-assignments";
19
+ export declare const CODEX_V3_FULL_CREDENTIAL_DELIVERIES_PATH = "/v4/codex/full-credential-deliveries";
20
+ export declare const CODEX_V3_CREDENTIAL_LINEAGES_PATH = "/v4/codex/credential-lineages";
21
+ export declare const CODEX_TOKEN_POOL_V4_SCHEMA_VERSION: 4;
22
+ export declare const CODEX_TOKEN_POOL_V4_PATH = "/v4/admin/codex";
23
+ export declare const CODEX_TOKEN_POOL_V4_ENROLLMENT_CONFIGURATION_PATH = "/v4/admin/codex/enrollment-configuration";
24
+ export declare const CODEX_TOKEN_POOL_V4_DIRECTORY_RESOLVE_PATH = "/v4/admin/codex/directory-users/resolve";
25
+ export declare const CODEX_TOKEN_POOL_V4_UPLOADS_PATH = "/v4/admin/codex/token-pool/uploads";
26
+ export declare const CODEX_TOKEN_POOL_V4_RUNTIME_PATH = "/v4/codex";
27
+ export declare const CODEX_TOKEN_POOL_V4_CREDENTIAL_ASSIGNMENTS_PATH = "/v4/codex/credential-assignments";
28
+ export declare const CODEX_TOKEN_POOL_V4_FULL_CREDENTIAL_DELIVERIES_PATH = "/v4/codex/full-credential-deliveries";
29
+ export declare const CODEX_TOKEN_POOL_V4_CREDENTIAL_LINEAGES_PATH = "/v4/codex/credential-lineages";
21
30
  export declare const CODEX_MIGRATION_CAPACITY: {
22
31
  readonly verifiedMinimum: 2;
23
32
  readonly verifiedLimit: null;
@@ -1456,7 +1465,7 @@ export declare const CodexV3CredentialEnvelopeSchema: z.ZodObject<{
1456
1465
  authenticationTag: z.ZodString;
1457
1466
  }, z.core.$strict>;
1458
1467
  export declare const CodexV3EnrollmentConfigurationSchema: z.ZodObject<{
1459
- schemaVersion: z.ZodLiteral<3>;
1468
+ schemaVersion: z.ZodLiteral<4>;
1460
1469
  ingress: z.ZodObject<{
1461
1470
  envelopeVersion: z.ZodLiteral<1>;
1462
1471
  algorithm: z.ZodLiteral<"X25519-HKDF-SHA256-AES-256-GCM">;
@@ -1570,7 +1579,7 @@ export declare const CodexV3CredentialAssignmentSchema: z.ZodObject<{
1570
1579
  deliveryEligible: z.ZodBoolean;
1571
1580
  }, z.core.$strict>;
1572
1581
  export declare const CodexV3CredentialAssignmentListResponseSchema: z.ZodObject<{
1573
- schemaVersion: z.ZodLiteral<3>;
1582
+ schemaVersion: z.ZodLiteral<4>;
1574
1583
  items: z.ZodArray<z.ZodObject<{
1575
1584
  assignmentId: z.ZodString;
1576
1585
  managedAccountId: z.ZodString;
@@ -1608,7 +1617,7 @@ export declare const CodexV3CredentialAssignmentListResponseSchema: z.ZodObject<
1608
1617
  total: z.ZodNumber;
1609
1618
  }, z.core.$strict>;
1610
1619
  export declare const CodexV3FullCredentialDeliveryRequestSchema: z.ZodObject<{
1611
- schemaVersion: z.ZodLiteral<3>;
1620
+ schemaVersion: z.ZodLiteral<4>;
1612
1621
  clientRequestId: z.ZodString;
1613
1622
  clientKey: z.ZodObject<{
1614
1623
  version: z.ZodLiteral<1>;
@@ -1617,7 +1626,7 @@ export declare const CodexV3FullCredentialDeliveryRequestSchema: z.ZodObject<{
1617
1626
  }, z.core.$strict>;
1618
1627
  }, z.core.$strict>;
1619
1628
  export declare const CodexV3FullCredentialDeliveryResponseSchema: z.ZodObject<{
1620
- schemaVersion: z.ZodLiteral<3>;
1629
+ schemaVersion: z.ZodLiteral<4>;
1621
1630
  delivery: z.ZodObject<{
1622
1631
  id: z.ZodString;
1623
1632
  credentialKind: z.ZodLiteral<"FULL">;
@@ -1648,13 +1657,13 @@ export declare const CodexV3FullCredentialDeliveryResponseSchema: z.ZodObject<{
1648
1657
  replayed: z.ZodBoolean;
1649
1658
  }, z.core.$strict>;
1650
1659
  export declare const CodexV3FullCredentialDeliveryAckInputSchema: z.ZodObject<{
1651
- schemaVersion: z.ZodLiteral<3>;
1660
+ schemaVersion: z.ZodLiteral<4>;
1652
1661
  lineageId: z.ZodString;
1653
1662
  generationVersion: z.ZodNumber;
1654
1663
  installed: z.ZodLiteral<true>;
1655
1664
  }, z.core.$strict>;
1656
1665
  export declare const CodexV3FullCredentialDeliveryAckResponseSchema: z.ZodObject<{
1657
- schemaVersion: z.ZodLiteral<3>;
1666
+ schemaVersion: z.ZodLiteral<4>;
1658
1667
  delivery: z.ZodObject<{
1659
1668
  id: z.ZodString;
1660
1669
  credentialKind: z.ZodLiteral<"FULL">;
@@ -1676,7 +1685,7 @@ export declare const CodexV3FullCredentialDeliveryAckResponseSchema: z.ZodObject
1676
1685
  replayed: z.ZodBoolean;
1677
1686
  }, z.core.$strict>;
1678
1687
  export declare const CodexV3FullCredentialBundleSchema: z.ZodObject<{
1679
- schemaVersion: z.ZodLiteral<3>;
1688
+ schemaVersion: z.ZodLiteral<4>;
1680
1689
  deliveryId: z.ZodString;
1681
1690
  managedAccountId: z.ZodString;
1682
1691
  providerAccountId: z.ZodString;
@@ -1688,7 +1697,7 @@ export declare const CodexV3FullCredentialBundleSchema: z.ZodObject<{
1688
1697
  expiresAt: z.ZodString;
1689
1698
  }, z.core.$strict>;
1690
1699
  export declare const CodexV3GenerationReportInputSchema: z.ZodObject<{
1691
- schemaVersion: z.ZodLiteral<3>;
1700
+ schemaVersion: z.ZodLiteral<4>;
1692
1701
  clientRequestId: z.ZodString;
1693
1702
  expectedGenerationVersion: z.ZodNumber;
1694
1703
  rotationMode: z.ZodEnum<{
@@ -1719,7 +1728,7 @@ export declare const CodexV3GenerationReportInputSchema: z.ZodObject<{
1719
1728
  observedAt: z.ZodString;
1720
1729
  }, z.core.$strict>;
1721
1730
  export declare const CodexV3GenerationReportResponseSchema: z.ZodObject<{
1722
- schemaVersion: z.ZodLiteral<3>;
1731
+ schemaVersion: z.ZodLiteral<4>;
1723
1732
  report: z.ZodObject<{
1724
1733
  id: z.ZodString;
1725
1734
  clientRequestId: z.ZodString;
@@ -1749,6 +1758,142 @@ export declare const CodexV3GenerationReportResponseSchema: z.ZodObject<{
1749
1758
  }, z.core.$strict>;
1750
1759
  replayed: z.ZodBoolean;
1751
1760
  }, z.core.$strict>;
1761
+ export declare const CodexTokenPoolV4IdempotencyKeySchema: z.ZodString;
1762
+ export declare const CodexTokenPoolV4AssignmentTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1763
+ mode: z.ZodLiteral<"UNBOUND_POOL">;
1764
+ }, z.core.$strict>, z.ZodObject<{
1765
+ mode: z.ZodLiteral<"DIRECTORY_PRINCIPAL">;
1766
+ principal: z.ZodString;
1767
+ }, z.core.$strict>, z.ZodObject<{
1768
+ mode: z.ZodLiteral<"SUBJECT">;
1769
+ userSubject: z.ZodString;
1770
+ }, z.core.$strict>], "mode">;
1771
+ export declare const CodexTokenPoolV4EnrollmentConfigurationSchema: z.ZodObject<{
1772
+ schemaVersion: z.ZodLiteral<4>;
1773
+ ingress: z.ZodObject<{
1774
+ envelopeVersion: z.ZodLiteral<1>;
1775
+ algorithm: z.ZodLiteral<"X25519-HKDF-SHA256-AES-256-GCM">;
1776
+ keyId: z.ZodString;
1777
+ publicKey: z.ZodString;
1778
+ maxRequestBytes: z.ZodNumber;
1779
+ maxCiphertextBytes: z.ZodNumber;
1780
+ }, z.core.$strict>;
1781
+ assignmentModes: z.ZodTuple<[z.ZodLiteral<"UNBOUND_POOL">, z.ZodLiteral<"DIRECTORY_PRINCIPAL">, z.ZodLiteral<"SUBJECT">], null>;
1782
+ }, z.core.$strict>;
1783
+ export declare const CodexTokenPoolV4DirectoryResolveResponseSchema: z.ZodObject<{
1784
+ schemaVersion: z.ZodLiteral<4>;
1785
+ user: z.ZodObject<{
1786
+ userSubject: z.ZodString;
1787
+ username: z.ZodString;
1788
+ email: z.ZodNullable<z.ZodEmail>;
1789
+ enabled: z.ZodLiteral<true>;
1790
+ }, z.core.$strict>;
1791
+ }, z.core.$strict>;
1792
+ export declare const CodexTokenPoolV4UploadInputSchema: z.ZodObject<{
1793
+ schemaVersion: z.ZodLiteral<4>;
1794
+ clientRequestId: z.ZodString;
1795
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
1796
+ mode: z.ZodLiteral<"UNBOUND_POOL">;
1797
+ }, z.core.$strict>, z.ZodObject<{
1798
+ mode: z.ZodLiteral<"DIRECTORY_PRINCIPAL">;
1799
+ principal: z.ZodString;
1800
+ }, z.core.$strict>, z.ZodObject<{
1801
+ mode: z.ZodLiteral<"SUBJECT">;
1802
+ userSubject: z.ZodString;
1803
+ }, z.core.$strict>], "mode">;
1804
+ envelope: z.ZodObject<{
1805
+ version: z.ZodLiteral<1>;
1806
+ algorithm: z.ZodLiteral<"X25519-HKDF-SHA256-AES-256-GCM">;
1807
+ keyId: z.ZodString;
1808
+ ephemeralPublicKey: z.ZodString;
1809
+ salt: z.ZodString;
1810
+ nonce: z.ZodString;
1811
+ ciphertext: z.ZodString;
1812
+ authenticationTag: z.ZodString;
1813
+ }, z.core.$strict>;
1814
+ }, z.core.$strict>;
1815
+ export declare const CodexTokenPoolV4UploadResponseTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1816
+ mode: z.ZodLiteral<"UNBOUND_POOL">;
1817
+ }, z.core.$strict>, z.ZodObject<{
1818
+ mode: z.ZodLiteral<"SUBJECT">;
1819
+ userSubject: z.ZodString;
1820
+ username: z.ZodString;
1821
+ userEmail: z.ZodNullable<z.ZodEmail>;
1822
+ }, z.core.$strict>], "mode">;
1823
+ export declare const CodexTokenPoolV4UploadSchema: z.ZodObject<{
1824
+ id: z.ZodString;
1825
+ clientRequestId: z.ZodString;
1826
+ status: z.ZodEnum<{
1827
+ NEEDS_REAUTH: "NEEDS_REAUTH";
1828
+ OUTCOME_AMBIGUOUS: "OUTCOME_AMBIGUOUS";
1829
+ POOLED: "POOLED";
1830
+ RESERVED: "RESERVED";
1831
+ TEMPORARILY_UNAVAILABLE: "TEMPORARILY_UNAVAILABLE";
1832
+ VALIDATING: "VALIDATING";
1833
+ }>;
1834
+ placement: z.ZodEnum<{
1835
+ FAILED: "FAILED";
1836
+ PENDING: "PENDING";
1837
+ RESERVED: "RESERVED";
1838
+ UNBOUND_POOL: "UNBOUND_POOL";
1839
+ }>;
1840
+ managedAccountId: z.ZodNullable<z.ZodString>;
1841
+ providerAccountId: z.ZodNullable<z.ZodString>;
1842
+ poolEntryId: z.ZodNullable<z.ZodString>;
1843
+ assignmentId: z.ZodNullable<z.ZodString>;
1844
+ assignedUserSubject: z.ZodNullable<z.ZodString>;
1845
+ reservedLineageId: z.ZodNullable<z.ZodString>;
1846
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
1847
+ mode: z.ZodLiteral<"UNBOUND_POOL">;
1848
+ }, z.core.$strict>, z.ZodObject<{
1849
+ mode: z.ZodLiteral<"SUBJECT">;
1850
+ userSubject: z.ZodString;
1851
+ username: z.ZodString;
1852
+ userEmail: z.ZodNullable<z.ZodEmail>;
1853
+ }, z.core.$strict>], "mode">;
1854
+ createdAt: z.ZodString;
1855
+ completedAt: z.ZodNullable<z.ZodString>;
1856
+ safeErrorCode: z.ZodNullable<z.ZodString>;
1857
+ }, z.core.$strict>;
1858
+ export declare const CodexTokenPoolV4UploadResponseSchema: z.ZodObject<{
1859
+ schemaVersion: z.ZodLiteral<4>;
1860
+ upload: z.ZodObject<{
1861
+ id: z.ZodString;
1862
+ clientRequestId: z.ZodString;
1863
+ status: z.ZodEnum<{
1864
+ NEEDS_REAUTH: "NEEDS_REAUTH";
1865
+ OUTCOME_AMBIGUOUS: "OUTCOME_AMBIGUOUS";
1866
+ POOLED: "POOLED";
1867
+ RESERVED: "RESERVED";
1868
+ TEMPORARILY_UNAVAILABLE: "TEMPORARILY_UNAVAILABLE";
1869
+ VALIDATING: "VALIDATING";
1870
+ }>;
1871
+ placement: z.ZodEnum<{
1872
+ FAILED: "FAILED";
1873
+ PENDING: "PENDING";
1874
+ RESERVED: "RESERVED";
1875
+ UNBOUND_POOL: "UNBOUND_POOL";
1876
+ }>;
1877
+ managedAccountId: z.ZodNullable<z.ZodString>;
1878
+ providerAccountId: z.ZodNullable<z.ZodString>;
1879
+ poolEntryId: z.ZodNullable<z.ZodString>;
1880
+ assignmentId: z.ZodNullable<z.ZodString>;
1881
+ assignedUserSubject: z.ZodNullable<z.ZodString>;
1882
+ reservedLineageId: z.ZodNullable<z.ZodString>;
1883
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
1884
+ mode: z.ZodLiteral<"UNBOUND_POOL">;
1885
+ }, z.core.$strict>, z.ZodObject<{
1886
+ mode: z.ZodLiteral<"SUBJECT">;
1887
+ userSubject: z.ZodString;
1888
+ username: z.ZodString;
1889
+ userEmail: z.ZodNullable<z.ZodEmail>;
1890
+ }, z.core.$strict>], "mode">;
1891
+ createdAt: z.ZodString;
1892
+ completedAt: z.ZodNullable<z.ZodString>;
1893
+ safeErrorCode: z.ZodNullable<z.ZodString>;
1894
+ }, z.core.$strict>;
1895
+ replayed: z.ZodBoolean;
1896
+ }, z.core.$strict>;
1752
1897
  export type CodexAccountSummary = z.infer<typeof CodexAccountSummarySchema>;
1753
1898
  export type CodexQuotaSnapshotView = z.infer<typeof CodexQuotaSnapshotViewSchema>;
1754
1899
  export type CodexAccountListResponse = z.infer<typeof CodexAccountListResponseSchema>;
@@ -1805,6 +1950,11 @@ export type CodexV3FullCredentialDeliveryAckResponse = z.infer<typeof CodexV3Ful
1805
1950
  export type CodexV3FullCredentialBundle = z.infer<typeof CodexV3FullCredentialBundleSchema>;
1806
1951
  export type CodexV3GenerationReportInput = z.infer<typeof CodexV3GenerationReportInputSchema>;
1807
1952
  export type CodexV3GenerationReportResponse = z.infer<typeof CodexV3GenerationReportResponseSchema>;
1953
+ export type CodexTokenPoolV4AssignmentTarget = z.infer<typeof CodexTokenPoolV4AssignmentTargetSchema>;
1954
+ export type CodexTokenPoolV4EnrollmentConfiguration = z.infer<typeof CodexTokenPoolV4EnrollmentConfigurationSchema>;
1955
+ export type CodexTokenPoolV4DirectoryResolveResponse = z.infer<typeof CodexTokenPoolV4DirectoryResolveResponseSchema>;
1956
+ export type CodexTokenPoolV4UploadInput = z.infer<typeof CodexTokenPoolV4UploadInputSchema>;
1957
+ export type CodexTokenPoolV4UploadResponse = z.infer<typeof CodexTokenPoolV4UploadResponseSchema>;
1808
1958
  export declare function codexAccountLoginCredentialsPath(accountId: string): string;
1809
1959
  export declare function codexAdminCredentialVersionsPath(accountId: string): string;
1810
1960
  export declare function codexAdminRefreshPath(accountId: string): string;
@@ -1825,3 +1975,5 @@ export declare function codexV3AssignmentFullCredentialDeliveryResolvePath(assig
1825
1975
  export declare function codexV3FullCredentialDeliveryAckPath(deliveryId: string): string;
1826
1976
  export declare function codexV3LineageGenerationReportsPath(lineageId: string): string;
1827
1977
  export declare function codexV3LineageGenerationReportResolvePath(lineageId: string, clientRequestId: string): string;
1978
+ export declare function codexTokenPoolV4DirectoryResolvePath(principal: string): string;
1979
+ export declare function codexTokenPoolV4UploadResolvePath(clientRequestId: string): string;
package/dist/protocol.js CHANGED
@@ -14,11 +14,20 @@ export const CODEX_ADMIN_MIGRATION_PLANS_PATH = "/v2/admin/codex/migration-plans
14
14
  export const CODEX_MANAGED_CREDENTIALS_V3_SCHEMA_VERSION = 3;
15
15
  // The configured service URL already includes the public `/api` prefix.
16
16
  export const CODEX_MANAGED_CREDENTIALS_V3_PATH = "/v3/codex";
17
- export const CODEX_V3_ENROLLMENT_CONFIGURATION_PATH = `${CODEX_MANAGED_CREDENTIALS_V3_PATH}/enrollment-configuration`;
17
+ export const CODEX_V3_ENROLLMENT_CONFIGURATION_PATH = "/v4/codex/enrollment-configuration";
18
18
  export const CODEX_V3_ENROLLMENTS_PATH = `${CODEX_MANAGED_CREDENTIALS_V3_PATH}/enrollments`;
19
- export const CODEX_V3_CREDENTIAL_ASSIGNMENTS_PATH = `${CODEX_MANAGED_CREDENTIALS_V3_PATH}/credential-assignments`;
20
- export const CODEX_V3_FULL_CREDENTIAL_DELIVERIES_PATH = `${CODEX_MANAGED_CREDENTIALS_V3_PATH}/full-credential-deliveries`;
21
- export const CODEX_V3_CREDENTIAL_LINEAGES_PATH = `${CODEX_MANAGED_CREDENTIALS_V3_PATH}/credential-lineages`;
19
+ export const CODEX_V3_CREDENTIAL_ASSIGNMENTS_PATH = "/v4/codex/credential-assignments";
20
+ export const CODEX_V3_FULL_CREDENTIAL_DELIVERIES_PATH = "/v4/codex/full-credential-deliveries";
21
+ export const CODEX_V3_CREDENTIAL_LINEAGES_PATH = "/v4/codex/credential-lineages";
22
+ export const CODEX_TOKEN_POOL_V4_SCHEMA_VERSION = 4;
23
+ export const CODEX_TOKEN_POOL_V4_PATH = "/v4/admin/codex";
24
+ export const CODEX_TOKEN_POOL_V4_ENROLLMENT_CONFIGURATION_PATH = `${CODEX_TOKEN_POOL_V4_PATH}/enrollment-configuration`;
25
+ export const CODEX_TOKEN_POOL_V4_DIRECTORY_RESOLVE_PATH = `${CODEX_TOKEN_POOL_V4_PATH}/directory-users/resolve`;
26
+ export const CODEX_TOKEN_POOL_V4_UPLOADS_PATH = `${CODEX_TOKEN_POOL_V4_PATH}/token-pool/uploads`;
27
+ export const CODEX_TOKEN_POOL_V4_RUNTIME_PATH = "/v4/codex";
28
+ export const CODEX_TOKEN_POOL_V4_CREDENTIAL_ASSIGNMENTS_PATH = `${CODEX_TOKEN_POOL_V4_RUNTIME_PATH}/credential-assignments`;
29
+ export const CODEX_TOKEN_POOL_V4_FULL_CREDENTIAL_DELIVERIES_PATH = `${CODEX_TOKEN_POOL_V4_RUNTIME_PATH}/full-credential-deliveries`;
30
+ export const CODEX_TOKEN_POOL_V4_CREDENTIAL_LINEAGES_PATH = `${CODEX_TOKEN_POOL_V4_RUNTIME_PATH}/credential-lineages`;
22
31
  export const CODEX_MIGRATION_CAPACITY = {
23
32
  verifiedMinimum: 2,
24
33
  verifiedLimit: null,
@@ -573,7 +582,7 @@ export const CodexV3CredentialIngressSchema = z.strictObject({
573
582
  });
574
583
  export const CodexV3CredentialEnvelopeSchema = CodexEnrollmentCandidateEnvelopeSchema;
575
584
  export const CodexV3EnrollmentConfigurationSchema = z.strictObject({
576
- schemaVersion: z.literal(CODEX_MANAGED_CREDENTIALS_V3_SCHEMA_VERSION),
585
+ schemaVersion: z.literal(CODEX_TOKEN_POOL_V4_SCHEMA_VERSION),
577
586
  ingress: CodexV3CredentialIngressSchema
578
587
  });
579
588
  export const CodexV3EnrollmentInputSchema = z.strictObject({
@@ -641,7 +650,7 @@ export const CodexV3CredentialAssignmentSchema = z.strictObject({
641
650
  deliveryEligible: z.boolean()
642
651
  });
643
652
  export const CodexV3CredentialAssignmentListResponseSchema = z.strictObject({
644
- schemaVersion: z.literal(CODEX_MANAGED_CREDENTIALS_V3_SCHEMA_VERSION),
653
+ schemaVersion: z.literal(CODEX_TOKEN_POOL_V4_SCHEMA_VERSION),
645
654
  items: z.array(CodexV3CredentialAssignmentSchema).max(256),
646
655
  total: z.number().int().min(0).max(256)
647
656
  }).superRefine((value, context) => {
@@ -650,7 +659,7 @@ export const CodexV3CredentialAssignmentListResponseSchema = z.strictObject({
650
659
  }
651
660
  });
652
661
  export const CodexV3FullCredentialDeliveryRequestSchema = z.strictObject({
653
- schemaVersion: z.literal(CODEX_MANAGED_CREDENTIALS_V3_SCHEMA_VERSION),
662
+ schemaVersion: z.literal(CODEX_TOKEN_POOL_V4_SCHEMA_VERSION),
654
663
  clientRequestId: CodexV3ClientRequestIdSchema,
655
664
  clientKey: CodexShortLivedDeliveryClientKeySchema
656
665
  });
@@ -673,7 +682,7 @@ const CodexV3FullCredentialDeliveryMetadataSchema = z.strictObject({
673
682
  ackedAt: CodexV3InstantSchema.nullable()
674
683
  });
675
684
  export const CodexV3FullCredentialDeliveryResponseSchema = z.strictObject({
676
- schemaVersion: z.literal(CODEX_MANAGED_CREDENTIALS_V3_SCHEMA_VERSION),
685
+ schemaVersion: z.literal(CODEX_TOKEN_POOL_V4_SCHEMA_VERSION),
677
686
  delivery: CodexV3FullCredentialDeliveryMetadataSchema.extend({
678
687
  status: z.literal("AWAITING_ACK"),
679
688
  authorityMode: z.literal("DELIVERY_PENDING"),
@@ -682,13 +691,13 @@ export const CodexV3FullCredentialDeliveryResponseSchema = z.strictObject({
682
691
  replayed: z.boolean()
683
692
  });
684
693
  export const CodexV3FullCredentialDeliveryAckInputSchema = z.strictObject({
685
- schemaVersion: z.literal(CODEX_MANAGED_CREDENTIALS_V3_SCHEMA_VERSION),
694
+ schemaVersion: z.literal(CODEX_TOKEN_POOL_V4_SCHEMA_VERSION),
686
695
  lineageId: CodexV3IdSchema,
687
696
  generationVersion: z.number().int().positive(),
688
697
  installed: z.literal(true)
689
698
  });
690
699
  export const CodexV3FullCredentialDeliveryAckResponseSchema = z.strictObject({
691
- schemaVersion: z.literal(CODEX_MANAGED_CREDENTIALS_V3_SCHEMA_VERSION),
700
+ schemaVersion: z.literal(CODEX_TOKEN_POOL_V4_SCHEMA_VERSION),
692
701
  delivery: CodexV3FullCredentialDeliveryMetadataSchema.extend({
693
702
  status: z.literal("ACKED"),
694
703
  authorityMode: z.literal("CLIENT_MANAGED"),
@@ -698,7 +707,7 @@ export const CodexV3FullCredentialDeliveryAckResponseSchema = z.strictObject({
698
707
  replayed: z.boolean()
699
708
  });
700
709
  export const CodexV3FullCredentialBundleSchema = z.strictObject({
701
- schemaVersion: z.literal(CODEX_MANAGED_CREDENTIALS_V3_SCHEMA_VERSION),
710
+ schemaVersion: z.literal(CODEX_TOKEN_POOL_V4_SCHEMA_VERSION),
702
711
  deliveryId: CodexV3IdSchema,
703
712
  managedAccountId: CodexV3IdSchema,
704
713
  providerAccountId: z.string().min(1).max(512),
@@ -710,7 +719,7 @@ export const CodexV3FullCredentialBundleSchema = z.strictObject({
710
719
  expiresAt: CodexV3InstantSchema
711
720
  });
712
721
  export const CodexV3GenerationReportInputSchema = z.strictObject({
713
- schemaVersion: z.literal(CODEX_MANAGED_CREDENTIALS_V3_SCHEMA_VERSION),
722
+ schemaVersion: z.literal(CODEX_TOKEN_POOL_V4_SCHEMA_VERSION),
714
723
  clientRequestId: CodexV3ClientRequestIdSchema,
715
724
  expectedGenerationVersion: z.number().int().positive(),
716
725
  rotationMode: z.enum(["ROTATED", "RETAINED"]),
@@ -720,7 +729,7 @@ export const CodexV3GenerationReportInputSchema = z.strictObject({
720
729
  observedAt: CodexV3InstantSchema
721
730
  });
722
731
  export const CodexV3GenerationReportResponseSchema = z.strictObject({
723
- schemaVersion: z.literal(CODEX_MANAGED_CREDENTIALS_V3_SCHEMA_VERSION),
732
+ schemaVersion: z.literal(CODEX_TOKEN_POOL_V4_SCHEMA_VERSION),
724
733
  report: z.strictObject({
725
734
  id: CodexV3IdSchema,
726
735
  clientRequestId: CodexV3ClientRequestIdSchema,
@@ -742,6 +751,95 @@ export const CodexV3GenerationReportResponseSchema = z.strictObject({
742
751
  context.addIssue({ code: "custom", path: ["report", "generationVersion"], message: "Generation did not advance exactly once." });
743
752
  }
744
753
  });
754
+ const CodexTokenPoolV4PrincipalSchema = z.string().min(1).max(255)
755
+ .refine((value) => value === value.trim(), "Principal must be canonical.")
756
+ .refine((value) => !/[\s\u0000-\u001f\u007f]/u.test(value), "Principal contains unsafe characters.");
757
+ export const CodexTokenPoolV4IdempotencyKeySchema = z.string().min(8).max(255)
758
+ .refine((value) => value === value.trim(), "Idempotency key must be canonical.");
759
+ export const CodexTokenPoolV4AssignmentTargetSchema = z.discriminatedUnion("mode", [
760
+ z.strictObject({ mode: z.literal("UNBOUND_POOL") }),
761
+ z.strictObject({ mode: z.literal("DIRECTORY_PRINCIPAL"), principal: CodexTokenPoolV4PrincipalSchema }),
762
+ z.strictObject({ mode: z.literal("SUBJECT"), userSubject: CodexV3IdSchema })
763
+ ]);
764
+ export const CodexTokenPoolV4EnrollmentConfigurationSchema = z.strictObject({
765
+ schemaVersion: z.literal(CODEX_TOKEN_POOL_V4_SCHEMA_VERSION),
766
+ ingress: CodexV3CredentialIngressSchema,
767
+ assignmentModes: z.tuple([
768
+ z.literal("UNBOUND_POOL"),
769
+ z.literal("DIRECTORY_PRINCIPAL"),
770
+ z.literal("SUBJECT")
771
+ ])
772
+ });
773
+ export const CodexTokenPoolV4DirectoryResolveResponseSchema = z.strictObject({
774
+ schemaVersion: z.literal(CODEX_TOKEN_POOL_V4_SCHEMA_VERSION),
775
+ user: z.strictObject({
776
+ userSubject: CodexV3IdSchema,
777
+ username: z.string().min(1).max(255).refine((value) => value === value.trim()),
778
+ email: z.email().nullable(),
779
+ enabled: z.literal(true)
780
+ })
781
+ });
782
+ export const CodexTokenPoolV4UploadInputSchema = z.strictObject({
783
+ schemaVersion: z.literal(CODEX_TOKEN_POOL_V4_SCHEMA_VERSION),
784
+ clientRequestId: CodexV3ClientRequestIdSchema,
785
+ target: CodexTokenPoolV4AssignmentTargetSchema,
786
+ envelope: CodexV3CredentialEnvelopeSchema
787
+ });
788
+ export const CodexTokenPoolV4UploadResponseTargetSchema = z.discriminatedUnion("mode", [
789
+ z.strictObject({ mode: z.literal("UNBOUND_POOL") }),
790
+ z.strictObject({
791
+ mode: z.literal("SUBJECT"),
792
+ userSubject: CodexV3IdSchema,
793
+ username: z.string().min(1).max(255).refine((value) => value === value.trim()),
794
+ userEmail: z.email().nullable()
795
+ })
796
+ ]);
797
+ export const CodexTokenPoolV4UploadSchema = z.strictObject({
798
+ id: CodexV3IdSchema,
799
+ clientRequestId: CodexV3ClientRequestIdSchema,
800
+ status: z.enum([
801
+ "VALIDATING",
802
+ "POOLED",
803
+ "RESERVED",
804
+ "TEMPORARILY_UNAVAILABLE",
805
+ "NEEDS_REAUTH",
806
+ "OUTCOME_AMBIGUOUS"
807
+ ]),
808
+ placement: z.enum(["PENDING", "UNBOUND_POOL", "RESERVED", "FAILED"]),
809
+ managedAccountId: CodexV3IdSchema.nullable(),
810
+ providerAccountId: CodexV3IdSchema.nullable(),
811
+ poolEntryId: CodexV3IdSchema.nullable(),
812
+ assignmentId: CodexV3IdSchema.nullable(),
813
+ assignedUserSubject: CodexV3IdSchema.nullable(),
814
+ reservedLineageId: CodexV3IdSchema.nullable(),
815
+ target: CodexTokenPoolV4UploadResponseTargetSchema,
816
+ createdAt: CodexV3InstantSchema,
817
+ completedAt: CodexV3InstantSchema.nullable(),
818
+ safeErrorCode: CodexV3IdSchema.nullable()
819
+ }).superRefine((value, context) => {
820
+ const outcome = [value.managedAccountId, value.providerAccountId, value.poolEntryId];
821
+ const reservation = [value.assignmentId, value.assignedUserSubject, value.reservedLineageId];
822
+ const failure = ["TEMPORARILY_UNAVAILABLE", "NEEDS_REAUTH", "OUTCOME_AMBIGUOUS"].includes(value.status);
823
+ const invalid = value.status === "VALIDATING"
824
+ ? value.placement !== "PENDING" || [...outcome, ...reservation].some((item) => item != null)
825
+ || value.completedAt != null || value.safeErrorCode != null
826
+ : value.status === "POOLED"
827
+ ? value.placement !== "UNBOUND_POOL" || outcome.some((item) => item == null)
828
+ || reservation.some((item) => item != null) || value.completedAt == null
829
+ || value.safeErrorCode != null || value.target.mode !== "UNBOUND_POOL"
830
+ : value.status === "RESERVED"
831
+ ? value.placement !== "RESERVED" || [...outcome, ...reservation].some((item) => item == null)
832
+ || value.completedAt == null || value.safeErrorCode != null || value.target.mode !== "SUBJECT"
833
+ : !failure || value.placement !== "FAILED" || [...outcome, ...reservation].some((item) => item != null)
834
+ || value.completedAt == null || value.safeErrorCode == null;
835
+ if (invalid)
836
+ context.addIssue({ code: "custom", message: "Token pool upload evidence is inconsistent." });
837
+ });
838
+ export const CodexTokenPoolV4UploadResponseSchema = z.strictObject({
839
+ schemaVersion: z.literal(CODEX_TOKEN_POOL_V4_SCHEMA_VERSION),
840
+ upload: CodexTokenPoolV4UploadSchema,
841
+ replayed: z.boolean()
842
+ });
745
843
  export function codexAccountLoginCredentialsPath(accountId) {
746
844
  return `${CODEX_ACCOUNTS_PATH}/${encodeURIComponent(accountId)}/login-credentials`;
747
845
  }
@@ -797,4 +895,10 @@ export function codexV3LineageGenerationReportResolvePath(lineageId, clientReque
797
895
  return `${CODEX_V3_CREDENTIAL_LINEAGES_PATH}/${encodeURIComponent(lineageId)}`
798
896
  + `/generations/resolve?clientRequestId=${encodeURIComponent(clientRequestId)}`;
799
897
  }
898
+ export function codexTokenPoolV4DirectoryResolvePath(principal) {
899
+ return `${CODEX_TOKEN_POOL_V4_DIRECTORY_RESOLVE_PATH}?principal=${encodeURIComponent(principal)}`;
900
+ }
901
+ export function codexTokenPoolV4UploadResolvePath(clientRequestId) {
902
+ return `${CODEX_TOKEN_POOL_V4_UPLOADS_PATH}/resolve?clientRequestId=${encodeURIComponent(clientRequestId)}`;
903
+ }
800
904
  //# sourceMappingURL=protocol.js.map