@rynfar/meridian 1.23.0 → 1.23.1
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.
|
@@ -6964,11 +6964,21 @@ function classifyError(errMsg) {
|
|
|
6964
6964
|
if (lower.includes("exited with code") || lower.includes("process exited")) {
|
|
6965
6965
|
const codeMatch = errMsg.match(/exited with code (\d+)/);
|
|
6966
6966
|
const code = codeMatch ? codeMatch[1] : "unknown";
|
|
6967
|
+
const hasStderr = lower.includes("subprocess stderr:");
|
|
6968
|
+
const stderrContent = hasStderr ? lower.split("subprocess stderr:")[1]?.trim() ?? "" : "";
|
|
6969
|
+
if (stderrContent.includes("authentication") || stderrContent.includes("401") || stderrContent.includes("oauth")) {
|
|
6970
|
+
return {
|
|
6971
|
+
status: 401,
|
|
6972
|
+
type: "authentication_error",
|
|
6973
|
+
message: "Claude authentication expired or invalid. Run 'claude login' in your terminal to re-authenticate, then restart the proxy."
|
|
6974
|
+
};
|
|
6975
|
+
}
|
|
6967
6976
|
if (code === "1" && !lower.includes("tool") && !lower.includes("mcp")) {
|
|
6977
|
+
const stderrHint = stderrContent ? ` Subprocess output: ${stderrContent.slice(0, 200)}` : " Run with CLAUDE_PROXY_DEBUG=1 for more detail.";
|
|
6968
6978
|
return {
|
|
6969
6979
|
status: 401,
|
|
6970
6980
|
type: "authentication_error",
|
|
6971
|
-
message:
|
|
6981
|
+
message: `Claude Code process exited (code 1). This is often an authentication issue — try 'claude login' and restart the proxy.${stderrHint}`
|
|
6972
6982
|
};
|
|
6973
6983
|
}
|
|
6974
6984
|
return {
|
|
@@ -13358,7 +13368,8 @@ function buildQueryOptions(ctx) {
|
|
|
13358
13368
|
isUndo,
|
|
13359
13369
|
undoRollbackUuid,
|
|
13360
13370
|
sdkHooks,
|
|
13361
|
-
adapter
|
|
13371
|
+
adapter,
|
|
13372
|
+
onStderr
|
|
13362
13373
|
} = ctx;
|
|
13363
13374
|
const blockedTools = [...adapter.getBlockedBuiltinTools(), ...adapter.getAgentIncompatibleTools()];
|
|
13364
13375
|
const mcpServerName = adapter.getMcpServerName();
|
|
@@ -13388,6 +13399,7 @@ function buildQueryOptions(ctx) {
|
|
|
13388
13399
|
mcpServers: { [mcpServerName]: createOpencodeMcpServer() }
|
|
13389
13400
|
},
|
|
13390
13401
|
plugins: [],
|
|
13402
|
+
...onStderr ? { stderr: onStderr } : {},
|
|
13391
13403
|
env: {
|
|
13392
13404
|
...cleanEnv,
|
|
13393
13405
|
ENABLE_TOOL_SEARCH: "false",
|
|
@@ -14215,6 +14227,11 @@ function createProxyServer(config = {}) {
|
|
|
14215
14227
|
...adapter.buildSdkHooks?.(body, sdkAgents) ?? {},
|
|
14216
14228
|
...fileChangeHook ? { PostToolUse: [fileChangeHook] } : {}
|
|
14217
14229
|
};
|
|
14230
|
+
const stderrLines = [];
|
|
14231
|
+
const onStderr = (data) => {
|
|
14232
|
+
stderrLines.push(data.trimEnd());
|
|
14233
|
+
claudeLog("subprocess.stderr", { line: data.trimEnd() });
|
|
14234
|
+
};
|
|
14218
14235
|
if (!stream2) {
|
|
14219
14236
|
const contentBlocks = [];
|
|
14220
14237
|
let assistantMessages = 0;
|
|
@@ -14251,7 +14268,8 @@ function createProxyServer(config = {}) {
|
|
|
14251
14268
|
isUndo,
|
|
14252
14269
|
undoRollbackUuid,
|
|
14253
14270
|
sdkHooks,
|
|
14254
|
-
adapter
|
|
14271
|
+
adapter,
|
|
14272
|
+
onStderr
|
|
14255
14273
|
}))) {
|
|
14256
14274
|
if (event.type === "assistant") {
|
|
14257
14275
|
didYieldContent = true;
|
|
@@ -14289,7 +14307,8 @@ function createProxyServer(config = {}) {
|
|
|
14289
14307
|
isUndo: false,
|
|
14290
14308
|
undoRollbackUuid: undefined,
|
|
14291
14309
|
sdkHooks,
|
|
14292
|
-
adapter
|
|
14310
|
+
adapter,
|
|
14311
|
+
onStderr
|
|
14293
14312
|
}));
|
|
14294
14313
|
return;
|
|
14295
14314
|
}
|
|
@@ -14358,11 +14377,18 @@ function createProxyServer(config = {}) {
|
|
|
14358
14377
|
durationMs: Date.now() - upstreamStartAt
|
|
14359
14378
|
});
|
|
14360
14379
|
} catch (error) {
|
|
14380
|
+
const stderrOutput = stderrLines.join(`
|
|
14381
|
+
`).trim();
|
|
14382
|
+
if (stderrOutput && error instanceof Error && !error.message.includes(stderrOutput)) {
|
|
14383
|
+
error.message = `${error.message}
|
|
14384
|
+
Subprocess stderr: ${stderrOutput}`;
|
|
14385
|
+
}
|
|
14361
14386
|
claudeLog("upstream.failed", {
|
|
14362
14387
|
mode: "non_stream",
|
|
14363
14388
|
model,
|
|
14364
14389
|
durationMs: Date.now() - upstreamStartAt,
|
|
14365
|
-
error: error instanceof Error ? error.message : String(error)
|
|
14390
|
+
error: error instanceof Error ? error.message : String(error),
|
|
14391
|
+
...stderrOutput ? { stderr: stderrOutput } : {}
|
|
14366
14392
|
});
|
|
14367
14393
|
throw error;
|
|
14368
14394
|
}
|
|
@@ -14512,7 +14538,8 @@ function createProxyServer(config = {}) {
|
|
|
14512
14538
|
isUndo,
|
|
14513
14539
|
undoRollbackUuid,
|
|
14514
14540
|
sdkHooks,
|
|
14515
|
-
adapter
|
|
14541
|
+
adapter,
|
|
14542
|
+
onStderr
|
|
14516
14543
|
}))) {
|
|
14517
14544
|
if (event.type === "stream_event") {
|
|
14518
14545
|
didYieldClientEvent = true;
|
|
@@ -14550,7 +14577,8 @@ function createProxyServer(config = {}) {
|
|
|
14550
14577
|
isUndo: false,
|
|
14551
14578
|
undoRollbackUuid: undefined,
|
|
14552
14579
|
sdkHooks,
|
|
14553
|
-
adapter
|
|
14580
|
+
adapter,
|
|
14581
|
+
onStderr
|
|
14554
14582
|
}));
|
|
14555
14583
|
return;
|
|
14556
14584
|
}
|
|
@@ -14857,6 +14885,12 @@ data: {"type":"message_stop"}
|
|
|
14857
14885
|
});
|
|
14858
14886
|
return;
|
|
14859
14887
|
}
|
|
14888
|
+
const stderrOutput = stderrLines.join(`
|
|
14889
|
+
`).trim();
|
|
14890
|
+
if (stderrOutput && error instanceof Error && !error.message.includes(stderrOutput)) {
|
|
14891
|
+
error.message = `${error.message}
|
|
14892
|
+
Subprocess stderr: ${stderrOutput}`;
|
|
14893
|
+
}
|
|
14860
14894
|
const errMsg = error instanceof Error ? error.message : String(error);
|
|
14861
14895
|
claudeLog("upstream.failed", {
|
|
14862
14896
|
mode: "stream",
|
|
@@ -14864,7 +14898,8 @@ data: {"type":"message_stop"}
|
|
|
14864
14898
|
durationMs: Date.now() - upstreamStartAt,
|
|
14865
14899
|
streamEventsSeen,
|
|
14866
14900
|
textEventsForwarded,
|
|
14867
|
-
error: errMsg
|
|
14901
|
+
error: errMsg,
|
|
14902
|
+
...stderrOutput ? { stderr: stderrOutput } : {}
|
|
14868
14903
|
});
|
|
14869
14904
|
const streamErr = classifyError(errMsg);
|
|
14870
14905
|
claudeLog("proxy.anthropic.error", { error: errMsg, classified: streamErr.type });
|
package/dist/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/proxy/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/proxy/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAmG7D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAG3D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAGxD"}
|
package/dist/proxy/query.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ export interface QueryContext {
|
|
|
37
37
|
sdkHooks?: any;
|
|
38
38
|
/** The agent adapter providing tool configuration */
|
|
39
39
|
adapter: AgentAdapter;
|
|
40
|
+
/** Callback to receive stderr lines from the Claude subprocess */
|
|
41
|
+
onStderr?: (line: string) => void;
|
|
40
42
|
}
|
|
41
43
|
/**
|
|
42
44
|
* Build the options object for the Claude Agent SDK query() call.
|
|
@@ -51,11 +53,12 @@ export declare function buildQueryOptions(ctx: QueryContext): {
|
|
|
51
53
|
forkSession?: boolean | undefined;
|
|
52
54
|
resume?: string | undefined;
|
|
53
55
|
agents?: Record<string, any> | undefined;
|
|
54
|
-
plugins: never[];
|
|
55
56
|
env: {
|
|
56
57
|
ENABLE_CLAUDEAI_MCP_SERVERS?: string | undefined;
|
|
57
58
|
ENABLE_TOOL_SEARCH: string;
|
|
58
59
|
};
|
|
60
|
+
stderr?: ((line: string) => void) | undefined;
|
|
61
|
+
plugins: never[];
|
|
59
62
|
allowedTools?: string[] | undefined;
|
|
60
63
|
mcpServers?: {
|
|
61
64
|
oc: import("@anthropic-ai/claude-agent-sdk").McpSdkServerConfigWithInstance;
|
|
@@ -79,11 +82,12 @@ export declare function buildQueryOptions(ctx: QueryContext): {
|
|
|
79
82
|
forkSession?: boolean | undefined;
|
|
80
83
|
resume?: string | undefined;
|
|
81
84
|
agents?: Record<string, any> | undefined;
|
|
82
|
-
plugins: never[];
|
|
83
85
|
env: {
|
|
84
86
|
ENABLE_CLAUDEAI_MCP_SERVERS?: string | undefined;
|
|
85
87
|
ENABLE_TOOL_SEARCH: string;
|
|
86
88
|
};
|
|
89
|
+
stderr?: ((line: string) => void) | undefined;
|
|
90
|
+
plugins: never[];
|
|
87
91
|
disallowedTools: string[];
|
|
88
92
|
allowedTools: string[];
|
|
89
93
|
mcpServers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/proxy/query.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C,OAAO,EAAE,0BAA0B,EAAwB,MAAM,oBAAoB,CAAA;AAErF,MAAM,WAAW,YAAY;IAC3B,iEAAiE;IACjE,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;IACnC,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,+BAA+B;IAC/B,gBAAgB,EAAE,MAAM,CAAA;IACxB,yCAAyC;IACzC,aAAa,EAAE,MAAM,CAAA;IACrB,gCAAgC;IAChC,gBAAgB,EAAE,MAAM,CAAA;IACxB,0CAA0C;IAC1C,WAAW,EAAE,OAAO,CAAA;IACpB,0CAA0C;IAC1C,MAAM,EAAE,OAAO,CAAA;IACf,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9B,mEAAmE;IACnE,cAAc,CAAC,EAAE,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAA;IAC9D,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IAC5C,0DAA0D;IAC1D,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,wCAAwC;IACxC,MAAM,EAAE,OAAO,CAAA;IACf,8CAA8C;IAC9C,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,GAAG,CAAA;IACd,qDAAqD;IACrD,OAAO,EAAE,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/proxy/query.ts"],"names":[],"mappings":"AAA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;;;;;;;;;;;;;;;;;;;EAiElC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/proxy/server.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACtE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,CAAA;AAiBvD,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EACpB,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAA+B,iBAAiB,EAAE,mBAAmB,EAAgB,MAAM,iBAAiB,CAAA;AAEnH,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA;AACjD,YAAY,EAAE,aAAa,EAAE,CAAA;AAyF7B,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/proxy/server.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACtE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,CAAA;AAiBvD,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EACpB,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAA+B,iBAAiB,EAAE,mBAAmB,EAAgB,MAAM,iBAAiB,CAAA;AAEnH,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA;AACjD,YAAY,EAAE,aAAa,EAAE,CAAA;AAyF7B,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,WAAW,CAksChF;AAED,wBAAsB,gBAAgB,CAAC,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CA0ChG"}
|
package/dist/server.js
CHANGED
package/package.json
CHANGED