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