@aexol/spectral 0.9.221 → 0.9.222

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.
Files changed (153) hide show
  1. package/dist/agent/index.d.ts +7 -3
  2. package/dist/agent/index.d.ts.map +1 -1
  3. package/dist/agent/index.js +35 -8
  4. package/dist/extensions/aexol-backend-client.d.ts +85 -0
  5. package/dist/extensions/aexol-backend-client.d.ts.map +1 -0
  6. package/dist/extensions/aexol-backend-client.js +159 -0
  7. package/dist/extensions/aexol-mcp.d.ts +10 -6
  8. package/dist/extensions/aexol-mcp.d.ts.map +1 -1
  9. package/dist/extensions/aexol-mcp.js +21 -106
  10. package/dist/extensions/logic-trace-backend-draft.d.ts +68 -0
  11. package/dist/extensions/logic-trace-backend-draft.d.ts.map +1 -0
  12. package/dist/extensions/logic-trace-backend-draft.js +171 -0
  13. package/dist/extensions/logic-trace-validate.d.ts +33 -0
  14. package/dist/extensions/logic-trace-validate.d.ts.map +1 -0
  15. package/dist/extensions/logic-trace-validate.js +73 -0
  16. package/dist/extensions/logic-trace.d.ts +213 -0
  17. package/dist/extensions/logic-trace.d.ts.map +1 -0
  18. package/dist/extensions/logic-trace.js +1098 -0
  19. package/dist/generated/parser/lexer.d.ts +148 -0
  20. package/dist/generated/parser/lexer.d.ts.map +1 -0
  21. package/dist/generated/parser/lexer.js +877 -0
  22. package/dist/generated/parser/mod.d.ts +26 -0
  23. package/dist/generated/parser/mod.d.ts.map +1 -0
  24. package/dist/generated/parser/mod.js +30 -0
  25. package/dist/generated/parser/parser.d.ts +161 -0
  26. package/dist/generated/parser/parser.d.ts.map +1 -0
  27. package/dist/generated/parser/parser.js +754 -0
  28. package/dist/generated/parser/tokenizer.d.ts +107 -0
  29. package/dist/generated/parser/tokenizer.d.ts.map +1 -0
  30. package/dist/generated/parser/tokenizer.js +202 -0
  31. package/dist/generated/parser/validator.d.ts +45 -0
  32. package/dist/generated/parser/validator.d.ts.map +1 -0
  33. package/dist/generated/parser/validator.js +202 -0
  34. package/dist/generated/zeus/const.d.ts.map +1 -1
  35. package/dist/generated/zeus/const.js +4 -170
  36. package/dist/generated/zeus/index.d.ts +8 -873
  37. package/dist/generated/zeus/index.d.ts.map +1 -1
  38. package/dist/generated/zeus/index.js +0 -7
  39. package/dist/mcp/ui-stream-types.d.ts +2 -2
  40. package/dist/memory/tools/share-project-observation.js +1 -1
  41. package/dist/memory/tools/write-project-observation.d.ts.map +1 -1
  42. package/dist/memory/tools/write-project-observation.js +4 -3
  43. package/dist/sdk/agent-core/harness/types.d.ts +0 -1
  44. package/dist/sdk/agent-core/harness/types.d.ts.map +1 -1
  45. package/dist/sdk/agent-core/index.d.ts +0 -8
  46. package/dist/sdk/agent-core/index.d.ts.map +1 -1
  47. package/dist/sdk/agent-core/index.js +0 -9
  48. package/dist/sdk/coding-agent/core/extensions/index.d.ts +1 -1
  49. package/dist/sdk/coding-agent/core/extensions/index.d.ts.map +1 -1
  50. package/dist/sdk/coding-agent/core/extensions/native-extensions.js +2 -2
  51. package/dist/sdk/coding-agent/core/extensions/types.d.ts +20 -1
  52. package/dist/sdk/coding-agent/core/extensions/types.d.ts.map +1 -1
  53. package/dist/sdk/coding-agent/core/tools/tool-definition-wrapper.d.ts +9 -4
  54. package/dist/sdk/coding-agent/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  55. package/dist/sdk/coding-agent/core/tools/tool-definition-wrapper.js +15 -2
  56. package/dist/sdk/coding-agent/index.d.ts +1 -1
  57. package/dist/sdk/coding-agent/index.d.ts.map +1 -1
  58. package/dist/server/agent-bridge/headless-ui.d.ts +20 -0
  59. package/dist/server/agent-bridge/headless-ui.d.ts.map +1 -0
  60. package/dist/server/agent-bridge/headless-ui.js +85 -0
  61. package/dist/server/agent-bridge/pricing.d.ts +37 -0
  62. package/dist/server/agent-bridge/pricing.d.ts.map +1 -0
  63. package/dist/server/agent-bridge/pricing.js +202 -0
  64. package/dist/server/agent-bridge/rehydrate.d.ts +35 -0
  65. package/dist/server/agent-bridge/rehydrate.d.ts.map +1 -0
  66. package/dist/server/agent-bridge/rehydrate.js +122 -0
  67. package/dist/server/agent-bridge/synthetic-model.d.ts +27 -0
  68. package/dist/server/agent-bridge/synthetic-model.d.ts.map +1 -0
  69. package/dist/server/agent-bridge/synthetic-model.js +92 -0
  70. package/dist/server/agent-bridge.d.ts +11 -1
  71. package/dist/server/agent-bridge.d.ts.map +1 -1
  72. package/dist/server/agent-bridge.js +42 -481
  73. package/dist/server/session-stream/compaction-events.d.ts +13 -0
  74. package/dist/server/session-stream/compaction-events.d.ts.map +1 -0
  75. package/dist/server/session-stream/compaction-events.js +32 -0
  76. package/dist/server/session-stream/history-prune.d.ts +35 -0
  77. package/dist/server/session-stream/history-prune.d.ts.map +1 -0
  78. package/dist/server/session-stream/history-prune.js +182 -0
  79. package/dist/server/session-stream/memory.d.ts +48 -0
  80. package/dist/server/session-stream/memory.d.ts.map +1 -0
  81. package/dist/server/session-stream/memory.js +136 -0
  82. package/dist/server/session-stream/replay-tail.d.ts +4 -0
  83. package/dist/server/session-stream/replay-tail.d.ts.map +1 -0
  84. package/dist/server/session-stream/replay-tail.js +39 -0
  85. package/dist/server/session-stream/turn-events.d.ts +33 -0
  86. package/dist/server/session-stream/turn-events.d.ts.map +1 -0
  87. package/dist/server/session-stream/turn-events.js +65 -0
  88. package/dist/server/session-stream/turn-silence.d.ts +8 -0
  89. package/dist/server/session-stream/turn-silence.d.ts.map +1 -0
  90. package/dist/server/session-stream/turn-silence.js +72 -0
  91. package/dist/server/session-stream.d.ts +137 -36
  92. package/dist/server/session-stream.d.ts.map +1 -1
  93. package/dist/server/session-stream.js +18 -509
  94. package/dist/server/storage/observation-ranking.d.ts +14 -0
  95. package/dist/server/storage/observation-ranking.d.ts.map +1 -0
  96. package/dist/server/storage/observation-ranking.js +37 -0
  97. package/dist/server/storage/preflight.d.ts +20 -0
  98. package/dist/server/storage/preflight.d.ts.map +1 -0
  99. package/dist/server/storage/preflight.js +22 -0
  100. package/dist/server/storage/project-binding.d.ts +5 -0
  101. package/dist/server/storage/project-binding.d.ts.map +1 -0
  102. package/dist/server/storage/project-binding.js +32 -0
  103. package/dist/server/storage/rows.d.ts +104 -0
  104. package/dist/server/storage/rows.d.ts.map +1 -0
  105. package/dist/server/storage/rows.js +2 -0
  106. package/dist/server/storage/schema.d.ts +20 -0
  107. package/dist/server/storage/schema.d.ts.map +1 -0
  108. package/dist/server/storage/schema.js +134 -0
  109. package/dist/server/storage/types.d.ts +66 -0
  110. package/dist/server/storage/types.d.ts.map +1 -0
  111. package/dist/server/storage/types.js +1 -0
  112. package/dist/server/storage.d.ts +7 -94
  113. package/dist/server/storage.d.ts.map +1 -1
  114. package/dist/server/storage.js +6 -224
  115. package/dist/server/wire.d.ts +6 -0
  116. package/dist/server/wire.d.ts.map +1 -1
  117. package/package.json +2 -1
  118. package/dist/sdk/agent-core/harness/agent-harness.d.ts +0 -92
  119. package/dist/sdk/agent-core/harness/agent-harness.d.ts.map +0 -1
  120. package/dist/sdk/agent-core/harness/agent-harness.js +0 -899
  121. package/dist/sdk/agent-core/harness/env/nodejs.d.ts +0 -51
  122. package/dist/sdk/agent-core/harness/env/nodejs.d.ts.map +0 -1
  123. package/dist/sdk/agent-core/harness/env/nodejs.js +0 -485
  124. package/dist/sdk/agent-core/harness/prompt-templates.d.ts +0 -48
  125. package/dist/sdk/agent-core/harness/prompt-templates.d.ts.map +0 -1
  126. package/dist/sdk/agent-core/harness/prompt-templates.js +0 -229
  127. package/dist/sdk/agent-core/harness/session/jsonl-repo.d.ts +0 -26
  128. package/dist/sdk/agent-core/harness/session/jsonl-repo.d.ts.map +0 -1
  129. package/dist/sdk/agent-core/harness/session/jsonl-repo.js +0 -100
  130. package/dist/sdk/agent-core/harness/session/jsonl-storage.d.ts +0 -33
  131. package/dist/sdk/agent-core/harness/session/jsonl-storage.d.ts.map +0 -1
  132. package/dist/sdk/agent-core/harness/session/jsonl-storage.js +0 -230
  133. package/dist/sdk/agent-core/harness/session/memory-repo.d.ts +0 -18
  134. package/dist/sdk/agent-core/harness/session/memory-repo.d.ts.map +0 -1
  135. package/dist/sdk/agent-core/harness/session/memory-repo.js +0 -41
  136. package/dist/sdk/agent-core/harness/session/memory-storage.d.ts +0 -25
  137. package/dist/sdk/agent-core/harness/session/memory-storage.d.ts.map +0 -1
  138. package/dist/sdk/agent-core/harness/session/memory-storage.js +0 -113
  139. package/dist/sdk/agent-core/harness/session/repo-utils.d.ts +0 -11
  140. package/dist/sdk/agent-core/harness/session/repo-utils.d.ts.map +0 -1
  141. package/dist/sdk/agent-core/harness/session/repo-utils.js +0 -38
  142. package/dist/sdk/agent-core/harness/skills.d.ts +0 -44
  143. package/dist/sdk/agent-core/harness/skills.d.ts.map +0 -1
  144. package/dist/sdk/agent-core/harness/skills.js +0 -310
  145. package/dist/sdk/agent-core/harness/utils/shell-output.d.ts +0 -14
  146. package/dist/sdk/agent-core/harness/utils/shell-output.d.ts.map +0 -1
  147. package/dist/sdk/agent-core/harness/utils/shell-output.js +0 -125
  148. package/dist/sdk/agent-core/node.d.ts +0 -3
  149. package/dist/sdk/agent-core/node.d.ts.map +0 -1
  150. package/dist/sdk/agent-core/node.js +0 -2
  151. package/dist/sdk/agent-core/proxy.d.ts +0 -69
  152. package/dist/sdk/agent-core/proxy.d.ts.map +0 -1
  153. package/dist/sdk/agent-core/proxy.js +0 -297
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Aexol Language Tokenizer
3
+ *
4
+ * Provides a stream-like interface for token consumption and lookahead.
5
+ * Builds on the Lexer to handle token stream management.
6
+ */
7
+ import { TokenType } from "./lexer.js";
8
+ import type { Token } from "./lexer.js";
9
+ export declare class Tokenizer {
10
+ private tokens;
11
+ private position;
12
+ constructor(source: string);
13
+ /**
14
+ * Get the current token without advancing
15
+ */
16
+ current(): Token;
17
+ /**
18
+ * Peek at the next token(s) without advancing
19
+ */
20
+ peek(offset?: number): Token;
21
+ /**
22
+ * Peek backwards
23
+ */
24
+ peekBack(offset?: number): Token;
25
+ /**
26
+ * Advance to the next token and return the current one
27
+ */
28
+ advance(): Token;
29
+ /**
30
+ * Check if current token matches a type
31
+ */
32
+ check(type: TokenType): boolean;
33
+ /**
34
+ * Check if current token matches multiple types
35
+ */
36
+ checkAny(...types: TokenType[]): boolean;
37
+ /**
38
+ * Consume a token of expected type or throw error
39
+ */
40
+ consume(type: TokenType, message?: string): Token;
41
+ /**
42
+ * Try to consume a token of type, return null if not found
43
+ */
44
+ tryConsume(type: TokenType): Token | null;
45
+ /**
46
+ * Match and consume one of multiple types
47
+ */
48
+ match(...types: TokenType[]): Token | null;
49
+ /**
50
+ * Check if we've reached EOF
51
+ */
52
+ isAtEnd(): boolean;
53
+ /**
54
+ * Get all tokens
55
+ */
56
+ getAllTokens(): Token[];
57
+ /**
58
+ * Get current position in token stream
59
+ */
60
+ getPosition(): number;
61
+ /**
62
+ * Set position in token stream
63
+ */
64
+ setPosition(pos: number): void;
65
+ /**
66
+ * Get tokens until a certain type is encountered
67
+ */
68
+ collectUntil(type: TokenType): Token[];
69
+ /**
70
+ * Get a range of tokens
71
+ */
72
+ getRange(start: number, end: number): Token[];
73
+ /**
74
+ * Synchronize on error - skip tokens until we find a statement boundary
75
+ */
76
+ synchronize(): void;
77
+ /**
78
+ * Create a copy of the tokenizer at current position
79
+ */
80
+ clone(): Tokenizer;
81
+ /**
82
+ * Get human-readable representation of current token
83
+ */
84
+ getErrorContext(): string;
85
+ /**
86
+ * Get tokens in a specific line
87
+ */
88
+ getLineTokens(lineNumber: number): Token[];
89
+ /**
90
+ * Skip newlines
91
+ */
92
+ skipNewlines(): void;
93
+ /**
94
+ * Skip indentation tokens
95
+ */
96
+ skipIndentation(): void;
97
+ /**
98
+ * Get diagnostic information about tokenizer state
99
+ */
100
+ getDiagnostics(): {
101
+ totalTokens: number;
102
+ currentPosition: number;
103
+ currentToken: Token;
104
+ tokensRemaining: number;
105
+ };
106
+ }
107
+ //# sourceMappingURL=tokenizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenizer.d.ts","sourceRoot":"","sources":["../../../src/generated/parser/tokenizer.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAEH,OAAO,EAAS,SAAS,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,QAAQ,CAAa;gBAEjB,MAAM,EAAE,MAAM;IAS1B;;OAEG;IACI,OAAO,IAAI,KAAK;IAIvB;;OAEG;IACI,IAAI,CAAC,MAAM,SAAI,GAAG,KAAK;IAK9B;;OAEG;IACI,QAAQ,CAAC,MAAM,SAAI,GAAG,KAAK;IAIlC;;OAEG;IACI,OAAO,IAAI,KAAK;IAQvB;;OAEG;IACI,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO;IAItC;;OAEG;IACI,QAAQ,CAAC,GAAG,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO;IAI/C;;OAEG;IACI,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK;IAUxD;;OAEG;IACI,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,KAAK,GAAG,IAAI;IAOhD;;OAEG;IACI,KAAK,CAAC,GAAG,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,GAAG,IAAI;IAOjD;;OAEG;IACI,OAAO,IAAI,OAAO;IAIzB;;OAEG;IACI,YAAY,IAAI,KAAK,EAAE;IAI9B;;OAEG;IACI,WAAW,IAAI,MAAM;IAI5B;;OAEG;IACI,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIrC;;OAEG;IACI,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,KAAK,EAAE;IAQ7C;;OAEG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,EAAE;IAIpD;;OAEG;IACI,WAAW,IAAI,IAAI;IAqB1B;;OAEG;IACI,KAAK,IAAI,SAAS;IAOzB;;OAEG;IACI,eAAe,IAAI,MAAM;IAYhC;;OAEG;IACI,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,EAAE;IAIjD;;OAEG;IACI,YAAY,IAAI,IAAI;IAM3B;;OAEG;IACI,eAAe,IAAI,IAAI;IAM9B;;OAEG;IACI,cAAc,IAAI;QACvB,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,EAAE,KAAK,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;KACzB;CAQF"}
@@ -0,0 +1,202 @@
1
+ // GENERATED by cli-node/scripts/vendor-parser.mjs — do not edit; regenerate with `node scripts/vendor-parser.mjs`; source: packages/parser/
2
+ /**
3
+ * Aexol Language Tokenizer
4
+ *
5
+ * Provides a stream-like interface for token consumption and lookahead.
6
+ * Builds on the Lexer to handle token stream management.
7
+ */
8
+ import { Lexer, TokenType } from "./lexer.js";
9
+ export class Tokenizer {
10
+ tokens;
11
+ position = 0;
12
+ constructor(source) {
13
+ const lexer = new Lexer(source);
14
+ this.tokens = lexer.tokenize();
15
+ // Filter out comments and whitespace tokens for parsing
16
+ this.tokens = this.tokens.filter((token) => token.type !== TokenType.COMMENT && token.type !== TokenType.WHITESPACE);
17
+ }
18
+ /**
19
+ * Get the current token without advancing
20
+ */
21
+ current() {
22
+ return this.tokens[this.position] || this.tokens[this.tokens.length - 1]; // Return EOF if past end
23
+ }
24
+ /**
25
+ * Peek at the next token(s) without advancing
26
+ */
27
+ peek(offset = 1) {
28
+ return this.tokens[this.position + offset] ||
29
+ this.tokens[this.tokens.length - 1];
30
+ }
31
+ /**
32
+ * Peek backwards
33
+ */
34
+ peekBack(offset = 1) {
35
+ return this.tokens[Math.max(0, this.position - offset)];
36
+ }
37
+ /**
38
+ * Advance to the next token and return the current one
39
+ */
40
+ advance() {
41
+ const token = this.current();
42
+ if (this.position < this.tokens.length - 1) {
43
+ this.position++;
44
+ }
45
+ return token;
46
+ }
47
+ /**
48
+ * Check if current token matches a type
49
+ */
50
+ check(type) {
51
+ return this.current().type === type;
52
+ }
53
+ /**
54
+ * Check if current token matches multiple types
55
+ */
56
+ checkAny(...types) {
57
+ return types.includes(this.current().type);
58
+ }
59
+ /**
60
+ * Consume a token of expected type or throw error
61
+ */
62
+ consume(type, message) {
63
+ if (!this.check(type)) {
64
+ throw new SyntaxError(message ||
65
+ `Expected ${type} but got ${this.current().type} at line ${this.current().location.line}:${this.current().location.column}`);
66
+ }
67
+ return this.advance();
68
+ }
69
+ /**
70
+ * Try to consume a token of type, return null if not found
71
+ */
72
+ tryConsume(type) {
73
+ if (this.check(type)) {
74
+ return this.advance();
75
+ }
76
+ return null;
77
+ }
78
+ /**
79
+ * Match and consume one of multiple types
80
+ */
81
+ match(...types) {
82
+ if (this.checkAny(...types)) {
83
+ return this.advance();
84
+ }
85
+ return null;
86
+ }
87
+ /**
88
+ * Check if we've reached EOF
89
+ */
90
+ isAtEnd() {
91
+ return this.check(TokenType.EOF);
92
+ }
93
+ /**
94
+ * Get all tokens
95
+ */
96
+ getAllTokens() {
97
+ return this.tokens;
98
+ }
99
+ /**
100
+ * Get current position in token stream
101
+ */
102
+ getPosition() {
103
+ return this.position;
104
+ }
105
+ /**
106
+ * Set position in token stream
107
+ */
108
+ setPosition(pos) {
109
+ this.position = Math.max(0, Math.min(pos, this.tokens.length - 1));
110
+ }
111
+ /**
112
+ * Get tokens until a certain type is encountered
113
+ */
114
+ collectUntil(type) {
115
+ const collected = [];
116
+ while (!this.check(type) && !this.isAtEnd()) {
117
+ collected.push(this.advance());
118
+ }
119
+ return collected;
120
+ }
121
+ /**
122
+ * Get a range of tokens
123
+ */
124
+ getRange(start, end) {
125
+ return this.tokens.slice(start, end);
126
+ }
127
+ /**
128
+ * Synchronize on error - skip tokens until we find a statement boundary
129
+ */
130
+ synchronize() {
131
+ this.advance();
132
+ while (!this.isAtEnd()) {
133
+ if (this.peekBack().type === TokenType.NEWLINE) {
134
+ return;
135
+ }
136
+ switch (this.current().type) {
137
+ case TokenType.VISITOR:
138
+ case TokenType.DEFINE:
139
+ case TokenType.AGENT:
140
+ case TokenType.WORKFLOW:
141
+ case TokenType.TYPE:
142
+ return;
143
+ }
144
+ this.advance();
145
+ }
146
+ }
147
+ /**
148
+ * Create a copy of the tokenizer at current position
149
+ */
150
+ clone() {
151
+ const newTokenizer = Object.create(Object.getPrototypeOf(this));
152
+ newTokenizer.tokens = this.tokens;
153
+ newTokenizer.position = this.position;
154
+ return newTokenizer;
155
+ }
156
+ /**
157
+ * Get human-readable representation of current token
158
+ */
159
+ getErrorContext() {
160
+ const token = this.current();
161
+ const prevToken = this.peekBack();
162
+ const nextToken = this.peek();
163
+ return `
164
+ Previous: ${prevToken.type} "${prevToken.value}"
165
+ Current: ${token.type} "${token.value}" at ${token.location.line}:${token.location.column}
166
+ Next: ${nextToken.type} "${nextToken.value}"
167
+ `;
168
+ }
169
+ /**
170
+ * Get tokens in a specific line
171
+ */
172
+ getLineTokens(lineNumber) {
173
+ return this.tokens.filter((token) => token.location.line === lineNumber);
174
+ }
175
+ /**
176
+ * Skip newlines
177
+ */
178
+ skipNewlines() {
179
+ while (this.check(TokenType.NEWLINE)) {
180
+ this.advance();
181
+ }
182
+ }
183
+ /**
184
+ * Skip indentation tokens
185
+ */
186
+ skipIndentation() {
187
+ while (this.checkAny(TokenType.INDENT, TokenType.DEDENT)) {
188
+ this.advance();
189
+ }
190
+ }
191
+ /**
192
+ * Get diagnostic information about tokenizer state
193
+ */
194
+ getDiagnostics() {
195
+ return {
196
+ totalTokens: this.tokens.length,
197
+ currentPosition: this.position,
198
+ currentToken: this.current(),
199
+ tokensRemaining: this.tokens.length - this.position,
200
+ };
201
+ }
202
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Aexol Language Validator
3
+ *
4
+ * Validates the AST and provides semantic analysis.
5
+ * Checks for errors, warnings, and best practices.
6
+ */
7
+ import type { ASTNode, Program } from "./parser.js";
8
+ export interface ValidationError {
9
+ type: "error" | "warning" | "info";
10
+ message: string;
11
+ node: ASTNode;
12
+ code: string;
13
+ }
14
+ export interface ValidationResult {
15
+ isValid: boolean;
16
+ errors: ValidationError[];
17
+ warnings: ValidationError[];
18
+ infos: ValidationError[];
19
+ }
20
+ export declare class Validator {
21
+ private program;
22
+ private errors;
23
+ private warnings;
24
+ private infos;
25
+ private visitorNameCounts;
26
+ private anonymousVisitorCount;
27
+ private definedTypes;
28
+ private definedRoles;
29
+ private definedWorkflows;
30
+ private definedAgents;
31
+ constructor(program: Program);
32
+ validate(): ValidationResult;
33
+ private validateVisitor;
34
+ private validateCapability;
35
+ private validateRole;
36
+ private validateWorkflow;
37
+ private validateAgent;
38
+ private validateDomainAgent;
39
+ private validateBuilderAgent;
40
+ private validateType;
41
+ private addError;
42
+ private addWarning;
43
+ private addInfo;
44
+ }
45
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/generated/parser/validator.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAEH,OAAO,KAAK,EAEV,OAAO,EAEP,OAAO,EAKR,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,KAAK,EAAE,eAAe,EAAE,CAAC;CAC1B;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,KAAK,CAAyB;IACtC,OAAO,CAAC,iBAAiB,CAAkC;IAC3D,OAAO,CAAC,qBAAqB,CAAK;IAClC,OAAO,CAAC,YAAY,CAA0B;IAC9C,OAAO,CAAC,YAAY,CAA0B;IAC9C,OAAO,CAAC,gBAAgB,CAA0B;IAClD,OAAO,CAAC,aAAa,CAA0B;gBAEnC,OAAO,EAAE,OAAO;IAIrB,QAAQ,IAAI,gBAAgB;IAgEnC,OAAO,CAAC,eAAe;IAiCvB,OAAO,CAAC,kBAAkB;IAgB1B,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,gBAAgB;IA+BxB,OAAO,CAAC,aAAa;IAkCrB,OAAO,CAAC,mBAAmB;IAmB3B,OAAO,CAAC,oBAAoB;IA2B5B,OAAO,CAAC,YAAY;IA2BpB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,OAAO;CAGhB"}
@@ -0,0 +1,202 @@
1
+ // GENERATED by cli-node/scripts/vendor-parser.mjs — do not edit; regenerate with `node scripts/vendor-parser.mjs`; source: packages/parser/
2
+ /**
3
+ * Aexol Language Validator
4
+ *
5
+ * Validates the AST and provides semantic analysis.
6
+ * Checks for errors, warnings, and best practices.
7
+ */
8
+ export class Validator {
9
+ program;
10
+ errors = [];
11
+ warnings = [];
12
+ infos = [];
13
+ visitorNameCounts = new Map();
14
+ anonymousVisitorCount = 0;
15
+ definedTypes = new Set();
16
+ definedRoles = new Set();
17
+ definedWorkflows = new Set();
18
+ definedAgents = new Set();
19
+ constructor(program) {
20
+ this.program = program;
21
+ }
22
+ validate() {
23
+ this.errors = [];
24
+ this.warnings = [];
25
+ this.infos = [];
26
+ this.visitorNameCounts = new Map();
27
+ this.anonymousVisitorCount = 0;
28
+ this.definedTypes = new Set();
29
+ this.definedRoles = new Set();
30
+ this.definedWorkflows = new Set();
31
+ this.definedAgents = new Set();
32
+ // First pass: collect definitions
33
+ for (const node of this.program.body) {
34
+ if (node.type === "TypeDefinition") {
35
+ this.definedTypes.add(node.name);
36
+ }
37
+ else if (node.type === "VisitorDefinition") {
38
+ const visitorName = node.name?.trim();
39
+ if (visitorName) {
40
+ this.visitorNameCounts.set(visitorName, (this.visitorNameCounts.get(visitorName) ?? 0) + 1);
41
+ }
42
+ else {
43
+ this.anonymousVisitorCount += 1;
44
+ }
45
+ }
46
+ else if (node.type === "RoleDefinition") {
47
+ this.definedRoles.add(node.name);
48
+ }
49
+ else if (node.type === "WorkflowDefinition") {
50
+ this.definedWorkflows.add(node.name);
51
+ }
52
+ else if (node.type === "AgentDefinition") {
53
+ this.definedAgents.add(node.name);
54
+ }
55
+ }
56
+ // Second pass: validate
57
+ for (const node of this.program.body) {
58
+ switch (node.type) {
59
+ case "VisitorDefinition":
60
+ this.validateVisitor(node);
61
+ break;
62
+ case "RoleDefinition":
63
+ this.validateRole(node);
64
+ break;
65
+ case "WorkflowDefinition":
66
+ this.validateWorkflow(node);
67
+ break;
68
+ case "AgentDefinition":
69
+ this.validateAgent(node);
70
+ break;
71
+ case "TypeDefinition":
72
+ this.validateType(node);
73
+ break;
74
+ }
75
+ }
76
+ return {
77
+ isValid: this.errors.length === 0,
78
+ errors: this.errors,
79
+ warnings: this.warnings,
80
+ infos: this.infos,
81
+ };
82
+ }
83
+ validateVisitor(visitor) {
84
+ const visitorName = visitor.name?.trim();
85
+ if (visitorName && (this.visitorNameCounts.get(visitorName) ?? 0) > 1) {
86
+ this.addError(visitor, "DUPLICATE_VISITOR_NAME", `Visitor name '${visitorName}' is defined multiple times`);
87
+ }
88
+ if (!visitorName && this.anonymousVisitorCount > 1) {
89
+ this.addError(visitor, "MULTIPLE_ANONYMOUS_VISITORS", "Only one anonymous visitor definition is allowed");
90
+ }
91
+ if (visitor.capabilities.length === 0) {
92
+ const displayName = visitorName ?? "Anonymous Visitor";
93
+ this.addWarning(visitor, "EMPTY_VISITOR", `Visitor '${displayName}' has no capabilities`);
94
+ }
95
+ for (const capability of visitor.capabilities) {
96
+ this.validateCapability(capability);
97
+ }
98
+ }
99
+ validateCapability(capability) {
100
+ if (!capability.action || capability.action.trim() === "") {
101
+ this.addError(capability, "INVALID_ACTION", "Capability must have an action");
102
+ }
103
+ if (capability.nested && capability.nested.length > 0) {
104
+ for (const nested of capability.nested) {
105
+ this.validateCapability(nested);
106
+ }
107
+ }
108
+ }
109
+ validateRole(role) {
110
+ if (!role.name || role.name.trim() === "") {
111
+ this.addError(role, "INVALID_NAME", "Role must have a name");
112
+ return;
113
+ }
114
+ if (role.permissions.length === 0) {
115
+ this.addWarning(role, "EMPTY_ROLE", `Role '${role.name}' has no permissions`);
116
+ }
117
+ }
118
+ validateWorkflow(workflow) {
119
+ if (!workflow.name || workflow.name.trim() === "") {
120
+ this.addError(workflow, "INVALID_NAME", "Workflow must have a name");
121
+ return;
122
+ }
123
+ if (workflow.steps.length === 0) {
124
+ this.addWarning(workflow, "EMPTY_WORKFLOW", `Workflow '${workflow.name}' has no steps`);
125
+ }
126
+ if (!workflow.initialState || workflow.initialState.trim() === "") {
127
+ this.addWarning(workflow, "MISSING_INITIAL_STATE", `Workflow '${workflow.name}' has no initial state`);
128
+ }
129
+ if (workflow.finalStates.length === 0) {
130
+ this.addWarning(workflow, "MISSING_FINAL_STATES", `Workflow '${workflow.name}' has no final states`);
131
+ }
132
+ }
133
+ validateAgent(agent) {
134
+ if (!agent.name || agent.name.trim() === "") {
135
+ this.addError(agent, "INVALID_NAME", "Agent must have a name");
136
+ return;
137
+ }
138
+ // Different validation based on agent kind
139
+ if (agent.agentKind === "builder") {
140
+ this.validateBuilderAgent(agent);
141
+ }
142
+ else {
143
+ this.validateDomainAgent(agent);
144
+ }
145
+ // Check for mixed properties (warning)
146
+ // Builder properties: skills, model, maxConcurrent
147
+ const hasBuilderProps = agent.skills !== undefined ||
148
+ agent.model !== undefined || agent.maxConcurrent !== undefined;
149
+ // Domain properties: role assignment, capabilities with conditions
150
+ const hasDomainRole = agent.role !== undefined && agent.role.trim() !== "";
151
+ const hasConditionalCapabilities = agent.capabilities.some((c) => c.conditions !== undefined && c.conditions.length > 0);
152
+ if (hasBuilderProps && (hasDomainRole || hasConditionalCapabilities)) {
153
+ this.addWarning(agent, "MIXED_AGENT_PROPERTIES", `Agent '${agent.name}' mixes builder properties (skills/model/max_concurrent) with domain properties (role${hasConditionalCapabilities ? "/conditional capabilities" : ""}). Consider separating into two distinct agents: one for business logic and one for AI assistance.`);
154
+ }
155
+ }
156
+ validateDomainAgent(agent) {
157
+ // Domain agents represent business logic actors
158
+ if (agent.role && !this.definedRoles.has(agent.role)) {
159
+ this.addWarning(agent, "UNDEFINED_ROLE", `Agent '${agent.name}' references undefined role '${agent.role}'`);
160
+ }
161
+ if (agent.capabilities.length === 0) {
162
+ this.addWarning(agent, "EMPTY_AGENT", `Domain agent '${agent.name}' has no capabilities`);
163
+ }
164
+ }
165
+ validateBuilderAgent(agent) {
166
+ // Builder agents are for AI-assisted code generation
167
+ if (!agent.skills && !agent.model && !agent.capabilities.length) {
168
+ this.addWarning(agent, "EMPTY_BUILDER", `Builder agent '${agent.name}' should have skills, capabilities, or model specified`);
169
+ }
170
+ if (agent.model && !agent.model.match(/^[a-z0-9\-\.]+$/)) {
171
+ this.addWarning(agent, "INVALID_MODEL_FORMAT", `Builder agent '${agent.name}' has invalid model format: '${agent.model}'`);
172
+ }
173
+ if (agent.maxConcurrent !== undefined && agent.maxConcurrent <= 0) {
174
+ this.addError(agent, "INVALID_MAX_CONCURRENT", `Builder agent '${agent.name}' max_concurrent must be a positive number`);
175
+ }
176
+ }
177
+ validateType(type) {
178
+ if (!type.name || type.name.trim() === "") {
179
+ this.addError(type, "INVALID_NAME", "Type must have a name");
180
+ return;
181
+ }
182
+ if (type.kind === "type" || type.kind === "interface") {
183
+ if (!type.fields || type.fields.length === 0) {
184
+ this.addWarning(type, "EMPTY_TYPE", `Type '${type.name}' has no fields`);
185
+ }
186
+ }
187
+ if (type.kind === "enum") {
188
+ if (!type.values || type.values.length === 0) {
189
+ this.addWarning(type, "EMPTY_ENUM", `Enum '${type.name}' has no values`);
190
+ }
191
+ }
192
+ }
193
+ addError(node, code, message) {
194
+ this.errors.push({ type: "error", message, node, code });
195
+ }
196
+ addWarning(node, code, message) {
197
+ this.warnings.push({ type: "warning", message, node, code });
198
+ }
199
+ addInfo(node, code, message) {
200
+ this.infos.push({ type: "info", message, node, code });
201
+ }
202
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../../src/generated/zeus/const.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAC,GAAG,CAm2B5C,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAC,GAAG,CAqtC1C,CAAA;AAED,eAAO,MAAM,GAAG;;;;CAIf,CAAA"}
1
+ {"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../../src/generated/zeus/const.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAC,GAAG,CAwyB5C,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAC,GAAG,CA0lC1C,CAAA;AAED,eAAO,MAAM,GAAG;;;;CAIf,CAAA"}