@ramme-io/kernel 7.2.0 → 7.3.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.
- package/dist/AiGateway-Bdcl3v8h.js +2534 -0
- package/dist/bodewellAdapter-BzbeTSIP.js +214 -0
- package/dist/index-kBkq1FSR.js +1236 -0
- package/dist/index.es.js +3330 -3429
- package/dist/kernel/src/index.d.ts +1 -0
- package/dist/kernel/src/index.d.ts.map +1 -1
- package/dist/kernel/src/services/ai/providers/adapter-errors.test.d.ts +2 -0
- package/dist/kernel/src/services/ai/providers/adapter-errors.test.d.ts.map +1 -0
- package/dist/kernel/src/signals/bodewellAdapter.d.ts +142 -0
- package/dist/kernel/src/signals/bodewellAdapter.d.ts.map +1 -0
- package/dist/kernel/src/signals/bodewellAdapter.test.d.ts +2 -0
- package/dist/kernel/src/signals/bodewellAdapter.test.d.ts.map +1 -0
- package/dist/kernel/src/signals/index.d.ts +21 -0
- package/dist/kernel/src/signals/index.d.ts.map +1 -0
- package/dist/server.es.js +47 -45
- package/dist/signals.d.ts +1 -0
- package/dist/signals.es.js +13 -0
- package/package.json +8 -4
- package/dist/AiGateway-ujqOJuoj.js +0 -3740
|
@@ -24,6 +24,7 @@ export * from './stores/spatialStore';
|
|
|
24
24
|
export * from './stores/useMarketDataStore';
|
|
25
25
|
export { useSignalStore, selectSignalById, selectSignalsByDomain, selectSignalsBySource, } from './stores/useSignalStore';
|
|
26
26
|
export { BaseSignalAdapter } from './signals/BaseSignalAdapter';
|
|
27
|
+
export * from './signals/bodewellAdapter';
|
|
27
28
|
export type { AdapterStatus } from './signals/BaseSignalAdapter';
|
|
28
29
|
export * from './components/settings/AiSettingsPanel';
|
|
29
30
|
export { generateThemeWithAI } from './services/ai/generateThemeWithAI';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAOA,cAAc,iBAAiB,CAAC;A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;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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-errors.test.d.ts","sourceRoot":"","sources":["../../../../../../src/services/ai/providers/adapter-errors.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Signal } from '../../../shared/index.ts';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hardware field → abstract Signal key, with the unit the field is measured in.
|
|
5
|
+
*
|
|
6
|
+
* Every entry here is a hardware name that must NOT appear above this file.
|
|
7
|
+
* Aliases exist because the firmware sends two spellings for two of these:
|
|
8
|
+
* `humidity`/`air_humid` and `pressure`/`air_pressure` — both are in the shared
|
|
9
|
+
* schema, and both have been seen on the wire.
|
|
10
|
+
*/
|
|
11
|
+
export declare const BODEWELL_SIGNAL_MAP: {
|
|
12
|
+
readonly soil_vwc: {
|
|
13
|
+
readonly key: "moisture";
|
|
14
|
+
readonly unit: "VWC%";
|
|
15
|
+
};
|
|
16
|
+
readonly soil_moisture_raw: {
|
|
17
|
+
readonly key: "moisture_raw";
|
|
18
|
+
readonly unit: "counts";
|
|
19
|
+
};
|
|
20
|
+
readonly soil_moisture: {
|
|
21
|
+
readonly key: "moisture_raw";
|
|
22
|
+
readonly unit: "counts";
|
|
23
|
+
};
|
|
24
|
+
readonly air_temp: {
|
|
25
|
+
readonly key: "temperature";
|
|
26
|
+
readonly unit: "°C";
|
|
27
|
+
};
|
|
28
|
+
readonly humidity: {
|
|
29
|
+
readonly key: "humidity";
|
|
30
|
+
readonly unit: "%RH";
|
|
31
|
+
};
|
|
32
|
+
readonly air_humid: {
|
|
33
|
+
readonly key: "humidity";
|
|
34
|
+
readonly unit: "%RH";
|
|
35
|
+
};
|
|
36
|
+
readonly pressure: {
|
|
37
|
+
readonly key: "pressure";
|
|
38
|
+
readonly unit: "hPa";
|
|
39
|
+
};
|
|
40
|
+
readonly air_pressure: {
|
|
41
|
+
readonly key: "pressure";
|
|
42
|
+
readonly unit: "hPa";
|
|
43
|
+
};
|
|
44
|
+
readonly light_lux: {
|
|
45
|
+
readonly key: "illuminance";
|
|
46
|
+
readonly unit: "lux";
|
|
47
|
+
};
|
|
48
|
+
readonly soil_temp_stemma: {
|
|
49
|
+
readonly key: "soil_temperature";
|
|
50
|
+
readonly unit: "°C";
|
|
51
|
+
};
|
|
52
|
+
readonly soil_ph: {
|
|
53
|
+
readonly key: "ph";
|
|
54
|
+
readonly unit: "pH";
|
|
55
|
+
};
|
|
56
|
+
readonly soil_ec: {
|
|
57
|
+
readonly key: "conductivity";
|
|
58
|
+
readonly unit: "mS/cm";
|
|
59
|
+
};
|
|
60
|
+
readonly fw_version: {
|
|
61
|
+
readonly key: "firmware";
|
|
62
|
+
readonly unit: undefined;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Hardware spellings that must never appear above this file.
|
|
67
|
+
*
|
|
68
|
+
* Deliberately NOT every key of BODEWELL_SIGNAL_MAP: `humidity` and `pressure`
|
|
69
|
+
* are the same word in both vocabularies, so banning them would ban the correct
|
|
70
|
+
* name along with the wrong one. These are the names that only a sensor
|
|
71
|
+
* datasheet would choose — `soil_temp_stemma` is a seesaw product name, and
|
|
72
|
+
* `soil_vwc` is a register's idea of moisture.
|
|
73
|
+
*
|
|
74
|
+
* products/bodewell-web guards itself against this list.
|
|
75
|
+
*/
|
|
76
|
+
export declare const BODEWELL_HARDWARE_ONLY_FIELDS: readonly ["soil_vwc", "soil_moisture_raw", "soil_moisture", "air_temp", "air_humid", "air_pressure", "light_lux", "soil_temp_stemma", "soil_ph", "soil_ec", "fw_version", "stick_id"];
|
|
77
|
+
export interface BodewellSignalContext {
|
|
78
|
+
/** Which rig this packet came from. Becomes the entity half of the signal id. */
|
|
79
|
+
rigId: string;
|
|
80
|
+
/** The transport that delivered it — 'mqtt' live, 'http' for a REST read. */
|
|
81
|
+
source: Signal['source'];
|
|
82
|
+
/** Fallback for packets with no timestamp of their own, in ms. */
|
|
83
|
+
receivedAt?: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Flatten one telemetry packet into Signals — one per measurement, because the
|
|
87
|
+
* contract says complex structures are flattened rather than nested.
|
|
88
|
+
*
|
|
89
|
+
* Unknown fields are dropped rather than passed through. A field nobody has
|
|
90
|
+
* mapped is a field no component can be reading yet, and letting it through
|
|
91
|
+
* under its hardware name is precisely the leak this closes.
|
|
92
|
+
*/
|
|
93
|
+
export declare function toBodewellSignals(packet: Record<string, unknown> | null | undefined, context: BodewellSignalContext): Signal[];
|
|
94
|
+
/** Convenience: the signals of one packet, keyed by abstract key. */
|
|
95
|
+
export declare function toBodewellReadingMap(packet: Record<string, unknown> | null | undefined, context: BodewellSignalContext): Record<string, Signal>;
|
|
96
|
+
/**
|
|
97
|
+
* The fields /api/v1/history is asked for, and the order a chart plots them in.
|
|
98
|
+
*
|
|
99
|
+
* This lives here rather than in a fetch call because the query string is the
|
|
100
|
+
* other place hardware names leak: a component that types `fields=soil_vwc` has
|
|
101
|
+
* the hardware contract in it just as surely as one that reads `packet.soil_vwc`.
|
|
102
|
+
*/
|
|
103
|
+
export declare const BODEWELL_HISTORY_FIELDS: readonly ["timestamp", "soil_vwc", "air_temp", "light_lux"];
|
|
104
|
+
/** The query-string value for the fields above. */
|
|
105
|
+
export declare const BODEWELL_HISTORY_FIELDS_PARAM: string;
|
|
106
|
+
export interface BodewellSeriesPoint {
|
|
107
|
+
/** Seconds, as the history endpoint returns and the charts plot. */
|
|
108
|
+
timestamp: number;
|
|
109
|
+
moisture?: number;
|
|
110
|
+
temperature?: number;
|
|
111
|
+
illuminance?: number;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Map history rows onto abstract keys, dropping anything unusable.
|
|
115
|
+
*
|
|
116
|
+
* Timestamps stay in seconds here, unlike Signals: this is chart input, and the
|
|
117
|
+
* pages already format from seconds. Converting would be a silent change to
|
|
118
|
+
* every axis label in the app.
|
|
119
|
+
*/
|
|
120
|
+
export declare function toBodewellSeries(rows: unknown): BodewellSeriesPoint[];
|
|
121
|
+
/**
|
|
122
|
+
* Which rig a packet came from.
|
|
123
|
+
*
|
|
124
|
+
* The firmware sends `stick_id`; the shared schema's canonical name is
|
|
125
|
+
* `device_id`; both appear on the wire. Knowing that is this module's job, not
|
|
126
|
+
* a React hook's.
|
|
127
|
+
*/
|
|
128
|
+
export declare function bodewellRigIdOf(packet: unknown): string | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* The body /api/v1/calibrate expects.
|
|
131
|
+
*
|
|
132
|
+
* `stick_id` is what that endpoint validates against BodewellCommandSchema — not
|
|
133
|
+
* `device_id`, which is what ingest uses for the same rig. A page that types
|
|
134
|
+
* either one by hand has the wire format in it, and gets to find out about the
|
|
135
|
+
* inconsistency on its own.
|
|
136
|
+
*/
|
|
137
|
+
export declare function toBodewellCalibrationCommand(rigId: string, type: 'dry' | 'wet', value: number): {
|
|
138
|
+
stick_id: string;
|
|
139
|
+
type: 'dry' | 'wet';
|
|
140
|
+
value: number;
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=bodewellAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bodewellAdapter.d.ts","sourceRoot":"","sources":["../../../../src/signals/bodewellAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAgC,KAA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,MAAM,GAAG,SAAS,CAKnE;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,KAAK,GAAG,KAAK,EACnB,KAAK,EAAE,MAAM,GACZ;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,KAAK,GAAG,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAE1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bodewellAdapter.test.d.ts","sourceRoot":"","sources":["../../../../src/signals/bodewellAdapter.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file signals/index.ts
|
|
3
|
+
* @package @ramme-io/kernel
|
|
4
|
+
* @description Entry point for the Signal boundary — adapters and mappings only.
|
|
5
|
+
*
|
|
6
|
+
* 🚨 NO React components. Importing the root barrel to reach a mapping function
|
|
7
|
+
* drags kernel's whole component registry behind it: `products/bodewell-web`
|
|
8
|
+
* did that for one pure function and its Ably regression test broke, because
|
|
9
|
+
* the barrel reached DynamicPage, which wanted a `StatCard` the test's partial
|
|
10
|
+
* @ramme-io/ui mock had never heard of. The app tree-shakes it in a production
|
|
11
|
+
* build; a test environment and a cold dev server do not.
|
|
12
|
+
*
|
|
13
|
+
* Same reasoning as ./server, and the same shape:
|
|
14
|
+
*
|
|
15
|
+
* import { toBodewellSignals } from '@ramme-io/kernel/signals'; // ✅
|
|
16
|
+
* import { toBodewellSignals } from '@ramme-io/kernel'; // ❌ pulls in React
|
|
17
|
+
*/
|
|
18
|
+
export * from './bodewellAdapter';
|
|
19
|
+
export { BaseSignalAdapter } from './BaseSignalAdapter';
|
|
20
|
+
export type { AdapterStatus } from './BaseSignalAdapter';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/signals/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/server.es.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { streamText as
|
|
4
|
-
import { createGoogleGenerativeAI as
|
|
5
|
-
|
|
1
|
+
import { n as E } from "./AiGateway-Bdcl3v8h.js";
|
|
2
|
+
import { A as x, c as J, g as L, a as M, d as k, D as F, G as Y, f as U, I as B, O as H, e as q, h as z, b as V, i as W, j as C, s as X } from "./AiGateway-Bdcl3v8h.js";
|
|
3
|
+
import { streamText as O, generateObject as G } from "ai";
|
|
4
|
+
import { createGoogleGenerativeAI as u } from "@ai-sdk/google";
|
|
5
|
+
import { A as S, D as _, a as f, b as y, c as g, d as T } from "./index-kBkq1FSR.js";
|
|
6
|
+
import { e as Z, g as ee, B as te, E as ae, F as se, f as re, P as oe, R as ne, S as ce, T as me, W as ie } from "./index-kBkq1FSR.js";
|
|
7
|
+
function A(e) {
|
|
6
8
|
const a = typeof process < "u" ? process.env.GOOGLE_GENERATIVE_AI_API_KEY : void 0, s = e || a;
|
|
7
9
|
if (!s)
|
|
8
10
|
throw new Error(
|
|
@@ -25,8 +27,8 @@ const P = {
|
|
|
25
27
|
* @param opts.apiKey - Optional client-provided key
|
|
26
28
|
*/
|
|
27
29
|
async generateSchema(e) {
|
|
28
|
-
const a =
|
|
29
|
-
return (await
|
|
30
|
+
const a = A(e.apiKey), s = u({ apiKey: a }), t = e.role ? S[e.role] : null, r = e.model ?? (t == null ? void 0 : t.model) ?? f, o = e.temperature ?? (t == null ? void 0 : t.temperature) ?? 0.3;
|
|
31
|
+
return (await G({
|
|
30
32
|
model: s(r),
|
|
31
33
|
schema: e.schema,
|
|
32
34
|
prompt: e.prompt,
|
|
@@ -47,8 +49,8 @@ const P = {
|
|
|
47
49
|
* @returns A Response object — directly return this from your route handler.
|
|
48
50
|
*/
|
|
49
51
|
streamChatResponse(e) {
|
|
50
|
-
const a =
|
|
51
|
-
return
|
|
52
|
+
const a = A(e.apiKey), s = u({ apiKey: a }), t = e.role ? S[e.role] : null, r = e.model ?? (t == null ? void 0 : t.model) ?? _, o = e.temperature ?? (t == null ? void 0 : t.temperature) ?? 0.5;
|
|
53
|
+
return O({
|
|
52
54
|
model: s(r),
|
|
53
55
|
messages: e.messages,
|
|
54
56
|
system: e.system,
|
|
@@ -56,15 +58,15 @@ const P = {
|
|
|
56
58
|
}).toTextStreamResponse();
|
|
57
59
|
}
|
|
58
60
|
};
|
|
59
|
-
class
|
|
61
|
+
class $ extends Error {
|
|
60
62
|
constructor(a, s, t) {
|
|
61
63
|
super(a), this.issues = s, this.attempts = t, this.name = "AppDocumentGenerationError";
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
|
-
const
|
|
66
|
+
const w = (e) => {
|
|
65
67
|
const a = e.match(/```(?:json)?\s*([\s\S]*?)```/), s = (a ? a[1] : e).trim(), t = s.indexOf("{"), r = s.lastIndexOf("}");
|
|
66
68
|
return t === -1 || r === -1 || r <= t ? s : s.slice(t, r + 1);
|
|
67
|
-
}, R = (e) => e.issues.map((a) => `${a.path.join(".") || "(root)"}: ${a.message}`),
|
|
69
|
+
}, R = (e) => e.issues.map((a) => `${a.path.join(".") || "(root)"}: ${a.message}`), b = async ({
|
|
68
70
|
request: e,
|
|
69
71
|
current: a,
|
|
70
72
|
complete: s,
|
|
@@ -74,7 +76,7 @@ const v = (e) => {
|
|
|
74
76
|
|
|
75
77
|
${r}
|
|
76
78
|
|
|
77
|
-
${
|
|
79
|
+
${g}
|
|
78
80
|
${JSON.stringify(a)}
|
|
79
81
|
|
|
80
82
|
Request: ${e}` : `${y}
|
|
@@ -84,17 +86,17 @@ ${r}
|
|
|
84
86
|
Request: ${e}`;
|
|
85
87
|
let n = o, c = [];
|
|
86
88
|
for (let l = 0; l <= t; l += 1) {
|
|
87
|
-
const
|
|
89
|
+
const h = await s(n);
|
|
88
90
|
let p;
|
|
89
91
|
try {
|
|
90
|
-
p = JSON.parse(
|
|
92
|
+
p = JSON.parse(w(h));
|
|
91
93
|
} catch {
|
|
92
94
|
c = ["the reply was not JSON"], n = `${o}
|
|
93
95
|
|
|
94
96
|
Your last reply was not valid JSON. Reply with the JSON object only.`;
|
|
95
97
|
continue;
|
|
96
98
|
}
|
|
97
|
-
const d =
|
|
99
|
+
const d = E(p), m = T.safeParse(d.value);
|
|
98
100
|
if (m.success && d.issues.length === 0)
|
|
99
101
|
return { document: m.data, repairs: l };
|
|
100
102
|
c = [
|
|
@@ -110,41 +112,41 @@ ${JSON.stringify(p)}
|
|
|
110
112
|
|
|
111
113
|
Return the corrected JSON object only.`;
|
|
112
114
|
}
|
|
113
|
-
throw new
|
|
115
|
+
throw new $(
|
|
114
116
|
"The model could not produce a valid app document.",
|
|
115
117
|
c,
|
|
116
118
|
t + 1
|
|
117
119
|
);
|
|
118
120
|
};
|
|
119
121
|
export {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
122
|
+
x as AGENT_ROSTER,
|
|
123
|
+
Z as ActionSchema,
|
|
124
|
+
J as AiConfigResolver,
|
|
125
|
+
L as AiGateway,
|
|
126
|
+
M as AiGatewayService,
|
|
127
|
+
k as AnthropicAdapter,
|
|
128
|
+
$ as AppDocumentGenerationError,
|
|
129
|
+
ee as AppSpecificationSchema,
|
|
130
|
+
te as BlockSchema,
|
|
129
131
|
F as DeepSeekAdapter,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
ae as EntitySchema,
|
|
133
|
+
se as FieldSchema,
|
|
134
|
+
Y as GeminiAdapter,
|
|
135
|
+
U as GrokAdapter,
|
|
136
|
+
B as InMemoryRateLimiter,
|
|
135
137
|
P as NeuralGateway,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
138
|
+
H as OllamaAdapter,
|
|
139
|
+
q as OpenAIAdapter,
|
|
140
|
+
re as PageSchema,
|
|
141
|
+
oe as PageSectionSchema,
|
|
142
|
+
ne as ResourceSchema,
|
|
143
|
+
ce as SignalSchema,
|
|
144
|
+
me as TriggerSchema,
|
|
145
|
+
ie as WorkflowSchema,
|
|
146
|
+
z as aiGateway,
|
|
147
|
+
V as aiGatewayService,
|
|
148
|
+
W as decodeSpr,
|
|
149
|
+
C as encodeSpr,
|
|
150
|
+
b as generateAppDocument,
|
|
151
|
+
X as sprByteLength
|
|
150
152
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './kernel/src/signals/index'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { b as l, d as o, e as s, a as L, B as E, g as d, h as B, c as _, f as S, t } from "./bodewellAdapter-BzbeTSIP.js";
|
|
2
|
+
export {
|
|
3
|
+
l as BODEWELL_HARDWARE_ONLY_FIELDS,
|
|
4
|
+
o as BODEWELL_HISTORY_FIELDS,
|
|
5
|
+
s as BODEWELL_HISTORY_FIELDS_PARAM,
|
|
6
|
+
L as BODEWELL_SIGNAL_MAP,
|
|
7
|
+
E as BaseSignalAdapter,
|
|
8
|
+
d as bodewellRigIdOf,
|
|
9
|
+
B as toBodewellCalibrationCommand,
|
|
10
|
+
_ as toBodewellReadingMap,
|
|
11
|
+
S as toBodewellSeries,
|
|
12
|
+
t as toBodewellSignals
|
|
13
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ramme-io/kernel",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
"./server": {
|
|
19
19
|
"import": "./dist/server.es.js",
|
|
20
20
|
"types": "./dist/server.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./signals": {
|
|
23
|
+
"import": "./dist/signals.es.js",
|
|
24
|
+
"types": "./dist/signals.d.ts"
|
|
21
25
|
}
|
|
22
26
|
},
|
|
23
27
|
"files": [
|
|
@@ -28,7 +32,7 @@
|
|
|
28
32
|
},
|
|
29
33
|
"peerDependencies": {
|
|
30
34
|
"@ai-sdk/google": ">=0.0.1",
|
|
31
|
-
"@ramme-io/ui": ">=4.2.
|
|
35
|
+
"@ramme-io/ui": ">=4.2.2",
|
|
32
36
|
"ai": ">=4.0.0",
|
|
33
37
|
"react": ">=18.2.0",
|
|
34
38
|
"react-dom": ">=18.2.0",
|
|
@@ -52,7 +56,7 @@
|
|
|
52
56
|
"vite-plugin-dts": "^3.9.1",
|
|
53
57
|
"vitest": "^2.1.9",
|
|
54
58
|
"zod": "^3.23.8",
|
|
55
|
-
"@ramme-io/ui": "4.2.
|
|
59
|
+
"@ramme-io/ui": "4.2.2"
|
|
56
60
|
},
|
|
57
61
|
"dependencies": {
|
|
58
62
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
@@ -63,7 +67,7 @@
|
|
|
63
67
|
"remark-gfm": "^4.0.1",
|
|
64
68
|
"zod-to-json-schema": "^3.23.0",
|
|
65
69
|
"zustand": "^5.0.0",
|
|
66
|
-
"@ramme-io/shared": "3.
|
|
70
|
+
"@ramme-io/shared": "3.3.0"
|
|
67
71
|
},
|
|
68
72
|
"scripts": {
|
|
69
73
|
"build": "vite build",
|