agentlang 0.2.0 → 0.2.2
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/out/api/http.js +3 -3
- package/out/api/http.js.map +1 -1
- package/out/language/agentlang-validator.d.ts.map +1 -1
- package/out/language/agentlang-validator.js +3 -1
- package/out/language/agentlang-validator.js.map +1 -1
- package/out/language/generated/ast.d.ts +35 -9
- package/out/language/generated/ast.d.ts.map +1 -1
- package/out/language/generated/ast.js +40 -1
- package/out/language/generated/ast.js.map +1 -1
- package/out/language/generated/grammar.d.ts.map +1 -1
- package/out/language/generated/grammar.js +289 -120
- package/out/language/generated/grammar.js.map +1 -1
- package/out/language/main.cjs +323 -122
- package/out/language/main.cjs.map +2 -2
- package/out/language/parser.d.ts +1 -0
- package/out/language/parser.d.ts.map +1 -1
- package/out/language/parser.js +14 -13
- package/out/language/parser.js.map +1 -1
- package/out/runtime/agents/common.d.ts +7 -1
- package/out/runtime/agents/common.d.ts.map +1 -1
- package/out/runtime/agents/common.js +57 -3
- package/out/runtime/agents/common.js.map +1 -1
- package/out/runtime/exec-graph.d.ts.map +1 -1
- package/out/runtime/exec-graph.js +15 -7
- package/out/runtime/exec-graph.js.map +1 -1
- package/out/runtime/interpreter.d.ts.map +1 -1
- package/out/runtime/interpreter.js +50 -22
- package/out/runtime/interpreter.js.map +1 -1
- package/out/runtime/loader.d.ts.map +1 -1
- package/out/runtime/loader.js +16 -9
- package/out/runtime/loader.js.map +1 -1
- package/out/runtime/module.d.ts +10 -0
- package/out/runtime/module.d.ts.map +1 -1
- package/out/runtime/module.js +76 -19
- package/out/runtime/module.js.map +1 -1
- package/out/runtime/modules/ai.d.ts +6 -2
- package/out/runtime/modules/ai.d.ts.map +1 -1
- package/out/runtime/modules/ai.js +59 -12
- package/out/runtime/modules/ai.js.map +1 -1
- package/out/runtime/resolvers/interface.js +2 -2
- package/out/runtime/resolvers/interface.js.map +1 -1
- package/out/runtime/resolvers/sqldb/impl.js +2 -2
- package/out/runtime/resolvers/sqldb/impl.js.map +1 -1
- package/out/runtime/util.d.ts +2 -1
- package/out/runtime/util.d.ts.map +1 -1
- package/out/runtime/util.js +4 -1
- package/out/runtime/util.js.map +1 -1
- package/out/syntaxes/agentlang.monarch.js +3 -3
- package/out/syntaxes/agentlang.monarch.js.map +1 -1
- package/package.json +1 -1
- package/src/api/http.ts +3 -3
- package/src/language/agentlang-validator.ts +3 -1
- package/src/language/agentlang.langium +8 -2
- package/src/language/generated/ast.ts +80 -9
- package/src/language/generated/grammar.ts +289 -120
- package/src/language/parser.ts +15 -14
- package/src/runtime/agents/common.ts +63 -3
- package/src/runtime/exec-graph.ts +14 -7
- package/src/runtime/interpreter.ts +54 -22
- package/src/runtime/loader.ts +23 -8
- package/src/runtime/module.ts +86 -18
- package/src/runtime/modules/ai.ts +69 -10
- package/src/runtime/resolvers/interface.ts +2 -2
- package/src/runtime/resolvers/sqldb/impl.ts +2 -2
- package/src/runtime/util.ts +5 -1
- package/src/syntaxes/agentlang.monarch.ts +3 -3
|
@@ -34,6 +34,7 @@ export type AgentlangKeywordNames =
|
|
|
34
34
|
| "<="
|
|
35
35
|
| "<>"
|
|
36
36
|
| "="
|
|
37
|
+
| "=="
|
|
37
38
|
| ">"
|
|
38
39
|
| ">="
|
|
39
40
|
| "?"
|
|
@@ -63,8 +64,10 @@ export type AgentlangKeywordNames =
|
|
|
63
64
|
| "and"
|
|
64
65
|
| "await"
|
|
65
66
|
| "between"
|
|
67
|
+
| "case"
|
|
66
68
|
| "contains"
|
|
67
69
|
| "create"
|
|
70
|
+
| "decision"
|
|
68
71
|
| "delete"
|
|
69
72
|
| "else"
|
|
70
73
|
| "entity"
|
|
@@ -122,7 +125,7 @@ export function isDecimal(item: unknown): item is Decimal {
|
|
|
122
125
|
return typeof item === 'number';
|
|
123
126
|
}
|
|
124
127
|
|
|
125
|
-
export type Definition = AgentDefinition | FlowDefinition | RelationshipDefinition | ResolverDefinition | SchemaDefinition | StandaloneStatement | WorkflowDefinition;
|
|
128
|
+
export type Definition = AgentDefinition | DecisionDefinition | FlowDefinition | RelationshipDefinition | ResolverDefinition | SchemaDefinition | StandaloneStatement | WorkflowDefinition;
|
|
126
129
|
|
|
127
130
|
export const Definition = 'Definition';
|
|
128
131
|
|
|
@@ -303,11 +306,11 @@ export function isBeforeTriggerDefinition(item: unknown): item is BeforeTriggerD
|
|
|
303
306
|
}
|
|
304
307
|
|
|
305
308
|
export interface BinExpr extends langium.AstNode {
|
|
306
|
-
readonly $container: AttributeDefinition | BinExpr | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute;
|
|
309
|
+
readonly $container: AttributeDefinition | BinExpr | CaseEntry | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute;
|
|
307
310
|
readonly $type: 'BinExpr';
|
|
308
311
|
e1: Expr | PrimExpr;
|
|
309
312
|
e2: Expr | PrimExpr;
|
|
310
|
-
op: '!=' | '*' | '+' | '-' | '/' | '<' | '<=' | '<>' | '
|
|
313
|
+
op: '!=' | '*' | '+' | '-' | '/' | '<' | '<=' | '<>' | '==' | '>' | '>=' | 'and' | 'in' | 'like' | 'or';
|
|
311
314
|
}
|
|
312
315
|
|
|
313
316
|
export const BinExpr = 'BinExpr';
|
|
@@ -316,6 +319,19 @@ export function isBinExpr(item: unknown): item is BinExpr {
|
|
|
316
319
|
return reflection.isInstance(item, BinExpr);
|
|
317
320
|
}
|
|
318
321
|
|
|
322
|
+
export interface CaseEntry extends langium.AstNode {
|
|
323
|
+
readonly $container: DecisionDefBody;
|
|
324
|
+
readonly $type: 'CaseEntry';
|
|
325
|
+
cond: Expr;
|
|
326
|
+
statements: Array<Statement>;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export const CaseEntry = 'CaseEntry';
|
|
330
|
+
|
|
331
|
+
export function isCaseEntry(item: unknown): item is CaseEntry {
|
|
332
|
+
return reflection.isInstance(item, CaseEntry);
|
|
333
|
+
}
|
|
334
|
+
|
|
319
335
|
export interface CatchSpec extends langium.AstNode {
|
|
320
336
|
readonly $container: RuntimeHint;
|
|
321
337
|
readonly $type: 'CatchSpec';
|
|
@@ -384,6 +400,31 @@ export function isCrudMapBody(item: unknown): item is CrudMapBody {
|
|
|
384
400
|
return reflection.isInstance(item, CrudMapBody);
|
|
385
401
|
}
|
|
386
402
|
|
|
403
|
+
export interface DecisionDefBody extends langium.AstNode {
|
|
404
|
+
readonly $container: DecisionDefinition;
|
|
405
|
+
readonly $type: 'DecisionDefBody';
|
|
406
|
+
cases: Array<CaseEntry>;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export const DecisionDefBody = 'DecisionDefBody';
|
|
410
|
+
|
|
411
|
+
export function isDecisionDefBody(item: unknown): item is DecisionDefBody {
|
|
412
|
+
return reflection.isInstance(item, DecisionDefBody);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export interface DecisionDefinition extends langium.AstNode {
|
|
416
|
+
readonly $container: ModuleDefinition;
|
|
417
|
+
readonly $type: 'DecisionDefinition';
|
|
418
|
+
body?: DecisionDefBody;
|
|
419
|
+
name: GenericName;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export const DecisionDefinition = 'DecisionDefinition';
|
|
423
|
+
|
|
424
|
+
export function isDecisionDefinition(item: unknown): item is DecisionDefinition {
|
|
425
|
+
return reflection.isInstance(item, DecisionDefinition);
|
|
426
|
+
}
|
|
427
|
+
|
|
387
428
|
export interface Delete extends langium.AstNode {
|
|
388
429
|
readonly $container: Pattern;
|
|
389
430
|
readonly $type: 'Delete';
|
|
@@ -578,7 +619,7 @@ export function isGenericPropertyDef(item: unknown): item is GenericPropertyDef
|
|
|
578
619
|
}
|
|
579
620
|
|
|
580
621
|
export interface Group extends langium.AstNode {
|
|
581
|
-
readonly $container: AttributeDefinition | BinExpr | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute;
|
|
622
|
+
readonly $container: AttributeDefinition | BinExpr | CaseEntry | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute;
|
|
582
623
|
readonly $type: 'Group';
|
|
583
624
|
ge: Expr;
|
|
584
625
|
}
|
|
@@ -655,7 +696,7 @@ export function isKvPairs(item: unknown): item is KvPairs {
|
|
|
655
696
|
}
|
|
656
697
|
|
|
657
698
|
export interface Literal extends langium.AstNode {
|
|
658
|
-
readonly $container: AttributeDefinition | BinExpr | CrudMap | FnCall | FullTextSearch | GenericPropertyDef | Group | If | KvPair | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute;
|
|
699
|
+
readonly $container: AttributeDefinition | BinExpr | CaseEntry | CrudMap | FnCall | FullTextSearch | GenericPropertyDef | Group | If | KvPair | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute;
|
|
659
700
|
readonly $type: 'Literal';
|
|
660
701
|
array?: ArrayLiteral;
|
|
661
702
|
asyncFnCall?: AsyncFnCall;
|
|
@@ -739,7 +780,7 @@ export function isModuleDefinition(item: unknown): item is ModuleDefinition {
|
|
|
739
780
|
}
|
|
740
781
|
|
|
741
782
|
export interface NegExpr extends langium.AstNode {
|
|
742
|
-
readonly $container: AttributeDefinition | BinExpr | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute;
|
|
783
|
+
readonly $container: AttributeDefinition | BinExpr | CaseEntry | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute;
|
|
743
784
|
readonly $type: 'NegExpr';
|
|
744
785
|
ne: Expr;
|
|
745
786
|
}
|
|
@@ -764,7 +805,7 @@ export function isNodeDefinition(item: unknown): item is NodeDefinition {
|
|
|
764
805
|
}
|
|
765
806
|
|
|
766
807
|
export interface NotExpr extends langium.AstNode {
|
|
767
|
-
readonly $container: AttributeDefinition | BinExpr | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute;
|
|
808
|
+
readonly $container: AttributeDefinition | BinExpr | CaseEntry | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute;
|
|
768
809
|
readonly $type: 'NotExpr';
|
|
769
810
|
ne: Expr;
|
|
770
811
|
}
|
|
@@ -1157,7 +1198,7 @@ export function isStandaloneStatement(item: unknown): item is StandaloneStatemen
|
|
|
1157
1198
|
}
|
|
1158
1199
|
|
|
1159
1200
|
export interface Statement extends langium.AstNode {
|
|
1160
|
-
readonly $container: ArrayLiteral | Else | ForEach | Handler | If | StandaloneStatement | ThenSpec | WorkflowDefinition;
|
|
1201
|
+
readonly $container: ArrayLiteral | CaseEntry | Else | ForEach | Handler | If | StandaloneStatement | ThenSpec | WorkflowDefinition;
|
|
1161
1202
|
readonly $type: 'Statement';
|
|
1162
1203
|
hints: Array<RuntimeHint>;
|
|
1163
1204
|
pattern: Pattern;
|
|
@@ -1246,11 +1287,14 @@ export type AgentlangAstType = {
|
|
|
1246
1287
|
AttributeValueExpression: AttributeValueExpression
|
|
1247
1288
|
BeforeTriggerDefinition: BeforeTriggerDefinition
|
|
1248
1289
|
BinExpr: BinExpr
|
|
1290
|
+
CaseEntry: CaseEntry
|
|
1249
1291
|
CatchSpec: CatchSpec
|
|
1250
1292
|
CompositeUniqueDefinition: CompositeUniqueDefinition
|
|
1251
1293
|
ConditionalFlowStep: ConditionalFlowStep
|
|
1252
1294
|
CrudMap: CrudMap
|
|
1253
1295
|
CrudMapBody: CrudMapBody
|
|
1296
|
+
DecisionDefBody: DecisionDefBody
|
|
1297
|
+
DecisionDefinition: DecisionDefinition
|
|
1254
1298
|
Definition: Definition
|
|
1255
1299
|
Delete: Delete
|
|
1256
1300
|
Else: Else
|
|
@@ -1325,12 +1369,13 @@ export type AgentlangAstType = {
|
|
|
1325
1369
|
export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
1326
1370
|
|
|
1327
1371
|
getAllTypes(): string[] {
|
|
1328
|
-
return [ActionEntry, AfterTriggerDefinition, AgentDefinition, AliasSpec, ArrayLiteral, AsyncFnCall, AttributeDefinition, AttributeValueExpression, BeforeTriggerDefinition, BinExpr, CatchSpec, CompositeUniqueDefinition, ConditionalFlowStep, CrudMap, CrudMapBody, Definition, Delete, Else, EntityActionsDefinitions, EntityDefinition, EnumSpec, EventDefinition, Expr, ExtendsClause, FlowDefBody, FlowDefinition, FlowEntry, FnCall, ForEach, FullTextSearch, GenericDefBody, GenericPropertyDef, Group, Handler, If, Import, KvPair, KvPairs, Literal, MapEntry, MapKey, MapLiteral, MetaDefinition, ModuleDefinition, NegExpr, NodeDefinition, NotExpr, OneOfSpec, Pattern, PrePostTriggerDefinition, PrimExpr, PropertyDefinition, Purge, RbacAllowSpec, RbacExpressionSpec, RbacOpr, RbacRolesSpec, RbacSpecDefinition, RbacSpecEntries, RbacSpecEntry, RecordDefinition, RecordExtraDefinition, RecordSchemaDefinition, RefSpec, RelNodes, RelationshipDefinition, RelationshipPattern, ResolverDefinition, ResolverFnName, ResolverMethodName, ResolverMethodSpec, Return, RuntimeHint, SchemaDefinition, SelectIntoEntry, SelectIntoSpec, SetAttribute, StandaloneStatement, Statement, ThenSpec, TriggerDefinition, TriggerEntry, WorkflowDefinition, WorkflowHeader];
|
|
1372
|
+
return [ActionEntry, AfterTriggerDefinition, AgentDefinition, AliasSpec, ArrayLiteral, AsyncFnCall, AttributeDefinition, AttributeValueExpression, BeforeTriggerDefinition, BinExpr, CaseEntry, CatchSpec, CompositeUniqueDefinition, ConditionalFlowStep, CrudMap, CrudMapBody, DecisionDefBody, DecisionDefinition, Definition, Delete, Else, EntityActionsDefinitions, EntityDefinition, EnumSpec, EventDefinition, Expr, ExtendsClause, FlowDefBody, FlowDefinition, FlowEntry, FnCall, ForEach, FullTextSearch, GenericDefBody, GenericPropertyDef, Group, Handler, If, Import, KvPair, KvPairs, Literal, MapEntry, MapKey, MapLiteral, MetaDefinition, ModuleDefinition, NegExpr, NodeDefinition, NotExpr, OneOfSpec, Pattern, PrePostTriggerDefinition, PrimExpr, PropertyDefinition, Purge, RbacAllowSpec, RbacExpressionSpec, RbacOpr, RbacRolesSpec, RbacSpecDefinition, RbacSpecEntries, RbacSpecEntry, RecordDefinition, RecordExtraDefinition, RecordSchemaDefinition, RefSpec, RelNodes, RelationshipDefinition, RelationshipPattern, ResolverDefinition, ResolverFnName, ResolverMethodName, ResolverMethodSpec, Return, RuntimeHint, SchemaDefinition, SelectIntoEntry, SelectIntoSpec, SetAttribute, StandaloneStatement, Statement, ThenSpec, TriggerDefinition, TriggerEntry, WorkflowDefinition, WorkflowHeader];
|
|
1329
1373
|
}
|
|
1330
1374
|
|
|
1331
1375
|
protected override computeIsSubtype(subtype: string, supertype: string): boolean {
|
|
1332
1376
|
switch (subtype) {
|
|
1333
1377
|
case AgentDefinition:
|
|
1378
|
+
case DecisionDefinition:
|
|
1334
1379
|
case FlowDefinition:
|
|
1335
1380
|
case RelationshipDefinition:
|
|
1336
1381
|
case ResolverDefinition:
|
|
@@ -1458,6 +1503,15 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
|
1458
1503
|
]
|
|
1459
1504
|
};
|
|
1460
1505
|
}
|
|
1506
|
+
case CaseEntry: {
|
|
1507
|
+
return {
|
|
1508
|
+
name: CaseEntry,
|
|
1509
|
+
properties: [
|
|
1510
|
+
{ name: 'cond' },
|
|
1511
|
+
{ name: 'statements', defaultValue: [] }
|
|
1512
|
+
]
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1461
1515
|
case CatchSpec: {
|
|
1462
1516
|
return {
|
|
1463
1517
|
name: CatchSpec,
|
|
@@ -1506,6 +1560,23 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
|
1506
1560
|
]
|
|
1507
1561
|
};
|
|
1508
1562
|
}
|
|
1563
|
+
case DecisionDefBody: {
|
|
1564
|
+
return {
|
|
1565
|
+
name: DecisionDefBody,
|
|
1566
|
+
properties: [
|
|
1567
|
+
{ name: 'cases', defaultValue: [] }
|
|
1568
|
+
]
|
|
1569
|
+
};
|
|
1570
|
+
}
|
|
1571
|
+
case DecisionDefinition: {
|
|
1572
|
+
return {
|
|
1573
|
+
name: DecisionDefinition,
|
|
1574
|
+
properties: [
|
|
1575
|
+
{ name: 'body' },
|
|
1576
|
+
{ name: 'name' }
|
|
1577
|
+
]
|
|
1578
|
+
};
|
|
1579
|
+
}
|
|
1509
1580
|
case Delete: {
|
|
1510
1581
|
return {
|
|
1511
1582
|
name: Delete,
|