@ramme-io/shared 2.0.1 → 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/dist/index.cjs CHANGED
@@ -20,21 +20,43 @@ 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,
23
26
  AI_TOOLS: () => AI_TOOLS,
24
27
  ActionSchema: () => ActionSchema,
28
+ AppSignalSchema: () => AppSignalSchema,
25
29
  AppSpecificationSchema: () => AppSpecificationSchema,
30
+ AuthStrategySchema: () => AuthStrategySchema,
26
31
  BlockSchema: () => BlockSchema,
27
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,
28
36
  EntitySchema: () => EntitySchema,
29
37
  FieldSchema: () => FieldSchema,
30
38
  FloraTelemetrySchema: () => FloraTelemetrySchema,
39
+ GENESIS_LIBRARY_CONTEXT: () => GENESIS_LIBRARY_CONTEXT,
40
+ GENESIS_VALID_COMPONENTS: () => GENESIS_VALID_COMPONENTS,
31
41
  PageSchema: () => PageSchema,
32
42
  PageSectionSchema: () => PageSectionSchema,
33
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,
34
51
  SignalSchema: () => SignalSchema,
52
+ SignalSourceSchema: () => SignalSourceSchema,
53
+ THEME_PRESETS: () => THEME_PRESETS,
54
+ THEME_SYSTEM_PROMPT: () => THEME_SYSTEM_PROMPT,
55
+ ThemeFontsSchema: () => ThemeFontsSchema,
56
+ ThemeOverridesSchema: () => ThemeOverridesSchema,
35
57
  TriggerSchema: () => TriggerSchema,
58
+ UserSchema: () => UserSchema,
36
59
  WorkflowSchema: () => WorkflowSchema,
37
- generateToolSystemPrompt: () => generateToolSystemPrompt,
38
60
  stockChartParameters: () => stockChartParameters,
39
61
  telemetryGraphParameters: () => telemetryGraphParameters
40
62
  });
@@ -63,7 +85,7 @@ var ResourceSchema = import_zod.z.object({
63
85
  exportable: import_zod.z.boolean().optional()
64
86
  }).optional()
65
87
  });
