@jacobbd/relay-ai 0.7.3 → 0.7.5

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.
@@ -11,7 +11,7 @@ import { join } from "path";
11
11
  // package.json
12
12
  var package_default = {
13
13
  name: "@jacobbd/relay-ai",
14
- version: "0.7.3",
14
+ version: "0.7.5",
15
15
  publishConfig: {
16
16
  access: "public"
17
17
  },
@@ -48,11 +48,13 @@ var package_default = {
48
48
  scripts: {
49
49
  build: "tsup && tsup --config tsup.core.config.ts && node scripts/copy-ui-assets.mjs",
50
50
  dev: "tsup --watch",
51
- test: "vitest run",
51
+ test: 'vitest run --exclude "tests/debug-*.test.ts"',
52
+ "test:live": "vitest run tests/debug-xai.test.ts tests/debug-openai-oauth.test.ts",
52
53
  "test:watch": "vitest",
53
54
  typecheck: "tsc --noEmit",
55
+ "release:check": "node scripts/release-metadata.mjs",
54
56
  "refresh:models-dev": "node scripts/refresh-models-dev-cache.mjs",
55
- prepublishOnly: `node -e "if (require('./package.json').version !== require('./package-lock.json').version) { console.error('Error: package.json and package-lock.json versions are out of sync! Run npm install to sync.'); process.exit(1); }" && npm run build`
57
+ prepublishOnly: "npm run release:check && npm run build"
56
58
  },
57
59
  dependencies: {
58
60
  "@ai-sdk/alibaba": "^1.0.26",
@@ -75,6 +77,7 @@ var package_default = {
75
77
  "@clack/prompts": "^0.9.1",
76
78
  "@openrouter/ai-sdk-provider": "^2.9.0",
77
79
  ai: "^6.0.197",
80
+ "cross-spawn": "^7.0.6",
78
81
  "gitlab-ai-provider": "^6.8.0",
79
82
  graphql: "^16.14.2",
80
83
  "ipaddr.js": "^2.4.0",
@@ -87,6 +90,7 @@ var package_default = {
87
90
  zod: "^3.25.76"
88
91
  },
89
92
  devDependencies: {
93
+ "@types/cross-spawn": "^6.0.6",
90
94
  "@types/node": "^22.0.0",
91
95
  "@types/node-forge": "^1.3.14",
92
96
  "@types/ws": "^8.18.1",
@@ -1920,7 +1924,8 @@ function resolveServerAutostart(env = process.env) {
1920
1924
  }
1921
1925
 
1922
1926
  // src/launch.ts
1923
- import { execSync, spawn } from "child_process";
1927
+ import { execSync } from "child_process";
1928
+ import spawn from "cross-spawn";
1924
1929
  import { existsSync as existsSync3, appendFileSync } from "fs";
1925
1930
  import { homedir as homedir3 } from "os";
1926
1931
  import { join as join4 } from "path";
@@ -2011,8 +2016,7 @@ function launchClaude(env, model, extraArgs) {
2011
2016
  };
2012
2017
  const child = spawn(claudePath, args, {
2013
2018
  stdio: "inherit",
2014
- env,
2015
- shell: isWindows
2019
+ env
2016
2020
  });
2017
2021
  const forward = (signal) => {
2018
2022
  child.kill(signal);
@@ -4172,6 +4176,10 @@ function getUiDebugLogPath() {
4172
4176
  function getServerDebugLogPath() {
4173
4177
  return join8(ensureLogsDir(), SERVER_DEBUG_LOG);
4174
4178
  }
4179
+ function getAntigravityDebugLogPath(tracePrefix) {
4180
+ const surface = tracePrefix === "antigravity" ? "app" : tracePrefix;
4181
+ return join8(ensureLogsDir(), `antigravity-${surface}-debug.log`);
4182
+ }
4175
4183
  function makeTraceLogger(logPath) {
4176
4184
  resetTraceLog(logPath);
4177
4185
  return (message) => writeSecureLogLine(logPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${message}`);
@@ -4716,6 +4724,46 @@ function serializeToolResultContent(content) {
4716
4724
  }
4717
4725
 
4718
4726
  // src/antigravity/request-adapter.ts
4727
+ function tracePartChars(part) {
4728
+ if (typeof part.text === "string") return part.text.length;
4729
+ if (part.type !== "tool-result") return void 0;
4730
+ const output = part.output;
4731
+ if (typeof output === "string") return output.length;
4732
+ if (output && typeof output === "object" && typeof output.value === "string") {
4733
+ return output.value.length;
4734
+ }
4735
+ try {
4736
+ return output === void 0 ? void 0 : JSON.stringify(output).length;
4737
+ } catch {
4738
+ return void 0;
4739
+ }
4740
+ }
4741
+ function summarizeSdkRequestForTrace(request) {
4742
+ const messages = request.messages.map((message) => {
4743
+ const content = message.content;
4744
+ if (typeof content === "string") {
4745
+ return { role: message.role, parts: [{ type: "text", chars: content.length }] };
4746
+ }
4747
+ const parts = Array.isArray(content) ? content.map((rawPart) => {
4748
+ const part = rawPart;
4749
+ const summary = {
4750
+ type: typeof part.type === "string" ? part.type : typeof rawPart
4751
+ };
4752
+ const chars = tracePartChars(part);
4753
+ if (chars !== void 0) summary.chars = chars;
4754
+ if (typeof part.toolName === "string") summary.toolName = part.toolName;
4755
+ if (typeof part.toolCallId === "string") summary.toolCallId = part.toolCallId;
4756
+ return summary;
4757
+ }) : [{ type: typeof content }];
4758
+ return { role: message.role, parts };
4759
+ });
4760
+ return {
4761
+ systemChars: request.system?.length ?? 0,
4762
+ messages,
4763
+ toolNames: Object.keys(request.tools ?? {}),
4764
+ ...request.toolChoice ? { toolChoice: request.toolChoice } : {}
4765
+ };
4766
+ }
4719
4767
  var JSON_SCHEMA_TYPES = /* @__PURE__ */ new Map([
4720
4768
  ["ARRAY", "array"],
4721
4769
  ["BOOLEAN", "boolean"],
@@ -5428,6 +5476,48 @@ function resolveUpstreamTools(tools, messages) {
5428
5476
  }
5429
5477
 
5430
5478
  // src/codex/upstream-error.ts
5479
+ var TRACE_FIELD_LIMIT = 4e3;
5480
+ function clipTraceField(value) {
5481
+ return value.length <= TRACE_FIELD_LIMIT ? value : `${value.slice(0, TRACE_FIELD_LIMIT)}\u2026`;
5482
+ }
5483
+ function safeUpstreamErrorFields(err, includeCause) {
5484
+ if (!err || typeof err !== "object") {
5485
+ return { message: clipTraceField(String(err)) };
5486
+ }
5487
+ const rec = err;
5488
+ const result = {};
5489
+ if (rec.name) result.name = rec.name;
5490
+ if (rec.message) result.message = clipTraceField(rec.message);
5491
+ if (rec.statusCode !== void 0) result.statusCode = rec.statusCode;
5492
+ if (rec.responseBody) result.responseBody = clipTraceField(rec.responseBody);
5493
+ if (rec.data?.error) {
5494
+ result.data = {
5495
+ error: {
5496
+ ...rec.data.error.type ? { type: rec.data.error.type } : {},
5497
+ ...rec.data.error.message ? { message: clipTraceField(rec.data.error.message) } : {}
5498
+ }
5499
+ };
5500
+ }
5501
+ if (rec.lastError) {
5502
+ result.lastError = {
5503
+ ...rec.lastError.message ? { message: clipTraceField(rec.lastError.message) } : {},
5504
+ ...rec.lastError.statusCode !== void 0 ? { statusCode: rec.lastError.statusCode } : {}
5505
+ };
5506
+ }
5507
+ if (rec.errors?.length) {
5508
+ result.errors = rec.errors.map((item) => ({
5509
+ ...item.message ? { message: clipTraceField(item.message) } : {},
5510
+ ...item.statusCode !== void 0 ? { statusCode: item.statusCode } : {}
5511
+ }));
5512
+ }
5513
+ if (includeCause && rec.cause !== void 0) {
5514
+ result.cause = safeUpstreamErrorFields(rec.cause, false);
5515
+ }
5516
+ return result;
5517
+ }
5518
+ function formatUpstreamErrorTrace(err) {
5519
+ return JSON.stringify(safeUpstreamErrorFields(err, true));
5520
+ }
5431
5521
  function formatUpstreamError(err) {
5432
5522
  if (!err || typeof err !== "object") return "Upstream model request failed.";
5433
5523
  const rec = err;
@@ -11971,6 +12061,7 @@ export {
11971
12061
  getGeminiProxyDebugLogPath,
11972
12062
  getUiDebugLogPath,
11973
12063
  getServerDebugLogPath,
12064
+ getAntigravityDebugLogPath,
11974
12065
  makeTraceLogger,
11975
12066
  writeSecureLogLine,
11976
12067
  printTraceLog,
@@ -12002,7 +12093,9 @@ export {
12002
12093
  splitToolUseId,
12003
12094
  encodeToolUseId,
12004
12095
  serializeToolResultContent,
12096
+ summarizeSdkRequestForTrace,
12005
12097
  translateRequest,
12098
+ formatUpstreamErrorTrace,
12006
12099
  formatUpstreamError,
12007
12100
  upstreamHttpStatus,
12008
12101
  aliasModelId,
@@ -12069,4 +12162,4 @@ export {
12069
12162
  supportsClaudeTransparentMode,
12070
12163
  buildHttpProxyRoutes
12071
12164
  };
12072
- //# sourceMappingURL=chunk-5LPUIWNJ.js.map
12165
+ //# sourceMappingURL=chunk-HEMJFOXG.js.map