@ramme-io/shared 2.0.1 → 2.0.3

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