@mduan/paseo-cli 0.11.0-fork.1 → 0.11.0-fork.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 (44) hide show
  1. package/node_modules/@getpaseo/client/package.json +3 -3
  2. package/node_modules/@getpaseo/highlight/package.json +1 -1
  3. package/node_modules/@getpaseo/plugin/package.json +3 -3
  4. package/node_modules/@getpaseo/protocol/dist/agent-types.d.ts +2 -0
  5. package/node_modules/@getpaseo/protocol/dist/generated/validation/ws-outbound.aot.js +106 -1
  6. package/node_modules/@getpaseo/protocol/dist/messages.js +3 -0
  7. package/node_modules/@getpaseo/protocol/package.json +1 -1
  8. package/node_modules/@getpaseo/relay/package.json +1 -1
  9. package/node_modules/@getpaseo/server/dist/server/builtin-plugins/package.json +1 -1
  10. package/node_modules/@getpaseo/server/dist/server/server/agent/agent-manager.d.ts +2 -2
  11. package/node_modules/@getpaseo/server/dist/server/server/agent/agent-projections.js +3 -0
  12. package/node_modules/@getpaseo/server/dist/server/server/agent/agent-sdk-types.d.ts +3 -1
  13. package/node_modules/@getpaseo/server/dist/server/server/agent/agent-storage.d.ts +1 -0
  14. package/node_modules/@getpaseo/server/dist/server/server/agent/agent-storage.js +1 -0
  15. package/node_modules/@getpaseo/server/dist/server/server/agent/provider-subagents/subtitle-format.d.ts +5 -0
  16. package/node_modules/@getpaseo/server/dist/server/server/agent/provider-subagents/subtitle-format.js +16 -0
  17. package/node_modules/@getpaseo/server/dist/server/server/agent/providers/appended-lines-reader.d.ts +20 -0
  18. package/node_modules/@getpaseo/server/dist/server/server/agent/providers/appended-lines-reader.js +59 -0
  19. package/node_modules/@getpaseo/server/dist/server/server/agent/providers/claude/agent.js +61 -2
  20. package/node_modules/@getpaseo/server/dist/server/server/agent/providers/claude/subagents/live-source.d.ts +2 -0
  21. package/node_modules/@getpaseo/server/dist/server/server/agent/providers/claude/subagents/live-source.js +7 -0
  22. package/node_modules/@getpaseo/server/dist/server/server/agent/providers/claude/subagents/presentation.d.ts +2 -0
  23. package/node_modules/@getpaseo/server/dist/server/server/agent/providers/claude/subagents/presentation.js +3 -8
  24. package/node_modules/@getpaseo/server/dist/server/server/agent/providers/claude/subagents/transcript-cost.d.ts +18 -0
  25. package/node_modules/@getpaseo/server/dist/server/server/agent/providers/claude/subagents/transcript-cost.js +50 -0
  26. package/node_modules/@getpaseo/server/dist/server/server/agent/providers/codex/pricing.d.ts +15 -1
  27. package/node_modules/@getpaseo/server/dist/server/server/agent/providers/codex/pricing.js +32 -1
  28. package/node_modules/@getpaseo/server/dist/server/server/agent/providers/codex/rollout-cost.d.ts +4 -8
  29. package/node_modules/@getpaseo/server/dist/server/server/agent/providers/codex/rollout-cost.js +11 -51
  30. package/node_modules/@getpaseo/server/dist/server/server/agent/providers/codex-app-server-agent.d.ts +5 -1
  31. package/node_modules/@getpaseo/server/dist/server/server/agent/providers/codex-app-server-agent.js +82 -11
  32. package/node_modules/@getpaseo/server/dist/server/server/agent/turn-diffs/snapshot.d.ts +14 -0
  33. package/node_modules/@getpaseo/server/dist/server/server/agent/turn-diffs/snapshot.js +91 -4
  34. package/node_modules/@getpaseo/server/dist/server/server/agent/turn-diffs/store.d.ts +3 -3
  35. package/node_modules/@getpaseo/server/dist/server/server/agent/turn-diffs/store.js +24 -18
  36. package/node_modules/@getpaseo/server/dist/server/web-ui/_expo/static/js/web/{index-9489c4e1587c4252f0bd3b6e4b1abab3.js → index-23bdbee37d31a9422c12f2a801979611.js} +21 -21
  37. package/node_modules/@getpaseo/server/dist/server/web-ui/_expo/static/js/web/index-23bdbee37d31a9422c12f2a801979611.js.br +0 -0
  38. package/node_modules/@getpaseo/server/dist/server/web-ui/_expo/static/js/web/{index-9489c4e1587c4252f0bd3b6e4b1abab3.js.gz → index-23bdbee37d31a9422c12f2a801979611.js.gz} +0 -0
  39. package/node_modules/@getpaseo/server/dist/server/web-ui/index.html +1 -1
  40. package/node_modules/@getpaseo/server/dist/server/web-ui/index.html.br +0 -0
  41. package/node_modules/@getpaseo/server/dist/server/web-ui/index.html.gz +0 -0
  42. package/node_modules/@getpaseo/server/package.json +6 -6
  43. package/package.json +7 -7
  44. package/node_modules/@getpaseo/server/dist/server/web-ui/_expo/static/js/web/index-9489c4e1587c4252f0bd3b6e4b1abab3.js.br +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/client",
3
- "version": "0.11.0-fork.1",
3
+ "version": "0.11.0-fork.2",
4
4
  "description": "Paseo client SDK package",
5
5
  "files": [
6
6
  "dist",
@@ -44,7 +44,7 @@
44
44
  "vitest": "^4.1.6"
45
45
  },
