@sriinnu/fiche 0.18.0-bootstrap.0 → 0.19.0

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 (196) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/LICENSE +22 -0
  3. package/NOTICE +13 -0
  4. package/PRIVACY.md +41 -0
  5. package/README.md +289 -0
  6. package/SECURITY.md +53 -0
  7. package/assets/JETBRAINS_MONO_LICENSE.txt +89 -0
  8. package/assets/SPLEEN_LICENSE.txt +24 -0
  9. package/assets/UNIFONT_LICENSE.txt +476 -0
  10. package/assets/fiche-logo-dark.svg +61 -0
  11. package/assets/fiche-logo-light.svg +61 -0
  12. package/assets/fiche-logo.svg +71 -0
  13. package/assets/fiche-mark.svg +48 -0
  14. package/bin/cli.js +7 -0
  15. package/bin/mcp.js +8 -0
  16. package/dist/calibrate.d.ts +30 -0
  17. package/dist/calibrate.js +588 -0
  18. package/dist/core/anthropic-vision.d.ts +28 -0
  19. package/dist/core/anthropic-vision.js +34 -0
  20. package/dist/core/applicability.d.ts +63 -0
  21. package/dist/core/applicability.js +151 -0
  22. package/dist/core/atlas-gray-jbmono10.d.ts +26 -0
  23. package/dist/core/atlas-gray-jbmono10.js +64 -0
  24. package/dist/core/atlas-gray-jbmono12.d.ts +26 -0
  25. package/dist/core/atlas-gray-jbmono12.js +64 -0
  26. package/dist/core/atlas-gray-jbmono14.d.ts +26 -0
  27. package/dist/core/atlas-gray-jbmono14.js +64 -0
  28. package/dist/core/atlas-gray.d.ts +26 -0
  29. package/dist/core/atlas-gray.js +64 -0
  30. package/dist/core/atlas-jbmono10.d.ts +34 -0
  31. package/dist/core/atlas-jbmono10.js +71 -0
  32. package/dist/core/atlas-jbmono12.d.ts +34 -0
  33. package/dist/core/atlas-jbmono12.js +71 -0
  34. package/dist/core/atlas-jbmono14.d.ts +34 -0
  35. package/dist/core/atlas-jbmono14.js +71 -0
  36. package/dist/core/atlas.d.ts +34 -0
  37. package/dist/core/atlas.js +71 -0
  38. package/dist/core/baseline.d.ts +121 -0
  39. package/dist/core/baseline.js +200 -0
  40. package/dist/core/calibration.d.ts +86 -0
  41. package/dist/core/calibration.js +547 -0
  42. package/dist/core/casi-delta.d.ts +63 -0
  43. package/dist/core/casi-delta.js +1271 -0
  44. package/dist/core/claude-model-profiles.d.ts +53 -0
  45. package/dist/core/claude-model-profiles.js +160 -0
  46. package/dist/core/client-tool-round.d.ts +31 -0
  47. package/dist/core/client-tool-round.js +58 -0
  48. package/dist/core/codex-cache.d.ts +20 -0
  49. package/dist/core/codex-cache.js +59 -0
  50. package/dist/core/context-mmu.d.ts +350 -0
  51. package/dist/core/context-mmu.js +3028 -0
  52. package/dist/core/cpt-fit.d.ts +70 -0
  53. package/dist/core/cpt-fit.js +197 -0
  54. package/dist/core/env.d.ts +8 -0
  55. package/dist/core/env.js +15 -0
  56. package/dist/core/export.d.ts +127 -0
  57. package/dist/core/export.js +385 -0
  58. package/dist/core/factsheet.d.ts +77 -0
  59. package/dist/core/factsheet.js +494 -0
  60. package/dist/core/gemini-model-profiles.d.ts +20 -0
  61. package/dist/core/gemini-model-profiles.js +134 -0
  62. package/dist/core/google.d.ts +76 -0
  63. package/dist/core/google.js +1380 -0
  64. package/dist/core/gpt-model-profiles.d.ts +218 -0
  65. package/dist/core/gpt-model-profiles.js +570 -0
  66. package/dist/core/gpt-tokens.d.ts +14 -0
  67. package/dist/core/gpt-tokens.js +165 -0
  68. package/dist/core/history.d.ts +197 -0
  69. package/dist/core/history.js +1003 -0
  70. package/dist/core/index.d.ts +16 -0
  71. package/dist/core/index.js +16 -0
  72. package/dist/core/library.d.ts +80 -0
  73. package/dist/core/library.js +131 -0
  74. package/dist/core/measurement.d.ts +34 -0
  75. package/dist/core/measurement.js +280 -0
  76. package/dist/core/messages-chat-bridge.d.ts +23 -0
  77. package/dist/core/messages-chat-bridge.js +747 -0
  78. package/dist/core/messages-responses-bridge.d.ts +11 -0
  79. package/dist/core/messages-responses-bridge.js +893 -0
  80. package/dist/core/openai-history.d.ts +184 -0
  81. package/dist/core/openai-history.js +1279 -0
  82. package/dist/core/openai-savings.d.ts +57 -0
  83. package/dist/core/openai-savings.js +116 -0
  84. package/dist/core/openai.d.ts +68 -0
  85. package/dist/core/openai.js +2523 -0
  86. package/dist/core/pin.d.ts +199 -0
  87. package/dist/core/pin.js +1353 -0
  88. package/dist/core/png.d.ts +14 -0
  89. package/dist/core/png.js +188 -0
  90. package/dist/core/prefix-tape.d.ts +102 -0
  91. package/dist/core/prefix-tape.js +315 -0
  92. package/dist/core/price-id.d.ts +10 -0
  93. package/dist/core/price-id.js +26 -0
  94. package/dist/core/prices.generated.d.ts +36 -0
  95. package/dist/core/prices.generated.js +369 -0
  96. package/dist/core/pricing.d.ts +134 -0
  97. package/dist/core/pricing.js +335 -0
  98. package/dist/core/profile-base.d.ts +30 -0
  99. package/dist/core/profile-base.js +67 -0
  100. package/dist/core/provider-router.d.ts +51 -0
  101. package/dist/core/provider-router.js +121 -0
  102. package/dist/core/proxy.d.ts +252 -0
  103. package/dist/core/proxy.js +2929 -0
  104. package/dist/core/reader-tier.d.ts +24 -0
  105. package/dist/core/reader-tier.js +118 -0
  106. package/dist/core/render.d.ts +280 -0
  107. package/dist/core/render.js +1302 -0
  108. package/dist/core/request-guard.d.ts +31 -0
  109. package/dist/core/request-guard.js +126 -0
  110. package/dist/core/request-transform.d.ts +43 -0
  111. package/dist/core/request-transform.js +173 -0
  112. package/dist/core/schema-compiler.d.ts +64 -0
  113. package/dist/core/schema-compiler.js +1696 -0
  114. package/dist/core/schema-strip.d.ts +29 -0
  115. package/dist/core/schema-strip.js +173 -0
  116. package/dist/core/session-state.d.ts +219 -0
  117. package/dist/core/session-state.js +929 -0
  118. package/dist/core/stage-plugins.d.ts +45 -0
  119. package/dist/core/stage-plugins.js +205 -0
  120. package/dist/core/text-history.d.ts +74 -0
  121. package/dist/core/text-history.js +612 -0
  122. package/dist/core/text-hygiene.d.ts +160 -0
  123. package/dist/core/text-hygiene.js +2259 -0
  124. package/dist/core/toon.d.ts +29 -0
  125. package/dist/core/toon.js +425 -0
  126. package/dist/core/tracker.d.ts +223 -0
  127. package/dist/core/tracker.js +290 -0
  128. package/dist/core/transform.d.ts +589 -0
  129. package/dist/core/transform.js +3153 -0
  130. package/dist/core/types.d.ts +87 -0
  131. package/dist/core/types.js +8 -0
  132. package/dist/core/upstream-hosts.d.ts +127 -0
  133. package/dist/core/upstream-hosts.js +398 -0
  134. package/dist/core/vision-cost.d.ts +63 -0
  135. package/dist/core/vision-cost.js +137 -0
  136. package/dist/dashboard/fragments.d.ts +87 -0
  137. package/dist/dashboard/fragments.js +1515 -0
  138. package/dist/dashboard/types.d.ts +217 -0
  139. package/dist/dashboard/types.js +3 -0
  140. package/dist/dashboard/vendor.d.ts +3 -0
  141. package/dist/dashboard/vendor.js +6 -0
  142. package/dist/dashboard.d.ts +372 -0
  143. package/dist/dashboard.js +2731 -0
  144. package/dist/export-collect.d.ts +36 -0
  145. package/dist/export-collect.js +59 -0
  146. package/dist/file-tracker.d.ts +42 -0
  147. package/dist/file-tracker.js +234 -0
  148. package/dist/kosha-sync.d.ts +74 -0
  149. package/dist/kosha-sync.js +272 -0
  150. package/dist/launchd-socket.d.ts +22 -0
  151. package/dist/launchd-socket.js +210 -0
  152. package/dist/mcp/cli.d.ts +2 -0
  153. package/dist/mcp/cli.js +55 -0
  154. package/dist/mcp/server.d.ts +48 -0
  155. package/dist/mcp/server.js +987 -0
  156. package/dist/mmu-store.d.ts +31 -0
  157. package/dist/mmu-store.js +179 -0
  158. package/dist/node-fetch.d.ts +22 -0
  159. package/dist/node-fetch.js +489 -0
  160. package/dist/node.d.ts +9 -0
  161. package/dist/node.js +244396 -0
  162. package/dist/request-decoding.d.ts +30 -0
  163. package/dist/request-decoding.js +85 -0
  164. package/dist/sessions.d.ts +179 -0
  165. package/dist/sessions.js +837 -0
  166. package/dist/stats.d.ts +114 -0
  167. package/dist/stats.js +439 -0
  168. package/dist/turn-report.d.ts +65 -0
  169. package/dist/turn-report.js +724 -0
  170. package/dist/warp/app-launch.d.ts +26 -0
  171. package/dist/warp/app-launch.js +155 -0
  172. package/dist/warp/ca.d.ts +74 -0
  173. package/dist/warp/ca.js +416 -0
  174. package/dist/warp/connect.d.ts +42 -0
  175. package/dist/warp/connect.js +686 -0
  176. package/dist/warp/der.d.ts +57 -0
  177. package/dist/warp/der.js +151 -0
  178. package/dist/warp/index.d.ts +79 -0
  179. package/dist/warp/index.js +650 -0
  180. package/dist/warp/resolve.d.ts +12 -0
  181. package/dist/warp/resolve.js +49 -0
  182. package/dist/warp/route.d.ts +71 -0
  183. package/dist/warp/route.js +134 -0
  184. package/dist/worker.d.ts +71 -0
  185. package/dist/worker.js +174 -0
  186. package/docs/SECURITY_MODEL.md +84 -0
  187. package/package.json +115 -3
  188. package/plugins/fiche-companion/README.md +42 -0
  189. package/plugins/fiche-companion/assets/logo.svg +48 -0
  190. package/plugins/fiche-companion/hooks.json +11 -0
  191. package/plugins/fiche-companion/mcp_config.json +8 -0
  192. package/plugins/fiche-companion/plugin.json +18 -0
  193. package/plugins/fiche-companion/scripts/claude-statusline.mjs +35 -0
  194. package/plugins/fiche-companion/scripts/post-invocation.mjs +122 -0
  195. package/plugins/fiche-companion/scripts/resolve-turn-report.mjs +132 -0
  196. package/plugins/fiche-companion/skills/fiche/SKILL.md +61 -0
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The ONE interpreter of image (vision) input-token cost.
3
+ *
4
+ * Every provider difference is DATA — a `GptVisionCost` regime on the model
5
+ * profile — never a branch on the model id. Adding a family means adding a
6
+ * profile (or an env override), not an `if (isFoo(model))` here or at a call
7
+ * site. Callers pass anything profile-shaped (`{ vision, visionTier }`), so the
8
+ * gate can price a hypothetical geometry with the same code that prices a real
9
+ * request.
10
+ *
11
+ * This module is a dependency leaf: it imports only types, so profile modules
12
+ * can use it without an import cycle through model resolution.
13
+ *
14
+ * Anthropic's 28-px patch geometry lives here too (it is one regime among
15
+ * several); `anthropic-vision.ts` is the documented, model-id-facing wrapper
16
+ * around it.
17
+ */
18
+ import type { GptVisionCost } from './gpt-model-profiles.js';
19
+ /** One visual token per 28×28-pixel patch. Also the Qwen2-VL grid; NOT OpenAI's
20
+ * 32-px patch / 512-px tile model — keep those on the OpenAI regimes. */
21
+ export declare const ANTHROPIC_PATCH_PX = 28;
22
+ export type AnthropicVisionTier = 'high-res' | 'standard';
23
+ export interface AnthropicVisionProfile {
24
+ readonly tier: AnthropicVisionTier;
25
+ /** Neither side may exceed this after downscale (px). */
26
+ readonly maxLongEdge: number;
27
+ /** ⌈w/28⌉×⌈h/28⌉ may not exceed this after downscale (visual tokens). */
28
+ readonly maxVisualTokens: number;
29
+ }
30
+ /**
31
+ * Anthropic's documented pre-billing downscale, tiered by model VERSION:
32
+ * | High-resolution | Claude 4.7 and later models | 2576 px | 4784 |
33
+ * | Standard | All other models | 1568 px | 1568 |
34
+ */
35
+ export declare const ANTHROPIC_TIERS: Record<AnthropicVisionTier, AnthropicVisionProfile>;
36
+ /** Raw 28-px patch count for a `w×h` image, i.e. the visual-token cost when the
37
+ * image already fits the tier limits (no downscale). `⌈w/28⌉` inherently pads
38
+ * the right/bottom edge up to the next 28-px multiple, as Anthropic documents. */
39
+ export declare function patchTokens(width: number, height: number): number;
40
+ /**
41
+ * Anthropic visual-token cost at `width×height` for a tier: the documented
42
+ * resize (largest aspect-preserving size fitting BOTH the long-edge limit and
43
+ * the visual-token budget, found by binary search exactly as Anthropic's
44
+ * reference `count_image_tokens`), then the 28-px patch count.
45
+ *
46
+ * Note: inkling's own pages are always ≤ 1568×728, so the resize never fires for
47
+ * proxy output (both tiers charge the raw patch count). The resize path is for
48
+ * correctness as a general-purpose estimator (e.g. arbitrary export input).
49
+ */
50
+ export declare function patchTokensForTier(tier: AnthropicVisionTier | undefined, width: number, height: number): number;
51
+ /** The profile fields that determine image cost. `GptModelProfile` satisfies
52
+ * this structurally, so a profile can be passed straight in. */
53
+ export interface VisionPricing {
54
+ readonly vision: GptVisionCost;
55
+ readonly visionTier?: AnthropicVisionTier;
56
+ }
57
+ /**
58
+ * Per-image input-token cost of a `width×height` render under `pricing`.
59
+ * This is the DOCUMENTED provider cost — any gate conservatism (safety margin)
60
+ * is applied by the gate, so this stays honest about what is actually charged.
61
+ */
62
+ export declare function visionTokens(pricing: VisionPricing, width: number, height: number): number;
63
+ //# sourceMappingURL=vision-cost.d.ts.map
@@ -0,0 +1,137 @@
1
+ /**
2
+ * The ONE interpreter of image (vision) input-token cost.
3
+ *
4
+ * Every provider difference is DATA — a `GptVisionCost` regime on the model
5
+ * profile — never a branch on the model id. Adding a family means adding a
6
+ * profile (or an env override), not an `if (isFoo(model))` here or at a call
7
+ * site. Callers pass anything profile-shaped (`{ vision, visionTier }`), so the
8
+ * gate can price a hypothetical geometry with the same code that prices a real
9
+ * request.
10
+ *
11
+ * This module is a dependency leaf: it imports only types, so profile modules
12
+ * can use it without an import cycle through model resolution.
13
+ *
14
+ * Anthropic's 28-px patch geometry lives here too (it is one regime among
15
+ * several); `anthropic-vision.ts` is the documented, model-id-facing wrapper
16
+ * around it.
17
+ */
18
+ /** One visual token per 28×28-pixel patch. Also the Qwen2-VL grid; NOT OpenAI's
19
+ * 32-px patch / 512-px tile model — keep those on the OpenAI regimes. */
20
+ export const ANTHROPIC_PATCH_PX = 28;
21
+ /** OpenAI's legacy tile model downscales to fit these boxes before tiling. */
22
+ const OPENAI_TILE_MAX_LONG_EDGE = 2048;
23
+ const OPENAI_TILE_MAX_SHORT_EDGE = 768;
24
+ const OPENAI_TILE_PX = 512;
25
+ /** OpenAI's current patch model. */
26
+ const OPENAI_PATCH_PX = 32;
27
+ /**
28
+ * Anthropic's documented pre-billing downscale, tiered by model VERSION:
29
+ * | High-resolution | Claude 4.7 and later models | 2576 px | 4784 |
30
+ * | Standard | All other models | 1568 px | 1568 |
31
+ */
32
+ export const ANTHROPIC_TIERS = {
33
+ 'high-res': { tier: 'high-res', maxLongEdge: 2576, maxVisualTokens: 4784 },
34
+ standard: { tier: 'standard', maxLongEdge: 1568, maxVisualTokens: 1568 },
35
+ };
36
+ /** Raw 28-px patch count for a `w×h` image, i.e. the visual-token cost when the
37
+ * image already fits the tier limits (no downscale). `⌈w/28⌉` inherently pads
38
+ * the right/bottom edge up to the next 28-px multiple, as Anthropic documents. */
39
+ export function patchTokens(width, height) {
40
+ const w = Math.max(1, Math.floor(width));
41
+ const h = Math.max(1, Math.floor(height));
42
+ return Math.ceil(w / ANTHROPIC_PATCH_PX) * Math.ceil(h / ANTHROPIC_PATCH_PX);
43
+ }
44
+ /** True when a `w×h` image fits a tier with no resize: both padded patch edges
45
+ * are within the long-edge limit AND the patch count is within the token
46
+ * budget. Mirrors the `fits` predicate in Anthropic's reference resize. */
47
+ function fitsTier(w, h, maxLongEdge, maxVisualTokens) {
48
+ return (Math.ceil(w / ANTHROPIC_PATCH_PX) * ANTHROPIC_PATCH_PX <= maxLongEdge &&
49
+ Math.ceil(h / ANTHROPIC_PATCH_PX) * ANTHROPIC_PATCH_PX <= maxLongEdge &&
50
+ patchTokens(w, h) <= maxVisualTokens);
51
+ }
52
+ /** Largest aspect-preserving size that fits the tier, exactly as Anthropic's
53
+ * reference does it: binary-search the long edge (short edge = round(long ×
54
+ * aspect)), recursing with a swap for portrait images. Original if it fits. */
55
+ function resizedSize(w, h, maxLongEdge, maxVisualTokens) {
56
+ if (fitsTier(w, h, maxLongEdge, maxVisualTokens))
57
+ return [w, h];
58
+ if (h > w) {
59
+ const [rh, rw] = resizedSize(h, w, maxLongEdge, maxVisualTokens);
60
+ return [rw, rh];
61
+ }
62
+ // Landscape (w ≥ h): binary-search the largest long edge that still fits.
63
+ const aspect = h / w;
64
+ let lo = 1;
65
+ let hi = w;
66
+ let best = 1;
67
+ while (lo <= hi) {
68
+ const mid = (lo + hi) >> 1;
69
+ if (fitsTier(mid, Math.max(1, Math.round(mid * aspect)), maxLongEdge, maxVisualTokens)) {
70
+ best = mid;
71
+ lo = mid + 1;
72
+ }
73
+ else {
74
+ hi = mid - 1;
75
+ }
76
+ }
77
+ return [best, Math.max(1, Math.round(best * aspect))];
78
+ }
79
+ /**
80
+ * Anthropic visual-token cost at `width×height` for a tier: the documented
81
+ * resize (largest aspect-preserving size fitting BOTH the long-edge limit and
82
+ * the visual-token budget, found by binary search exactly as Anthropic's
83
+ * reference `count_image_tokens`), then the 28-px patch count.
84
+ *
85
+ * Note: inkling's own pages are always ≤ 1568×728, so the resize never fires for
86
+ * proxy output (both tiers charge the raw patch count). The resize path is for
87
+ * correctness as a general-purpose estimator (e.g. arbitrary export input).
88
+ */
89
+ export function patchTokensForTier(tier, width, height) {
90
+ const { maxLongEdge, maxVisualTokens } = ANTHROPIC_TIERS[tier ?? 'standard'];
91
+ const w = Math.max(1, Math.floor(width));
92
+ const h = Math.max(1, Math.floor(height));
93
+ const [rw, rh] = resizedSize(w, h, maxLongEdge, maxVisualTokens);
94
+ return patchTokens(rw, rh);
95
+ }
96
+ /**
97
+ * Per-image input-token cost of a `width×height` render under `pricing`.
98
+ * This is the DOCUMENTED provider cost — any gate conservatism (safety margin)
99
+ * is applied by the gate, so this stays honest about what is actually charged.
100
+ */
101
+ export function visionTokens(pricing, width, height) {
102
+ const c = pricing.vision;
103
+ switch (c.regime) {
104
+ case 'patch28':
105
+ return patchTokensForTier(pricing.visionTier, width, height);
106
+ case 'patch': {
107
+ const rawPatches = Math.ceil(width / OPENAI_PATCH_PX) * Math.ceil(height / OPENAI_PATCH_PX);
108
+ const patches = c.patchCap === undefined ? rawPatches : Math.min(c.patchCap, rawPatches);
109
+ return Math.ceil(patches * c.multiplier);
110
+ }
111
+ case 'mpix': {
112
+ const pixels = Math.max(0, width) * Math.max(0, height);
113
+ return Math.max(1, Math.ceil((pixels / 1_000_000) * c.tokensPerMegapixel));
114
+ }
115
+ case 'flat':
116
+ return c.exact && width === c.exact.widthPx && height === c.exact.heightPx
117
+ ? c.exact.tokens
118
+ : c.tokens;
119
+ case 'tile': {
120
+ let w = Math.max(1, width), h = Math.max(1, height);
121
+ const long = Math.max(w, h);
122
+ if (long > OPENAI_TILE_MAX_LONG_EDGE) {
123
+ const r = OPENAI_TILE_MAX_LONG_EDGE / long;
124
+ w = Math.max(1, Math.floor(w * r));
125
+ h = Math.max(1, Math.floor(h * r));
126
+ }
127
+ const short = Math.min(w, h);
128
+ if (short > OPENAI_TILE_MAX_SHORT_EDGE) {
129
+ const r = OPENAI_TILE_MAX_SHORT_EDGE / short;
130
+ w = Math.max(1, Math.floor(w * r));
131
+ h = Math.max(1, Math.floor(h * r));
132
+ }
133
+ return c.base + c.perTile * (Math.ceil(w / OPENAI_TILE_PX) * Math.ceil(h / OPENAI_TILE_PX));
134
+ }
135
+ }
136
+ }
137
+ //# sourceMappingURL=vision-cost.js.map
@@ -0,0 +1,87 @@
1
+ import { type ProviderStatus } from '../core/upstream-hosts.js';
2
+ import type { StatsPayload, RecentPayload, SessionsPayload, FullStatsPayload } from './types.js';
3
+ export declare function escapeHtml(s: string | null | undefined): string;
4
+ export declare function renderToggleFragment(enabled: boolean): string;
5
+ export declare function renderModelsFragment(active: string[], configured: string[], enabled: boolean, providers?: readonly ProviderStatus[]): string;
6
+ /** Render server-driven 1-click controls for 3rd-party plugins, skills & extensions. */
7
+ export declare function renderPluginsFragment(plugins: ReadonlyArray<{
8
+ id: string;
9
+ name: string;
10
+ kind: string;
11
+ enabled: boolean;
12
+ }>): string;
13
+ export declare function renderSessionSummaryFragment(s: StatsPayload): string;
14
+ export declare function renderHeaderFragment(s: StatsPayload, port: number): string;
15
+ export interface ContextMapData {
16
+ id: number;
17
+ baselineTokens: number;
18
+ realInput: number;
19
+ baselineInputEff: number;
20
+ actualInputEff: number;
21
+ haveBaseline: boolean;
22
+ cacheRead: number;
23
+ warm: boolean;
24
+ output: number;
25
+ imageCount: number;
26
+ /** Image blocks the CLIENT sent. They spend from the provider's cap exactly
27
+ * like ours, so they explain a turn that compressed less than usual. */
28
+ nativeImages?: number;
29
+ /** Image blocks really on the wire. Lower than imageCount when the history
30
+ * collapse absorbed messages that already carried our images. */
31
+ wireImages?: number;
32
+ /** Imaging steps that degraded to text because the cap was full. */
33
+ imageBudgetSkips?: number;
34
+ baselineImagedTokens?: number;
35
+ buckets: Partial<Record<string, number>>;
36
+ imageIds: number[];
37
+ compressed: boolean;
38
+ model?: string;
39
+ responsesComposition?: {
40
+ instructions: number;
41
+ systemDeveloper: number;
42
+ userAssistant: number;
43
+ functionCalls: number;
44
+ functionOutputs: number;
45
+ reasoningEncrypted: number;
46
+ compactionOpaque: number;
47
+ toolsJson: number;
48
+ other: number;
49
+ totalLocal: number;
50
+ imageParts: number;
51
+ completedFunctionPairs?: number;
52
+ recentNativeFunctionPairs?: number;
53
+ oldFunctionPairs?: number;
54
+ openFunctionCalls?: number;
55
+ orphanFunctionOutputs?: number;
56
+ malformedFunctionItems?: number;
57
+ imageableFunctionCalls?: number;
58
+ imageableFunctionOutputs?: number;
59
+ collapsedFunctionPairs?: number;
60
+ collapsedFunctionCalls?: number;
61
+ collapsedFunctionOutputs?: number;
62
+ };
63
+ /** Difference between the provider text counterfactual and local o200k buckets.
64
+ * Can include envelope, tokenizer, and server-side additions. */
65
+ responsesUnexplainedTokens?: number;
66
+ restored?: boolean;
67
+ }
68
+ /** Image-vs-text breakdown for one request. */
69
+ export declare function renderContextMapFragment(c: ContextMapData | undefined, history?: ContextMapData[], notFound?: boolean): string;
70
+ export declare function renderRecentFragment(p: RecentPayload): string;
71
+ export interface LatestFragmentInput {
72
+ payload: RecentPayload;
73
+ pin: number | null;
74
+ showSource: boolean;
75
+ sourceText: string | null;
76
+ }
77
+ export declare function renderLatestFragment(inp: LatestFragmentInput): string;
78
+ export declare function renderAnalyticsFragment(s: StatsPayload): string;
79
+ export declare function renderSessionsFragment(p: SessionsPayload): string;
80
+ export declare function renderStatsTableFragment(p: FullStatsPayload): string;
81
+ export declare const FICHE_ICON_SVG: string;
82
+ /** `hostLabel` names the machine this proxy runs on. The dashboard is otherwise
83
+ * byte-identical across hosts, so a tab opened against a remote host through
84
+ * the tailnet front is indistinguishable from the local one - which is how a
85
+ * session gets read on the wrong box. Empty label = render as before. */
86
+ export declare function renderPage(port: number, hostLabel?: string): string;
87
+ //# sourceMappingURL=fragments.d.ts.map