@snowyroad/braid 0.92.2 → 0.92.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.
@@ -319,6 +319,14 @@ function resolveAnthropicAuth(input) {
319
319
  );
320
320
  return { stripKeys: [], notices };
321
321
  }
322
+ function effectiveUsageAuthMode(input) {
323
+ if (input.agentMode !== "acp") return "apikey";
324
+ if (input.agent !== "claude-code") return void 0;
325
+ const { stripKeys } = resolveAnthropicAuth(input);
326
+ if (stripKeys.length > 0) return "oauth";
327
+ if (presentKeyEnvVars(input.env).length > 0) return "apikey";
328
+ return "oauth";
329
+ }
322
330
  function effectiveAnthropicCredential(input) {
323
331
  if (input.agent !== "claude-code" || input.agentMode !== "acp") return "the provider's own login";
324
332
  const { stripKeys } = resolveAnthropicAuth(input);
@@ -389,7 +397,7 @@ var InviteExpiredError = class extends Error {
389
397
  }
390
398
  };
391
399
  async function redeemInvite(relayHttpUrl, code) {
392
- const { boundedJsonFetch: boundedJsonFetch2 } = await import("./http-C5YTXRNH.js");
400
+ const { boundedJsonFetch: boundedJsonFetch2 } = await import("./http-WLOQB44Q.js");
393
401
  const r = await boundedJsonFetch2(`${relayHttpUrl.replace(/\/$/, "")}/invites/redeem`, {
394
402
  method: "POST",
395
403
  headers: { "content-type": "application/json" },
@@ -478,7 +486,7 @@ function validateReplacementToken(newToken, currentToken, nowMs = Date.now()) {
478
486
  return { ok: true };
479
487
  }
480
488
  async function mintAccessToken(relayHttpUrl, agentKey, fetchFn = fetch, dpopProof) {
481
- const { boundedJsonFetch: boundedJsonFetch2 } = await import("./http-C5YTXRNH.js");
489
+ const { boundedJsonFetch: boundedJsonFetch2 } = await import("./http-WLOQB44Q.js");
482
490
  const r = await boundedJsonFetch2(`${relayHttpUrl.replace(/\/$/, "")}/agents/token`, {
483
491
  method: "POST",
484
492
  headers: {
@@ -6258,7 +6266,17 @@ function makeUsageSource(cfg, channelId) {
6258
6266
  return new AcpUsageSource({
6259
6267
  model: cfg.model,
6260
6268
  provider: cfg.agent,
6261
- authMode: cfg.agentMode === "acp" ? "oauth" : "apikey",
6269
+ // D12/F6: stamp the auth mode from the RESOLVED credential (mirrors
6270
+ // resolveAnthropicAuth), not the old agentMode ternary that mislabelled a
6271
+ // metered API key as "oauth". A non-Claude ACP provider returns undefined so
6272
+ // the relay derives the honest "unknown" instead of guessing.
6273
+ authMode: effectiveUsageAuthMode({
6274
+ agent: cfg.agent,
6275
+ agentMode: cfg.agentMode,
6276
+ authMode: cfg.authMode ?? "auto",
6277
+ env: process.env,
6278
+ hasSubscriptionLogin: detectSubscriptionLogin(process.env)
6279
+ }),
6262
6280
  loadBaseline: () => loadStoredSession(dir, cfg.relayWsUrl, cfg.agentName, channelId, cfg.agent)?.costCumulativeLastSeen,
6263
6281
  saveBaseline: (cumulative, currency) => updateStoredCost(dir, cfg.relayWsUrl, cfg.agentName, channelId, cumulative, currency, cfg.agent)
6264
6282
  });
package/dist/cli.js CHANGED
@@ -71,7 +71,7 @@ import {
71
71
  toolStatusLine,
72
72
  validateRelayWsUrl,
73
73
  wsToHttp
74
- } from "./chunk-4ABAU7OP.js";
74
+ } from "./chunk-WJ2X7ILC.js";
75
75
  import {
76
76
  externalSourceLabel,
77
77
  externalUntrustedPreamble,
@@ -4,7 +4,7 @@ import {
4
4
  boundedJsonFetch,
5
5
  resetHttpMetricsForTest,
6
6
  snapshotHttpMetrics
7
- } from "./chunk-4ABAU7OP.js";
7
+ } from "./chunk-WJ2X7ILC.js";
8
8
  import "./chunk-BDOF72CL.js";
9
9
  export {
10
10
  assertHttpEndpoint,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowyroad/braid",
3
- "version": "0.92.2",
3
+ "version": "0.92.3",
4
4
  "description": "Braid: connect your own coding agent (Claude Code, Codex, Gemini, Grok) to a Braid channel and collaborate with other agents and humans.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "SnowyRoad",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@snowyroad/braid",
3
- "version": "0.92.2",
3
+ "version": "0.92.3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@snowyroad/braid",
9
- "version": "0.92.2",
9
+ "version": "0.92.3",
10
10
  "license": "SEE LICENSE IN LICENSE.md",
11
11
  "dependencies": {
12
12
  "@agentclientprotocol/sdk": "0.25.1",
@@ -1532,9 +1532,9 @@
1532
1532
  }
1533
1533
  },
1534
1534
  "node_modules/body-parser/node_modules/content-type": {
1535
- "version": "2.0.0",
1536
- "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz",
1537
- "integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==",
1535
+ "version": "2.1.0",
1536
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz",
1537
+ "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==",
1538
1538
  "license": "MIT",
1539
1539
  "engines": {
1540
1540
  "node": ">=18"
@@ -2368,9 +2368,9 @@
2368
2368
  }
2369
2369
  },
2370
2370
  "node_modules/hono": {
2371
- "version": "4.13.1",
2372
- "resolved": "https://registry.npmjs.org/hono/-/hono-4.13.1.tgz",
2373
- "integrity": "sha512-kdJoFVv2xmayw6cY09H7AbMJMt8Jn5jdlEdXsP7AGBdF2DIptVlKlOLKXP41yPip4/a3yQPv9gVcJYI8YY04dw==",
2371
+ "version": "4.13.2",
2372
+ "resolved": "https://registry.npmjs.org/hono/-/hono-4.13.2.tgz",
2373
+ "integrity": "sha512-JydRilDRkYBQMt9qR9U92mXxmbGqsqSn/IKOrh4e7/gEbn+0zSr8igTu0obwJoNGN4sez28DIql7FBHWydoJpA==",
2374
2374
  "license": "MIT",
2375
2375
  "engines": {
2376
2376
  "node": ">=16.9.0"
@@ -4246,9 +4246,9 @@
4246
4246
  }
4247
4247
  },
4248
4248
  "node_modules/type-is/node_modules/content-type": {
4249
- "version": "2.0.0",
4250
- "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz",
4251
- "integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==",
4249
+ "version": "2.1.0",
4250
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz",
4251
+ "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==",
4252
4252
  "license": "MIT",
4253
4253
  "engines": {
4254
4254
  "node": ">=18"