agentlang 0.0.8 → 0.0.11
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 +1 -1
- package/out/api/http.js.map +1 -1
- package/out/language/generated/ast.d.ts +11 -2
- package/out/language/generated/ast.d.ts.map +1 -1
- package/out/language/generated/ast.js +15 -2
- 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 +162 -119
- package/out/language/generated/grammar.js.map +1 -1
- package/out/language/main.cjs +174 -121
- 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 +4 -0
- package/out/language/parser.js.map +1 -1
- package/out/language/syntax.js +2 -2
- package/out/language/syntax.js.map +1 -1
- package/out/runtime/agents/common.d.ts +1 -1
- package/out/runtime/agents/common.d.ts.map +1 -1
- package/out/runtime/agents/common.js +10 -10
- package/out/runtime/interpreter.d.ts +20 -1
- package/out/runtime/interpreter.d.ts.map +1 -1
- package/out/runtime/interpreter.js +160 -13
- package/out/runtime/interpreter.js.map +1 -1
- package/out/runtime/jsmodules.d.ts +2 -2
- package/out/runtime/jsmodules.d.ts.map +1 -1
- package/out/runtime/jsmodules.js +12 -4
- package/out/runtime/jsmodules.js.map +1 -1
- package/out/runtime/loader.d.ts +1 -1
- package/out/runtime/loader.d.ts.map +1 -1
- package/out/runtime/loader.js +10 -7
- package/out/runtime/loader.js.map +1 -1
- package/out/runtime/module.d.ts +4 -1
- package/out/runtime/module.d.ts.map +1 -1
- package/out/runtime/module.js +56 -11
- package/out/runtime/module.js.map +1 -1
- package/out/runtime/modules/ai.d.ts +1 -0
- package/out/runtime/modules/ai.d.ts.map +1 -1
- package/out/runtime/modules/ai.js +17 -5
- package/out/runtime/modules/ai.js.map +1 -1
- package/out/runtime/modules/auth.d.ts.map +1 -1
- package/out/runtime/modules/auth.js +21 -16
- package/out/runtime/modules/auth.js.map +1 -1
- package/out/runtime/modules/core.d.ts +9 -0
- package/out/runtime/modules/core.d.ts.map +1 -1
- package/out/runtime/modules/core.js +107 -2
- package/out/runtime/modules/core.js.map +1 -1
- package/out/runtime/resolvers/interface.d.ts +4 -3
- package/out/runtime/resolvers/interface.d.ts.map +1 -1
- package/out/runtime/resolvers/interface.js +4 -4
- 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.map +1 -1
- package/out/runtime/util.js +3 -2
- package/out/runtime/util.js.map +1 -1
- package/out/syntaxes/agentlang.monarch.js +1 -1
- package/out/syntaxes/agentlang.monarch.js.map +1 -1
- package/package.json +1 -1
- package/src/api/http.ts +1 -1
- package/src/language/agentlang.langium +7 -5
- package/src/language/generated/ast.ts +29 -5
- package/src/language/generated/grammar.ts +162 -119
- package/src/language/parser.ts +5 -0
- package/src/language/syntax.ts +2 -2
- package/src/runtime/agents/common.ts +10 -10
- package/src/runtime/interpreter.ts +177 -13
- package/src/runtime/jsmodules.ts +12 -4
- package/src/runtime/loader.ts +12 -6
- package/src/runtime/module.ts +61 -11
- package/src/runtime/modules/ai.ts +16 -5
- package/src/runtime/modules/auth.ts +21 -17
- package/src/runtime/modules/core.ts +144 -2
- package/src/runtime/resolvers/interface.ts +6 -6
- package/src/runtime/resolvers/sqldb/impl.ts +2 -2
- package/src/runtime/util.ts +4 -2
- package/src/syntaxes/agentlang.monarch.ts +1 -1
|
@@ -2,7 +2,7 @@ grammar Agentlang
|
|
|
2
2
|
|
|
3
3
|
entry ModuleDefinition: 'module' name=ID (imports+=Import)* (defs+=Definition)*;
|
|
4
4
|
|
|
5
|
-
Import: 'import' path=STRING 'as' name=ID;
|
|
5
|
+
Import: 'import' path=STRING '@as' name=ID;
|
|
6
6
|
|
|
7
7
|
Definition: SchemaDefinition | RelationshipDefinition | WorkflowDefinition | StandaloneStatement
|
|
8
8
|
| AgentDefinition | ResolverDefinition ;
|
|
@@ -33,7 +33,7 @@ ExtendsClause: 'extends' parentName=ID;
|
|
|
33
33
|
RelationshipDefinition: 'relationship' name=ID type=('contains' | 'between') nodes=RelNodes properties+=PropertyDefinition*
|
|
34
34
|
(schema=RecordSchemaDefinition)?;
|
|
35
35
|
|
|
36
|
-
NodeDefinition: name=ID | name=ID 'as' alias=ID;
|
|
36
|
+
NodeDefinition: name=ID | name=ID '@as' alias=ID;
|
|
37
37
|
|
|
38
38
|
RelNodes: '(' node1=NodeDefinition ',' node2=NodeDefinition ')';
|
|
39
39
|
|
|
@@ -94,13 +94,13 @@ fragment Body: '{' '}' | '{' (statements+=Statement (';' statements+=Statement)*
|
|
|
94
94
|
|
|
95
95
|
WorkflowDefinition: 'workflow' name=ID Body;
|
|
96
96
|
|
|
97
|
-
Pattern: expr=Expr | crudMap=CrudMap | if=If | forEach=ForEach | delete=Delete | purge=Purge | fullTextSearch=FullTextSearch;
|
|
97
|
+
Pattern: expr=Expr | crudMap=CrudMap | if=If | forEach=ForEach | delete=Delete | purge=Purge | fullTextSearch=FullTextSearch | return=Return;
|
|
98
98
|
|
|
99
99
|
Statement: pattern=Pattern hints+=RuntimeHint*;
|
|
100
100
|
|
|
101
101
|
RuntimeHint: aliasSpec=AliasSpec | catchSpec=CatchSpec;
|
|
102
102
|
|
|
103
|
-
AliasSpec: ('as' (alias=ID | '[' ( aliases+=ID (',' aliases+=ID)*)+ ']'));
|
|
103
|
+
AliasSpec: ('@as' (alias=ID | '[' ( aliases+=ID (',' aliases+=ID)*)+ ']'));
|
|
104
104
|
|
|
105
105
|
CrudMap: '{' (name=QueryId '{''}'
|
|
106
106
|
| (name=ID '{''}' ',' '@from' source=Literal (',' upsert+='@upsert')?)
|
|
@@ -118,6 +118,8 @@ SelectIntoEntry: alias=ID attribute=Ref;
|
|
|
118
118
|
|
|
119
119
|
FullTextSearch: '{' name=QueryId query=Literal options=MapLiteral? '}';
|
|
120
120
|
|
|
121
|
+
Return: 'return' pat=Pattern;
|
|
122
|
+
|
|
121
123
|
AgentDefinition: 'agent' name=(ID | STRING) (body=AgentDefBody? | '{''}');
|
|
122
124
|
|
|
123
125
|
AgentDefBody: '{' (attributes+=AgentPropertyDef (',' attributes+=AgentPropertyDef)*)+ '}';
|
|
@@ -135,7 +137,7 @@ ResolverMethodName: name=('create' | 'update' | 'upsert' | 'delete' | 'query' |
|
|
|
135
137
|
|
|
136
138
|
RelationshipPattern: name=ID pattern=Pattern;
|
|
137
139
|
|
|
138
|
-
CatchSpec: 'catch' '{' (handlers+=Handler)+ '}';
|
|
140
|
+
CatchSpec: '@catch' '{' (handlers+=Handler)+ '}';
|
|
139
141
|
|
|
140
142
|
Handler: except=('not_found' | 'error') stmt=Statement;
|
|
141
143
|
|
|
@@ -38,8 +38,10 @@ export type AgentlangKeywordNames =
|
|
|
38
38
|
| "@"
|
|
39
39
|
| "@actions"
|
|
40
40
|
| "@after"
|
|
41
|
+
| "@as"
|
|
41
42
|
| "@async"
|
|
42
43
|
| "@before"
|
|
44
|
+
| "@catch"
|
|
43
45
|
| "@enum"
|
|
44
46
|
| "@expr"
|
|
45
47
|
| "@from"
|
|
@@ -54,10 +56,8 @@ export type AgentlangKeywordNames =
|
|
|
54
56
|
| "agent"
|
|
55
57
|
| "allow"
|
|
56
58
|
| "and"
|
|
57
|
-
| "as"
|
|
58
59
|
| "await"
|
|
59
60
|
| "between"
|
|
60
|
-
| "catch"
|
|
61
61
|
| "contains"
|
|
62
62
|
| "create"
|
|
63
63
|
| "delete"
|
|
@@ -84,6 +84,7 @@ export type AgentlangKeywordNames =
|
|
|
84
84
|
| "record"
|
|
85
85
|
| "relationship"
|
|
86
86
|
| "resolver"
|
|
87
|
+
| "return"
|
|
87
88
|
| "roles"
|
|
88
89
|
| "subscribe"
|
|
89
90
|
| "true"
|
|
@@ -705,7 +706,7 @@ export function isOneOfSpec(item: unknown): item is OneOfSpec {
|
|
|
705
706
|
}
|
|
706
707
|
|
|
707
708
|
export interface Pattern extends langium.AstNode {
|
|
708
|
-
readonly $container: Delete | ForEach | Purge | RelationshipPattern | Statement;
|
|
709
|
+
readonly $container: Delete | ForEach | Purge | RelationshipPattern | Return | Statement;
|
|
709
710
|
readonly $type: 'Pattern';
|
|
710
711
|
crudMap?: CrudMap;
|
|
711
712
|
delete?: Delete;
|
|
@@ -714,6 +715,7 @@ export interface Pattern extends langium.AstNode {
|
|
|
714
715
|
fullTextSearch?: FullTextSearch;
|
|
715
716
|
if?: If;
|
|
716
717
|
purge?: Purge;
|
|
718
|
+
return?: Return;
|
|
717
719
|
}
|
|
718
720
|
|
|
719
721
|
export const Pattern = 'Pattern';
|
|
@@ -995,6 +997,18 @@ export function isResolverMethodSpec(item: unknown): item is ResolverMethodSpec
|
|
|
995
997
|
return reflection.isInstance(item, ResolverMethodSpec);
|
|
996
998
|
}
|
|
997
999
|
|
|
1000
|
+
export interface Return extends langium.AstNode {
|
|
1001
|
+
readonly $container: Pattern;
|
|
1002
|
+
readonly $type: 'Return';
|
|
1003
|
+
pat: Pattern;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
export const Return = 'Return';
|
|
1007
|
+
|
|
1008
|
+
export function isReturn(item: unknown): item is Return {
|
|
1009
|
+
return reflection.isInstance(item, Return);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
998
1012
|
export interface RuntimeHint extends langium.AstNode {
|
|
999
1013
|
readonly $container: Statement;
|
|
1000
1014
|
readonly $type: 'RuntimeHint';
|
|
@@ -1179,6 +1193,7 @@ export type AgentlangAstType = {
|
|
|
1179
1193
|
ResolverFnName: ResolverFnName
|
|
1180
1194
|
ResolverMethodName: ResolverMethodName
|
|
1181
1195
|
ResolverMethodSpec: ResolverMethodSpec
|
|
1196
|
+
Return: Return
|
|
1182
1197
|
RuntimeHint: RuntimeHint
|
|
1183
1198
|
SchemaDefinition: SchemaDefinition
|
|
1184
1199
|
SelectIntoEntry: SelectIntoEntry
|
|
@@ -1194,7 +1209,7 @@ export type AgentlangAstType = {
|
|
|
1194
1209
|
export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
1195
1210
|
|
|
1196
1211
|
getAllTypes(): string[] {
|
|
1197
|
-
return [ActionEntry, AfterTriggerDefinition, AgentDefBody, AgentDefinition, AgentPropertyDef, AliasSpec, ArrayLiteral, AsyncFnCall, AttributeDefinition, AttributeValueExpression, BeforeTriggerDefinition, BinExpr, CatchSpec, CompositeUniqueDefinition, CrudMap, CrudMapBody, Definition, Delete, Else, EntityActionsDefinitions, EntityDefinition, EnumSpec, EventDefinition, Expr, ExtendsClause, FnCall, ForEach, FullTextSearch, 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, RuntimeHint, SchemaDefinition, SelectIntoEntry, SelectIntoSpec, SetAttribute, StandaloneStatement, Statement, TriggerDefinition, TriggerEntry, WorkflowDefinition];
|
|
1212
|
+
return [ActionEntry, AfterTriggerDefinition, AgentDefBody, AgentDefinition, AgentPropertyDef, AliasSpec, ArrayLiteral, AsyncFnCall, AttributeDefinition, AttributeValueExpression, BeforeTriggerDefinition, BinExpr, CatchSpec, CompositeUniqueDefinition, CrudMap, CrudMapBody, Definition, Delete, Else, EntityActionsDefinitions, EntityDefinition, EnumSpec, EventDefinition, Expr, ExtendsClause, FnCall, ForEach, FullTextSearch, 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, TriggerDefinition, TriggerEntry, WorkflowDefinition];
|
|
1198
1213
|
}
|
|
1199
1214
|
|
|
1200
1215
|
protected override computeIsSubtype(subtype: string, supertype: string): boolean {
|
|
@@ -1627,7 +1642,8 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
|
1627
1642
|
{ name: 'forEach' },
|
|
1628
1643
|
{ name: 'fullTextSearch' },
|
|
1629
1644
|
{ name: 'if' },
|
|
1630
|
-
{ name: 'purge' }
|
|
1645
|
+
{ name: 'purge' },
|
|
1646
|
+
{ name: 'return' }
|
|
1631
1647
|
]
|
|
1632
1648
|
};
|
|
1633
1649
|
}
|
|
@@ -1820,6 +1836,14 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
|
1820
1836
|
]
|
|
1821
1837
|
};
|
|
1822
1838
|
}
|
|
1839
|
+
case Return: {
|
|
1840
|
+
return {
|
|
1841
|
+
name: Return,
|
|
1842
|
+
properties: [
|
|
1843
|
+
{ name: 'pat' }
|
|
1844
|
+
]
|
|
1845
|
+
};
|
|
1846
|
+
}
|
|
1823
1847
|
case RuntimeHint: {
|
|
1824
1848
|
return {
|
|
1825
1849
|
name: RuntimeHint,
|