agentlang 0.4.5 → 0.4.7

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.
Files changed (66) hide show
  1. package/out/language/generated/ast.d.ts +1 -0
  2. package/out/language/generated/ast.d.ts.map +1 -1
  3. package/out/language/generated/ast.js +1 -0
  4. package/out/language/generated/ast.js.map +1 -1
  5. package/out/language/generated/grammar.d.ts.map +1 -1
  6. package/out/language/generated/grammar.js +13 -0
  7. package/out/language/generated/grammar.js.map +1 -1
  8. package/out/language/main.cjs +14 -0
  9. package/out/language/main.cjs.map +2 -2
  10. package/out/language/syntax.d.ts +1 -0
  11. package/out/language/syntax.d.ts.map +1 -1
  12. package/out/language/syntax.js +19 -0
  13. package/out/language/syntax.js.map +1 -1
  14. package/out/runtime/auth/cognito.d.ts +2 -0
  15. package/out/runtime/auth/cognito.d.ts.map +1 -1
  16. package/out/runtime/auth/cognito.js +48 -2
  17. package/out/runtime/auth/cognito.js.map +1 -1
  18. package/out/runtime/auth/interface.d.ts +2 -0
  19. package/out/runtime/auth/interface.d.ts.map +1 -1
  20. package/out/runtime/loader.d.ts +6 -0
  21. package/out/runtime/loader.d.ts.map +1 -1
  22. package/out/runtime/loader.js +32 -6
  23. package/out/runtime/loader.js.map +1 -1
  24. package/out/runtime/module.d.ts +2 -0
  25. package/out/runtime/module.d.ts.map +1 -1
  26. package/out/runtime/module.js +8 -1
  27. package/out/runtime/module.js.map +1 -1
  28. package/out/runtime/modules/ai.d.ts.map +1 -1
  29. package/out/runtime/modules/ai.js +19 -3
  30. package/out/runtime/modules/ai.js.map +1 -1
  31. package/out/runtime/modules/auth.d.ts +5 -2
  32. package/out/runtime/modules/auth.d.ts.map +1 -1
  33. package/out/runtime/modules/auth.js +122 -8
  34. package/out/runtime/modules/auth.js.map +1 -1
  35. package/out/runtime/modules/core.d.ts +1 -0
  36. package/out/runtime/modules/core.d.ts.map +1 -1
  37. package/out/runtime/modules/core.js +17 -1
  38. package/out/runtime/modules/core.js.map +1 -1
  39. package/out/runtime/modules/files.d.ts +18 -0
  40. package/out/runtime/modules/files.d.ts.map +1 -0
  41. package/out/runtime/modules/files.js +116 -0
  42. package/out/runtime/modules/files.js.map +1 -0
  43. package/out/setupClassic.d.ts +98 -0
  44. package/out/setupClassic.d.ts.map +1 -0
  45. package/out/setupClassic.js +38 -0
  46. package/out/setupClassic.js.map +1 -0
  47. package/out/setupCommon.d.ts +2 -0
  48. package/out/setupCommon.d.ts.map +1 -0
  49. package/out/setupCommon.js +33 -0
  50. package/out/setupCommon.js.map +1 -0
  51. package/out/setupExtended.d.ts +40 -0
  52. package/out/setupExtended.d.ts.map +1 -0
  53. package/out/setupExtended.js +67 -0
  54. package/out/setupExtended.js.map +1 -0
  55. package/package.json +184 -183
  56. package/src/language/agentlang.langium +1 -1
  57. package/src/language/generated/ast.ts +2 -0
  58. package/src/language/generated/grammar.ts +13 -0
  59. package/src/language/syntax.ts +18 -1
  60. package/src/runtime/auth/cognito.ts +52 -2
  61. package/src/runtime/auth/interface.ts +2 -0
  62. package/src/runtime/loader.ts +41 -6
  63. package/src/runtime/module.ts +9 -1
  64. package/src/runtime/modules/ai.ts +20 -3
  65. package/src/runtime/modules/auth.ts +140 -8
  66. package/src/runtime/modules/core.ts +25 -1
