@decantr/registry 1.0.0-beta.3 → 1.0.0-beta.5

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.d.ts CHANGED
@@ -34,9 +34,17 @@ interface Pattern {
34
34
  }
35
35
  interface ArchetypePage {
36
36
  id: string;
37
- default_layout: string[];
37
+ default_layout: (string | {
38
+ pattern: string;
39
+ preset?: string;
40
+ as?: string;
41
+ })[];
38
42
  shell: string;
39
43
  }
44
+ interface SeoHints {
45
+ schema_org?: string[];
46
+ meta_priorities?: string[];
47
+ }
40
48
  interface Archetype {
41
49
  id: string;
42
50
  version: string;
@@ -49,6 +57,7 @@ interface Archetype {
49
57
  patterns: Record<string, string>;
50
58
  recipes: Record<string, string>;
51
59
  };
60
+ seo_hints?: SeoHints;
52
61
  }
53
62
  interface RecipeSpatialHints {
54
63
  density_bias: number;
@@ -96,19 +105,137 @@ interface Recipe {
96
105
  micro?: string;
97
106
  };
98
107
  }
108
+ type ArchetypeRole = 'primary' | 'gateway' | 'public' | 'auxiliary';
109
+ type ComposeEntry = string | {
110
+ archetype: string;
111
+ prefix: string;
112
+ role?: ArchetypeRole;
113
+ };
114
+ interface Blueprint {
115
+ id: string;
116
+ name: string;
117
+ description?: string;
118
+ archetype: string;
119
+ compose?: ComposeEntry[];
120
+ theme: {
121
+ style: string;
122
+ recipe?: string;
123
+ mode?: string;
124
+ shape?: string;
125
+ };
126
+ personality?: string;
127
+ pages: Array<{
128
+ id: string;
129
+ layout: string[];
130
+ shell?: string;
131
+ }>;
132
+ features?: string[];
133
+ version?: string;
134
+ }
135
+ interface Shell {
136
+ id: string;
137
+ name: string;
138
+ description?: string;
139
+ root?: string;
140
+ nav?: string;
141
+ header?: string;
142
+ nav_style?: string;
143
+ dimensions?: {
144
+ navWidth?: string;
145
+ headerHeight?: string;
146
+ };
147
+ }
99
148
  type ContentType = 'pattern' | 'archetype' | 'recipe' | 'theme' | 'blueprint';
100
149
  interface ResolvedContent<T> {
101
150
  item: T;
102
- source: 'local' | 'installed' | 'core';
151
+ source: 'local' | 'core';
103
152
  path: string;
104
153
  }
154
+ type CvdMode = 'deuteranopia' | 'protanopia' | 'tritanopia' | 'achromatopsia';
155
+ interface ThemeTokens {
156
+ base?: Record<string, string>;
157
+ cvd?: Partial<Record<CvdMode, Record<string, string>>>;
158
+ }
159
+ interface Theme {
160
+ id: string;
161
+ name: string;
162
+ description?: string;
163
+ tags?: string[];
164
+ personality?: string;
165
+ seed?: Record<string, string>;
166
+ modes?: string[];
167
+ shapes?: string[];
168
+ cvd_support?: CvdMode[];
169
+ tokens?: ThemeTokens;
170
+ decantr_compat?: string;
171
+ source?: string;
172
+ }
173
+ type ApiContentType = 'patterns' | 'recipes' | 'themes' | 'blueprints' | 'archetypes' | 'shells';
174
+ interface ContentListResponse<T = Record<string, unknown>> {
175
+ items: T[];
176
+ total: number;
177
+ }
178
+ interface ContentItem {
179
+ id: string;
180
+ slug: string;
181
+ namespace: string;
182
+ type: string;
183
+ version: string;
184
+ data: Record<string, unknown>;
185
+ visibility: 'public' | 'private';
186
+ status: 'pending' | 'approved' | 'rejected' | 'published';
187
+ created_at: string;
188
+ updated_at: string;
189
+ published_at?: string;
190
+ }
191
+ interface PublishPayload {
192
+ type: ApiContentType;
193
+ slug: string;
194
+ namespace: string;
195
+ version: string;
196
+ data: Record<string, unknown>;
197
+ visibility?: 'public' | 'private';
198
+ }
199
+ interface PublishResponse {
200
+ id: string;
201
+ slug: string;
202
+ namespace: string;
203
+ type: string;
204
+ status: string;
205
+ }
206
+ interface SearchParams {
207
+ q: string;
208
+ type?: string;
209
+ namespace?: string;
210
+ limit?: number;
211
+ offset?: number;
212
+ }
213
+ interface SearchResponse {
214
+ results: Array<{
215
+ id: string;
216
+ type: string;
217
+ slug: string;
218
+ namespace: string;
219
+ name: string;
220
+ description: string;
221
+ version: string;
222
+ }>;
223
+ total: number;
224
+ }
225
+ interface UserProfile {
226
+ id: string;
227
+ email: string;
228
+ tier: 'free' | 'pro' | 'team' | 'enterprise';
229
+ reputation_score: number;
230
+ trusted: boolean;
231
+ }
105
232
 
106
233
  type ContentMap = {
107
234
  pattern: Pattern;
108
235
  archetype: Archetype;
109
236
  recipe: Recipe;
110
237
  theme: Record<string, unknown>;
111
- blueprint: Record<string, unknown>;
238
+ blueprint: Blueprint;
112
239
  };
