enyosx-ai 0.1.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/LICENSE +18 -0
- package/README.md +740 -0
- package/dist/chunk-2WM5L76D.js +320 -0
- package/dist/chunk-3BNDFBX3.js +324 -0
- package/dist/chunk-4LJILSCT.js +30 -0
- package/dist/chunk-4ZV5JV6W.js +298 -0
- package/dist/chunk-76PHNPTY.js +631 -0
- package/dist/chunk-BSSA33NY.js +677 -0
- package/dist/chunk-EK6IDRY7.js +105 -0
- package/dist/chunk-FI2EBH2N.js +2232 -0
- package/dist/chunk-GAKKLY4M.js +276 -0
- package/dist/chunk-HR4G5XQI.js +319 -0
- package/dist/chunk-HROGCEE5.js +30 -0
- package/dist/chunk-MMH7M7MG.js +30 -0
- package/dist/chunk-NGLRXS6G.js +2079 -0
- package/dist/chunk-NSE6LQJC.js +681 -0
- package/dist/chunk-O5XZOSBW.js +2484 -0
- package/dist/chunk-OVCMUPMP.js +677 -0
- package/dist/chunk-P2YBRE3X.js +2484 -0
- package/dist/chunk-VVIL5NIM.js +318 -0
- package/dist/chunk-ZNGEBY33.js +273 -0
- package/dist/cli.cjs +2509 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +99 -0
- package/dist/index.cjs +2912 -0
- package/dist/index.d.ts +672 -0
- package/dist/index.js +379 -0
- package/dist/parser-4JXKOWKY.js +8 -0
- package/dist/parser-UUB6D2CZ.js +8 -0
- package/dist/parser-V44AIVNI.js +8 -0
- package/examples/README.md +13 -0
- package/examples/ia-demo.eny +37 -0
- package/examples/sample.eny +15 -0
- package/examples/simple/system.eny +7 -0
- package/examples/spec/sample.eny +19 -0
- package/examples/starter/README.md +96 -0
- package/examples/starter/main.eny +39 -0
- package/examples/starter/run.js +68 -0
- package/examples/starter.eny +16 -0
- package/examples/wasm-demo.eny +34 -0
- package/package.json +49 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SYMBOL_NAMES,
|
|
3
|
+
TokenType,
|
|
4
|
+
applyEvolve,
|
|
5
|
+
hasWASMTarget,
|
|
6
|
+
parse,
|
|
7
|
+
runENY,
|
|
8
|
+
tokenize,
|
|
9
|
+
transpileToDTS,
|
|
10
|
+
transpileToJS,
|
|
11
|
+
transpileToWAT,
|
|
12
|
+
validateSemantic,
|
|
13
|
+
validateSemanticFull
|
|
14
|
+
} from "./chunk-O5XZOSBW.js";
|
|
15
|
+
|
|
16
|
+
// src/ia/index.ts
|
|
17
|
+
var LocalIA = class {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.name = "LocalIA";
|
|
20
|
+
this.capabilities = /* @__PURE__ */ new Map();
|
|
21
|
+
this.capabilities.set("aprender", () => ({ learned: true }));
|
|
22
|
+
this.capabilities.set("sugerir", () => ({ suggestions: ["option1", "option2"] }));
|
|
23
|
+
this.capabilities.set("evoluir", () => ({ evolved: true }));
|
|
24
|
+
this.capabilities.set("analisar", () => ({ analysis: "completed" }));
|
|
25
|
+
this.capabilities.set("prever", () => ({ prediction: "success" }));
|
|
26
|
+
this.capabilities.set("otimizar", () => ({ optimized: true }));
|
|
27
|
+
}
|
|
28
|
+
async isAvailable() {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
async process(ia, context) {
|
|
32
|
+
const log = context?.onLog;
|
|
33
|
+
if (log) {
|
|
34
|
+
log({
|
|
35
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
36
|
+
level: "info",
|
|
37
|
+
event: "ia.process.start",
|
|
38
|
+
detail: { name: ia.name, capabilities: ia.body }
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const results = {};
|
|
42
|
+
const processedCapabilities = [];
|
|
43
|
+
for (const capability of ia.body) {
|
|
44
|
+
const capName = capability.split(/\s+/)[0].toLowerCase();
|
|
45
|
+
const handler = this.capabilities.get(capName);
|
|
46
|
+
if (handler) {
|
|
47
|
+
results[capName] = handler();
|
|
48
|
+
processedCapabilities.push(capName);
|
|
49
|
+
if (log) {
|
|
50
|
+
log({
|
|
51
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
52
|
+
level: "debug",
|
|
53
|
+
event: "ia.capability.executed",
|
|
54
|
+
detail: { capability: capName, result: results[capName] }
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
results[capName] = { status: "acknowledged", raw: capability };
|
|
59
|
+
processedCapabilities.push(capName);
|
|
60
|
+
if (log) {
|
|
61
|
+
log({
|
|
62
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
63
|
+
level: "warn",
|
|
64
|
+
event: "ia.capability.unknown",
|
|
65
|
+
detail: { capability: capName, raw: capability }
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (log) {
|
|
71
|
+
log({
|
|
72
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
73
|
+
level: "info",
|
|
74
|
+
event: "ia.process.complete",
|
|
75
|
+
detail: { name: ia.name, processedCount: processedCapabilities.length }
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
success: true,
|
|
80
|
+
result: results,
|
|
81
|
+
capabilities: processedCapabilities
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Register a custom capability handler
|
|
86
|
+
*/
|
|
87
|
+
registerCapability(name, handler) {
|
|
88
|
+
this.capabilities.set(name.toLowerCase(), handler);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var RemoteIA = class {
|
|
92
|
+
constructor(endpoint, apiKey) {
|
|
93
|
+
this.name = "RemoteIA";
|
|
94
|
+
this.endpoint = endpoint;
|
|
95
|
+
this.apiKey = apiKey;
|
|
96
|
+
}
|
|
97
|
+
async isAvailable() {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
async process(ia, context) {
|
|
101
|
+
const log = context?.onLog;
|
|
102
|
+
if (log) {
|
|
103
|
+
log({
|
|
104
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
105
|
+
level: "warn",
|
|
106
|
+
event: "ia.remote.notImplemented",
|
|
107
|
+
detail: { endpoint: this.endpoint }
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
success: false,
|
|
112
|
+
error: "RemoteIA is not implemented yet. Use LocalIA for development."
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
var IAManager = class {
|
|
117
|
+
constructor(defaultProvider) {
|
|
118
|
+
this.providers = /* @__PURE__ */ new Map();
|
|
119
|
+
this.defaultProvider = defaultProvider || new LocalIA();
|
|
120
|
+
this.providers.set(this.defaultProvider.name, this.defaultProvider);
|
|
121
|
+
}
|
|
122
|
+
registerProvider(provider) {
|
|
123
|
+
this.providers.set(provider.name, provider);
|
|
124
|
+
}
|
|
125
|
+
getProvider(name) {
|
|
126
|
+
if (name && this.providers.has(name)) {
|
|
127
|
+
return this.providers.get(name);
|
|
128
|
+
}
|
|
129
|
+
return this.defaultProvider;
|
|
130
|
+
}
|
|
131
|
+
async processIA(ia, context, providerName) {
|
|
132
|
+
const provider = this.getProvider(providerName);
|
|
133
|
+
const available = await provider.isAvailable();
|
|
134
|
+
if (!available) {
|
|
135
|
+
if (provider.name !== "LocalIA") {
|
|
136
|
+
const localIA = this.providers.get("LocalIA") || new LocalIA();
|
|
137
|
+
return localIA.process(ia, context);
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
success: false,
|
|
141
|
+
error: `Provider ${provider.name} is not available`
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
return provider.process(ia, context);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
var defaultIAManager = new IAManager();
|
|
148
|
+
async function processIA(ia, context, provider) {
|
|
149
|
+
const p = provider || new LocalIA();
|
|
150
|
+
return p.process(ia, context);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// src/pillars.ts
|
|
154
|
+
function createSystem(config) {
|
|
155
|
+
const lines = [];
|
|
156
|
+
lines.push(`\u03A3 SYSTEM "${config.name}"`);
|
|
157
|
+
if (config.mode)
|
|
158
|
+
lines.push(`\u03A3 MODE ${config.mode}`);
|
|
159
|
+
if (config.ui)
|
|
160
|
+
lines.push(`\u03A3 UI ${config.ui}`);
|
|
161
|
+
if (config.evolve)
|
|
162
|
+
lines.push(`\u03A3 EVOLVE true`);
|
|
163
|
+
if (config.targets?.length) {
|
|
164
|
+
lines.push(`\u03A3 TARGET ${config.targets.join(" + ")}`);
|
|
165
|
+
}
|
|
166
|
+
return lines.join("\n");
|
|
167
|
+
}
|
|
168
|
+
function getState(ast) {
|
|
169
|
+
return {
|
|
170
|
+
system: ast.system,
|
|
171
|
+
mode: ast.mode,
|
|
172
|
+
ui: ast.ui,
|
|
173
|
+
version: ast.version,
|
|
174
|
+
isEny: ast.isEny,
|
|
175
|
+
substates: ast.substates || []
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function createFunction(name, args, steps) {
|
|
179
|
+
const argsStr = args.length ? `(${args.join(", ")})` : "";
|
|
180
|
+
const stepsStr = steps.map((s) => ` \u2192 ${s}`).join("\n");
|
|
181
|
+
return `\u0394 function ${name}${argsStr}
|
|
182
|
+
${stepsStr}`;
|
|
183
|
+
}
|
|
184
|
+
function getFunctions(ast) {
|
|
185
|
+
return ast.functions || [];
|
|
186
|
+
}
|
|
187
|
+
function createObject(name, props) {
|
|
188
|
+
const propsStr = Object.entries(props).map(([k, v]) => ` ${k}: ${JSON.stringify(v)}`).join("\n");
|
|
189
|
+
return `\u03A9 ${name} {
|
|
190
|
+
${propsStr}
|
|
191
|
+
}`;
|
|
192
|
+
}
|
|
193
|
+
function createClass(name, props, methods = [], extendsClass) {
|
|
194
|
+
const extendsStr = extendsClass ? ` \u2192 ${extendsClass}` : "";
|
|
195
|
+
const propsStr = Object.entries(props).map(([k, v]) => ` ${k}: ${typeof v}`).join("\n");
|
|
196
|
+
const methodsStr = methods.map((m) => ` ${m}()`).join("\n");
|
|
197
|
+
return `\u25CB ${name}${extendsStr} {
|
|
198
|
+
${propsStr}
|
|
199
|
+
${methodsStr}
|
|
200
|
+
}`;
|
|
201
|
+
}
|
|
202
|
+
function getStructures(ast) {
|
|
203
|
+
return {
|
|
204
|
+
objects: ast.objects || [],
|
|
205
|
+
classes: ast.classes || [],
|
|
206
|
+
modules: ast.modules || []
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function createEvent(name, handlers) {
|
|
210
|
+
const handlersStr = handlers.map((h) => ` \u2192 ${h}`).join("\n");
|
|
211
|
+
return `\u25CC ${name}
|
|
212
|
+
${handlersStr}`;
|
|
213
|
+
}
|
|
214
|
+
function createLoop(count, body) {
|
|
215
|
+
const bodyStr = body.map((b) => ` ${b}`).join("\n");
|
|
216
|
+
return `\u21BB ${count} {
|
|
217
|
+
${bodyStr}
|
|
218
|
+
}`;
|
|
219
|
+
}
|
|
220
|
+
function getTemporals(ast) {
|
|
221
|
+
return {
|
|
222
|
+
events: ast.events || [],
|
|
223
|
+
loops: ast.loops || [],
|
|
224
|
+
causes: ast.causes || [],
|
|
225
|
+
timeouts: ast.timeouts || [],
|
|
226
|
+
delays: ast.delays || [],
|
|
227
|
+
syncs: ast.syncs || []
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function createThrottle(target, limit) {
|
|
231
|
+
return `\u23EC ${target} ${limit}`;
|
|
232
|
+
}
|
|
233
|
+
function createBoost(target, factor) {
|
|
234
|
+
return `\u23EB ${target} ${factor}`;
|
|
235
|
+
}
|
|
236
|
+
function getEnergy(ast) {
|
|
237
|
+
return {
|
|
238
|
+
throttles: ast.throttles || [],
|
|
239
|
+
boosts: ast.boosts || [],
|
|
240
|
+
costs: ast.costs || []
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function createMemory(name, size, persist = false) {
|
|
244
|
+
return `\u{1D4DC} ${name} ${size}${persist ? " persist" : ""}`;
|
|
245
|
+
}
|
|
246
|
+
function createPersist(target, storage = "db") {
|
|
247
|
+
return `\u267E ${target} ${storage}`;
|
|
248
|
+
}
|
|
249
|
+
function getMemory(ast) {
|
|
250
|
+
return {
|
|
251
|
+
database: ast.database,
|
|
252
|
+
memories: ast.memories || [],
|
|
253
|
+
persists: ast.persists || []
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function createInput(name, type = "text") {
|
|
257
|
+
return `\u2328 ${name} ${type}`;
|
|
258
|
+
}
|
|
259
|
+
function createVisual(name, props) {
|
|
260
|
+
const propsStr = Object.entries(props).map(([k, v]) => ` ${k}: ${v}`).join("\n");
|
|
261
|
+
return `\u{1F441} ${name} {
|
|
262
|
+
${propsStr}
|
|
263
|
+
}`;
|
|
264
|
+
}
|
|
265
|
+
function getInterface(ast) {
|
|
266
|
+
return {
|
|
267
|
+
forms: ast.forms || [],
|
|
268
|
+
inputs: ast.inputs || [],
|
|
269
|
+
visuals: ast.visuals || [],
|
|
270
|
+
interfaces: ast.interfaces || []
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function createSecurity(level, rules) {
|
|
274
|
+
const rulesStr = rules.map((r) => ` ${r}`).join("\n");
|
|
275
|
+
return `\u{1F6E1} ${level} {
|
|
276
|
+
${rulesStr}
|
|
277
|
+
}`;
|
|
278
|
+
}
|
|
279
|
+
function createKey(name, permissions) {
|
|
280
|
+
const permsStr = permissions.map((p) => ` ${p}`).join("\n");
|
|
281
|
+
return `\u{1F511} ${name} {
|
|
282
|
+
${permsStr}
|
|
283
|
+
}`;
|
|
284
|
+
}
|
|
285
|
+
function getSecurity(ast) {
|
|
286
|
+
return {
|
|
287
|
+
securities: ast.securities || [],
|
|
288
|
+
keys: ast.keys || [],
|
|
289
|
+
sandboxes: ast.sandboxes || [],
|
|
290
|
+
locks: ast.locks || [],
|
|
291
|
+
unlocks: ast.unlocks || []
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
function createEvolve(steps) {
|
|
295
|
+
const stepsStr = steps.map((s) => ` ${s}`).join("\n");
|
|
296
|
+
return `\u27F3 {
|
|
297
|
+
${stepsStr}
|
|
298
|
+
}`;
|
|
299
|
+
}
|
|
300
|
+
function getEvolve(ast) {
|
|
301
|
+
return {
|
|
302
|
+
evolve: ast.evolve,
|
|
303
|
+
verifies: ast.verifies || [],
|
|
304
|
+
logNodes: ast.logNodes || []
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
function generateENY(config) {
|
|
308
|
+
const parts = [];
|
|
309
|
+
parts.push(`\u03A3 SYSTEM "${config.system.name}"`);
|
|
310
|
+
if (config.system.mode)
|
|
311
|
+
parts.push(`\u03A3 MODE ${config.system.mode}`);
|
|
312
|
+
if (config.system.ui)
|
|
313
|
+
parts.push(`\u03A3 UI ${config.system.ui}`);
|
|
314
|
+
parts.push("");
|
|
315
|
+
for (const fn of config.functions || []) {
|
|
316
|
+
parts.push(createFunction(fn.name, fn.args || [], fn.steps));
|
|
317
|
+
parts.push("");
|
|
318
|
+
}
|
|
319
|
+
for (const obj of config.objects || []) {
|
|
320
|
+
parts.push(createObject(obj.name, obj.props));
|
|
321
|
+
parts.push("");
|
|
322
|
+
}
|
|
323
|
+
for (const evt of config.events || []) {
|
|
324
|
+
parts.push(createEvent(evt.name, evt.handlers));
|
|
325
|
+
parts.push("");
|
|
326
|
+
}
|
|
327
|
+
if (config.security) {
|
|
328
|
+
parts.push(createSecurity(config.security.level, config.security.rules));
|
|
329
|
+
parts.push("");
|
|
330
|
+
}
|
|
331
|
+
if (config.evolve?.length) {
|
|
332
|
+
parts.push(createEvolve(config.evolve));
|
|
333
|
+
}
|
|
334
|
+
return parts.join("\n").trim();
|
|
335
|
+
}
|
|
336
|
+
export {
|
|
337
|
+
IAManager,
|
|
338
|
+
LocalIA,
|
|
339
|
+
RemoteIA,
|
|
340
|
+
SYMBOL_NAMES,
|
|
341
|
+
TokenType,
|
|
342
|
+
applyEvolve,
|
|
343
|
+
createBoost,
|
|
344
|
+
createClass,
|
|
345
|
+
createEvent,
|
|
346
|
+
createEvolve,
|
|
347
|
+
createFunction,
|
|
348
|
+
createInput,
|
|
349
|
+
createKey,
|
|
350
|
+
createLoop,
|
|
351
|
+
createMemory,
|
|
352
|
+
createObject,
|
|
353
|
+
createPersist,
|
|
354
|
+
createSecurity,
|
|
355
|
+
createSystem,
|
|
356
|
+
createThrottle,
|
|
357
|
+
createVisual,
|
|
358
|
+
defaultIAManager,
|
|
359
|
+
generateENY,
|
|
360
|
+
getEnergy,
|
|
361
|
+
getEvolve,
|
|
362
|
+
getFunctions,
|
|
363
|
+
getInterface,
|
|
364
|
+
getMemory,
|
|
365
|
+
getSecurity,
|
|
366
|
+
getState,
|
|
367
|
+
getStructures,
|
|
368
|
+
getTemporals,
|
|
369
|
+
hasWASMTarget,
|
|
370
|
+
parse,
|
|
371
|
+
processIA,
|
|
372
|
+
runENY,
|
|
373
|
+
tokenize,
|
|
374
|
+
transpileToDTS,
|
|
375
|
+
transpileToJS,
|
|
376
|
+
transpileToWAT,
|
|
377
|
+
validateSemantic,
|
|
378
|
+
validateSemanticFull
|
|
379
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
This folder contains simple examples to try the CLI and API.
|
|
4
|
+
|
|
5
|
+
- `sample.eny` — a compact language sample covering system, module, object, form, function, parallel and build.
|
|
6
|
+
- `starter.eny` — a minimal starter app example for experimenting.
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
node ./dist/cli.js examples/sample.eny
|
|
12
|
+
node ./dist/cli.js examples/starter.eny --emit js --out starter.js
|
|
13
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Σ SYSTEM "IA Demo"
|
|
2
|
+
Σ MODE autonomous
|
|
3
|
+
Σ UI dashboard
|
|
4
|
+
|
|
5
|
+
Ψ IA vendas {
|
|
6
|
+
aprender clientes
|
|
7
|
+
sugerir ofertas
|
|
8
|
+
evoluir estratégias
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
Ψ IA analytics {
|
|
12
|
+
analisar dados
|
|
13
|
+
prever tendências
|
|
14
|
+
otimizar processos
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Δ iniciarIA()
|
|
18
|
+
→ carregarModelos
|
|
19
|
+
→ ativarIA
|
|
20
|
+
|
|
21
|
+
Δ carregarModelos()
|
|
22
|
+
→ loadVendas
|
|
23
|
+
→ loadAnalytics
|
|
24
|
+
|
|
25
|
+
Δ loadVendas()
|
|
26
|
+
→ done
|
|
27
|
+
|
|
28
|
+
Δ loadAnalytics()
|
|
29
|
+
→ done
|
|
30
|
+
|
|
31
|
+
Δ ativarIA()
|
|
32
|
+
→ processarFila
|
|
33
|
+
|
|
34
|
+
Δ processarFila()
|
|
35
|
+
→ done
|
|
36
|
+
|
|
37
|
+
Δ done()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Σ SYSTEM "Studio Neural"
|
|
2
|
+
Σ TARGET web desktop
|
|
3
|
+
Σ UI adaptive
|
|
4
|
+
Σ IA creative
|
|
5
|
+
Σ EVOLVE true
|
|
6
|
+
|
|
7
|
+
Ω User { nome email }
|
|
8
|
+
|
|
9
|
+
Φ UI { layout: canvas }
|
|
10
|
+
|
|
11
|
+
Ψ IA "Criador" {
|
|
12
|
+
gerar imagens
|
|
13
|
+
gerar 3D
|
|
14
|
+
gerar animações
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Θ animation "intro"
|
|
18
|
+
|
|
19
|
+
→ iniciar sistema
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Starter Example
|
|
2
|
+
|
|
3
|
+
Este é um projeto exemplo para começar a usar a biblioteca AI-ENY (enyosx-ai).
|
|
4
|
+
|
|
5
|
+
## Estrutura
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
starter/
|
|
9
|
+
├── main.eny # Sistema principal AI-ENY
|
|
10
|
+
├── run.js # Script de execução Node.js
|
|
11
|
+
└── README.md # Este arquivo
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Instalação
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Instale a biblioteca
|
|
18
|
+
npm install enyosx-ai
|
|
19
|
+
|
|
20
|
+
# Ou globalmente para usar a CLI
|
|
21
|
+
npm install -g enyosx-ai
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Uso
|
|
25
|
+
|
|
26
|
+
### Via CLI
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Parsear e mostrar AST
|
|
30
|
+
npx enyosx-ai main.eny
|
|
31
|
+
|
|
32
|
+
# Transpilar para JavaScript
|
|
33
|
+
npx enyosx-ai main.eny --emit js --out output.js
|
|
34
|
+
|
|
35
|
+
# Gerar tipos TypeScript
|
|
36
|
+
npx enyosx-ai main.eny --emit dts --out output.d.ts
|
|
37
|
+
|
|
38
|
+
# Gerar stub WASM
|
|
39
|
+
npx enyosx-ai main.eny --emit wasm --out output.wat
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Via JavaScript/TypeScript
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
node run.js
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Arquivo main.eny
|
|
49
|
+
|
|
50
|
+
```eny
|
|
51
|
+
Σ SYSTEM "Starter App"
|
|
52
|
+
Σ MODE development
|
|
53
|
+
Σ UI auto
|
|
54
|
+
|
|
55
|
+
Δ inicializar()
|
|
56
|
+
→ configurar
|
|
57
|
+
→ iniciar
|
|
58
|
+
|
|
59
|
+
Δ configurar()
|
|
60
|
+
→ carregarConfigs
|
|
61
|
+
|
|
62
|
+
Δ carregarConfigs()
|
|
63
|
+
→ validar
|
|
64
|
+
|
|
65
|
+
Δ validar()
|
|
66
|
+
→ done
|
|
67
|
+
|
|
68
|
+
Δ iniciar()
|
|
69
|
+
→ executarApp
|
|
70
|
+
|
|
71
|
+
Δ executarApp()
|
|
72
|
+
→ done
|
|
73
|
+
|
|
74
|
+
Δ done()
|
|
75
|
+
|
|
76
|
+
Ψ IA assistente {
|
|
77
|
+
aprender contexto
|
|
78
|
+
sugerir acoes
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
Ω Config {
|
|
82
|
+
ambiente: dev
|
|
83
|
+
debug: true
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
Σ BUILD {
|
|
87
|
+
target: js
|
|
88
|
+
target: wasm
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Próximos Passos
|
|
93
|
+
|
|
94
|
+
1. Modifique `main.eny` para seu caso de uso
|
|
95
|
+
2. Use a CLI para transpilar para JS ou WASM
|
|
96
|
+
3. Integre com seu projeto Node.js ou React
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Σ SYSTEM "Starter App"
|
|
2
|
+
Σ MODE development
|
|
3
|
+
Σ UI auto
|
|
4
|
+
|
|
5
|
+
Δ inicializar()
|
|
6
|
+
→ configurar
|
|
7
|
+
→ iniciar
|
|
8
|
+
|
|
9
|
+
Δ configurar()
|
|
10
|
+
→ carregarConfigs
|
|
11
|
+
|
|
12
|
+
Δ carregarConfigs()
|
|
13
|
+
→ validar
|
|
14
|
+
|
|
15
|
+
Δ validar()
|
|
16
|
+
→ done
|
|
17
|
+
|
|
18
|
+
Δ iniciar()
|
|
19
|
+
→ executarApp
|
|
20
|
+
|
|
21
|
+
Δ executarApp()
|
|
22
|
+
→ done
|
|
23
|
+
|
|
24
|
+
Δ done()
|
|
25
|
+
|
|
26
|
+
Ψ IA assistente {
|
|
27
|
+
aprender contexto
|
|
28
|
+
sugerir acoes
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
Ω Config {
|
|
32
|
+
ambiente: dev
|
|
33
|
+
debug: true
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
Σ BUILD {
|
|
37
|
+
target: js
|
|
38
|
+
target: wasm
|
|
39
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Starter example - Node.js script
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
// Import enyosx-ai (use require for commonjs compatibility)
|
|
6
|
+
let runENY, transpileToJS, transpileToDTS, transpileToWAT, LocalIA;
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
const lib = require('enyosx-ai');
|
|
10
|
+
runENY = lib.runENY;
|
|
11
|
+
transpileToJS = lib.transpileToJS;
|
|
12
|
+
transpileToDTS = lib.transpileToDTS;
|
|
13
|
+
transpileToWAT = lib.transpileToWAT;
|
|
14
|
+
LocalIA = lib.LocalIA;
|
|
15
|
+
} catch (e) {
|
|
16
|
+
// Fallback for local development
|
|
17
|
+
const lib = require('../../dist/index.cjs');
|
|
18
|
+
runENY = lib.runENY;
|
|
19
|
+
transpileToJS = lib.transpileToJS;
|
|
20
|
+
transpileToDTS = lib.transpileToDTS;
|
|
21
|
+
transpileToWAT = lib.transpileToWAT;
|
|
22
|
+
LocalIA = lib.LocalIA;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Read the main.eny file
|
|
26
|
+
const enyPath = path.join(__dirname, 'main.eny');
|
|
27
|
+
const code = fs.readFileSync(enyPath, 'utf-8');
|
|
28
|
+
|
|
29
|
+
console.log('=== AI-ENY Starter Example ===\n');
|
|
30
|
+
|
|
31
|
+
// Parse the code
|
|
32
|
+
const ast = runENY(code, {
|
|
33
|
+
verbose: true,
|
|
34
|
+
onLog: (entry) => {
|
|
35
|
+
console.log(`[${entry.level.toUpperCase()}] ${entry.event}`);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
console.log('\n=== Parsed AST ===');
|
|
40
|
+
console.log(`System: ${ast.system}`);
|
|
41
|
+
console.log(`Mode: ${ast.mode}`);
|
|
42
|
+
console.log(`Functions: ${ast.functions?.map(f => f.name).join(', ')}`);
|
|
43
|
+
console.log(`IAs: ${ast.ias?.map(ia => ia.name).join(', ')}`);
|
|
44
|
+
console.log(`Objects: ${ast.objects?.map(o => o.name).join(', ')}`);
|
|
45
|
+
console.log(`Build targets: ${ast.build?.targets?.join(', ')}`);
|
|
46
|
+
|
|
47
|
+
// Transpile to JS
|
|
48
|
+
console.log('\n=== Transpiled JS (preview) ===');
|
|
49
|
+
const js = transpileToJS(ast);
|
|
50
|
+
console.log(js.substring(0, 500) + '...');
|
|
51
|
+
|
|
52
|
+
// Process IA blocks
|
|
53
|
+
if (ast.ias && ast.ias.length > 0) {
|
|
54
|
+
console.log('\n=== Processing IA blocks ===');
|
|
55
|
+
const ia = new LocalIA();
|
|
56
|
+
|
|
57
|
+
for (const iaNode of ast.ias) {
|
|
58
|
+
console.log(`\nProcessing IA: ${iaNode.name}`);
|
|
59
|
+
ia.process(iaNode, {
|
|
60
|
+
onLog: (e) => console.log(` [IA] ${e.event}`)
|
|
61
|
+
}).then(result => {
|
|
62
|
+
console.log(` Result: ${result.success ? 'SUCCESS' : 'FAILED'}`);
|
|
63
|
+
console.log(` Capabilities processed: ${result.capabilities?.join(', ')}`);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
console.log('\n=== Done ===');
|