agentlang 0.0.20 → 0.0.22
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/runtime/agents/impl/anthropic.d.ts.map +1 -1
- package/out/runtime/agents/impl/anthropic.js +6 -2
- package/out/runtime/agents/impl/anthropic.js.map +1 -1
- package/out/runtime/agents/impl/openai.d.ts +1 -1
- package/out/runtime/agents/impl/openai.d.ts.map +1 -1
- package/out/runtime/agents/impl/openai.js +12 -3
- package/out/runtime/agents/impl/openai.js.map +1 -1
- package/out/runtime/agents/provider.d.ts +1 -1
- package/out/runtime/agents/provider.d.ts.map +1 -1
- package/out/runtime/agents/provider.js +5 -1
- package/out/runtime/agents/provider.js.map +1 -1
- package/out/runtime/auth/defs.d.ts +2 -0
- package/out/runtime/auth/defs.d.ts.map +1 -1
- package/out/runtime/auth/defs.js +8 -0
- package/out/runtime/auth/defs.js.map +1 -1
- package/out/runtime/defs.d.ts +0 -1
- package/out/runtime/defs.d.ts.map +1 -1
- package/out/runtime/defs.js +0 -1
- package/out/runtime/defs.js.map +1 -1
- package/out/runtime/interpreter.d.ts +3 -0
- package/out/runtime/interpreter.d.ts.map +1 -1
- package/out/runtime/interpreter.js +14 -5
- package/out/runtime/interpreter.js.map +1 -1
- package/out/runtime/loader.js +1 -1
- package/out/runtime/loader.js.map +1 -1
- package/out/runtime/module.d.ts +2 -0
- package/out/runtime/module.d.ts.map +1 -1
- package/out/runtime/module.js +39 -24
- package/out/runtime/module.js.map +1 -1
- package/out/runtime/modules/ai.d.ts +4 -0
- package/out/runtime/modules/ai.d.ts.map +1 -1
- package/out/runtime/modules/ai.js +60 -17
- package/out/runtime/modules/ai.js.map +1 -1
- package/out/runtime/resolvers/interface.d.ts +4 -0
- package/out/runtime/resolvers/interface.d.ts.map +1 -1
- package/out/runtime/resolvers/interface.js +23 -2
- package/out/runtime/resolvers/interface.js.map +1 -1
- package/out/runtime/resolvers/sqldb/impl.js +2 -2
- package/out/runtime/resolvers/sqldb/impl.js.map +1 -1
- package/package.json +1 -1
- package/src/runtime/agents/impl/anthropic.ts +7 -2
- package/src/runtime/agents/impl/openai.ts +13 -3
- package/src/runtime/agents/provider.ts +6 -2
- package/src/runtime/auth/defs.ts +11 -0
- package/src/runtime/defs.ts +0 -1
- package/src/runtime/interpreter.ts +12 -5
- package/src/runtime/loader.ts +1 -1
- package/src/runtime/module.ts +49 -29
- package/src/runtime/modules/ai.ts +66 -15
- package/src/runtime/resolvers/interface.ts +37 -2
- package/src/runtime/resolvers/sqldb/impl.ts +2 -2
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Environment,
|
|
3
|
+
evaluate,
|
|
4
|
+
runPostCreateEvents,
|
|
5
|
+
runPostDeleteEvents,
|
|
6
|
+
runPostUpdateEvents,
|
|
7
|
+
} from '../interpreter.js';
|
|
2
8
|
import { logger } from '../logger.js';
|
|
3
9
|
import {
|
|
4
10
|
Instance,
|
|
@@ -7,7 +13,7 @@ import {
|
|
|
7
13
|
newInstanceAttributes,
|
|
8
14
|
Relationship,
|
|
9
15
|
} from '../module.js';
|
|
10
|
-
import { splitFqName } from '../util.js';
|
|
16
|
+
import { CrudType, splitFqName } from '../util.js';
|
|
11
17
|
|
|
12
18
|
export class ResolverAuthInfo {
|
|
13
19
|
userId: string;
|
|
@@ -191,6 +197,35 @@ export class Resolver {
|
|
|
191
197
|
return undefined;
|
|
192
198
|
}
|
|
193
199
|
|
|
200
|
+
private async onOutOfBandCrud(
|
|
201
|
+
inst: Instance,
|
|
202
|
+
operation: CrudType,
|
|
203
|
+
env: Environment
|
|
204
|
+
): Promise<any> {
|
|
205
|
+
switch (operation) {
|
|
206
|
+
case CrudType.CREATE:
|
|
207
|
+
return await runPostCreateEvents(inst, env);
|
|
208
|
+
case CrudType.UPDATE:
|
|
209
|
+
return await runPostUpdateEvents(inst, env);
|
|
210
|
+
case CrudType.DELETE:
|
|
211
|
+
return await runPostDeleteEvents(inst, env);
|
|
212
|
+
default:
|
|
213
|
+
return inst;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
public async onCreate(inst: Instance, env: Environment): Promise<any> {
|
|
218
|
+
return this.onOutOfBandCrud(inst, CrudType.CREATE, env);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
public async onUpdate(inst: Instance, env: Environment): Promise<any> {
|
|
222
|
+
return this.onOutOfBandCrud(inst, CrudType.UPDATE, env);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
public async onDelete(inst: Instance, env: Environment): Promise<any> {
|
|
226
|
+
return this.onOutOfBandCrud(inst, CrudType.DELETE, env);
|
|
227
|
+
}
|
|
228
|
+
|
|
194
229
|
public async onSubscription(result: any): Promise<any> {
|
|
195
230
|
if (result != undefined) {
|
|
196
231
|
try {
|
|
@@ -94,8 +94,8 @@ export class SqlDbResolver extends Resolver {
|
|
|
94
94
|
const idAttrName: string | undefined = maybeFindIdAttributeName(inst);
|
|
95
95
|
ensureOneToOneAttributes(inst);
|
|
96
96
|
const attrs: InstanceAttributes = inst.attributes;
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
const idAttrVal: any = idAttrName ? attrs.get(idAttrName) : crypto.randomUUID();
|
|
98
|
+
if (idAttrVal != undefined) {
|
|
99
99
|
const pp: string | undefined = attrs.get(PathAttributeName);
|
|
100
100
|
const n: string = `${inst.moduleName}/${inst.name}`;
|
|
101
101
|
let p: string = '';
|