@ramme-io/kernel 7.0.0 → 7.2.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 (48) hide show
  1. package/dist/{AiGateway-BmV6ypkd.js → AiGateway-ujqOJuoj.js} +1203 -1071
  2. package/dist/index.es.js +5670 -5485
  3. package/dist/kernel/src/apps/quantize.d.ts +22 -1
  4. package/dist/kernel/src/apps/quantize.d.ts.map +1 -1
  5. package/dist/kernel/src/apps/quantize.test.d.ts +2 -0
  6. package/dist/kernel/src/apps/quantize.test.d.ts.map +1 -0
  7. package/dist/kernel/src/apps/spr.d.ts +55 -0
  8. package/dist/kernel/src/apps/spr.d.ts.map +1 -0
  9. package/dist/kernel/src/apps/spr.test.d.ts +2 -0
  10. package/dist/kernel/src/apps/spr.test.d.ts.map +1 -0
  11. package/dist/kernel/src/components/AIChatPanel.d.ts +32 -1
  12. package/dist/kernel/src/components/AIChatPanel.d.ts.map +1 -1
  13. package/dist/kernel/src/components/AIChatPanel.test.d.ts +2 -0
  14. package/dist/kernel/src/components/AIChatPanel.test.d.ts.map +1 -0
  15. package/dist/kernel/src/components/settings/AiSettingsPanel.d.ts +7 -0
  16. package/dist/kernel/src/components/settings/AiSettingsPanel.d.ts.map +1 -1
  17. package/dist/kernel/src/engine/runtime/useRammeAI.d.ts +10 -1
  18. package/dist/kernel/src/engine/runtime/useRammeAI.d.ts.map +1 -1
  19. package/dist/kernel/src/hooks/useAIKeyOrchestrator.d.ts.map +1 -1
  20. package/dist/kernel/src/index.d.ts +2 -0
  21. package/dist/kernel/src/index.d.ts.map +1 -1
  22. package/dist/kernel/src/renderers/AppDocumentRenderer.d.ts +22 -9
  23. package/dist/kernel/src/renderers/AppDocumentRenderer.d.ts.map +1 -1
  24. package/dist/kernel/src/renderers/AppDocumentRenderer.test.d.ts +2 -0
  25. package/dist/kernel/src/renderers/AppDocumentRenderer.test.d.ts.map +1 -0
  26. package/dist/kernel/src/renderers/AppImage.test.d.ts +2 -0
  27. package/dist/kernel/src/renderers/AppImage.test.d.ts.map +1 -0
  28. package/dist/kernel/src/server.d.ts +3 -0
  29. package/dist/kernel/src/server.d.ts.map +1 -1
  30. package/dist/kernel/src/services/MarketDataService.d.ts +5 -0
  31. package/dist/kernel/src/services/MarketDataService.d.ts.map +1 -1
  32. package/dist/kernel/src/services/ai/ConfigResolver.d.ts +23 -8
  33. package/dist/kernel/src/services/ai/ConfigResolver.d.ts.map +1 -1
  34. package/dist/kernel/src/services/ai/providers/AnthropicAdapter.d.ts +37 -0
  35. package/dist/kernel/src/services/ai/providers/AnthropicAdapter.d.ts.map +1 -1
  36. package/dist/kernel/src/services/ai/providers/AnthropicAdapter.test.d.ts +2 -0
  37. package/dist/kernel/src/services/ai/providers/AnthropicAdapter.test.d.ts.map +1 -0
  38. package/dist/kernel/src/services/ai/providers/openAiCompatibleStreamChat.d.ts +1 -1
  39. package/dist/kernel/src/services/ai/transport.d.ts +16 -1
  40. package/dist/kernel/src/services/ai/transport.d.ts.map +1 -1
  41. package/dist/kernel/src/services/marketSession.d.ts +33 -0
  42. package/dist/kernel/src/services/marketSession.d.ts.map +1 -0
  43. package/dist/kernel/src/services/marketSession.test.d.ts +14 -0
  44. package/dist/kernel/src/services/marketSession.test.d.ts.map +1 -0
  45. package/dist/kernel/src/stores/useMarketDataStore.d.ts +33 -0
  46. package/dist/kernel/src/stores/useMarketDataStore.d.ts.map +1 -1
  47. package/dist/server.es.js +32 -29
  48. package/package.json +4 -4
@@ -38,6 +38,27 @@ export interface QuantizeResult {
38
38
  /** One hex character per pixel, one line per row — feed to gridToSprite. */
39
39
  grid: string;
40
40
  }
