@aigne/afs 1.4.0-beta.5 → 1.4.0-beta.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.4.0-beta.7](https://github.com/AIGNE-io/aigne-framework/compare/afs-v1.4.0-beta.6...afs-v1.4.0-beta.7) (2026-01-08)
4
+
5
+
6
+ ### Features
7
+
8
+ * **afs,bash:** add physical path mapping for AFS modules in bash execution ([#881](https://github.com/AIGNE-io/aigne-framework/issues/881)) ([50dbda2](https://github.com/AIGNE-io/aigne-framework/commit/50dbda224bd666d951494d2449779830d8db57fc))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * bump version ([696560f](https://github.com/AIGNE-io/aigne-framework/commit/696560fa2673eddcb4d00ac0523fbbbde7273cb3))
14
+
15
+
16
+ ### Dependencies
17
+
18
+ * The following workspace dependencies were updated
19
+ * dependencies
20
+ * @aigne/platform-helpers bumped to 0.6.7-beta.1
21
+
22
+ ## [1.4.0-beta.6](https://github.com/AIGNE-io/aigne-framework/compare/afs-v1.4.0-beta.5...afs-v1.4.0-beta.6) (2026-01-06)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **afs:** throw errors instead of logging in AFS module operations ([#874](https://github.com/AIGNE-io/aigne-framework/issues/874)) ([f0cc1c4](https://github.com/AIGNE-io/aigne-framework/commit/f0cc1c4056f8b95b631d595892bb12eb75da4b9f))
28
+
3
29
  ## [1.4.0-beta.5](https://github.com/AIGNE-io/aigne-framework/compare/afs-v1.4.0-beta.4...afs-v1.4.0-beta.5) (2025-12-31)
4
30
 
5
31
 
package/lib/cjs/afs.d.ts CHANGED
@@ -31,4 +31,7 @@ export declare class AFS extends Emitter<AFSRootEvents> implements AFSRoot {
31
31
  private buildSimpleListView;
32
32
  private buildTreeView;
33
33
  private buildMetadataSuffix;
34
+ private physicalPath?;
35
+ initializePhysicalPath(): Promise<string>;
36
+ cleanupPhysicalPath(): Promise<void>;
34
37
  }
package/lib/cjs/afs.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AFS = void 0;
4
+ const index_js_1 = require("@aigne/platform-helpers/nodejs/index.js");
5
+ const uuid_1 = require("@aigne/uuid");
4
6
  const strict_event_emitter_1 = require("strict-event-emitter");
5
7
  const ufo_1 = require("ufo");
6
8
  const zod_1 = require("zod");
@@ -82,7 +84,7 @@ class AFS extends strict_event_emitter_1.Emitter {
82
84
  }
83
85
  }
84
86
  catch (error) {
85
- console.error(`Error listing from module at ${matched.modulePath}`, error);
87
+ throw new Error(`Error listing from module at ${matched.modulePath}: ${error.message}`);
86
88
  }
87
89
  }
88
90
  return { data: results };
@@ -196,7 +198,7 @@ class AFS extends strict_event_emitter_1.Emitter {
196
198
  messages.push(message);
197
199
  }
198
200
  catch (error) {
199
- console.error(`Error searching in module at ${modulePath}`, error);
201
+ throw new Error(`Error searching in module at ${modulePath}: ${error.message}`);
200
202
  }
201
203
  }
202
204
  return { data: results, message: messages.join("; ") };
@@ -286,5 +288,25 @@ class AFS extends strict_event_emitter_1.Emitter {
286
288
  const metadataSuffix = metadataParts.length > 0 ? ` [${metadataParts.join(", ")}]` : "";
287
289
  return metadataSuffix;
288
290
  }
291
+ physicalPath;
292
+ async initializePhysicalPath() {
293
+ this.physicalPath ??= (async () => {
294
+ const rootDir = index_js_1.nodejs.path.join(index_js_1.nodejs.os.tmpdir(), (0, uuid_1.v7)());
295
+ await index_js_1.nodejs.fs.mkdir(rootDir, { recursive: true });
296
+ for (const [modulePath, module] of this.modules) {
297
+ const physicalModulePath = index_js_1.nodejs.path.join(rootDir, modulePath);
298
+ await index_js_1.nodejs.fs.mkdir(index_js_1.nodejs.path.dirname(physicalModulePath), { recursive: true });
299
+ await module.symlinkToPhysical?.(physicalModulePath);
300
+ }
301
+ return rootDir;
302
+ })();
303
+ return this.physicalPath;
304
+ }
305
+ async cleanupPhysicalPath() {
306
+ if (this.physicalPath) {
307
+ await index_js_1.nodejs.fs.rm(await this.physicalPath, { recursive: true, force: true });
308
+ this.physicalPath = undefined;
309
+ }
310
+ }
289
311
  }