package/package.json CHANGED
@@ -1,184 +1,185 @@
1
1
  {
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.4.5",
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.32",
42
- "@langchain/core": "^0.3.78",
43
- "@langchain/openai": "^0.6.16",
44
- "@types/jsonwebtoken": "^9.0.10",
45
- "amazon-cognito-identity-js": "^6.3.15",
46
- "aws-jwt-verify": "^5.1.0",
47
- "bcryptjs": "^3.0.2",
48
- "buffer": "^6.0.3",
49
- "chalk": "~5.3.0",
50
- "commander": "~11.0.0",
51
- "express": "^5.1.0",
52
- "handlebars": "^4.7.8",
53
- "jsonwebtoken": "^9.0.2",
54
- "langchain": "^0.3.36",
55
- "langium": "^3.5.0",
56
- "openapi-client-axios": "^7.6.0",
57
- "pg": "^8.16.1",
58
- "pgvector": "^0.2.1",
59
- "sql.js": "^1.13.0",
60
- "sqlite3": "^5.1.7",
61
- "typeorm": "^0.3.25",
62
- "vscode-languageserver": "^9.0.1",
63
- "winston": "^3.17.0",
64
- "winston-daily-rotate-file": "^5.0.0",
65
- "zod": "^3.25.55"
66
- },
67
- "overrides": {
68
- "semver": "^7.5.3",
69
- "trim-newlines": ">=3.0.1"
70
- },
71
- "devDependencies": {
72
- "@codingame/esbuild-import-meta-url-plugin": "~1.0.2",
73
- "@eslint/js": "^9.26.0",
74
- "@types/cookie-parser": "^1.4.9",
75
- "@types/express": "^5.0.1",
76
- "@types/node": "^18.19.110",
77
- "@types/sql.js": "^1.4.9",
78
- "@types/vscode": "^1.100.0",
79
- "@typescript-eslint/eslint-plugin": "~8.32.1",
80
- "@typescript-eslint/parser": "~8.32.1",
81
- "brace-expansion": ">=2.0.2",
82
- "concurrently": "~8.2.1",
83
- "esbuild": "^0.25.4",
84
- "eslint": "~9.26.0",
85
- "generator-langium": "^3.0.0",
86
- "http-server": "~14.1.1",
87
- "langium-cli": "^3.5.0",
88
- "nodemon": "^3.1.10",
89
- "prettier": "^3.5.3",
90
- "typescript": "^5.8.3",
91
- "typescript-eslint": "^8.32.1",
92
- "vite": "^6.3.5",
93
- "vite-plugin-node-polyfills": "^0.24.0",
94
- "vitest": "^3.1.3",
95
- "vscode-languageclient": "^9.0.1",
96
- "vscode-uri": "^3.1.0"
97
- },
98
- "volta": {
99
- "node": ">=20.0.0",
100
- "npm": ">=10.8.2"
101
- },
102
- "displayName": "agentlang",
103
- "engines": {
104
- "vscode": "^1.67.0",
105
- "node": ">=20.0.0"
106
- },
107
- "categories": [
108
- "Programming Languages"
109
- ],
110
- "contributes": {
111
- "languages": [
112
- {
113
- "id": "agentlang",
114
- "aliases": [
115
- "Agentlang",
116
- "agentlang"
117
- ],
118
- "extensions": [
119
- ".al"
120
- ],
121
- "configuration": "./language-configuration.json"
122
- }
123
- ],
124
- "grammars": [
125
- {
126
- "language": "agentlang",
127
- "scopeName": "source.agentlang",
128
- "path": "syntaxes/agentlang.tmLanguage.json"
129
- }
130
- ]
131
- },
132
- "activationEvents": [
133
- "onLanguage:agentlang"
134
- ],
135
- "main": "./out/extension/main.cjs",
136
- "types": "./out/index.d.ts",
137
- "exports": {
138
- ".": {
139
- "types": "./out/index.d.ts",
140
- "import": "./out/extension/main.cjs",
141
- "require": "./out/extension/main.cjs"
142
- },
143
- "./browser": {
144
- "types": "./out/browser.d.ts",
145
- "import": "./out/browser.js",
146
- "default": "./out/browser.js"
147
- },
148
- "./src/*": {
149
- "types": "./out/*.d.ts",
150
- "import": "./out/*.js",
151
- "require": "./out/*.js",
152
- "default": "./out/*.js"
153
- },
154
- "./out/*": "./out/*"
155
- },
156
- "bin": {
157
- "agentlang-cli": "./bin/cli.js"
158
- },
159
- "lint-staged": {
160
- "*.{js,ts,tsx}": [
161
- "eslint --fix --cache",
162
- "prettier --write"
163
- ],
164
- "*.{json,md,yml,yaml}": [
165
- "prettier --write"
166
- ]
167
- },
168
- "scripts": {
169
- "build": "tsc -b tsconfig.src.json && tsc -b tsconfig.declarations.json && node esbuild.mjs",
170
- "build:ts": "tsc -b tsconfig.src.json",
171
- "watch": "concurrently -n tsc,esbuild -c blue,yellow \"tsc -b tsconfig.src.json --watch\" \"node esbuild.mjs --watch\"",
172
- "lint": "eslint . --ext .ts",
173
- "lint:fix": "eslint . --ext .ts --fix",
174
- "format": "prettier --write \"src/**/*.{js,ts,tsx,json,md}\"",
175
- "format:check": "prettier --check \"src/**/*.{js,ts,tsx,json,md}\"",
176
- "langium:generate": "langium generate",
177
- "langium:generate:production": "langium generate --mode=production",
178
- "langium:watch": "langium generate --watch",
179
- "vscode:prepublish": "npm run build && npm run lint",
180
- "dev": "vite",
181
- "test": "vitest run",
182
- "test:verbose": "VITEST_VERBOSE=true vitest run"
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.4.7",
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
+ "amazon-cognito-identity-js": "^6.3.15",
62
+ "aws-jwt-verify": "^5.1.0",
63
+ "bcryptjs": "^3.0.2",
64
+ "buffer": "^6.0.3",
65
+ "chalk": "~5.3.0",
66
+ "commander": "~11.0.0",
67
+ "express": "^5.1.0",
68
+ "handlebars": "^4.7.8",
69
+ "jsonwebtoken": "^9.0.2",
70
+ "langchain": "^0.3.36",
71
+ "langium": "^3.5.0",
72
+ "openapi-client-axios": "^7.6.0",
73
+ "pg": "^8.16.1",
74
+ "pgvector": "^0.2.1",
75
+ "sql.js": "^1.13.0",
76
+ "sqlite3": "^5.1.7",
77
+ "typeorm": "^0.3.25",
78
+ "vscode-languageserver": "^9.0.1",
79
+ "winston": "^3.17.0",
80
+ "winston-daily-rotate-file": "^5.0.0",
81
+ "zod": "^3.25.55"
82
+ },
83
+ "overrides": {
84
+ "semver": "^7.5.3",
85
+ "trim-newlines": ">=3.0.1"
86
+ },
87
+ "devDependencies": {
88
+ "@codingame/esbuild-import-meta-url-plugin": "~1.0.2",
89
+ "@eslint/js": "^9.26.0",
90
+ "@types/cookie-parser": "^1.4.9",
91
+ "@types/express": "^5.0.1",
92
+ "@types/node": "^18.19.110",
93
+ "@types/sql.js": "^1.4.9",
94
+ "@types/vscode": "^1.100.0",
95
+ "@typescript-eslint/eslint-plugin": "~8.32.1",
96
+ "@typescript-eslint/parser": "~8.32.1",
97
+ "brace-expansion": ">=2.0.2",
98
+ "concurrently": "~8.2.1",
99
+ "esbuild": "^0.25.4",
100
+ "eslint": "~9.26.0",
101
+ "generator-langium": "^3.0.0",
102
+ "http-server": "~14.1.1",
103
+ "langium-cli": "^3.5.0",
104
+ "nodemon": "^3.1.10",
105
+ "prettier": "^3.5.3",
106
+ "typescript": "^5.8.3",
107
+ "typescript-eslint": "^8.32.1",
108
+ "vite": "^6.3.5",
109
+ "vite-plugin-node-polyfills": "^0.24.0",
110
+ "vitest": "^3.1.3",
111
+ "vscode-languageclient": "^9.0.1",
112
+ "vscode-uri": "^3.1.0"
113
+ },
114
+ "volta": {
115
+ "node": ">=20.0.0",
116
+ "npm": ">=10.8.2"
117
+ },
118
+ "displayName": "agentlang",
119
+ "engines": {
120
+ "vscode": "^1.67.0",
121
+ "node": ">=20.0.0"
122
+ },
123
+ "categories": [
124
+ "Programming Languages"
125
+ ],
126
+ "contributes": {
127
+ "languages": [
128
+ {
129
+ "id": "agentlang",
130
+ "aliases": [
131
+ "Agentlang",
132
+ "agentlang"
133
+ ],
134
+ "extensions": [
135
+ ".al"
136
+ ],
137
+ "configuration": "./language-configuration.json"
138
+ }
139
+ ],
140
+ "grammars": [
141
+ {
142
+ "language": "agentlang",
143
+ "scopeName": "source.agentlang",
144
+ "path": "syntaxes/agentlang.tmLanguage.json"
145
+ }
146
+ ]
147
+ },
148
+ "activationEvents": [
149
+ "onLanguage:agentlang"
150
+ ],
151
+ "main": "./out/extension/main.cjs",
152
+ "types": "./out/index.d.ts",
153
+ "exports": {
154
+ ".": {
155
+ "types": "./out/index.d.ts",
156
+ "import": "./out/extension/main.cjs",
157
+ "require": "./out/extension/main.cjs"
158
+ },
159
+ "./browser": {
160
+ "types": "./out/browser.d.ts",
161
+ "import": "./out/browser.js",
162
+ "default": "./out/browser.js"
163
+ },
164
+ "./src/*": {
165
+ "types": "./out/*.d.ts",
166
+ "import": "./out/*.js",
167
+ "require": "./out/*.js",
168
+ "default": "./out/*.js"
169
+ },
170
+ "./out/*": "./out/*"
171
+ },
172
+ "bin": {
173
+ "agentlang-cli": "./bin/cli.js"
174
+ },
175
+ "lint-staged": {
176
+ "*.{js,ts,tsx}": [
177
+ "eslint --fix --cache",
178
+ "prettier --write"
179
+ ],
180
+ "*.{json,md,yml,yaml}": [
181
+ "prettier --write"
182
+ ]
183
+ },
184
+ "packageManager": "pnpm@10.13.1+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad"
185
+ }
@@ -42,7 +42,7 @@ RelNodes: '(' node1=NodeDefinition ',' node2=NodeDefinition ')';
42
42
  AttributeDefinition: name=ID (type=QualifiedName | arrayType=QualifiedName '['']' | oneOfSpec=OneOfSpec | enumSpec=EnumSpec
43
43
  | refSpec=RefSpec) ('@expr' '(' expr=Expr ')')? properties+=PropertyDefinition*;