41
+ export interface QuantizeOptions {
42
+ /**
43
+ * `'ordered'` scatters a fixed 4x4 pattern of small offsets over the picture
44
+ * before each pixel is matched to the palette, so a smooth area between two
45
+ * palette colours becomes a fine checker of both rather than a hard band.
46
+ * It is the look of an old game console or a GIF, which is what the owner
47
+ * asked photos on a board to look like (issue 214).
48
+ *
49
+ * Ordered (Bayer) rather than error diffusion (Floyd–Steinberg) on purpose:
50
+ * each pixel depends only on its own position, so the result is stable —
51
+ * moving the crop by one pixel does not reshuffle noise across the whole
52
+ * picture, and the same input always gives the same bytes, which the photo's
53
+ * hash depends on.
54
+ *
55
+ * The palette is chosen from the undithered picture either way; dithering
56
+ * only changes which entry each pixel is given.
57
+ */
58
+ dither?: 'none' | 'ordered';
59
+ /** How far the pattern pushes a channel, 0–255. Higher is grainier. Default 32. */
60
+ ditherStrength?: number;
61
+ }
41
62
  /**
42
63
  * Reduce an RGBA buffer to a small palette and a grid of indices.
43
64
  *
@@ -46,5 +67,5 @@ export interface QuantizeResult {
46
67
  * dropped: a sprite has no alpha channel, so transparency has to become a
47
68
  * colour, and entry 0 is the one a document is expected to use as its ground.
48
69
  */
49
- export declare const quantize: (rgba: Uint8ClampedArray | number[], width: number, height: number, maxColors?: number) => QuantizeResult;
70
+ export declare const quantize: (rgba: Uint8ClampedArray | number[], width: number, height: number, maxColors?: number, options?: QuantizeOptions) => QuantizeResult;
50
71
  //# sourceMappingURL=quantize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quantize.d.ts","sourceRoot":"","sources":["../../../../src/apps/quantize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,0EAA0E;AAC1E,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,MAAM,WAAW,cAAc;IAC7B,qEAAqE;IACrE,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;CACd;AAiCD;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GACnB,MAAM,iBAAiB,GAAG,MAAM,EAAE,EAClC,OAAO,MAAM,EACb,QAAQ,MAAM,EACd,kBAAc,KACb,cAuFF,CAAC"}
