@agentvault/claude-bridge 0.8.17 → 0.8.19

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.
@@ -3,6 +3,10 @@ export interface ServiceCmdDeps {
3
3
  backend: ServiceBackend;
4
4
  entrypoint: string;
5
5
  log: (msg: string) => void;
6
+ /** Wait for the freshly installed service to publish its enrolment
7
+ * fingerprint. Defaults to polling the data dir — but only for the REAL
8
+ * backend: an injected backend starts no daemon, so nothing would come. */
9
+ waitForFingerprint?: (dataDir: string) => string | undefined;
6
10
  }
7
11
  /**
8
12
  * #837: resolve the label that is ACTUALLY loaded rather than assuming the
@@ -1 +1 @@
1
- {"version":3,"file":"subcommand.d.ts","sourceRoot":"","sources":["../../src/service/subcommand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAElE,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5B;AAoCD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAMpF;AAED;;uFAEuF;AACvF,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAsHT"}
1
+ {"version":3,"file":"subcommand.d.ts","sourceRoot":"","sources":["../../src/service/subcommand.ts"],"names":[],"mappings":"AASA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAElE,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3B;;gFAE4E;IAC5E,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC9D;AAoCD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAMpF;AAED;;uFAEuF;AACvF,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAiJT"}
package/dist/session.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { type LlmUsage } from "./usage-report.js";
2
3
  /**
3
4
  * The one tool the room session exposes: `room_say`. Speaking to the room is an
4
5
  * explicit choice — Claude calls this only when it has something to add, and
@@ -98,6 +99,12 @@ export interface SessionOpts {
98
99
  * absent getter ⇒ `?? false` ⇒ gates stay in place.
99
100
  */
100
101
  gatesRemoved?: () => boolean;
102
+ /**
103
+ * Health (2026-10-14): per-model LLM usage lifted off each turn's `result`
104
+ * message, with the turn's API time. Fire-and-forget; a throw is swallowed so
105
+ * telemetry can never break a turn.
106
+ */
107
+ onUsage?: (usage: LlmUsage[], durationApiMs?: number) => void;
101
108
  }
102
109
  export declare class PersistentClaudeSession {
103
110
  private opts;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * LLM usage off the Claude Agent SDK `result` message, for Health (2026-10-14).
3
+ *
4
+ * The SDK already reports exact per-model usage and cost on every turn —
5
+ * `modelUsage: { [model]: { inputTokens, outputTokens, cacheReadInputTokens,
6
+ * cacheCreationInputTokens, costUSD } }`, plus the aggregate `usage` and
7
+ * `total_cost_usd`. The bridge used to discard all of it. This turns one
8
+ * result into one entry per model so the backend ledger can show cost per
9
+ * model without the bridge keeping a pricing table of its own.
10
+ *
11
+ * Read defensively: the result is untyped here, and an absent number must
12
+ * stay absent rather than become 0 (cost especially — "unknown" is not "free").
13
+ */
14
+ export interface LlmUsage {
15
+ model: string;
16
+ inputTokens: number;
17
+ outputTokens: number;
18
+ costUsd?: number;
19
+ cacheReadTokens?: number;
20
+ cacheCreationTokens?: number;
21
+ }
22
+ export declare function usageFromResult(result: Record<string, unknown>, fallbackModel?: string): LlmUsage[];
23
+ //# sourceMappingURL=usage-report.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/claude-bridge",
3
- "version": "0.8.17",
3
+ "version": "0.8.19",
4
4
  "type": "module",
5
5
  "description": "AgentVault Claude Bridge — daemon for bridging a Claude agent into secure E2E-encrypted AgentVault 1:1 direct messages and rooms.",
6
6
  "main": "dist/index.js",