contracts.ts 791 B

123456789101112131415161718192021222324252627
  1. export const MCODE_OAUTH_CLIENT_ID = 'mcode-public' as const;
  2. export const MCODE_OAUTH_SCOPES = ['agent.default'] as const;
  3. export const MCODE_OAUTH_AUDIENCE = 'agent-backend' as const;
  4. export type AuthBuildEnv = 'dev' | 'test' | 'staging' | 'prod';
  5. export type AuthRegion = 'cn' | 'en';
  6. export interface AuthNamespaceInput {
  7. dataDir: string;
  8. buildEnv: AuthBuildEnv;
  9. region: AuthRegion;
  10. }
  11. export interface AccessTokenLease {
  12. accessToken: string;
  13. /** Stable across refresh, replaced by every interactive login. Absent on legacy credentials. */
  14. loginEpoch?: string;
  15. expiresAtMs: number;
  16. generation: number;
  17. scopes: typeof MCODE_OAUTH_SCOPES;
  18. audience: typeof MCODE_OAUTH_AUDIENCE;
  19. }
  20. export interface UnauthorizedContext {
  21. generation: number;
  22. loginEpoch?: string;
  23. }