@gajae-code/ai 0.15.5 → 0.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 (88) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/types/adapter-internals/aws-region.d.ts +7 -0
  3. package/dist/types/auth-broker/client.d.ts +6 -2
  4. package/dist/types/auth-broker/remote-store.d.ts +14 -2
  5. package/dist/types/auth-broker/types.d.ts +6 -0
  6. package/dist/types/auth-broker/wire-schemas.d.ts +19 -0
  7. package/dist/types/auth-gateway/server.d.ts +39 -5
  8. package/dist/types/auth-gateway/types.d.ts +16 -2
  9. package/dist/types/auth-storage.d.ts +92 -24
  10. package/dist/types/core.d.ts +1 -0
  11. package/dist/types/index.d.ts +1 -0
  12. package/dist/types/provider-models/openai-compat.d.ts +1 -0
  13. package/dist/types/providers/anthropic.d.ts +1 -1
  14. package/dist/types/providers/google-gemini-headers.d.ts +1 -1
  15. package/dist/types/providers/openai-codex-responses.d.ts +6 -0
  16. package/dist/types/providers/register-builtins.d.ts +12 -12
  17. package/dist/types/stream.d.ts +2 -1
  18. package/dist/types/types.d.ts +22 -2
  19. package/dist/types/utils/oauth/api-key-login.d.ts +4 -1
  20. package/dist/types/utils/oauth/api-key-validation.d.ts +12 -6
  21. package/dist/types/utils/oauth/commandcode.d.ts +1 -0
  22. package/dist/types/utils/oauth/types.d.ts +1 -1
  23. package/dist/types/utils/retry.d.ts +2 -0
  24. package/dist/types/utils/schema/normalize.d.ts +0 -5
  25. package/dist/types/utils/sqlite-errors.d.ts +4 -0
  26. package/package.json +3 -3
  27. package/src/adapter-internals/aws-region.d.ts +7 -0
  28. package/src/adapter-internals/aws-region.ts +14 -0
  29. package/src/auth-broker/client.ts +41 -13
  30. package/src/auth-broker/redact.ts +25 -1
  31. package/src/auth-broker/remote-store.ts +374 -115
  32. package/src/auth-broker/server.ts +131 -91
  33. package/src/auth-broker/types.ts +6 -0
  34. package/src/auth-broker/wire-schemas.ts +6 -0
  35. package/src/auth-gateway/server.ts +447 -79
  36. package/src/auth-gateway/types.ts +28 -2
  37. package/src/auth-storage.ts +672 -168
  38. package/src/cli.ts +1 -0
  39. package/src/core.ts +1 -0
  40. package/src/index.ts +1 -0
  41. package/src/model-thinking.ts +8 -0
  42. package/src/models.json +1224 -3
  43. package/src/provider-models/descriptors.ts +3 -1
  44. package/src/provider-models/openai-compat.ts +102 -1
  45. package/src/providers/amazon-bedrock.ts +5 -1
  46. package/src/providers/anthropic.d.ts +1 -1
  47. package/src/providers/anthropic.ts +8 -2
  48. package/src/providers/aws-credentials.ts +6 -0
  49. package/src/providers/azure-openai-responses.ts +4 -1
  50. package/src/providers/cursor.ts +256 -101
  51. package/src/providers/gitlab-duo.ts +18 -1
  52. package/src/providers/google-gemini-cli.ts +3 -0
  53. package/src/providers/google-gemini-headers.d.ts +1 -1
  54. package/src/providers/google-gemini-headers.ts +1 -1
  55. package/src/providers/google-shared.ts +3 -0
  56. package/src/providers/kiro-api-key.ts +33 -8
  57. package/src/providers/kiro-codewhisperer.ts +28 -9
  58. package/src/providers/ollama.ts +3 -0
  59. package/src/providers/openai-codex-responses.d.ts +6 -0
  60. package/src/providers/openai-codex-responses.ts +37 -8
  61. package/src/providers/openai-completions.ts +11 -1
  62. package/src/providers/openai-responses.ts +10 -1
  63. package/src/providers/pi-native-client.ts +25 -1
  64. package/src/providers/pi-native-server.ts +24 -0
  65. package/src/providers/register-builtins.d.ts +12 -12
  66. package/src/providers/register-builtins.ts +16 -3
  67. package/src/stream.d.ts +2 -1
  68. package/src/stream.ts +175 -67
  69. package/src/types.d.ts +22 -2
  70. package/src/types.ts +27 -1
  71. package/src/utils/oauth/api-key-login.ts +13 -2
  72. package/src/utils/oauth/api-key-validation.ts +242 -41
  73. package/src/utils/oauth/commandcode.ts +17 -0
  74. package/src/utils/oauth/index.ts +20 -5
  75. package/src/utils/oauth/kiro.ts +91 -22
  76. package/src/utils/oauth/types.d.ts +1 -1
  77. package/src/utils/oauth/types.ts +1 -0
  78. package/src/utils/retry.d.ts +2 -0
  79. package/src/utils/retry.ts +15 -2
  80. package/src/utils/schema/dereference.ts +169 -49
  81. package/src/utils/schema/draft.ts +46 -23
  82. package/src/utils/schema/normalize.d.ts +0 -5
  83. package/src/utils/schema/normalize.ts +396 -119
  84. package/src/utils/schema/types.ts +3 -1
  85. package/src/utils/schema/zod-decontaminate.ts +83 -29
  86. package/src/utils/sqlite-errors.d.ts +4 -0
  87. package/src/utils/sqlite-errors.ts +13 -0
  88. package/src/utils/tool-choice-capability.ts +2 -3
