@sneub/pair 0.0.1 → 0.0.2

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 (2) hide show
  1. package/dist/cli.js +26 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -24916,6 +24916,20 @@ var init_engine = __esm(() => {
24916
24916
  log3.info(`Starting turn (model: ${model}, resume: ${options.sdkSessionId ?? "new"})`);
24917
24917
  const startTime = Date.now();
24918
24918
  const settings = config.pair.apiKeyHelper ? { apiKeyHelper: config.pair.apiKeyHelper } : undefined;
24919
+ const stderrLines = [];
24920
+ const MAX_STDERR_LINES = 40;
24921
+ const captureStderr = (data) => {
24922
+ for (const line of data.split(`
24923
+ `)) {
24924
+ const trimmed = line.trim();
24925
+ if (!trimmed)
24926
+ continue;
24927
+ stderrLines.push(trimmed);
24928
+ if (stderrLines.length > MAX_STDERR_LINES) {
24929
+ stderrLines.shift();
24930
+ }
24931
+ }
24932
+ };
24919
24933
  try {
24920
24934
  for await (const message of Ns({
24921
24935
  prompt,
@@ -24925,6 +24939,7 @@ var init_engine = __esm(() => {
24925
24939
  systemPrompt: options.systemPrompt,
24926
24940
  permissionMode: "bypassPermissions",
24927
24941
  allowDangerouslySkipPermissions: true,
24942
+ stderr: captureStderr,
24928
24943
  ...settings ? { settings } : {},
24929
24944
  ...options.mcpServers ? { mcpServers: options.mcpServers } : {},
24930
24945
  ...options.sdkSessionId ? { resume: options.sdkSessionId } : {}
@@ -24935,16 +24950,23 @@ var init_engine = __esm(() => {
24935
24950
  } catch (err) {
24936
24951
  const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
24937
24952
  const errorMsg = err instanceof Error ? err.message : String(err);
24953
+ const stderrTail = stderrLines.slice(-15).join(`
24954
+ `);
24938
24955
  log3.error(`Turn failed after ${elapsed}s: ${errorMsg}`);
24939
- const isAuthError = errorMsg.includes("401") || errorMsg.includes("auth") || errorMsg.includes("Unauthorized");
24956
+ if (stderrTail) {
24957
+ log3.error(`claude stderr (last ${Math.min(stderrLines.length, 15)} lines):
24958
+ ${stderrTail}`);
24959
+ }
24960
+ const isAuthError = errorMsg.includes("401") || errorMsg.includes("auth") || errorMsg.includes("Unauthorized") || /\b(invalid[_ ]api[_ ]key|not authenticated|credentials)\b/i.test(stderrTail);
24940
24961
  if (isAuthError && config.pair.authMode === "oauth") {
24941
24962
  this.emit("error", {
24942
24963
  message: "Authentication failed \u2014 your OAuth session may have expired. Run `claude login` to re-authenticate.",
24943
- details: errorMsg
24964
+ details: stderrTail || errorMsg
24944
24965
  });
24945
24966
  } else {
24946
24967
  this.emit("error", {
24947
- message: `Turn failed unexpectedly: ${errorMsg}`
24968
+ message: `Turn failed unexpectedly: ${errorMsg}`,
24969
+ details: stderrTail || undefined
24948
24970
  });
24949
24971
  }
24950
24972
  }
@@ -30277,7 +30299,7 @@ init_dist();
30277
30299
  // package.json
30278
30300
  var package_default = {
30279
30301
  name: "@sneub/pair",
30280
- version: "0.0.1",
30302
+ version: "0.0.2",
30281
30303
  type: "module",
30282
30304
  description: "A personal AI assistant powered by Claude Code \u2014 connects Telegram and Slack to Claude with persistent memory and custom tools",
30283
30305
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sneub/pair",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "description": "A personal AI assistant powered by Claude Code — connects Telegram and Slack to Claude with persistent memory and custom tools",
6
6
  "bin": {