44
44
 
45
- EnumSpec: '@enum' '(' values+=STRING (',' values+=STRING)* ')';
45
+ EnumSpec: (type=QualifiedName)? '@enum' '(' values+=STRING (',' values+=STRING)* ')';
46
46
 
47
47
  OneOfSpec: '@oneof' '(' ref=Ref ')';
48
48
 
@@ -539,6 +539,7 @@ export function isEntityDefinition(item: unknown): item is EntityDefinition {
539
539
  export interface EnumSpec extends langium.AstNode {
540
540
  readonly $container: AttributeDefinition;
541
541
  readonly $type: 'EnumSpec';
542
+ type?: QualifiedName;
542
543
  values: Array<string>;
543
544
  }
544
545
 
@@ -1806,6 +1807,7 @@ export class AgentlangAstReflection extends langium.AbstractAstReflection {
1806
1807
  return {
1807
1808
  name: EnumSpec,
1808
1809
  properties: [
1810
+ { name: 'type' },
1809
1811
  { name: 'values', defaultValue: [] }
1810
1812
  ]
1811
1813
  };
@@ -1222,6 +1222,19 @@ export const AgentlangGrammar = (): Grammar => loadedAgentlangGrammar ?? (loaded
1222
1222
  "definition": {
1223
1223
  "$type": "Group",
1224
1224
  "elements": [
1225
+ {
1226
+ "$type": "Assignment",
1227
+ "feature": "type",
1228
+ "operator": "=",
1229
+ "terminal": {
1230
+ "$type": "RuleCall",
1231
+ "rule": {
1232
+ "$ref": "#/rules@109"
1233
+ },
1234
+ "arguments": []
1235
+ },
1236
+ "cardinality": "?"
1237
+ },
1225
1238
  {
1226
1239
  "$type": "Keyword",
1227
1240
  "value": "@enum"
@@ -1,8 +1,9 @@
1
1
  import { parseHelper } from 'langium/test';
2
2
  import { escapeQueryName, trimQuotes } from '../runtime/util.js';
3
- import { ModuleDefinition } from './generated/ast.js';
3
+ import { isDecisionDefinition, ModuleDefinition } from './generated/ast.js';
4
4
  import { createAgentlangServices } from './agentlang-module.js';
5
5
  import { EmptyFileSystem } from 'langium';
6
+ import { introspect, parseModule } from './parser.js';
6
7
 
7
8
  export class BasePattern {
8
9
  alias: string | undefined;
@@ -688,6 +689,22 @@ export class CasePattern extends BasePattern {
688
689
  this.body = body;
689
690
  }
690
691
 
692
+ static async FromString(s: string): Promise<CasePattern> {
693
+ const ss = s.trimStart();
694
+ if (ss.startsWith('case')) {
695
+ const m = await parseModule(`module T\ndecision D {\n${ss}}`);
696
+ const d = m.defs[0];
697
+ if (isDecisionDefinition(d) && d.body) {
698
+ const c = d.body.cases[0];
699
+ const b = await introspect(c.statements[0].$cstNode?.text || '');
700
+ return new CasePattern(new ExpressionPattern(c.cond), b[0]);
701
+ } else {
702
+ throw new Error(`Failed to parse ${s}`);
703
+ }
704
+ }
705
+ throw new Error(`Not a case expression - ${s}`);
706
+ }
707
+
691
708
  override toString(): string {
692
709
  return `case (${this.condition.toString()}) {
693
710
  ${this.body.toString()}
@@ -43,6 +43,8 @@ let ConfirmForgotPasswordCommand: any = undefined;
43
43
  let AdminGetUserCommand: any = undefined;
44
44
  let InitiateAuthCommand: any = undefined;
45
45
  let AdminCreateUserCommand: any = undefined;
46
+ let AdminDisableUserCommand: any = undefined;
47
+ let AdminEnableUserCommand: any = undefined;
46
48
  let RespondToAuthChallengeCommand: any = undefined;
47
49
  let AuthenticationDetails: any = undefined;
48
50
  let CognitoUser: any = undefined;
@@ -66,6 +68,8 @@ if (isNodeEnv) {
66
68
  AdminGetUserCommand = cip.AdminGetUserCommand;
67
69
  InitiateAuthCommand = cip.InitiateAuthCommand;
68
70
  AdminCreateUserCommand = cip.AdminCreateUserCommand;
71
+ AdminDisableUserCommand = cip.AdminDisableUserCommand;
72
+ AdminEnableUserCommand = cip.AdminEnableUserCommand;
69
73
  RespondToAuthChallengeCommand = cip.RespondToAuthChallengeCommand;
70
74
 
71
75
  const ci = await import('amazon-cognito-identity-js');
@@ -384,7 +388,7 @@ export class CognitoAuth implements AgentlangAuth {
384
388
 
385
389
  if (response.$metadata.httpStatusCode == 200) {
386
390
  logger.info(`Signup successful for user: ${username}`);
387
- const user = await ensureUser(username, firstName, lastName, env);
391
+ const user = await ensureUser(username, firstName, lastName, env, 'Active');
388
392
  const userInfo: UserInfo = {
389
393
  username: username,
390
394
  firstName: firstName,
@@ -1088,7 +1092,7 @@ export class CognitoAuth implements AgentlangAuth {
1088
1092
  if (response.$metadata.httpStatusCode === 200) {
1089
1093
  logger.info(`User invitation successful for: ${email}`);
1090
1094
 
1091
- await ensureUser(email, firstName, lastName, env);
1095
+ await ensureUser(email, firstName, lastName, env, 'Invited');
1092
1096
 
1093
1097
  const invitationInfo: InvitationInfo = {
1094
1098
  email: email,
@@ -1270,4 +1274,50 @@ export class CognitoAuth implements AgentlangAuth {
1270
1274
  throw new Error('Invalid JWT token');
1271
1275
  }
1272
1276
  }
1277
+
1278
+ async disableUser(email: string, _env: Environment): Promise<void> {
1279
+ try {
1280
+ const client = new CognitoIdentityProviderClient({
1281
+ region: process.env.AWS_REGION || 'us-west-2',
1282
+ });
1283
+
1284
+ const command = new AdminDisableUserCommand({
1285
+ UserPoolId: this.fetchUserPoolId(),
1286
+ Username: email,
1287
+ });
1288
+
1289
+ logger.debug(`Attempting to disable user: ${email}`);
1290
+ await client.send(command);
1291
+ logger.info(`User disabled successfully: ${email}`);
1292
+ } catch (err: any) {
1293
+ logger.error(`Failed to disable user ${email}:`, {
1294
+ errorName: err.name,
1295
+ errorMessage: sanitizeErrorMessage(err.message),
1296
+ });
1297
+ handleCognitoError(err, 'disableUser');
1298
+ }
1299
+ }
1300
+
1301
+ async enableUser(email: string, _env: Environment): Promise<void> {
1302
+ try {
1303
+ const client = new CognitoIdentityProviderClient({
1304
+ region: process.env.AWS_REGION || 'us-west-2',
1305
+ });
1306
+
1307
+ const command = new AdminEnableUserCommand({
1308
+ UserPoolId: this.fetchUserPoolId(),
1309
+ Username: email,
1310
+ });
1311
+
1312
+ logger.debug(`Attempting to enable user: ${email}`);
1313
+ await client.send(command);
1314
+ logger.info(`User enabled successfully: ${email}`);
1315
+ } catch (err: any) {
1316
+ logger.error(`Failed to enable user ${email}:`, {
1317
+ errorName: err.name,
1318
+ errorMessage: sanitizeErrorMessage(err.message),
1319
+ });
1320
+ handleCognitoError(err, 'enableUser');
1321
+ }
1322
+ }
1273
1323
  }
@@ -78,4 +78,6 @@ export interface AgentlangAuth {
78
78
  env: Environment
79
79
  ): Promise<void>;
80
80
  callback(code: string, env: Environment, cb: LoginCallback): Promise<void>;
81
+ disableUser(email: string, env: Environment): Promise<void>;
82
+ enableUser(email: string, env: Environment): Promise<void>;
81
83
  }
@@ -213,6 +213,17 @@ async function getAllModules(
213
213
  return alFiles;
214
214
  }
215
215
 
216
+ let dependenciesCallback: Function | undefined = undefined;
217
+
218
+ export function setDependenciesCallback(cb: Function) {
219
+ dependenciesCallback = cb;
220
+ }
221
+
222
+ export type DependencyInfo = {
223
+ appName: string;
224
+ url: string;
225
+ };
226
+
216
227
  async function loadApp(appDir: string, fsOptions?: any, callback?: Function): Promise<string> {
217
228
  // Initialize filesystem if not already done
218
229
  const fs = await getFileSystem(fsOptions);
@@ -220,6 +231,20 @@ async function loadApp(appDir: string, fsOptions?: any, callback?: Function): Pr
220
231
  const appJsonFile = `${appDir}${path.sep}package.json`;
221
232
  const s: string = await fs.readFile(appJsonFile);
222
233
  const appSpec: ApplicationSpec = JSON.parse(s);
234
+ if (dependenciesCallback !== undefined && appSpec.dependencies) {
235
+ const aldeps = new Array<DependencyInfo>();
236
+ for (const [k, v] of Object.entries(appSpec.dependencies)) {
237
+ if (typeof v === 'string' && v.startsWith('git+http')) {
238
+ aldeps.push({
239
+ appName: k,
240
+ url: v,
241
+ });
242
+ }
243
+ }
244
+ if (aldeps.length > 0) {
245
+ await dependenciesCallback(aldeps);
246
+ }
247
+ }
223
248
  let lastModuleLoaded: string = '';
224
249
  async function cont2() {
225
250
  const fls01 = await getAllModules(appDir, fs, false);
@@ -237,7 +262,13 @@ async function loadApp(appDir: string, fsOptions?: any, callback?: Function): Pr
237
262
  if (appSpec.dependencies !== undefined) {
238
263
  for (const [depName, _] of Object.entries(appSpec.dependencies)) {
239
264
  try {
240
- const depDirName = `./node_modules/${depName}`;
265
+ // In browser (with virtual filesystem), use absolute path relative to appDir
266
+ // In Node.js, use relative path from current working directory
267
+ const isBrowser = fsOptions && fsOptions.name;
268
+ const depDirName = isBrowser
269
+ ? `${appDir}${path.sep}node_modules${path.sep}${depName}`
270
+ : `./node_modules/${depName}`;
271
+
241
272
  const fls01 = await fs.readdir(depDirName);
242
273
  const srcDir = depDirName + path.sep + 'src';
243
274
  const hasSrc = await fs.exists(srcDir);
@@ -279,6 +310,12 @@ export async function load(
279
310
  return { name: result, version: '0.0.1' };
280
311
  }
281
312
 
313
+ export function flushAllModules() {
314
+ getUserModuleNames().forEach((n: string) => {
315
+ removeModule(n);
316
+ });
317
+ }
318
+
282
319
  /**
283
320
  * Removes all existing user-modules and loads the specified module-file.
284
321
  * @param fileName Path to the file containing the module
@@ -291,9 +328,7 @@ export async function flushAllAndLoad(
291
328
  fsOptions?: any,
292
329
  callback?: Function
293
330
  ): Promise<ApplicationSpec> {
294
- getUserModuleNames().forEach((n: string) => {
295
- removeModule(n);
296
- });
331
+ flushAllModules();
297
332
  return await load(fileName, fsOptions, callback);
298
333
  }
299
334
 
@@ -457,7 +492,7 @@ function addSchemaFromDef(
457
492
  } else if (isRecordDefinition(def)) {
458
493
  result = addRecord(def.name, moduleName, def.schema, maybeExtends(def.extends));
459
494
  } else {
460
- throw new Error(`Cannot add schema defintiion in module ${moduleName} for ${def}`);
495
+ throw new Error(`Cannot add schema definition in module ${moduleName} for ${def}`);
461
496
  }
462
497
  if (ispub) {
463
498
  result.setPublic(true);
@@ -785,7 +820,7 @@ function processAgentArrayValue(expr: Expr | undefined, attrName: string): strin
785
820
  });
786
821
  return `{${m.join(',')}}`;
787
822
  } else {
788
- throw new Error(`Type not supprted in agent-arrays - ${attrName}`);
823
+ throw new Error(`Type not supported in agent-arrays - ${attrName}`);
789
824
  }
790
825
  } else {
791
826
  throw new Error(`Invalid value in array passed to agent ${attrName}`);