agentlang 0.7.0 → 0.7.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.
Files changed (63) hide show
  1. package/out/api/http.d.ts.map +1 -1
  2. package/out/api/http.js +46 -26
  3. package/out/api/http.js.map +1 -1
  4. package/out/cli/main.d.ts +1 -0
  5. package/out/cli/main.d.ts.map +1 -1
  6. package/out/cli/main.js +15 -2
  7. package/out/cli/main.js.map +1 -1
  8. package/out/language/generated/ast.d.ts +15 -6
  9. package/out/language/generated/ast.d.ts.map +1 -1
  10. package/out/language/generated/ast.js +16 -2
  11. package/out/language/generated/ast.js.map +1 -1
  12. package/out/language/generated/grammar.d.ts.map +1 -1
  13. package/out/language/generated/grammar.js +215 -164
  14. package/out/language/generated/grammar.js.map +1 -1
  15. package/out/language/main.cjs +227 -166
  16. package/out/language/main.cjs.map +2 -2
  17. package/out/runtime/defs.d.ts +16 -1
  18. package/out/runtime/defs.d.ts.map +1 -1
  19. package/out/runtime/defs.js +29 -1
  20. package/out/runtime/defs.js.map +1 -1
  21. package/out/runtime/exec-graph.d.ts.map +1 -1
  22. package/out/runtime/exec-graph.js +8 -0
  23. package/out/runtime/exec-graph.js.map +1 -1
  24. package/out/runtime/interpreter.d.ts +2 -1
  25. package/out/runtime/interpreter.d.ts.map +1 -1
  26. package/out/runtime/interpreter.js +10 -0
  27. package/out/runtime/interpreter.js.map +1 -1
  28. package/out/runtime/jsmodules.d.ts +8 -0
  29. package/out/runtime/jsmodules.d.ts.map +1 -1
  30. package/out/runtime/jsmodules.js +139 -22
  31. package/out/runtime/jsmodules.js.map +1 -1
  32. package/out/runtime/loader.d.ts +1 -0
  33. package/out/runtime/loader.d.ts.map +1 -1
  34. package/out/runtime/loader.js +9 -2
  35. package/out/runtime/loader.js.map +1 -1
  36. package/out/runtime/module-transform.d.ts +77 -0
  37. package/out/runtime/module-transform.d.ts.map +1 -0
  38. package/out/runtime/module-transform.js +201 -0
  39. package/out/runtime/module-transform.js.map +1 -0
  40. package/out/runtime/modules/ai.d.ts.map +1 -1
  41. package/out/runtime/modules/ai.js +18 -6
  42. package/out/runtime/modules/ai.js.map +1 -1
  43. package/out/runtime/modules/core.d.ts +5 -0
  44. package/out/runtime/modules/core.d.ts.map +1 -1
  45. package/out/runtime/modules/core.js +58 -6
  46. package/out/runtime/modules/core.js.map +1 -1
  47. package/out/syntaxes/agentlang.monarch.js +1 -1
  48. package/out/syntaxes/agentlang.monarch.js.map +1 -1
  49. package/package.json +1 -1
  50. package/src/api/http.ts +51 -25
  51. package/src/cli/main.ts +20 -0
  52. package/src/language/agentlang.langium +3 -1
  53. package/src/language/generated/ast.ts +32 -8
  54. package/src/language/generated/grammar.ts +215 -164
  55. package/src/runtime/defs.ts +47 -0
  56. package/src/runtime/exec-graph.ts +13 -0
  57. package/src/runtime/interpreter.ts +12 -0
  58. package/src/runtime/jsmodules.ts +189 -22
  59. package/src/runtime/loader.ts +10 -2
  60. package/src/runtime/module-transform.ts +277 -0
  61. package/src/runtime/modules/ai.ts +20 -6
  62. package/src/runtime/modules/core.ts +80 -5
  63. package/src/syntaxes/agentlang.monarch.ts +1 -1
@@ -3,7 +3,7 @@
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
 
6
-
6
+ /* eslint-disable */
7
7
  import * as langium from 'langium';
8
8
 
9
9
  export const AgentlangTerminals = {
@@ -110,6 +110,7 @@ export type AgentlangKeywordNames =
110
110
  | "scenario"
111
111
  | "startTransaction"
112
112
  | "subscribe"
113
+ | "throw"
113
114
  | "true"
114
115
  | "update"
115
116
  | "upsert"
@@ -378,7 +379,7 @@ export function isBeforeTriggerDefinition(item: unknown): item is BeforeTriggerD
378
379
  }
379
380
 
380
381
  export interface BinExpr extends langium.AstNode {
381
- readonly $container: AttributeDefinition | BinExpr | CaseEntry | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute;
382
+ readonly $container: AttributeDefinition | BinExpr | CaseEntry | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute | ThrowError;
382
383
  readonly $type: 'BinExpr';
383
384
  e1: Expr | PrimExpr;
384
385
  e2: Expr | PrimExpr;
@@ -721,7 +722,7 @@ export function isGlossaryEntryDefinition(item: unknown): item is GlossaryEntryD
721
722
  }
722
723
 
723
724
  export interface Group extends langium.AstNode {
724
- readonly $container: AttributeDefinition | BinExpr | CaseEntry | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute;
725
+ readonly $container: AttributeDefinition | BinExpr | CaseEntry | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute | ThrowError;
725
726
  readonly $type: 'Group';
726
727
  ge: Expr;
727
728
  }
@@ -814,7 +815,7 @@ export function isKvPairs(item: unknown): item is KvPairs {
814
815
  }
