agentlang 0.10.0 → 0.10.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.
Files changed (43) hide show
  1. package/out/language/generated/ast.d.ts +60 -42
  2. package/out/language/generated/ast.d.ts.map +1 -1
  3. package/out/language/generated/ast.js +45 -31
  4. package/out/language/generated/ast.js.map +1 -1
  5. package/out/language/generated/grammar.d.ts.map +1 -1
  6. package/out/language/generated/grammar.js +294 -327
  7. package/out/language/generated/grammar.js.map +1 -1
  8. package/out/language/main.cjs +336 -358
  9. package/out/language/main.cjs.map +2 -2
  10. package/out/language/parser.d.ts +11 -1
  11. package/out/language/parser.d.ts.map +1 -1
  12. package/out/language/parser.js +47 -7
  13. package/out/language/parser.js.map +1 -1
  14. package/out/runtime/agents/common.d.ts +2 -2
  15. package/out/runtime/agents/common.js +1 -1
  16. package/out/runtime/interpreter.d.ts.map +1 -1
  17. package/out/runtime/interpreter.js +14 -13
  18. package/out/runtime/interpreter.js.map +1 -1
  19. package/out/runtime/modules/ai.d.ts +2 -5
  20. package/out/runtime/modules/ai.d.ts.map +1 -1
  21. package/out/runtime/modules/ai.js +26 -17
  22. package/out/runtime/modules/ai.js.map +1 -1
  23. package/out/runtime/services/documentFetcher.js +2 -2
  24. package/out/runtime/services/documentFetcher.js.map +1 -1
  25. package/out/runtime/util.d.ts +10 -0
  26. package/out/runtime/util.d.ts.map +1 -1
  27. package/out/runtime/util.js +27 -2
  28. package/out/runtime/util.js.map +1 -1
  29. package/out/utils/fs/index.d.ts +12 -2
  30. package/out/utils/fs/index.d.ts.map +1 -1
  31. package/out/utils/fs/index.js +27 -6
  32. package/out/utils/fs/index.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/language/agentlang.langium +6 -9
  35. package/src/language/generated/ast.ts +66 -43
  36. package/src/language/generated/grammar.ts +294 -327
  37. package/src/language/parser.ts +54 -5
  38. package/src/runtime/agents/common.ts +1 -1
  39. package/src/runtime/interpreter.ts +25 -13
  40. package/src/runtime/modules/ai.ts +33 -24
  41. package/src/runtime/services/documentFetcher.ts +2 -2
  42. package/src/runtime/util.ts +45 -2
  43. package/src/utils/fs/index.ts +30 -6
@@ -122,17 +122,14 @@ AliasSpec: ('@as' (alias=ID | '[' ( aliases+=ID (',' aliases+=ID)*)+ ']'));
122
122
  ThenSpec: '@then' '{' (statements+=Statement (';' statements+=Statement)*)+ '}';
123
123
 
124
124
  CrudMap: '{' (name=QueryId (':')? '{''}'
125
- | (name=QualifiedName (':')? '{''}' ',' '@from' source=Literal (',' upsert+='@upsert')?)
125
+ | (name=QualifiedName (':')? '{''}' ',' '@from' source=Literal)
126
126
  | name=QualifiedName (':')? body=CrudMapBody)
127
127
  (',' relationships+=RelationshipPattern (',' relationships+=RelationshipPattern)*)?
128
- (',' joins+=JoinSpec)*
129
- (',' into=SelectIntoSpec)?
130
- (',' where=WhereSpec)?
131
- (',' groupByClause=GroupByClause)?
132
- (',' orderByClause=OrderByClause)?
133
- (',' upsert+='@upsert')?
134
- (',' distinct+='@distinct')?
135
- '}';
128
+ (',' queryOptions+=QueryOption (',' queryOptions+=QueryOption)*)?
129
+ '}';
130
+
131
+ QueryOption: join=JoinSpec | into=SelectIntoSpec | where=WhereSpec | groupByClause=GroupByClause | orderByClause=OrderByClause
132
+ | upsert='@upsert' | distinct='@distinct';
136
133
 