1
+ {"version":3,"file":"quantize.d.ts","sourceRoot":"","sources":["../../../../src/apps/quantize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,0EAA0E;AAC1E,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,MAAM,WAAW,cAAc;IAC7B,qEAAqE;IACrE,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,mFAAmF;IACnF,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAyCD;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GACnB,MAAM,iBAAiB,GAAG,MAAM,EAAE,EAClC,OAAO,MAAM,EACb,QAAQ,MAAM,EACd,kBAAc,EACd,UAAS,eAAoB,KAC5B,cAgGF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=quantize.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quantize.test.d.ts","sourceRoot":"","sources":["../../../../src/apps/quantize.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Reading and writing `.spr`, the file an image block names by hash.
3
+ *
4
+ * WHY THE PALETTE IS RGB565 IN THE FILE
5
+ *
6
+ * The panel is sixteen bits a pixel, so a colour on its way there loses the low
7
+ * bits of every channel. Storing RGB565 means that loss happens once, when the
8
+ * file is written, and the browser preview decodes the same sixteen bits the
9
+ * board pushes — rather than showing a smoother colour than the panel can make.
10
+ * The expansion back to eight bits (`r << 3 | r >> 2`) is the standard one and
11
+ * is what a screenshot of the panel would show.
12
+ *
13
+ * WHY IT REFUSES RATHER THAN REPAIRS
14
+ *
15
+ * A file arrives over the network into a fixed buffer on a board with no memory
16
+ * protection. `decodeSpr` answers every malformation with a reason and no
17
+ * pixels, never a best guess, because the board's reader must do the same and a
18
+ * preview that drew something the board refuses would be lying. Every check
19
+ * here has a twin in the firmware's reader.
20
+ *
21
+ * Pure: bytes in, data out. No canvas, so it runs under vitest in Node.
22
+ */
23
+ /** Eight-bit channels, as the browser draws them. */
24
+ export type Rgb = [number, number, number];
25
+ export interface SprImage {
26
+ width: number;
27
+ height: number;
28
+ /** Already through RGB565: the colours the panel will actually show. */
29
+ palette: Rgb[];
30
+ /** One palette index per pixel, row-major. */
31
+ indices: Uint8Array;
32
+ }
33
+ export type SprDecodeResult = {
34
+ ok: true;
35
+ image: SprImage;
36
+ } | {
37
+ ok: false;
38
+ reason: string;
39
+ };
40
+ export declare const toRgb565: ([r, g, b]: Rgb) => number;
41
+ export declare const fromRgb565: (c: number) => Rgb;
42
+ /** The exact length a file with these dimensions and palette must have. */
43
+ export declare const sprByteLength: (width: number, height: number, colors: number) => number;
44
+ /**
45
+ * Write a file. Throws on input no reader would accept, because a caller that
46
+ * hands this a 17-colour palette has a bug worth hearing about immediately.
47
+ */
48
+ export declare const encodeSpr: (image: {
49
+ width: number;
50
+ height: number;
51
+ palette: Rgb[];
52
+ indices: ArrayLike<number>;
53
+ }) => Uint8Array;
54
+ export declare const decodeSpr: (bytes: Uint8Array) => SprDecodeResult;
55
+ //# sourceMappingURL=spr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spr.d.ts","sourceRoot":"","sources":["../../../../src/apps/spr.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,qDAAqD;AACrD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3C,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,8CAA8C;IAC9C,OAAO,EAAE,UAAU,CAAC;CACrB;AAED,MAAM,MAAM,eAAe,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5F,eAAO,MAAM,QAAQ,GAAI,WAAW,GAAG,KAAG,MAAuD,CAAC;AAElG,eAAO,MAAM,UAAU,GAAI,GAAG,MAAM,KAAG,GAKtC,CAAC;AAIF,2EAA2E;AAC3E,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,EAAE,QAAQ,MAAM,KAAG,MACd,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,EAAE,CAAC;IAAC,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;CAAE,KAAG,UAwChH,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,UAAU,KAAG,eAuC7C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=spr.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spr.test.d.ts","sourceRoot":"","sources":["../../../../src/apps/spr.test.ts"],"names":[],"mappings":""}
@@ -1,5 +1,35 @@
1
1
  import { default as React } from 'react';
2
2
 
3
+ /** One message as the frame shows it. */
4
+ export interface PanelMessage {
5
+ role: 'user' | 'assistant' | 'system';
6
+ content: string;
7
+ }
8
+ export interface AIChatPanelFrameProps {
9
+ messages: PanelMessage[];
10
+ isStreaming: boolean;
11
+ onSubmit: (message: string) => void;
12
+ error?: string | null;
13
+ placeholder?: string;
14
+ /** Chips shown before the conversation starts. */
15
+ suggestions?: string[];
16
+ /** A short line while the assistant works — "Looking at your boards". */
17
+ status?: string | null;
18
+ /** Anything to show under the conversation, such as a card to confirm. */
19
+ footer?: React.ReactNode;
20
+ /** A link in an answer was clicked. Return true when it was handled. */
21
+ onLinkClick?: (href: string) => boolean;
22
+ }
23
+ /**
24
+ * The panel itself — position, open and close, window controls, the thread —
25
+ * with no opinion about where its conversation comes from.
26
+ *
27
+ * Split out of AIChatPanel so a product with its own conversation (the
28
+ * ramme.io assistant, whose answers are assembled on the server) can use the
29
+ * same panel instead of a copy of it. AIChatPanel below is this frame driven
30
+ * by useRammeAI, exactly as before.
31
+ */
32
+ export declare const AIChatPanelFrame: React.FC<AIChatPanelFrameProps>;
3
33
  export interface AIChatPanelProps {
4
34
  /**
5
35
  * Static system prompt, or a builder function called on every submit so
@@ -11,12 +41,13 @@ export interface AIChatPanelProps {
11
41
  /**
12
42
  * Transport mode.
13
43
  * - 'auto' (default) — 'local' in dev, 'proxy' in prod
14
- * - 'local' — direct browser-to-LLM (uses VITE_DEFAULT_*_KEY)
44
+ * - 'local' — direct browser-to-LLM, with the key the person saved in Settings
15
45
  * - 'proxy' — via serverless /api/ai/generate endpoint
16
46
  */
17
47
  transport?: 'local' | 'proxy' | 'auto';
18
48
  /** Override the proxy URL. Defaults to '/api/ai/generate'. */
19
49
  proxyUrl?: string;
20
50
  }
51
+ /** The frame, driven by useRammeAI — the kernel's own chat, unchanged. */
21
52
  export declare const AIChatPanel: React.FC<AIChatPanelProps>;
22
53
  //# sourceMappingURL=AIChatPanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AIChatPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/AIChatPanel.tsx"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAsB,MAAM,OAAO,CAAC;AA4D3C,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,YAAY,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;IACtC,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;IACvC,8DAA8D;IAC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AM,CAAC;IACvC,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAeD,0EAA0E;AAC1E,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA2BlD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AIChatPanel.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIChatPanel.test.d.ts","sourceRoot":"","sources":["../../../../src/components/AIChatPanel.test.tsx"],"names":[],"mappings":""}
@@ -1,10 +1,17 @@
1
1
  import { default as React } from 'react';
2
+ import { AiProvider } from '../../services/ai/types';
2
3
 
3
4
  export interface AiSettingsPanelProps {
4
5
  /** Fired after the user clicks Save with the new provider value. */
5
6
  onSaved?: () => void;
6
7
  /** Render as a compact inline section without the Card wrapper. */
7
8
  compact?: boolean;
9
+ /**
10
+ * Providers this deployment cannot reach, left out of the picker. A hosted
11
+ * build with no route to a local Ollama passes ['ollama'] rather than offer
12
+ * a choice that fails on the first message.
13
+ */
14
+ hiddenProviders?: AiProvider[];
8
15
  }
9
16
  export declare const AiSettingsPanel: React.FC<AiSettingsPanelProps>;
10
17
  //# sourceMappingURL=AiSettingsPanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AiSettingsPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/settings/AiSettingsPanel.tsx"],"names":[],"mappings":"AACA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAUnD,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAwQ1D,CAAC"}
1
+ {"version":3,"file":"AiSettingsPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/settings/AiSettingsPanel.tsx"],"names":[],"mappings":"AACA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAMnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI1D,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,eAAe,CAAC,EAAE,UAAU,EAAE,CAAC;CAChC;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAwQ1D,CAAC"}
@@ -21,9 +21,18 @@ export interface UseRammeAIConfig {
21
21
  */
22
22
  sessionKey?: string;
23
23
  }
24
+ /**
25
+ * A message a person can see. The transport's ChatMessage also has a `tool`
26
+ * role, for sending a tool's result back to the model on the server; this hook
27
+ * never creates one, so what it returns is always something a chat thread can
28
+ * render.
29
+ */
30
+ export type DisplayMessage = ChatMessage & {
31
+ role: 'user' | 'assistant' | 'system';
32
+ };
24
33
  export interface UseRammeAIReturn {
25
34
  /** Full conversation history, updated in real-time during streaming. */
26
- messages: ChatMessage[];
35
+ messages: DisplayMessage[];
27
36
  /** True while the model is actively streaming a response. */
28
37
  isStreaming: boolean;
29
38
  /** Error message from the last failed request, or null. */
@@ -1 +1 @@
1
- {"version":3,"file":"useRammeAI.d.ts","sourceRoot":"","sources":["../../../../../src/engine/runtime/useRammeAI.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAe,aAAa,EAAY,MAAM,6BAA6B,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAYxD,MAAM,WAAW,gBAAgB;IAC/B,iFAAiF;IACjF,SAAS,EAAE,aAAa,CAAC;I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zB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,oHAAoH;IACpH,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;CAAE,CAAC;AAErF,MAAM,WAAW,gBAAgB;IAC/B,wEAAwE;IACxE,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,6DAA6D;IAC7D,WAAW,EAAE,OAAO,CAAC;IACrB,2DAA2D;IAC3D,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,kFAAkF;IAClF,iBAAiB,EAAE,MAAM,CAAC;IAC1B,+EAA+E;IAC/E,cAAc,EAAE,MAAM,CAAC;IACvB,oFAAoF;IACpF,WAAW,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,gFAAgF;IAChF,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,wDAAwD;IACxD,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AA6FD,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAwMrE"}
@@ -1 +1 @@
1
- {"version":3,"file":"useAIKeyOrchestrator.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAIKeyOrchestrator.ts"],"names":[],"mappings":"AAaA,wBAAgB,oBAAoB;;;;;4BA8EH,MAAM;;;;+BA0BA,MAAM,GAAG,IAAI;EAsBnD"}
1
+ {"version":3,"file":"useAIKeyOrchestrator.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAIKeyOrchestrator.ts"],"names":[],"mappings":"AAeA,wBAAgB,oBAAoB;;;;;4BAiDH,MAAM;;;;+BA0BA,MAAM,GAAG,IAAI;EAsBnD"}
@@ -17,6 +17,7 @@ export * from './engine/runtime/useRammeAI';
17
17
  export * from './renderers/AppDocumentRenderer';
18
18
  export * from './apps/spriteGrid';
19
19
  export * from './apps/quantize';
20
+ export * from './apps/spr';
20
21
  export * from './stores/useAppStore';
21
22
  export * from './stores/useSettingsStore';
22
23
  export * from './stores/spatialStore';
@@ -35,6 +36,7 @@ export { generateToolSystemPrompt } from './services/ai/toolPromptGenerator';
35
36
  export { AiGateway, aiGateway } from './services/AiGateway';
36
37
  export * from './services/ai';
37
38
  export * from './services/MarketDataService';
39
+ export * from './services/marketSession';
38
40
  export type { AITransport, ChatMessage, TransportMode, ToolCall, ToolDefinitionWire, StreamEvent } from './services/ai/transport';
39
41
  export { LocalTransportAdapter } from './services/ai/adapters/LocalTransportAdapter';
40
42
  export { ProxyTransportAdapter } from './services/ai/adapters/ProxyTransportAdapter';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAOA,cAAc,iBAAiB,CAAC;AAOhC,cAAc,wBAAwB,CAAC;AAKvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAG7C,cAAc,iCAAiC,CAAC;AAGhD,cAAc,6BAA6B,CAAC;AAO5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mBAAmB,C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5C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,sBAAsB,CAAC;AAGrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAM7E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAG5D,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AAGzC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAClI,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAMrF,cAAc,4BAA4B,CAAC;AAE3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAK7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAK7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AAKpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AAKnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qCAAqC,CAAC;AAKpD,cAAc,0BAA0B,CAAC"}
@@ -2,16 +2,18 @@ import { default as React } from 'react';
2
2
  import { AppDocument, AppColor } from '../../../shared/index.ts';
3
3
 
4
4
  /**
5
- * A colour from the document, as something CSS can use.
5
+ * A colour as three channels, whichever form the document wrote it in.
6
6
  *
7
- * Tokens resolve to DEVICE_PALETTE — the firmware's own numbers — and not to
8
- * the theme variables the rest of the site uses. That looks like a violation
9
- * of the semantic-token rule and is the opposite: the board has one palette
10
- * burned into it and has never heard of `.blueprint`, so a preview wired to
11
- * `--app-accent-color` shows a different accent in each of the five themes
12
- * while the panel shows the same one every time. Predicting the panel means
13
- * using the panel's values.
7
+ * One parser, because two is exactly how every sprite came out blank. This
8
+ * function's CSS sibling below emits the space-separated form — `rgb(17 17 17)`,
9
+ * valid CSS and the format DEVICE_PALETTE stores — and SpriteCanvas used to
10
+ * re-parse that string with a comma-only pattern. It never matched, so every
11
+ * palette entry of every sprite fell through to one flat colour and every
12
+ * drawing painted as a solid block, in the one component whose whole purpose is
13
+ * to predict the panel exactly. Tokens and explicit "R G B" triplets both went
14
+ * the same way, so nothing about the document could avoid it.
14
15
  */
16
+ export declare const appColorRgb: (color: AppColor | undefined, fallback?: string) => [number, number, number];
15
17
  export declare const resolveAppColor: (color: AppColor | undefined, fallback?: string) => string;
16
18
  /**
17
19
  * Text as the panel will actually draw it.
@@ -24,15 +26,26 @@ export declare const resolveAppColor: (color: AppColor | undefined, fallback?: s
24
26
  export declare const deviceText: (input: string) => string;
25
27
  /** Data the document's bindings read from: { sourceName: { field: value } }. */
26
28
  export type AppData = Record<string, Record<string, unknown>>;
29
+ /**
30
+ * Fetches the bytes an image block names. Returns null when they are not there.
31
+ *
32
+ * A function the caller supplies rather than a URL this component knows,
33
+ * because the bytes come from different places: the Studio previews a photo it
34
+ * has just reduced, before it has been uploaded, and a saved document reads
35
+ * from the asset route. Without one, an image draws as an empty outline.
36
+ */
37
+ export type AssetLoader = (hash: string) => Promise<Uint8Array | null>;
27
38
  export interface AppDocumentRendererProps {
28
39
  document: AppDocument;
29
40
  /** Values the bindings read. Missing fields draw as the placeholder. */
30
41
  data?: AppData;
31
42
  /**
32
- * Display scale. 1 renders at true device size — 240x320 CSS pixels — which
43
+ * Display scale. 1 renders at true device size — 320x240 CSS pixels — which
33
44
  * is small on a desktop and exactly right for judging whether text fits.
34
45
  */
35
46
  scale?: number;
47
+ /** Where image blocks get their bytes. Without it they draw as outlines. */
48
+ loadAsset?: AssetLoader;
36
49
  className?: string;
37
50
  }
38
51
  export declare const AppDocumentRenderer: React.FC<AppDocumentRendererProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"AppDocumentRenderer.d.ts","sourceRoot":"","sources":["../../../../src/renderers/AppDocumentRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EACV,WAAW,EAGX,QAAQ,EAMT,MAAM,kBAAkB,CAAC;AA0D1B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,QAAQ,GAAG,SAAS,EAAE,iBAAuB,KAAG,MAKtF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,MAO9B,CAAC;AAEd,gFAAgF;AAChF,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AA4S9D,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,WAAW,CAAC;IACtB,wEAAwE;IACxE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAOD,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAsClE,CAAC"}
1
+ {"version":3,"file":"AppDocumentRenderer.d.ts","sourceRoot":"","sources":["../../../../src/renderers/AppDocumentRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EACV,WAAW,EAGX,QAAQ,EAMT,MAAM,kBAAkB,CAAC;AAyE1B;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,GACtB,OAAO,QAAQ,GAAG,SAAS,EAC3B,WAAU,MAAqB,KAC9B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CASzB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,OAAO,QAAQ,GAAG,SAAS,EAAE,iBAAuB,KAAG,MAGtF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,MAO9B,CAAC;AAEd,gFAAgF;AAChF,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAgJ9D;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;AA6PvE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,WAAW,CAAC;IACtB,wEAAwE;IACxE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAaD,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAyClE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AppDocumentRenderer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppDocumentRenderer.test.d.ts","sourceRoot":"","sources":["../../../../src/renderers/AppDocumentRenderer.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AppImage.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppImage.test.d.ts","sourceRoot":"","sources":["../../../../src/renderers/AppImage.test.tsx"],"names":[],"mappings":""}
@@ -39,6 +39,9 @@ export { AiGateway, aiGateway } from './services/AiGateway';
39
39
  export * from './engine/validation/schema';
40
40
  export * from './engine/types/manifest-types';
41
41
  export * from './engine/types/sitemap-entry';
42
+ export type { ChatMessage, StreamEvent, ToolCall, ToolDefinitionWire, } from './services/ai/transport';
42
43
  export type { AiProvider, AiModelConfig, AiProviderAdapter, AiResponse, AiConfigSource } from './services/ai/types';
43
44
  export type { RateLimitConfig } from './services/ai/RateLimiter';
45
+ export { decodeSpr, encodeSpr, sprByteLength } from './apps/spr';
46
+ export type { SprImage, SprDecodeResult, Rgb } from './apps/spr';
44
47
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAOjD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAIpF,OAAO,EACL,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAG1E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC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AC;AAC9C,cAAc,8BAA8B,CAAC;AAI7C,YAAY,EACV,WAAW,EACX,WAAW,EACX,QAAQ,EACR,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EACV,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,cAAc,EACf,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAIjE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACjE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC"}
@@ -10,6 +10,11 @@ declare class MarketDataService {
10
10
  private static instance;
11
11
  private constructor();
12
12
  static getInstance(): MarketDataService;
13
+ /**
14
+ * Credentials are passed in, never read from VITE_ALPACA_*: a VITE_ variable is
15
+ * copied into the browser bundle, and an Alpaca secret there is a brokerage
16
+ * credential on a public page. Fetch them from a server you control.
17
+ */
13
18
  connect(keyId?: string, secret?: string): void;
14
19
  private authenticate;
15
20
  subscribe(tickers: string[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"MarketDataService.d.ts","sourceRoot":"","sources":["../../../../src/services/MarketDataService.ts"],"names":[],"mappings":"AAcA,cAAM,iBAAiB;IACrB,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,iBAAiB,CAAgB;IACzC,OAAO,CAAC,mBAAmB,CAA8C;IACzE,OAAO,CAAC,iBAAiB,CAA+B;IACxD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAoB;IAE3C,OAAO;WAIO,WAAW,IAAI,iBAAiB;IAOvC,OAAO,CACZ,KAAK,GAAE,MAA2D,EAClE,MAAM,GAAE,MAA2D,GAClE,IAAI;IA+FP,OAAO,CAAC,YAAY;IAcb,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAuBlC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAgB3C,OAAO,CAAC,kBAAkB;IAmBnB,UAAU,IAAI,IAAI;IAsBlB,cAAc,IAAI,OAAO;IAIzB,oBAAoB,IAAI,MAAM,EAAE;CAGxC;AAED,eAAO,MAAM,iBAAiB,mBAAkC,CAAC"}
1
+ {"version":3,"file":"MarketDataService.d.ts","sourceRoot":"","sources":["../../../../src/services/MarketDataService.ts"],"names":[],"mappings":"AAcA,cAAM,iBAAiB;IACrB,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,iBAAiB,CAAgB;IACzC,OAAO,CAAC,mBAAmB,CAA8C;IACzE,OAAO,CAAC,iBAAiB,CAA+B;IACxD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAoB;IAE3C,OAAO;WAIO,WAAW,IAAI,iBAAiB;IAO9C;;;;OAIG;IACI,OAAO,CAAC,KAAK,GAAE,MAAW,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI;IAqH7D,OAAO,CAAC,YAAY;IAcb,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAuBlC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAgB3C,OAAO,CAAC,kBAAkB;IAmBnB,UAAU,IAAI,IAAI;IAsBlB,cAAc,IAAI,OAAO;IAIzB,oBAAoB,IAAI,MAAM,EAAE;CAGxC;AAED,eAAO,MAAM,iBAAiB,mBAAkC,CAAC"}
@@ -14,18 +14,33 @@ export declare class AiConfigResolver {
14
14
  */
15
15
  static loadUserConfig(): AiConfigSource | undefined;
16
16
  /**
17
- * Returns the env key for a specific provider — for REQUEST FLOW ONLY.
18
- * Never call this from UI components; use hasEnvKey() for status badges.
17
+ * A provider key from the environment — on a server only. Never in a browser.
18
+ *
19
+ * This used to read VITE_DEFAULT_<PROVIDER>_KEY, and on 2026-09-27 ramme.io's
20
+ * public JavaScript was found carrying live Anthropic, Google and OpenAI keys:
21
+ * Vite copies every VITE_ variable a browser build refers to into the bundle,
22
+ * and this read them through import.meta.env as a whole object, which inlines
23
+ * all of them. A key in the browser is a key anyone can copy. So in a browser
24
+ * this answers "no key", always; a browser that needs its own key gets it from
25
+ * the person, in Settings, and a product that wants a shared key keeps it on
26
+ * its server and proxies (ramme-marketing: lib/aiQuota.ts serverKeyFor).
27
+ *
28
+ * On a server it reads the unprefixed names — GEMINI_API_KEY and the rest —
29
+ * the same names ramme-marketing's routes use, and never a VITE_ or
30
+ * NEXT_PUBLIC_ one, both of which are browser-visible by design.
19
31
  */
20
32
  static getEnvKeyForProvider(provider: AiProvider): string | undefined;
21
- /**
22
- * Returns true if an env key exists for the given provider — boolean only,
23
- * value never exposed. Safe to call from UI components for status badges.
24
- */
33
+ /** Whether a server-side key exists for this provider. Always false in a browser. */
25
34
  static hasEnvKey(provider: AiProvider): boolean;
26
35
  /**
27
- * Load app defaults from environment variables
28
- * Note: This works differently in Vite vs Next.js
36
+ * App defaults that are safe to publish: which provider and model to start
37
+ * on, and where Ollama is. Never a key — see getEnvKeyForProvider.
38
+ *
39
+ * Each value is read as a single named property (import.meta.env.VITE_…),
40
+ * never through import.meta.env as a whole object: Vite replaces a named
41
+ * property with that one value, but replaces the whole object with every
42
+ * VITE_ variable the build can see — which is how keys nobody read by name
43
+ * still ended up in the bundle.
29
44
  */
30
45
  static loadAppDefaults(): AiConfigSource;
31
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigResolver.d.ts","sourceRoot":"","sources":["../../../../../src/services/ai/ConfigResolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEpE,qBAAa,gBAAgB;IAC3B;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CACZ,YAAY,CAAC,EAAE,cAAc,EAC7B,WAAW,CAAC,EAAE,cAAc,GAC3B,aAAa;IAwBhB,OAAO,CAAC,MAAM,CAAC,eAAe;IAM9B;;OAEG;IACH,MAAM,CAAC,cAAc,IAAI,cAAc,GAAG,SAAS;IAWnD;;;OAGG;IACH,MAAM,CAAC,oBAAoB,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS;IA2BrE;;;OAGG;IACH,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,GAAG,OAAO;IAyB/C;;;OAGG;IACH,MAAM,CAAC,eAAe,IAAI,cAAc;CAoDzC"}
1
+ {"version":3,"file":"ConfigResolver.d.ts","sourceRoot":"","sources":["../../../../../src/services/ai/ConfigResolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEpE,qBAAa,gBAAgB;IAC3B;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CACZ,YAAY,CAAC,EAAE,cAAc,EAC7B,WAAW,CAAC,EAAE,cAAc,GAC3B,aAAa;IAwBhB,OAAO,CAAC,MAAM,CAAC,eAAe;IAM9B;;OAEG;IACH,MAAM,CAAC,cAAc,IAAI,cAAc,GAAG,SAAS;IAWnD;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,oBAAoB,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS;IAarE,qFAAqF;IACrF,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,GAAG,OAAO;IAI/C;;;;;;;;;OASG;IACH,MAAM,CAAC,eAAe,IAAI,cAAc;CA0BzC"}
@@ -1,6 +1,42 @@
1
1
  import { AiProviderAdapter, AiModelConfig } from '../types';
2
2
  import { ChatMessage, StreamEvent, ToolDefinitionWire } from '../transport';
3
3
 
4
+ type AnthropicBlock = {
5
+ type: 'text';
6
+ text: string;
7
+ } | {
8
+ type: 'tool_use';
9
+ id: string;
10
+ name: string;
11
+ input: Record<string, unknown>;
12
+ } | {
13
+ type: 'tool_result';
14
+ tool_use_id: string;
15
+ content: string;
16
+ };
17
+ interface AnthropicMessage {
18
+ role: 'user' | 'assistant';
19
+ content: string | AnthropicBlock[];
20
+ }
21
+ /**
22
+ * A conversation in Anthropic's shape, including tool calls and their results.
23
+ *
24
+ * Until this existed every message went over as `{ role, content }`, so a tool's
25
+ * result had nowhere to go: a model could ask to look something up and never
26
+ * see the answer, and tool calling stopped at the first call.
27
+ *
28
+ * Two of the API's rules are enforced here rather than left to the caller:
29
+ *
30
+ * - A tool's result is a `tool_result` block in a USER message, keyed by the
31
+ * id of the `tool_use` it answers. There is no "tool" role on the wire.
32
+ * - Messages must alternate. When a model asks for two tools at once, both
33
+ * results must arrive in one user message — so adjacent messages from the
34
+ * same side are merged, block lists concatenated.
35
+ *
36
+ * The system prompt is not a message on this API; streamChat lifts it out
37
+ * before this runs.
38
+ */
39
+ export declare const toAnthropicMessages: (messages: ChatMessage[]) => AnthropicMessage[];
4
40
  export declare class AnthropicAdapter implements AiProviderAdapter {
5
41
  streamChat(messages: ChatMessage[], config: AiModelConfig, tools?: ToolDefinitionWire[]): AsyncIterable<StreamEvent>;
6
42
  generateText(prompt: string, config: AiModelConfig): Promise<string>;
@@ -24,4 +60,5 @@ export declare class AnthropicAdapter implements AiProviderAdapter {
24
60
  listModels(_apiKey?: string, _baseUrl?: string): Promise<string[]>;
25
61
  private normalizeError;
26
62
  }
63
+ export {};
27
64
  //# sourceMappingURL=AnthropicAdapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnthropicAdapter.d.ts","sourceRoot":"","sources":["../../../../../../src/services/ai/providers/AnthropicAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,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sources":["../../../../../../src/services/ai/providers/AnthropicAdapter.test.ts"],"names":[],"mappings":""}
@@ -10,7 +10,7 @@ export declare function buildOpenAiCompatibleTools(tools?: ToolDefinitionWire[])
10
10
  }[] | undefined;
11
11
  export declare function openAiCompatibleStreamChat(url: string, headers: Record<string, string>, body: Record<string, unknown>, normalizeError: (status: number, error: any) => Error): AsyncIterable<StreamEvent>;
12
12
  export declare function toOpenAiMessages(messages: ChatMessage[]): {
13
- role: "system" | "user" | "assistant";
13
+ role: "system" | "user" | "assistant" | "tool";
14
14
  content: string;
15
15
  }[];
16
16
  //# sourceMappingURL=openAiCompatibleStreamChat.d.ts.map
@@ -16,9 +16,24 @@ export interface ToolCall {
16
16
  * Extended to support tool calling for Generative UI.
17
17
  */
18
18
  export interface ChatMessage {
19
- role: 'user' | 'assistant' | 'system';
19
+ role: 'user' | 'assistant' | 'system' | 'tool';
20
20
  content: string;
21
21
  toolCall?: ToolCall;
22
+ /**
23
+ * Every tool the model asked for in this assistant turn, for sending the turn
24
+ * back on the next request. A model can ask for several at once, and each
25
+ * needs its id so its result can be matched to it.
26
+ */
27
+ toolCalls?: ToolCall[];
28
+ /**
29
+ * On a `tool` message: which call this is the result of. `content` is the
30
+ * result, as the model should read it (usually JSON text).
31
+ *
32
+ * Without this role a conversation could not carry a tool's answer back to
33
+ * the model, so tool calling stopped at the first call: the model could ask
34
+ * to look something up and never see what came back.
35
+ */
36
+ toolCallId?: string;
22
37
  }
23
38
  /**
24
39
  * A tool definition in wire format (JSON Schema `parameters`), as sent to a
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../../../src/services/ai/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,M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;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;OAMG;IACH,MAAM,CACJ,QAAQ,EAAE,WAAW,EAAE,EACvB,MAAM,EAAE,aAAa,EACrB,MAAM,CAAC,EAAE,WAAW,EACpB,KAAK,CAAC,EAAE,kBAAkB,EAAE,GAC3B,aAAa,CAAC,WAAW,CAAC,CAAC;CAC/B"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Which US equities session is it right now?
3
+ *
4
+ * A live price and a frozen one look identical on screen, so a page that
5
+ * streams quotes has to say which it is showing. Outside regular hours the
6
+ * Alpaca IEX feed goes quiet and every row keeps whatever number it last had —
7
+ * indistinguishable from a broken feed unless the page knows the market is
8
+ * closed and labels the figure "At Close".
9
+ *
10
+ * WHY Intl RATHER THAN AN OFFSET
11
+ *
12
+ * Market hours are defined in New York local time, and New York moves between
13
+ * EST and EDT. Subtracting a fixed 4 or 5 hours from UTC is right for about
14
+ * half the year and silently an hour wrong for the other half — worst around
15
+ * the open, where an hour decides whether the market is open at all. Intl
16
+ * resolves the zone for the actual instant, so the DST transition costs
17
+ * nothing.
18
+ *
19
+ * WHAT THIS DOES NOT KNOW
20
+ *
21
+ * Holidays. Thanksgiving, Good Friday and the early closes around Christmas
22
+ * and Independence Day will read as `open` here. Getting that right needs a
23
+ * calendar that has to be maintained, and a wrong calendar is worse than none
24
+ * because it would claim closure with the same confidence it claims anything
25
+ * else. The honest version of this function is one that knows the ordinary
26
+ * week and says so; callers wanting holiday accuracy should ask the broker,
27
+ * which is the only source that cannot drift.
28
+ */
29
+ export type MarketSession = 'pre' | 'open' | 'after' | 'closed';
30
+ export declare function marketSession(now?: Date): MarketSession;
31
+ /** Wording for a price when the market is not open, e.g. "At Close". */
32
+ export declare function priceQualifier(session: MarketSession): string | null;
33
+ //# sourceMappingURL=marketSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marketSession.d.ts","sourceRoot":"","sources":["../../../../src/services/marketSession.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAwBhE,wBAAgB,aAAa,CAAC,GAAG,GAAE,IAAiB,GAAG,aAAa,CAOnE;AAED,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAWpE"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Guards on the market session clock.
3
+ *
4
+ * These matter because the answer decides whether a number on screen is
5
+ * labelled live or "At Close", and a wrong label is worse than no label: it
6
+ * tells an operator a frozen price is current.
7
+ *
8
+ * Every case is expressed as a UTC instant, because that is what a browser
9
+ * actually holds. Writing them in New York local time would hide the one thing
10
+ * most likely to break — the DST offset — behind the same assumption the code
11
+ * is being tested for.
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=marketSession.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marketSession.test.d.ts","sourceRoot":"","sources":["../../../../src/services/marketSession.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}