@koda-sl/baker-bridge 0.129.0 → 0.130.0-dev.1468b4215

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koda-sl/baker-bridge",
3
- "version": "0.129.0",
3
+ "version": "0.130.0-dev.1468b4215",
4
4
  "description": "HTTP server wrapping the Claude Agent SDK. Persists chat events to Convex; the dashboard subscribes via Convex realtime",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,9 +41,8 @@
41
41
  "unlink:local": "bash scripts/unlink-local.sh"
42
42
  },
43
43
  "dependencies": {
44
- "@anthropic-ai/claude-agent-sdk": "^0.3.284",
44
+ "@anthropic-ai/claude-agent-sdk": "^0.3.295",
45
45
  "@hono/node-server": "^1.19.14",
46
- "@latitude-data/claude-code-telemetry": "0.0.15",
47
46
  "@t3-oss/env-core": "^0.13.10",
48
47
  "hono": "^4.12.25",
49
48
  "image-size": "^2.0.2",
@@ -1,17 +0,0 @@
1
- import type { Settings } from "@anthropic-ai/claude-agent-sdk";
2
- type LatitudeHook = {
3
- readonly node: string;
4
- readonly entry: string;
5
- };
6
- type LatitudeHooks = NonNullable<Settings["hooks"]>;
7
- /**
8
- * `Stop` reports each turn without delaying it; `SessionEnd` is synchronous
9
- * because it is the one that still fires when the CLI exits right after a turn,
10
- * which is how the bridge closes a query. The hook's own offset lock keeps the
11
- * two from reporting a turn twice.
12
- */
13
- export declare function latitudeTelemetryFor(env: Record<string, string | undefined>, hook: LatitudeHook | undefined): LatitudeHooks | undefined;
14
- /** Where the installed hook lives; undefined turns tracing off rather than failing the turn. */
15
- export declare function installedLatitudeHook(): LatitudeHook | undefined;
16
- export {};
17
- //# sourceMappingURL=latitude-telemetry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"latitude-telemetry.d.ts","sourceRoot":"","sources":["../../src/hono/latitude-telemetry.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE/D,KAAK,YAAY,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtE,KAAK,aAAa,GAAG,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,IAAI,EAAE,YAAY,GAAG,SAAS,GAC7B,aAAa,GAAG,SAAS,CAS3B;AAED,gGAAgG;AAChG,wBAAgB,qBAAqB,IAAI,YAAY,GAAG,SAAS,CAOhE"}
@@ -1,58 +0,0 @@
1
- /**
2
- * Latitude tracing of the agent, one trace per turn.
3
- *
4
- * Off: Baker's backend no longer hands a Runtime `LATITUDE_API_KEY` /
5
- * `LATITUDE_PROJECT`. Every company has Credentials, and the uploaded
6
- * transcript may hold a tool result the credential scrub did not rewrite
7
- * (docs/adr/0008-credentials-broker.md, docs/operations.md § Agent Tracing).
8
- * Turning it back on takes backend code, not an env var.
9
- *
10
- * Latitude's Claude Code hook reads the turn's transcript when the turn ends and
11
- * uploads it as OTLP spans: the prompt, every model call with its tokens, every
12
- * tool call with its result, subagents and auto-memory. The bridge registers it
13
- * through the per-query `settings` tier rather than the scaffold's
14
- * `.claude/settings.json`, so no client repo carries it and it is on exactly
15
- * when the sandbox has both variables.
16
- *
17
- * Every company lands in one Latitude project; the hook stamps each trace with
18
- * the workspace's git repo (the company) and branch (the chat), which is how
19
- * they are told apart there. The session id is left to the hook: it hashes it
20
- * with a turn count that restarts for every Claude session, so pinning it to a
21
- * thread — which starts a fresh Claude session after a stall or an invalid
22
- * resume — would reuse the trace ids of that thread's first turns.
23
- *
24
- * The hook is a pinned dependency run with the bridge's own node, never
25
- * `npx …@latest`: that would fetch unpinned code into every sandbox on every
26
- * turn. Its optional `BUN_OPTIONS` preload (full system prompt and tool
27
- * definitions) is deliberately not wired — if that file is ever missing, the
28
- * CLI refuses to start, which would take every turn down with it.
29
- */
30
- import { createRequire } from "node:module";
31
- import { dirname, join } from "node:path";
32
- /**
33
- * `Stop` reports each turn without delaying it; `SessionEnd` is synchronous
34
- * because it is the one that still fires when the CLI exits right after a turn,
35
- * which is how the bridge closes a query. The hook's own offset lock keeps the
36
- * two from reporting a turn twice.
37
- */
38
- export function latitudeTelemetryFor(env, hook) {
39
- if (!env.LATITUDE_API_KEY || !env.LATITUDE_PROJECT || !hook) {
40
- return undefined;
41
- }
42
- const command = `"${hook.node}" "${hook.entry}"`;
43
- return {
44
- Stop: [{ hooks: [{ type: "command", command, async: true }] }],
45
- SessionEnd: [{ hooks: [{ type: "command", command, timeout: 10 }] }],
46
- };
47
- }
48
- /** Where the installed hook lives; undefined turns tracing off rather than failing the turn. */
49
- export function installedLatitudeHook() {
50
- try {
51
- const main = createRequire(import.meta.url).resolve("@latitude-data/claude-code-telemetry");
52
- return { node: process.execPath, entry: join(dirname(main), "entry.js") };
53
- }
54
- catch {
55
- return undefined;
56
- }
57
- }
58
- //# sourceMappingURL=latitude-telemetry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"latitude-telemetry.js","sourceRoot":"","sources":["../../src/hono/latitude-telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAO1C;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,GAAuC,EACvC,IAA8B;IAE9B,IAAI,CAAC,GAAG,CAAC,gBAAgB,IAAI,CAAC,GAAG,CAAC,gBAAgB,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5D,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,KAAK,GAAG,CAAC;IACjD,OAAO;QACL,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAC9D,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;KACrE,CAAC;AACJ,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,qBAAqB;IACnC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,sCAAsC,CAAC,CAAC;QAC5F,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC;IAC5E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=latitude-telemetry.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"latitude-telemetry.test.d.ts","sourceRoot":"","sources":["../../src/hono/latitude-telemetry.test.ts"],"names":[],"mappings":""}
@@ -1,18 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { latitudeTelemetryFor } from "./latitude-telemetry.js";
3
- const HOOK = { node: "/usr/bin/node", entry: "/app/node_modules/@latitude-data/claude-code-telemetry/dist/entry.js" };
4
- describe("latitudeTelemetryFor", () => {
5
- it("is off when the sandbox was not given a Latitude key and project", () => {
6
- expect(latitudeTelemetryFor({}, HOOK)).toBeUndefined();
7
- expect(latitudeTelemetryFor({ LATITUDE_API_KEY: "k" }, HOOK)).toBeUndefined();
8
- expect(latitudeTelemetryFor({ LATITUDE_PROJECT: "p" }, HOOK)).toBeUndefined();
9
- });
10
- it("runs the pinned hook at the end of every turn and at session end", () => {
11
- const command = `"/usr/bin/node" "${HOOK.entry}"`;
12
- expect(latitudeTelemetryFor({ LATITUDE_API_KEY: "k", LATITUDE_PROJECT: "p" }, HOOK)).toEqual({
13
- Stop: [{ hooks: [{ type: "command", command, async: true }] }],
14
- SessionEnd: [{ hooks: [{ type: "command", command, timeout: 10 }] }],
15
- });
16
- });
17
- });
18
- //# sourceMappingURL=latitude-telemetry.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"latitude-telemetry.test.js","sourceRoot":"","sources":["../../src/hono/latitude-telemetry.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,sEAAsE,EAAE,CAAC;AAEtH,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,kEAAkE,EAAE,GAAG,EAAE;QAC1E,MAAM,CAAC,oBAAoB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QACvD,MAAM,CAAC,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QAC9E,MAAM,CAAC,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IAChF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kEAAkE,EAAE,GAAG,EAAE;QAC1E,MAAM,OAAO,GAAG,oBAAoB,IAAI,CAAC,KAAK,GAAG,CAAC;QAClD,MAAM,CAAC,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;YAC3F,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;YAC9D,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;SACrE,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}