@@ -1,12 +1,21 @@
1
1
  import type { Effort } from "../model-thinking";
2
- import type { AssistantMessage, AssistantMessageEventStream, CacheRetention, Context, ServiceTier } from "../types";
2
+ import type {
3
+ Api,
4
+ AssistantMessage,
5
+ AssistantMessageEventStream,
6
+ CacheRetention,
7
+ Context,
8
+ Provider,
9
+ ServiceTier,
10
+ } from "../types";
3
11
 
4
12
  /**
5
13
  * Wire types for the gjc auth-gateway.
6
14
  *
7
15
  * The gateway sits between unauthenticated clients (containerized gjc,
8
16
  * llm-git, …) and the broker. It accepts provider-format HTTP requests
9
- * (OpenAI chat-completions / Anthropic messages / OpenAI Responses),
17
+ * (OpenAI chat-completions / Anthropic messages / OpenAI Responses) within
18
+ * one explicit provider scope,
10
19
  * dispatches them through pi-ai's `streamSimple()`, and translates the
11
20
  * canonical event stream back to the matching wire format. The gateway
12
21
  * injects `Authorization` server-side so clients never see access tokens.
@@ -15,6 +24,21 @@ import type { AssistantMessage, AssistantMessageEventStream, CacheRetention, Con
15
24
  /** Default bind. Loopback-only — front with reverse proxy for remote access. */
16
25
  export const DEFAULT_AUTH_GATEWAY_BIND = "127.0.0.1:4000";
17
26
 
27
+ /**
28
+ * Provider APIs whose gateway identity is part of the provider contract.
29
+ *
30
+ * OpenAI Codex is backed by the Codex OAuth authority and must never be
31
+ * projected as a generic OpenAI Responses model. Other providers may expose
32
+ * more than one API and therefore remain catalog-defined.
33
+ */
34
+ export const AUTH_GATEWAY_PROVIDER_APIS: Readonly<Record<string, Api>> = {
35
+ "openai-codex": "openai-codex-responses",
36
+ };
37
+
38
+ export interface AuthGatewayProviderScope {
39
+ provider: Provider;
40
+ }
41
+
18
42
  export type AuthGatewayToolChoice = "auto" | "none" | "required" | { name: string };
19
43
 
20
44
  export interface AuthGatewayParsedRequestOptions {
@@ -120,6 +144,8 @@ export interface AuthGatewayFormatModule {
120
144
  export interface AuthGatewayServerOptions {
121
145
  /** Listen address. Default `127.0.0.1:4000`. */
122
146
  bind?: string;
147
+ /** Required provider scope. An unscoped gateway is not supported. */
148
+ providerScope: AuthGatewayProviderScope;
123
149
  /** Accept any of these bearer tokens. Empty allows unauthenticated calls. */
124
150
  bearerTokens: string[];
125
151
  /** Version surfaced on `/healthz`. */