46
46
  "dependencies": {
47
- "@getpaseo/protocol": "0.11.0-fork.1",
48
- "@getpaseo/relay": "0.11.0-fork.1"
47
+ "@getpaseo/protocol": "0.11.0-fork.2",
48
+ "@getpaseo/relay": "0.11.0-fork.2"
49
49
  }
50
50
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/highlight",
3
- "version": "0.11.0-fork.1",
3
+ "version": "0.11.0-fork.2",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.map",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/plugin",
3
- "version": "0.11.0-fork.1",
3
+ "version": "0.11.0-fork.2",
4
4
  "description": "Paseo plugin SDK package",
5
5
  "files": [
6
6
  "dist",
@@ -66,8 +66,8 @@
66
66
  "test": "vitest run"
67
67
  },
68
68
  "devDependencies": {
69
- "@getpaseo/client": "0.11.0-fork.1",
70
- "@getpaseo/protocol": "0.11.0-fork.1",
69
+ "@getpaseo/client": "0.11.0-fork.2",
70
+ "@getpaseo/protocol": "0.11.0-fork.2",
71
71
  "@types/node": "^20.9.0",
72
72
  "@types/react": "~19.2.0",
73
73
  "react": "19.1.0",
@@ -168,6 +168,8 @@ export interface AgentUsage {
168
168
  totalCostUsd?: number;
169
169
  /** The provider can estimate cost, but its price list could not be loaded. */
170
170
  totalCostUnavailable?: boolean;
171
+ /** Paseo priced the provider's token counts itself; the provider reports no cost. */
172
+ totalCostEstimated?: boolean;
171
173
  contextWindowMaxTokens?: number;
172
174
  contextWindowUsedTokens?: number;
173
175
  }
@@ -631,7 +631,7 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
631
631
  function __du_106(__dx_107) { switch (__dx_107["type"]) {
632
632
  case "thread_started": return typeof __dx_107 === "object" && __dx_107 !== null && !Array.isArray(__dx_107) && __dx_107["type"] === "thread_started" && typeof __dx_107["sessionId"] === "string" && typeof __dx_107["provider"] === "string";
633
633
  case "turn_started": return typeof __dx_107 === "object" && __dx_107 !== null && !Array.isArray(__dx_107) && __dx_107["type"] === "turn_started" && typeof __dx_107["provider"] === "string" && (__dx_107["turnId"] === undefined || (typeof __dx_107["turnId"] === "string"));
634
- case "turn_completed": return typeof __dx_107 === "object" && __dx_107 !== null && !Array.isArray(__dx_107) && __dx_107["type"] === "turn_completed" && typeof __dx_107["provider"] === "string" && (__dx_107["turnId"] === undefined || (typeof __dx_107["turnId"] === "string")) && (__dx_107["usage"] === undefined || (typeof __dx_107["usage"] === "object" && __dx_107["usage"] !== null && !Array.isArray(__dx_107["usage"]) && (__dx_107["usage"]["inputTokens"] === undefined || (typeof __dx_107["usage"]["inputTokens"] === "number" && !Number.isNaN(__dx_107["usage"]["inputTokens"]) && Number.isFinite(__dx_107["usage"]["inputTokens"]))) && (__dx_107["usage"]["cachedInputTokens"] === undefined || (typeof __dx_107["usage"]["cachedInputTokens"] === "number" && !Number.isNaN(__dx_107["usage"]["cachedInputTokens"]) && Number.isFinite(__dx_107["usage"]["cachedInputTokens"]))) && (__dx_107["usage"]["outputTokens"] === undefined || (typeof __dx_107["usage"]["outputTokens"] === "number" && !Number.isNaN(__dx_107["usage"]["outputTokens"]) && Number.isFinite(__dx_107["usage"]["outputTokens"]))) && (__dx_107["usage"]["totalCostUsd"] === undefined || (typeof __dx_107["usage"]["totalCostUsd"] === "number" && !Number.isNaN(__dx_107["usage"]["totalCostUsd"]) && Number.isFinite(__dx_107["usage"]["totalCostUsd"]))) && (__dx_107["usage"]["totalCostUnavailable"] === undefined || (typeof __dx_107["usage"]["totalCostUnavailable"] === "boolean")) && (__dx_107["usage"]["contextWindowMaxTokens"] === undefined || (typeof __dx_107["usage"]["contextWindowMaxTokens"] === "number" && !Number.isNaN(__dx_107["usage"]["contextWindowMaxTokens"]) && Number.isFinite(__dx_107["usage"]["contextWindowMaxTokens"]))) && (__dx_107["usage"]["contextWindowUsedTokens"] === undefined || (typeof __dx_107["usage"]["contextWindowUsedTokens"] === "number" && !Number.isNaN(__dx_107["usage"]["contextWindowUsedTokens"]) && Number.isFinite(__dx_107["usage"]["contextWindowUsedTokens"])))));
634
+ case "turn_completed": return typeof __dx_107 === "object" && __dx_107 !== null && !Array.isArray(__dx_107) && __dx_107["type"] === "turn_completed" && typeof __dx_107["provider"] === "string" && (__dx_107["turnId"] === undefined || (typeof __dx_107["turnId"] === "string")) && (__dx_107["usage"] === undefined || (typeof __dx_107["usage"] === "object" && __dx_107["usage"] !== null && !Array.isArray(__dx_107["usage"]) && (__dx_107["usage"]["inputTokens"] === undefined || (typeof __dx_107["usage"]["inputTokens"] === "number" && !Number.isNaN(__dx_107["usage"]["inputTokens"]) && Number.isFinite(__dx_107["usage"]["inputTokens"]))) && (__dx_107["usage"]["cachedInputTokens"] === undefined || (typeof __dx_107["usage"]["cachedInputTokens"] === "number" && !Number.isNaN(__dx_107["usage"]["cachedInputTokens"]) && Number.isFinite(__dx_107["usage"]["cachedInputTokens"]))) && (__dx_107["usage"]["outputTokens"] === undefined || (typeof __dx_107["usage"]["outputTokens"] === "number" && !Number.isNaN(__dx_107["usage"]["outputTokens"]) && Number.isFinite(__dx_107["usage"]["outputTokens"]))) && (__dx_107["usage"]["totalCostUsd"] === undefined || (typeof __dx_107["usage"]["totalCostUsd"] === "number" && !Number.isNaN(__dx_107["usage"]["totalCostUsd"]) && Number.isFinite(__dx_107["usage"]["totalCostUsd"]))) && (__dx_107["usage"]["totalCostUnavailable"] === undefined || (typeof __dx_107["usage"]["totalCostUnavailable"] === "boolean")) && (__dx_107["usage"]["totalCostEstimated"] === undefined || (typeof __dx_107["usage"]["totalCostEstimated"] === "boolean")) && (__dx_107["usage"]["contextWindowMaxTokens"] === undefined || (typeof __dx_107["usage"]["contextWindowMaxTokens"] === "number" && !Number.isNaN(__dx_107["usage"]["contextWindowMaxTokens"]) && Number.isFinite(__dx_107["usage"]["contextWindowMaxTokens"]))) && (__dx_107["usage"]["contextWindowUsedTokens"] === undefined || (typeof __dx_107["usage"]["contextWindowUsedTokens"] === "number" && !Number.isNaN(__dx_107["usage"]["contextWindowUsedTokens"]) && Number.isFinite(__dx_107["usage"]["contextWindowUsedTokens"])))));
635
635
  case "turn_failed": return typeof __dx_107 === "object" && __dx_107 !== null && !Array.isArray(__dx_107) && __dx_107["type"] === "turn_failed" && typeof __dx_107["provider"] === "string" && (__dx_107["turnId"] === undefined || (typeof __dx_107["turnId"] === "string")) && typeof __dx_107["error"] === "string" && (__dx_107["code"] === undefined || (typeof __dx_107["code"] === "string")) && (__dx_107["diagnostic"] === undefined || (typeof __dx_107["diagnostic"] === "string"));
636
636
  case "turn_canceled": return typeof __dx_107 === "object" && __dx_107 !== null && !Array.isArray(__dx_107) && __dx_107["type"] === "turn_canceled" && typeof __dx_107["provider"] === "string" && (__dx_107["turnId"] === undefined || (typeof __dx_107["turnId"] === "string")) && typeof __dx_107["reason"] === "string";
637
637
  case "timeline": return typeof __dx_107 === "object" && __dx_107 !== null && !Array.isArray(__dx_107) && __dx_107["type"] === "timeline" && typeof __dx_107["provider"] === "string" && ((typeof __dx_107["item"] === "object" && __dx_107["item"] !== null && !Array.isArray(__dx_107["item"]) && __dx_107["item"]["type"] === "user_message" && typeof __dx_107["item"]["text"] === "string" && (__dx_107["item"]["messageId"] === undefined || (typeof __dx_107["item"]["messageId"] === "string")) && (__dx_107["item"]["clientMessageId"] === undefined || (typeof __dx_107["item"]["clientMessageId"] === "string"))) || (typeof __dx_107["item"] === "object" && __dx_107["item"] !== null && !Array.isArray(__dx_107["item"]) && __dx_107["item"]["type"] === "assistant_message" && typeof __dx_107["item"]["text"] === "string" && (__dx_107["item"]["messageId"] === undefined || (typeof __dx_107["item"]["messageId"] === "string"))) || (typeof __dx_107["item"] === "object" && __dx_107["item"] !== null && !Array.isArray(__dx_107["item"]) && __dx_107["item"]["type"] === "reasoning" && typeof __dx_107["item"]["text"] === "string") || (typeof __dx_107["item"] === "object" && __dx_107["item"] !== null && !Array.isArray(__dx_107["item"]) && __du_108(__dx_107["item"])) || (typeof __dx_107["item"] === "object" && __dx_107["item"] !== null && !Array.isArray(__dx_107["item"]) && __dx_107["item"]["type"] === "todo" && Array.isArray(__dx_107["item"]["items"]) && __af_184(__dx_107["item"]["items"])) || (typeof __dx_107["item"] === "object" && __dx_107["item"] !== null && !Array.isArray(__dx_107["item"]) && __dx_107["item"]["type"] === "error" && typeof __dx_107["item"]["message"] === "string") || (typeof __dx_107["item"] === "object" && __dx_107["item"] !== null && !Array.isArray(__dx_107["item"]) && __dx_107["item"]["type"] === "notification" && (__dx_107["item"]["level"] === "info" || __dx_107["item"]["level"] === "warning" || __dx_107["item"]["level"] === "error") && typeof __dx_107["item"]["message"] === "string") || (typeof __dx_107["item"] === "object" && __dx_107["item"] !== null && !Array.isArray(__dx_107["item"]) && __dx_107["item"]["type"] === "compaction" && (__dx_107["item"]["status"] === "loading" || __dx_107["item"]["status"] === "completed") && (__dx_107["item"]["trigger"] === undefined || ((__dx_107["item"]["trigger"] === "auto" || __dx_107["item"]["trigger"] === "manual"))) && (__dx_107["item"]["preTokens"] === undefined || (typeof __dx_107["item"]["preTokens"] === "number" && !Number.isNaN(__dx_107["item"]["preTokens"]) && Number.isFinite(__dx_107["item"]["preTokens"])))) || (typeof __dx_107["item"] === "object" && __dx_107["item"] !== null && !Array.isArray(__dx_107["item"]) && __dx_107["item"]["type"] === "fork_marker" && typeof __dx_107["item"]["sourceAgentId"] === "string" && (__dx_107["item"]["mode"] === "full" || __dx_107["item"]["mode"] === "summary")) || (typeof __dx_107["item"] === "object" && __dx_107["item"] !== null && !Array.isArray(__dx_107["item"]) && __dx_107["item"]["type"] === "plugin" && typeof __dx_107["item"]["id"] === "string" && typeof __dx_107["item"]["pluginId"] === "string" && __re_re_185.test(__dx_107["item"]["pluginId"]) && typeof __dx_107["item"]["kind"] === "string" && typeof __dx_107["item"]["version"] === "number" && !Number.isNaN(__dx_107["item"]["version"]) && Number.isFinite(__dx_107["item"]["version"]) && true)) && (__dx_107["turnId"] === undefined || (typeof __dx_107["turnId"] === "string"));
@@ -2457,6 +2457,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
2457
2457
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_333["totalCostUnavailable"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
2458
2458
  }
2459
2459
  }
2460
+ if (__o_333["totalCostEstimated"] !== undefined) {
2461
+ if (typeof __o_333["totalCostEstimated"] !== "boolean") {
2462
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_333["totalCostEstimated"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostEstimated") });
2463
+ }
2464
+ }
2460
2465
  if (__o_333["contextWindowMaxTokens"] !== undefined) {
2461
2466
  if (typeof __o_333["contextWindowMaxTokens"] !== "number") {
2462
2467
  _e.push({ code: "invalid_type", expected: "number", input: __o_333["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -4273,6 +4278,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
4273
4278
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_464["totalCostUnavailable"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
4274
4279
  }
4275
4280
  }
4281
+ if (__o_464["totalCostEstimated"] !== undefined) {
4282
+ if (typeof __o_464["totalCostEstimated"] !== "boolean") {
4283
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_464["totalCostEstimated"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostEstimated") });
4284
+ }
4285
+ }
4276
4286
  if (__o_464["contextWindowMaxTokens"] !== undefined) {
4277
4287
  if (typeof __o_464["contextWindowMaxTokens"] !== "number") {
4278
4288
  _e.push({ code: "invalid_type", expected: "number", input: __o_464["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -4523,6 +4533,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
4523
4533
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_475["totalCostUnavailable"], path: ["message"].concat("payload").concat("event").concat("usage").concat("totalCostUnavailable") });
4524
4534
  }
4525
4535
  }
4536
+ if (__o_475["totalCostEstimated"] !== undefined) {
4537
+ if (typeof __o_475["totalCostEstimated"] !== "boolean") {
4538
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_475["totalCostEstimated"], path: ["message"].concat("payload").concat("event").concat("usage").concat("totalCostEstimated") });
4539
+ }
4540
+ }
4526
4541
  if (__o_475["contextWindowMaxTokens"] !== undefined) {
4527
4542
  if (typeof __o_475["contextWindowMaxTokens"] !== "number") {
4528
4543
  _e.push({ code: "invalid_type", expected: "number", input: __o_475["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("event").concat("usage").concat("contextWindowMaxTokens") });
@@ -15385,6 +15400,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
15385
15400
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_1232["totalCostUnavailable"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
15386
15401
  }
15387
15402
  }
15403
+ if (__o_1232["totalCostEstimated"] !== undefined) {
15404
+ if (typeof __o_1232["totalCostEstimated"] !== "boolean") {
15405
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_1232["totalCostEstimated"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostEstimated") });
15406
+ }
15407
+ }
15388
15408
  if (__o_1232["contextWindowMaxTokens"] !== undefined) {
15389
15409
  if (typeof __o_1232["contextWindowMaxTokens"] !== "number") {
15390
15410
  _e.push({ code: "invalid_type", expected: "number", input: __o_1232["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -18066,6 +18086,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
18066
18086
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_1366["totalCostUnavailable"], path: ["message"].concat("payload").concat("event").concat("usage").concat("totalCostUnavailable") });
18067
18087
  }
18068
18088
  }
18089
+ if (__o_1366["totalCostEstimated"] !== undefined) {
18090
+ if (typeof __o_1366["totalCostEstimated"] !== "boolean") {
18091
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_1366["totalCostEstimated"], path: ["message"].concat("payload").concat("event").concat("usage").concat("totalCostEstimated") });
18092
+ }
18093
+ }
18069
18094
  if (__o_1366["contextWindowMaxTokens"] !== undefined) {
18070
18095
  if (typeof __o_1366["contextWindowMaxTokens"] !== "number") {
18071
18096
  _e.push({ code: "invalid_type", expected: "number", input: __o_1366["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("event").concat("usage").concat("contextWindowMaxTokens") });
@@ -24638,6 +24663,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
24638
24663
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_1852["totalCostUnavailable"], path: ["message"].concat("payload").concat("info").concat("lastUsage").concat("totalCostUnavailable") });
24639
24664
  }
24640
24665
  }
24666
+ if (__o_1852["totalCostEstimated"] !== undefined) {
24667
+ if (typeof __o_1852["totalCostEstimated"] !== "boolean") {
24668
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_1852["totalCostEstimated"], path: ["message"].concat("payload").concat("info").concat("lastUsage").concat("totalCostEstimated") });
24669
+ }
24670
+ }
24641
24671
  if (__o_1852["contextWindowMaxTokens"] !== undefined) {
24642
24672
  if (typeof __o_1852["contextWindowMaxTokens"] !== "number") {
24643
24673
  _e.push({ code: "invalid_type", expected: "number", input: __o_1852["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("info").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -26192,6 +26222,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
26192
26222
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_1959["totalCostUnavailable"], path: ["message"].concat("payload").concat("entries").concat(__i_1859).concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
26193
26223
  }
26194
26224
  }
26225
+ if (__o_1959["totalCostEstimated"] !== undefined) {
26226
+ if (typeof __o_1959["totalCostEstimated"] !== "boolean") {
26227
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_1959["totalCostEstimated"], path: ["message"].concat("payload").concat("entries").concat(__i_1859).concat("agent").concat("lastUsage").concat("totalCostEstimated") });
26228
+ }
26229
+ }
26195
26230
  if (__o_1959["contextWindowMaxTokens"] !== undefined) {
26196
26231
  if (typeof __o_1959["contextWindowMaxTokens"] !== "number") {
26197
26232
  _e.push({ code: "invalid_type", expected: "number", input: __o_1959["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("entries").concat(__i_1859).concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -28128,6 +28163,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
28128
28163
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_2094["totalCostUnavailable"], path: ["message"].concat("payload").concat("entries").concat(__i_1994).concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
28129
28164
  }
28130
28165
  }
28166
+ if (__o_2094["totalCostEstimated"] !== undefined) {
28167
+ if (typeof __o_2094["totalCostEstimated"] !== "boolean") {
28168
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_2094["totalCostEstimated"], path: ["message"].concat("payload").concat("entries").concat(__i_1994).concat("agent").concat("lastUsage").concat("totalCostEstimated") });
28169
+ }
28170
+ }
28131
28171
  if (__o_2094["contextWindowMaxTokens"] !== undefined) {
28132
28172
  if (typeof __o_2094["contextWindowMaxTokens"] !== "number") {
28133
28173
  _e.push({ code: "invalid_type", expected: "number", input: __o_2094["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("entries").concat(__i_1994).concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -33384,6 +33424,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
33384
33424
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_2367["totalCostUnavailable"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
33385
33425
  }
33386
33426
  }
33427
+ if (__o_2367["totalCostEstimated"] !== undefined) {
33428
+ if (typeof __o_2367["totalCostEstimated"] !== "boolean") {
33429
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_2367["totalCostEstimated"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostEstimated") });
33430
+ }
33431
+ }
33387
33432
  if (__o_2367["contextWindowMaxTokens"] !== undefined) {
33388
33433
  if (typeof __o_2367["contextWindowMaxTokens"] !== "number") {
33389
33434
  _e.push({ code: "invalid_type", expected: "number", input: __o_2367["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -35136,6 +35181,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
35136
35181
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_2490["totalCostUnavailable"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
35137
35182
  }
35138
35183
  }
35184
+ if (__o_2490["totalCostEstimated"] !== undefined) {
35185
+ if (typeof __o_2490["totalCostEstimated"] !== "boolean") {
35186
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_2490["totalCostEstimated"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostEstimated") });
35187
+ }
35188
+ }
35139
35189
  if (__o_2490["contextWindowMaxTokens"] !== undefined) {
35140
35190
  if (typeof __o_2490["contextWindowMaxTokens"] !== "number") {
35141
35191
  _e.push({ code: "invalid_type", expected: "number", input: __o_2490["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -49937,6 +49987,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
49937
49987
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_3550["totalCostUnavailable"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
49938
49988
  }
49939
49989
  }
49990
+ if (__o_3550["totalCostEstimated"] !== undefined) {
49991
+ if (typeof __o_3550["totalCostEstimated"] !== "boolean") {
49992
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_3550["totalCostEstimated"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostEstimated") });
49993
+ }
49994
+ }
49940
49995
  if (__o_3550["contextWindowMaxTokens"] !== undefined) {
49941
49996
  if (typeof __o_3550["contextWindowMaxTokens"] !== "number") {
49942
49997
  _e.push({ code: "invalid_type", expected: "number", input: __o_3550["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -51483,6 +51538,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
51483
51538
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_3655["totalCostUnavailable"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
51484
51539
  }
51485
51540
  }
51541
+ if (__o_3655["totalCostEstimated"] !== undefined) {
51542
+ if (typeof __o_3655["totalCostEstimated"] !== "boolean") {
51543
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_3655["totalCostEstimated"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostEstimated") });
51544
+ }
51545
+ }
51486
51546
  if (__o_3655["contextWindowMaxTokens"] !== undefined) {
51487
51547
  if (typeof __o_3655["contextWindowMaxTokens"] !== "number") {
51488
51548
  _e.push({ code: "invalid_type", expected: "number", input: __o_3655["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -53081,6 +53141,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
53081
53141
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_3768["totalCostUnavailable"], path: ["message"].concat("payload").concat("agents").concat(__i_3669).concat("lastUsage").concat("totalCostUnavailable") });
53082
53142
  }
53083
53143
  }
53144
+ if (__o_3768["totalCostEstimated"] !== undefined) {
53145
+ if (typeof __o_3768["totalCostEstimated"] !== "boolean") {
53146
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_3768["totalCostEstimated"], path: ["message"].concat("payload").concat("agents").concat(__i_3669).concat("lastUsage").concat("totalCostEstimated") });
53147
+ }
53148
+ }
53084
53149
  if (__o_3768["contextWindowMaxTokens"] !== undefined) {
53085
53150
  if (typeof __o_3768["contextWindowMaxTokens"] !== "number") {
53086
53151
  _e.push({ code: "invalid_type", expected: "number", input: __o_3768["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("agents").concat(__i_3669).concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -54617,6 +54682,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
54617
54682
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_3873["totalCostUnavailable"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
54618
54683
  }
54619
54684
  }
54685
+ if (__o_3873["totalCostEstimated"] !== undefined) {
54686
+ if (typeof __o_3873["totalCostEstimated"] !== "boolean") {
54687
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_3873["totalCostEstimated"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostEstimated") });
54688
+ }
54689
+ }
54620
54690
  if (__o_3873["contextWindowMaxTokens"] !== undefined) {
54621
54691
  if (typeof __o_3873["contextWindowMaxTokens"] !== "number") {
54622
54692
  _e.push({ code: "invalid_type", expected: "number", input: __o_3873["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -56918,6 +56988,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
56918
56988
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_4016["totalCostUnavailable"], path: ["message"].concat("payload").concat("creation").concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
56919
56989
  }
56920
56990
  }
56991
+ if (__o_4016["totalCostEstimated"] !== undefined) {
56992
+ if (typeof __o_4016["totalCostEstimated"] !== "boolean") {
56993
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_4016["totalCostEstimated"], path: ["message"].concat("payload").concat("creation").concat("agent").concat("lastUsage").concat("totalCostEstimated") });
56994
+ }
56995
+ }
56921
56996
  if (__o_4016["contextWindowMaxTokens"] !== undefined) {
56922
56997
  if (typeof __o_4016["contextWindowMaxTokens"] !== "number") {
56923
56998
  _e.push({ code: "invalid_type", expected: "number", input: __o_4016["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("creation").concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -59251,6 +59326,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
59251
59326
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_4159["totalCostUnavailable"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
59252
59327
  }
59253
59328
  }
59329
+ if (__o_4159["totalCostEstimated"] !== undefined) {
59330
+ if (typeof __o_4159["totalCostEstimated"] !== "boolean") {
59331
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_4159["totalCostEstimated"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostEstimated") });
59332
+ }
59333
+ }
59254
59334
  if (__o_4159["contextWindowMaxTokens"] !== undefined) {
59255
59335
  if (typeof __o_4159["contextWindowMaxTokens"] !== "number") {
59256
59336
  _e.push({ code: "invalid_type", expected: "number", input: __o_4159["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -61557,6 +61637,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
61557
61637
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_4302["totalCostUnavailable"], path: ["message"].concat("payload").concat("creation").concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
61558
61638
  }
61559
61639
  }
61640
+ if (__o_4302["totalCostEstimated"] !== undefined) {
61641
+ if (typeof __o_4302["totalCostEstimated"] !== "boolean") {
61642
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_4302["totalCostEstimated"], path: ["message"].concat("payload").concat("creation").concat("agent").concat("lastUsage").concat("totalCostEstimated") });
61643
+ }
61644
+ }
61560
61645
  if (__o_4302["contextWindowMaxTokens"] !== undefined) {
61561
61646
  if (typeof __o_4302["contextWindowMaxTokens"] !== "number") {
61562
61647
  _e.push({ code: "invalid_type", expected: "number", input: __o_4302["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("creation").concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -63900,6 +63985,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
63900
63985
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_4446["totalCostUnavailable"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
63901
63986
  }
63902
63987
  }
63988
+ if (__o_4446["totalCostEstimated"] !== undefined) {
63989
+ if (typeof __o_4446["totalCostEstimated"] !== "boolean") {
63990
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_4446["totalCostEstimated"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostEstimated") });
63991
+ }
63992
+ }
63903
63993
  if (__o_4446["contextWindowMaxTokens"] !== undefined) {
63904
63994
  if (typeof __o_4446["contextWindowMaxTokens"] !== "number") {
63905
63995
  _e.push({ code: "invalid_type", expected: "number", input: __o_4446["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -66245,6 +66335,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
66245
66335
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_4590["totalCostUnavailable"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
66246
66336
  }
66247
66337
  }
66338
+ if (__o_4590["totalCostEstimated"] !== undefined) {
66339
+ if (typeof __o_4590["totalCostEstimated"] !== "boolean") {
66340
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_4590["totalCostEstimated"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("totalCostEstimated") });
66341
+ }
66342
+ }
66248
66343
  if (__o_4590["contextWindowMaxTokens"] !== undefined) {
66249
66344
  if (typeof __o_4590["contextWindowMaxTokens"] !== "number") {
66250
66345
  _e.push({ code: "invalid_type", expected: "number", input: __o_4590["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -68604,6 +68699,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
68604
68699
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_4735["totalCostUnavailable"], path: ["message"].concat("payload").concat("snapshot").concat("agent").concat("lastUsage").concat("totalCostUnavailable") });
68605
68700
  }
68606
68701
  }
68702
+ if (__o_4735["totalCostEstimated"] !== undefined) {
68703
+ if (typeof __o_4735["totalCostEstimated"] !== "boolean") {
68704
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_4735["totalCostEstimated"], path: ["message"].concat("payload").concat("snapshot").concat("agent").concat("lastUsage").concat("totalCostEstimated") });
68705
+ }
68706
+ }
68607
68707
  if (__o_4735["contextWindowMaxTokens"] !== undefined) {
68608
68708
  if (typeof __o_4735["contextWindowMaxTokens"] !== "number") {
68609
68709
  _e.push({ code: "invalid_type", expected: "number", input: __o_4735["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("snapshot").concat("agent").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -74041,6 +74141,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
74041
74141
  _e.push({ code: "invalid_type", expected: "boolean", input: __o_5171["totalCostUnavailable"], path: ["message"].concat("payload").concat("final").concat("lastUsage").concat("totalCostUnavailable") });
74042
74142
  }
74043
74143
  }
74144
+ if (__o_5171["totalCostEstimated"] !== undefined) {
74145
+ if (typeof __o_5171["totalCostEstimated"] !== "boolean") {
74146
+ _e.push({ code: "invalid_type", expected: "boolean", input: __o_5171["totalCostEstimated"], path: ["message"].concat("payload").concat("final").concat("lastUsage").concat("totalCostEstimated") });
74147
+ }
74148
+ }
74044
74149
  if (__o_5171["contextWindowMaxTokens"] !== undefined) {
74045
74150
  if (typeof __o_5171["contextWindowMaxTokens"] !== "number") {
74046
74151
  _e.push({ code: "invalid_type", expected: "number", input: __o_5171["contextWindowMaxTokens"], path: ["message"].concat("payload").concat("final").concat("lastUsage").concat("contextWindowMaxTokens") });
@@ -255,6 +255,7 @@ const AgentUsageSchema = z.object({
255
255
  outputTokens: z.number().optional(),
256
256
  totalCostUsd: z.number().optional(),
257
257
  totalCostUnavailable: z.boolean().optional(),
258
+ totalCostEstimated: z.boolean().optional(),
258
259
  contextWindowMaxTokens: z.number().optional(),
259
260
  contextWindowUsedTokens: z.number().optional(),
260
261
  });
@@ -1570,6 +1571,8 @@ export const AgentTurnDiffsListRequestMessageSchema = z.object({
1570
1571
  export const AgentTurnDiffTargetSchema = z.discriminatedUnion("kind", [
1571
1572
  z.object({ kind: z.literal("turn"), turnId: z.string() }),
1572
1573
  z.object({ kind: z.literal("last_turn") }),
1574
+ // COMPAT(turnDiffSession): added in v0.11.0-beta.3, remove after 2027-01-04. The daemon no longer
1575
+ // serves Chat Session diffs; older clients still send this target.
1573
1576
  z.object({ kind: z.literal("session") }),
1574
1577
  ]);
1575
1578
  export const AgentTurnDiffsGetDiffRequestMessageSchema = z.object({
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/protocol",
3
- "version": "0.11.0-fork.1",
3
+ "version": "0.11.0-fork.2",
4
4
  "description": "Paseo shared protocol schemas and wire types",
5
5
  "files": [
6
6
  "dist",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/relay",
3
- "version": "0.11.0-fork.1",
3
+ "version": "0.11.0-fork.2",
4
4
  "description": "Paseo relay for bridging daemon and client connections",
5
5
  "files": [
6
6
  "dist",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/builtin-plugins",
3
- "version": "0.11.0-fork.1",
3
+ "version": "0.11.0-fork.2",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -12,7 +12,7 @@ import { type ForegroundTurnWaiter } from "./agent-run-state.js";
12
12
  import { type RewindMode } from "./rewind/rewind.js";
13
13
  import type { PaseoToolCatalogFactory } from "./tools/types.js";
14
14
  import { type ProviderSubagentDescriptor, type ProviderSubagentStoreEvent } from "./provider-subagents/store.js";
15
- import type { WorkingTreeSnapshot } from "./turn-diffs/snapshot.js";
15
+ import type { TurnStartSnapshot } from "./turn-diffs/snapshot.js";
16
16
  import type { TurnDiffStore } from "./turn-diffs/store.js";
17
17
  export declare class AgentManagerShuttingDownError extends Error {
18
18
  constructor();
@@ -160,7 +160,7 @@ export type AttentionState = {
160
160
  };
161
161
  interface PendingTurnDiff {
162
162
  turnId: string;
163
- start: WorkingTreeSnapshot;
163
+ start: TurnStartSnapshot;
164
164
  clientMessageId?: string;
165
165
  }
166
166
  interface ManagedAgentBase {
@@ -383,6 +383,9 @@ function sanitizeUsage(value) {
383
383
  if (typeof sanitized.totalCostUnavailable === "boolean") {
384
384
  result.totalCostUnavailable = sanitized.totalCostUnavailable;
385
385
  }
386
+ if (typeof sanitized.totalCostEstimated === "boolean") {
387
+ result.totalCostEstimated = sanitized.totalCostEstimated;
388
+ }
386
389
  return Object.keys(result).length ? result : undefined;
387
390
  }
388
391
  function sanitizeRuntimeInfo(runtimeInfo) {
@@ -176,10 +176,12 @@ export interface AgentUsage {
176
176
  totalCostUsd?: number;
177
177
  /** The provider can estimate cost, but its price list could not be loaded. */
178
178
  totalCostUnavailable?: boolean;
179
+ /** Paseo priced the provider's token counts itself; the provider reports no cost. */
180
+ totalCostEstimated?: boolean;
179
181
  contextWindowMaxTokens?: number;
180
182
  contextWindowUsedTokens?: number;
181
183
  }
182
- export type AgentUsageNumericField = Exclude<keyof AgentUsage, "totalCostUnavailable">;
184
+ export type AgentUsageNumericField = Exclude<keyof AgentUsage, "totalCostUnavailable" | "totalCostEstimated">;
183
185
  export declare const TOOL_CALL_ICON_NAMES: readonly ["wrench", "square_terminal", "eye", "pencil", "search", "bot", "sparkles", "brain", "mic_vocal"];
184
186
  export type ToolCallIconName = (typeof TOOL_CALL_ICON_NAMES)[number];
185
187
  export type ToolCallDetail = {
@@ -88,6 +88,7 @@ declare const STORED_AGENT_SCHEMA: z.ZodObject<{
88
88
  outputTokens: z.ZodOptional<z.ZodNumber>;
89
89
  totalCostUsd: z.ZodOptional<z.ZodNumber>;
90
90
  totalCostUnavailable: z.ZodOptional<z.ZodBoolean>;
91
+ totalCostEstimated: z.ZodOptional<z.ZodBoolean>;
91
92
  contextWindowMaxTokens: z.ZodOptional<z.ZodNumber>;
92
93
  contextWindowUsedTokens: z.ZodOptional<z.ZodNumber>;
93
94
  }, z.core.$strip>>;
@@ -39,6 +39,7 @@ const STORED_USAGE_SCHEMA = z.object({
39
39
  outputTokens: z.number().optional(),
40
40
  totalCostUsd: z.number().optional(),
41
41
  totalCostUnavailable: z.boolean().optional(),
42
+ totalCostEstimated: z.boolean().optional(),
42
43
  contextWindowMaxTokens: z.number().optional(),
43
44
  contextWindowUsedTokens: z.number().optional(),
44
45
  });
@@ -0,0 +1,5 @@
1
+ /** Subtitle parts that every provider formats the same way. */
2
+ export declare function formatSubagentTokens(totalTokens: number | undefined): string | undefined;
3
+ /** Rounded like the app's session cost, and marked as an estimate from list prices. */
4
+ export declare function formatSubagentCost(costUsd: number | undefined): string | undefined;
5
+ //# sourceMappingURL=subtitle-format.d.ts.map
@@ -0,0 +1,16 @@
1
+ /** Subtitle parts that every provider formats the same way. */
2
+ export function formatSubagentTokens(totalTokens) {
3
+ if (typeof totalTokens !== "number" || totalTokens <= 0)
4
+ return undefined;
5
+ if (totalTokens < 1000)
6
+ return `${Math.round(totalTokens)} tokens`;
7
+ return `${Math.round(totalTokens / 100) / 10}k tokens`;
8
+ }
9
+ /** Rounded like the app's session cost, and marked as an estimate from list prices. */
10
+ export function formatSubagentCost(costUsd) {
11
+ if (typeof costUsd !== "number" || !Number.isFinite(costUsd) || costUsd <= 0)
12
+ return undefined;
13
+ const amount = costUsd < 0.01 ? costUsd.toFixed(4) : costUsd.toFixed(2);
14
+ return `$${amount} (est.)`;
15
+ }
16
+ //# sourceMappingURL=subtitle-format.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Reads a file that a provider keeps appending to, one complete line at a time.
3
+ * Each read parses only the bytes appended since the previous read, and reads run one at a time so
4
+ * a line is never handed out twice.
5
+ */
6
+ export declare class AppendedLinesReader {
7
+ private readonly filePath;
8
+ private offset;
9
+ private readonly decoder;
10
+ private pendingLine;
11
+ private queue;
12
+ constructor(filePath: string);
13
+ /** Passes each line completed since the previous read to `onLine`. */
14
+ read(onLine: (line: string) => void): Promise<void>;
15
+ private readAppended;
16
+ }
17
+ export declare function parseRecordLine(line: string): Record<string, unknown> | undefined;
18
+ export declare function toRecord(value: unknown): Record<string, unknown> | undefined;
19
+ export declare function readCount(value: unknown): number;
20
+ //# sourceMappingURL=appended-lines-reader.d.ts.map
@@ -0,0 +1,59 @@
1
+ import fs from "node:fs/promises";
2
+ import { StringDecoder } from "node:string_decoder";
3
+ /**
4
+ * Reads a file that a provider keeps appending to, one complete line at a time.
5
+ * Each read parses only the bytes appended since the previous read, and reads run one at a time so
6
+ * a line is never handed out twice.
7
+ */
8
+ export class AppendedLinesReader {
9
+ constructor(filePath) {
10
+ this.filePath = filePath;
11
+ this.offset = 0;
12
+ this.decoder = new StringDecoder("utf8");
13
+ this.pendingLine = "";
14
+ this.queue = Promise.resolve();
15
+ }
16
+ /** Passes each line completed since the previous read to `onLine`. */
17
+ read(onLine) {
18
+ const result = this.queue.then(() => this.readAppended(onLine));
19
+ this.queue = result.catch(() => undefined);
20
+ return result;
21
+ }
22
+ async readAppended(onLine) {
23
+ const handle = await fs.open(this.filePath, "r");
24
+ try {
25
+ const { size } = await handle.stat();
26
+ if (size <= this.offset)
27
+ return;
28
+ const buffer = Buffer.alloc(size - this.offset);
29
+ const { bytesRead } = await handle.read(buffer, 0, buffer.length, this.offset);
30
+ this.offset += bytesRead;
31
+ const lines = (this.pendingLine + this.decoder.write(buffer.subarray(0, bytesRead))).split("\n");
32
+ this.pendingLine = lines.pop() ?? "";
33
+ for (const line of lines) {
34
+ onLine(line);
35
+ }
36
+ }
37
+ finally {
38
+ await handle.close();
39
+ }
40
+ }
41
+ }
42
+ export function parseRecordLine(line) {
43
+ try {
44
+ return toRecord(JSON.parse(line));
45
+ }
46
+ catch {
47
+ // A torn or foreign line only drops that line from an estimate.
48
+ return undefined;
49
+ }
50
+ }
51
+ export function toRecord(value) {
52
+ return typeof value === "object" && value !== null && !Array.isArray(value)
53
+ ? value
54
+ : undefined;
55
+ }
56
+ export function readCount(value) {
57
+ return typeof value === "number" && Number.isFinite(value) ? value : 0;
58
+ }
59
+ //# sourceMappingURL=appended-lines-reader.js.map