@aigne/afs-history 1.2.0-beta.8 → 1.2.0
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 +83 -0
- package/lib/cjs/index.d.ts +30 -2
- package/lib/cjs/index.js +29 -2
- package/lib/dts/index.d.ts +30 -2
- package/lib/esm/index.d.ts +30 -2
- package/lib/esm/index.js +29 -2
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,89 @@
|
|
|
6
6
|
* dependencies
|
|
7
7
|
* @aigne/afs bumped to 1.2.0
|
|
8
8
|
|
|
9
|
+
## [1.2.0](https://github.com/AIGNE-io/aigne-framework/compare/afs-history-v1.2.0-beta.12...afs-history-v1.2.0) (2026-01-16)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Dependencies
|
|
13
|
+
|
|
14
|
+
* The following workspace dependencies were updated
|
|
15
|
+
* dependencies
|
|
16
|
+
* @aigne/afs bumped to 1.4.0
|
|
17
|
+
* @aigne/sqlite bumped to 0.4.9
|
|
18
|
+
|
|
19
|
+
## [1.2.0-beta.12](https://github.com/AIGNE-io/aigne-framework/compare/afs-history-v1.2.0-beta.11...afs-history-v1.2.0-beta.12) (2026-01-16)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* add session compact support for AIAgent ([#863](https://github.com/AIGNE-io/aigne-framework/issues/863)) ([9010918](https://github.com/AIGNE-io/aigne-framework/commit/9010918cd3f18b02b5c60ddc9ed5c34b568d0b28))
|
|
25
|
+
* **afs:** add module access control and schema validation support ([#904](https://github.com/AIGNE-io/aigne-framework/issues/904)) ([d0b279a](https://github.com/AIGNE-io/aigne-framework/commit/d0b279aac07ebe2bcc1fd4148498fc3f6bbcd561))
|
|
26
|
+
* **afs:** support expand context into prompt template by call `$afs.xxx` ([#830](https://github.com/AIGNE-io/aigne-framework/issues/830)) ([5616acd](https://github.com/AIGNE-io/aigne-framework/commit/5616acd6ea257c91aa0b766608f45c5ce17f0345))
|
|
27
|
+
* **core:** add cross session user memory support ([#873](https://github.com/AIGNE-io/aigne-framework/issues/873)) ([f377aa1](https://github.com/AIGNE-io/aigne-framework/commit/f377aa17f2cf8004fd3225ade4a37fd90af1292f))
|
|
28
|
+
* **core:** add session history support ([#858](https://github.com/AIGNE-io/aigne-framework/issues/858)) ([28a070e](https://github.com/AIGNE-io/aigne-framework/commit/28a070ed33b821d1fd344b899706d817ca992b9f))
|
|
29
|
+
* support mount mcp agent into AFS ([#740](https://github.com/AIGNE-io/aigne-framework/issues/740)) ([6d474fc](https://github.com/AIGNE-io/aigne-framework/commit/6d474fc05845a15e2c3e8fa97727b409bdd70945))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* **afs:** support read binary file as base64 string ([3480f9f](https://github.com/AIGNE-io/aigne-framework/commit/3480f9fe90647eba3bf2ff37e22c334599b72e35))
|
|
35
|
+
* bump version ([696560f](https://github.com/AIGNE-io/aigne-framework/commit/696560fa2673eddcb4d00ac0523fbbbde7273cb3))
|
|
36
|
+
* bump version ([70d217c](https://github.com/AIGNE-io/aigne-framework/commit/70d217c8360dd0dda7f5f17011c4e92ec836e801))
|
|
37
|
+
* bump version ([af04b69](https://github.com/AIGNE-io/aigne-framework/commit/af04b6931951afa35d52065430acc7fef4b10087))
|
|
38
|
+
* bump version ([ba7ad18](https://github.com/AIGNE-io/aigne-framework/commit/ba7ad184fcf32b49bf0507a3cb638d20fb00690d))
|
|
39
|
+
* bump version ([93a1c10](https://github.com/AIGNE-io/aigne-framework/commit/93a1c10cf35f88eaafe91092481f5d087bd5b3a9))
|
|
40
|
+
* improve test coverage tracking and reporting ([#903](https://github.com/AIGNE-io/aigne-framework/issues/903)) ([031144e](https://github.com/AIGNE-io/aigne-framework/commit/031144e74f29e882cffe52ffda8f7a18c76ace7f))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Dependencies
|
|
44
|
+
|
|
45
|
+
* The following workspace dependencies were updated
|
|
46
|
+
* dependencies
|
|
47
|
+
* @aigne/afs bumped to 1.4.0-beta.11
|
|
48
|
+
|
|
49
|
+
## [1.2.0-beta.11](https://github.com/AIGNE-io/aigne-framework/compare/afs-history-v1.2.0-beta.10...afs-history-v1.2.0-beta.11) (2026-01-16)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Bug Fixes
|
|
53
|
+
|
|
54
|
+
* **afs:** support read binary file as base64 string ([3480f9f](https://github.com/AIGNE-io/aigne-framework/commit/3480f9fe90647eba3bf2ff37e22c334599b72e35))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Dependencies
|
|
58
|
+
|
|
59
|
+
* The following workspace dependencies were updated
|
|
60
|
+
* dependencies
|
|
61
|
+
* @aigne/afs bumped to 1.4.0-beta.10
|
|
62
|
+
|
|
63
|
+
## [1.2.0-beta.10](https://github.com/AIGNE-io/aigne-framework/compare/afs-history-v1.2.0-beta.9...afs-history-v1.2.0-beta.10) (2026-01-14)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Features
|
|
67
|
+
|
|
68
|
+
* **afs:** add module access control and schema validation support ([#904](https://github.com/AIGNE-io/aigne-framework/issues/904)) ([d0b279a](https://github.com/AIGNE-io/aigne-framework/commit/d0b279aac07ebe2bcc1fd4148498fc3f6bbcd561))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Bug Fixes
|
|
72
|
+
|
|
73
|
+
* improve test coverage tracking and reporting ([#903](https://github.com/AIGNE-io/aigne-framework/issues/903)) ([031144e](https://github.com/AIGNE-io/aigne-framework/commit/031144e74f29e882cffe52ffda8f7a18c76ace7f))
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Dependencies
|
|
77
|
+
|
|
78
|
+
* The following workspace dependencies were updated
|
|
79
|
+
* dependencies
|
|
80
|
+
* @aigne/afs bumped to 1.4.0-beta.9
|
|
81
|
+
* @aigne/sqlite bumped to 0.4.9-beta.2
|
|
82
|
+
|
|
83
|
+
## [1.2.0-beta.9](https://github.com/AIGNE-io/aigne-framework/compare/afs-history-v1.2.0-beta.8...afs-history-v1.2.0-beta.9) (2026-01-12)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### Dependencies
|
|
87
|
+
|
|
88
|
+
* The following workspace dependencies were updated
|
|
89
|
+
* dependencies
|
|
90
|
+
* @aigne/afs bumped to 1.4.0-beta.8
|
|
91
|
+
|
|
9
92
|
## [1.2.0-beta.8](https://github.com/AIGNE-io/aigne-framework/compare/afs-history-v1.2.0-beta.7...afs-history-v1.2.0-beta.8) (2026-01-08)
|
|
10
93
|
|
|
11
94
|
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,12 +1,40 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AFSAccessMode, type AFSDeleteOptions, type AFSDeleteResult, type AFSListOptions, type AFSListResult, type AFSModule, type AFSModuleLoadParams, type AFSReadOptions, type AFSReadResult, type AFSRoot, type AFSWriteEntryPayload, type AFSWriteOptions, type AFSWriteResult } from "@aigne/afs";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
import { SharedAFSStorage, type SharedAFSStorageOptions } from "./storage/index.js";
|
|
3
4
|
export * from "./storage/index.js";
|
|
4
5
|
export interface AFSHistoryOptions {
|
|
5
6
|
storage?: SharedAFSStorage | SharedAFSStorageOptions;
|
|
7
|
+
/**
|
|
8
|
+
* Access mode for this module.
|
|
9
|
+
* @default "readwrite"
|
|
10
|
+
*/
|
|
11
|
+
accessMode?: AFSAccessMode;
|
|
6
12
|
}
|
|
7
13
|
export declare class AFSHistory implements AFSModule {
|
|
14
|
+
static schema(): z.ZodObject<{
|
|
15
|
+
storage: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
url: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
url?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
url?: string | undefined;
|
|
21
|
+
}>>;
|
|
22
|
+
accessMode: z.ZodOptional<z.ZodEnum<["readonly", "readwrite"]>>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
storage?: {
|
|
25
|
+
url?: string | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
accessMode?: "readonly" | "readwrite" | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
storage?: {
|
|
30
|
+
url?: string | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
accessMode?: "readonly" | "readwrite" | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
static load({ parsed }: AFSModuleLoadParams): Promise<AFSHistory>;
|
|
8
35
|
constructor(options?: AFSHistoryOptions);
|
|
9
36
|
readonly name: string;
|
|
37
|
+
readonly accessMode: AFSAccessMode;
|
|
10
38
|
private storage;
|
|
11
39
|
private afs?;
|
|
12
40
|
private router;
|
|
@@ -14,7 +42,7 @@ export declare class AFSHistory implements AFSModule {
|
|
|
14
42
|
onMount(afs: AFSRoot): void;
|
|
15
43
|
list(path: string, options?: AFSListOptions): Promise<AFSListResult>;
|
|
16
44
|
read(path: string, options?: AFSReadOptions): Promise<AFSReadResult>;
|
|
17
|
-
write(path: string, content: AFSWriteEntryPayload): Promise<AFSWriteResult>;
|
|
45
|
+
write(path: string, content: AFSWriteEntryPayload, options: AFSWriteOptions): Promise<AFSWriteResult>;
|
|
18
46
|
delete(path: string, _options?: AFSDeleteOptions): Promise<AFSDeleteResult>;
|
|
19
47
|
private normalizePath;
|
|
20
48
|
}
|
package/lib/cjs/index.js
CHANGED
|
@@ -15,19 +15,42 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.AFSHistory = void 0;
|
|
18
|
+
const afs_1 = require("@aigne/afs");
|
|
18
19
|
const uuid_1 = require("@aigne/uuid");
|
|
19
20
|
const radix3_1 = require("radix3");
|
|
20
21
|
const ufo_1 = require("ufo");
|
|
22
|
+
const zod_1 = require("zod");
|
|
21
23
|
const index_js_1 = require("./storage/index.js");
|
|
22
24
|
__exportStar(require("./storage/index.js"), exports);
|
|
25
|
+
const sharedAFSStorageOptionsSchema = zod_1.z.object({
|
|
26
|
+
url: zod_1.z.string().describe("Database URL for storage").optional(),
|
|
27
|
+
});
|
|
28
|
+
const afsHistoryOptionsSchema = preprocessSchema((v) => {
|
|
29
|
+
if (!v || typeof v !== "object") {
|
|
30
|
+
return v;
|
|
31
|
+
}
|
|
32
|
+
return { ...v, accessMode: v.accessMode || v.access_mode };
|
|
33
|
+
}, zod_1.z.object({
|
|
34
|
+
storage: sharedAFSStorageOptionsSchema.optional(),
|
|
35
|
+
accessMode: afs_1.accessModeSchema,
|
|
36
|
+
}));
|
|
23
37
|
class AFSHistory {
|
|
38
|
+
static schema() {
|
|
39
|
+
return afsHistoryOptionsSchema;
|
|
40
|
+
}
|
|
41
|
+
static async load({ parsed }) {
|
|
42
|
+
const valid = await AFSHistory.schema().parseAsync(parsed);
|
|
43
|
+
return new AFSHistory(valid);
|
|
44
|
+
}
|
|
24
45
|
constructor(options) {
|
|
25
46
|
this.storage =
|
|
26
47
|
options?.storage instanceof index_js_1.SharedAFSStorage
|
|
27
48
|
? options.storage.withModule(this)
|
|
28
49
|
: new index_js_1.SharedAFSStorage(options?.storage).withModule(this);
|
|
50
|
+
this.accessMode = options?.accessMode ?? "readwrite";
|
|
29
51
|
}
|
|
30
52
|
name = "history";
|
|
53
|
+
accessMode;
|
|
31
54
|
storage;
|
|
32
55
|
afs;
|
|
33
56
|
router = (0, radix3_1.createRouter)({
|
|
@@ -176,7 +199,7 @@ class AFSHistory {
|
|
|
176
199
|
},
|
|
177
200
|
};
|
|
178
201
|
}
|
|
179
|
-
async write(path, content) {
|
|
202
|
+
async write(path, content, options) {
|
|
180
203
|
const id = (0, uuid_1.v7)();
|
|
181
204
|
const match = this.router.lookup(path);
|
|
182
205
|
if (!match || match.action !== "create") {
|
|
@@ -197,7 +220,7 @@ class AFSHistory {
|
|
|
197
220
|
}, { type, scope });
|
|
198
221
|
// Emit event for history entries
|
|
199
222
|
if (type === "history") {
|
|
200
|
-
this.afs?.emit("historyCreated", { entry });
|
|
223
|
+
this.afs?.emit("historyCreated", { entry }, options);
|
|
201
224
|
}
|
|
202
225
|
return {
|
|
203
226
|
data: {
|
|
@@ -252,3 +275,7 @@ class AFSHistory {
|
|
|
252
275
|
}
|
|
253
276
|
}
|
|
254
277
|
exports.AFSHistory = AFSHistory;
|
|
278
|
+
const _typeCheck = AFSHistory;
|
|
279
|
+
function preprocessSchema(fn, schema) {
|
|
280
|
+
return zod_1.z.preprocess(fn, schema);
|
|
281
|
+
}
|
package/lib/dts/index.d.ts
CHANGED
|
@@ -1,12 +1,40 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AFSAccessMode, type AFSDeleteOptions, type AFSDeleteResult, type AFSListOptions, type AFSListResult, type AFSModule, type AFSModuleLoadParams, type AFSReadOptions, type AFSReadResult, type AFSRoot, type AFSWriteEntryPayload, type AFSWriteOptions, type AFSWriteResult } from "@aigne/afs";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
import { SharedAFSStorage, type SharedAFSStorageOptions } from "./storage/index.js";
|
|
3
4
|
export * from "./storage/index.js";
|
|
4
5
|
export interface AFSHistoryOptions {
|
|
5
6
|
storage?: SharedAFSStorage | SharedAFSStorageOptions;
|
|
7
|
+
/**
|
|
8
|
+
* Access mode for this module.
|
|
9
|
+
* @default "readwrite"
|
|
10
|
+
*/
|
|
11
|
+
accessMode?: AFSAccessMode;
|
|
6
12
|
}
|
|
7
13
|
export declare class AFSHistory implements AFSModule {
|
|
14
|
+
static schema(): z.ZodObject<{
|
|
15
|
+
storage: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
url: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
url?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
url?: string | undefined;
|
|
21
|
+
}>>;
|
|
22
|
+
accessMode: z.ZodOptional<z.ZodEnum<["readonly", "readwrite"]>>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
storage?: {
|
|
25
|
+
url?: string | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
accessMode?: "readonly" | "readwrite" | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
storage?: {
|
|
30
|
+
url?: string | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
accessMode?: "readonly" | "readwrite" | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
static load({ parsed }: AFSModuleLoadParams): Promise<AFSHistory>;
|
|
8
35
|
constructor(options?: AFSHistoryOptions);
|
|
9
36
|
readonly name: string;
|
|
37
|
+
readonly accessMode: AFSAccessMode;
|
|
10
38
|
private storage;
|
|
11
39
|
private afs?;
|
|
12
40
|
private router;
|
|
@@ -14,7 +42,7 @@ export declare class AFSHistory implements AFSModule {
|
|
|
14
42
|
onMount(afs: AFSRoot): void;
|
|
15
43
|
list(path: string, options?: AFSListOptions): Promise<AFSListResult>;
|
|
16
44
|
read(path: string, options?: AFSReadOptions): Promise<AFSReadResult>;
|
|
17
|
-
write(path: string, content: AFSWriteEntryPayload): Promise<AFSWriteResult>;
|
|
45
|
+
write(path: string, content: AFSWriteEntryPayload, options: AFSWriteOptions): Promise<AFSWriteResult>;
|
|
18
46
|
delete(path: string, _options?: AFSDeleteOptions): Promise<AFSDeleteResult>;
|
|
19
47
|
private normalizePath;
|
|
20
48
|
}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,12 +1,40 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AFSAccessMode, type AFSDeleteOptions, type AFSDeleteResult, type AFSListOptions, type AFSListResult, type AFSModule, type AFSModuleLoadParams, type AFSReadOptions, type AFSReadResult, type AFSRoot, type AFSWriteEntryPayload, type AFSWriteOptions, type AFSWriteResult } from "@aigne/afs";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
import { SharedAFSStorage, type SharedAFSStorageOptions } from "./storage/index.js";
|
|
3
4
|
export * from "./storage/index.js";
|
|
4
5
|
export interface AFSHistoryOptions {
|
|
5
6
|
storage?: SharedAFSStorage | SharedAFSStorageOptions;
|
|
7
|
+
/**
|
|
8
|
+
* Access mode for this module.
|
|
9
|
+
* @default "readwrite"
|
|
10
|
+
*/
|
|
11
|
+
accessMode?: AFSAccessMode;
|
|
6
12
|
}
|
|
7
13
|
export declare class AFSHistory implements AFSModule {
|
|
14
|
+
static schema(): z.ZodObject<{
|
|
15
|
+
storage: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
url: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
url?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
url?: string | undefined;
|
|
21
|
+
}>>;
|
|
22
|
+
accessMode: z.ZodOptional<z.ZodEnum<["readonly", "readwrite"]>>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
storage?: {
|
|
25
|
+
url?: string | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
accessMode?: "readonly" | "readwrite" | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
storage?: {
|
|
30
|
+
url?: string | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
accessMode?: "readonly" | "readwrite" | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
static load({ parsed }: AFSModuleLoadParams): Promise<AFSHistory>;
|
|
8
35
|
constructor(options?: AFSHistoryOptions);
|
|
9
36
|
readonly name: string;
|
|
37
|
+
readonly accessMode: AFSAccessMode;
|
|
10
38
|
private storage;
|
|
11
39
|
private afs?;
|
|
12
40
|
private router;
|
|
@@ -14,7 +42,7 @@ export declare class AFSHistory implements AFSModule {
|
|
|
14
42
|
onMount(afs: AFSRoot): void;
|
|
15
43
|
list(path: string, options?: AFSListOptions): Promise<AFSListResult>;
|
|
16
44
|
read(path: string, options?: AFSReadOptions): Promise<AFSReadResult>;
|
|
17
|
-
write(path: string, content: AFSWriteEntryPayload): Promise<AFSWriteResult>;
|
|
45
|
+
write(path: string, content: AFSWriteEntryPayload, options: AFSWriteOptions): Promise<AFSWriteResult>;
|
|
18
46
|
delete(path: string, _options?: AFSDeleteOptions): Promise<AFSDeleteResult>;
|
|
19
47
|
private normalizePath;
|
|
20
48
|
}
|
package/lib/esm/index.js
CHANGED
|
@@ -1,16 +1,39 @@
|
|
|
1
|
+
import { accessModeSchema, } from "@aigne/afs";
|
|
1
2
|
import { v7 } from "@aigne/uuid";
|
|
2
3
|
import { createRouter } from "radix3";
|
|
3
4
|
import { joinURL } from "ufo";
|
|
5
|
+
import { z } from "zod";
|
|
4
6
|
import { SharedAFSStorage, } from "./storage/index.js";
|
|
5
7
|
export * from "./storage/index.js";
|
|
8
|
+
const sharedAFSStorageOptionsSchema = z.object({
|
|
9
|
+
url: z.string().describe("Database URL for storage").optional(),
|
|
10
|
+
});
|
|
11
|
+
const afsHistoryOptionsSchema = preprocessSchema((v) => {
|
|
12
|
+
if (!v || typeof v !== "object") {
|
|
13
|
+
return v;
|
|
14
|
+
}
|
|
15
|
+
return { ...v, accessMode: v.accessMode || v.access_mode };
|
|
16
|
+
}, z.object({
|
|
17
|
+
storage: sharedAFSStorageOptionsSchema.optional(),
|
|
18
|
+
accessMode: accessModeSchema,
|
|
19
|
+
}));
|
|
6
20
|
export class AFSHistory {
|
|
21
|
+
static schema() {
|
|
22
|
+
return afsHistoryOptionsSchema;
|
|
23
|
+
}
|
|
24
|
+
static async load({ parsed }) {
|
|
25
|
+
const valid = await AFSHistory.schema().parseAsync(parsed);
|
|
26
|
+
return new AFSHistory(valid);
|
|
27
|
+
}
|
|
7
28
|
constructor(options) {
|
|
8
29
|
this.storage =
|
|
9
30
|
options?.storage instanceof SharedAFSStorage
|
|
10
31
|
? options.storage.withModule(this)
|
|
11
32
|
: new SharedAFSStorage(options?.storage).withModule(this);
|
|
33
|
+
this.accessMode = options?.accessMode ?? "readwrite";
|
|
12
34
|
}
|
|
13
35
|
name = "history";
|
|
36
|
+
accessMode;
|
|
14
37
|
storage;
|
|
15
38
|
afs;
|
|
16
39
|
router = createRouter({
|
|
@@ -159,7 +182,7 @@ export class AFSHistory {
|
|
|
159
182
|
},
|
|
160
183
|
};
|
|
161
184
|
}
|
|
162
|
-
async write(path, content) {
|
|
185
|
+
async write(path, content, options) {
|
|
163
186
|
const id = v7();
|
|
164
187
|
const match = this.router.lookup(path);
|
|
165
188
|
if (!match || match.action !== "create") {
|
|
@@ -180,7 +203,7 @@ export class AFSHistory {
|
|
|
180
203
|
}, { type, scope });
|
|
181
204
|
// Emit event for history entries
|
|
182
205
|
if (type === "history") {
|
|
183
|
-
this.afs?.emit("historyCreated", { entry });
|
|
206
|
+
this.afs?.emit("historyCreated", { entry }, options);
|
|
184
207
|
}
|
|
185
208
|
return {
|
|
186
209
|
data: {
|
|
@@ -234,3 +257,7 @@ export class AFSHistory {
|
|
|
234
257
|
return joinURL("/", prefix, scopeId, entry.id);
|
|
235
258
|
}
|
|
236
259
|
}
|
|
260
|
+
const _typeCheck = AFSHistory;
|
|
261
|
+
function preprocessSchema(fn, schema) {
|
|
262
|
+
return z.preprocess(fn, schema);
|
|
263
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/afs-history",
|
|
3
|
-
"version": "1.2.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "AIGNE AFS module for managing chat history",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -50,8 +50,9 @@
|
|
|
50
50
|
"@aigne/uuid": "^13.0.1",
|
|
51
51
|
"radix3": "^1.1.2",
|
|
52
52
|
"ufo": "^1.6.1",
|
|
53
|
-
"
|
|
54
|
-
"@aigne/afs": "^1.4.0
|
|
53
|
+
"zod": "^3.25.67",
|
|
54
|
+
"@aigne/afs": "^1.4.0",
|
|
55
|
+
"@aigne/sqlite": "^0.4.9"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@types/bun": "^1.2.22",
|