290
312
  exports.AFS = AFS;
package/lib/cjs/type.d.ts CHANGED
@@ -82,6 +82,7 @@ export interface AFSModule {
82
82
  readonly name: string;
83
83
  readonly description?: string;
84
84
  onMount?(root: AFSRoot): void;
85
+ symlinkToPhysical?(path: string): Promise<void>;
85
86
  list?(path: string, options?: AFSListOptions): Promise<AFSListResult>;
86
87
  read?(path: string, options?: AFSReadOptions): Promise<AFSReadResult>;
87
88
  write?(path: string, content: AFSWriteEntryPayload, options?: AFSWriteOptions): Promise<AFSWriteResult>;
@@ -120,6 +121,8 @@ export interface AFSRootSearchResult extends Omit<AFSSearchResult, "data"> {
120
121
  export interface AFSRoot extends Emitter<AFSRootEvents>, AFSModule {
121
122
  list(path: string, options?: AFSRootListOptions): Promise<AFSRootListResult>;
122
123
  search(path: string, query: string, options: AFSRootSearchOptions): Promise<AFSRootSearchResult>;
124
+ initializePhysicalPath(): Promise<string>;
125
+ cleanupPhysicalPath(): Promise<void>;
123
126
  }
124
127
  export interface AFSEntryMetadata extends Record<string, any> {
125
128
  execute?: {
package/lib/dts/afs.d.ts CHANGED
@@ -31,4 +31,7 @@ export declare class AFS extends Emitter<AFSRootEvents> implements AFSRoot {
31
31
  private buildSimpleListView;
32
32
  private buildTreeView;
33
33
  private buildMetadataSuffix;
34
+ private physicalPath?;
35
+ initializePhysicalPath(): Promise<string>;
36
+ cleanupPhysicalPath(): Promise<void>;
34
37
  }
package/lib/dts/type.d.ts CHANGED
@@ -82,6 +82,7 @@ export interface AFSModule {
82
82
  readonly name: string;
83
83
  readonly description?: string;
84
84
  onMount?(root: AFSRoot): void;
85
+ symlinkToPhysical?(path: string): Promise<void>;
85
86
  list?(path: string, options?: AFSListOptions): Promise<AFSListResult>;
86
87
  read?(path: string, options?: AFSReadOptions): Promise<AFSReadResult>;
87
88
  write?(path: string, content: AFSWriteEntryPayload, options?: AFSWriteOptions): Promise<AFSWriteResult>;
@@ -120,6 +121,8 @@ export interface AFSRootSearchResult extends Omit<AFSSearchResult, "data"> {
120
121
  export interface AFSRoot extends Emitter<AFSRootEvents>, AFSModule {
121
122
  list(path: string, options?: AFSRootListOptions): Promise<AFSRootListResult>;
122
123
  search(path: string, query: string, options: AFSRootSearchOptions): Promise<AFSRootSearchResult>;
124
+ initializePhysicalPath(): Promise<string>;
125
+ cleanupPhysicalPath(): Promise<void>;
123
126
  }
124
127
  export interface AFSEntryMetadata extends Record<string, any> {
125
128
  execute?: {
package/lib/esm/afs.d.ts CHANGED
@@ -31,4 +31,7 @@ export declare class AFS extends Emitter<AFSRootEvents> implements AFSRoot {
31
31
  private buildSimpleListView;
32
32
  private buildTreeView;
33
33
  private buildMetadataSuffix;
34
+ private physicalPath?;
35
+ initializePhysicalPath(): Promise<string>;
36
+ cleanupPhysicalPath(): Promise<void>;
34
37
  }
package/lib/esm/afs.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { nodejs } from "@aigne/platform-helpers/nodejs/index.js";
2
+ import { v7 } from "@aigne/uuid";
1
3
  import { Emitter } from "strict-event-emitter";
2
4
  import { joinURL } from "ufo";
3
5
  import { z } from "zod";
@@ -79,7 +81,7 @@ export class AFS extends Emitter {
79
81
  }
80
82
  }
81
83
  catch (error) {
82
- console.error(`Error listing from module at ${matched.modulePath}`, error);
84
+ throw new Error(`Error listing from module at ${matched.modulePath}: ${error.message}`);
83
85
  }
84
86
  }
85
87
  return { data: results };
@@ -193,7 +195,7 @@ export class AFS extends Emitter {
193
195
  messages.push(message);
194
196
  }
195
197
  catch (error) {
196
- console.error(`Error searching in module at ${modulePath}`, error);
198
+ throw new Error(`Error searching in module at ${modulePath}: ${error.message}`);
197
199
  }
198
200
  }
199
201
  return { data: results, message: messages.join("; ") };
@@ -283,4 +285,24 @@ export class AFS extends Emitter {
283
285
  const metadataSuffix = metadataParts.length > 0 ? ` [${metadataParts.join(", ")}]` : "";
284
286
  return metadataSuffix;
285
287
  }
288
+ physicalPath;
289
+ async initializePhysicalPath() {
290
+ this.physicalPath ??= (async () => {
291
+ const rootDir = nodejs.path.join(nodejs.os.tmpdir(), v7());
292
+ await nodejs.fs.mkdir(rootDir, { recursive: true });
293
+ for (const [modulePath, module] of this.modules) {
294
+ const physicalModulePath = nodejs.path.join(rootDir, modulePath);
295
+ await nodejs.fs.mkdir(nodejs.path.dirname(physicalModulePath), { recursive: true });
296
+ await module.symlinkToPhysical?.(physicalModulePath);
297
+ }
298
+ return rootDir;
299
+ })();
300
+ return this.physicalPath;
301
+ }
302
+ async cleanupPhysicalPath() {
303
+ if (this.physicalPath) {
304
+ await nodejs.fs.rm(await this.physicalPath, { recursive: true, force: true });
305
+ this.physicalPath = undefined;
306
+ }
307
+ }
286
308
  }
package/lib/esm/type.d.ts CHANGED
@@ -82,6 +82,7 @@ export interface AFSModule {
82
82
  readonly name: string;
83
83
  readonly description?: string;
84
84
  onMount?(root: AFSRoot): void;
85
+ symlinkToPhysical?(path: string): Promise<void>;
85
86
  list?(path: string, options?: AFSListOptions): Promise<AFSListResult>;
86
87
  read?(path: string, options?: AFSReadOptions): Promise<AFSReadResult>;
87
88
  write?(path: string, content: AFSWriteEntryPayload, options?: AFSWriteOptions): Promise<AFSWriteResult>;
@@ -120,6 +121,8 @@ export interface AFSRootSearchResult extends Omit<AFSSearchResult, "data"> {
120
121
  export interface AFSRoot extends Emitter<AFSRootEvents>, AFSModule {
121
122
  list(path: string, options?: AFSRootListOptions): Promise<AFSRootListResult>;
122
123
  search(path: string, query: string, options: AFSRootSearchOptions): Promise<AFSRootSearchResult>;
124
+ initializePhysicalPath(): Promise<string>;
125
+ cleanupPhysicalPath(): Promise<void>;
123
126
  }
124
127
  export interface AFSEntryMetadata extends Record<string, any> {
125
128
  execute?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/afs",
3
- "version": "1.4.0-beta.5",
3
+ "version": "1.4.0-beta.7",
4
4
  "description": "Agentic File System (AFS) is a virtual file system that supports various storage backends and provides a unified API for file operations.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -47,9 +47,11 @@
47
47
  }
48
48
  },
49
49
  "dependencies": {
50
+ "@aigne/uuid": "^13.0.1",
50
51
  "strict-event-emitter": "^0.5.1",
51
52
  "ufo": "^1.6.1",
52
- "zod": "^3.25.67"
53
+ "zod": "^3.25.67",
54
+ "@aigne/platform-helpers": "^0.6.7-beta.1"
53
55
  },
54
56
  "devDependencies": {
55
57
  "@types/bun": "^1.2.22",