66
- var SignalSchema = import_zod.z.object({
88
+ var AppSignalSchema = import_zod.z.object({
67
89
  id: import_zod.z.string().min(1, "Signal ID is required"),
68
90
  label: import_zod.z.string(),
69
91
  description: import_zod.z.string().optional(),
@@ -144,6 +166,11 @@ var PageSchema = import_zod.z.object({
144
166
  icon: import_zod.z.string().optional(),
145
167
  sections: import_zod.z.array(PageSectionSchema)
146
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
+ });
147
174
  var AppSpecificationSchema = import_zod.z.object({
148
175
  meta: import_zod.z.object({
149
176
  name: import_zod.z.string(),
@@ -154,13 +181,15 @@ var AppSpecificationSchema = import_zod.z.object({
154
181
  }),
155
182
  config: import_zod.z.object({
156
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"),
157
185
  mockMode: import_zod.z.boolean().default(true),
158
- brokerUrl: import_zod.z.string().optional()
186
+ brokerUrl: import_zod.z.string().optional(),
187
+ aiKeyManifest: AIKeyManifestSchema.optional()
159
188
  }),
160
189
  modules: import_zod.z.array(import_zod.z.string()).optional(),
161
190
  resources: import_zod.z.array(ResourceSchema).optional(),
162
191
  domain: import_zod.z.object({
163
- signals: import_zod.z.array(SignalSchema),
192
+ signals: import_zod.z.array(AppSignalSchema),
164
193
  entities: import_zod.z.array(EntitySchema),
165
194
  workflows: import_zod.z.array(WorkflowSchema).optional()
166
195
  }),
@@ -173,6 +202,98 @@ var FloraTelemetrySchema = import_zod.z.object({
173
202
  temperature: import_zod.z.number().min(-40).max(125)
174
203
  });
175
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
+
176
297
  // src/bodewell/schema.ts
177
298
  var schema_exports = {};
178
299
  __export(schema_exports, {
@@ -180,53 +301,53 @@ __export(schema_exports, {
180
301
  BodewellDeviceID: () => BodewellDeviceID,
181
302
  BodewellTelemetrySchema: () => BodewellTelemetrySchema
182
303
  });
183
- var import_zod2 = require("zod");
184
- var BodewellDeviceID = import_zod2.z.enum([
304
+ var import_zod4 = require("zod");
305
+ var BodewellDeviceID = import_zod4.z.enum([
185
306
  "STK-V1-001",
186
307
  "STK-V1-002",
187
308
  "STK-V1-003",
188
309
  "STK-PRO-001",
189
310
  "STK-VIS-001"
190
311
  ]);
191
- var BodewellTelemetrySchema = import_zod2.z.object({
312
+ var BodewellTelemetrySchema = import_zod4.z.object({
192
313
  device_id: BodewellDeviceID,
193
- stick_id: import_zod2.z.string().optional().describe("Firmware alias for device_id"),
194
- timestamp: import_zod2.z.number().optional().describe("Epoch timestamp from NTP"),
195
- air_temp: import_zod2.z.number().optional().describe("Celsius"),
196
- air_humid: import_zod2.z.number().optional().describe("Relative Humidity %"),
197
- humidity: import_zod2.z.number().optional().describe("Firmware alias for air_humid"),
198
- air_pressure: import_zod2.z.number().optional().describe("hPa"),
199
- pressure: import_zod2.z.number().optional().describe("Firmware alias for air_pressure"),
200
- light_lux: import_zod2.z.number().optional().describe("Lux level"),
201
- soil_temp_stemma: import_zod2.z.number().optional().describe("Celsius"),
202
- soil_vwc: import_zod2.z.number().describe("Volumetric Water Content / Raw Capacitance"),
203
- soil_moisture: import_zod2.z.number().optional().describe("Firmware alias for raw capacitance"),
204
- soil_moisture_raw: import_zod2.z.number().optional().describe("Unscaled capacitance (300-1100)")
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)")
205
326
  }).passthrough();
206
- var BodewellCommandSchema = import_zod2.z.object({
327
+ var BodewellCommandSchema = import_zod4.z.object({
207
328
  stick_id: BodewellDeviceID,
208
329
  // Note: Your API uses stick_id here, not device_id
209
- type: import_zod2.z.enum(["dry", "wet"]),
210
- value: import_zod2.z.number()
330
+ type: import_zod4.z.enum(["dry", "wet"]),
331
+ value: import_zod4.z.number()
211
332
  });
212
333
 
213
334
  // src/ai/tools.ts
214
- var import_zod3 = require("zod");
215
- var telemetryGraphParameters = import_zod3.z.object({
216
- deviceId: import_zod3.z.string().min(1, "Device ID is required"),
217
- timeRange: import_zod3.z.enum(["1h", "24h", "7d"], {
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"], {
218
339
  errorMap: () => ({ message: "Time range must be 1h, 24h, or 7d" })
219
340
  }),
220
- metrics: import_zod3.z.array(
221
- import_zod3.z.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
341
+ metrics: import_zod5.z.array(
342
+ import_zod5.z.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
222
343
  ).min(1, "At least one metric is required").max(4, "Maximum 4 metrics per graph")
223
344
  });
224
- var stockChartParameters = import_zod3.z.object({
225
- ticker: import_zod3.z.string().min(1).describe("The stock ticker symbol explicitly requested by the user. YOU MUST EXTRACT AND PROVIDE THIS (e.g., 'AAPL', 'MSFT')."),
226
- timeRange: import_zod3.z.enum(["1D", "1W", "1M", "1Y"], {
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"], {
227
348
  errorMap: () => ({ message: "Time range must be 1D, 1W, 1M, or 1Y" })
228
349
  }).describe("The time range for the chart. Choose based on user request or default to '1M'."),
229
- metrics: import_zod3.z.array(import_zod3.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.")
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.")
230
351
  });
231
352
  var AI_TOOLS = {
232
353
  get_telemetry_graph: {
@@ -240,86 +361,302 @@ var AI_TOOLS = {
240
361
  parameters: stockChartParameters
241
362
  }
242
363
  };
243
- function generateToolSystemPrompt(tools) {
244
- const toolDescriptions = tools.map((tool) => {
245
- let paramsDesc = "See tool description for parameter details";
246
- if (tool.name === "get_telemetry_graph") {
247
- paramsDesc = `{
248
- "deviceId": "string (required)",
249
- "timeRange": "enum: '1h' | '24h' | '7d' (required)",
250
- "metrics": "array of enum: 'temperature' | 'humidity' | 'vwc' | 'ec' | 'ph' | 'pressure' | 'co2' (1-4 items required)"
251
- }`;
252
- }
253
- if (tool.name === "get_stock_chart") {
254
- paramsDesc = `{
255
- "ticker": "string (required, e.g., 'AAPL', 'TSLA')",
256
- "timeRange": "enum: '1D' | '1W' | '1M' | '1Y' (required)",
257
- "metrics": "array of enum: 'price' | 'volume' | 'moving_average' (1+ items required)"
258
- }`;
259
- }
260
- return `<tool name="${tool.name}">
261
- <description>${tool.description}</description>
262
- <parameters>${paramsDesc}</parameters>
263
- </tool>`;
264
- }).join("\n\n");
265
- return `
266
- You have access to the following tools to enhance your responses with interactive UI components:
267
-
268
- ${toolDescriptions}
269
364
 
270
- When you need to use a tool, output it in this EXACT XML format:
271
- <tool_call>
272
- {
273
- "name": "tool_name",
274
- "arguments": {
275
- "param1": "value1",
276
- "param2": "value2"
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
277
401
  }
278
- }
279
- </tool_call>
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".
280
408
 
281
- CRITICAL RULES:
282
- 1. Tool calls MUST be valid JSON wrapped in <tool_call></tool_call> XML tags.
283
- 2. Do NOT add any text before or after the tool_call tags on the same line.
284
- 3. You can include explanatory text before or after the tool call in separate paragraphs.
285
- 4. Only use tools when they directly serve the user's request.
286
- 5. Validate that all required parameters are present before calling a tool.
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
+
287
413
 
288
- Example usage:
289
- User: "Show me temperature trends for device ABC over the last 24 hours"
290
- You: "I'll visualize the temperature data for device ABC over the past day.
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.
291
433
 
292
- <tool_call>
293
- {
294
- "name": "get_telemetry_graph",
295
- "arguments": {
296
- "deviceId": "ABC",
297
- "timeRange": "24h",
298
- "metrics": ["temperature"]
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
+ }
299
461
  }
300
- }
301
- </tool_call>
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(", ")}
302
505
 
303
- The graph above shows the temperature fluctuations. Notice the spike around noon, which may indicate..."
304
- `.trim();
305
- }
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()
620
+ });
306
621
  // Annotate the CommonJS export names for ESM import in node:
307
622
  0 && (module.exports = {
623
+ AIKeyManifestSchema,
624
+ AIThemeSchema,
625
+ AI_ROSTER,
308
626
  AI_TOOLS,
309
627
  ActionSchema,
628
+ AppSignalSchema,
310
629
  AppSpecificationSchema,
630
+ AuthStrategySchema,
311
631
  BlockSchema,
312
632
  Bodewell,
633
+ DEFAULT_CHAT_MODEL,
634
+ DEFAULT_PRO_MODEL,
635
+ DEFAULT_SCHEMA_MODEL,
313
636
  EntitySchema,
314
637
  FieldSchema,
315
638
  FloraTelemetrySchema,
639
+ GENESIS_LIBRARY_CONTEXT,
640
+ GENESIS_VALID_COMPONENTS,
316
641
  PageSchema,
317
642
  PageSectionSchema,
318
643
  ResourceSchema,
644
+ SIGNAL_DOMAINS,
645
+ SIGNAL_KINDS,
646
+ SIGNAL_KIND_LABELS,
647
+ SIGNAL_SOURCES,
648
+ SignalArraySchema,
649
+ SignalKindSchema,
650
+ SignalPacketSchema,
319
651
  SignalSchema,
652
+ SignalSourceSchema,
653
+ THEME_PRESETS,
654
+ THEME_SYSTEM_PROMPT,
655
+ ThemeFontsSchema,
656
+ ThemeOverridesSchema,
320
657
  TriggerSchema,
658
+ UserSchema,
321
659
  WorkflowSchema,
322
- generateToolSystemPrompt,
323
660
  stockChartParameters,
324
661
  telemetryGraphParameters
325
662
  });