113
240
  interface ResolverOptions {
114
241
  contentRoot: string;
@@ -144,13 +271,80 @@ interface WiringResult {
144
271
  props: Record<string, Record<string, string>>;
145
272
  hookProps: Record<string, Record<string, string>>;
146
273
  }
274
+ /**
275
+ * IO declaration for a pattern, used by the data-driven wiring system.
276
+ */
277
+ interface PatternIOEntry {
278
+ id: string;
279
+ io: PatternIO;
280
+ }
281
+ /**
282
+ * A dynamically derived wiring edge between two patterns based on shared IO signals.
283
+ */
284
+ interface IOWiringEdge {
285
+ producer: string;
286
+ consumer: string;
287
+ signals: string[];
288
+ }
147
289
  declare const WIRING_RULES: WiringRule[];
148
- declare function detectWirings(layout: LayoutItem[]): WiringResult[];
290
+ /**
291
+ * Derive wiring edges from pattern IO declarations.
292
+ * If pattern A produces signal X and pattern B consumes signal X, an edge is created.
293
+ * Only patterns present in the layout are considered.
294
+ */
295
+ declare function deriveIOWirings(layoutIds: string[], patternIOMap: Map<string, PatternIO>): IOWiringEdge[];
296
+ /**
297
+ * Build a PatternIO map from an array of PatternIOEntry objects.
298
+ */
299
+ declare function buildIOMap(entries: PatternIOEntry[]): Map<string, PatternIO>;
300
+ /**
301
+ * Detect wirings from a layout. Uses hardcoded WIRING_RULES for detailed
302
+ * signal/prop information. When a patternIOMap is provided, also derives
303
+ * IO-based wirings and merges them (hardcoded rules take precedence for
304
+ * pairs they cover).
305
+ */
306
+ declare function detectWirings(layout: LayoutItem[], patternIOMap?: Map<string, PatternIO>): WiringResult[];
149
307
 
308
+ interface RegistryAPIClientOptions {
309
+ baseUrl?: string;
310
+ apiKey?: string;
311
+ timeoutMs?: number;
312
+ cacheTtlMs?: number;
313
+ }
314
+ declare class RegistryAPIClient {
315
+ private baseUrl;
316
+ private apiKey;
317
+ private timeoutMs;
318
+ private cacheTtlMs;
319
+ private cache;
320
+ constructor(options?: RegistryAPIClientOptions);
321
+ private buildHeaders;
322
+ private fetchWithTimeout;
323
+ private request;
324
+ private getCached;
325
+ private setCache;
326
+ clearCache(): void;
327
+ checkHealth(): Promise<boolean>;
328
+ listContent<T = Record<string, unknown>>(type: ApiContentType, params?: {
329
+ namespace?: string;
330
+ limit?: number;
331
+ offset?: number;
332
+ }): Promise<ContentListResponse<T>>;
333
+ getContent<T = Record<string, unknown>>(type: ApiContentType, namespace: string, slug: string): Promise<T>;
334
+ getPattern(namespace: string, slug: string): Promise<Pattern>;
335
+ getArchetype(namespace: string, slug: string): Promise<Archetype>;
336
+ getRecipe(namespace: string, slug: string): Promise<Recipe>;
337
+ getTheme(namespace: string, slug: string): Promise<Theme>;
338
+ getBlueprint(namespace: string, slug: string): Promise<Blueprint>;
339
+ getShell(namespace: string, slug: string): Promise<Shell>;
340
+ search(params: SearchParams): Promise<SearchResponse>;
341
+ getProfile(): Promise<UserProfile>;
342
+ publishContent(payload: PublishPayload): Promise<PublishResponse>;
343
+ getMyContent(): Promise<ContentListResponse<ContentItem>>;
344
+ getSchema(name?: string): Promise<Record<string, unknown>>;
345
+ }
150
346
  interface RegistryClientOptions {
151
347
  baseUrl?: string;
152
- cacheDir?: string;
153
- cacheTtl?: number;
154
348
  }
155
349
  interface SearchResult {
156
350
  id: string;
@@ -166,4 +360,4 @@ interface RegistryClient {
166
360
  }
167
361
  declare function createRegistryClient(options?: RegistryClientOptions): RegistryClient;
168
362
 
169
- export { type Archetype, type ArchetypePage, type ContentResolver, type ContentType, type HookType, type Pattern, type PatternIO, type PatternPreset, type Recipe, type RecipeShell, type RecipeSpatialHints, type RecipeVisualEffects, type RegistryClient, type RegistryClientOptions, type ResolvedContent, type ResolvedPreset, type ResolverOptions, type SearchResult, WIRING_RULES, type WiringResult, type WiringRule, type WiringSignal, createRegistryClient, createResolver, detectWirings, resolvePatternPreset };
363
+ export { type ApiContentType, type Archetype, type ArchetypePage, type ArchetypeRole, type Blueprint, type ComposeEntry, type ContentItem, type ContentListResponse, type ContentResolver, type ContentType, type HookType, type IOWiringEdge, type Pattern, type PatternIO, type PatternIOEntry, type PatternPreset, type PublishPayload, type PublishResponse, type Recipe, type RecipeShell, type RecipeSpatialHints, type RecipeVisualEffects, RegistryAPIClient, type RegistryAPIClientOptions, type RegistryClient, type RegistryClientOptions, type ResolvedContent, type ResolvedPreset, type ResolverOptions, type SearchParams, type SearchResponse, type SearchResult, type Shell, type UserProfile, WIRING_RULES, type WiringResult, type WiringRule, type WiringSignal, buildIOMap, createRegistryClient, createResolver, deriveIOWirings, detectWirings, resolvePatternPreset };
package/dist/index.js CHANGED
@@ -27,7 +27,10 @@ function createResolver(options) {
27
27
  const item = await tryLoadJson(filePath);
28
28
  if (item) return { item, source: "local", path: filePath };
29
29
  }
30
- const corePath = join(contentRoot, dir, fileName);
30
+ const mainPath = join(contentRoot, dir, fileName);
31
+ const mainItem = await tryLoadJson(mainPath);
32
+ if (mainItem) return { item: mainItem, source: "core", path: mainPath };
33
+ const corePath = join(contentRoot, "core", dir, fileName);
31
34
  const coreItem = await tryLoadJson(corePath);
32
35
  if (coreItem) return { item: coreItem, source: "core", path: corePath };
33
36
  return null;
@@ -110,21 +113,243 @@ function getPatternId(item) {
110
113
  if ("pattern" in item) return item.pattern;
111
114
  return null;
112
115
  }
113
- function detectWirings(layout) {
116
+ function deriveIOWirings(layoutIds, patternIOMap) {
117
+ const edges = [];
118
+ const layoutSet = new Set(layoutIds);
119
+ for (const producerId of layoutIds) {
120
+ const producerIO = patternIOMap.get(producerId);
121
+ if (!producerIO?.produces?.length) continue;
122
+ for (const consumerId of layoutIds) {
123
+ if (producerId === consumerId) continue;
124
+ if (!layoutSet.has(consumerId)) continue;
125
+ const consumerIO = patternIOMap.get(consumerId);
126
+ if (!consumerIO?.consumes?.length) continue;
127
+ const shared = producerIO.produces.filter(
128
+ (signal) => consumerIO.consumes.includes(signal)
129
+ );
130
+ if (shared.length > 0) {
131
+ edges.push({ producer: producerId, consumer: consumerId, signals: shared });
132
+ }
133
+ }
134
+ }
135
+ return edges;
136
+ }
137
+ function buildIOMap(entries) {
138
+ const map = /* @__PURE__ */ new Map();
139
+ for (const entry of entries) {
140
+ map.set(entry.id, entry.io);
141
+ }
142
+ return map;
143
+ }
144
+ function detectWirings(layout, patternIOMap) {
114
145
  const patternIds = layout.map(getPatternId).filter((id) => id !== null);
115
146
  const results = [];
147
+ const coveredPairs = /* @__PURE__ */ new Set();
116
148
  for (const rule of WIRING_RULES) {
117
149
  const [a, b] = rule.pair;
118
150
  if (patternIds.includes(a) && patternIds.includes(b)) {
119
151
  results.push({ rule, signals: rule.signals, props: rule.props, hookProps: rule.hookProps });
152
+ coveredPairs.add(`${a}:${b}`);
153
+ coveredPairs.add(`${b}:${a}`);
154
+ }
155
+ }
156
+ if (patternIOMap) {
157
+ const ioEdges = deriveIOWirings(patternIds, patternIOMap);
158
+ for (const edge of ioEdges) {
159
+ const pairKey = `${edge.producer}:${edge.consumer}`;
160
+ if (coveredPairs.has(pairKey)) continue;
161
+ coveredPairs.add(pairKey);
162
+ const signals = edge.signals.map((sig) => {
163
+ const camel = toCamelCase(sig);
164
+ return {
165
+ name: `page${capitalize(camel)}`,
166
+ init: "''",
167
+ hookType: classifySignal(sig)
168
+ };
169
+ });
170
+ const producerProps = {};
171
+ const consumerProps = {};
172
+ const producerHookProps = {};
173
+ const consumerHookProps = {};
174
+ for (const sig of edge.signals) {
175
+ const camel = toCamelCase(sig);
176
+ const stateName = `page${capitalize(camel)}`;
177
+ const setterName = `set${capitalize(stateName)}`;
178
+ producerProps[`on${capitalize(camel)}`] = setterName;
179
+ consumerProps[sig] = stateName;
180
+ producerHookProps[sig] = sig;
181
+ consumerHookProps[sig] = sig;
182
+ }
183
+ const rule = {
184
+ pair: [edge.producer, edge.consumer],
185
+ signals,
186
+ props: { [edge.producer]: producerProps, [edge.consumer]: consumerProps },
187
+ hookProps: { [edge.producer]: producerHookProps, [edge.consumer]: consumerHookProps }
188
+ };
189
+ results.push({ rule, signals, props: rule.props, hookProps: rule.hookProps });
120
190
  }
121
191
  }
122
192
  return results;
123
193
  }
194
+ function toCamelCase(str) {
195
+ return str.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
196
+ }
197
+ function capitalize(str) {
198
+ return str.charAt(0).toUpperCase() + str.slice(1);
199
+ }
200
+ function classifySignal(signal) {
201
+ const normalized = toCamelCase(signal);
202
+ if (normalized === "search") return "search";
203
+ if (normalized === "selection") return "selection";
204
+ if (normalized === "sort") return "sort";
205
+ return "filter";
206
+ }
124
207
 
125
- // src/client.ts
208
+ // src/api-client.ts
209
+ var DEFAULT_BASE_URL = "https://api.decantr.ai/v1";
210
+ var DEFAULT_TIMEOUT_MS = 8e3;
211
+ var DEFAULT_CACHE_TTL_MS = 5 * 60 * 1e3;
212
+ var RegistryAPIClient = class {
213
+ baseUrl;
214
+ apiKey;
215
+ timeoutMs;
216
+ cacheTtlMs;
217
+ cache = /* @__PURE__ */ new Map();
218
+ constructor(options = {}) {
219
+ this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;
220
+ this.apiKey = options.apiKey;
221
+ this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
222
+ this.cacheTtlMs = options.cacheTtlMs ?? DEFAULT_CACHE_TTL_MS;
223
+ }
224
+ // ── HTTP helpers ──
225
+ buildHeaders() {
226
+ const headers = {
227
+ "Accept": "application/json"
228
+ };
229
+ if (this.apiKey) {
230
+ headers["X-API-Key"] = this.apiKey;
231
+ }
232
+ return headers;
233
+ }
234
+ async fetchWithTimeout(url, init) {
235
+ const controller = new AbortController();
236
+ const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
237
+ try {
238
+ return await fetch(url, { ...init, signal: controller.signal });
239
+ } finally {
240
+ clearTimeout(timeout);
241
+ }
242
+ }
243
+ async request(path, init) {
244
+ const url = `${this.baseUrl}${path}`;
245
+ const response = await this.fetchWithTimeout(url, {
246
+ ...init,
247
+ headers: { ...this.buildHeaders(), ...init?.headers }
248
+ });
249
+ if (!response.ok) {
250
+ const body = await response.text().catch(() => "");
251
+ throw new Error(`API ${response.status}: ${body || response.statusText}`);
252
+ }
253
+ return response.json();
254
+ }
255
+ // ── Cache helpers ──
256
+ getCached(key) {
257
+ const entry = this.cache.get(key);
258
+ if (!entry) return null;
259
+ if (Date.now() - entry.timestamp > this.cacheTtlMs) {
260
+ this.cache.delete(key);
261
+ return null;
262
+ }
263
+ return entry.data;
264
+ }
265
+ setCache(key, data) {
266
+ this.cache.set(key, { data, timestamp: Date.now() });
267
+ }
268
+ clearCache() {
269
+ this.cache.clear();
270
+ }
271
+ // ── Health ──
272
+ async checkHealth() {
273
+ try {
274
+ const url = this.baseUrl.replace(/\/v1$/, "/health");
275
+ const response = await this.fetchWithTimeout(url);
276
+ return response.ok;
277
+ } catch {
278
+ return false;
279
+ }
280
+ }
281
+ // ── Content fetching (public) ──
282
+ async listContent(type, params) {
283
+ const cacheKey = `list:${type}:${JSON.stringify(params ?? {})}`;
284
+ const cached = this.getCached(cacheKey);
285
+ if (cached) return cached;
286
+ const searchParams = new URLSearchParams();
287
+ if (params?.namespace) searchParams.set("namespace", params.namespace);
288
+ if (params?.limit) searchParams.set("limit", String(params.limit));
289
+ if (params?.offset) searchParams.set("offset", String(params.offset));
290
+ const query = searchParams.toString();
291
+ const path = `/${type}${query ? `?${query}` : ""}`;
292
+ const result = await this.request(path);
293
+ this.setCache(cacheKey, result);
294
+ return result;
295
+ }
296
+ async getContent(type, namespace, slug) {
297
+ const cacheKey = `get:${type}:${namespace}:${slug}`;
298
+ const cached = this.getCached(cacheKey);
299
+ if (cached) return cached;
300
+ const result = await this.request(`/${type}/${namespace}/${slug}`);
301
+ this.setCache(cacheKey, result);
302
+ return result;
303
+ }
304
+ // ── Typed convenience methods ──
305
+ async getPattern(namespace, slug) {
306
+ return this.getContent("patterns", namespace, slug);
307
+ }
308
+ async getArchetype(namespace, slug) {
309
+ return this.getContent("archetypes", namespace, slug);
310
+ }
311
+ async getRecipe(namespace, slug) {
312
+ return this.getContent("recipes", namespace, slug);
313
+ }
314
+ async getTheme(namespace, slug) {
315
+ return this.getContent("themes", namespace, slug);
316
+ }
317
+ async getBlueprint(namespace, slug) {
318
+ return this.getContent("blueprints", namespace, slug);
319
+ }
320
+ async getShell(namespace, slug) {
321
+ return this.getContent("shells", namespace, slug);
322
+ }
323
+ // ── Search ──
324
+ async search(params) {
325
+ const searchParams = new URLSearchParams({ q: params.q });
326
+ if (params.type) searchParams.set("type", params.type);
327
+ if (params.namespace) searchParams.set("namespace", params.namespace);
328
+ if (params.limit) searchParams.set("limit", String(params.limit));
329
+ if (params.offset) searchParams.set("offset", String(params.offset));
330
+ return this.request(`/search?${searchParams}`);
331
+ }
332
+ // ── Authenticated endpoints ──
333
+ async getProfile() {
334
+ return this.request("/me");
335
+ }
336
+ async publishContent(payload) {
337
+ return this.request("/content", {
338
+ method: "POST",
339
+ headers: { "Content-Type": "application/json" },
340
+ body: JSON.stringify(payload)
341
+ });
342
+ }
343
+ async getMyContent() {
344
+ return this.request("/my/content");
345
+ }
346
+ // ── Schema ──
347
+ async getSchema(name = "essence.v3.json") {
348
+ return this.request(`/schema/${name}`);
349
+ }
350
+ };
126
351
  function createRegistryClient(options = {}) {
127
- const baseUrl = options.baseUrl ?? "https://decantr-registry.fly.dev/v1";
352
+ const baseUrl = options.baseUrl ?? "https://api.decantr.ai/v1";
128
353
  return {
129
354
  async search(query, type) {
130
355
  const params = new URLSearchParams({ q: query });
@@ -144,9 +369,12 @@ function createRegistryClient(options = {}) {
144
369
  };
145
370
  }
146
371
  export {
372
+ RegistryAPIClient,
147
373
  WIRING_RULES,
374
+ buildIOMap,
148
375
  createRegistryClient,
149
376
  createResolver,
377
+ deriveIOWirings,
150
378
  detectWirings,
151
379
  resolvePatternPreset
152
380
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/resolver.ts","../src/pattern.ts","../src/wiring.ts","../src/client.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { Pattern, Archetype, Recipe, ContentType, ResolvedContent } from './types.js';\n\ntype ContentMap = {\n pattern: Pattern;\n archetype: Archetype;\n recipe: Recipe;\n theme: Record<string, unknown>;\n blueprint: Record<string, unknown>;\n};\n\nexport interface ResolverOptions {\n contentRoot: string;\n overridePaths?: string[];\n}\n\nexport interface ContentResolver {\n resolve<T extends ContentType>(type: T, id: string): Promise<ResolvedContent<ContentMap[T]> | null>;\n}\n\nconst TYPE_DIRS: Record<ContentType, string> = {\n pattern: 'patterns',\n archetype: 'archetypes',\n recipe: 'recipes',\n theme: 'themes',\n blueprint: 'blueprints',\n};\n\nasync function tryLoadJson<T>(filePath: string): Promise<T | null> {\n try {\n const content = await readFile(filePath, 'utf-8');\n return JSON.parse(content) as T;\n } catch {\n return null;\n }\n}\n\nexport function createResolver(options: ResolverOptions): ContentResolver {\n const { contentRoot, overridePaths = [] } = options;\n return {\n async resolve<T extends ContentType>(type: T, id: string): Promise<ResolvedContent<ContentMap[T]> | null> {\n const dir = TYPE_DIRS[type];\n const fileName = `${id}.json`;\n for (const overridePath of overridePaths) {\n const filePath = join(overridePath, dir, fileName);\n const item = await tryLoadJson<ContentMap[T]>(filePath);\n if (item) return { item, source: 'local', path: filePath };\n }\n const corePath = join(contentRoot, dir, fileName);\n const coreItem = await tryLoadJson<ContentMap[T]>(corePath);\n if (coreItem) return { item: coreItem, source: 'core', path: corePath };\n return null;\n },\n };\n}\n","import type { Pattern, PatternPreset } from './types.js';\n\nexport interface ResolvedPreset {\n preset: string;\n layout: PatternPreset['layout'];\n code: PatternPreset['code'];\n}\n\nexport function resolvePatternPreset(\n pattern: Pattern,\n explicitPreset?: string,\n recipeDefaultPresets?: Record<string, string>,\n): ResolvedPreset {\n const presets = pattern.presets;\n const hasPresets = Object.keys(presets).length > 0;\n\n if (!hasPresets) {\n return {\n preset: '',\n layout: { layout: 'row', atoms: '' },\n code: pattern.code ?? { imports: '', example: '' },\n };\n }\n\n let presetName = explicitPreset;\n if (presetName && !presets[presetName]) presetName = undefined;\n if (!presetName && recipeDefaultPresets?.[pattern.id]) {\n const recipeName = recipeDefaultPresets[pattern.id];\n if (presets[recipeName]) presetName = recipeName;\n }\n if (!presetName) presetName = pattern.default_preset;\n if (!presetName || !presets[presetName]) presetName = Object.keys(presets)[0];\n\n const preset = presets[presetName];\n return { preset: presetName, layout: preset.layout, code: preset.code };\n}\n","import type { LayoutItem, PatternRef } from '@decantr/essence-spec';\n\n// AUTO: hookType classifies each signal for custom hook generation\nexport type HookType = 'search' | 'filter' | 'selection' | 'sort';\n\nexport interface WiringSignal { name: string; init: string; hookType: HookType }\n\nexport interface WiringRule {\n pair: [string, string];\n signals: WiringSignal[];\n props: Record<string, Record<string, string>>;\n // AUTO: hookProps maps pattern IDs to hook variable names passed as props\n hookProps: Record<string, Record<string, string>>;\n}\n\nexport interface WiringResult {\n rule: WiringRule;\n signals: WiringSignal[];\n props: Record<string, Record<string, string>>;\n hookProps: Record<string, Record<string, string>>;\n}\n\nexport const WIRING_RULES: WiringRule[] = [\n {\n pair: ['filter-bar', 'data-table'],\n signals: [\n { name: 'pageSearch', init: \"''\", hookType: 'search' },\n { name: 'pageStatus', init: \"'all'\", hookType: 'filter' },\n ],\n props: {\n 'filter-bar': { onSearch: 'setPageSearch', onCategory: 'setPageStatus' },\n 'data-table': { search: 'pageSearch', status: 'pageStatus' },\n },\n hookProps: {\n 'filter-bar': { search: 'search', filters: 'filters' },\n 'data-table': { search: 'search', filters: 'filters' },\n },\n },\n {\n pair: ['filter-bar', 'activity-feed'],\n signals: [\n { name: 'pageSearch', init: \"''\", hookType: 'search' },\n { name: 'pageView', init: \"'all'\", hookType: 'filter' },\n ],\n props: {\n 'filter-bar': { onSearch: 'setPageSearch', onView: 'setPageView' },\n 'activity-feed': { search: 'pageSearch', view: 'pageView' },\n },\n hookProps: {\n 'filter-bar': { search: 'search', filters: 'filters' },\n 'activity-feed': { search: 'search', filters: 'filters' },\n },\n },\n {\n pair: ['filter-bar', 'card-grid'],\n signals: [\n { name: 'pageSearch', init: \"''\", hookType: 'search' },\n ],\n props: {\n 'filter-bar': { onSearch: 'setPageSearch' },\n 'card-grid': { search: 'pageSearch' },\n },\n hookProps: {\n 'filter-bar': { search: 'search' },\n 'card-grid': { search: 'search' },\n },\n },\n];\n\nfunction getPatternId(item: LayoutItem): string | null {\n if (typeof item === 'string') return item;\n if ('pattern' in item) return (item as PatternRef).pattern;\n return null;\n}\n\nexport function detectWirings(layout: LayoutItem[]): WiringResult[] {\n const patternIds = layout.map(getPatternId).filter((id): id is string => id !== null);\n const results: WiringResult[] = [];\n for (const rule of WIRING_RULES) {\n const [a, b] = rule.pair;\n if (patternIds.includes(a) && patternIds.includes(b)) {\n results.push({ rule, signals: rule.signals, props: rule.props, hookProps: rule.hookProps });\n }\n }\n return results;\n}\n","export interface RegistryClientOptions {\n baseUrl?: string;\n cacheDir?: string;\n cacheTtl?: number;\n}\n\nexport interface SearchResult {\n id: string;\n type: string;\n name: string;\n description: string;\n version: string;\n tags: string[];\n}\n\nexport interface RegistryClient {\n search(query: string, type?: string): Promise<SearchResult[]>;\n fetch(type: string, id: string, version?: string): Promise<unknown>;\n}\n\nexport function createRegistryClient(options: RegistryClientOptions = {}): RegistryClient {\n const baseUrl = options.baseUrl ?? 'https://decantr-registry.fly.dev/v1';\n return {\n async search(query: string, type?: string): Promise<SearchResult[]> {\n const params = new URLSearchParams({ q: query });\n if (type) params.set('type', type);\n const res = await fetch(`${baseUrl}/search?${params}`);\n if (!res.ok) return [];\n const data = await res.json() as { results?: SearchResult[]; total?: number } | SearchResult[];\n // API returns { total, results } wrapper\n if (Array.isArray(data)) return data;\n return (data as { results: SearchResult[] }).results ?? [];\n },\n async fetch(type: string, id: string, version?: string): Promise<unknown> {\n const url = version ? `${baseUrl}/content/${type}/${id}/${version}` : `${baseUrl}/content/${type}/${id}`;\n const res = await fetch(url);\n if (!res.ok) return null;\n return res.json();\n },\n };\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,YAAY;AAoBrB,IAAM,YAAyC;AAAA,EAC7C,SAAS;AAAA,EACT,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,WAAW;AACb;AAEA,eAAe,YAAe,UAAqC;AACjE,MAAI;AACF,UAAM,UAAU,MAAM,SAAS,UAAU,OAAO;AAChD,WAAO,KAAK,MAAM,OAAO;AAAA,EAC3B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,eAAe,SAA2C;AACxE,QAAM,EAAE,aAAa,gBAAgB,CAAC,EAAE,IAAI;AAC5C,SAAO;AAAA,IACL,MAAM,QAA+B,MAAS,IAA4D;AACxG,YAAM,MAAM,UAAU,IAAI;AAC1B,YAAM,WAAW,GAAG,EAAE;AACtB,iBAAW,gBAAgB,eAAe;AACxC,cAAM,WAAW,KAAK,cAAc,KAAK,QAAQ;AACjD,cAAM,OAAO,MAAM,YAA2B,QAAQ;AACtD,YAAI,KAAM,QAAO,EAAE,MAAM,QAAQ,SAAS,MAAM,SAAS;AAAA,MAC3D;AACA,YAAM,WAAW,KAAK,aAAa,KAAK,QAAQ;AAChD,YAAM,WAAW,MAAM,YAA2B,QAAQ;AAC1D,UAAI,SAAU,QAAO,EAAE,MAAM,UAAU,QAAQ,QAAQ,MAAM,SAAS;AACtE,aAAO;AAAA,IACT;AAAA,EACF;AACF;;;AC/CO,SAAS,qBACd,SACA,gBACA,sBACgB;AAChB,QAAM,UAAU,QAAQ;AACxB,QAAM,aAAa,OAAO,KAAK,OAAO,EAAE,SAAS;AAEjD,MAAI,CAAC,YAAY;AACf,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ,EAAE,QAAQ,OAAO,OAAO,GAAG;AAAA,MACnC,MAAM,QAAQ,QA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/C,UAAI,KAAM,QAAO,IAAI,QAAQ,IAAI;AACjC,YAAM,MAAM,MAAM,MAAM,GAAG,OAAO,WAAW,MAAM,EAAE;AACrD,UAAI,CAAC,IAAI,GAAI,QAAO,CAAC;AACrB,YAAM,OAAO,MAAM,IAAI,KAAK;AAE5B,UAAI,MAAM,QAAQ,IAAI,EAAG,QAAO;AAChC,aAAQ,KAAqC,WAAW,CAAC;AAAA,IAC3D;AAAA,IACA,MAAM,MAAM,MAAc,IAAY,SAAoC;AACxE,YAAM,MAAM,UAAU,GAAG,OAAO,YAAY,IAAI,IAAI,EAAE,IAAI,OAAO,KAAK,GAAG,OAAO,YAAY,IAAI,IAAI,EAAE;AACtG,YAAM,MAAM,MAAM,MAAM,GAAG;AAC3B,UAAI,CAAC,IAAI,GAAI,QAAO;AACpB,aAAO,IAAI,KAAK;AAAA,IAClB;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/resolver.ts","../src/pattern.ts","../src/wiring.ts","../src/api-client.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { Pattern, Archetype, Recipe, Blueprint, ContentType, ResolvedContent } from './types.js';\n\ntype ContentMap = {\n pattern: Pattern;\n archetype: Archetype;\n recipe: Recipe;\n theme: Record<string, unknown>;\n blueprint: Blueprint;\n};\n\nexport interface ResolverOptions {\n contentRoot: string;\n overridePaths?: string[];\n}\n\nexport interface ContentResolver {\n resolve<T extends ContentType>(type: T, id: string): Promise<ResolvedContent<ContentMap[T]> | null>;\n}\n\nconst TYPE_DIRS: Record<ContentType, string> = {\n pattern: 'patterns',\n archetype: 'archetypes',\n recipe: 'recipes',\n theme: 'themes',\n blueprint: 'blueprints',\n};\n\nasync function tryLoadJson<T>(filePath: string): Promise<T | null> {\n try {\n const content = await readFile(filePath, 'utf-8');\n return JSON.parse(content) as T;\n } catch {\n return null;\n }\n}\n\nexport function createResolver(options: ResolverOptions): ContentResolver {\n const { contentRoot, overridePaths = [] } = options;\n return {\n async resolve<T extends ContentType>(type: T, id: string): Promise<ResolvedContent<ContentMap[T]> | null> {\n const dir = TYPE_DIRS[type];\n const fileName = `${id}.json`;\n for (const overridePath of overridePaths) {\n const filePath = join(overridePath, dir, fileName);\n const item = await tryLoadJson<ContentMap[T]>(filePath);\n if (item) return { item, source: 'local', path: filePath };\n }\n // Check main content directory\n const mainPath = join(contentRoot, dir, fileName);\n const mainItem = await tryLoadJson<ContentMap[T]>(mainPath);\n if (mainItem) return { item: mainItem, source: 'core', path: mainPath };\n\n // Check content/core/{type}/ as fallback\n const corePath = join(contentRoot, 'core', dir, fileName);\n const coreItem = await tryLoadJson<ContentMap[T]>(corePath);\n if (coreItem) return { item: coreItem, source: 'core', path: corePath };\n\n return null;\n },\n };\n}\n","import type { Pattern, PatternPreset } from './types.js';\n\nexport interface ResolvedPreset {\n preset: string;\n layout: PatternPreset['layout'];\n code: PatternPreset['code'];\n}\n\nexport function resolvePatternPreset(\n pattern: Pattern,\n explicitPreset?: string,\n recipeDefaultPresets?: Record<string, string>,\n): ResolvedPreset {\n const presets = pattern.presets;\n const hasPresets = Object.keys(presets).length > 0;\n\n if (!hasPresets) {\n return {\n preset: '',\n layout: { layout: 'row', atoms: '' },\n code: pattern.code ?? { imports: '', example: '' },\n };\n }\n\n let presetName = explicitPreset;\n if (presetName && !presets[presetName]) presetName = undefined;\n if (!presetName && recipeDefaultPresets?.[pattern.id]) {\n const recipeName = recipeDefaultPresets[pattern.id];\n if (presets[recipeName]) presetName = recipeName;\n }\n if (!presetName) presetName = pattern.default_preset;\n if (!presetName || !presets[presetName]) presetName = Object.keys(presets)[0];\n\n const preset = presets[presetName];\n return { preset: presetName, layout: preset.layout, code: preset.code };\n}\n","import type { LayoutItem, PatternRef } from '@decantr/essence-spec';\nimport type { PatternIO } from './types.js';\n\n// AUTO: hookType classifies each signal for custom hook generation\nexport type HookType = 'search' | 'filter' | 'selection' | 'sort';\n\nexport interface WiringSignal { name: string; init: string; hookType: HookType }\n\nexport interface WiringRule {\n pair: [string, string];\n signals: WiringSignal[];\n props: Record<string, Record<string, string>>;\n // AUTO: hookProps maps pattern IDs to hook variable names passed as props\n hookProps: Record<string, Record<string, string>>;\n}\n\nexport interface WiringResult {\n rule: WiringRule;\n signals: WiringSignal[];\n props: Record<string, Record<string, string>>;\n hookProps: Record<string, Record<string, string>>;\n}\n\n/**\n * IO declaration for a pattern, used by the data-driven wiring system.\n */\nexport interface PatternIOEntry {\n id: string;\n io: PatternIO;\n}\n\n/**\n * A dynamically derived wiring edge between two patterns based on shared IO signals.\n */\nexport interface IOWiringEdge {\n producer: string;\n consumer: string;\n signals: string[];\n}\n\nexport const WIRING_RULES: WiringRule[] = [\n {\n pair: ['filter-bar', 'data-table'],\n signals: [\n { name: 'pageSearch', init: \"''\", hookType: 'search' },\n { name: 'pageStatus', init: \"'all'\", hookType: 'filter' },\n ],\n props: {\n 'filter-bar': { onSearch: 'setPageSearch', onCategory: 'setPageStatus' },\n 'data-table': { search: 'pageSearch', status: 'pageStatus' },\n },\n hookProps: {\n 'filter-bar': { search: 'search', filters: 'filters' },\n 'data-table': { search: 'search', filters: 'filters' },\n },\n },\n {\n pair: ['filter-bar', 'activity-feed'],\n signals: [\n { name: 'pageSearch', init: \"''\", hookType: 'search' },\n { name: 'pageView', init: \"'all'\", hookType: 'filter' },\n ],\n props: {\n 'filter-bar': { onSearch: 'setPageSearch', onView: 'setPageView' },\n 'activity-feed': { search: 'pageSearch', view: 'pageView' },\n },\n hookProps: {\n 'filter-bar': { search: 'search', filters: 'filters' },\n 'activity-feed': { search: 'search', filters: 'filters' },\n },\n },\n {\n pair: ['filter-bar', 'card-grid'],\n signals: [\n { name: 'pageSearch', init: \"''\", hookType: 'search' },\n ],\n props: {\n 'filter-bar': { onSearch: 'setPageSearch' },\n 'card-grid': { search: 'pageSearch' },\n },\n hookProps: {\n 'filter-bar': { search: 'search' },\n 'card-grid': { search: 'search' },\n },\n },\n];\n\nfunction getPatternId(item: LayoutItem): string | null {\n if (typeof item === 'string') return item;\n if ('pattern' in item) return (item as PatternRef).pattern;\n return null;\n}\n\n/**\n * Derive wiring edges from pattern IO declarations.\n * If pattern A produces signal X and pattern B consumes signal X, an edge is created.\n * Only patterns present in the layout are considered.\n */\nexport function deriveIOWirings(\n layoutIds: string[],\n patternIOMap: Map<string, PatternIO>,\n): IOWiringEdge[] {\n const edges: IOWiringEdge[] = [];\n const layoutSet = new Set(layoutIds);\n\n for (const producerId of layoutIds) {\n const producerIO = patternIOMap.get(producerId);\n if (!producerIO?.produces?.length) continue;\n\n for (const consumerId of layoutIds) {\n if (producerId === consumerId) continue;\n if (!layoutSet.has(consumerId)) continue;\n const consumerIO = patternIOMap.get(consumerId);\n if (!consumerIO?.consumes?.length) continue;\n\n const shared = producerIO.produces.filter(\n (signal) => consumerIO.consumes!.includes(signal),\n );\n if (shared.length > 0) {\n edges.push({ producer: producerId, consumer: consumerId, signals: shared });\n }\n }\n }\n\n return edges;\n}\n\n/**\n * Build a PatternIO map from an array of PatternIOEntry objects.\n */\nexport function buildIOMap(entries: PatternIOEntry[]): Map<string, PatternIO> {\n const map = new Map<string, PatternIO>();\n for (const entry of entries) {\n map.set(entry.id, entry.io);\n }\n return map;\n}\n\n/**\n * Detect wirings from a layout. Uses hardcoded WIRING_RULES for detailed\n * signal/prop information. When a patternIOMap is provided, also derives\n * IO-based wirings and merges them (hardcoded rules take precedence for\n * pairs they cover).\n */\nexport function detectWirings(\n layout: LayoutItem[],\n patternIOMap?: Map<string, PatternIO>,\n): WiringResult[] {\n const patternIds = layout.map(getPatternId).filter((id): id is string => id !== null);\n const results: WiringResult[] = [];\n const coveredPairs = new Set<string>();\n\n // Apply hardcoded rules first (these have detailed signal/prop info)\n for (const rule of WIRING_RULES) {\n const [a, b] = rule.pair;\n if (patternIds.includes(a) && patternIds.includes(b)) {\n results.push({ rule, signals: rule.signals, props: rule.props, hookProps: rule.hookProps });\n coveredPairs.add(`${a}:${b}`);\n coveredPairs.add(`${b}:${a}`);\n }\n }\n\n // If IO map provided, derive additional wirings from IO declarations\n if (patternIOMap) {\n const ioEdges = deriveIOWirings(patternIds, patternIOMap);\n for (const edge of ioEdges) {\n const pairKey = `${edge.producer}:${edge.consumer}`;\n if (coveredPairs.has(pairKey)) continue;\n coveredPairs.add(pairKey);\n\n // Generate a synthetic WiringRule from IO signals\n const signals: WiringSignal[] = edge.signals.map((sig) => {\n const camel = toCamelCase(sig);\n return {\n name: `page${capitalize(camel)}`,\n init: \"''\",\n hookType: classifySignal(sig),\n };\n });\n\n const producerProps: Record<string, string> = {};\n const consumerProps: Record<string, string> = {};\n const producerHookProps: Record<string, string> = {};\n const consumerHookProps: Record<string, string> = {};\n\n for (const sig of edge.signals) {\n const camel = toCamelCase(sig);\n const stateName = `page${capitalize(camel)}`;\n const setterName = `set${capitalize(stateName)}`;\n producerProps[`on${capitalize(camel)}`] = setterName;\n consumerProps[sig] = stateName;\n producerHookProps[sig] = sig;\n consumerHookProps[sig] = sig;\n }\n\n const rule: WiringRule = {\n pair: [edge.producer, edge.consumer],\n signals,\n props: { [edge.producer]: producerProps, [edge.consumer]: consumerProps },\n hookProps: { [edge.producer]: producerHookProps, [edge.consumer]: consumerHookProps },\n };\n\n results.push({ rule, signals, props: rule.props, hookProps: rule.hookProps });\n }\n }\n\n return results;\n}\n\n/**\n * Convert a kebab-case string to camelCase.\n */\nfunction toCamelCase(str: string): string {\n return str.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase());\n}\n\n/**\n * Capitalize the first letter of a string.\n */\nfunction capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\n/**\n * Classify a signal name into a HookType for code generation.\n */\nfunction classifySignal(signal: string): HookType {\n const normalized = toCamelCase(signal);\n if (normalized === 'search') return 'search';\n if (normalized === 'selection') return 'selection';\n if (normalized === 'sort') return 'sort';\n return 'filter';\n}\n","import type {\n Pattern,\n Archetype,\n Recipe,\n Theme,\n Blueprint,\n Shell,\n ApiContentType,\n ContentListResponse,\n ContentItem,\n PublishPayload,\n PublishResponse,\n SearchParams,\n SearchResponse,\n UserProfile,\n} from './types.js';\n\nconst DEFAULT_BASE_URL = 'https://api.decantr.ai/v1';\nconst DEFAULT_TIMEOUT_MS = 8000;\nconst DEFAULT_CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes\n\ninterface CacheEntry<T> {\n data: T;\n timestamp: number;\n}\n\nexport interface RegistryAPIClientOptions {\n baseUrl?: string;\n apiKey?: string;\n timeoutMs?: number;\n cacheTtlMs?: number;\n}\n\nexport class RegistryAPIClient {\n private baseUrl: string;\n private apiKey: string | undefined;\n private timeoutMs: number;\n private cacheTtlMs: number;\n private cache = new Map<string, CacheEntry<unknown>>();\n\n constructor(options: RegistryAPIClientOptions = {}) {\n this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n this.apiKey = options.apiKey;\n this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n this.cacheTtlMs = options.cacheTtlMs ?? DEFAULT_CACHE_TTL_MS;\n }\n\n // ── HTTP helpers ──\n\n private buildHeaders(): Record<string, string> {\n const headers: Record<string, string> = {\n 'Accept': 'application/json',\n };\n if (this.apiKey) {\n headers['X-API-Key'] = this.apiKey;\n }\n return headers;\n }\n\n private async fetchWithTimeout(url: string, init?: RequestInit): Promise<Response> {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), this.timeoutMs);\n try {\n return await fetch(url, { ...init, signal: controller.signal });\n } finally {\n clearTimeout(timeout);\n }\n }\n\n private async request<T>(path: string, init?: RequestInit): Promise<T> {\n const url = `${this.baseUrl}${path}`;\n const response = await this.fetchWithTimeout(url, {\n ...init,\n headers: { ...this.buildHeaders(), ...init?.headers },\n });\n if (!response.ok) {\n const body = await response.text().catch(() => '');\n throw new Error(`API ${response.status}: ${body || response.statusText}`);\n }\n return response.json() as Promise<T>;\n }\n\n // ── Cache helpers ──\n\n private getCached<T>(key: string): T | null {\n const entry = this.cache.get(key) as CacheEntry<T> | undefined;\n if (!entry) return null;\n if (Date.now() - entry.timestamp > this.cacheTtlMs) {\n this.cache.delete(key);\n return null;\n }\n return entry.data;\n }\n\n private setCache<T>(key: string, data: T): void {\n this.cache.set(key, { data, timestamp: Date.now() });\n }\n\n clearCache(): void {\n this.cache.clear();\n }\n\n // ── Health ──\n\n async checkHealth(): Promise<boolean> {\n try {\n const url = this.baseUrl.replace(/\\/v1$/, '/health');\n const response = await this.fetchWithTimeout(url);\n return response.ok;\n } catch {\n return false;\n }\n }\n\n // ── Content fetching (public) ──\n\n async listContent<T = Record<string, unknown>>(\n type: ApiContentType,\n params?: { namespace?: string; limit?: number; offset?: number }\n ): Promise<ContentListResponse<T>> {\n const cacheKey = `list:${type}:${JSON.stringify(params ?? {})}`;\n const cached = this.getCached<ContentListResponse<T>>(cacheKey);\n if (cached) return cached;\n\n const searchParams = new URLSearchParams();\n if (params?.namespace) searchParams.set('namespace', params.namespace);\n if (params?.limit) searchParams.set('limit', String(params.limit));\n if (params?.offset) searchParams.set('offset', String(params.offset));\n\n const query = searchParams.toString();\n const path = `/${type}${query ? `?${query}` : ''}`;\n const result = await this.request<ContentListResponse<T>>(path);\n this.setCache(cacheKey, result);\n return result;\n }\n\n async getContent<T = Record<string, unknown>>(\n type: ApiContentType,\n namespace: string,\n slug: string\n ): Promise<T> {\n const cacheKey = `get:${type}:${namespace}:${slug}`;\n const cached = this.getCached<T>(cacheKey);\n if (cached) return cached;\n\n const result = await this.request<T>(`/${type}/${namespace}/${slug}`);\n this.setCache(cacheKey, result);\n return result;\n }\n\n // ── Typed convenience methods ──\n\n async getPattern(namespace: string, slug: string): Promise<Pattern> {\n return this.getContent<Pattern>('patterns', namespace, slug);\n }\n\n async getArchetype(namespace: string, slug: string): Promise<Archetype> {\n return this.getContent<Archetype>('archetypes', namespace, slug);\n }\n\n async getRecipe(namespace: string, slug: string): Promise<Recipe> {\n return this.getContent<Recipe>('recipes', namespace, slug);\n }\n\n async getTheme(namespace: string, slug: string): Promise<Theme> {\n return this.getContent<Theme>('themes', namespace, slug);\n }\n\n async getBlueprint(namespace: string, slug: string): Promise<Blueprint> {\n return this.getContent<Blueprint>('blueprints', namespace, slug);\n }\n\n async getShell(namespace: string, slug: string): Promise<Shell> {\n return this.getContent<Shell>('shells', namespace, slug);\n }\n\n // ── Search ──\n\n async search(params: SearchParams): Promise<SearchResponse> {\n const searchParams = new URLSearchParams({ q: params.q });\n if (params.type) searchParams.set('type', params.type);\n if (params.namespace) searchParams.set('namespace', params.namespace);\n if (params.limit) searchParams.set('limit', String(params.limit));\n if (params.offset) searchParams.set('offset', String(params.offset));\n\n return this.request<SearchResponse>(`/search?${searchParams}`);\n }\n\n // ── Authenticated endpoints ──\n\n async getProfile(): Promise<UserProfile> {\n return this.request<UserProfile>('/me');\n }\n\n async publishContent(payload: PublishPayload): Promise<PublishResponse> {\n return this.request<PublishResponse>('/content', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(payload),\n });\n }\n\n async getMyContent(): Promise<ContentListResponse<ContentItem>> {\n return this.request<ContentListResponse<ContentItem>>('/my/content');\n }\n\n // ── Schema ──\n\n async getSchema(name: string = 'essence.v3.json'): Promise<Record<string, unknown>> {\n return this.request<Record<string, unknown>>(`/schema/${name}`);\n }\n}\n\n// ── Lightweight registry client (merged from client.ts) ──\n\nexport interface RegistryClientOptions {\n baseUrl?: string;\n}\n\nexport interface SearchResult {\n id: string;\n type: string;\n name: string;\n description: string;\n version: string;\n tags: string[];\n}\n\nexport interface RegistryClient {\n search(query: string, type?: string): Promise<SearchResult[]>;\n fetch(type: string, id: string, version?: string): Promise<unknown>;\n}\n\nexport function createRegistryClient(options: RegistryClientOptions = {}): RegistryClient {\n const baseUrl = options.baseUrl ?? 'https://api.decantr.ai/v1';\n return {\n async search(query: string, type?: string): Promise<SearchResult[]> {\n const params = new URLSearchParams({ q: query });\n if (type) params.set('type', type);\n const res = await fetch(`${baseUrl}/search?${params}`);\n if (!res.ok) return [];\n const data = await res.json() as { results?: SearchResult[]; total?: number } | SearchResult[];\n // API returns { total, results } wrapper\n if (Array.isArray(data)) return data;\n return (data as { results: SearchResult[] }).results ?? [];\n },\n async fetch(type: string, id: string, version?: string): Promise<unknown> {\n const url = version ? `${baseUrl}/content/${type}/${id}/${version}` : `${baseUrl}/content/${type}/${id}`;\n const res = await fetch(url);\n if (!res.ok) return null;\n return res.json();\n },\n };\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,YAAY;AAoBrB,IAAM,YAAyC;AAAA,EAC7C,SAAS;AAAA,EACT,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,WAAW;AACb;AAEA,eAAe,YAAe,UAAqC;AACjE,MAAI;AACF,UAAM,UAAU,MAAM,SAAS,UAAU,OAAO;AAChD,WAAO,KAAK,MAAM,OAAO;AAAA,EAC3B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,eAAe,SAA2C;AACxE,QAAM,EAAE,aAAa,gBAAgB,CAAC,EAAE,IAAI;AAC5C,SAAO;AAAA,IACL,MAAM,QAA+B,MAAS,IAA4D;AACxG,YAAM,MAAM,UAAU,IAAI;AAC1B,YAAM,WAAW,GAAG,EAAE;AACtB,iBAAW,gBAAgB,eAAe;AACxC,cAAM,WAAW,KAAK,cAAc,KAAK,QAAQ;AACjD,cAAM,OAAO,MAAM,YAA2B,QAAQ;AACtD,YAAI,KAAM,QAAO,EAAE,MAAM,QAAQ,SAAS,MAAM,SAAS;AAAA,MAC3D;AAEA,YAAM,WAAW,KAAK,aAAa,KAAK,QAAQ;AAChD,YAAM,WAAW,MAAM,YAA2B,QAAQ;AAC1D,UAAI,SAAU,QAAO,EAAE,MAAM,UAAU,QAAQ,QAAQ,MAAM,SAAS;AAGtE,YAAM,WAAW,KAAK,aAAa,QAAQ,KAAK,QAAQ;AACxD,YAAM,WAAW,MAAM,YAA2B,QAAQ;AAC1D,UAAI,SAAU,QAAO,EAAE,MAAM,UAAU,QAAQ,Q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I,GAAI,QAAO;AACpB,aAAO,IAAI,KAAK;AAAA,IAClB;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decantr/registry",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.0.0-beta.5",
4
4
  "description": "Registry format, content resolver, and wiring rules for Decantr",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,18 +18,16 @@
18
18
  "types": "./dist/index.d.ts"
19
19
  }
20
20
  },
21
- "files": [
22
- "dist"
23
- ],
21
+ "files": ["dist"],
24
22
  "publishConfig": {
25
23
  "access": "public"
26
24
  },
27
- "dependencies": {
28
- "@decantr/essence-spec": "1.0.0-beta.3"
29
- },
30
25
  "scripts": {
31
26
  "build": "tsup",
32
27
  "test": "vitest run",
33
28
  "test:watch": "vitest"
29
+ },
30
+ "dependencies": {
31
+ "@decantr/essence-spec": "workspace:*"
34
32
  }
35
- }
33
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Decantr AI
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.