@juspay/neurolink 12.7.1 → 12.7.3

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.
@@ -234,7 +234,7 @@ function publishCodexHeaders(ctx, account, attempt, quota) {
234
234
  }
235
235
  }
236
236
  /** Core pooled handler for POST /backend-api/codex/responses. */
237
- async function handleCodexResponsesRequest(ctx) {
237
+ export async function handleCodexResponsesRequest(ctx) {
238
238
  const requestStartTime = Date.now();
239
239
  const body = ctx.body ?? {};
240
240
  const bodyStr = JSON.stringify(body);
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Shared internal types for the Anthropic-compatible proxy route.
3
+ */
4
+ /** A deterministic upstream validation failure that must reach the caller. */
5
+ export type AnthropicInvalidRequestFailure = {
6
+ status: number;
7
+ body: string;
8
+ contentType?: string;
9
+ };
10
+ /** A credential failure deferred until peer and provider fallbacks are tried. */
11
+ export type DeferredClaudeAccountFailure = {
12
+ status: number;
13
+ message: string;
14
+ errorType: string;
15
+ responseHeaders?: Record<string, string>;
16
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Shared internal types for the Anthropic-compatible proxy route.
3
+ */
4
+ export {};
@@ -11,7 +11,7 @@
11
11
  * stored through the same AccountQuota shape as Anthropic — its primary window
12
12
  * maps onto the session fields and its secondary window onto the weekly fields.
13
13
  */
14
- import type { AccountCoolingReason, AccountQuota } from "./proxy.js";
14
+ import type { AccountCoolingReason, AccountQuota, InternalResult } from "./proxy.js";
15
15
  /** Token block inside `~/.codex/auth.json`. */
16
16
  export type CodexAuthFileTokens = {
17
17
  id_token?: string;
@@ -93,3 +93,64 @@ export type CodexRuntimeAccount = {
93
93
  * spent record — nothing else ever reaps it. */
94
94
  expiredCooldownUntil?: number;
95
95
  };
96
+ /** Provider-qualified account identity used by proxy status rendering. */
97
+ export type CodexProxyStatusAccountIdentity = {
98
+ provider: "anthropic";
99
+ key: string;
100
+ } | {
101
+ provider: "codex";
102
+ key: string;
103
+ } | {
104
+ provider: "other";
105
+ key: null;
106
+ };
107
+ /** A text or image content part accepted by the Codex Responses backend. */
108
+ export type CodexContentPart = {
109
+ type: "input_text";
110
+ text: string;
111
+ } | {
112
+ type: "output_text";
113
+ text: string;
114
+ } | {
115
+ type: "input_image";
116
+ image_url: string;
117
+ };
118
+ /** A single item in a Codex Responses request. */
119
+ export type CodexResponsesInputItem = {
120
+ role: "user" | "assistant";
121
+ content: CodexContentPart[];
122
+ } | {
123
+ type: "function_call";
124
+ call_id: string;
125
+ name: string;
126
+ arguments: string;
127
+ } | {
128
+ type: "function_call_output";
129
+ call_id: string;
130
+ output: string;
131
+ };
132
+ /** Request shape used to bridge Anthropic Messages traffic to Codex Responses. */
133
+ export type CodexResponsesRequest = {
134
+ model: string;
135
+ input: CodexResponsesInputItem[];
136
+ stream: true;
137
+ store: false;
138
+ instructions?: string;
139
+ tools?: Array<{
140
+ type: "function";
141
+ name: string;
142
+ description?: string;
143
+ parameters: Record<string, unknown>;
144
+ }>;
145
+ tool_choice?: "auto" | "required" | "none" | {
146
+ type: "function";
147
+ name: string;
148
+ };
149
+ };
150
+ /** Fully buffered Codex result rendered back as an Anthropic response. */
151
+ export type CodexFallbackResult = {
152
+ text: string;
153
+ toolCalls: NonNullable<InternalResult["toolCalls"]>;
154
+ usage?: NonNullable<InternalResult["usage"]>;
155
+ finishReason: "end_turn" | "tool_use";
156
+ };
@@ -10,6 +10,7 @@ export * from "./artifact.js";
10
10
  export * from "./auth.js";
11
11
  export * from "./autoresearch.js";
12
12
  export * from "./circuitBreakerErrors.js";
13
+ export * from "./claudeProxy.js";
13
14
  export * from "./cli.js";
14
15
  export * from "./client.js";
15
16
  export * from "./codex.js";
@@ -11,6 +11,7 @@ export * from "./artifact.js";
11
11
  export * from "./auth.js";
12
12
  export * from "./autoresearch.js";
13
13
  export * from "./circuitBreakerErrors.js";
14
+ export * from "./claudeProxy.js";
14
15
  export * from "./cli.js";
15
16
  export * from "./client.js";
16
17
  export * from "./codex.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "12.7.1",
3
+ "version": "12.7.3",
4
4
  "packageManager": "pnpm@10.15.1",
5
5
  "description": "TypeScript AI SDK with 24+ LLM providers behind one consistent API. MCP-native (connect any MCP server), voice TTS/STT/realtime, RAG, agents, memory, context compaction. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · DeepSeek · NVIDIA NIM and more.",
6
6
  "author": {