137
134
  CrudMapBody: '{' (attributes+=SetAttribute (',' attributes+=SetAttribute)*)+ properties+=PropertyDefinition* '}';
138
135
 
@@ -453,31 +453,19 @@ export interface CrudMap extends langium.AstNode {
453
453
  readonly $container: Pattern;
454
454
  readonly $type: 'CrudMap';
455
455
  body?: CrudMapBody;
456
- distinct: Array<'@distinct'>;
457
- groupByClause?: GroupByClause;
458
- into?: SelectIntoSpec;
459
- joins: Array<JoinSpec>;
460
456
  name: QualifiedName | QueryId;
461
- orderByClause?: OrderByClause;
457
+ queryOptions: Array<QueryOption>;
462
458
  relationships: Array<RelationshipPattern>;
463
459
  source?: Literal;
464
- upsert: Array<'@upsert'>;
465
- where?: WhereSpec;
466
460
  }
467
461
 
468
462
  export const CrudMap = {
469
463
  $type: 'CrudMap',
470
464
  body: 'body',
471
- distinct: 'distinct',
472
- groupByClause: 'groupByClause',
473
- into: 'into',
474
- joins: 'joins',
475
465
  name: 'name',
476
- orderByClause: 'orderByClause',
466
+ queryOptions: 'queryOptions',
477
467
  relationships: 'relationships',
478
- source: 'source',
479
- upsert: 'upsert',
480
- where: 'where'
468
+ source: 'source'
481
469
  } as const;
482
470
 
