@aitos/core 1.0.0 → 1.0.1

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/acs.d.ts ADDED
@@ -0,0 +1,108 @@
1
+ /**
2
+ * AITOS Compact Syntax (ACS)
3
+ *
4
+ * ACS is a compact representation of Graph JSON, designed for:
5
+ * - AI generation (10-20x more compact than JSON)
6
+ * - Human readability (for auditing AI output)
7
+ * - Unambiguous compilation to/from Graph JSON
8
+ *
9
+ * Syntax:
10
+ * graph <name> {
11
+ * [mode: kernel|user]
12
+ * [in: <type> | <name>: <type>, ...]
13
+ * [out: <type>]
14
+ *
15
+ * let <nodeId> = <atom>(<param>: <value>, ...)
16
+ * if <refNodeId> {
17
+ * <nodes...>
18
+ * } [else {
19
+ * <nodes...>
20
+ * }]
21
+ * loop [max: N] [cond: <storeKey>] {
22
+ * <nodes...>
23
+ * }
24
+ * forEach <itemKey> in <arrayRef> [max: N] {
25
+ * <nodes...>
26
+ * }
27
+ * }
28
+ */
29
+ import { Graph } from './types';
30
+ interface AcsNode {
31
+ type: 'let' | 'if' | 'loop' | 'forEach' | 'filter';
32
+ id?: string;
33
+ atom?: string;
34
+ params?: Record<string, any>;
35
+ ref?: string;
36
+ body?: AcsNode[];
37
+ elseBody?: AcsNode[];
38
+ maxIterations?: number;
39
+ condKey?: string;
40
+ itemKey?: string;
41
+ indexKey?: string;
42
+ arrayRef?: string;
43
+ maxItems?: number;
44
+ inlineCondAtom?: {
45
+ atom: string;
46
+ params: Record<string, any>;
47
+ };
48
+ }
49
+ interface AcsGraph {
50
+ name: string;
51
+ mode?: 'kernel' | 'user';
52
+ meta?: {
53
+ description?: string;
54
+ type?: string;
55
+ category?: string;
56
+ author?: string;
57
+ };
58
+ input?: Array<{
59
+ name: string;
60
+ type: string;
61
+ }>;
62
+ output?: string;
63
+ nodes: AcsNode[];
64
+ }
65
+ export declare class AcsParser {
66
+ private pos;
67
+ private src;
68
+ parse(text: string): AcsGraph;
69
+ private parseGraph;
70
+ private parseLet;
71
+ private parseIf;
72
+ private parseLoop;
73
+ private parseForEach;
74
+ private parseFilter;
75
+ private parseBody;
76
+ private parseParams;
77
+ private parseInputDecl;
78
+ private parseMetaDecl;
79
+ private readValue;
80
+ private readReference;
81
+ private readObject;
82
+ private readArray;
83
+ private skipWhitespaceAndComments;
84
+ private peek;
85
+ private expect;
86
+ private advance;
87
+ private readIdentifier;
88
+ private readNumber;
89
+ private readString;
90
+ private readUntil;
91
+ }
92
+ export declare class AcsCompiler {
93
+ compile(acsGraph: AcsGraph): Graph;
94
+ private compileNodes;
95
+ private compileSubGraph;
96
+ }
97
+ export declare class AcsDecompiler {
98
+ decompile(graph: Graph, name?: string): string;
99
+ private decompileNode;
100
+ private decompileSubGraph;
101
+ private formatParams;
102
+ private formatValue;
103
+ private extractArrayRef;
104
+ private extractCondRef;
105
+ }
106
+ export declare function compileAcs(text: string): Graph;
107
+ export declare function decompileAcs(graph: Graph, name?: string): string;
108
+ export {};