eny-ai 1.0.0 → 2.0.0

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.js CHANGED
@@ -3,20 +3,44 @@ import {
3
3
  TokenType,
4
4
  applyEvolve,
5
5
  hasWASMTarget,
6
- init_parser,
7
- init_tokenize,
8
- init_transpile,
9
6
  parse,
10
- parser_exports,
11
7
  runENY,
12
8
  tokenize,
13
9
  transpileToDTS,
14
10
  transpileToJS,
15
11
  transpileToWAT,
16
- transpile_exports,
17
12
  validateSemantic,
18
13
  validateSemanticFull
19
- } from "./chunk-2WFUL4XJ.js";
14
+ } from "./chunk-5PZUUNHS.js";
15
+ import {
16
+ ENYRuntime,
17
+ init_runtime,
18
+ runtime_exports
19
+ } from "./chunk-LVJ3GJRQ.js";
20
+ import {
21
+ EnyContext,
22
+ EnyUI,
23
+ EnyValidate,
24
+ useCallbackWithDeps,
25
+ useEnyEffect,
26
+ useEnyFetch,
27
+ useEnyState,
28
+ useLogger,
29
+ useMemoWithDeps,
30
+ useNavigation,
31
+ usePersistentState,
32
+ useReducerWithState,
33
+ useValidation
34
+ } from "./chunk-2NUS77CI.js";
35
+ import {
36
+ ENYFirebase,
37
+ firebase,
38
+ firebase_exports,
39
+ init_firebase,
40
+ useAuth,
41
+ useFirebase,
42
+ useRealtimeData
43
+ } from "./chunk-5KPALVCK.js";
20
44
  import {
21
45
  ALPHABET,
22
46
  FALSE,
@@ -45,17 +69,20 @@ import {
45
69
  toSymbolic,
46
70
  transpileSymbols,
47
71
  validate
48
- } from "./chunk-E4KJZEXX.js";
72
+ } from "./chunk-AJH2I5ZI.js";
49
73
  import {
50
- __toCommonJS
51
- } from "./chunk-PNKVD2UK.js";
74
+ __toCommonJS,
75
+ init_esm_shims
76
+ } from "./chunk-MXA7TAAG.js";
52
77
 
53
78
  // src/index.ts
54
- init_parser();
55
- init_tokenize();
56
- init_transpile();
79
+ init_esm_shims();
80
+
81
+ // src/types.ts
82
+ init_esm_shims();
57
83
 
58
84
  // src/ia/index.ts