483
471
  export function isCrudMap(item: unknown): item is CrudMap {
@@ -882,7 +870,7 @@ export function isGroup(item: unknown): item is Group {
882
870
  }
883
871
 
884
872
  export interface GroupByClause extends langium.AstNode {
885
- readonly $container: CrudMap;
873
+ readonly $container: QueryOption;
886
874
  readonly $type: 'GroupByClause';
887
875
  colNames: Array<QualifiedName>;
888
876
  }
@@ -965,7 +953,7 @@ export function isImport(item: unknown): item is Import {
965
953
  }
966
954
 
967
955
  export interface JoinSpec extends langium.AstNode {
968
- readonly $container: CrudMap;
956
+ readonly $container: QueryOption;
969
957
  readonly $type: 'JoinSpec';
970
958
  lhs: QueryId;
971
959
  name: QualifiedName;
@@ -1203,7 +1191,7 @@ export function isOneOfSpec(item: unknown): item is OneOfSpec {
1203
1191
  }
1204
1192
 
1205
1193
  export interface OrderByClause extends langium.AstNode {
1206
- readonly $container: CrudMap;
1194
+ readonly $container: QueryOption;
1207
1195
  readonly $type: 'OrderByClause';
1208
1196
  colNames: Array<QualifiedName>;
1209
1197
  order?: '@asc' | '@desc';
@@ -1368,6 +1356,33 @@ export function isQueryId(item: unknown): item is QueryId {
1368
1356
  return typeof item === 'string';
1369
1357
  }
1370
1358
 
1359
+ export interface QueryOption extends langium.AstNode {
1360
+ readonly $container: CrudMap;
1361
+ readonly $type: 'QueryOption';
1362
+ distinct?: '@distinct';
1363
+ groupByClause?: GroupByClause;
1364
+ into?: SelectIntoSpec;
1365
+ join?: JoinSpec;
1366
+ orderByClause?: OrderByClause;
1367
+ upsert?: '@upsert';
1368
+ where?: WhereSpec;
1369
+ }
1370
+
1371
+ export const QueryOption = {
1372
+ $type: 'QueryOption',
1373
+ distinct: 'distinct',
1374
+ groupByClause: 'groupByClause',
1375
+ into: 'into',
1376
+ join: 'join',
1377
+ orderByClause: 'orderByClause',
1378
+ upsert: 'upsert',
1379
+ where: 'where'
1380
+ } as const;
1381
+
1382
+ export function isQueryOption(item: unknown): item is QueryOption {
1383
+ return reflection.isInstance(item, QueryOption.$type);
1384
+ }
1385
+
1371
1386
  export interface RbacAllowSpec extends langium.AstNode {
1372
1387
  readonly $container: RbacSpecEntry;
1373
1388
  readonly $type: 'RbacAllowSpec';
@@ -1792,7 +1807,7 @@ export function isSelectIntoEntry(item: unknown): item is SelectIntoEntry {
1792
1807
  }
1793
1808
 
1794
1809
  export interface SelectIntoSpec extends langium.AstNode {
1795
- readonly $container: CrudMap;
1810
+ readonly $container: QueryOption;
1796
1811
  readonly $type: 'SelectIntoSpec';
1797
1812
  entries: Array<SelectIntoEntry>;
1798
1813
  }
@@ -1942,7 +1957,7 @@ export function isTriggerEntry(item: unknown): item is TriggerEntry {
1942
1957
  }
1943
1958
 
1944
1959
  export interface WhereSpec extends langium.AstNode {
1945
- readonly $container: CrudMap;
1960
+ readonly $container: QueryOption;
1946
1961
  readonly $type: 'WhereSpec';
1947
1962
  clauses: Array<WhereSpecClause>;
1948
1963
  }
@@ -2131,6 +2146,7 @@ export type AgentlangAstType = {
2131
2146
  PublicEventDefinition: PublicEventDefinition
2132
2147
  PublicWorkflowDefinition: PublicWorkflowDefinition
2133
2148
  Purge: Purge
2149
+ QueryOption: QueryOption
2134
2150
  RbacAllowSpec: RbacAllowSpec
2135
2151
  RbacExpressionSpec: RbacExpressionSpec
2136
2152
  RbacOpr: RbacOpr
@@ -2408,25 +2424,12 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
2408
2424
  body: {
2409
2425
  name: CrudMap.body
2410
2426
  },
2411
- distinct: {
2412
- name: CrudMap.distinct,
2413
- defaultValue: []
2414
- },
2415
- groupByClause: {
2416
- name: CrudMap.groupByClause
2417
- },
2418
- into: {
2419
- name: CrudMap.into
2420
- },
2421
- joins: {
2422
- name: CrudMap.joins,
2423
- defaultValue: []
2424
- },
2425
2427
  name: {
2426
2428
  name: CrudMap.name
2427
2429
  },
2428
- orderByClause: {
2429
- name: CrudMap.orderByClause
2430
+ queryOptions: {
2431
+ name: CrudMap.queryOptions,
2432
+ defaultValue: []
2430
2433
  },
2431
2434
  relationships: {
2432
2435
  name: CrudMap.relationships,
@@ -2434,13 +2437,6 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
2434
2437
  },
2435
2438
  source: {
2436
2439
  name: CrudMap.source
2437
- },
2438
- upsert: {
2439
- name: CrudMap.upsert,
2440
- defaultValue: []
2441
- },
2442
- where: {
2443
- name: CrudMap.where
2444
2440
  }
2445
2441
  },
2446
2442
  superTypes: []
@@ -3074,6 +3070,33 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
3074
3070
  },
3075
3071
  superTypes: []
3076
3072
  },
3073
+ QueryOption: {
3074
+ name: QueryOption.$type,
3075
+ properties: {
3076
+ distinct: {
3077
+ name: QueryOption.distinct
3078
+ },
3079
+ groupByClause: {
3080
+ name: QueryOption.groupByClause
3081
+ },
3082
+ into: {
3083
+ name: QueryOption.into
3084
+ },
3085
+ join: {
3086
+ name: QueryOption.join
3087
+ },
3088
+ orderByClause: {
3089
+ name: QueryOption.orderByClause
3090
+ },
3091
+ upsert: {
3092
+ name: QueryOption.upsert
3093
+ },
3094
+ where: {
3095
+ name: QueryOption.where
3096
+ }
3097
+ },
3098
+ superTypes: []
3099
+ },
3077
3100
  RbacAllowSpec: {
3078
3101
  name: RbacAllowSpec.$type,
3079
3102
  properties: {