815
816
 
816
817
  export interface Literal extends langium.AstNode {
817
- readonly $container: AttributeDefinition | BinExpr | CaseEntry | CrudMap | FnCall | FullTextSearch | GenericPropertyDef | Group | If | KvPair | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute;
818
+ readonly $container: AttributeDefinition | BinExpr | CaseEntry | CrudMap | FnCall | FullTextSearch | GenericPropertyDef | Group | If | KvPair | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute | ThrowError;
818
819
  readonly $type: 'Literal';
819
820
  array?: ArrayLiteral;
820
821
  asyncFnCall?: AsyncFnCall;
@@ -898,7 +899,7 @@ export function isModuleDefinition(item: unknown): item is ModuleDefinition {
898
899
  }
899
900
 
900
901
  export interface NegExpr extends langium.AstNode {
901
- readonly $container: AttributeDefinition | BinExpr | CaseEntry | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute;
902
+ readonly $container: AttributeDefinition | BinExpr | CaseEntry | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute | ThrowError;
902
903
  readonly $type: 'NegExpr';
903
904
  ne: Expr;
904
905
  }
@@ -923,7 +924,7 @@ export function isNodeDefinition(item: unknown): item is NodeDefinition {
923
924
  }
924
925
 
925
926
  export interface NotExpr extends langium.AstNode {
926
- readonly $container: AttributeDefinition | BinExpr | CaseEntry | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute;
927
+ readonly $container: AttributeDefinition | BinExpr | CaseEntry | FnCall | Group | If | MapEntry | NegExpr | NotExpr | Pattern | SetAttribute | ThrowError;
927
928
  readonly $type: 'NotExpr';
928
929
  ne: Expr;
929
930
  }
@@ -957,6 +958,7 @@ export interface Pattern extends langium.AstNode {
957
958
  if?: If;
958
959
  purge?: Purge;
959
960
  return?: Return;
961
+ throwError?: ThrowError;
960
962
  }
961
963
 
962
964
  export const Pattern = 'Pattern';
@@ -1405,6 +1407,18 @@ export function isThenSpec(item: unknown): item is ThenSpec {
1405
1407
  return reflection.isInstance(item, ThenSpec);
1406
1408
  }
1407
1409
 
1410
+ export interface ThrowError extends langium.AstNode {
1411
+ readonly $container: Pattern;
1412
+ readonly $type: 'ThrowError';
1413
+ reason: Expr;
1414
+ }
1415
+
1416
+ export const ThrowError = 'ThrowError';
1417
+
1418
+ export function isThrowError(item: unknown): item is ThrowError {
1419
+ return reflection.isInstance(item, ThrowError);
1420
+ }
1421
+
1408
1422
  export interface TriggerDefinition extends langium.AstNode {
1409
1423
  readonly $container: AfterTriggerDefinition | BeforeTriggerDefinition;
1410
1424
  readonly $type: 'TriggerDefinition';
@@ -1555,6 +1569,7 @@ export type AgentlangAstType = {
1555
1569
  StandaloneStatement: StandaloneStatement
1556
1570
  Statement: Statement
1557
1571
  ThenSpec: ThenSpec
1572
+ ThrowError: ThrowError
1558
1573
  TriggerDefinition: TriggerDefinition
1559
1574
  TriggerEntry: TriggerEntry
1560
1575
  WorkflowDefinition: WorkflowDefinition
@@ -1564,7 +1579,7 @@ export type AgentlangAstType = {
1564
1579
  export class AgentlangAstReflection extends langium.AbstractAstReflection {
1565
1580
 
1566
1581
  getAllTypes(): string[] {
1567
- return [ActionEntry, AfterTriggerDefinition, AgentDefinition, AgentXtraAttribute, AgentXtraSpec, 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, Handler, If, Import, JoinSpec, KvPair, KvPairs, Literal, MapEntry, MapKey, MapLiteral, MetaDefinition, ModuleDefinition, NegExpr, NodeDefinition, NotExpr, OneOfSpec, 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, TriggerDefinition, TriggerEntry, WorkflowDefinition, WorkflowHeader];
1582
+ return [ActionEntry, AfterTriggerDefinition, AgentDefinition, AgentXtraAttribute, AgentXtraSpec, 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, Handler, If, Import, JoinSpec, KvPair, KvPairs, Literal, MapEntry, MapKey, MapLiteral, MetaDefinition, ModuleDefinition, NegExpr, NodeDefinition, NotExpr, OneOfSpec, 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, WorkflowDefinition, WorkflowHeader];
1568
1583
  }
1569
1584
 
1570
1585
  protected override computeIsSubtype(subtype: string, supertype: string): boolean {
@@ -2132,7 +2147,8 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
2132
2147
  { name: 'fullTextSearch' },
2133
2148
  { name: 'if' },
2134
2149
  { name: 'purge' },
2135
- { name: 'return' }
2150
+ { name: 'return' },
2151
+ { name: 'throwError' }
2136
2152
  ]
2137
2153
  };
2138
2154
  }
@@ -2440,6 +2456,14 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
2440
2456
  ]
2441
2457
  };
2442
2458
  }
2459
+ case ThrowError: {
2460
+ return {
2461
+ name: ThrowError,
2462
+ properties: [
2463
+ { name: 'reason' }
2464
+ ]
2465
+ };
2466
+ }
2443
2467
  case TriggerDefinition: {
2444
2468
  return {
2445
2469
  name: TriggerDefinition,