agentlang 0.3.1 → 0.3.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/README.md +78 -60
- package/out/runtime/agents/common.d.ts +4 -1
- package/out/runtime/agents/common.d.ts.map +1 -1
- package/out/runtime/agents/common.js +10 -1
- package/out/runtime/agents/common.js.map +1 -1
- package/out/runtime/loader.d.ts.map +1 -1
- package/out/runtime/loader.js +17 -11
- package/out/runtime/loader.js.map +1 -1
- package/out/runtime/module.d.ts +19 -11
- package/out/runtime/module.d.ts.map +1 -1
- package/out/runtime/module.js +96 -49
- package/out/runtime/module.js.map +1 -1
- package/out/runtime/modules/ai.js +1 -1
- package/out/runtime/modules/ai.js.map +1 -1
- package/package.json +182 -183
- package/src/runtime/agents/common.ts +27 -2
- package/src/runtime/loader.ts +17 -12
- package/src/runtime/module.ts +107 -52
- package/src/runtime/modules/ai.ts +1 -1
- package/out/runtime/modules/files.d.ts +0 -18
- package/out/runtime/modules/files.d.ts.map +0 -1
- package/out/runtime/modules/files.js +0 -116
- package/out/runtime/modules/files.js.map +0 -1
- package/out/setupClassic.d.ts +0 -98
- package/out/setupClassic.d.ts.map +0 -1
- package/out/setupClassic.js +0 -38
- package/out/setupClassic.js.map +0 -1
- package/out/setupCommon.d.ts +0 -2
- package/out/setupCommon.d.ts.map +0 -1
- package/out/setupCommon.js +0 -33
- package/out/setupCommon.js.map +0 -1
- package/out/setupExtended.d.ts +0 -40
- package/out/setupExtended.d.ts.map +0 -1
- package/out/setupExtended.js +0 -67
- package/out/setupExtended.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,184 +1,183 @@
|
|
|
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
|
-
}
|
|
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.3.2",
|
|
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
|
+
"dependencies": {
|
|
37
|
+
"@aws-sdk/client-cognito-identity": "^3.828.0",
|
|
38
|
+
"@aws-sdk/client-cognito-identity-provider": "^3.828.0",
|
|
39
|
+
"@aws-sdk/credential-providers": "^3.828.0",
|
|
40
|
+
"@isomorphic-git/lightning-fs": "^4.6.1",
|
|
41
|
+
"@langchain/anthropic": "^0.3.25",
|
|
42
|
+
"@langchain/core": "^0.3.59",
|
|
43
|
+
"@langchain/openai": "^0.5.18",
|
|
44
|
+
"amazon-cognito-identity-js": "^6.3.15",
|
|
45
|
+
"aws-jwt-verify": "^5.1.0",
|
|
46
|
+
"bcryptjs": "^3.0.2",
|
|
47
|
+
"buffer": "^6.0.3",
|
|
48
|
+
"chalk": "~5.3.0",
|
|
49
|
+
"commander": "~11.0.0",
|
|
50
|
+
"express": "^5.1.0",
|
|
51
|
+
"handlebars": "^4.7.8",
|
|
52
|
+
"langchain": "^0.3.28",
|
|
53
|
+
"langium": "^3.5.0",
|
|
54
|
+
"openapi-client-axios": "^7.6.0",
|
|
55
|
+
"pg": "^8.16.1",
|
|
56
|
+
"pgvector": "^0.2.1",
|
|
57
|
+
"sqlite3": "^5.1.7",
|
|
58
|
+
"sql.js": "^1.13.0",
|
|
59
|
+
"typeorm": "^0.3.25",
|
|
60
|
+
"vscode-languageserver": "^9.0.1",
|
|
61
|
+
"winston": "^3.17.0",
|
|
62
|
+
"winston-daily-rotate-file": "^5.0.0",
|
|
63
|
+
"zod": "^3.25.55"
|
|
64
|
+
},
|
|
65
|
+
"optionalDependencies": {},
|
|
66
|
+
"overrides": {
|
|
67
|
+
"semver": "^7.5.3",
|
|
68
|
+
"trim-newlines": ">=3.0.1"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@codingame/esbuild-import-meta-url-plugin": "~1.0.2",
|
|
72
|
+
"@eslint/js": "^9.26.0",
|
|
73
|
+
"@types/cookie-parser": "^1.4.9",
|
|
74
|
+
"@types/express": "^5.0.1",
|
|
75
|
+
"@types/node": "^18.19.110",
|
|
76
|
+
"@types/sql.js": "^1.4.9",
|
|
77
|
+
"@types/vscode": "^1.100.0",
|
|
78
|
+
"@typescript-eslint/eslint-plugin": "~8.32.1",
|
|
79
|
+
"@typescript-eslint/parser": "~8.32.1",
|
|
80
|
+
"brace-expansion": ">=2.0.2",
|
|
81
|
+
"concurrently": "~8.2.1",
|
|
82
|
+
"esbuild": "^0.25.4",
|
|
83
|
+
"eslint": "~9.26.0",
|
|
84
|
+
"generator-langium": "^3.0.0",
|
|
85
|
+
"http-server": "~14.1.1",
|
|
86
|
+
"langium-cli": "^3.5.0",
|
|
87
|
+
"nodemon": "^3.1.10",
|
|
88
|
+
"prettier": "^3.5.3",
|
|
89
|
+
"typescript": "^5.8.3",
|
|
90
|
+
"typescript-eslint": "^8.32.1",
|
|
91
|
+
"vite": "^6.3.5",
|
|
92
|
+
"vite-plugin-node-polyfills": "^0.24.0",
|
|
93
|
+
"vitest": "^3.1.3",
|
|
94
|
+
"vscode-languageclient": "^9.0.1",
|
|
95
|
+
"vscode-uri": "^3.1.0"
|
|
96
|
+
},
|
|
97
|
+
"volta": {
|
|
98
|
+
"node": ">=20.0.0",
|
|
99
|
+
"npm": ">=10.8.2"
|
|
100
|
+
},
|
|
101
|
+
"displayName": "agentlang",
|
|
102
|
+
"engines": {
|
|
103
|
+
"vscode": "^1.67.0",
|
|
104
|
+
"node": ">=20.0.0"
|
|
105
|
+
},
|
|
106
|
+
"categories": [
|
|
107
|
+
"Programming Languages"
|
|
108
|
+
],
|
|
109
|
+
"contributes": {
|
|
110
|
+
"languages": [
|
|
111
|
+
{
|
|
112
|
+
"id": "agentlang",
|
|
113
|
+
"aliases": [
|
|
114
|
+
"Agentlang",
|
|
115
|
+
"agentlang"
|
|
116
|
+
],
|
|
117
|
+
"extensions": [
|
|
118
|
+
".al"
|
|
119
|
+
],
|
|
120
|
+
"configuration": "./language-configuration.json"
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"grammars": [
|
|
124
|
+
{
|
|
125
|
+
"language": "agentlang",
|
|
126
|
+
"scopeName": "source.agentlang",
|
|
127
|
+
"path": "syntaxes/agentlang.tmLanguage.json"
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
"activationEvents": [
|
|
132
|
+
"onLanguage:agentlang"
|
|
133
|
+
],
|
|
134
|
+
"main": "./out/extension/main.cjs",
|
|
135
|
+
"types": "./out/index.d.ts",
|
|
136
|
+
"exports": {
|
|
137
|
+
".": {
|
|
138
|
+
"types": "./out/index.d.ts",
|
|
139
|
+
"import": "./out/extension/main.cjs",
|
|
140
|
+
"require": "./out/extension/main.cjs"
|
|
141
|
+
},
|
|
142
|
+
"./browser": {
|
|
143
|
+
"types": "./out/browser.d.ts",
|
|
144
|
+
"import": "./out/browser.js",
|
|
145
|
+
"default": "./out/browser.js"
|
|
146
|
+
},
|
|
147
|
+
"./src/*": {
|
|
148
|
+
"types": "./out/*.d.ts",
|
|
149
|
+
"import": "./out/*.js",
|
|
150
|
+
"require": "./out/*.js",
|
|
151
|
+
"default": "./out/*.js"
|
|
152
|
+
},
|
|
153
|
+
"./out/*": "./out/*"
|
|
154
|
+
},
|
|
155
|
+
"bin": {
|
|
156
|
+
"agentlang-cli": "./bin/cli.js"
|
|
157
|
+
},
|
|
158
|
+
"lint-staged": {
|
|
159
|
+
"*.{js,ts,tsx}": [
|
|
160
|
+
"eslint --fix --cache",
|
|
161
|
+
"prettier --write"
|
|
162
|
+
],
|
|
163
|
+
"*.{json,md,yml,yaml}": [
|
|
164
|
+
"prettier --write"
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
"scripts": {
|
|
168
|
+
"build": "tsc -b tsconfig.src.json && tsc -b tsconfig.declarations.json && node esbuild.mjs",
|
|
169
|
+
"build:ts": "tsc -b tsconfig.src.json",
|
|
170
|
+
"watch": "concurrently -n tsc,esbuild -c blue,yellow \"tsc -b tsconfig.src.json --watch\" \"node esbuild.mjs --watch\"",
|
|
171
|
+
"lint": "eslint . --ext .ts",
|
|
172
|
+
"lint:fix": "eslint . --ext .ts --fix",
|
|
173
|
+
"format": "prettier --write \"src/**/*.{js,ts,tsx,json,md}\"",
|
|
174
|
+
"format:check": "prettier --check \"src/**/*.{js,ts,tsx,json,md}\"",
|
|
175
|
+
"langium:generate": "langium generate",
|
|
176
|
+
"langium:generate:production": "langium generate --mode=production",
|
|
177
|
+
"langium:watch": "langium generate --watch",
|
|
178
|
+
"vscode:prepublish": "npm run build && npm run lint",
|
|
179
|
+
"dev": "vite",
|
|
180
|
+
"test": "vitest run",
|
|
181
|
+
"test:verbose": "VITEST_VERBOSE=true vitest run"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -354,13 +354,21 @@ Now apply the same analysis to the following context and cases provided by the u
|
|
|
354
354
|
`;
|
|
355
355
|
|
|
356
356
|
export type AgentCondition = {
|
|
357
|
-
|
|
357
|
+
if: string;
|
|
358
358
|
then: string;
|
|
359
359
|
internal: boolean;
|
|
360
360
|
};
|
|
361
361
|
|
|
362
362
|
const AgentDirectives = new Map<string, AgentCondition[]>();
|
|
363
363
|
|
|
364
|
+
export function newAgentDirective(
|
|
365
|
+
cond: string,
|
|
366
|
+
then: string,
|
|
367
|
+
internal: boolean = false
|
|
368
|
+
): AgentCondition {
|
|
369
|
+
return { if: cond, then, internal };
|
|
370
|
+
}
|
|
371
|
+
|
|
364
372
|
export function registerAgentDirectives(agentFqName: string, conds: AgentCondition[]) {
|
|
365
373
|
AgentDirectives.set(agentFqName, conds);
|
|
366
374
|
}
|
|
@@ -379,7 +387,7 @@ export function getAgentDirectivesJson(agentFqName: string): string | undefined
|
|
|
379
387
|
const conds = getAgentDirectivesInternal(agentFqName);
|
|
380
388
|
if (conds) {
|
|
381
389
|
const fmted = conds.map((c: AgentCondition) => {
|
|
382
|
-
return { if: c.
|
|
390
|
+
return { if: c.if, then: c.then };
|
|
383
391
|
});
|
|
384
392
|
return JSON.stringify(fmted);
|
|
385
393
|
}
|
|
@@ -402,6 +410,14 @@ export type AgentScenario = {
|
|
|
402
410
|
internal: boolean;
|
|
403
411
|
};
|
|
404
412
|
|
|
413
|
+
export function newAgentScenario(
|
|
414
|
+
user: string,
|
|
415
|
+
ai: string,
|
|
416
|
+
internal: boolean = false
|
|
417
|
+
): AgentScenario {
|
|
418
|
+
return { user, ai, internal };
|
|
419
|
+
}
|
|
420
|
+
|
|
405
421
|
const AgentScenarios = new Map<string, AgentScenario[]>();
|
|
406
422
|
|
|
407
423
|
export function registerAgentScenarios(agentFqName: string, scenarios: AgentScenario[]) {
|
|
@@ -449,6 +465,15 @@ export type AgentGlossaryEntry = {
|
|
|
449
465
|
internal: boolean;
|
|
450
466
|
};
|
|
451
467
|
|
|
468
|
+
export function newAgentGlossaryEntry(
|
|
469
|
+
name: string,
|
|
470
|
+
meaning: string,
|
|
471
|
+
synonyms: string | undefined,
|
|
472
|
+
internal: boolean = false
|
|
473
|
+
): AgentGlossaryEntry {
|
|
474
|
+
return { name, meaning, synonyms, internal };
|
|
475
|
+
}
|
|
476
|
+
|
|
452
477
|
const AgentGlossary = new Map<string, AgentGlossaryEntry[]>();
|
|
453
478
|
|
|
454
479
|
export function registerAgentGlossary(agentFqName: string, glossary: AgentGlossaryEntry[]) {
|
package/src/runtime/loader.ts
CHANGED
|
@@ -529,7 +529,7 @@ function processAgentDirectives(agentName: string, value: Literal): AgentConditi
|
|
|
529
529
|
});
|
|
530
530
|
if (cond && then) {
|
|
531
531
|
const internal = true;
|
|
532
|
-
conds?.push({ cond, then, internal });
|
|
532
|
+
conds?.push({ if: cond, then, internal });
|
|
533
533
|
} else {
|
|
534
534
|
throw new Error(`Invalid condition spec in agent ${agentName}`);
|
|
535
535
|
}
|
|
@@ -821,9 +821,11 @@ function addScenarioDefintion(def: ScenarioDefinition, moduleName: string) {
|
|
|
821
821
|
const m = asStringLiteralsMap(def.body);
|
|
822
822
|
const user = m.get('user');
|
|
823
823
|
const ai = m.get('ai');
|
|
824
|
-
if (user && ai)
|
|
825
|
-
|
|
826
|
-
|
|
824
|
+
if (user && ai) {
|
|
825
|
+
const scn = { user: user, ai: ai, internal: false };
|
|
826
|
+
addAgentScenario(n, scn);
|
|
827
|
+
fetchModule(moduleName).addScenario(def.name, scn);
|
|
828
|
+
} else throw new Error(`scenario ${def.name} requires both user and ai entries`);
|
|
827
829
|
}
|
|
828
830
|
}
|
|
829
831
|
|
|
@@ -836,9 +838,11 @@ function addDirectiveDefintion(def: DirectiveDefinition, moduleName: string) {
|
|
|
836
838
|
const m = asStringLiteralsMap(def.body);
|
|
837
839
|
const cond = m.get('if');
|
|
838
840
|
const then = m.get('then');
|
|
839
|
-
if (cond && then)
|
|
840
|
-
|
|
841
|
-
|
|
841
|
+
if (cond && then) {
|
|
842
|
+
const dir = { if: cond, then: then, internal: false };
|
|
843
|
+
addAgentDirective(n, dir);
|
|
844
|
+
fetchModule(moduleName).addDirective(def.name, dir);
|
|
845
|
+
} else throw new Error(`directive ${def.name} requires both if and then entries`);
|
|
842
846
|
}
|
|
843
847
|
}
|
|
844
848
|
|
|
@@ -852,15 +856,16 @@ function addGlossaryEntryDefintion(def: GlossaryEntryDefinition, moduleName: str
|
|
|
852
856
|
const name = m.get('name');
|
|
853
857
|
const meaning = m.get('meaning');
|
|
854
858
|
const syn = m.get('synonyms');
|
|
855
|
-
if (name && meaning)
|
|
856
|
-
|
|
859
|
+
if (name && meaning) {
|
|
860
|
+
const ge = {
|
|
857
861
|
name: name,
|
|
858
862
|
meaning: meaning,
|
|
859
863
|
synonyms: syn,
|
|
860
864
|
internal: false,
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
|
|
865
|
+
};
|
|
866
|
+
addAgentGlossaryEntry(n, ge);
|
|
867
|
+
fetchModule(moduleName).addGlossaryEntry(def.name, ge);
|
|
868
|
+
} else throw new Error(`glossaryEntry ${def.name} requires both name and meaning keys`);
|
|
864
869
|
}
|
|
865
870
|
}
|
|
866
871
|
|