agentlang 0.10.0 → 0.10.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.d.ts.map +1 -1
- package/out/api/http.js +136 -0
- package/out/api/http.js.map +1 -1
- package/out/language/generated/ast.d.ts +87 -44
- package/out/language/generated/ast.d.ts.map +1 -1
- package/out/language/generated/ast.js +65 -31
- 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 +337 -330
- package/out/language/generated/grammar.js.map +1 -1
- package/out/language/main.cjs +396 -361
- package/out/language/main.cjs.map +2 -2
- package/out/language/parser.d.ts +11 -1
- package/out/language/parser.d.ts.map +1 -1
- package/out/language/parser.js +74 -8
- package/out/language/parser.js.map +1 -1
- package/out/language/syntax.d.ts +14 -0
- package/out/language/syntax.d.ts.map +1 -1
- package/out/language/syntax.js +60 -27
- package/out/language/syntax.js.map +1 -1
- package/out/runtime/agents/common.d.ts +2 -2
- package/out/runtime/agents/common.js +1 -1
- package/out/runtime/api.d.ts +2 -0
- package/out/runtime/api.d.ts.map +1 -1
- package/out/runtime/api.js +3 -0
- package/out/runtime/api.js.map +1 -1
- package/out/runtime/datefns.d.ts +34 -0
- package/out/runtime/datefns.d.ts.map +1 -0
- package/out/runtime/datefns.js +82 -0
- package/out/runtime/datefns.js.map +1 -0
- package/out/runtime/exec-graph.d.ts.map +1 -1
- package/out/runtime/exec-graph.js +22 -3
- package/out/runtime/exec-graph.js.map +1 -1
- package/out/runtime/interpreter.d.ts +9 -0
- package/out/runtime/interpreter.d.ts.map +1 -1
- package/out/runtime/interpreter.js +85 -20
- package/out/runtime/interpreter.js.map +1 -1
- package/out/runtime/module.d.ts +8 -0
- package/out/runtime/module.d.ts.map +1 -1
- package/out/runtime/module.js +23 -0
- package/out/runtime/module.js.map +1 -1
- package/out/runtime/modules/ai.d.ts +9 -8
- package/out/runtime/modules/ai.d.ts.map +1 -1
- package/out/runtime/modules/ai.js +92 -37
- 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 +5 -1
- package/out/runtime/modules/core.js.map +1 -1
- package/out/runtime/monitor.d.ts +6 -0
- package/out/runtime/monitor.d.ts.map +1 -1
- package/out/runtime/monitor.js +21 -1
- package/out/runtime/monitor.js.map +1 -1
- package/out/runtime/relgraph.d.ts.map +1 -1
- package/out/runtime/relgraph.js +7 -3
- package/out/runtime/relgraph.js.map +1 -1
- package/out/runtime/resolvers/interface.d.ts +3 -2
- package/out/runtime/resolvers/interface.d.ts.map +1 -1
- package/out/runtime/resolvers/interface.js +3 -2
- package/out/runtime/resolvers/interface.js.map +1 -1
- package/out/runtime/resolvers/sqldb/dbutil.d.ts.map +1 -1
- package/out/runtime/resolvers/sqldb/dbutil.js +17 -4
- package/out/runtime/resolvers/sqldb/dbutil.js.map +1 -1
- package/out/runtime/resolvers/sqldb/impl.d.ts +1 -1
- package/out/runtime/resolvers/sqldb/impl.d.ts.map +1 -1
- package/out/runtime/resolvers/sqldb/impl.js +17 -7
- package/out/runtime/resolvers/sqldb/impl.js.map +1 -1
- package/out/runtime/services/documentFetcher.js +2 -2
- package/out/runtime/services/documentFetcher.js.map +1 -1
- package/out/runtime/util.d.ts +12 -1
- package/out/runtime/util.d.ts.map +1 -1
- package/out/runtime/util.js +38 -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/out/test-harness.d.ts +36 -0
- package/out/test-harness.d.ts.map +1 -0
- package/out/test-harness.js +341 -0
- package/out/test-harness.js.map +1 -0
- package/out/utils/fs/index.d.ts +12 -2
- package/out/utils/fs/index.d.ts.map +1 -1
- package/out/utils/fs/index.js +27 -6
- package/out/utils/fs/index.js.map +1 -1
- package/package.json +4 -1
- package/src/api/http.ts +138 -0
- package/src/language/agentlang.langium +9 -10
- package/src/language/generated/ast.ts +98 -44
- package/src/language/generated/grammar.ts +337 -330
- package/src/language/parser.ts +87 -6
- package/src/language/syntax.ts +71 -24
- package/src/runtime/agents/common.ts +1 -1
- package/src/runtime/api.ts +5 -0
- package/src/runtime/datefns.ts +112 -0
- package/src/runtime/exec-graph.ts +23 -2
- package/src/runtime/interpreter.ts +107 -19
- package/src/runtime/module.ts +26 -0
- package/src/runtime/modules/ai.ts +110 -54
- package/src/runtime/modules/core.ts +5 -1
- package/src/runtime/monitor.ts +27 -1
- package/src/runtime/relgraph.ts +7 -3
- package/src/runtime/resolvers/interface.ts +4 -2
- package/src/runtime/resolvers/sqldb/dbutil.ts +20 -6
- package/src/runtime/resolvers/sqldb/impl.ts +17 -7
- package/src/runtime/services/documentFetcher.ts +2 -2
- package/src/runtime/util.ts +62 -2
- package/src/syntaxes/agentlang.monarch.ts +1 -1
- package/src/test-harness.ts +423 -0
- package/src/utils/fs/index.ts +30 -6
|
@@ -115,24 +115,23 @@ Statement: pattern=Pattern hints+=RuntimeHint*;
|
|
|
115
115
|
|
|
116
116
|
IfWithAlias: '(' if=If ')';
|
|
117
117
|
|
|
118
|
-
RuntimeHint: aliasSpec=AliasSpec | catchSpec=CatchSpec | thenSpec=ThenSpec;
|
|
118
|
+
RuntimeHint: aliasSpec=AliasSpec | catchSpec=CatchSpec | emptySpec=EmptySpec | thenSpec=ThenSpec;
|
|
119
|
+
|
|
120
|
+
EmptySpec: '@empty' stmt=Statement;
|
|
119
121
|
|
|
120
122
|
AliasSpec: ('@as' (alias=ID | '[' ( aliases+=ID (',' aliases+=ID)*)+ ']'));
|
|
121
123
|
|
|
122
124
|
ThenSpec: '@then' '{' (statements+=Statement (';' statements+=Statement)*)+ '}';
|
|
123
125
|
|
|
124
126
|
CrudMap: '{' (name=QueryId (':')? '{''}'
|
|
125
|
-
| (name=QualifiedName (':')? '{''}' ',' '@from' source=Literal
|
|
127
|
+
| (name=QualifiedName (':')? '{''}' ',' '@from' source=Literal)
|
|
126
128
|
| name=QualifiedName (':')? body=CrudMapBody)
|
|
127
129
|
(',' relationships+=RelationshipPattern (',' relationships+=RelationshipPattern)*)?
|
|
128
|
-
(','
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
(',' upsert+='@upsert')?
|
|
134
|
-
(',' distinct+='@distinct')?
|
|
135
|
-
'}';
|
|
130
|
+
(',' queryOptions+=QueryOption (',' queryOptions+=QueryOption)*)?
|
|
131
|
+
'}';
|
|
132
|
+
|
|
133
|
+
QueryOption: join=JoinSpec | into=SelectIntoSpec | where=WhereSpec | groupByClause=GroupByClause | orderByClause=OrderByClause
|
|
134
|
+
| upsert='@upsert' | distinct='@distinct';
|
|
136
135
|
|
|
137
136
|
CrudMapBody: '{' (attributes+=SetAttribute (',' attributes+=SetAttribute)*)+ properties+=PropertyDefinition* '}';
|
|
138
137
|
|
|
@@ -49,6 +49,7 @@ export type AgentlangKeywordNames =
|
|
|
49
49
|
| "@catch"
|
|
50
50
|
| "@desc"
|
|
51
51
|
| "@distinct"
|
|
52
|
+
| "@empty"
|
|
52
53
|
| "@enum"
|
|
53
54
|
| "@expr"
|
|
54
55
|
| "@from"
|
|
@@ -453,31 +454,19 @@ export interface CrudMap extends langium.AstNode {
|
|
|
453
454
|
readonly $container: Pattern;
|
|
454
455
|
readonly $type: 'CrudMap';
|
|
455
456
|
body?: CrudMapBody;
|
|
456
|
-
distinct: Array<'@distinct'>;
|
|
457
|
-
groupByClause?: GroupByClause;
|
|
458
|
-
into?: SelectIntoSpec;
|
|
459
|
-
joins: Array<JoinSpec>;
|
|
460
457
|
name: QualifiedName | QueryId;
|
|
461
|
-
|
|
458
|
+
queryOptions: Array<QueryOption>;
|
|
462
459
|
relationships: Array<RelationshipPattern>;
|
|
463
460
|
source?: Literal;
|
|
464
|
-
upsert: Array<'@upsert'>;
|
|
465
|
-
where?: WhereSpec;
|
|
466
461
|
}
|
|
467
462
|
|
|
468
463
|
export const CrudMap = {
|
|
469
464
|
$type: 'CrudMap',
|
|
470
465
|
body: 'body',
|
|
471
|
-
distinct: 'distinct',
|
|
472
|
-
groupByClause: 'groupByClause',
|
|
473
|
-
into: 'into',
|
|
474
|
-
joins: 'joins',
|
|
475
466
|
name: 'name',
|
|
476
|
-
|
|
467
|
+
queryOptions: 'queryOptions',
|
|
477
468
|
relationships: 'relationships',
|
|
478
|
-
source: 'source'
|
|
479
|
-
upsert: 'upsert',
|
|
480
|
-
where: 'where'
|
|
469
|
+
source: 'source'
|
|
481
470
|
} as const;
|
|
482
471
|
|
|
483
472
|
export function isCrudMap(item: unknown): item is CrudMap {
|
|
@@ -598,6 +587,21 @@ export function isElse(item: unknown): item is Else {
|
|
|
598
587
|
return reflection.isInstance(item, Else.$type);
|
|
599
588
|
}
|
|
600
589
|
|
|
590
|
+
export interface EmptySpec extends langium.AstNode {
|
|
591
|
+
readonly $container: RuntimeHint;
|
|
592
|
+
readonly $type: 'EmptySpec';
|
|
593
|
+
stmt: Statement;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
export const EmptySpec = {
|
|
597
|
+
$type: 'EmptySpec',
|
|
598
|
+
stmt: 'stmt'
|
|
599
|
+
} as const;
|
|
600
|
+
|
|
601
|
+
export function isEmptySpec(item: unknown): item is EmptySpec {
|
|
602
|
+
return reflection.isInstance(item, EmptySpec.$type);
|
|
603
|
+
}
|
|
604
|
+
|
|
601
605
|
export interface EntityActionsDefinitions extends langium.AstNode {
|
|
602
606
|
readonly $container: RecordExtraDefinition;
|
|
603
607
|
readonly $type: 'EntityActionsDefinitions';
|
|
@@ -882,7 +886,7 @@ export function isGroup(item: unknown): item is Group {
|
|
|
882
886
|
}
|
|
883
887
|
|
|
884
888
|
export interface GroupByClause extends langium.AstNode {
|
|
885
|
-
readonly $container:
|
|
889
|
+
readonly $container: QueryOption;
|
|
886
890
|
readonly $type: 'GroupByClause';
|
|
887
891
|
colNames: Array<QualifiedName>;
|
|
888
892
|
}
|
|
@@ -965,7 +969,7 @@ export function isImport(item: unknown): item is Import {
|
|
|
965
969
|
}
|
|
966
970
|
|
|
967
971
|
export interface JoinSpec extends langium.AstNode {
|
|
968
|
-
readonly $container:
|
|
972
|
+
readonly $container: QueryOption;
|
|
969
973
|
readonly $type: 'JoinSpec';
|
|
970
974
|
lhs: QueryId;
|
|
971
975
|
name: QualifiedName;
|
|
@@ -1203,7 +1207,7 @@ export function isOneOfSpec(item: unknown): item is OneOfSpec {
|
|
|
1203
1207
|
}
|
|
1204
1208
|
|
|
1205
1209
|
export interface OrderByClause extends langium.AstNode {
|
|
1206
|
-
readonly $container:
|
|
1210
|
+
readonly $container: QueryOption;
|
|
1207
1211
|
readonly $type: 'OrderByClause';
|
|
1208
1212
|
colNames: Array<QualifiedName>;
|
|
1209
1213
|
order?: '@asc' | '@desc';
|
|
@@ -1368,6 +1372,33 @@ export function isQueryId(item: unknown): item is QueryId {
|
|
|
1368
1372
|
return typeof item === 'string';
|
|
1369
1373
|
}
|
|
1370
1374
|
|
|
1375
|
+
export interface QueryOption extends langium.AstNode {
|
|
1376
|
+
readonly $container: CrudMap;
|
|
1377
|
+
readonly $type: 'QueryOption';
|
|
1378
|
+
distinct?: '@distinct';
|
|
1379
|
+
groupByClause?: GroupByClause;
|
|
1380
|
+
into?: SelectIntoSpec;
|
|
1381
|
+
join?: JoinSpec;
|
|
1382
|
+
orderByClause?: OrderByClause;
|
|
1383
|
+
upsert?: '@upsert';
|
|
1384
|
+
where?: WhereSpec;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
export const QueryOption = {
|
|
1388
|
+
$type: 'QueryOption',
|
|
1389
|
+
distinct: 'distinct',
|
|
1390
|
+
groupByClause: 'groupByClause',
|
|
1391
|
+
into: 'into',
|
|
1392
|
+
join: 'join',
|
|
1393
|
+
orderByClause: 'orderByClause',
|
|
1394
|
+
upsert: 'upsert',
|
|
1395
|
+
where: 'where'
|
|
1396
|
+
} as const;
|
|
1397
|
+
|
|
1398
|
+
export function isQueryOption(item: unknown): item is QueryOption {
|
|
1399
|
+
return reflection.isInstance(item, QueryOption.$type);
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1371
1402
|
export interface RbacAllowSpec extends langium.AstNode {
|
|
1372
1403
|
readonly $container: RbacSpecEntry;
|
|
1373
1404
|
readonly $type: 'RbacAllowSpec';
|
|
@@ -1729,6 +1760,7 @@ export interface RuntimeHint extends langium.AstNode {
|
|
|
1729
1760
|
readonly $type: 'RuntimeHint';
|
|
1730
1761
|
aliasSpec?: AliasSpec;
|
|
1731
1762
|
catchSpec?: CatchSpec;
|
|
1763
|
+
emptySpec?: EmptySpec;
|
|
1732
1764
|
thenSpec?: ThenSpec;
|
|
1733
1765
|
}
|
|
1734
1766
|
|
|
@@ -1736,6 +1768,7 @@ export const RuntimeHint = {
|
|
|
1736
1768
|
$type: 'RuntimeHint',
|
|
1737
1769
|
aliasSpec: 'aliasSpec',
|
|
1738
1770
|
catchSpec: 'catchSpec',
|
|
1771
|
+
emptySpec: 'emptySpec',
|
|
1739
1772
|
thenSpec: 'thenSpec'
|
|
1740
1773
|
} as const;
|
|
1741
1774
|
|
|
@@ -1792,7 +1825,7 @@ export function isSelectIntoEntry(item: unknown): item is SelectIntoEntry {
|
|
|
1792
1825
|
}
|
|
1793
1826
|
|
|
1794
1827
|
export interface SelectIntoSpec extends langium.AstNode {
|
|
1795
|
-
readonly $container:
|
|
1828
|
+
readonly $container: QueryOption;
|
|
1796
1829
|
readonly $type: 'SelectIntoSpec';
|
|
1797
1830
|
entries: Array<SelectIntoEntry>;
|
|
1798
1831
|
}
|
|
@@ -1849,7 +1882,7 @@ export function isStandaloneStatement(item: unknown): item is StandaloneStatemen
|
|
|
1849
1882
|
}
|
|
1850
1883
|
|
|
1851
1884
|
export interface Statement extends langium.AstNode {
|
|
1852
|
-
readonly $container: ArrayLiteral | CaseEntry | ConditionalFlowStep | Else | FlowEntry | ForEach | Handler | If | StandaloneStatement | ThenSpec | WorkflowDefinition;
|
|
1885
|
+
readonly $container: ArrayLiteral | CaseEntry | ConditionalFlowStep | Else | EmptySpec | FlowEntry | ForEach | Handler | If | StandaloneStatement | ThenSpec | WorkflowDefinition;
|
|
1853
1886
|
readonly $type: 'Statement';
|
|
1854
1887
|
hints: Array<RuntimeHint>;
|
|
1855
1888
|
pattern: Pattern;
|
|
@@ -1942,7 +1975,7 @@ export function isTriggerEntry(item: unknown): item is TriggerEntry {
|
|
|
1942
1975
|
}
|
|
1943
1976
|
|
|
1944
1977
|
export interface WhereSpec extends langium.AstNode {
|
|
1945
|
-
readonly $container:
|
|
1978
|
+
readonly $container: QueryOption;
|
|
1946
1979
|
readonly $type: 'WhereSpec';
|
|
1947
1980
|
clauses: Array<WhereSpecClause>;
|
|
1948
1981
|
}
|
|
@@ -2087,6 +2120,7 @@ export type AgentlangAstType = {
|
|
|
2087
2120
|
Delete: Delete
|
|
2088
2121
|
DirectiveDefinition: DirectiveDefinition
|
|
2089
2122
|
Else: Else
|
|
2123
|
+
EmptySpec: EmptySpec
|
|
2090
2124
|
EntityActionsDefinitions: EntityActionsDefinitions
|
|
2091
2125
|
EntityDefinition: EntityDefinition
|
|
2092
2126
|
EnumSpec: EnumSpec
|
|
@@ -2131,6 +2165,7 @@ export type AgentlangAstType = {
|
|
|
2131
2165
|
PublicEventDefinition: PublicEventDefinition
|
|
2132
2166
|
PublicWorkflowDefinition: PublicWorkflowDefinition
|
|
2133
2167
|
Purge: Purge
|
|
2168
|
+
QueryOption: QueryOption
|
|
2134
2169
|
RbacAllowSpec: RbacAllowSpec
|
|
2135
2170
|
RbacExpressionSpec: RbacExpressionSpec
|
|
2136
2171
|
RbacOpr: RbacOpr
|
|
@@ -2408,25 +2443,12 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
|
2408
2443
|
body: {
|
|
2409
2444
|
name: CrudMap.body
|
|
2410
2445
|
},
|
|
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
2446
|
name: {
|
|
2426
2447
|
name: CrudMap.name
|
|
2427
2448
|
},
|
|
2428
|
-
|
|
2429
|
-
name: CrudMap.
|
|
2449
|
+
queryOptions: {
|
|
2450
|
+
name: CrudMap.queryOptions,
|
|
2451
|
+
defaultValue: []
|
|
2430
2452
|
},
|
|
2431
2453
|
relationships: {
|
|
2432
2454
|
name: CrudMap.relationships,
|
|
@@ -2434,13 +2456,6 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
|
2434
2456
|
},
|
|
2435
2457
|
source: {
|
|
2436
2458
|
name: CrudMap.source
|
|
2437
|
-
},
|
|
2438
|
-
upsert: {
|
|
2439
|
-
name: CrudMap.upsert,
|
|
2440
|
-
defaultValue: []
|
|
2441
|
-
},
|
|
2442
|
-
where: {
|
|
2443
|
-
name: CrudMap.where
|
|
2444
2459
|
}
|
|
2445
2460
|
},
|
|
2446
2461
|
superTypes: []
|
|
@@ -2521,6 +2536,15 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
|
2521
2536
|
},
|
|
2522
2537
|
superTypes: []
|
|
2523
2538
|
},
|
|
2539
|
+
EmptySpec: {
|
|
2540
|
+
name: EmptySpec.$type,
|
|
2541
|
+
properties: {
|
|
2542
|
+
stmt: {
|
|
2543
|
+
name: EmptySpec.stmt
|
|
2544
|
+
}
|
|
2545
|
+
},
|
|
2546
|
+
superTypes: []
|
|
2547
|
+
},
|
|
2524
2548
|
EntityActionsDefinitions: {
|
|
2525
2549
|
name: EntityActionsDefinitions.$type,
|
|
2526
2550
|
properties: {
|
|
@@ -3074,6 +3098,33 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
|
3074
3098
|
},
|
|
3075
3099
|
superTypes: []
|
|
3076
3100
|
},
|
|
3101
|
+
QueryOption: {
|
|
3102
|
+
name: QueryOption.$type,
|
|
3103
|
+
properties: {
|
|
3104
|
+
distinct: {
|
|
3105
|
+
name: QueryOption.distinct
|
|
3106
|
+
},
|
|
3107
|
+
groupByClause: {
|
|
3108
|
+
name: QueryOption.groupByClause
|
|
3109
|
+
},
|
|
3110
|
+
into: {
|
|
3111
|
+
name: QueryOption.into
|
|
3112
|
+
},
|
|
3113
|
+
join: {
|
|
3114
|
+
name: QueryOption.join
|
|
3115
|
+
},
|
|
3116
|
+
orderByClause: {
|
|
3117
|
+
name: QueryOption.orderByClause
|
|
3118
|
+
},
|
|
3119
|
+
upsert: {
|
|
3120
|
+
name: QueryOption.upsert
|
|
3121
|
+
},
|
|
3122
|
+
where: {
|
|
3123
|
+
name: QueryOption.where
|
|
3124
|
+
}
|
|
3125
|
+
},
|
|
3126
|
+
superTypes: []
|
|
3127
|
+
},
|
|
3077
3128
|
RbacAllowSpec: {
|
|
3078
3129
|
name: RbacAllowSpec.$type,
|
|
3079
3130
|
properties: {
|
|
@@ -3338,6 +3389,9 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
|
|
|
3338
3389
|
catchSpec: {
|
|
3339
3390
|
name: RuntimeHint.catchSpec
|
|
3340
3391
|
},
|
|
3392
|
+
emptySpec: {
|
|
3393
|
+
name: RuntimeHint.emptySpec
|
|
3394
|
+
},
|
|
3341
3395
|
thenSpec: {
|
|
3342
3396
|
name: RuntimeHint.thenSpec
|
|
3343
3397
|
}
|