agentlang 0.0.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/LICENSE +83 -0
- package/README.md +120 -0
- package/bin/cli.js +4 -0
- package/out/api/http.d.ts +3 -0
- package/out/api/http.d.ts.map +1 -0
- package/out/api/http.js +290 -0
- package/out/api/http.js.map +1 -0
- package/out/cli/cli-util.d.ts +7 -0
- package/out/cli/cli-util.d.ts.map +1 -0
- package/out/cli/cli-util.js +9 -0
- package/out/cli/cli-util.js.map +1 -0
- package/out/cli/docs.d.ts +2 -0
- package/out/cli/docs.d.ts.map +1 -0
- package/out/cli/docs.js +236 -0
- package/out/cli/docs.js.map +1 -0
- package/out/cli/main.d.ts +288 -0
- package/out/cli/main.d.ts.map +1 -0
- package/out/cli/main.js +119 -0
- package/out/cli/main.js.map +1 -0
- package/out/cli/openapi-docs.yml +695 -0
- package/out/extension/main.cjs +18093 -0
- package/out/extension/main.cjs.map +7 -0
- package/out/extension/main.d.ts +4 -0
- package/out/extension/main.d.ts.map +1 -0
- package/out/extension/main.js +42 -0
- package/out/extension/main.js.map +1 -0
- package/out/language/agentlang-module.d.ts +42 -0
- package/out/language/agentlang-module.d.ts.map +1 -0
- package/out/language/agentlang-module.js +42 -0
- package/out/language/agentlang-module.js.map +1 -0
- package/out/language/agentlang-validator.d.ts +15 -0
- package/out/language/agentlang-validator.d.ts.map +1 -0
- package/out/language/agentlang-validator.js +50 -0
- package/out/language/agentlang-validator.js.map +1 -0
- package/out/language/generated/ast.d.ts +491 -0
- package/out/language/generated/ast.d.ts.map +1 -0
- package/out/language/generated/ast.js +934 -0
- package/out/language/generated/ast.js.map +1 -0
- package/out/language/generated/grammar.d.ts +7 -0
- package/out/language/generated/grammar.d.ts.map +1 -0
- package/out/language/generated/grammar.js +4475 -0
- package/out/language/generated/grammar.js.map +1 -0
- package/out/language/generated/module.d.ts +14 -0
- package/out/language/generated/module.d.ts.map +1 -0
- package/out/language/generated/module.js +21 -0
- package/out/language/generated/module.js.map +1 -0
- package/out/language/main-browser.d.ts +2 -0
- package/out/language/main-browser.d.ts.map +1 -0
- package/out/language/main-browser.js +10 -0
- package/out/language/main-browser.js.map +1 -0
- package/out/language/main.cjs +36229 -0
- package/out/language/main.cjs.map +7 -0
- package/out/language/main.d.ts +2 -0
- package/out/language/main.d.ts.map +1 -0
- package/out/language/main.js +11 -0
- package/out/language/main.js.map +1 -0
- package/out/language/parser.d.ts +9 -0
- package/out/language/parser.d.ts.map +1 -0
- package/out/language/parser.js +273 -0
- package/out/language/parser.js.map +1 -0
- package/out/language/syntax.d.ts +155 -0
- package/out/language/syntax.d.ts.map +1 -0
- package/out/language/syntax.js +527 -0
- package/out/language/syntax.js.map +1 -0
- package/out/runtime/agents/common.d.ts +2 -0
- package/out/runtime/agents/common.d.ts.map +1 -0
- package/out/runtime/agents/common.js +178 -0
- package/out/runtime/agents/common.js.map +1 -0
- package/out/runtime/agents/impl/openai.d.ts +8 -0
- package/out/runtime/agents/impl/openai.d.ts.map +1 -0
- package/out/runtime/agents/impl/openai.js +15 -0
- package/out/runtime/agents/impl/openai.js.map +1 -0
- package/out/runtime/agents/provider.d.ts +21 -0
- package/out/runtime/agents/provider.d.ts.map +1 -0
- package/out/runtime/agents/provider.js +32 -0
- package/out/runtime/agents/provider.js.map +1 -0
- package/out/runtime/agents/registry.d.ts +2 -0
- package/out/runtime/agents/registry.d.ts.map +1 -0
- package/out/runtime/agents/registry.js +10 -0
- package/out/runtime/agents/registry.js.map +1 -0
- package/out/runtime/auth/cognito.d.ts +16 -0
- package/out/runtime/auth/cognito.d.ts.map +1 -0
- package/out/runtime/auth/cognito.js +186 -0
- package/out/runtime/auth/cognito.js.map +1 -0
- package/out/runtime/auth/defs.d.ts +11 -0
- package/out/runtime/auth/defs.d.ts.map +1 -0
- package/out/runtime/auth/defs.js +24 -0
- package/out/runtime/auth/defs.js.map +1 -0
- package/out/runtime/auth/interface.d.ts +22 -0
- package/out/runtime/auth/interface.d.ts.map +1 -0
- package/out/runtime/auth/interface.js +2 -0
- package/out/runtime/auth/interface.js.map +1 -0
- package/out/runtime/defs.js +24 -0
- package/out/runtime/defs.js.map +1 -0
- package/out/runtime/interpreter.d.ts +69 -0
- package/out/runtime/interpreter.d.ts.map +1 -0
- package/out/runtime/interpreter.js +1163 -0
- package/out/runtime/interpreter.js.map +1 -0
- package/out/runtime/loader.d.ts +25 -0
- package/out/runtime/loader.d.ts.map +1 -0
- package/out/runtime/loader.js +346 -0
- package/out/runtime/loader.js.map +1 -0
- package/out/runtime/logger.d.ts +2 -0
- package/out/runtime/logger.d.ts.map +1 -0
- package/out/runtime/logger.js +44 -0
- package/out/runtime/logger.js.map +1 -0
- package/out/runtime/module.d.ts +273 -0
- package/out/runtime/module.d.ts.map +1 -0
- package/out/runtime/module.js +1786 -0
- package/out/runtime/module.js.map +1 -0
- package/out/runtime/modules/ai.d.ts +26 -0
- package/out/runtime/modules/ai.d.ts.map +1 -0
- package/out/runtime/modules/ai.js +211 -0
- package/out/runtime/modules/ai.js.map +1 -0
- package/out/runtime/modules/auth.d.ts +39 -0
- package/out/runtime/modules/auth.d.ts.map +1 -0
- package/out/runtime/modules/auth.js +359 -0
- package/out/runtime/modules/auth.js.map +1 -0
- package/out/runtime/modules/core.d.ts +2 -0
- package/out/runtime/modules/core.d.ts.map +1 -0
- package/out/runtime/modules/core.js +67 -0
- package/out/runtime/modules/core.js.map +1 -0
- package/out/runtime/relgraph.d.ts +21 -0
- package/out/runtime/relgraph.d.ts.map +1 -0
- package/out/runtime/relgraph.js +156 -0
- package/out/runtime/relgraph.js.map +1 -0
- package/out/runtime/resolvers/interface.d.ts +59 -0
- package/out/runtime/resolvers/interface.d.ts.map +1 -0
- package/out/runtime/resolvers/interface.js +111 -0
- package/out/runtime/resolvers/interface.js.map +1 -0
- package/out/runtime/resolvers/registry.d.ts +8 -0
- package/out/runtime/resolvers/registry.d.ts.map +1 -0
- package/out/runtime/resolvers/registry.js +26 -0
- package/out/runtime/resolvers/registry.js.map +1 -0
- package/out/runtime/resolvers/sqldb/database.d.ts +50 -0
- package/out/runtime/resolvers/sqldb/database.d.ts.map +1 -0
- package/out/runtime/resolvers/sqldb/database.js +618 -0
- package/out/runtime/resolvers/sqldb/database.js.map +1 -0
- package/out/runtime/resolvers/sqldb/dbutil.d.ts +18 -0
- package/out/runtime/resolvers/sqldb/dbutil.d.ts.map +1 -0
- package/out/runtime/resolvers/sqldb/dbutil.js +221 -0
- package/out/runtime/resolvers/sqldb/dbutil.js.map +1 -0
- package/out/runtime/resolvers/sqldb/impl.d.ts +26 -0
- package/out/runtime/resolvers/sqldb/impl.d.ts.map +1 -0
- package/out/runtime/resolvers/sqldb/impl.js +300 -0
- package/out/runtime/resolvers/sqldb/impl.js.map +1 -0
- package/out/runtime/state.js +83 -0
- package/out/runtime/state.js.map +1 -0
- package/out/runtime/util.d.ts +43 -0
- package/out/runtime/util.d.ts.map +1 -0
- package/out/runtime/util.js +447 -0
- package/out/runtime/util.js.map +1 -0
- 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/out/syntaxes/agentlang.monarch.d.ts +77 -0
- package/out/syntaxes/agentlang.monarch.d.ts.map +1 -0
- package/out/syntaxes/agentlang.monarch.js +31 -0
- package/out/syntaxes/agentlang.monarch.js.map +1 -0
- package/out/utils/fs/index.d.ts +14 -0
- package/out/utils/fs/index.d.ts.map +1 -0
- package/out/utils/fs/index.js +26 -0
- package/out/utils/fs/index.js.map +1 -0
- package/out/utils/fs/interfaces.d.ts +105 -0
- package/out/utils/fs/interfaces.d.ts.map +1 -0
- package/out/utils/fs/interfaces.js +5 -0
- package/out/utils/fs/interfaces.js.map +1 -0
- package/out/utils/fs/lightning-fs.d.ts +116 -0
- package/out/utils/fs/lightning-fs.d.ts.map +1 -0
- package/out/utils/fs/lightning-fs.js +243 -0
- package/out/utils/fs/lightning-fs.js.map +1 -0
- package/out/utils/fs/node-fs.d.ts +93 -0
- package/out/utils/fs/node-fs.d.ts.map +1 -0
- package/out/utils/fs/node-fs.js +169 -0
- package/out/utils/fs/node-fs.js.map +1 -0
- package/out/utils/fs-utils.d.ts +153 -0
- package/out/utils/fs-utils.d.ts.map +1 -0
- package/out/utils/fs-utils.js +271 -0
- package/out/utils/fs-utils.js.map +1 -0
- package/out/utils/runtime.d.ts +36 -0
- package/out/utils/runtime.d.ts.map +1 -0
- package/out/utils/runtime.js +39 -0
- package/out/utils/runtime.js.map +1 -0
- package/package.json +155 -0
- package/src/api/http.ts +361 -0
- package/src/cli/cli-util.ts +18 -0
- package/src/cli/main.ts +146 -0
- package/src/extension/main.ts +51 -0
- package/src/language/agentlang-module.ts +75 -0
- package/src/language/agentlang-validator.ts +60 -0
- package/src/language/agentlang.langium +178 -0
- package/src/language/generated/ast.ts +1698 -0
- package/src/language/generated/grammar.ts +4477 -0
- package/src/language/generated/module.ts +25 -0
- package/src/language/main-browser.ts +19 -0
- package/src/language/main.ts +13 -0
- package/src/language/parser.ts +329 -0
- package/src/language/syntax.ts +646 -0
- package/src/runtime/agents/common.ts +177 -0
- package/src/runtime/agents/impl/openai.ts +19 -0
- package/src/runtime/agents/provider.ts +58 -0
- package/src/runtime/agents/registry.ts +9 -0
- package/src/runtime/auth/cognito.ts +225 -0
- package/src/runtime/auth/defs.ts +33 -0
- package/src/runtime/auth/interface.ts +31 -0
- package/src/runtime/defs.ts +33 -0
- package/src/runtime/interpreter.ts +1352 -0
- package/src/runtime/loader.ts +450 -0
- package/src/runtime/logger.ts +51 -0
- package/src/runtime/module.ts +2188 -0
- package/src/runtime/modules/ai.ts +257 -0
- package/src/runtime/modules/auth.ts +489 -0
- package/src/runtime/modules/core.ts +95 -0
- package/src/runtime/relgraph.ts +195 -0
- package/src/runtime/resolvers/interface.ts +160 -0
- package/src/runtime/resolvers/registry.ts +30 -0
- package/src/runtime/resolvers/sqldb/database.ts +823 -0
- package/src/runtime/resolvers/sqldb/dbutil.ts +257 -0
- package/src/runtime/resolvers/sqldb/impl.ts +471 -0
- package/src/runtime/state.ts +87 -0
- package/src/runtime/util.ts +513 -0
- package/src/setupClassic.ts +43 -0
- package/src/setupCommon.ts +33 -0
- package/src/setupExtended.ts +79 -0
- package/src/syntaxes/agentlang.monarch.ts +31 -0
- package/src/utils/fs/index.ts +28 -0
- package/src/utils/fs/interfaces.ts +118 -0
- package/src/utils/fs/lightning-fs.ts +284 -0
- package/src/utils/fs/node-fs.ts +185 -0
- package/src/utils/fs-utils.ts +304 -0
- package/src/utils/runtime.ts +43 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { ExtendedFileSystem } from '../utils/fs/index.js';
|
|
2
|
+
import { URI as VSCodeURI } from 'vscode-uri';
|
|
3
|
+
/**
|
|
4
|
+
* Re-export the URI type from vscode-uri
|
|
5
|
+
*/
|
|
6
|
+
export type URI = VSCodeURI;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a URI from a string
|
|
9
|
+
* @param uriString String representation of a URI
|
|
10
|
+
* @returns URI object
|
|
11
|
+
*/
|
|
12
|
+
export declare function createURI(uriString: string): URI;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a file URI from a file path
|
|
15
|
+
* @param filePath File path (can be absolute or relative)
|
|
16
|
+
* @returns File URI object
|
|
17
|
+
*/
|
|
18
|
+
export declare function createFileURI(filePath: string): URI;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a directory URI from a directory path
|
|
21
|
+
* @param dirPath Directory path (can be absolute or relative)
|
|
22
|
+
* @returns Directory URI object
|
|
23
|
+
*/
|
|
24
|
+
export declare function createDirectoryURI(dirPath: string): URI;
|
|
25
|
+
/**
|
|
26
|
+
* Helper function to extract filesystem path from URI or string
|
|
27
|
+
* @param uri URI or string representation of URI
|
|
28
|
+
* @returns Filesystem path
|
|
29
|
+
*/
|
|
30
|
+
export declare function toFsPath(uri: URI | string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Initialize the filesystem with the appropriate implementation based on environment
|
|
33
|
+
* @param options Optional configuration for the filesystem
|
|
34
|
+
* @returns Promise resolving to the filesystem instance
|
|
35
|
+
*/
|
|
36
|
+
export declare function initializeFileSystem(options?: any): Promise<ExtendedFileSystem>;
|
|
37
|
+
/**
|
|
38
|
+
* Get the filesystem instance, initializing it if necessary
|
|
39
|
+
* @param options Optional configuration for the filesystem
|
|
40
|
+
* @returns Promise resolving to the filesystem instance
|
|
41
|
+
*/
|
|
42
|
+
export declare function getFileSystem(options?: any): Promise<ExtendedFileSystem>;
|
|
43
|
+
/**
|
|
44
|
+
* Read a file as text
|
|
45
|
+
* @param uri URI to the file
|
|
46
|
+
* @returns Promise resolving to file content as string
|
|
47
|
+
*/
|
|
48
|
+
export declare function readFile(uri: URI | string): Promise<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Read a file as binary
|
|
51
|
+
* @param uri URI to the file
|
|
52
|
+
* @returns Promise resolving to file content as Buffer
|
|
53
|
+
*/
|
|
54
|
+
export declare function readFileBuffer(uri: URI | string): Promise<Buffer>;
|
|
55
|
+
/**
|
|
56
|
+
* Write content to a file
|
|
57
|
+
* @param uri URI to the file
|
|
58
|
+
* @param data Content to write (string or Buffer)
|
|
59
|
+
* @returns Promise that resolves when write is complete
|
|
60
|
+
*/
|
|
61
|
+
export declare function writeFile(uri: URI | string, data: string | Buffer): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Check if a file or directory exists
|
|
64
|
+
* @param uri URI to check
|
|
65
|
+
* @returns Promise resolving to boolean indicating existence
|
|
66
|
+
*/
|
|
67
|
+
export declare function exists(uri: URI | string): Promise<boolean>;
|
|
68
|
+
/**
|
|
69
|
+
* Create a directory
|
|
70
|
+
* @param uri Directory URI to create
|
|
71
|
+
* @returns Promise that resolves when directory is created
|
|
72
|
+
*/
|
|
73
|
+
export declare function mkdir(uri: URI | string): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* List files in a directory
|
|
76
|
+
* @param uri Directory URI
|
|
77
|
+
* @returns Promise resolving to array of file names
|
|
78
|
+
*/
|
|
79
|
+
export declare function readdir(uri: URI | string): Promise<string[]>;
|
|
80
|
+
/**
|
|
81
|
+
* List files in a Directory (Wrapper for readdir)
|
|
82
|
+
* @param uri Directory URI
|
|
83
|
+
* @returns Promise resolving to array of file names
|
|
84
|
+
*/
|
|
85
|
+
export declare function readDirectory(uri: URI | string): Promise<string[]>;
|
|
86
|
+
/**
|
|
87
|
+
* Get stats for a file or directory
|
|
88
|
+
* @param uri URI to check
|
|
89
|
+
* @returns Promise resolving to stats object
|
|
90
|
+
*/
|
|
91
|
+
export declare function stat(uri: URI | string): Promise<any>;
|
|
92
|
+
/**
|
|
93
|
+
* Remove a file
|
|
94
|
+
* @param uri URI to the file
|
|
95
|
+
* @returns Promise that resolves when file is removed
|
|
96
|
+
*/
|
|
97
|
+
export declare function unlink(uri: URI | string): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Remove a directory
|
|
100
|
+
* @param uri URI to the directory
|
|
101
|
+
* @returns Promise that resolves when directory is removed
|
|
102
|
+
*/
|
|
103
|
+
export declare function rmdir(uri: URI | string): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Copy a file
|
|
106
|
+
* @param srcUri Source URI
|
|
107
|
+
* @param destUri Destination URI
|
|
108
|
+
* @returns Promise that resolves when copy is complete
|
|
109
|
+
*/
|
|
110
|
+
export declare function copyFile(srcUri: URI | string, destUri: URI | string): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Move a file
|
|
113
|
+
* @param srcUri Source URI
|
|
114
|
+
* @param destUri Destination URI
|
|
115
|
+
* @returns Promise that resolves when move is complete
|
|
116
|
+
*/
|
|
117
|
+
export declare function moveFile(srcUri: URI | string, destUri: URI | string): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Ensure a directory exists, creating it and any parent directories if needed
|
|
120
|
+
* @param uri Directory URI
|
|
121
|
+
* @returns Promise that resolves when directory exists
|
|
122
|
+
*/
|
|
123
|
+
export declare function ensureDir(uri: URI | string): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* Remove a directory and all its contents recursively
|
|
126
|
+
* @param uri Directory URI
|
|
127
|
+
* @returns Promise that resolves when directory is removed
|
|
128
|
+
*/
|
|
129
|
+
export declare function removeDir(uri: URI | string): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Determine if we're running in a browser environment
|
|
132
|
+
* @returns boolean indicating if in browser
|
|
133
|
+
*/
|
|
134
|
+
export declare function isBrowser(): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Determine if we're running in Node.js environment
|
|
137
|
+
* @returns boolean indicating if in Node.js
|
|
138
|
+
*/
|
|
139
|
+
export declare function isNode(): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Joins a URI with path segments
|
|
142
|
+
* @param base Base URI
|
|
143
|
+
* @param pathSegments Path segments to join
|
|
144
|
+
* @returns New URI with joined path
|
|
145
|
+
*/
|
|
146
|
+
export declare function joinURI(base: URI | string, ...pathSegments: string[]): URI;
|
|
147
|
+
/**
|
|
148
|
+
* Gets the parent directory URI from a file or directory URI
|
|
149
|
+
* @param uri URI to get parent from
|
|
150
|
+
* @returns Parent directory URI
|
|
151
|
+
*/
|
|
152
|
+
export declare function getParentURI(uri: URI | string): URI;
|
|
153
|
+
//# sourceMappingURL=fs-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-utils.d.ts","sourceRoot":"","sources":["../../src/utils/fs-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAY,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,GAAG,IAAI,SAAS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,CAwB1E;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,GAAG,CAmBnD"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { createFS } from '../utils/fs/index.js';
|
|
2
|
+
import { URI as VSCodeURI } from 'vscode-uri';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a URI from a string
|
|
5
|
+
* @param uriString String representation of a URI
|
|
6
|
+
* @returns URI object
|
|
7
|
+
*/
|
|
8
|
+
export function createURI(uriString) {
|
|
9
|
+
return VSCodeURI.parse(uriString);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates a file URI from a file path
|
|
13
|
+
* @param filePath File path (can be absolute or relative)
|
|
14
|
+
* @returns File URI object
|
|
15
|
+
*/
|
|
16
|
+
export function createFileURI(filePath) {
|
|
17
|
+
return VSCodeURI.file(filePath);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates a directory URI from a directory path
|
|
21
|
+
* @param dirPath Directory path (can be absolute or relative)
|
|
22
|
+
* @returns Directory URI object
|
|
23
|
+
*/
|
|
24
|
+
export function createDirectoryURI(dirPath) {
|
|
25
|
+
// Ensure path ends with a slash for directories
|
|
26
|
+
if (!dirPath.endsWith('/') && !dirPath.endsWith('\\')) {
|
|
27
|
+
dirPath = `${dirPath}/`;
|
|
28
|
+
}
|
|
29
|
+
return VSCodeURI.file(dirPath);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Helper function to extract filesystem path from URI or string
|
|
33
|
+
* @param uri URI or string representation of URI
|
|
34
|
+
* @returns Filesystem path
|
|
35
|
+
*/
|
|
36
|
+
export function toFsPath(uri) {
|
|
37
|
+
return typeof uri === 'string' ? VSCodeURI.parse(uri).fsPath : uri.fsPath;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Singleton instance of the filesystem
|
|
41
|
+
*/
|
|
42
|
+
let fsInstance = null;
|
|
43
|
+
/**
|
|
44
|
+
* Initialize the filesystem with the appropriate implementation based on environment
|
|
45
|
+
* @param options Optional configuration for the filesystem
|
|
46
|
+
* @returns Promise resolving to the filesystem instance
|
|
47
|
+
*/
|
|
48
|
+
export async function initializeFileSystem(options) {
|
|
49
|
+
if (!fsInstance) {
|
|
50
|
+
fsInstance = await createFS(options);
|
|
51
|
+
}
|
|
52
|
+
return fsInstance;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get the filesystem instance, initializing it if necessary
|
|
56
|
+
* @param options Optional configuration for the filesystem
|
|
57
|
+
* @returns Promise resolving to the filesystem instance
|
|
58
|
+
*/
|
|
59
|
+
export async function getFileSystem(options) {
|
|
60
|
+
return fsInstance || initializeFileSystem(options);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Read a file as text
|
|
64
|
+
* @param uri URI to the file
|
|
65
|
+
* @returns Promise resolving to file content as string
|
|
66
|
+
*/
|
|
67
|
+
export async function readFile(uri) {
|
|
68
|
+
const fs = await getFileSystem();
|
|
69
|
+
const path = toFsPath(uri);
|
|
70
|
+
return fs.readFile(path);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Read a file as binary
|
|
74
|
+
* @param uri URI to the file
|
|
75
|
+
* @returns Promise resolving to file content as Buffer
|
|
76
|
+
*/
|
|
77
|
+
export async function readFileBuffer(uri) {
|
|
78
|
+
const fs = await getFileSystem();
|
|
79
|
+
const path = toFsPath(uri);
|
|
80
|
+
return fs.readFileBuffer(path);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Write content to a file
|
|
84
|
+
* @param uri URI to the file
|
|
85
|
+
* @param data Content to write (string or Buffer)
|
|
86
|
+
* @returns Promise that resolves when write is complete
|
|
87
|
+
*/
|
|
88
|
+
export async function writeFile(uri, data) {
|
|
89
|
+
const fs = await getFileSystem();
|
|
90
|
+
const path = toFsPath(uri);
|
|
91
|
+
return fs.writeFile(path, data);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Check if a file or directory exists
|
|
95
|
+
* @param uri URI to check
|
|
96
|
+
* @returns Promise resolving to boolean indicating existence
|
|
97
|
+
*/
|
|
98
|
+
export async function exists(uri) {
|
|
99
|
+
const fs = await getFileSystem();
|
|
100
|
+
const path = toFsPath(uri);
|
|
101
|
+
return fs.exists(path);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Create a directory
|
|
105
|
+
* @param uri Directory URI to create
|
|
106
|
+
* @returns Promise that resolves when directory is created
|
|
107
|
+
*/
|
|
108
|
+
export async function mkdir(uri) {
|
|
109
|
+
const fs = await getFileSystem();
|
|
110
|
+
const path = toFsPath(uri);
|
|
111
|
+
return fs.mkdir(path);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* List files in a directory
|
|
115
|
+
* @param uri Directory URI
|
|
116
|
+
* @returns Promise resolving to array of file names
|
|
117
|
+
*/
|
|
118
|
+
export async function readdir(uri) {
|
|
119
|
+
const fs = await getFileSystem();
|
|
120
|
+
const path = toFsPath(uri);
|
|
121
|
+
return fs.readdir(path);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* List files in a Directory (Wrapper for readdir)
|
|
125
|
+
* @param uri Directory URI
|
|
126
|
+
* @returns Promise resolving to array of file names
|
|
127
|
+
*/
|
|
128
|
+
export async function readDirectory(uri) {
|
|
129
|
+
return readdir(uri);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Get stats for a file or directory
|
|
133
|
+
* @param uri URI to check
|
|
134
|
+
* @returns Promise resolving to stats object
|
|
135
|
+
*/
|
|
136
|
+
export async function stat(uri) {
|
|
137
|
+
const fs = await getFileSystem();
|
|
138
|
+
const path = toFsPath(uri);
|
|
139
|
+
return fs.stat(path);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Remove a file
|
|
143
|
+
* @param uri URI to the file
|
|
144
|
+
* @returns Promise that resolves when file is removed
|
|
145
|
+
*/
|
|
146
|
+
export async function unlink(uri) {
|
|
147
|
+
const fs = await getFileSystem();
|
|
148
|
+
const path = toFsPath(uri);
|
|
149
|
+
return fs.unlink(path);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Remove a directory
|
|
153
|
+
* @param uri URI to the directory
|
|
154
|
+
* @returns Promise that resolves when directory is removed
|
|
155
|
+
*/
|
|
156
|
+
export async function rmdir(uri) {
|
|
157
|
+
const fs = await getFileSystem();
|
|
158
|
+
const path = toFsPath(uri);
|
|
159
|
+
return fs.rmdir(path);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Copy a file
|
|
163
|
+
* @param srcUri Source URI
|
|
164
|
+
* @param destUri Destination URI
|
|
165
|
+
* @returns Promise that resolves when copy is complete
|
|
166
|
+
*/
|
|
167
|
+
export async function copyFile(srcUri, destUri) {
|
|
168
|
+
const fs = await getFileSystem();
|
|
169
|
+
const srcPath = toFsPath(srcUri);
|
|
170
|
+
const destPath = toFsPath(destUri);
|
|
171
|
+
return fs.copyFile(srcPath, destPath);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Move a file
|
|
175
|
+
* @param srcUri Source URI
|
|
176
|
+
* @param destUri Destination URI
|
|
177
|
+
* @returns Promise that resolves when move is complete
|
|
178
|
+
*/
|
|
179
|
+
export async function moveFile(srcUri, destUri) {
|
|
180
|
+
const fs = await getFileSystem();
|
|
181
|
+
const srcPath = toFsPath(srcUri);
|
|
182
|
+
const destPath = toFsPath(destUri);
|
|
183
|
+
return fs.moveFile(srcPath, destPath);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Ensure a directory exists, creating it and any parent directories if needed
|
|
187
|
+
* @param uri Directory URI
|
|
188
|
+
* @returns Promise that resolves when directory exists
|
|
189
|
+
*/
|
|
190
|
+
export async function ensureDir(uri) {
|
|
191
|
+
const fs = await getFileSystem();
|
|
192
|
+
const path = toFsPath(uri);
|
|
193
|
+
return fs.ensureDir(path);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Remove a directory and all its contents recursively
|
|
197
|
+
* @param uri Directory URI
|
|
198
|
+
* @returns Promise that resolves when directory is removed
|
|
199
|
+
*/
|
|
200
|
+
export async function removeDir(uri) {
|
|
201
|
+
const fs = await getFileSystem();
|
|
202
|
+
const path = toFsPath(uri);
|
|
203
|
+
return fs.removeDir(path);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Determine if we're running in a browser environment
|
|
207
|
+
* @returns boolean indicating if in browser
|
|
208
|
+
*/
|
|
209
|
+
export function isBrowser() {
|
|
210
|
+
return typeof window !== 'undefined';
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Determine if we're running in Node.js environment
|
|
214
|
+
* @returns boolean indicating if in Node.js
|
|
215
|
+
*/
|
|
216
|
+
export function isNode() {
|
|
217
|
+
return typeof window === 'undefined';
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Joins a URI with path segments
|
|
221
|
+
* @param base Base URI
|
|
222
|
+
* @param pathSegments Path segments to join
|
|
223
|
+
* @returns New URI with joined path
|
|
224
|
+
*/
|
|
225
|
+
export function joinURI(base, ...pathSegments) {
|
|
226
|
+
const baseUri = typeof base === 'string' ? VSCodeURI.parse(base) : base;
|
|
227
|
+
let path = baseUri.path;
|
|
228
|
+
// Join the path segments
|
|
229
|
+
for (const segment of pathSegments) {
|
|
230
|
+
// Make sure we don't double up on slashes
|
|
231
|
+
if (path.endsWith('/') && segment.startsWith('/')) {
|
|
232
|
+
path += segment.substring(1);
|
|
233
|
+
}
|
|
234
|
+
else if (!path.endsWith('/') && !segment.startsWith('/')) {
|
|
235
|
+
path += '/' + segment;
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
path += segment;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
// Create a new URI with the same scheme and authority but updated path
|
|
242
|
+
return VSCodeURI.from({
|
|
243
|
+
scheme: baseUri.scheme,
|
|
244
|
+
authority: baseUri.authority,
|
|
245
|
+
path,
|
|
246
|
+
query: baseUri.query,
|
|
247
|
+
fragment: baseUri.fragment,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Gets the parent directory URI from a file or directory URI
|
|
252
|
+
* @param uri URI to get parent from
|
|
253
|
+
* @returns Parent directory URI
|
|
254
|
+
*/
|
|
255
|
+
export function getParentURI(uri) {
|
|
256
|
+
const uriObj = typeof uri === 'string' ? VSCodeURI.parse(uri) : uri;
|
|
257
|
+
// Split the path into segments
|
|
258
|
+
const segments = uriObj.path.split('/').filter(Boolean);
|
|
259
|
+
// Remove the last segment (file or directory name)
|
|
260
|
+
segments.pop();
|
|
261
|
+
// Create a new path with the parent segments
|
|
262
|
+
const parentPath = '/' + segments.join('/');
|
|
263
|
+
return VSCodeURI.from({
|
|
264
|
+
scheme: uriObj.scheme,
|
|
265
|
+
authority: uriObj.authority,
|
|
266
|
+
path: parentPath,
|
|
267
|
+
query: uriObj.query,
|
|
268
|
+
fragment: uriObj.fragment,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=fs-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-utils.js","sourceRoot":"","sources":["../../src/utils/fs-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AAO9C;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,SAAiB;IACzC,OAAO,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;I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|
3
|
+
export declare const browserPath: {
|
|
4
|
+
extname: (path: string) => string;
|
|
5
|
+
basename: (path: string, ext?: string) => string;
|
|
6
|
+
dirname: (path: string) => string;
|
|
7
|
+
join: (...parts: string[]) => string;
|
|
8
|
+
resolve: (path: string) => string;
|
|
9
|
+
sep: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const path: {
|
|
12
|
+
extname: (path: string) => string;
|
|
13
|
+
basename: (path: string, ext?: string) => string;
|
|
14
|
+
dirname: (path: string) => string;
|
|
15
|
+
join: (...parts: string[]) => string;
|
|
16
|
+
resolve: (path: string) => string;
|
|
17
|
+
sep: string;
|
|
18
|
+
} | {
|
|
19
|
+
default: import("path").PlatformPath;
|
|
20
|
+
normalize(path: string): string;
|
|
21
|
+
join(...paths: string[]): string;
|
|
22
|
+
resolve(...paths: string[]): string;
|
|
23
|
+
isAbsolute(path: string): boolean;
|
|
24
|
+
relative(from: string, to: string): string;
|
|
25
|
+
dirname(path: string): string;
|
|
26
|
+
basename(path: string, suffix?: string): string;
|
|
27
|
+
extname(path: string): string;
|
|
28
|
+
sep: "\\" | "/";
|
|
29
|
+
delimiter: ";" | ":";
|
|
30
|
+
parse(path: string): import("path").ParsedPath;
|
|
31
|
+
format(pathObject: import("path").FormatInputPathObject): string;
|
|
32
|
+
toNamespacedPath(path: string): string;
|
|
33
|
+
posix: import("path").PlatformPath;
|
|
34
|
+
win32: import("path").PlatformPath;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/utils/runtime.ts"],"names":[],"mappings":"AAAA,eAAO,IAAI,KAAK,EAAE,GAAG,CAAC;AAGtB,eAAO,MAAM,SAAS,SACuE,CAAC;AAW9F,eAAO,MAAM,WAAW;oBACN,MAAM,KAAG,MAAM;qBAId,MAAM,QAAQ,MAAM,KAAG,MAAM;oBAO9B,MAAM,KAAG,MAAM;qBAKd,MAAM,EAAE,KAAG,MAAM;oBAGlB,MAAM,KAAG,MAAM;;CAIhC,CAAC;AAGF,eAAO,MAAM,IAAI;oBA1BC,MAAM,KAAG,MAAM;qBAId,MAAM,QAAQ,MAAM,KAAG,MAAM;oBAO9B,MAAM,KAAG,MAAM;qBAKd,MAAM,EAAE,KAAG,MAAM;oBAGlB,MAAM,KAAG,MAAM;;;;;;;;;;;;;;;;;;;CAO6D,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export let chalk;
|
|
2
|
+
// Environment detection
|
|
3
|
+
export const isNodeEnv = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
|
|
4
|
+
if (isNodeEnv) {
|
|
5
|
+
// Only import Node.js modules in Node environment
|
|
6
|
+
// Using dynamic imports to avoid breaking browser bundling
|
|
7
|
+
import('chalk').then(module => {
|
|
8
|
+
chalk = module.default;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
// Browser-compatible path utilities
|
|
12
|
+
export const browserPath = {
|
|
13
|
+
extname: (path) => {
|
|
14
|
+
const lastDotIndex = path.lastIndexOf('.');
|
|
15
|
+
return lastDotIndex !== -1 ? path.substring(lastDotIndex) : '';
|
|
16
|
+
},
|
|
17
|
+
basename: (path, ext) => {
|
|
18
|
+
let name = path.split('/').pop() || '';
|
|
19
|
+
if (ext && name.endsWith(ext)) {
|
|
20
|
+
name = name.substring(0, name.length - ext.length);
|
|
21
|
+
}
|
|
22
|
+
return name;
|
|
23
|
+
},
|
|
24
|
+
dirname: (path) => {
|
|
25
|
+
const parts = path.split('/');
|
|
26
|
+
parts.pop();
|
|
27
|
+
return parts.join('/') || '.';
|
|
28
|
+
},
|
|
29
|
+
join: (...parts) => {
|
|
30
|
+
return parts.filter(Boolean).join('/').replace(/\/+/g, '/');
|
|
31
|
+
},
|
|
32
|
+
resolve: (path) => {
|
|
33
|
+
return path;
|
|
34
|
+
},
|
|
35
|
+
sep: '/',
|
|
36
|
+
};
|
|
37
|
+
// Use either Node.js path or browser path based on environment
|
|
38
|
+
export const path = isNodeEnv ? await import('node:path').then(module => module) : browserPath;
|
|
39
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/utils/runtime.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAI,KAAU,CAAC;AAEtB,wBAAwB;AACxB,MAAM,CAAC,MAAM,SAAS,GACpB,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,IAAI,CAAC;AAE9F,IAAI,SAAS,EAAE,CAAC;IACd,kDAAkD;IAClD,2DAA2D;IAC3D,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;QAC5B,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,oCAAoC;AACpC,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,OAAO,EAAE,CAAC,IAAY,EAAU,EAAE;QAChC,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC3C,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,CAAC;IACD,QAAQ,EAAE,CAAC,IAAY,EAAE,GAAY,EAAU,EAAE;QAC/C,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;QACvC,IAAI,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,EAAE,CAAC,IAAY,EAAU,EAAE;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,KAAK,CAAC,GAAG,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;IAChC,CAAC;IACD,IAAI,EAAE,CAAC,GAAG,KAAe,EAAU,EAAE;QACnC,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,EAAE,CAAC,IAAY,EAAU,EAAE;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,GAAG,EAAE,GAAG;CACT,CAAC;AAEF,+DAA+D;AAC/D,MAAM,CAAC,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agentlang",
|
|
3
|
+
"description": "Please enter a brief description here",
|
|
4
|
+
"version": "0.0.2",
|
|
5
|
+
"files": [
|
|
6
|
+
"bin",
|
|
7
|
+
"out",
|
|
8
|
+
"src"
|
|
9
|
+
],
|
|
10
|
+
"type": "module",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc -b tsconfig.src.json && node esbuild.mjs",
|
|
13
|
+
"build:deno": "deno run -A scripts/build.ts",
|
|
14
|
+
"build:ts": "tsc -b tsconfig.src.json",
|
|
15
|
+
"build:vite": "vite build --emptyOutDir",
|
|
16
|
+
"watch": "concurrently -n tsc,esbuild -c blue,yellow \"tsc -b tsconfig.src.json --watch\" \"node esbuild.mjs --watch\"",
|
|
17
|
+
"watch:deno": "deno run --watch -A scripts/build.ts",
|
|
18
|
+
"lint": "eslint . --ext .ts",
|
|
19
|
+
"lint:fix": "eslint . --ext .ts --fix",
|
|
20
|
+
"lint:deno": "deno lint scripts/",
|
|
21
|
+
"format": "prettier --write \"src/**/*.{js,ts,tsx,json,md}\"",
|
|
22
|
+
"format:deno": "deno fmt scripts/",
|
|
23
|
+
"format:check": "prettier --check \"src/**/*.{js,ts,tsx,json,md}\"",
|
|
24
|
+
"langium:generate": "langium generate",
|
|
25
|
+
"langium:generate:production": "langium generate --mode=production",
|
|
26
|
+
"langium:watch": "langium generate --watch",
|
|
27
|
+
"vscode:prepublish": "npm run build && npm run lint",
|
|
28
|
+
"build:web": "npm run build",
|
|
29
|
+
"bundle": "vite build",
|
|
30
|
+
"bundle:serve": "http-server ./dist --port 5175",
|
|
31
|
+
"dev": "vite",
|
|
32
|
+
"dev:debug": "vite --debug --force",
|
|
33
|
+
"serve": "npm run dev",
|
|
34
|
+
"repl": "deno task repl",
|
|
35
|
+
"run": "deno task run",
|
|
36
|
+
"test": "vitest run",
|
|
37
|
+
"test:deno": "deno test -A scripts/"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@aws-sdk/client-cognito-identity": "^3.828.0",
|
|
41
|
+
"@aws-sdk/client-cognito-identity-provider": "^3.828.0",
|
|
42
|
+
"@aws-sdk/credential-providers": "^3.828.0",
|
|
43
|
+
"@codingame/monaco-vscode-editor-service-override": "^17.1.0",
|
|
44
|
+
"@codingame/monaco-vscode-keybindings-service-override": "^17.1.0",
|
|
45
|
+
"@isomorphic-git/lightning-fs": "^4.6.1",
|
|
46
|
+
"@langchain/core": "^0.3.59",
|
|
47
|
+
"@langchain/openai": "^0.5.13",
|
|
48
|
+
"@types/express": "^5.0.1",
|
|
49
|
+
"amazon-cognito-identity-js": "^6.3.15",
|
|
50
|
+
"aws-jwt-verify": "^5.1.0",
|
|
51
|
+
"buffer": "^6.0.3",
|
|
52
|
+
"c12": "^3.0.4",
|
|
53
|
+
"chalk": "~5.3.0",
|
|
54
|
+
"commander": "~11.0.0",
|
|
55
|
+
"dotenv": "^16.5.0",
|
|
56
|
+
"express": "^5.1.0",
|
|
57
|
+
"fs-extra": "^11.3.0",
|
|
58
|
+
"generator-langium": "^3.0.0",
|
|
59
|
+
"jsonwebtoken": "^9.0.2",
|
|
60
|
+
"jwk-to-pem": "^2.0.7",
|
|
61
|
+
"langchain": "^0.3.28",
|
|
62
|
+
"langium": "^3.5.0",
|
|
63
|
+
"monaco-editor": "~0.52.0",
|
|
64
|
+
"monaco-editor-wrapper": "^6.7.0",
|
|
65
|
+
"node-fetch": "^2.7.0",
|
|
66
|
+
"pg": "^8.16.1",
|
|
67
|
+
"pgvector": "^0.2.1",
|
|
68
|
+
"sqlite3": "^5.1.7",
|
|
69
|
+
"typeorm": "^0.3.23",
|
|
70
|
+
"vscode-languageclient": "^9.0.1",
|
|
71
|
+
"vscode-languageserver": "^9.0.1",
|
|
72
|
+
"winston": "^3.17.0",
|
|
73
|
+
"winston-daily-rotate-file": "^5.0.0",
|
|
74
|
+
"zod": "^3.25.55"
|
|
75
|
+
},
|
|
76
|
+
"overrides": {
|
|
77
|
+
"semver": "^7.5.3",
|
|
78
|
+
"trim-newlines": ">=3.0.1"
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@codingame/esbuild-import-meta-url-plugin": "~1.0.2",
|
|
82
|
+
"@eslint/js": "^9.26.0",
|
|
83
|
+
"@types/cookie-parser": "^1.4.9",
|
|
84
|
+
"@types/node": "^18.19.110",
|
|
85
|
+
"@types/vscode": "^1.100.0",
|
|
86
|
+
"@typescript-eslint/eslint-plugin": "~8.32.1",
|
|
87
|
+
"@typescript-eslint/parser": "~8.32.1",
|
|
88
|
+
"brace-expansion": ">=2.0.2",
|
|
89
|
+
"concurrently": "~8.2.1",
|
|
90
|
+
"esbuild": "^0.25.4",
|
|
91
|
+
"eslint": "~9.26.0",
|
|
92
|
+
"http-server": "~14.1.1",
|
|
93
|
+
"langium-cli": "^3.5.0",
|
|
94
|
+
"monaco-languageclient": "^9.7.0",
|
|
95
|
+
"nodemon": "^3.1.10",
|
|
96
|
+
"prettier": "^3.5.3",
|
|
97
|
+
"typescript": "^5.8.3",
|
|
98
|
+
"typescript-eslint": "^8.32.1",
|
|
99
|
+
"vite": "^6.3.5",
|
|
100
|
+
"vite-plugin-node-polyfills": "^0.23.0",
|
|
101
|
+
"vitest": "^3.1.3",
|
|
102
|
+
"vscode-languageclient": "^9.0.1",
|
|
103
|
+
"vscode-uri": "^3.1.0"
|
|
104
|
+
},
|
|
105
|
+
"volta": {
|
|
106
|
+
"node": ">=20.0.0",
|
|
107
|
+
"npm": ">=10.8.2"
|
|
108
|
+
},
|
|
109
|
+
"displayName": "agentlang",
|
|
110
|
+
"engines": {
|
|
111
|
+
"vscode": "^1.67.0",
|
|
112
|
+
"node": ">=20.0.0"
|
|
113
|
+
},
|
|
114
|
+
"categories": [
|
|
115
|
+
"Programming Languages"
|
|
116
|
+
],
|
|
117
|
+
"contributes": {
|
|
118
|
+
"languages": [
|
|
119
|
+
{
|
|
120
|
+
"id": "agentlang",
|
|
121
|
+
"aliases": [
|
|
122
|
+
"Agentlang",
|
|
123
|
+
"agentlang"
|
|
124
|
+
],
|
|
125
|
+
"extensions": [
|
|
126
|
+
".al"
|
|
127
|
+
],
|
|
128
|
+
"configuration": "./language-configuration.json"
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"grammars": [
|
|
132
|
+
{
|
|
133
|
+
"language": "agentlang",
|
|
134
|
+
"scopeName": "source.agentlang",
|
|
135
|
+
"path": "syntaxes/agentlang.tmLanguage.json"
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"activationEvents": [
|
|
140
|
+
"onLanguage:agentlang"
|
|
141
|
+
],
|
|
142
|
+
"main": "./out/extension/main.cjs",
|
|
143
|
+
"bin": {
|
|
144
|
+
"agentlang-cli": "./bin/cli.js"
|
|
145
|
+
},
|
|
146
|
+
"lint-staged": {
|
|
147
|
+
"*.{js,ts,tsx}": [
|
|
148
|
+
"eslint --fix --cache",
|
|
149
|
+
"prettier --write"
|
|
150
|
+
],
|
|
151
|
+
"*.{json,md,yml,yaml}": [
|
|
152
|
+
"prettier --write"
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
}
|