@ramme-io/kernel 6.0.0 → 6.0.1
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-DsVWU6ih.js +3619 -0
- package/dist/index.es.js +5073 -4784
- package/dist/kernel/src/apps/quantize.d.ts +50 -0
- package/dist/kernel/src/apps/quantize.d.ts.map +1 -0
- package/dist/kernel/src/apps/spriteGrid.d.ts +47 -0
- package/dist/kernel/src/apps/spriteGrid.d.ts.map +1 -0
- package/dist/kernel/src/auth/AuthContext.d.ts +1 -1
- package/dist/kernel/src/auth/AuthContext.d.ts.map +1 -1
- package/dist/kernel/src/components/ThemeStudio.d.ts.map +1 -1
- package/dist/kernel/src/components/settings/AiSettingsPanel.d.ts.map +1 -1
- package/dist/kernel/src/config/app.manifest.d.ts +1 -1
- package/dist/kernel/src/engine/runtime/ManifestContext.d.ts +94 -94
- package/dist/kernel/src/engine/runtime/useLiveBridge.d.ts +93 -93
- package/dist/kernel/src/hooks/useAIKeyOrchestrator.d.ts +2 -2
- package/dist/kernel/src/hooks/useDevice.d.ts +5 -5
- package/dist/kernel/src/hooks/useDevice.d.ts.map +1 -1
- package/dist/kernel/src/index.d.ts +3 -0
- package/dist/kernel/src/index.d.ts.map +1 -1
- package/dist/kernel/src/renderers/AppDocumentRenderer.d.ts +39 -0
- package/dist/kernel/src/renderers/AppDocumentRenderer.d.ts.map +1 -0
- package/dist/kernel/src/server.d.ts +2 -0
- package/dist/kernel/src/server.d.ts.map +1 -1
- package/dist/kernel/src/services/ai/ConfigResolver.d.ts.map +1 -1
- package/dist/kernel/src/services/ai/generateAppDocument.d.ts +61 -0
- package/dist/kernel/src/services/ai/generateAppDocument.d.ts.map +1 -0
- package/dist/kernel/src/services/ai/providers/AnthropicAdapter.d.ts +16 -1
- package/dist/kernel/src/services/ai/providers/AnthropicAdapter.d.ts.map +1 -1
- package/dist/kernel/src/services/ai/providers/DeepSeekAdapter.d.ts.map +1 -1
- package/dist/kernel/src/services/ai/providers/GeminiAdapter.d.ts.map +1 -1
- package/dist/kernel/src/services/ai/providers/GrokAdapter.d.ts.map +1 -1
- package/dist/kernel/src/services/ai/providers/OllamaAdapter.d.ts.map +1 -1
- package/dist/kernel/src/services/ai/providers/OpenAIAdapter.d.ts.map +1 -1
- package/dist/kernel/src/services/ai/providers/openAiCompatibleStreamChat.d.ts +1 -1
- package/dist/kernel/src/services/ai/providers/openAiCompatibleStreamChat.d.ts.map +1 -1
- package/dist/kernel/src/stores/useSettingsStore.d.ts +1 -1
- package/dist/kernel/src/stores/useSettingsStore.d.ts.map +1 -1
- package/dist/kernel/src/utils/validationUtils.d.ts +103 -103
- package/dist/server.es.js +103 -41
- package/package.json +4 -2
- package/dist/AiGateway-DLGiTtyR.js +0 -3001
package/dist/server.es.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { streamText as
|
|
4
|
-
import { createGoogleGenerativeAI as
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
1
|
+
import { C as u, a as E, H as O, J as y, K as G, n as _, L as T } from "./AiGateway-DsVWU6ih.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-DsVWU6ih.js";
|
|
3
|
+
import { streamText as w, generateObject as $ } from "ai";
|
|
4
|
+
import { createGoogleGenerativeAI as S } from "@ai-sdk/google";
|
|
5
|
+
function A(e) {
|
|
6
|
+
const a = typeof process < "u" ? process.env.GOOGLE_GENERATIVE_AI_API_KEY : void 0, s = e || a;
|
|
7
|
+
if (!s)
|
|
8
8
|
throw new Error(
|
|
9
9
|
`[NeuralGateway] No API key found.
|
|
10
10
|
— Server: Set GOOGLE_GENERATIVE_AI_API_KEY in .env.local
|
|
11
11
|
— Client: Pass apiKey via request body`
|
|
12
12
|
);
|
|
13
|
-
return
|
|
13
|
+
return s;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
15
|
+
const P = {
|
|
16
16
|
/**
|
|
17
17
|
* Generate a validated, typed object using the Vercel AI SDK.
|
|
18
18
|
*
|
|
@@ -25,13 +25,13 @@ const E = {
|
|
|
25
25
|
* @param opts.apiKey - Optional client-provided key
|
|
26
26
|
*/
|
|
27
27
|
async generateSchema(e) {
|
|
28
|
-
const
|
|
29
|
-
return (await
|
|
30
|
-
model:
|
|
28
|
+
const a = A(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
|
+
return (await $({
|
|
30
|
+
model: s(r),
|
|
31
31
|
schema: e.schema,
|
|
32
32
|
prompt: e.prompt,
|
|
33
33
|
...e.system ? { system: e.system } : {},
|
|
34
|
-
temperature:
|
|
34
|
+
temperature: o
|
|
35
35
|
})).object;
|
|
36
36
|
},
|
|
37
37
|
/**
|
|
@@ -47,38 +47,100 @@ const E = {
|
|
|
47
47
|
* @returns A Response object — directly return this from your route handler.
|
|
48
48
|
*/
|
|
49
49
|
streamChatResponse(e) {
|
|
50
|
-
const
|
|
51
|
-
return e.temperature ?? (
|
|
52
|
-
model:
|
|
50
|
+
const a = A(e.apiKey), s = S({ apiKey: a }), t = e.role ? u[e.role] : null, r = e.model ?? (t == null ? void 0 : t.model) ?? E;
|
|
51
|
+
return e.temperature ?? (t == null || t.temperature), w({
|
|
52
|
+
model: s(r),
|
|
53
53
|
messages: e.messages,
|
|
54
54
|
system: e.system
|
|
55
55
|
}).toTextStreamResponse();
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
+
class g extends Error {
|
|
59
|
+
constructor(a, s, t) {
|
|
60
|
+
super(a), this.issues = s, this.attempts = t, this.name = "AppDocumentGenerationError";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const v = (e) => {
|
|
64
|
+
const a = e.match(/```(?:json)?\s*([\s\S]*?)```/), s = (a ? a[1] : e).trim(), t = s.indexOf("{"), r = s.lastIndexOf("}");
|
|
65
|
+
return t === -1 || r === -1 || r <= t ? s : s.slice(t, r + 1);
|
|
66
|
+
}, R = (e) => e.issues.map((a) => `${a.path.join(".") || "(root)"}: ${a.message}`), D = async ({
|
|
67
|
+
request: e,
|
|
68
|
+
current: a,
|
|
69
|
+
complete: s,
|
|
70
|
+
maxRepairs: t = 2
|
|
71
|
+
}) => {
|
|
72
|
+
const r = `Today is ${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.`, o = a ? `${y}
|
|
73
|
+
|
|
74
|
+
${r}
|
|
75
|
+
|
|
76
|
+
${G}
|
|
77
|
+
${JSON.stringify(a)}
|
|
78
|
+
|
|
79
|
+
Request: ${e}` : `${y}
|
|
80
|
+
|
|
81
|
+
${r}
|
|
82
|
+
|
|
83
|
+
Request: ${e}`;
|
|
84
|
+
let n = o, c = [];
|
|
85
|
+
for (let l = 0; l <= t; l += 1) {
|
|
86
|
+
const h = await s(n);
|
|
87
|
+
let p;
|
|
88
|
+
try {
|
|
89
|
+
p = JSON.parse(v(h));
|
|
90
|
+
} catch {
|
|
91
|
+
c = ["the reply was not JSON"], n = `${o}
|
|
92
|
+
|
|
93
|
+
Your last reply was not valid JSON. Reply with the JSON object only.`;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const d = _(p), i = T.safeParse(d.value);
|
|
97
|
+
if (i.success && d.issues.length === 0)
|
|
98
|
+
return { document: i.data, repairs: l };
|
|
99
|
+
c = [
|
|
100
|
+
...d.issues.map((m) => `${m.path.join(".") || "(root)"}: ${m.message}`),
|
|
101
|
+
...i.success ? [] : R(i.error)
|
|
102
|
+
], n = `${o}
|
|
103
|
+
|
|
104
|
+
Your last reply did not validate:
|
|
105
|
+
${c.map((m) => `- ${m}`).join(`
|
|
106
|
+
`)}
|
|
107
|
+
Here it is:
|
|
108
|
+
${JSON.stringify(p)}
|
|
109
|
+
|
|
110
|
+
Return the corrected JSON object only.`;
|
|
111
|
+
}
|
|
112
|
+
throw new g(
|
|
113
|
+
"The model could not produce a valid app document.",
|
|
114
|
+
c,
|
|
115
|
+
t + 1
|
|
116
|
+
);
|
|
117
|
+
};
|
|
58
118
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
g as
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
119
|
+
J as AGENT_ROSTER,
|
|
120
|
+
b as ActionSchema,
|
|
121
|
+
k as AiConfigResolver,
|
|
122
|
+
x as AiGateway,
|
|
123
|
+
L as AiGatewayService,
|
|
124
|
+
M as AnthropicAdapter,
|
|
125
|
+
g as AppDocumentGenerationError,
|
|
126
|
+
Y as AppSpecificationSchema,
|
|
127
|
+
F as BlockSchema,
|
|
128
|
+
H as DeepSeekAdapter,
|
|
129
|
+
U as EntitySchema,
|
|
130
|
+
q as FieldSchema,
|
|
131
|
+
z as GeminiAdapter,
|
|
132
|
+
B as GrokAdapter,
|
|
133
|
+
C as InMemoryRateLimiter,
|
|
134
|
+
P as NeuralGateway,
|
|
135
|
+
V as OllamaAdapter,
|
|
136
|
+
W as OpenAIAdapter,
|
|
137
|
+
X as PageSchema,
|
|
138
|
+
Q as PageSectionSchema,
|
|
139
|
+
Z as ResourceSchema,
|
|
140
|
+
ee as SignalSchema,
|
|
141
|
+
te as TriggerSchema,
|
|
142
|
+
ae as WorkflowSchema,
|
|
143
|
+
se as aiGateway,
|
|
144
|
+
re as aiGatewayService,
|
|
145
|
+
D as generateAppDocument
|
|
84
146
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ramme-io/kernel",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@ai-sdk/google": "^3.0.1",
|
|
40
|
+
"@types/node": "^20.14.10",
|
|
40
41
|
"@types/react": "^18.3.3",
|
|
41
42
|
"@types/react-dom": "^18.3.0",
|
|
42
43
|
"ai": "^6.0.3",
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
"@ramme-io/shared": "3.1.2"
|
|
61
62
|
},
|
|
62
63
|
"scripts": {
|
|
63
|
-
"build": "vite build"
|
|
64
|
+
"build": "vite build",
|
|
65
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
64
66
|
}
|
|
65
67
|
}
|