agentlang 0.6.1 → 0.6.3
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/README.md +37 -73
- package/out/api/http.d.ts.map +1 -1
- package/out/api/http.js +8 -4
- package/out/api/http.js.map +1 -1
- package/out/language/generated/grammar.d.ts.map +1 -1
- package/out/language/generated/grammar.js +10 -0
- package/out/language/generated/grammar.js.map +1 -1
- package/out/language/main.cjs +10 -0
- package/out/language/main.cjs.map +2 -2
- package/out/runtime/auth/cognito.d.ts.map +1 -1
- package/out/runtime/auth/cognito.js +2 -2
- package/out/runtime/auth/cognito.js.map +1 -1
- package/out/runtime/defs.d.ts +1 -0
- package/out/runtime/defs.d.ts.map +1 -1
- package/out/runtime/defs.js +3 -0
- package/out/runtime/defs.js.map +1 -1
- package/out/runtime/interpreter.d.ts.map +1 -1
- package/out/runtime/interpreter.js +2 -2
- package/out/runtime/interpreter.js.map +1 -1
- package/out/runtime/loader.d.ts.map +1 -1
- package/out/runtime/loader.js +6 -2
- package/out/runtime/loader.js.map +1 -1
- package/out/runtime/module.d.ts.map +1 -1
- package/out/runtime/module.js +10 -3
- package/out/runtime/module.js.map +1 -1
- package/out/runtime/modules/ai.d.ts.map +1 -1
- package/out/runtime/modules/ai.js +3 -2
- package/out/runtime/modules/ai.js.map +1 -1
- package/out/runtime/util.d.ts +4 -0
- package/out/runtime/util.d.ts.map +1 -1
- package/out/runtime/util.js +35 -0
- package/out/runtime/util.js.map +1 -1
- package/out/setupClassic.d.ts +98 -0
- package/out/setupClassic.d.ts.map +1 -0
- package/out/setupClassic.js +38 -0
- package/out/setupClassic.js.map +1 -0
- package/out/setupCommon.d.ts +2 -0
- package/out/setupCommon.d.ts.map +1 -0
- package/out/setupCommon.js +33 -0
- package/out/setupCommon.js.map +1 -0
- package/out/setupExtended.d.ts +40 -0
- package/out/setupExtended.d.ts.map +1 -0
- package/out/setupExtended.js +67 -0
- package/out/setupExtended.js.map +1 -0
- package/package.json +186 -185
- package/src/api/http.ts +13 -3
- package/src/language/agentlang.langium +2 -2
- package/src/language/generated/grammar.ts +10 -0
- package/src/runtime/auth/cognito.ts +2 -1
- package/src/runtime/defs.ts +4 -0
- package/src/runtime/interpreter.ts +5 -2
- package/src/runtime/loader.ts +5 -2
- package/src/runtime/module.ts +11 -2
- package/src/runtime/modules/ai.ts +3 -2
- package/src/runtime/util.ts +44 -0
package/package.json
CHANGED
|
@@ -1,186 +1,187 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
2
|
+
"name": "agentlang",
|
|
3
|
+
"description": "The easiest way to build the most reliable AI agents - enterprise-grade teams of AI agents that collaborate with each other and humans",
|
|
4
|
+
"version": "0.6.3",
|
|
5
|
+
"license": "Sustainable Use License",
|
|
6
|
+
"author": "agentlang-ai",
|
|
7
|
+
"homepage": "https://github.com/agentlang-ai/agentlang#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/agentlang-ai/agentlang.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/agentlang-ai/agentlang/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"agentlang",
|
|
17
|
+
"agents-generation",
|
|
18
|
+
"ai-agents",
|
|
19
|
+
"enterprise",
|
|
20
|
+
"multi-agent",
|
|
21
|
+
"no-code",
|
|
22
|
+
"agent-teams",
|
|
23
|
+
"production-ready"
|
|
24
|
+
],
|
|
25
|
+
"files": [
|
|
26
|
+
"bin",
|
|
27
|
+
"out",
|
|
28
|
+
"src",
|
|
29
|
+
"LICENSE"
|
|
30
|
+
],
|
|
31
|
+
"type": "module",
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public",
|
|
34
|
+
"registry": "https://registry.npmjs.org/"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc -b tsconfig.src.json && tsc -b tsconfig.declarations.json && node esbuild.mjs",
|
|
38
|
+
"build:ts": "tsc -b tsconfig.src.json",
|
|
39
|
+
"watch": "concurrently -n tsc,esbuild -c blue,yellow \"tsc -b tsconfig.src.json --watch\" \"node esbuild.mjs --watch\"",
|
|
40
|
+
"lint": "eslint . --ext .ts",
|
|
41
|
+
"lint:fix": "eslint . --ext .ts --fix",
|
|
42
|
+
"format": "prettier --write \"src/**/*.{js,ts,tsx,json,md}\"",
|
|
43
|
+
"format:check": "prettier --check \"src/**/*.{js,ts,tsx,json,md}\"",
|
|
44
|
+
"langium:generate": "langium generate",
|
|
45
|
+
"langium:generate:production": "langium generate --mode=production",
|
|
46
|
+
"langium:watch": "langium generate --watch",
|
|
47
|
+
"vscode:prepublish": "npm run build && npm run lint",
|
|
48
|
+
"dev": "vite",
|
|
49
|
+
"test": "vitest run",
|
|
50
|
+
"test:verbose": "VITEST_VERBOSE=true vitest run"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@aws-sdk/client-cognito-identity": "^3.828.0",
|
|
54
|
+
"@aws-sdk/client-cognito-identity-provider": "^3.828.0",
|
|
55
|
+
"@aws-sdk/credential-providers": "^3.828.0",
|
|
56
|
+
"@isomorphic-git/lightning-fs": "^4.6.1",
|
|
57
|
+
"@langchain/anthropic": "^0.3.32",
|
|
58
|
+
"@langchain/core": "^0.3.78",
|
|
59
|
+
"@langchain/openai": "^0.6.16",
|
|
60
|
+
"@types/jsonwebtoken": "^9.0.10",
|
|
61
|
+
"@types/multer": "^1.4.5-lts.1",
|
|
62
|
+
"amazon-cognito-identity-js": "^6.3.15",
|
|
63
|
+
"aws-jwt-verify": "^5.1.0",
|
|
64
|
+
"bcryptjs": "^3.0.2",
|
|
65
|
+
"buffer": "^6.0.3",
|
|
66
|
+
"chalk": "~5.3.0",
|
|
67
|
+
"commander": "~11.0.0",
|
|
68
|
+
"express": "^5.1.0",
|
|
69
|
+
"handlebars": "^4.7.8",
|
|
70
|
+
"jsonwebtoken": "^9.0.2",
|
|
71
|
+
"langchain": "^0.3.36",
|
|
72
|
+
"langium": "^3.5.0",
|
|
73
|
+
"multer": "^1.4.5-lts.1",
|
|
74
|
+
"openapi-client-axios": "^7.6.0",
|
|
75
|
+
"pg": "^8.16.1",
|
|
76
|
+
"pgvector": "^0.2.1",
|
|
77
|
+
"sql.js": "^1.13.0",
|
|
78
|
+
"sqlite3": "^5.1.7",
|
|
79
|
+
"typeorm": "^0.3.25",
|
|
80
|
+
"vscode-languageserver": "^9.0.1",
|
|
81
|
+
"winston": "^3.17.0",
|
|
82
|
+
"winston-daily-rotate-file": "^5.0.0",
|
|
83
|
+
"zod": "^3.25.55"
|
|
84
|
+
},
|
|
85
|
+
"overrides": {
|
|
86
|
+
"semver": "^7.5.3",
|
|
87
|
+
"trim-newlines": ">=3.0.1"
|
|
88
|
+
},
|
|
89
|
+
"devDependencies": {
|
|
90
|
+
"@codingame/esbuild-import-meta-url-plugin": "~1.0.2",
|
|
91
|
+
"@eslint/js": "^9.26.0",
|
|
92
|
+
"@types/cookie-parser": "^1.4.9",
|
|
93
|
+
"@types/express": "^5.0.1",
|
|
94
|
+
"@types/node": "^18.19.110",
|
|
95
|
+
"@types/sql.js": "^1.4.9",
|
|
96
|
+
"@types/vscode": "^1.100.0",
|
|
97
|
+
"@typescript-eslint/eslint-plugin": "~8.32.1",
|
|
98
|
+
"@typescript-eslint/parser": "~8.32.1",
|
|
99
|
+
"brace-expansion": ">=2.0.2",
|
|
100
|
+
"concurrently": "~8.2.1",
|
|
101
|
+
"esbuild": "^0.25.4",
|
|
102
|
+
"eslint": "^9.39.1",
|
|
103
|
+
"generator-langium": "^3.0.0",
|
|
104
|
+
"http-server": "~14.1.1",
|
|
105
|
+
"langium-cli": "^3.5.0",
|
|
106
|
+
"nodemon": "^3.1.10",
|
|
107
|
+
"prettier": "^3.5.3",
|
|
108
|
+
"typescript": "^5.8.3",
|
|
109
|
+
"typescript-eslint": "^8.32.1",
|
|
110
|
+
"vite": "^6.3.5",
|
|
111
|
+
"vite-plugin-node-polyfills": "^0.24.0",
|
|
112
|
+
"vitest": "^3.1.3",
|
|
113
|
+
"vscode-languageclient": "^9.0.1",
|
|
114
|
+
"vscode-uri": "^3.1.0"
|
|
115
|
+
},
|
|
116
|
+
"volta": {
|
|
117
|
+
"node": ">=20.0.0",
|
|
118
|
+
"npm": ">=10.8.2"
|
|
119
|
+
},
|
|
120
|
+
"displayName": "agentlang",
|
|
121
|
+
"engines": {
|
|
122
|
+
"vscode": "^1.67.0",
|
|
123
|
+
"node": ">=20.0.0"
|
|
124
|
+
},
|
|
125
|
+
"categories": [
|
|
126
|
+
"Programming Languages"
|
|
127
|
+
],
|
|
128
|
+
"contributes": {
|
|
129
|
+
"languages": [
|
|
130
|
+
{
|
|
131
|
+
"id": "agentlang",
|
|
132
|
+
"aliases": [
|
|
133
|
+
"Agentlang",
|
|
134
|
+
"agentlang"
|
|
135
|
+
],
|
|
136
|
+
"extensions": [
|
|
137
|
+
".al"
|
|
138
|
+
],
|
|
139
|
+
"configuration": "./language-configuration.json"
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
"grammars": [
|
|
143
|
+
{
|
|
144
|
+
"language": "agentlang",
|
|
145
|
+
"scopeName": "source.agentlang",
|
|
146
|
+
"path": "syntaxes/agentlang.tmLanguage.json"
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
"activationEvents": [
|
|
151
|
+
"onLanguage:agentlang"
|
|
152
|
+
],
|
|
153
|
+
"main": "./out/extension/main.cjs",
|
|
154
|
+
"types": "./out/index.d.ts",
|
|
155
|
+
"exports": {
|
|
156
|
+
".": {
|
|
157
|
+
"types": "./out/index.d.ts",
|
|
158
|
+
"import": "./out/extension/main.cjs",
|
|
159
|
+
"require": "./out/extension/main.cjs"
|
|
160
|
+
},
|
|
161
|
+
"./browser": {
|
|
162
|
+
"types": "./out/browser.d.ts",
|
|
163
|
+
"import": "./out/browser.js",
|
|
164
|
+
"default": "./out/browser.js"
|
|
165
|
+
},
|
|
166
|
+
"./src/*": {
|
|
167
|
+
"types": "./out/*.d.ts",
|
|
168
|
+
"import": "./out/*.js",
|
|
169
|
+
"require": "./out/*.js",
|
|
170
|
+
"default": "./out/*.js"
|
|
171
|
+
},
|
|
172
|
+
"./out/*": "./out/*"
|
|
173
|
+
},
|
|
174
|
+
"bin": {
|
|
175
|
+
"agentlang-cli": "./bin/cli.js"
|
|
176
|
+
},
|
|
177
|
+
"lint-staged": {
|
|
178
|
+
"*.{js,ts,tsx}": [
|
|
179
|
+
"eslint --fix --cache",
|
|
180
|
+
"prettier --write"
|
|
181
|
+
],
|
|
182
|
+
"*.{json,md,yml,yaml}": [
|
|
183
|
+
"prettier --write"
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
"packageManager": "pnpm@10.22.0"
|
|
187
|
+
}
|
package/src/api/http.ts
CHANGED
|
@@ -36,8 +36,14 @@ import {
|
|
|
36
36
|
DefaultFileHandlingDirectory,
|
|
37
37
|
splitRefs,
|
|
38
38
|
splitFqName,
|
|
39
|
+
escapeSepInPath,
|
|
39
40
|
} from '../runtime/util.js';
|
|
40
|
-
import {
|
|
41
|
+
import {
|
|
42
|
+
BadRequestError,
|
|
43
|
+
isPathAttribute,
|
|
44
|
+
PathAttributeNameQuery,
|
|
45
|
+
UnauthorisedError,
|
|
46
|
+
} from '../runtime/defs.js';
|
|
41
47
|
import { evaluate } from '../runtime/interpreter.js';
|
|
42
48
|
import { Config } from '../runtime/state.js';
|
|
43
49
|
import {
|
|
@@ -225,6 +231,9 @@ function patternFromAttributes(
|
|
|
225
231
|
if (av instanceof Object) {
|
|
226
232
|
av = JSON.stringify(av);
|
|
227
233
|
}
|
|
234
|
+
if (isPathAttribute(n)) {
|
|
235
|
+
av = escapeSepInPath(av);
|
|
236
|
+
}
|
|
228
237
|
attrsStrs.push(`${n} ${av}`);
|
|
229
238
|
});
|
|
230
239
|
return `{${moduleName}/${recName} { ${attrsStrs.join(',\n')} }}`;
|
|
@@ -416,10 +425,11 @@ function queryPatternFromPath(path: string, req: Request): string {
|
|
|
416
425
|
const ns = nameToPath(n);
|
|
417
426
|
const pe = ns.getEntryName();
|
|
418
427
|
const pm = ns.hasModule() ? ns.getModuleName() : moduleName;
|
|
419
|
-
const p = parts.slice(0, parts.length - 2).join('/');
|
|
428
|
+
const p = escapeSepInPath(parts.slice(0, parts.length - 2).join('/'));
|
|
420
429
|
return `{${pm}/${pe} {${PathAttributeNameQuery} "${p}"}, ${relName} {${moduleName}/${entityName}? {}}}`;
|
|
421
430
|
}
|
|
422
431
|
entityName = restoreFqName(entityName);
|
|
432
|
+
path = escapeSepInPath(path);
|
|
423
433
|
if (id === undefined) {
|
|
424
434
|
return `{${moduleName}/${entityName} {${PathAttributeNameQuery}like "${path}%"}}`;
|
|
425
435
|
} else {
|
|
@@ -496,7 +506,7 @@ function createChildPattern(moduleName: string, entityName: string, req: Request
|
|
|
496
506
|
const pinfo = parts.slice(-4);
|
|
497
507
|
const parentFqname = forceAsFqName(pinfo[0], moduleName);
|
|
498
508
|
const relName = forceAsFqName(pinfo[2], moduleName);
|
|
499
|
-
const parentPath = parts.slice(0, parts.length - 2).join('/');
|
|
509
|
+
const parentPath = escapeSepInPath(parts.slice(0, parts.length - 2).join('/'));
|
|
500
510
|
const childFqName = forceAsFqName(pinfo[3], moduleName);
|
|
501
511
|
const cparts = nameToPath(childFqName);
|
|
502
512
|
const childModuleName = cparts.getModuleName();
|
|
@@ -129,7 +129,7 @@ CrudMapBody: '{' (attributes+=SetAttribute (',' attributes+=SetAttribute)*)+ pro
|
|
|
129
129
|
|
|
130
130
|
SelectIntoSpec: '@into' '{' entries+=SelectIntoEntry (',' entries+=SelectIntoEntry)* '}';
|
|
131
131
|
|
|
132
|
-
SelectIntoEntry: alias=ID attribute=Ref;
|
|
132
|
+
SelectIntoEntry: alias=ID (':')? attribute=Ref;
|
|
133
133
|
|
|
134
134
|
JoinSpec: type=JoinType name=QualifiedName '{' lhs=QueryId op=SqlComparisonOpr? rhs=Ref '}';
|
|
135
135
|
|
|
@@ -186,7 +186,7 @@ ResolverFnName: name=(ID | Ref | STRING);
|
|
|
186
186
|
|
|
187
187
|
ResolverMethodName: name=('create' | 'update' | 'upsert' | 'delete' | 'query' | 'subscribe' | 'onSubscription' | 'startTransaction' | 'commitTransaction' | 'rollbackTransaction');
|
|
188
188
|
|
|
189
|
-
RelationshipPattern: name=QualifiedName pattern=Pattern;
|
|
189
|
+
RelationshipPattern: name=QualifiedName (':')? pattern=Pattern;
|
|
190
190
|
|
|
191
191
|
CatchSpec: '@catch' '{' (handlers+=Handler)+ '}';
|
|
192
192
|
|
|
@@ -3822,6 +3822,11 @@ export const AgentlangGrammar = (): Grammar => loadedAgentlangGrammar ?? (loaded
|
|
|
3822
3822
|
"arguments": []
|
|
3823
3823
|
}
|
|
3824
3824
|
},
|
|
3825
|
+
{
|
|
3826
|
+
"$type": "Keyword",
|
|
3827
|
+
"value": ":",
|
|
3828
|
+
"cardinality": "?"
|
|
3829
|
+
},
|
|
3825
3830
|
{
|
|
3826
3831
|
"$type": "Assignment",
|
|
3827
3832
|
"feature": "attribute",
|
|
@@ -5455,6 +5460,11 @@ export const AgentlangGrammar = (): Grammar => loadedAgentlangGrammar ?? (loaded
|
|
|
5455
5460
|
"arguments": []
|
|
5456
5461
|
}
|
|
5457
5462
|
},
|
|
5463
|
+
{
|
|
5464
|
+
"$type": "Keyword",
|
|
5465
|
+
"value": ":",
|
|
5466
|
+
"cardinality": "?"
|
|
5467
|
+
},
|
|
5458
5468
|
{
|
|
5459
5469
|
"$type": "Assignment",
|
|
5460
5470
|
"feature": "pattern",
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
findUserByEmail,
|
|
17
17
|
} from '../modules/auth.js';
|
|
18
18
|
import { logger } from '../logger.js';
|
|
19
|
-
import { sleepMilliseconds } from '../util.js';
|
|
19
|
+
import { sleepMilliseconds, generateUrlSafePassword } from '../util.js';
|
|
20
20
|
import { Instance } from '../module.js';
|
|
21
21
|
import { CognitoJwtVerifier } from 'aws-jwt-verify';
|
|
22
22
|
import { Environment } from '../interpreter.js';
|
|
@@ -1084,6 +1084,7 @@ export class CognitoAuth implements AgentlangAuth {
|
|
|
1084
1084
|
Username: email,
|
|
1085
1085
|
UserAttributes: userAttrs,
|
|
1086
1086
|
DesiredDeliveryMediums: ['EMAIL'],
|
|
1087
|
+
TemporaryPassword: generateUrlSafePassword(),
|
|
1087
1088
|
...(userExists ? { MessageAction: 'RESEND' } : {}),
|
|
1088
1089
|
});
|
|
1089
1090
|
|
package/src/runtime/defs.ts
CHANGED
|
@@ -5,6 +5,10 @@ export const PathAttributeNameQuery: string = '__path__?';
|
|
|
5
5
|
export const ParentAttributeName: string = '__parent__';
|
|
6
6
|
export const DeletedFlagAttributeName: string = '__is_deleted__';
|
|
7
7
|
|
|
8
|
+
export function isPathAttribute(n: string): boolean {
|
|
9
|
+
return n.startsWith(PathAttributeName);
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
export type UnautInfo = {
|
|
9
13
|
opr: string;
|
|
10
14
|
entity: string;
|
|
@@ -1878,7 +1878,7 @@ async function agentInvoke(agent: AgentInstance, msg: string, env: Environment):
|
|
|
1878
1878
|
} catch (err: any) {
|
|
1879
1879
|
if (retries < MAX_PLANNER_RETRIES) {
|
|
1880
1880
|
await agent.invoke(
|
|
1881
|
-
`For my previouns request <${msg}>, you generated this pattern: ${result}. It had these errors: ${err}. Please fix these errors.`,
|
|
1881
|
+
`For my previouns request <${msg}>, you generated this pattern: ${result}. It had these errors: ${err}. Please fix these errors.\nReturn only the fixed code and no other additional text or messages.`,
|
|
1882
1882
|
env
|
|
1883
1883
|
);
|
|
1884
1884
|
const r: string | undefined = env.getLastResult();
|
|
@@ -1906,7 +1906,10 @@ async function agentInvoke(agent: AgentInstance, msg: string, env: Environment):
|
|
|
1906
1906
|
break;
|
|
1907
1907
|
} catch (err: any) {
|
|
1908
1908
|
if (retries < MAX_PLANNER_RETRIES) {
|
|
1909
|
-
await agent.invoke(
|
|
1909
|
+
await agent.invoke(
|
|
1910
|
+
`Please fix these errors:\n ${err}\nReturn only the fixed response and no other additional text or messages.`,
|
|
1911
|
+
env
|
|
1912
|
+
);
|
|
1910
1913
|
const r: string | undefined = env.getLastResult();
|
|
1911
1914
|
result = r;
|
|
1912
1915
|
++retries;
|
package/src/runtime/loader.ts
CHANGED
|
@@ -593,7 +593,10 @@ function processAgentScenarios(agentName: string, value: Literal): AgentScenario
|
|
|
593
593
|
let user: string | undefined;
|
|
594
594
|
let ai: string | undefined;
|
|
595
595
|
expr.map.entries.forEach((me: MapEntry) => {
|
|
596
|
-
|
|
596
|
+
let v = isLiteral(me.value) ? me.value.str : undefined;
|
|
597
|
+
if (v === undefined) {
|
|
598
|
+
v = me.value.$cstNode?.text;
|
|
599
|
+
}
|
|
597
600
|
if (v) {
|
|
598
601
|
if (me.key.str == 'user') {
|
|
599
602
|
user = v;
|
|
@@ -606,7 +609,7 @@ function processAgentScenarios(agentName: string, value: Literal): AgentScenario
|
|
|
606
609
|
const internal = true;
|
|
607
610
|
scenarios.push({ user, ai, internal, ifPattern: undefined });
|
|
608
611
|
} else {
|
|
609
|
-
throw new Error(`Invalid
|
|
612
|
+
throw new Error(`Invalid scenario spec in agent ${agentName}`);
|
|
610
613
|
}
|
|
611
614
|
}
|
|
612
615
|
});
|
package/src/runtime/module.ts
CHANGED
|
@@ -45,6 +45,8 @@ import {
|
|
|
45
45
|
splitFqName,
|
|
46
46
|
splitRefs,
|
|
47
47
|
forceAsFqName,
|
|
48
|
+
validateIdFormat,
|
|
49
|
+
nameContainsSepEscape,
|
|
48
50
|
} from './util.js';
|
|
49
51
|
import { parseStatement } from '../language/parser.js';
|
|
50
52
|
import { ActiveSessionInfo, AdminSession } from './auth/defs.js';
|
|
@@ -78,6 +80,9 @@ export class ModuleEntry {
|
|
|
78
80
|
private taggedAsPublic: boolean = false;
|
|
79
81
|
|
|
80
82
|
constructor(name: string, moduleName: string) {
|
|
83
|
+
if (nameContainsSepEscape(name)) {
|
|
84
|
+
throw new Error(`Name cannot contain reserved escape characters - ${name}`);
|
|
85
|
+
}
|
|
81
86
|
this.name = name;
|
|
82
87
|
this.moduleName = moduleName;
|
|
83
88
|
}
|
|
@@ -569,7 +574,7 @@ export class Record extends ModuleEntry {
|
|
|
569
574
|
targetModuleName,
|
|
570
575
|
targetEntityName,
|
|
571
576
|
targetColumnName,
|
|
572
|
-
onDelete: '
|
|
577
|
+
onDelete: 'SET NULL',
|
|
573
578
|
onUpdate: 'CASCADE',
|
|
574
579
|
});
|
|
575
580
|
}
|
|
@@ -1090,7 +1095,7 @@ ${attrs.join(',\n')}
|
|
|
1090
1095
|
}
|
|
1091
1096
|
}
|
|
1092
1097
|
|
|
1093
|
-
static Suffix = '
|
|
1098
|
+
static Suffix = '_agent';
|
|
1094
1099
|
|
|
1095
1100
|
static EscapeName(n: string): string {
|
|
1096
1101
|
if (n.endsWith(Agent.Suffix)) {
|
|
@@ -3680,6 +3685,7 @@ export function makeInstance(
|
|
|
3680
3685
|
const record: Record = module.getRecord(entryName);
|
|
3681
3686
|
|
|
3682
3687
|
const schema: RecordSchema = record.schema;
|
|
3688
|
+
const idAttr = record.getIdAttributeName();
|
|
3683
3689
|
if (schema.size > 0) {
|
|
3684
3690
|
attributes.forEach((value: any, key: string) => {
|
|
3685
3691
|
if (!schema.has(key)) {
|
|
@@ -3687,6 +3693,9 @@ export function makeInstance(
|
|
|
3687
3693
|
}
|
|
3688
3694
|
const spec: AttributeSpec = getAttributeSpec(schema, key);
|
|
3689
3695
|
if (value !== null && value !== undefined) validateType(key, value, spec);
|
|
3696
|
+
if (key === idAttr) {
|
|
3697
|
+
validateIdFormat(key, value);
|
|
3698
|
+
}
|
|
3690
3699
|
});
|
|
3691
3700
|
}
|
|
3692
3701
|
if (!queryAttributes && !queryAll) {
|
|
@@ -512,13 +512,14 @@ Only return a pure JSON object with no extra text, annotations etc.`;
|
|
|
512
512
|
validationEventName: string
|
|
513
513
|
): Promise<Instance> {
|
|
514
514
|
let isstr = true;
|
|
515
|
+
const content = trimGeneratedCode(response.content);
|
|
515
516
|
try {
|
|
516
|
-
const c = JSON.parse(
|
|
517
|
+
const c = JSON.parse(content);
|
|
517
518
|
isstr = isString(c);
|
|
518
519
|
} catch (reason: any) {
|
|
519
520
|
logger.debug(`invokeValidator json/parse - ${reason}`);
|
|
520
521
|
}
|
|
521
|
-
const d = isstr ? `"${escapeSpecialChars(
|
|
522
|
+
const d = isstr ? `"${escapeSpecialChars(content)}"` : content;
|
|
522
523
|
const r: Instance | Instance[] = await parseAndEvaluateStatement(
|
|
523
524
|
`{${validationEventName} {data ${d}}}`
|
|
524
525
|
);
|