agentlang 0.9.0 → 0.9.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/out/language/generated/ast.d.ts +14 -5
- package/out/language/generated/ast.d.ts.map +1 -1
- package/out/language/generated/ast.js +17 -4
- 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 +248 -213
- package/out/language/generated/grammar.js.map +1 -1
- package/out/language/main.cjs +262 -217
- package/out/language/main.cjs.map +2 -2
- package/out/language/syntax.d.ts +6 -2
- package/out/language/syntax.d.ts.map +1 -1
- package/out/language/syntax.js +19 -6
- 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 +6 -2
- package/out/runtime/agents/common.js.map +1 -1
- package/out/runtime/defs.d.ts +9 -7
- package/out/runtime/defs.d.ts.map +1 -1
- package/out/runtime/defs.js +11 -7
- package/out/runtime/defs.js.map +1 -1
- package/out/runtime/exec-graph.d.ts.map +1 -1
- package/out/runtime/exec-graph.js +32 -2
- package/out/runtime/exec-graph.js.map +1 -1
- package/out/runtime/interpreter.d.ts +4 -1
- package/out/runtime/interpreter.d.ts.map +1 -1
- package/out/runtime/interpreter.js +54 -8
- package/out/runtime/interpreter.js.map +1 -1
- package/out/runtime/mcpclient.d.ts +46 -0
- package/out/runtime/mcpclient.d.ts.map +1 -0
- package/out/runtime/mcpclient.js +457 -0
- package/out/runtime/mcpclient.js.map +1 -0
- package/out/runtime/module.d.ts +8 -1
- package/out/runtime/module.d.ts.map +1 -1
- package/out/runtime/module.js +66 -6
- package/out/runtime/module.js.map +1 -1
- package/out/runtime/modules/ai.d.ts.map +1 -1
- package/out/runtime/modules/ai.js +6 -20
- package/out/runtime/modules/ai.js.map +1 -1
- package/out/runtime/modules/core.d.ts.map +1 -1
- package/out/runtime/modules/core.js +6 -1
- package/out/runtime/modules/core.js.map +1 -1
- package/out/runtime/modules/mcp.d.ts +6 -0
- package/out/runtime/modules/mcp.d.ts.map +1 -0
- package/out/runtime/modules/mcp.js +43 -0
- package/out/runtime/modules/mcp.js.map +1 -0
- package/out/runtime/resolvers/sqldb/database.d.ts.map +1 -1
- package/out/runtime/resolvers/sqldb/database.js +3 -2
- package/out/runtime/resolvers/sqldb/database.js.map +1 -1
- package/package.json +3 -2
- package/src/language/agentlang.langium +5 -3
- package/src/language/generated/ast.ts +32 -9
- package/src/language/generated/grammar.ts +248 -213
- package/src/language/syntax.ts +24 -7
- package/src/runtime/agents/common.ts +6 -2
- package/src/runtime/defs.ts +5 -0
- package/src/runtime/exec-graph.ts +36 -1
- package/src/runtime/interpreter.ts +68 -7
- package/src/runtime/mcpclient.ts +542 -0
- package/src/runtime/module.ts +70 -7
- package/src/runtime/modules/ai.ts +6 -22
- package/src/runtime/modules/core.ts +5 -1
- package/src/runtime/modules/mcp.ts +45 -0
- package/src/runtime/resolvers/sqldb/database.ts +3 -2
|
@@ -105,10 +105,12 @@ WorkflowHeaderPrefix returns string: 'create' | 'update' | 'delete';
|
|
|
105
105
|
PublicWorkflowDefinition: '@public' def=WorkflowDefinition;
|
|
106
106
|
|
|
107
107
|
Pattern: expr=Expr | crudMap=CrudMap | if=If | forEach=ForEach | delete=Delete | purge=Purge
|
|
108
|
-
| fullTextSearch=FullTextSearch | return=Return |
|
|
108
|
+
| fullTextSearch=FullTextSearch | return=Return | throwError=ThrowError | ifWithAlias=IfWithAlias;
|
|
109
109
|
|
|
110
110
|
Statement: pattern=Pattern hints+=RuntimeHint*;
|
|
111
111
|
|
|
112
|
+
IfWithAlias: '(' if=If ')';
|
|
113
|
+
|
|
112
114
|
RuntimeHint: aliasSpec=AliasSpec | catchSpec=CatchSpec | thenSpec=ThenSpec;
|
|
113
115
|
|
|
114
116
|
AliasSpec: ('@as' (alias=ID | '[' ( aliases+=ID (',' aliases+=ID)*)+ ']'));
|
|
@@ -162,11 +164,11 @@ FlowDefinition: 'flow' name=GenericName (body=FlowDefBody? | '{''}');
|
|
|
162
164
|
|
|
163
165
|
FlowDefBody: '{' (entries+=FlowEntry (entries+=FlowEntry)*)+ '}';
|
|
164
166
|
|
|
165
|
-
FlowEntry: root=
|
|
167
|
+
FlowEntry: root=QueryId '-->' (cond=ConditionalFlowStep | next=FlowStepSpec);
|
|
166
168
|
|
|
167
169
|
ConditionalFlowStep: expr=STRING next=FlowStepSpec;
|
|
168
170
|
|
|
169
|
-
FlowStepSpec:
|
|
171
|
+
FlowStepSpec: Statement;
|
|
170
172
|
|
|
171
173
|
DecisionDefinition: 'decision' name=GenericName (body=DecisionDefBody? | '{''}');
|
|
172
174
|
|
|
@@ -162,7 +162,7 @@ export function isExpr(item: unknown): item is Expr {
|
|
|
162
162
|
return reflection.isInstance(item, Expr);
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
export type FlowStepSpec =
|
|
165
|
+
export type FlowStepSpec = Statement;
|
|
166
166
|
|
|
167
167
|
export const FlowStepSpec = 'FlowStepSpec';
|
|
168
168
|
|
|
@@ -467,7 +467,7 @@ export function isConditionalFlowStep(item: unknown): item is ConditionalFlowSte
|
|
|
467
467
|
}
|
|
468
468
|
|
|
469
469
|
export interface CrudMap extends langium.AstNode {
|
|
470
|
-
readonly $container:
|
|
470
|
+
readonly $container: Pattern;
|
|
471
471
|
readonly $type: 'CrudMap';
|
|
472
472
|
body?: CrudMapBody;
|
|
473
473
|
distinct: Array<'@distinct'>;
|
|
@@ -659,7 +659,7 @@ export interface FlowEntry extends langium.AstNode {
|
|
|
659
659
|
readonly $type: 'FlowEntry';
|
|
660
660
|
cond?: ConditionalFlowStep;
|
|
661
661
|
next?: FlowStepSpec;
|
|
662
|
-
root:
|
|
662
|
+
root: QueryId;
|
|
663
663
|
}
|
|
664
664
|
|
|
665
665
|
export const FlowEntry = 'FlowEntry';
|
|
@@ -786,7 +786,7 @@ export function isHandler(item: unknown): item is Handler {
|
|
|
786
786
|
}
|
|
787
787
|
|
|
788
788
|
export interface If extends langium.AstNode {
|
|
789
|
-
readonly $container: DirectiveDefinition | Pattern | ScenarioDefinition;
|
|
789
|
+
readonly $container: DirectiveDefinition | IfWithAlias | Pattern | ScenarioDefinition;
|
|
790
790
|
readonly $type: 'If';
|
|
791
791
|
cond: Expr;
|
|
792
792
|
else?: Else;
|
|
@@ -799,6 +799,18 @@ export function isIf(item: unknown): item is If {
|
|
|
799
799
|
return reflection.isInstance(item, If);
|
|
800
800
|
}
|
|
801
801
|
|
|
802
|
+
export interface IfWithAlias extends langium.AstNode {
|
|
803
|
+
readonly $container: Pattern;
|
|
804
|
+
readonly $type: 'IfWithAlias';
|
|
805
|
+
if: If;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
export const IfWithAlias = 'IfWithAlias';
|
|
809
|
+
|
|
810
|
+
export function isIfWithAlias(item: unknown): item is IfWithAlias {
|
|
811
|
+
return reflection.isInstance(item, IfWithAlias);
|
|
812
|
+
}
|
|
813
|
+
|
|
802
814
|
export interface Import extends langium.AstNode {
|
|
803
815
|
readonly $container: ModuleDefinition;
|
|
804
816
|
readonly $type: 'Import';
|
|
@@ -1008,6 +1020,7 @@ export interface Pattern extends langium.AstNode {
|
|
|
1008
1020
|
forEach?: ForEach;
|
|
1009
1021
|
fullTextSearch?: FullTextSearch;
|
|
1010
1022
|
if?: If;
|
|
1023
|
+
ifWithAlias?: IfWithAlias;
|
|
1011
1024
|
purge?: Purge;
|
|
1012
1025
|
return?: Return;
|
|
1013
1026
|
throwError?: ThrowError;
|
|
@@ -1437,7 +1450,7 @@ export function isStandaloneStatement(item: unknown): item is StandaloneStatemen
|
|
|
1437
1450
|
}
|
|
1438
1451
|
|
|
1439
1452
|
export interface Statement extends langium.AstNode {
|
|
1440
|
-
readonly $container: ArrayLiteral | CaseEntry | Else | ForEach | Handler | If | StandaloneStatement | ThenSpec | WorkflowDefinition;
|
|
1453
|
+
readonly $container: ArrayLiteral | CaseEntry | ConditionalFlowStep | Else | FlowEntry | ForEach | Handler | If | StandaloneStatement | ThenSpec | WorkflowDefinition;
|
|
1441
1454
|
readonly $type: 'Statement';
|
|
1442
1455
|
hints: Array<RuntimeHint>;
|
|
1443
1456
|
pattern: Pattern;
|
|
@@ -1600,6 +1613,7 @@ export type AgentlangAstType = {
|
|
|
1600
1613
|
GroupByClause: GroupByClause
|
|
1601
1614
|
Handler: Handler
|
|
1602
1615
|
If: If
|
|
1616
|
+
IfWithAlias: IfWithAlias
|
|
1603
1617
|
Import: Import
|
|
1604
1618
|
JoinSpec: JoinSpec
|
|
1605
1619
|
KvPair: KvPair
|
|
@@ -1664,7 +1678,7 @@ export type AgentlangAstType = {
|
|
|
1664
1678
|
export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
1665
1679
|
|
|
1666
1680
|
getAllTypes(): string[] {
|
|
1667
|
-
return [ActionEntry, AfterTriggerDefinition, AgentDefinition, AgentXtraAttribute, AgentXtraSpec, AggregateFunctionSpec, AliasSpec, ArrayLiteral, AsyncFnCall, AttributeDefinition, AttributeValueExpression, BackoffSpec, BeforeTriggerDefinition, BinExpr, CaseEntry, CatchSpec, CompositeUniqueDefinition, ConditionalFlowStep, CrudMap, CrudMapBody, DecisionDefBody, DecisionDefinition, Definition, Delete, DirectiveDefinition, Else, EntityActionsDefinitions, EntityDefinition, EnumSpec, EventDefinition, Expr, ExtendsClause, FlowDefBody, FlowDefinition, FlowEntry, FlowStepSpec, FnCall, ForEach, FullTextSearch, GenericDefBody, GenericPropertyDef, GlossaryEntryDefinition, Group, GroupByClause, Handler, If, Import, JoinSpec, KvPair, KvPairs, Literal, MapEntry, MapKey, MapLiteral, MetaDefinition, ModuleDefinition, NegExpr, NodeDefinition, NotExpr, OneOfSpec, OrderByClause, Pattern, PrePostTriggerDefinition, PrimExpr, PropertyDefinition, PublicAgentDefinition, PublicEventDefinition, PublicWorkflowDefinition, Purge, RbacAllowSpec, RbacExpressionSpec, RbacOpr, RbacRolesSpec, RbacSpecDefinition, RbacSpecEntries, RbacSpecEntry, RecordDefinition, RecordExtraDefinition, RecordSchemaDefinition, RefSpec, RelNodes, RelationshipDefinition, RelationshipPattern, ResolverDefinition, ResolverFnName, ResolverMethodName, ResolverMethodSpec, RetryDefinition, Return, RuntimeHint, ScenarioDefinition, SchemaDefinition, SelectIntoEntry, SelectIntoSpec, SetAttribute, StandaloneStatement, Statement, ThenSpec, ThrowError, TriggerDefinition, TriggerEntry, WhereSpec, WhereSpecClause, WorkflowDefinition, WorkflowHeader];
|
|
1681
|
+
return [ActionEntry, AfterTriggerDefinition, AgentDefinition, AgentXtraAttribute, AgentXtraSpec, AggregateFunctionSpec, AliasSpec, ArrayLiteral, AsyncFnCall, AttributeDefinition, AttributeValueExpression, BackoffSpec, BeforeTriggerDefinition, BinExpr, CaseEntry, CatchSpec, CompositeUniqueDefinition, ConditionalFlowStep, CrudMap, CrudMapBody, DecisionDefBody, DecisionDefinition, Definition, Delete, DirectiveDefinition, Else, EntityActionsDefinitions, EntityDefinition, EnumSpec, EventDefinition, Expr, ExtendsClause, FlowDefBody, FlowDefinition, FlowEntry, FlowStepSpec, FnCall, ForEach, FullTextSearch, GenericDefBody, GenericPropertyDef, GlossaryEntryDefinition, Group, GroupByClause, Handler, If, IfWithAlias, Import, JoinSpec, KvPair, KvPairs, Literal, MapEntry, MapKey, MapLiteral, MetaDefinition, ModuleDefinition, NegExpr, NodeDefinition, NotExpr, OneOfSpec, OrderByClause, Pattern, PrePostTriggerDefinition, PrimExpr, PropertyDefinition, PublicAgentDefinition, PublicEventDefinition, PublicWorkflowDefinition, Purge, RbacAllowSpec, RbacExpressionSpec, RbacOpr, RbacRolesSpec, RbacSpecDefinition, RbacSpecEntries, RbacSpecEntry, RecordDefinition, RecordExtraDefinition, RecordSchemaDefinition, RefSpec, RelNodes, RelationshipDefinition, RelationshipPattern, ResolverDefinition, ResolverFnName, ResolverMethodName, ResolverMethodSpec, RetryDefinition, Return, RuntimeHint, ScenarioDefinition, SchemaDefinition, SelectIntoEntry, SelectIntoSpec, SetAttribute, StandaloneStatement, Statement, ThenSpec, ThrowError, TriggerDefinition, TriggerEntry, WhereSpec, WhereSpecClause, WorkflowDefinition, WorkflowHeader];
|
|
1668
1682
|
}
|
|
1669
1683
|
|
|
1670
1684
|
protected override computeIsSubtype(subtype: string, supertype: string): boolean {
|
|
@@ -1689,9 +1703,6 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
|
1689
1703
|
case PrimExpr: {
|
|
1690
1704
|
return this.isSubtype(Expr, supertype);
|
|
1691
1705
|
}
|
|
1692
|
-
case CrudMap: {
|
|
1693
|
-
return this.isSubtype(FlowStepSpec, supertype);
|
|
1694
|
-
}
|
|
1695
1706
|
case EntityDefinition:
|
|
1696
1707
|
case EventDefinition:
|
|
1697
1708
|
case PublicEventDefinition:
|
|
@@ -1707,6 +1718,9 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
|
1707
1718
|
case NotExpr: {
|
|
1708
1719
|
return this.isSubtype(PrimExpr, supertype);
|
|
1709
1720
|
}
|
|
1721
|
+
case Statement: {
|
|
1722
|
+
return this.isSubtype(FlowStepSpec, supertype);
|
|
1723
|
+
}
|
|
1710
1724
|
default: {
|
|
1711
1725
|
return false;
|
|
1712
1726
|
}
|
|
@@ -2109,6 +2123,14 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
|
2109
2123
|
]
|
|
2110
2124
|
};
|
|
2111
2125
|
}
|
|
2126
|
+
case IfWithAlias: {
|
|
2127
|
+
return {
|
|
2128
|
+
name: IfWithAlias,
|
|
2129
|
+
properties: [
|
|
2130
|
+
{ name: 'if' }
|
|
2131
|
+
]
|
|
2132
|
+
};
|
|
2133
|
+
}
|
|
2112
2134
|
case Import: {
|
|
2113
2135
|
return {
|
|
2114
2136
|
name: Import,
|
|
@@ -2260,6 +2282,7 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
|
2260
2282
|
{ name: 'forEach' },
|
|
2261
2283
|
{ name: 'fullTextSearch' },
|
|
2262
2284
|
{ name: 'if' },
|
|
2285
|
+
{ name: 'ifWithAlias' },
|
|
2263
2286
|
{ name: 'purge' },
|
|
2264
2287
|
{ name: 'return' },
|
|
2265
2288
|
{ name: 'throwError' }
|