agentlang 0.9.11 → 0.10.1

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 (48) hide show
  1. package/out/language/generated/ast.d.ts +60 -42
  2. package/out/language/generated/ast.d.ts.map +1 -1
  3. package/out/language/generated/ast.js +45 -31
  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 +294 -327
  7. package/out/language/generated/grammar.js.map +1 -1
  8. package/out/language/main.cjs +336 -358
  9. package/out/language/main.cjs.map +2 -2
  10. package/out/language/parser.d.ts +11 -1
  11. package/out/language/parser.d.ts.map +1 -1
  12. package/out/language/parser.js +56 -6
  13. package/out/language/parser.js.map +1 -1
  14. package/out/language/syntax.d.ts +8 -0
  15. package/out/language/syntax.d.ts.map +1 -1
  16. package/out/language/syntax.js +11 -2
  17. package/out/language/syntax.js.map +1 -1
  18. package/out/runtime/agents/common.d.ts +2 -2
  19. package/out/runtime/agents/common.js +1 -1
  20. package/out/runtime/interpreter.d.ts.map +1 -1
  21. package/out/runtime/interpreter.js +104 -87
  22. package/out/runtime/interpreter.js.map +1 -1
  23. package/out/runtime/modules/ai.d.ts +2 -5
  24. package/out/runtime/modules/ai.d.ts.map +1 -1
  25. package/out/runtime/modules/ai.js +28 -19
  26. package/out/runtime/modules/ai.js.map +1 -1
  27. package/out/runtime/services/documentFetcher.js +2 -2
  28. package/out/runtime/services/documentFetcher.js.map +1 -1
  29. package/out/runtime/util.d.ts +10 -0
  30. package/out/runtime/util.d.ts.map +1 -1
  31. package/out/runtime/util.js +27 -2
  32. package/out/runtime/util.js.map +1 -1
  33. package/out/utils/fs/index.d.ts +12 -2
  34. package/out/utils/fs/index.d.ts.map +1 -1
  35. package/out/utils/fs/index.js +27 -6
  36. package/out/utils/fs/index.js.map +1 -1
  37. package/package.json +1 -1
  38. package/src/language/agentlang.langium +6 -9
  39. package/src/language/generated/ast.ts +66 -43
  40. package/src/language/generated/grammar.ts +294 -327
  41. package/src/language/parser.ts +65 -4
  42. package/src/language/syntax.ts +21 -2
  43. package/src/runtime/agents/common.ts +1 -1
  44. package/src/runtime/interpreter.ts +111 -84
  45. package/src/runtime/modules/ai.ts +35 -25
  46. package/src/runtime/services/documentFetcher.ts +2 -2
  47. package/src/runtime/util.ts +45 -2
  48. package/src/utils/fs/index.ts +30 -6
@@ -4,25 +4,49 @@
4
4
 
5
5
  export * from './interfaces.js';
6
6
  import { ExtendedFileSystem } from './interfaces.js';
7
- import { createNodeFS } from './node-fs.js';
8
- import { createLightningFS } from './lightning-fs.js';
9
7
 
10
8
  /**
11
9
  * Create the appropriate filesystem implementation based on environment
10
+ * Uses dynamic imports to avoid bundling Node.js-specific code in browser builds
12
11
  * @returns Promise resolving to appropriate filesystem implementation
13
12
  */
14
13
  export async function createFS(options?: any): Promise<ExtendedFileSystem> {
15
14
  // Check if we're in a browser or Node environment
16
15
  if (typeof window === 'undefined') {
17
- // Node.js environment
16
+ // Node.js environment - use dynamic import to avoid bundling in browser
17
+ const { createNodeFS } = await import('./node-fs.js');
18
18
  return createNodeFS();
19
19
  } else {
20
20
  // Browser environment - use Lightning FS
21
+ const { createLightningFS } = await import('./lightning-fs.js');
21
22
  return createLightningFS(options);
22
23
  }
23
24
  }
24
25
 
25
- // Export the specific filesystem implementations
26
- export { createNodeFS } from './node-fs.js';
27
- export { createLightningFS } from './lightning-fs.js';
26
+ // Re-export interface types (these are safe for browser)
28
27
  export * from './interfaces.js';
28
+
29
+ // Export factory functions that use dynamic imports internally
30
+ // These are async to support dynamic loading based on environment
31
+
32
+ /**
33
+ * Create Node.js filesystem - only works in Node.js environment
34
+ * @returns Promise resolving to NodeFileSystem instance
35
+ */
36
+ export async function createNodeFS(): Promise<ExtendedFileSystem> {
37
+ if (typeof window !== 'undefined') {
38
+ throw new Error('createNodeFS is only available in Node.js environment');
39
+ }
40
+ const module = await import('./node-fs.js');
41
+ return module.createNodeFS();
42
+ }
43
+
44
+ /**
45
+ * Create Lightning FS - works in browser environment
46
+ * @param options Optional configuration for Lightning FS
47
+ * @returns Promise resolving to LightningFileSystem instance
48
+ */
49
+ export async function createLightningFS(options?: any): Promise<ExtendedFileSystem> {
50
+ const module = await import('./lightning-fs.js');
51
+ return module.createLightningFS(options);
52
+ }