@ramme-io/shared 2.0.0 → 2.0.2
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/LICENSE +21 -0
- package/dist/index.cjs +462 -23
- package/dist/index.d.cts +872 -3
- package/dist/index.d.ts +872 -3
- package/dist/index.js +435 -22
- package/package.json +10 -4
- package/.turbo/turbo-build.log +0 -19
- package/AGENTS.md +0 -2
- package/index.ts +0 -4
- package/src/bodewell/schema.ts +0 -35
- package/src/schema.ts +0 -209
- package/tsconfig.json +0 -16
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ramme Framework
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.cjs
CHANGED
|
@@ -20,19 +20,45 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
AIKeyManifestSchema: () => AIKeyManifestSchema,
|
|
24
|
+
AIThemeSchema: () => AIThemeSchema,
|
|
25
|
+
AI_ROSTER: () => AI_ROSTER,
|
|
26
|
+
AI_TOOLS: () => AI_TOOLS,
|
|
23
27
|
ActionSchema: () => ActionSchema,
|
|
28
|
+
AppSignalSchema: () => AppSignalSchema,
|
|
24
29
|
AppSpecificationSchema: () => AppSpecificationSchema,
|
|
30
|
+
AuthStrategySchema: () => AuthStrategySchema,
|
|
25
31
|
BlockSchema: () => BlockSchema,
|
|
26
32
|
Bodewell: () => schema_exports,
|
|
33
|
+
DEFAULT_CHAT_MODEL: () => DEFAULT_CHAT_MODEL,
|
|
34
|
+
DEFAULT_PRO_MODEL: () => DEFAULT_PRO_MODEL,
|
|
35
|
+
DEFAULT_SCHEMA_MODEL: () => DEFAULT_SCHEMA_MODEL,
|
|
27
36
|
EntitySchema: () => EntitySchema,
|
|
28
37
|
FieldSchema: () => FieldSchema,
|
|
29
38
|
FloraTelemetrySchema: () => FloraTelemetrySchema,
|
|
39
|
+
GENESIS_LIBRARY_CONTEXT: () => GENESIS_LIBRARY_CONTEXT,
|
|
40
|
+
GENESIS_VALID_COMPONENTS: () => GENESIS_VALID_COMPONENTS,
|
|
30
41
|
PageSchema: () => PageSchema,
|
|
31
42
|
PageSectionSchema: () => PageSectionSchema,
|
|
32
43
|
ResourceSchema: () => ResourceSchema,
|
|
44
|
+
SIGNAL_DOMAINS: () => SIGNAL_DOMAINS,
|
|
45
|
+
SIGNAL_KINDS: () => SIGNAL_KINDS,
|
|
46
|
+
SIGNAL_KIND_LABELS: () => SIGNAL_KIND_LABELS,
|
|
47
|
+
SIGNAL_SOURCES: () => SIGNAL_SOURCES,
|
|
48
|
+
SignalArraySchema: () => SignalArraySchema,
|
|
49
|
+
SignalKindSchema: () => SignalKindSchema,
|
|
50
|
+
SignalPacketSchema: () => SignalPacketSchema,
|
|
33
51
|
SignalSchema: () => SignalSchema,
|
|
52
|
+
SignalSourceSchema: () => SignalSourceSchema,
|
|
53
|
+
THEME_PRESETS: () => THEME_PRESETS,
|
|
54
|
+
THEME_SYSTEM_PROMPT: () => THEME_SYSTEM_PROMPT,
|
|
55
|
+
ThemeFontsSchema: () => ThemeFontsSchema,
|
|
56
|
+
ThemeOverridesSchema: () => ThemeOverridesSchema,
|
|
34
57
|
TriggerSchema: () => TriggerSchema,
|
|
35
|
-
|
|
58
|
+
UserSchema: () => UserSchema,
|
|
59
|
+
WorkflowSchema: () => WorkflowSchema,
|
|
60
|
+
stockChartParameters: () => stockChartParameters,
|
|
61
|
+
telemetryGraphParameters: () => telemetryGraphParameters
|
|
36
62
|
});
|
|
37
63
|
module.exports = __toCommonJS(index_exports);
|
|
38
64
|
|
|
@@ -59,7 +85,7 @@ var ResourceSchema = import_zod.z.object({
|
|
|
59
85
|
exportable: import_zod.z.boolean().optional()
|
|
60
86
|
}).optional()
|
|
61
87
|
});
|
|
62
|
-
var
|
|
88
|
+
var AppSignalSchema = import_zod.z.object({
|
|
63
89
|
id: import_zod.z.string().min(1, "Signal ID is required"),
|
|
64
90
|
label: import_zod.z.string(),
|
|
65
91
|
description: import_zod.z.string().optional(),
|
|
@@ -140,6 +166,11 @@ var PageSchema = import_zod.z.object({
|
|
|
140
166
|
icon: import_zod.z.string().optional(),
|
|
141
167
|
sections: import_zod.z.array(PageSectionSchema)
|
|
142
168
|
});
|
|
169
|
+
var AuthStrategySchema = import_zod.z.enum(["ENVIRONMENT", "SESSION_BYOK", "VAULT"]);
|
|
170
|
+
var AIKeyManifestSchema = import_zod.z.object({
|
|
171
|
+
strategy: AuthStrategySchema,
|
|
172
|
+
status: import_zod.z.enum(["VALID", "KEY_EXPIRED", "BYOK_REQUIRED", "DEGRADED", "UNKNOWN"]).default("UNKNOWN")
|
|
173
|
+
});
|
|
143
174
|
var AppSpecificationSchema = import_zod.z.object({
|
|
144
175
|
meta: import_zod.z.object({
|
|
145
176
|
name: import_zod.z.string(),
|
|
@@ -150,13 +181,15 @@ var AppSpecificationSchema = import_zod.z.object({
|
|
|
150
181
|
}),
|
|
151
182
|
config: import_zod.z.object({
|
|
152
183
|
theme: import_zod.z.enum(["light", "dark", "system", "corporate", "midnight", "blueprint"]).default("system"),
|
|
184
|
+
layout: import_zod.z.enum(["dashboard", "explorer", "studio", "focus"]).default("dashboard"),
|
|
153
185
|
mockMode: import_zod.z.boolean().default(true),
|
|
154
|
-
brokerUrl: import_zod.z.string().optional()
|
|
186
|
+
brokerUrl: import_zod.z.string().optional(),
|
|
187
|
+
aiKeyManifest: AIKeyManifestSchema.optional()
|
|
155
188
|
}),
|
|
156
189
|
modules: import_zod.z.array(import_zod.z.string()).optional(),
|
|
157
190
|
resources: import_zod.z.array(ResourceSchema).optional(),
|
|
158
191
|
domain: import_zod.z.object({
|
|
159
|
-
signals: import_zod.z.array(
|
|
192
|
+
signals: import_zod.z.array(AppSignalSchema),
|
|
160
193
|
entities: import_zod.z.array(EntitySchema),
|
|
161
194
|
workflows: import_zod.z.array(WorkflowSchema).optional()
|
|
162
195
|
}),
|
|
@@ -169,6 +202,98 @@ var FloraTelemetrySchema = import_zod.z.object({
|
|
|
169
202
|
temperature: import_zod.z.number().min(-40).max(125)
|
|
170
203
|
});
|
|
171
204
|
|
|
205
|
+
// src/signals/schema.ts
|
|
206
|
+
var import_zod2 = require("zod");
|
|
207
|
+
var SignalSchema = import_zod2.z.object({
|
|
208
|
+
id: import_zod2.z.string(),
|
|
209
|
+
source: import_zod2.z.enum(["mqtt", "http", "ws", "mock"]),
|
|
210
|
+
domain: import_zod2.z.string(),
|
|
211
|
+
key: import_zod2.z.string(),
|
|
212
|
+
value: import_zod2.z.union([import_zod2.z.number(), import_zod2.z.string(), import_zod2.z.boolean()]),
|
|
213
|
+
unit: import_zod2.z.string().optional(),
|
|
214
|
+
timestamp: import_zod2.z.number(),
|
|
215
|
+
meta: import_zod2.z.record(import_zod2.z.unknown()).optional()
|
|
216
|
+
});
|
|
217
|
+
var SignalArraySchema = import_zod2.z.array(SignalSchema);
|
|
218
|
+
var SIGNAL_DOMAINS = {
|
|
219
|
+
AGRICULTURE: "agriculture",
|
|
220
|
+
// Track A — soil, pH, EC, moisture
|
|
221
|
+
FINANCE: "finance",
|
|
222
|
+
// Track B — price, volume, risk metrics
|
|
223
|
+
INFRASTRUCTURE: "infrastructure",
|
|
224
|
+
// Track C — latency, uptime, queue depth
|
|
225
|
+
USER_BEHAVIOR: "user_behavior",
|
|
226
|
+
// Track D — engagement, conversion, NPS
|
|
227
|
+
LOGIC: "logic"
|
|
228
|
+
// Derived — Methodology Engine outputs
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
// src/signals/base.schema.ts
|
|
232
|
+
var import_zod3 = require("zod");
|
|
233
|
+
var SignalKindSchema = import_zod3.z.enum(["telemetry", "market", "system", "logic"]);
|
|
234
|
+
var SignalSourceSchema = import_zod3.z.enum(["mqtt", "http", "ws", "mock"]);
|
|
235
|
+
var SignalPacketSchema = import_zod3.z.object({
|
|
236
|
+
/**
|
|
237
|
+
* Globally unique signal identifier.
|
|
238
|
+
* Convention: '<device-or-entity-id>:<key>'
|
|
239
|
+
* Examples: 'sensor-01:soil_vwc', 'AAPL:price', 'server-01:cpu_pct'
|
|
240
|
+
*/
|
|
241
|
+
id: import_zod3.z.string(),
|
|
242
|
+
/**
|
|
243
|
+
* The semantic category of this signal.
|
|
244
|
+
* Determines which Methodology Engine processes it.
|
|
245
|
+
*/
|
|
246
|
+
kind: SignalKindSchema,
|
|
247
|
+
/**
|
|
248
|
+
* The specific measurement or metric key within its kind.
|
|
249
|
+
* RULE: Keys MUST be abstract and domain-agnostic where possible.
|
|
250
|
+
* Use 'price' not 'stock_price'. Use 'moisture' not 'soil_vwc'.
|
|
251
|
+
* Hardware-specific keys (soil_vwc) MUST be mapped to abstract keys
|
|
252
|
+
* at the adapter layer BEFORE the SignalPacket is created.
|
|
253
|
+
*/
|
|
254
|
+
key: import_zod3.z.string(),
|
|
255
|
+
/**
|
|
256
|
+
* The scalar value. Accepts number, string, or boolean.
|
|
257
|
+
* Structured data MUST be flattened into multiple SignalPackets,
|
|
258
|
+
* one per measurable dimension.
|
|
259
|
+
*/
|
|
260
|
+
value: import_zod3.z.union([import_zod3.z.number(), import_zod3.z.string(), import_zod3.z.boolean()]),
|
|
261
|
+
/**
|
|
262
|
+
* Optional unit of measurement.
|
|
263
|
+
* Examples: 'VWC%', 'USD', 'bpm', 'ms', '°C', 'pct'
|
|
264
|
+
*/
|
|
265
|
+
unit: import_zod3.z.string().optional(),
|
|
266
|
+
/**
|
|
267
|
+
* Unix timestamp in milliseconds (Date.now() format).
|
|
268
|
+
* MUST represent when the measurement was taken, not when it was received.
|
|
269
|
+
*/
|
|
270
|
+
ts: import_zod3.z.number(),
|
|
271
|
+
/**
|
|
272
|
+
* The transport source that produced this signal.
|
|
273
|
+
*/
|
|
274
|
+
source: SignalSourceSchema.optional(),
|
|
275
|
+
/**
|
|
276
|
+
* Optional domain namespace for grouping related signals.
|
|
277
|
+
* Examples: 'bodewell', 'finance', 'infrastructure', 'user_behavior'
|
|
278
|
+
*/
|
|
279
|
+
domain: import_zod3.z.string().optional(),
|
|
280
|
+
/**
|
|
281
|
+
* Optional pass-through for source-specific metadata that does NOT
|
|
282
|
+
* belong in the core contract (e.g. device firmware version, exchange name).
|
|
283
|
+
* RULE: If you find yourself reading from meta in UI components, that
|
|
284
|
+
* field should be promoted to the core schema or handled in the adapter.
|
|
285
|
+
*/
|
|
286
|
+
meta: import_zod3.z.record(import_zod3.z.unknown()).optional()
|
|
287
|
+
});
|
|
288
|
+
var SIGNAL_KINDS = ["telemetry", "market", "system", "logic"];
|
|
289
|
+
var SIGNAL_SOURCES = ["mqtt", "http", "ws", "mock"];
|
|
290
|
+
var SIGNAL_KIND_LABELS = {
|
|
291
|
+
telemetry: "Edge Telemetry",
|
|
292
|
+
market: "Financial Market",
|
|
293
|
+
system: "System / SaaS",
|
|
294
|
+
logic: "Derived Logic"
|
|
295
|
+
};
|
|
296
|
+
|
|
172
297
|
// src/bodewell/schema.ts
|
|
173
298
|
var schema_exports = {};
|
|
174
299
|
__export(schema_exports, {
|
|
@@ -176,48 +301,362 @@ __export(schema_exports, {
|
|
|
176
301
|
BodewellDeviceID: () => BodewellDeviceID,
|
|
177
302
|
BodewellTelemetrySchema: () => BodewellTelemetrySchema
|
|
178
303
|
});
|
|
179
|
-
var
|
|
180
|
-
var BodewellDeviceID =
|
|
304
|
+
var import_zod4 = require("zod");
|
|
305
|
+
var BodewellDeviceID = import_zod4.z.enum([
|
|
181
306
|
"STK-V1-001",
|
|
182
307
|
"STK-V1-002",
|
|
183
308
|
"STK-V1-003",
|
|
184
309
|
"STK-PRO-001",
|
|
185
310
|
"STK-VIS-001"
|
|
186
311
|
]);
|
|
187
|
-
var BodewellTelemetrySchema =
|
|
312
|
+
var BodewellTelemetrySchema = import_zod4.z.object({
|
|
188
313
|
device_id: BodewellDeviceID,
|
|
189
|
-
stick_id:
|
|
190
|
-
timestamp:
|
|
191
|
-
air_temp:
|
|
192
|
-
air_humid:
|
|
193
|
-
humidity:
|
|
194
|
-
air_pressure:
|
|
195
|
-
pressure:
|
|
196
|
-
light_lux:
|
|
197
|
-
soil_temp_stemma:
|
|
198
|
-
soil_vwc:
|
|
199
|
-
soil_moisture:
|
|
200
|
-
soil_moisture_raw:
|
|
314
|
+
stick_id: import_zod4.z.string().optional().describe("Firmware alias for device_id"),
|
|
315
|
+
timestamp: import_zod4.z.number().optional().describe("Epoch timestamp from NTP"),
|
|
316
|
+
air_temp: import_zod4.z.number().optional().describe("Celsius"),
|
|
317
|
+
air_humid: import_zod4.z.number().optional().describe("Relative Humidity %"),
|
|
318
|
+
humidity: import_zod4.z.number().optional().describe("Firmware alias for air_humid"),
|
|
319
|
+
air_pressure: import_zod4.z.number().optional().describe("hPa"),
|
|
320
|
+
pressure: import_zod4.z.number().optional().describe("Firmware alias for air_pressure"),
|
|
321
|
+
light_lux: import_zod4.z.number().optional().describe("Lux level"),
|
|
322
|
+
soil_temp_stemma: import_zod4.z.number().optional().describe("Celsius"),
|
|
323
|
+
soil_vwc: import_zod4.z.number().describe("Volumetric Water Content / Raw Capacitance"),
|
|
324
|
+
soil_moisture: import_zod4.z.number().optional().describe("Firmware alias for raw capacitance"),
|
|
325
|
+
soil_moisture_raw: import_zod4.z.number().optional().describe("Unscaled capacitance (300-1100)")
|
|
201
326
|
}).passthrough();
|
|
202
|
-
var BodewellCommandSchema =
|
|
327
|
+
var BodewellCommandSchema = import_zod4.z.object({
|
|
203
328
|
stick_id: BodewellDeviceID,
|
|
204
329
|
// Note: Your API uses stick_id here, not device_id
|
|
205
|
-
type:
|
|
206
|
-
value:
|
|
330
|
+
type: import_zod4.z.enum(["dry", "wet"]),
|
|
331
|
+
value: import_zod4.z.number()
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
// src/ai/tools.ts
|
|
335
|
+
var import_zod5 = require("zod");
|
|
336
|
+
var telemetryGraphParameters = import_zod5.z.object({
|
|
337
|
+
deviceId: import_zod5.z.string().min(1, "Device ID is required"),
|
|
338
|
+
timeRange: import_zod5.z.enum(["1h", "24h", "7d"], {
|
|
339
|
+
errorMap: () => ({ message: "Time range must be 1h, 24h, or 7d" })
|
|
340
|
+
}),
|
|
341
|
+
metrics: import_zod5.z.array(
|
|
342
|
+
import_zod5.z.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
|
|
343
|
+
).min(1, "At least one metric is required").max(4, "Maximum 4 metrics per graph")
|
|
344
|
+
});
|
|
345
|
+
var stockChartParameters = import_zod5.z.object({
|
|
346
|
+
ticker: import_zod5.z.string().min(1).describe("The stock ticker symbol explicitly requested by the user. YOU MUST EXTRACT AND PROVIDE THIS (e.g., 'AAPL', 'MSFT')."),
|
|
347
|
+
timeRange: import_zod5.z.enum(["1D", "1W", "1M", "1Y"], {
|
|
348
|
+
errorMap: () => ({ message: "Time range must be 1D, 1W, 1M, or 1Y" })
|
|
349
|
+
}).describe("The time range for the chart. Choose based on user request or default to '1M'."),
|
|
350
|
+
metrics: import_zod5.z.array(import_zod5.z.enum(["price", "volume", "moving_average"])).min(1, "At least one metric is required").describe("Array of metrics to display. Always include 'price' and 'volume' unless user specifies otherwise.")
|
|
351
|
+
});
|
|
352
|
+
var AI_TOOLS = {
|
|
353
|
+
get_telemetry_graph: {
|
|
354
|
+
name: "get_telemetry_graph",
|
|
355
|
+
description: "Displays an interactive line chart of historical sensor telemetry data. Use this when the user asks to visualize trends, compare metrics over time, or analyze device performance. Supports temperature, humidity, VWC (volumetric water content), EC (electrical conductivity), pH, pressure, and CO2.",
|
|
356
|
+
parameters: telemetryGraphParameters
|
|
357
|
+
},
|
|
358
|
+
get_stock_chart: {
|
|
359
|
+
name: "get_stock_chart",
|
|
360
|
+
description: "Displays an interactive financial chart with price movements, volume, and technical indicators. Use this when the user asks to visualize stock performance, analyze price trends, or compare financial metrics over time. Supports daily (1D), weekly (1W), monthly (1M), and yearly (1Y) time ranges.",
|
|
361
|
+
parameters: stockChartParameters
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
// src/ai/registry.ts
|
|
366
|
+
var DEFAULT_SCHEMA_MODEL = "gemini-2.5-flash";
|
|
367
|
+
var DEFAULT_CHAT_MODEL = "gemini-2.5-flash";
|
|
368
|
+
var DEFAULT_PRO_MODEL = "gemini-2.5-pro";
|
|
369
|
+
var AI_ROSTER = {
|
|
370
|
+
/** The Strategist: high creativity, exploratory conversation */
|
|
371
|
+
STRATEGIST: {
|
|
372
|
+
model: DEFAULT_CHAT_MODEL,
|
|
373
|
+
provider: "google-gemini",
|
|
374
|
+
temperature: 0.7
|
|
375
|
+
},
|
|
376
|
+
/** The Architect: data schema and resource modeling — precision required */
|
|
377
|
+
ARCHITECT: {
|
|
378
|
+
model: DEFAULT_SCHEMA_MODEL,
|
|
379
|
+
provider: "google-gemini",
|
|
380
|
+
temperature: 0.3
|
|
381
|
+
},
|
|
382
|
+
/** The Designer: UI layout generation — moderate creativity */
|
|
383
|
+
DESIGNER: {
|
|
384
|
+
model: DEFAULT_SCHEMA_MODEL,
|
|
385
|
+
provider: "google-gemini",
|
|
386
|
+
temperature: 0.5
|
|
387
|
+
},
|
|
388
|
+
/** The Reviewer/Product Owner: structured plan output — strict adherence.
|
|
389
|
+
* Uses the Pro tier for superior reasoning on complex structured tasks.
|
|
390
|
+
*/
|
|
391
|
+
REVIEWER: {
|
|
392
|
+
model: DEFAULT_PRO_MODEL,
|
|
393
|
+
provider: "google-gemini",
|
|
394
|
+
temperature: 0.2
|
|
395
|
+
},
|
|
396
|
+
/** The Genesis Engine: one-shot app generation — must be schema-strict */
|
|
397
|
+
GENESIS: {
|
|
398
|
+
model: DEFAULT_SCHEMA_MODEL,
|
|
399
|
+
provider: "google-gemini",
|
|
400
|
+
temperature: 0.2
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
// src/ai/prompts/theme.prompt.ts
|
|
405
|
+
var THEME_SYSTEM_PROMPT = `
|
|
406
|
+
You are a Senior UI Design Engineer specializing in WCAG 2.1 Accessibility.
|
|
407
|
+
Generate a JSON theme for: "Ramme Project".
|
|
408
|
+
|
|
409
|
+
CRITICAL FONT RULE:
|
|
410
|
+
Do NOT use generic fonts like 'Roboto', 'Open Sans', or 'Lato' unless specifically asked.
|
|
411
|
+
Instead, pick high-contrast, expressive pairings from Google Fonts that match the vibe. Dont be afraid of taking risks.
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
VIBE-TO-FONT REFERENCE:
|
|
415
|
+
- Futuristic/Cyberpunk: 'Orbitron', 'Space Grotesk', 'Rajdhani', 'Exo 2', 'Syne'
|
|
416
|
+
- Elegant/Luxury: 'Playfair Display', 'Cormorant Garamond', 'Prata', 'Fraunces'
|
|
417
|
+
- Brutalist/Bold: 'Archivo Black', 'Syne', 'Bebas Neue', 'Lexend', 'Clash Display'
|
|
418
|
+
- Modern Tech: 'Inter', 'Sora', 'Plus Jakarta Sans', 'Outfit', 'Manrope'
|
|
419
|
+
- Retro/Whimsical: 'BioRhyme', 'Space Mono', 'Zilla Slab', 'Bungee'
|
|
420
|
+
|
|
421
|
+
RULES:
|
|
422
|
+
1. Use RGB space-separated values (e.g., "13 110 253").
|
|
423
|
+
2. Pick a high-quality Google Font pair (Heading + Body).
|
|
424
|
+
3. Ensure the 'fonts' object is included in the root of the JSON.
|
|
425
|
+
4. Use ONLY valid Google Font names (e.g., 'Montserrat', 'Inter', 'Playfair Display', 'Poppins', 'Lato', 'Merriweather').
|
|
426
|
+
5. Return ONLY raw JSON. No markdown backticks.
|
|
427
|
+
5. ACCESSIBILITY RULE (WCAG 2.1):
|
|
428
|
+
- The Contrast Ratio between --app-text-color and --app-bg-color MUST be at least 4.5:1.
|
|
429
|
+
- The Contrast Ratio between --app-primary-foreground-color and --app-primary-color MUST be at least 4.5:1.
|
|
430
|
+
- If the background is Light (high RGB values), the text MUST be Dark (low RGB values).
|
|
431
|
+
- If the background is Dark, the text MUST be Light.
|
|
432
|
+
- SECONDARY/ACCENT: Must be vibrant but legible.
|
|
433
|
+
|
|
434
|
+
JSON STRUCTURE:
|
|
435
|
+
{
|
|
436
|
+
"name": "Theme Name",
|
|
437
|
+
"description": "Vibe description",
|
|
438
|
+
"fonts": {
|
|
439
|
+
"heading": "Montserrat",
|
|
440
|
+
"body": "Inter"
|
|
441
|
+
},
|
|
442
|
+
"cssVars": {
|
|
443
|
+
"--app-primary-color": "R G B",
|
|
444
|
+
"--app-primary-foreground-color": "R G B",
|
|
445
|
+
"--app-secondary-color": "R G B",
|
|
446
|
+
"--app-accent-color": "R G B",
|
|
447
|
+
"--app-bg-color": "R G B",
|
|
448
|
+
"--app-card-bg-color": "R G B",
|
|
449
|
+
"--app-text-color": "R G B",
|
|
450
|
+
"--app-border-color": "R G B",
|
|
451
|
+
"--app-muted-bg": "R G B",
|
|
452
|
+
"--app-input-bg-color": "R G B",
|
|
453
|
+
"--app-input-border-color": "R G B",
|
|
454
|
+
"--app-chart-1": "R G B",
|
|
455
|
+
"--app-chart-2": "R G B",
|
|
456
|
+
"--app-chart-3": "R G B",
|
|
457
|
+
"--app-chart-4": "R G B",
|
|
458
|
+
"--app-chart-5": "R G B",
|
|
459
|
+
"--app-border-radius-md": "0.375rem"
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
`;
|
|
463
|
+
|
|
464
|
+
// src/ai/prompts/genesis.prompt.ts
|
|
465
|
+
var GENESIS_VALID_COMPONENTS = [
|
|
466
|
+
"SmartTable",
|
|
467
|
+
"StatCard",
|
|
468
|
+
"DeviceCard",
|
|
469
|
+
"BarChart",
|
|
470
|
+
"LineChart",
|
|
471
|
+
"PieChart",
|
|
472
|
+
"ActivityFeed",
|
|
473
|
+
"CodeBlock",
|
|
474
|
+
"StatusBadge",
|
|
475
|
+
"Card",
|
|
476
|
+
"SectionHeader",
|
|
477
|
+
"PageHeader",
|
|
478
|
+
"Accordion",
|
|
479
|
+
"FormTemplate",
|
|
480
|
+
"ChatFAB",
|
|
481
|
+
"EmptyState"
|
|
482
|
+
];
|
|
483
|
+
var GENESIS_LIBRARY_CONTEXT = `
|
|
484
|
+
You are a **Full-Stack Systems Architect**.
|
|
485
|
+
Your goal is to design a complete software solution: Data, Logic, and Interface.
|
|
486
|
+
|
|
487
|
+
### 1. NAVIGATION STRATEGY
|
|
488
|
+
- Simple Apps: Use 'sidebar'. Complex Apps (ERP, CRM): Use 'hub_spoke'.
|
|
489
|
+
- Always include a Dashboard page (slug: 'dashboard') with StatCards.
|
|
490
|
+
|
|
491
|
+
### 2. DATA STRATEGY (Resources)
|
|
492
|
+
- Define the "Nouns" (e.g., Users, Invoices, Sensors).
|
|
493
|
+
- Use specific field types ('currency', 'status', 'email').
|
|
494
|
+
|
|
495
|
+
### 3. LOGIC STRATEGY (Workflows)
|
|
496
|
+
- If user asks for "CRM", create: "On Record Create \u2192 Send Welcome Email".
|
|
497
|
+
- If user asks for "IoT Monitor", create: "On Signal Change (Temp > 80) \u2192 Send Alert".
|
|
498
|
+
|
|
499
|
+
### 4. INTERFACE STRATEGY (Pages)
|
|
500
|
+
- Use "SmartTable" for managing resources (connect via dataId prop).
|
|
501
|
+
- Use "StatCard" for KPIs.
|
|
502
|
+
- ALWAYS connect UI components to data using the 'dataId' prop.
|
|
503
|
+
|
|
504
|
+
**Valid Components:** ${GENESIS_VALID_COMPONENTS.join(", ")}
|
|
505
|
+
|
|
506
|
+
### 5. THEME STRATEGY (config.theme)
|
|
507
|
+
- Pick a theme preset that matches the user's domain and vibe:
|
|
508
|
+
- 'light' \u2192 clean, minimal, general-purpose SaaS
|
|
509
|
+
- 'dark' \u2192 data dashboards, developer tools, monitoring
|
|
510
|
+
- 'corporate' \u2192 finance, HR, professional services (green/amber)
|
|
511
|
+
- 'midnight' \u2192 analytics, creative tools, AI apps (indigo/purple)
|
|
512
|
+
- 'blueprint' \u2192 engineering, technical, IoT, infrastructure (blue/sharp)
|
|
513
|
+
- 'system' \u2192 follow OS preference (default if unsure)
|
|
514
|
+
- Only populate 'themeOverrides' when the user explicitly asks for a custom color.
|
|
515
|
+
|
|
516
|
+
### 6. DESIGN LAW \u2014 SEMANTIC TOKEN MANDATE (CRITICAL \u26A0\uFE0F)
|
|
517
|
+
The component library is FULLY THEME-REACTIVE. Tokens switch automatically when
|
|
518
|
+
the user changes from 'light' to 'dark' or 'midnight'. Raw colors BREAK this.
|
|
519
|
+
|
|
520
|
+
\u2705 REQUIRED \u2014 Always use these semantic Tailwind classes in block props:
|
|
521
|
+
bg-background \u2192 page-level and layout backgrounds
|
|
522
|
+
bg-card \u2192 card panels, modals, sidebars
|
|
523
|
+
bg-surface-muted \u2192 secondary panels, table wrappers, empty states
|
|
524
|
+
bg-primary \u2192 brand CTA buttons, active nav items, highlights
|
|
525
|
+
bg-table-header \u2192 table <thead> rows
|
|
526
|
+
text-foreground \u2192 all body copy and labels
|
|
527
|
+
text-muted-foreground \u2192 secondary text, helper copy, timestamps
|
|
528
|
+
text-primary \u2192 branded links, emphasis
|
|
529
|
+
border-border \u2192 all dividers, outlines, and card borders
|
|
530
|
+
ring-ring \u2192 focus rings on inputs and interactive elements
|
|
531
|
+
bg-success \u2192 positive status indicators
|
|
532
|
+
bg-warning \u2192 caution/warning indicators
|
|
533
|
+
bg-destructive \u2192 error/danger indicators
|
|
534
|
+
|
|
535
|
+
\u274C BANNED \u2014 Never use these raw Tailwind palette classes:
|
|
536
|
+
bg-blue-500, bg-blue-600, bg-indigo-500
|
|
537
|
+
bg-gray-50, bg-gray-100, bg-gray-800, bg-gray-900
|
|
538
|
+
text-gray-400, text-gray-500, text-gray-700, text-gray-900
|
|
539
|
+
border-gray-200, border-gray-300, border-gray-700
|
|
540
|
+
Any color with a numeric suffix (blue-500, red-400, green-600, etc.)
|
|
541
|
+
|
|
542
|
+
RULE: If you cannot express a UI intent with a semantic token from the \u2705 list,
|
|
543
|
+
use bg-card or bg-background as a safe fallback. NEVER invent raw colors.
|
|
544
|
+
`;
|
|
545
|
+
|
|
546
|
+
// src/theme/schema.ts
|
|
547
|
+
var import_zod6 = require("zod");
|
|
548
|
+
var RGBString = import_zod6.z.string().regex(
|
|
549
|
+
/^\d{1,3}\s+\d{1,3}\s+\d{1,3}$/,
|
|
550
|
+
'Must be space-separated RGB integers (e.g. "13 110 253")'
|
|
551
|
+
);
|
|
552
|
+
var ThemeOverridesSchema = import_zod6.z.object({
|
|
553
|
+
// ── Core Brand ───────────────────────────────────────────────────────────
|
|
554
|
+
"--app-primary-color": RGBString.optional(),
|
|
555
|
+
"--app-primary-foreground-color": RGBString.optional(),
|
|
556
|
+
"--app-secondary-color": RGBString.optional(),
|
|
557
|
+
"--app-secondary-foreground-color": RGBString.optional(),
|
|
558
|
+
"--app-accent-color": RGBString.optional(),
|
|
559
|
+
"--app-accent-foreground-color": RGBString.optional(),
|
|
560
|
+
// ── Base Surface ─────────────────────────────────────────────────────────
|
|
561
|
+
"--app-bg-color": RGBString.optional(),
|
|
562
|
+
"--app-card-bg-color": RGBString.optional(),
|
|
563
|
+
"--app-text-color": RGBString.optional(),
|
|
564
|
+
"--app-border-color": RGBString.optional(),
|
|
565
|
+
"--app-muted-bg": RGBString.optional(),
|
|
566
|
+
"--app-muted-text": RGBString.optional(),
|
|
567
|
+
// ── Shape ────────────────────────────────────────────────────────────────
|
|
568
|
+
"--app-border-radius-sm": import_zod6.z.string().optional(),
|
|
569
|
+
"--app-border-radius-md": import_zod6.z.string().optional(),
|
|
570
|
+
"--app-border-radius-lg": import_zod6.z.string().optional(),
|
|
571
|
+
// ── Form Controls ────────────────────────────────────────────────────────
|
|
572
|
+
"--app-input-bg-color": RGBString.optional(),
|
|
573
|
+
"--app-input-text-color": RGBString.optional(),
|
|
574
|
+
"--app-input-border-color": RGBString.optional(),
|
|
575
|
+
"--app-input-focus-ring-color": RGBString.optional(),
|
|
576
|
+
"--app-input-placeholder-color": RGBString.optional(),
|
|
577
|
+
// ── Chart Palette ────────────────────────────────────────────────────────
|
|
578
|
+
"--app-chart-1": RGBString.optional(),
|
|
579
|
+
"--app-chart-2": RGBString.optional(),
|
|
580
|
+
"--app-chart-3": RGBString.optional(),
|
|
581
|
+
"--app-chart-4": RGBString.optional(),
|
|
582
|
+
"--app-chart-5": RGBString.optional()
|
|
583
|
+
}).strict();
|
|
584
|
+
var ThemeFontsSchema = import_zod6.z.object({
|
|
585
|
+
/** Google Font name for headings (h1–h4, .font-serif). Example: "Playfair Display" */
|
|
586
|
+
heading: import_zod6.z.string(),
|
|
587
|
+
/** Google Font name for body text. Example: "Inter" */
|
|
588
|
+
body: import_zod6.z.string(),
|
|
589
|
+
/** Optional monospace font. Example: "Roboto Mono" */
|
|
590
|
+
mono: import_zod6.z.string().optional()
|
|
591
|
+
});
|
|
592
|
+
var AIThemeSchema = import_zod6.z.object({
|
|
593
|
+
/** Short descriptive theme name. Example: "Midnight Garden" */
|
|
594
|
+
name: import_zod6.z.string(),
|
|
595
|
+
/** One-sentence vibe description. Example: "Dark indigo with golden accents." */
|
|
596
|
+
description: import_zod6.z.string(),
|
|
597
|
+
/** Google Font pairing for heading and body text. */
|
|
598
|
+
fonts: ThemeFontsSchema.optional(),
|
|
599
|
+
/**
|
|
600
|
+
* CSS variable overrides.
|
|
601
|
+
* Every key must match an --app-* variable name.
|
|
602
|
+
* All color values must be space-separated RGB integers.
|
|
603
|
+
*/
|
|
604
|
+
cssVars: ThemeOverridesSchema
|
|
605
|
+
});
|
|
606
|
+
var THEME_PRESETS = ["light", "dark", "system", "corporate", "midnight", "blueprint"];
|
|
607
|
+
|
|
608
|
+
// src/auth/schema.ts
|
|
609
|
+
var import_zod7 = require("zod");
|
|
610
|
+
var UserSchema = import_zod7.z.object({
|
|
611
|
+
id: import_zod7.z.string().default(""),
|
|
612
|
+
name: import_zod7.z.string(),
|
|
613
|
+
email: import_zod7.z.string().email(),
|
|
614
|
+
password: import_zod7.z.string().optional(),
|
|
615
|
+
role: import_zod7.z.string(),
|
|
616
|
+
status: import_zod7.z.string().optional(),
|
|
617
|
+
joinedAt: import_zod7.z.string().optional(),
|
|
618
|
+
lastActive: import_zod7.z.string().optional(),
|
|
619
|
+
avatarUrl: import_zod7.z.string().optional()
|
|
207
620
|
});
|
|
208
621
|
// Annotate the CommonJS export names for ESM import in node:
|
|
209
622
|
0 && (module.exports = {
|
|
623
|
+
AIKeyManifestSchema,
|
|
624
|
+
AIThemeSchema,
|
|
625
|
+
AI_ROSTER,
|
|
626
|
+
AI_TOOLS,
|
|
210
627
|
ActionSchema,
|
|
628
|
+
AppSignalSchema,
|
|
211
629
|
AppSpecificationSchema,
|
|
630
|
+
AuthStrategySchema,
|
|
212
631
|
BlockSchema,
|
|
213
632
|
Bodewell,
|
|
633
|
+
DEFAULT_CHAT_MODEL,
|
|
634
|
+
DEFAULT_PRO_MODEL,
|
|
635
|
+
DEFAULT_SCHEMA_MODEL,
|
|
214
636
|
EntitySchema,
|
|
215
637
|
FieldSchema,
|
|
216
638
|
FloraTelemetrySchema,
|
|
639
|
+
GENESIS_LIBRARY_CONTEXT,
|
|
640
|
+
GENESIS_VALID_COMPONENTS,
|
|
217
641
|
PageSchema,
|
|
218
642
|
PageSectionSchema,
|
|
219
643
|
ResourceSchema,
|
|
644
|
+
SIGNAL_DOMAINS,
|
|
645
|
+
SIGNAL_KINDS,
|
|
646
|
+
SIGNAL_KIND_LABELS,
|
|
647
|
+
SIGNAL_SOURCES,
|
|
648
|
+
SignalArraySchema,
|
|
649
|
+
SignalKindSchema,
|
|
650
|
+
SignalPacketSchema,
|
|
220
651
|
SignalSchema,
|
|
652
|
+
SignalSourceSchema,
|
|
653
|
+
THEME_PRESETS,
|
|
654
|
+
THEME_SYSTEM_PROMPT,
|
|
655
|
+
ThemeFontsSchema,
|
|
656
|
+
ThemeOverridesSchema,
|
|
221
657
|
TriggerSchema,
|
|
222
|
-
|
|
658
|
+
UserSchema,
|
|
659
|
+
WorkflowSchema,
|
|
660
|
+
stockChartParameters,
|
|
661
|
+
telemetryGraphParameters
|
|
223
662
|
});
|