85
+ init_esm_shims();
59
86
  var LocalIA = class {
60
87
  constructor() {
61
88
  this.name = "LocalIA";
@@ -192,291 +219,57 @@ async function processIA(ia, context, provider) {
192
219
  return p.process(ia, context);
193
220
  }
194
221
 
195
- // src/pillars.ts
196
- function createSystem(config) {
197
- const lines = [];
198
- lines.push(`\u03A3 SYSTEM "${config.name}"`);
199
- if (config.mode) lines.push(`\u03A3 MODE ${config.mode}`);
200
- if (config.ui) lines.push(`\u03A3 UI ${config.ui}`);
201
- if (config.evolve) lines.push(`\u03A3 EVOLVE true`);
202
- if (config.targets?.length) {
203
- lines.push(`\u03A3 TARGET ${config.targets.join(" + ")}`);
204
- }
205
- return lines.join("\n");
206
- }
207
- function getState(ast) {
208
- return {
209
- system: ast.system,
210
- mode: ast.mode,
211
- ui: ast.ui,
212
- version: ast.version,
213
- isEny: ast.isEny,
214
- substates: ast.substates || []
215
- };
216
- }
217
- function createFunction(name, args, steps) {
218
- const argsStr = args.length ? `(${args.join(", ")})` : "";
219
- const stepsStr = steps.map((s) => ` \u2192 ${s}`).join("\n");
220
- return `\u0394 function ${name}${argsStr}
221
- ${stepsStr}`;
222
- }
223
- function getFunctions(ast) {
224
- return ast.functions || [];
225
- }
226
- function createObject(name, props) {
227
- const propsStr = Object.entries(props).map(([k, v]) => ` ${k}: ${JSON.stringify(v)}`).join("\n");
228
- return `\u03A9 ${name} {
229
- ${propsStr}
230
- }`;
231
- }
232
- function createClass(name, props, methods = [], extendsClass) {
233
- const extendsStr = extendsClass ? ` \u2192 ${extendsClass}` : "";
234
- const propsStr = Object.entries(props).map(([k, v]) => ` ${k}: ${typeof v}`).join("\n");
235
- const methodsStr = methods.map((m) => ` ${m}()`).join("\n");
236
- return `\u25CB ${name}${extendsStr} {
237
- ${propsStr}
238
- ${methodsStr}
239
- }`;
240
- }
241
- function getStructures(ast) {
242
- return {
243
- objects: ast.objects || [],
244
- classes: ast.classes || [],
245
- modules: ast.modules || []
246
- };
247
- }
248
- function createEvent(name, handlers) {
249
- const handlersStr = handlers.map((h) => ` \u2192 ${h}`).join("\n");
250
- return `\u25CC ${name}
251
- ${handlersStr}`;
252
- }
253
- function createLoop(count, body) {
254
- const bodyStr = body.map((b) => ` ${b}`).join("\n");
255
- return `\u21BB ${count} {
256
- ${bodyStr}
257
- }`;
258
- }
259
- function getTemporals(ast) {
260
- return {
261
- events: ast.events || [],
262
- loops: ast.loops || [],
263
- causes: ast.causes || [],
264
- timeouts: ast.timeouts || [],
265
- delays: ast.delays || [],
266
- syncs: ast.syncs || []
267
- };
268
- }
269
- function createThrottle(target, limit) {
270
- return `\u23EC ${target} ${limit}`;
271
- }
272
- function createBoost(target, factor) {
273
- return `\u23EB ${target} ${factor}`;
274
- }
275
- function getEnergy(ast) {
276
- return {
277
- throttles: ast.throttles || [],
278
- boosts: ast.boosts || [],
279
- costs: ast.costs || []
280
- };
281
- }
282
- function createMemory(name, size, persist = false) {
283
- return `\u{1D4DC} ${name} ${size}${persist ? " persist" : ""}`;
284
- }
285
- function createPersist(target, storage = "db") {
286
- return `\u267E ${target} ${storage}`;
287
- }
288
- function getMemory(ast) {
289
- return {
290
- database: ast.database,
291
- memories: ast.memories || [],
292
- persists: ast.persists || []
293
- };
294
- }
295
- function createInput(name, type = "text") {
296
- return `\u2328 ${name} ${type}`;
297
- }
298
- function createVisual(name, props) {
299
- const propsStr = Object.entries(props).map(([k, v]) => ` ${k}: ${v}`).join("\n");
300
- return `\u{1F441} ${name} {
301
- ${propsStr}
302
- }`;
303
- }
304
- function getInterface(ast) {
305
- return {
306
- forms: ast.forms || [],
307
- inputs: ast.inputs || [],
308
- visuals: ast.visuals || [],
309
- interfaces: ast.interfaces || []
310
- };
311
- }
312
- function createSecurity(level, rules) {
313
- const rulesStr = rules.map((r) => ` ${r}`).join("\n");
314
- return `\u{1F6E1} ${level} {
315
- ${rulesStr}
316
- }`;
317
- }
318
- function createKey(name, permissions) {
319
- const permsStr = permissions.map((p) => ` ${p}`).join("\n");
320
- return `\u{1F511} ${name} {
321
- ${permsStr}
322
- }`;
323
- }
324
- function getSecurity(ast) {
325
- return {
326
- securities: ast.securities || [],
327
- keys: ast.keys || [],
328
- sandboxes: ast.sandboxes || [],
329
- locks: ast.locks || [],
330
- unlocks: ast.unlocks || []
331
- };
332
- }
333
- function createEvolve(steps) {
334
- const stepsStr = steps.map((s) => ` ${s}`).join("\n");
335
- return `\u27F3 {
336
- ${stepsStr}
337
- }`;
338
- }
339
- function getEvolve(ast) {
340
- return {
341
- evolve: ast.evolve,
342
- verifies: ast.verifies || [],
343
- logNodes: ast.logNodes || []
344
- };
345
- }
346
- function generateENY(config) {
347
- const parts = [];
348
- parts.push(`\u03A3 SYSTEM "${config.system.name}"`);
349
- if (config.system.mode) parts.push(`\u03A3 MODE ${config.system.mode}`);
350
- if (config.system.ui) parts.push(`\u03A3 UI ${config.system.ui}`);
351
- parts.push("");
352
- for (const fn2 of config.functions || []) {
353
- parts.push(createFunction(fn2.name, fn2.args || [], fn2.steps));
354
- parts.push("");
355
- }
356
- for (const obj of config.objects || []) {
357
- parts.push(createObject(obj.name, obj.props));
358
- parts.push("");
359
- }
360
- for (const evt of config.events || []) {
361
- parts.push(createEvent(evt.name, evt.handlers));
362
- parts.push("");
363
- }
364
- if (config.security) {
365
- parts.push(createSecurity(config.security.level, config.security.rules));
366
- parts.push("");
367
- }
368
- if (config.evolve?.length) {
369
- parts.push(createEvolve(config.evolve));
370
- }
371
- return parts.join("\n").trim();
372
- }
373
-
374
222
  // src/index.ts
375
- var VERSION = "1.0.0";
376
- var NAME = "eny-ai";
377
- var STATE = /* @__PURE__ */ Symbol("STATE");
378
- var SUBSTATE = /* @__PURE__ */ Symbol("SUBSTATE");
379
- var VOID_VAL = null;
380
- var TRUE_VAL = true;
381
- var FALSE_VAL = false;
382
- var OBJECT = /* @__PURE__ */ Symbol("OBJECT");
383
- var FUNCTION = /* @__PURE__ */ Symbol("FUNCTION");
384
- var INTERFACE = /* @__PURE__ */ Symbol("INTERFACE");
385
- var SHIELD = /* @__PURE__ */ Symbol("SECURITY");
386
- var EVOLVE = /* @__PURE__ */ Symbol("EVOLVE");
387
- function quickSystem(name, config) {
388
- return createSystem({
389
- name,
390
- mode: config?.mode || "development",
391
- ui: config?.ui || "auto",
392
- evolve: config?.evolve || false
393
- });
223
+ init_runtime();
224
+ init_firebase();
225
+ function createEnySystem() {
226
+ return new (init_runtime(), __toCommonJS(runtime_exports)).ENYRuntime();
394
227
  }
395
- function compile(enyCode) {
396
- const { transpileToJS: transpileToJS2 } = (init_transpile(), __toCommonJS(transpile_exports));
397
- const { parse: parse2 } = (init_parser(), __toCommonJS(parser_exports));
398
- const ast = parse2(enyCode);
399
- return transpileToJS2(ast);
400
- }
401
- function isValidENY(code) {
402
- try {
403
- const { parse: parse2 } = (init_parser(), __toCommonJS(parser_exports));
404
- const ast = parse2(code);
405
- return ast.isEny === true;
406
- } catch {
407
- return false;
408
- }
228
+ function initializeEnyFirebase(config) {
229
+ return new (init_firebase(), __toCommonJS(firebase_exports)).ENYFirebase().initialize(config);
409
230
  }
231
+ var VERSION = "2.0.0";
232
+ var NAME = "eny-ai";
410
233
  export {
411
234
  ALPHABET,
412
- EVOLVE,
235
+ ENYFirebase,
236
+ ENYRuntime,
237
+ EnyContext,
238
+ EnyUI,
239
+ EnyValidate,
413
240
  FALSE,
414
- FALSE_VAL,
415
- FUNCTION,
416
241
  IAManager,
417
- INTERFACE,
418
242
  LocalIA,
419
243
  NAME,
420
244
  NIL,
421
- OBJECT,
422
245
  RemoteIA,
423
- SHIELD,
424
- STATE,
425
- SUBSTATE,
426
246
  SYMBOLS,
427
247
  SYMBOL_NAMES,
428
248
  TRANSPILE_MAP,
429
249
  TRUE,
430
- TRUE_VAL,
431
250
  TokenType,
432
251
  VERSION,
433
252
  VOID,
434
- VOID_VAL,
435
253
  applyEvolve,
436
254
  asyncFn,
437
- compile,
438
255
  component,
439
- createBoost,
440
- createClass,
441
- createEvent,
442
- createEvolve,
443
- createFunction,
444
- createInput,
445
- createKey,
446
- createLoop,
447
- createMemory,
448
- createObject,
449
- createPersist,
450
- createSecurity,
451
- createSystem,
452
- createThrottle,
453
- createVisual,
256
+ createEnySystem,
454
257
  defaultIAManager,
455
258
  effect,
456
259
  error,
457
260
  filter,
458
261
  find,
262
+ firebase,
459
263
  fn,
460
- generateENY,
461
264
  get,
462
- getEnergy,
463
- getEvolve,
464
- getFunctions,
465
- getInterface,
466
- getMemory,
467
- getSecurity,
468
- getState,
469
- getStructures,
470
- getTemporals,
471
265
  hasWASMTarget,
472
- isValidENY,
266
+ initializeEnyFirebase,
473
267
  log,
474
268
  map,
475
269
  navigate,
476
270
  parse,
477
271
  post,
478
272
  processIA,
479
- quickSystem,
480
273
  reduce,
481
274
  runENY,
482
275
  shape,
@@ -489,6 +282,19 @@ export {
489
282
  transpileToDTS,
490
283
  transpileToJS,
491
284
  transpileToWAT,
285
+ useAuth,
286
+ useCallbackWithDeps,
287
+ useEnyEffect,
288
+ useEnyFetch,
289
+ useEnyState,
290
+ useFirebase,
291
+ useLogger,
292
+ useMemoWithDeps,
293
+ useNavigation,
294
+ usePersistentState,
295
+ useRealtimeData,
296
+ useReducerWithState,
297
+ useValidation,
492
298
  validate,
493
299
  validateSemantic,
494
300
  validateSemanticFull