agentlang 0.0.33 → 0.0.35
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 +13 -6
- package/out/api/http.js.map +1 -1
- package/out/language/generated/ast.d.ts +1 -1
- package/out/language/generated/ast.d.ts.map +1 -1
- package/out/language/generated/ast.js +0 -1
- package/out/language/generated/ast.js.map +1 -1
- package/out/language/generated/grammar.js +1 -1
- package/out/language/main.cjs +1 -1
- package/out/language/main.cjs.map +1 -1
- package/out/runtime/integrations.d.ts.map +1 -1
- package/out/runtime/integrations.js +21 -15
- package/out/runtime/integrations.js.map +1 -1
- package/out/runtime/interpreter.d.ts +1 -0
- package/out/runtime/interpreter.d.ts.map +1 -1
- package/out/runtime/interpreter.js +14 -3
- package/out/runtime/interpreter.js.map +1 -1
- package/out/runtime/resolvers/sqldb/impl.d.ts.map +1 -1
- package/out/runtime/resolvers/sqldb/impl.js +4 -2
- package/out/runtime/resolvers/sqldb/impl.js.map +1 -1
- package/package.json +1 -1
- package/src/api/http.ts +13 -5
- package/src/language/agentlang.langium +1 -1
- package/src/language/generated/ast.ts +2 -2
- package/src/language/generated/grammar.ts +1 -1
- package/src/runtime/integrations.ts +22 -17
- package/src/runtime/interpreter.ts +16 -3
- package/src/runtime/resolvers/sqldb/impl.ts +4 -2
|
@@ -19,26 +19,31 @@ export async function prepareIntegrations(
|
|
|
19
19
|
const configPath = integConfig.get(configName);
|
|
20
20
|
if (configPath) {
|
|
21
21
|
const apiUrl = mkApiUrl(integManagerHost, configPath);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
try {
|
|
23
|
+
const response = await fetch(apiUrl, {
|
|
24
|
+
method: 'GET',
|
|
25
|
+
headers: standardHeaders,
|
|
26
|
+
});
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
console.error(
|
|
30
|
+
`Failed to fetch integration for ${configPath}, HTTP error! status: ${response.status} ${response.text} ${response.statusText}`
|
|
31
|
+
);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const data = await response.json();
|
|
36
|
+
if (data.length > 0) {
|
|
37
|
+
const inst: any = data[0].config;
|
|
38
|
+
if (inst.type == 'custom' && isString(inst.parameter)) {
|
|
39
|
+
inst.parameter = new Map(Object.entries(JSON.parse(inst.parameter)));
|
|
40
|
+
}
|
|
41
|
+
Integrations.set(configName, inst);
|
|
42
|
+
} else {
|
|
43
|
+
console.error(`Integration not found for ${configPath}`);
|
|
38
44
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
throw new Error(`Integration not found for ${configPath}`);
|
|
45
|
+
} catch (error: any) {
|
|
46
|
+
console.error(`Error fetching integration for ${configPath}:`, error.message);
|
|
42
47
|
}
|
|
43
48
|
}
|
|
44
49
|
}
|
|
@@ -302,6 +302,16 @@ export class Environment extends Instance {
|
|
|
302
302
|
return this.returnFlag;
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
+
resetReturnFlag(): Environment {
|
|
306
|
+
if (this.returnFlag) {
|
|
307
|
+
this.returnFlag = false;
|
|
308
|
+
if (this.parent) {
|
|
309
|
+
this.parent.resetReturnFlag();
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return this;
|
|
313
|
+
}
|
|
314
|
+
|
|
305
315
|
protected propagateSuspension(suspId: string) {
|
|
306
316
|
this.suspensionId = suspId;
|
|
307
317
|
if (this.parent) {
|
|
@@ -767,10 +777,10 @@ function maybeBindStatementResultToAlias(hints: RuntimeHint[], env: Environment)
|
|
|
767
777
|
const resArr: Array<any> = result as Array<any>;
|
|
768
778
|
for (let i = 0; i < aliases.length; ++i) {
|
|
769
779
|
const k: string = aliases[i];
|
|
770
|
-
if (k == '
|
|
780
|
+
if (k == '__') {
|
|
771
781
|
env.bind(aliases[i + 1], resArr.splice(i));
|
|
772
782
|
break;
|
|
773
|
-
} else {
|
|
783
|
+
} else if (k != '_') {
|
|
774
784
|
env.bind(aliases[i], resArr[i]);
|
|
775
785
|
}
|
|
776
786
|
}
|
|
@@ -1212,7 +1222,10 @@ async function evaluateCrudMap(crud: CrudMap, env: Environment): Promise<void> {
|
|
|
1212
1222
|
if (isAgentEventInstance(inst)) await handleAgentInvocation(inst, env);
|
|
1213
1223
|
else if (isOpenApiEventInstance(inst)) await handleOpenApiEvent(inst, env);
|
|
1214
1224
|
else if (isDocEventInstance(inst)) await handleDocEvent(inst, env);
|
|
1215
|
-
else
|
|
1225
|
+
else {
|
|
1226
|
+
await evaluate(inst, (result: Result) => env.setLastResult(result), env);
|
|
1227
|
+
env.resetReturnFlag();
|
|
1228
|
+
}
|
|
1216
1229
|
} else {
|
|
1217
1230
|
env.setLastResult(inst);
|
|
1218
1231
|
}
|
|
@@ -217,15 +217,17 @@ export class SqlDbResolver extends Resolver {
|
|
|
217
217
|
inst.addQuery(col, '=', connectedInstance.lookup(PathAttributeName));
|
|
218
218
|
return await this.queryInstances(inst, false);
|
|
219
219
|
} else {
|
|
220
|
+
const from = relationship.getAliasFor(connectedInstance);
|
|
221
|
+
const to = relationship.getInverseAliasFor(connectedInstance);
|
|
220
222
|
await getAllConnected(
|
|
221
223
|
asTableReference(inst.moduleName, inst.name),
|
|
222
224
|
inst.queryAttributesAsObject(),
|
|
223
225
|
inst.queryAttributeValuesAsObject(),
|
|
224
226
|
{
|
|
225
227
|
connectionTable: asTableReference(inst.moduleName, relationship.name),
|
|
226
|
-
fromColumn:
|
|
228
|
+
fromColumn: from,
|
|
227
229
|
fromValue: `'${connectedInstance.lookup(PathAttributeName)}'`,
|
|
228
|
-
toColumn:
|
|
230
|
+
toColumn: to,
|
|
229
231
|
toRef: PathAttributeName,
|
|
230
232
|
},
|
|
231
233
|
this.getDbContext(inst.getFqName())
|