@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
@@ -3,9 +3,42 @@ interface LivePriceData {
3
3
  change: number;
4
4
  trend: 'up' | 'down' | 'flat';
5
5
  }
6
+ /**
7
+ * The feed's own state, which nothing used to be able to see.
8
+ *
9
+ * MarketDataService already tracked `isConnected` and `isAuthenticated`, and
10
+ * both were private. When the Alpaca socket failed the store simply stopped
11
+ * receiving prices and every row kept its last number — a frozen price and a
12
+ * live one render identically, so there was no way to tell a quiet market from
13
+ * a dead feed.
14
+ *
15
+ * On 2026-09-23 that turned out to be hiding a specific, actionable error:
16
+ * Alpaca's free tier allows one concurrent stream per account, and a second
17
+ * client elsewhere was holding it, so every connection from the browser got
18
+ * `[406] connection limit exceeded`. The service logged it to the console and
19
+ * threw it away. It had been diagnosable in about a minute, and invisible for
20
+ * however long it had been happening.
21
+ *
22
+ * `lastError` keeps the code as well as the message, because the code is what
23
+ * separates "close your other tab" from "your key expired".
24
+ */
25
+ export type FeedStatus = 'idle' | 'connecting' | 'live' | 'error' | 'closed';
26
+ export interface FeedError {
27
+ code?: number;
28
+ msg: string;
29
+ }
30
+ export interface FeedState {
31
+ status: FeedStatus;
32
+ /** epoch ms of the last price actually applied, not the last socket frame. */
33
+ lastMessageAt: number | null;
34
+ lastError: FeedError | null;
35
+ }
6
36
  interface MarketDataState {
7
37
  livePrices: Record<string, LivePriceData>;
38
+ feed: FeedState;
8
39
  updatePrice: (ticker: string, newPrice: number) => void;
40
+ setFeedStatus: (status: FeedStatus) => void;
41
+ setFeedError: (error: FeedError) => void;
9
42
  _messageBuffer: {
10
43
  ticker: string;
11
44
  price: number;
@@ -1 +1 @@
1
- {"version":3,"file":"useMarketDataStore.d.ts","sourceRoot":"","sources":["../../../../src/stores/useMarketDataStore.ts"],"names":[],"mappings":"AAEA,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;CAC/B;AAED,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1C,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,cAAc,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACpD,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AA+CD,eAAO,MAAM,kBAAkB,8EAU5B,CAAC"}
1
+ {"version":3,"file":"useMarketDataStore.d.ts","sourceRoot":"","sources":["../../../../src/stores/useMarketDataStore.ts"],"names":[],"mappings":"AAEA,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,YAAY,GACZ,MAAM,GACN,OAAO,GACP,QAAQ,CAAC;AAEb,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,UAAU,CAAC;IACnB,8EAA8E;IAC9E,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;CAC7B;AAED,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1C,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,aAAa,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAC5C,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC,cAAc,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACpD,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAoDD,eAAO,MAAM,kBAAkB,8EAuB5B,CAAC"}
package/dist/server.es.js CHANGED
@@ -1,8 +1,8 @@
1
- import { C as d, a as E, H as O, J as y, K as G, n as _, L as T } from "./AiGateway-BmV6ypkd.js";
2
- import { k as J, w as b, A as k, i as x, g as L, o as M, z as Y, B as F, r as H, E as U, v as q, G as z, q as B, I as C, O as V, p as W, y as X, x as Q, R as Z, S as ee, T as te, W as ae, j as se, b as re } from "./AiGateway-BmV6ypkd.js";
1
+ import { M as u, a as E, N as O, Q as y, U as G, n as _, V as T } from "./AiGateway-ujqOJuoj.js";
2
+ import { l as J, C as L, A as M, j as b, h as k, v as x, L as U, H as Y, y as F, E as H, B as q, G as B, x as V, I as z, O as C, w as W, K as Q, J as X, R as Z, S as ee, T as te, W as ae, k as se, b as re, f as oe, r as ne, q as ce } from "./AiGateway-ujqOJuoj.js";
3
3
  import { streamText as w, generateObject as $ } from "ai";
4
4
  import { createGoogleGenerativeAI as S } from "@ai-sdk/google";
5
- function A(e) {
5
+ function h(e) {
6
6
  const a = typeof process < "u" ? process.env.GOOGLE_GENERATIVE_AI_API_KEY : void 0, s = e || a;
7
7
  if (!s)
8
8
  throw new Error(
@@ -25,7 +25,7 @@ const P = {
25
25
  * @param opts.apiKey - Optional client-provided key
26
26
  */
27
27
  async generateSchema(e) {
28
- const a = A(e.apiKey), s = S({ apiKey: a }), t = e.role ? d[e.role] : null, r = e.model ?? (t == null ? void 0 : t.model) ?? O, o = e.temperature ?? (t == null ? void 0 : t.temperature) ?? 0.3;
28
+ const a = h(e.apiKey), s = S({ apiKey: a }), t = e.role ? u[e.role] : null, r = e.model ?? (t == null ? void 0 : t.model) ?? O, o = e.temperature ?? (t == null ? void 0 : t.temperature) ?? 0.3;
29
29
  return (await $({
30
30
  model: s(r),
31
31
  schema: e.schema,
@@ -47,7 +47,7 @@ const P = {
47
47
  * @returns A Response object — directly return this from your route handler.
48
48
  */
49
49
  streamChatResponse(e) {
50
- const a = A(e.apiKey), s = S({ apiKey: a }), t = e.role ? d[e.role] : null, r = e.model ?? (t == null ? void 0 : t.model) ?? E, o = e.temperature ?? (t == null ? void 0 : t.temperature) ?? 0.5;
50
+ const a = h(e.apiKey), s = S({ apiKey: a }), t = e.role ? u[e.role] : null, r = e.model ?? (t == null ? void 0 : t.model) ?? E, o = e.temperature ?? (t == null ? void 0 : t.temperature) ?? 0.5;
51
51
  return w({
52
52
  model: s(r),
53
53
  messages: e.messages,
@@ -84,26 +84,26 @@ ${r}
84
84
  Request: ${e}`;
85
85
  let n = o, c = [];
86
86
  for (let l = 0; l <= t; l += 1) {
87
- const h = await s(n);
87
+ const A = await s(n);
88
88
  let p;
89
89
  try {
90
- p = JSON.parse(v(h));
90
+ p = JSON.parse(v(A));
91
91
  } catch {
92
92
  c = ["the reply was not JSON"], n = `${o}
93
93
 
94
94
  Your last reply was not valid JSON. Reply with the JSON object only.`;
95
95
  continue;
96
96
  }
97
- const u = _(p), i = T.safeParse(u.value);
98
- if (i.success && u.issues.length === 0)
99
- return { document: i.data, repairs: l };
97
+ const d = _(p), m = T.safeParse(d.value);
98
+ if (m.success && d.issues.length === 0)
99
+ return { document: m.data, repairs: l };
100
100
  c = [
101
- ...u.issues.map((m) => `${m.path.join(".") || "(root)"}: ${m.message}`),
102
- ...i.success ? [] : R(i.error)
101
+ ...d.issues.map((i) => `${i.path.join(".") || "(root)"}: ${i.message}`),
102
+ ...m.success ? [] : R(m.error)
103
103
  ], n = `${o}
104
104
 
105
105
  Your last reply did not validate:
106
- ${c.map((m) => `- ${m}`).join(`
106
+ ${c.map((i) => `- ${i}`).join(`
107
107
  `)}
108
108
  Here it is:
109
109
  ${JSON.stringify(p)}
@@ -118,30 +118,33 @@ Return the corrected JSON object only.`;
118
118
  };
119
119
  export {
120
120
  J as AGENT_ROSTER,
121
- b as ActionSchema,
122
- k as AiConfigResolver,
123
- x as AiGateway,
124
- L as AiGatewayService,
125
- M as AnthropicAdapter,
121
+ L as ActionSchema,
122
+ M as AiConfigResolver,
123
+ b as AiGateway,
124
+ k as AiGatewayService,
125
+ x as AnthropicAdapter,
126
126
  g as AppDocumentGenerationError,
127
- Y as AppSpecificationSchema,
128
- F as BlockSchema,
129
- H as DeepSeekAdapter,
130
- U as EntitySchema,
127
+ U as AppSpecificationSchema,
128
+ Y as BlockSchema,
129
+ F as DeepSeekAdapter,
130
+ H as EntitySchema,
131
131
  q as FieldSchema,
132
- z as GeminiAdapter,
133
- B as GrokAdapter,
134
- C as InMemoryRateLimiter,
132
+ B as GeminiAdapter,
133
+ V as GrokAdapter,
134
+ z as InMemoryRateLimiter,
135
135
  P as NeuralGateway,
136
- V as OllamaAdapter,
136
+ C as OllamaAdapter,
137
137
  W as OpenAIAdapter,
138
- X as PageSchema,
139
- Q as PageSectionSchema,
138
+ Q as PageSchema,
139
+ X as PageSectionSchema,
140
140
  Z as ResourceSchema,
141
141
  ee as SignalSchema,
142
142
  te as TriggerSchema,
143
143
  ae as WorkflowSchema,
144
144
  se as aiGateway,
145
145
  re as aiGatewayService,
146
- D as generateAppDocument
146
+ oe as decodeSpr,
147
+ ne as encodeSpr,
148
+ D as generateAppDocument,
149
+ ce as sprByteLength
147
150
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ramme-io/kernel",
3
- "version": "7.0.0",
3
+ "version": "7.2.0",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "type": "module",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@ai-sdk/google": ">=0.0.1",
31
- "@ramme-io/ui": ">=4.2.0",
31
+ "@ramme-io/ui": ">=4.2.1",
32
32
  "ai": ">=4.0.0",
33
33
  "react": ">=18.2.0",
34
34
  "react-dom": ">=18.2.0",
@@ -52,7 +52,7 @@
52
52
  "vite-plugin-dts": "^3.9.1",
53
53
  "vitest": "^2.1.9",
54
54
  "zod": "^3.23.8",
55
- "@ramme-io/ui": "4.2.0"
55
+ "@ramme-io/ui": "4.2.1"
56
56
  },
57
57
  "dependencies": {
58
58
  "@types/react-syntax-highlighter": "^15.5.13",
@@ -63,7 +63,7 @@
63
63
  "remark-gfm": "^4.0.1",
64
64
  "zod-to-json-schema": "^3.23.0",
65
65
  "zustand": "^5.0.0",
66
- "@ramme-io/shared": "3.1.2"
66
+ "@ramme-io/shared": "3.2.0"
67
67
  },
68
68
  "scripts": {
69
69
  "build": "vite build",