@aigne/core 1.71.0 → 1.72.0-beta.10
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 +158 -0
- package/lib/cjs/agents/agent.d.ts +42 -29
- package/lib/cjs/agents/agent.js +32 -11
- package/lib/cjs/agents/ai-agent.d.ts +63 -4
- package/lib/cjs/agents/ai-agent.js +148 -20
- package/lib/cjs/agents/chat-model.d.ts +162 -0
- package/lib/cjs/agents/chat-model.js +56 -5
- package/lib/cjs/agents/image-agent.d.ts +17 -1
- package/lib/cjs/agents/image-agent.js +16 -0
- package/lib/cjs/agents/image-model.d.ts +17 -2
- package/lib/cjs/agents/image-model.js +2 -0
- package/lib/cjs/agents/mcp-agent.d.ts +17 -0
- package/lib/cjs/agents/mcp-agent.js +18 -0
- package/lib/cjs/agents/team-agent.d.ts +55 -0
- package/lib/cjs/agents/team-agent.js +31 -0
- package/lib/cjs/agents/transform-agent.d.ts +12 -0
- package/lib/cjs/agents/transform-agent.js +13 -0
- package/lib/cjs/agents/video-model.d.ts +15 -0
- package/lib/cjs/agents/video-model.js +2 -0
- package/lib/cjs/aigne/usage.d.ts +5 -0
- package/lib/cjs/aigne/usage.js +6 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/loader/agent-yaml.d.ts +27 -64
- package/lib/cjs/loader/agent-yaml.js +22 -129
- package/lib/cjs/loader/agents.d.ts +4 -0
- package/lib/cjs/loader/agents.js +17 -0
- package/lib/cjs/loader/index.d.ts +16 -12
- package/lib/cjs/loader/index.js +46 -82
- package/lib/cjs/loader/schema.d.ts +21 -6
- package/lib/cjs/loader/schema.js +60 -1
- package/lib/cjs/memory/recorder.d.ts +4 -4
- package/lib/cjs/memory/retriever.d.ts +4 -4
- package/lib/cjs/prompt/agent-session.d.ts +135 -0
- package/lib/cjs/prompt/agent-session.js +889 -0
- package/lib/cjs/prompt/compact/compactor.d.ts +7 -0
- package/lib/cjs/prompt/compact/compactor.js +48 -0
- package/lib/cjs/prompt/compact/session-memory-extractor.d.ts +7 -0
- package/lib/cjs/prompt/compact/session-memory-extractor.js +139 -0
- package/lib/cjs/prompt/compact/types.d.ts +329 -0
- package/lib/cjs/prompt/compact/types.js +53 -0
- package/lib/cjs/prompt/compact/user-memory-extractor.d.ts +7 -0
- package/lib/cjs/prompt/compact/user-memory-extractor.js +120 -0
- package/lib/cjs/prompt/context/afs/history.d.ts +9 -0
- package/lib/cjs/prompt/context/afs/history.js +33 -0
- package/lib/cjs/prompt/context/afs/index.d.ts +20 -0
- package/lib/cjs/prompt/context/afs/index.js +54 -0
- package/lib/cjs/prompt/context/index.d.ts +31 -0
- package/lib/cjs/prompt/context/index.js +18 -0
- package/lib/cjs/prompt/prompt-builder.d.ts +11 -9
- package/lib/cjs/prompt/prompt-builder.js +81 -151
- package/lib/cjs/prompt/skills/afs/agent-skill/agent-skill.d.ts +18 -0
- package/lib/cjs/prompt/skills/afs/agent-skill/agent-skill.js +69 -0
- package/lib/cjs/prompt/skills/afs/agent-skill/skill-loader.d.ts +13 -0
- package/lib/cjs/prompt/skills/afs/agent-skill/skill-loader.js +62 -0
- package/lib/cjs/prompt/skills/afs/base.d.ts +4 -0
- package/lib/cjs/prompt/skills/afs/base.js +8 -0
- package/lib/cjs/prompt/skills/afs/delete.d.ts +3 -2
- package/lib/cjs/prompt/skills/afs/delete.js +17 -5
- package/lib/cjs/prompt/skills/afs/edit.d.ts +9 -11
- package/lib/cjs/prompt/skills/afs/edit.js +89 -63
- package/lib/cjs/prompt/skills/afs/exec.d.ts +4 -3
- package/lib/cjs/prompt/skills/afs/exec.js +23 -7
- package/lib/cjs/prompt/skills/afs/index.js +4 -1
- package/lib/cjs/prompt/skills/afs/list.d.ts +4 -4
- package/lib/cjs/prompt/skills/afs/list.js +38 -55
- package/lib/cjs/prompt/skills/afs/read.d.ts +10 -5
- package/lib/cjs/prompt/skills/afs/read.js +66 -19
- package/lib/cjs/prompt/skills/afs/rename.d.ts +3 -2
- package/lib/cjs/prompt/skills/afs/rename.js +20 -6
- package/lib/cjs/prompt/skills/afs/search.d.ts +4 -3
- package/lib/cjs/prompt/skills/afs/search.js +24 -8
- package/lib/cjs/prompt/skills/afs/write.d.ts +3 -2
- package/lib/cjs/prompt/skills/afs/write.js +22 -8
- package/lib/cjs/prompt/template.d.ts +84 -9
- package/lib/cjs/prompt/template.js +46 -17
- package/lib/dts/agents/agent.d.ts +42 -29
- package/lib/dts/agents/ai-agent.d.ts +63 -4
- package/lib/dts/agents/chat-model.d.ts +162 -0
- package/lib/dts/agents/image-agent.d.ts +17 -1
- package/lib/dts/agents/image-model.d.ts +17 -2
- package/lib/dts/agents/mcp-agent.d.ts +17 -0
- package/lib/dts/agents/team-agent.d.ts +55 -0
- package/lib/dts/agents/transform-agent.d.ts +12 -0
- package/lib/dts/agents/video-model.d.ts +15 -0
- package/lib/dts/aigne/context.d.ts +2 -2
- package/lib/dts/aigne/usage.d.ts +5 -0
- package/lib/dts/index.d.ts +1 -0
- package/lib/dts/loader/agent-yaml.d.ts +27 -64
- package/lib/dts/loader/agents.d.ts +4 -0
- package/lib/dts/loader/index.d.ts +16 -12
- package/lib/dts/loader/schema.d.ts +21 -6
- package/lib/dts/memory/recorder.d.ts +4 -4
- package/lib/dts/memory/retriever.d.ts +4 -4
- package/lib/dts/prompt/agent-session.d.ts +135 -0
- package/lib/dts/prompt/compact/compactor.d.ts +7 -0
- package/lib/dts/prompt/compact/session-memory-extractor.d.ts +7 -0
- package/lib/dts/prompt/compact/types.d.ts +329 -0
- package/lib/dts/prompt/compact/user-memory-extractor.d.ts +7 -0
- package/lib/dts/prompt/context/afs/history.d.ts +9 -0
- package/lib/dts/prompt/context/afs/index.d.ts +20 -0
- package/lib/dts/prompt/context/index.d.ts +31 -0
- package/lib/dts/prompt/prompt-builder.d.ts +11 -9
- package/lib/dts/prompt/skills/afs/agent-skill/agent-skill.d.ts +18 -0
- package/lib/dts/prompt/skills/afs/agent-skill/skill-loader.d.ts +13 -0
- package/lib/dts/prompt/skills/afs/base.d.ts +4 -0
- package/lib/dts/prompt/skills/afs/delete.d.ts +3 -2
- package/lib/dts/prompt/skills/afs/edit.d.ts +9 -11
- package/lib/dts/prompt/skills/afs/exec.d.ts +4 -3
- package/lib/dts/prompt/skills/afs/list.d.ts +4 -4
- package/lib/dts/prompt/skills/afs/read.d.ts +10 -5
- package/lib/dts/prompt/skills/afs/rename.d.ts +3 -2
- package/lib/dts/prompt/skills/afs/search.d.ts +4 -3
- package/lib/dts/prompt/skills/afs/write.d.ts +3 -2
- package/lib/dts/prompt/template.d.ts +84 -9
- package/lib/esm/agents/agent.d.ts +42 -29
- package/lib/esm/agents/agent.js +32 -11
- package/lib/esm/agents/ai-agent.d.ts +63 -4
- package/lib/esm/agents/ai-agent.js +148 -20
- package/lib/esm/agents/chat-model.d.ts +162 -0
- package/lib/esm/agents/chat-model.js +55 -4
- package/lib/esm/agents/image-agent.d.ts +17 -1
- package/lib/esm/agents/image-agent.js +16 -0
- package/lib/esm/agents/image-model.d.ts +17 -2
- package/lib/esm/agents/image-model.js +2 -0
- package/lib/esm/agents/mcp-agent.d.ts +17 -0
- package/lib/esm/agents/mcp-agent.js +18 -0
- package/lib/esm/agents/team-agent.d.ts +55 -0
- package/lib/esm/agents/team-agent.js +31 -0
- package/lib/esm/agents/transform-agent.d.ts +12 -0
- package/lib/esm/agents/transform-agent.js +13 -0
- package/lib/esm/agents/video-model.d.ts +15 -0
- package/lib/esm/agents/video-model.js +2 -0
- package/lib/esm/aigne/context.d.ts +2 -2
- package/lib/esm/aigne/usage.d.ts +5 -0
- package/lib/esm/aigne/usage.js +6 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/loader/agent-yaml.d.ts +27 -64
- package/lib/esm/loader/agent-yaml.js +22 -128
- package/lib/esm/loader/agents.d.ts +4 -0
- package/lib/esm/loader/agents.js +14 -0
- package/lib/esm/loader/index.d.ts +16 -12
- package/lib/esm/loader/index.js +47 -82
- package/lib/esm/loader/schema.d.ts +21 -6
- package/lib/esm/loader/schema.js +57 -0
- package/lib/esm/memory/recorder.d.ts +4 -4
- package/lib/esm/memory/retriever.d.ts +4 -4
- package/lib/esm/prompt/agent-session.d.ts +135 -0
- package/lib/esm/prompt/agent-session.js +849 -0
- package/lib/esm/prompt/compact/compactor.d.ts +7 -0
- package/lib/esm/prompt/compact/compactor.js +44 -0
- package/lib/esm/prompt/compact/session-memory-extractor.d.ts +7 -0
- package/lib/esm/prompt/compact/session-memory-extractor.js +135 -0
- package/lib/esm/prompt/compact/types.d.ts +329 -0
- package/lib/esm/prompt/compact/types.js +50 -0
- package/lib/esm/prompt/compact/user-memory-extractor.d.ts +7 -0
- package/lib/esm/prompt/compact/user-memory-extractor.js +116 -0
- package/lib/esm/prompt/context/afs/history.d.ts +9 -0
- package/lib/esm/prompt/context/afs/history.js +30 -0
- package/lib/esm/prompt/context/afs/index.d.ts +20 -0
- package/lib/esm/prompt/context/afs/index.js +51 -0
- package/lib/esm/prompt/context/index.d.ts +31 -0
- package/lib/esm/prompt/context/index.js +15 -0
- package/lib/esm/prompt/prompt-builder.d.ts +11 -9
- package/lib/esm/prompt/prompt-builder.js +80 -150
- package/lib/esm/prompt/skills/afs/agent-skill/agent-skill.d.ts +18 -0
- package/lib/esm/prompt/skills/afs/agent-skill/agent-skill.js +65 -0
- package/lib/esm/prompt/skills/afs/agent-skill/skill-loader.d.ts +13 -0
- package/lib/esm/prompt/skills/afs/agent-skill/skill-loader.js +54 -0
- package/lib/esm/prompt/skills/afs/base.d.ts +4 -0
- package/lib/esm/prompt/skills/afs/base.js +4 -0
- package/lib/esm/prompt/skills/afs/delete.d.ts +3 -2
- package/lib/esm/prompt/skills/afs/delete.js +17 -5
- package/lib/esm/prompt/skills/afs/edit.d.ts +9 -11
- package/lib/esm/prompt/skills/afs/edit.js +89 -63
- package/lib/esm/prompt/skills/afs/exec.d.ts +4 -3
- package/lib/esm/prompt/skills/afs/exec.js +23 -7
- package/lib/esm/prompt/skills/afs/index.js +4 -1
- package/lib/esm/prompt/skills/afs/list.d.ts +4 -4
- package/lib/esm/prompt/skills/afs/list.js +38 -55
- package/lib/esm/prompt/skills/afs/read.d.ts +10 -5
- package/lib/esm/prompt/skills/afs/read.js +66 -19
- package/lib/esm/prompt/skills/afs/rename.d.ts +3 -2
- package/lib/esm/prompt/skills/afs/rename.js +20 -6
- package/lib/esm/prompt/skills/afs/search.d.ts +4 -3
- package/lib/esm/prompt/skills/afs/search.js +24 -8
- package/lib/esm/prompt/skills/afs/write.d.ts +3 -2
- package/lib/esm/prompt/skills/afs/write.js +22 -8
- package/lib/esm/prompt/template.d.ts +84 -9
- package/lib/esm/prompt/template.js +46 -17
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,163 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.72.0-beta.10](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.72.0-beta.9...core-v1.72.0-beta.10) (2026-01-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **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))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **core:** compact current turn messages ([#871](https://github.com/AIGNE-io/aigne-framework/issues/871)) ([08c19d7](https://github.com/AIGNE-io/aigne-framework/commit/08c19d7651fb0ff0a0f7faa347746cf62b34f1f5))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Dependencies
|
|
17
|
+
|
|
18
|
+
* The following workspace dependencies were updated
|
|
19
|
+
* dependencies
|
|
20
|
+
* @aigne/afs-history bumped to 1.2.0-beta.6
|
|
21
|
+
|
|
22
|
+
## [1.72.0-beta.9](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.72.0-beta.8...core-v1.72.0-beta.9) (2026-01-02)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **cli:** add run-skill command ([#868](https://github.com/AIGNE-io/aigne-framework/issues/868)) ([f62ffe2](https://github.com/AIGNE-io/aigne-framework/commit/f62ffe21acc49ec1a68349fbb35a13d0fadd239a))
|
|
28
|
+
|
|
29
|
+
## [1.72.0-beta.8](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.72.0-beta.7...core-v1.72.0-beta.8) (2025-12-31)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* 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))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* **core:** ensure data consistency in async compact mode and load all history entries ([25c7840](https://github.com/AIGNE-io/aigne-framework/commit/25c78406b48f8789a19d59b6d2c82ff859f0113b))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Dependencies
|
|
43
|
+
|
|
44
|
+
* The following workspace dependencies were updated
|
|
45
|
+
* dependencies
|
|
46
|
+
* @aigne/afs bumped to 1.4.0-beta.5
|
|
47
|
+
* @aigne/afs-history bumped to 1.2.0-beta.5
|
|
48
|
+
|
|
49
|
+
## [1.72.0-beta.7](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.72.0-beta.6...core-v1.72.0-beta.7) (2025-12-26)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Features
|
|
53
|
+
|
|
54
|
+
* **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))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Dependencies
|
|
58
|
+
|
|
59
|
+
* The following workspace dependencies were updated
|
|
60
|
+
* dependencies
|
|
61
|
+
* @aigne/afs bumped to 1.4.0-beta.4
|
|
62
|
+
* @aigne/afs-history bumped to 1.2.0-beta.4
|
|
63
|
+
|
|
64
|
+
## [1.72.0-beta.6](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.72.0-beta.5...core-v1.72.0-beta.6) (2025-12-25)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Bug Fixes
|
|
68
|
+
|
|
69
|
+
* **core:** passthrough model options in chat model ([#856](https://github.com/AIGNE-io/aigne-framework/issues/856)) ([41387bd](https://github.com/AIGNE-io/aigne-framework/commit/41387bde0a615080ea5d665e998afb0b9c32c5fd))
|
|
70
|
+
|
|
71
|
+
## [1.72.0-beta.5](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.72.0-beta.4...core-v1.72.0-beta.5) (2025-12-25)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
### Bug Fixes
|
|
75
|
+
|
|
76
|
+
* **core:** afs skills improvements ([#849](https://github.com/AIGNE-io/aigne-framework/issues/849)) ([557cc8b](https://github.com/AIGNE-io/aigne-framework/commit/557cc8b4b72f0e91ad654556f47bbe0ad0ececdb))
|
|
77
|
+
|
|
78
|
+
## [1.72.0-beta.4](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.72.0-beta.3...core-v1.72.0-beta.4) (2025-12-24)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Features
|
|
82
|
+
|
|
83
|
+
* add Agent Skill support ([#787](https://github.com/AIGNE-io/aigne-framework/issues/787)) ([f04fbe7](https://github.com/AIGNE-io/aigne-framework/commit/f04fbe76ec24cf3c59c74adf92d87b0c3784a8f7))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### Bug Fixes
|
|
87
|
+
|
|
88
|
+
* **cli:** improve terminal outputs ([#847](https://github.com/AIGNE-io/aigne-framework/issues/847)) ([329e91b](https://github.com/AIGNE-io/aigne-framework/commit/329e91bc3323f72fc8a2d278ff5e6bba9adbd6e0))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Dependencies
|
|
92
|
+
|
|
93
|
+
* The following workspace dependencies were updated
|
|
94
|
+
* dependencies
|
|
95
|
+
* @aigne/afs bumped to 1.4.0-beta.3
|
|
96
|
+
* @aigne/afs-history bumped to 1.2.0-beta.3
|
|
97
|
+
|
|
98
|
+
## [1.72.0-beta.3](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.72.0-beta.2...core-v1.72.0-beta.3) (2025-12-19)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
### Features
|
|
102
|
+
|
|
103
|
+
* add prompt caching for OpenAI/Gemini/Anthropic and cache token display ([#838](https://github.com/AIGNE-io/aigne-framework/issues/838)) ([46c628f](https://github.com/AIGNE-io/aigne-framework/commit/46c628f180572ea1b955d1a9888aad6145204842))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### Dependencies
|
|
107
|
+
|
|
108
|
+
* The following workspace dependencies were updated
|
|
109
|
+
* dependencies
|
|
110
|
+
* @aigne/observability-api bumped to 0.11.14-beta.1
|
|
111
|
+
|
|
112
|
+
## [1.72.0-beta.2](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.72.0-beta.1...core-v1.72.0-beta.2) (2025-12-19)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
### Bug Fixes
|
|
116
|
+
|
|
117
|
+
* **afs:** set AFS tag for all AFS's skills ([#841](https://github.com/AIGNE-io/aigne-framework/issues/841)) ([0bd995a](https://github.com/AIGNE-io/aigne-framework/commit/0bd995aeb68aa68caac1ce19a200b42a022a9998))
|
|
118
|
+
* **afs:** use simple-list instead of tree as default type ([#839](https://github.com/AIGNE-io/aigne-framework/issues/839)) ([65a9a40](https://github.com/AIGNE-io/aigne-framework/commit/65a9a4054b3bdad6f7e40357299ef3dc48f7c3e4))
|
|
119
|
+
* **core:** add creditPrefix field to usage tracking ([#837](https://github.com/AIGNE-io/aigne-framework/issues/837)) ([9ef25e0](https://github.com/AIGNE-io/aigne-framework/commit/9ef25e0687b4e7b4ba39a27a35805f377f0979eb))
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
### Dependencies
|
|
123
|
+
|
|
124
|
+
* The following workspace dependencies were updated
|
|
125
|
+
* dependencies
|
|
126
|
+
* @aigne/afs bumped to 1.4.0-beta.2
|
|
127
|
+
* @aigne/afs-history bumped to 1.2.0-beta.2
|
|
128
|
+
|
|
129
|
+
## [1.72.0-beta.1](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.72.0-beta...core-v1.72.0-beta.1) (2025-12-17)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### Bug Fixes
|
|
133
|
+
|
|
134
|
+
* bump version ([70d217c](https://github.com/AIGNE-io/aigne-framework/commit/70d217c8360dd0dda7f5f17011c4e92ec836e801))
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
### Dependencies
|
|
138
|
+
|
|
139
|
+
* The following workspace dependencies were updated
|
|
140
|
+
* dependencies
|
|
141
|
+
* @aigne/afs bumped to 1.4.0-beta.1
|
|
142
|
+
* @aigne/afs-history bumped to 1.2.0-beta.1
|
|
143
|
+
* @aigne/observability-api bumped to 0.11.14-beta
|
|
144
|
+
* @aigne/platform-helpers bumped to 0.6.7-beta
|
|
145
|
+
|
|
146
|
+
## [1.72.0-beta](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.71.0...core-v1.72.0-beta) (2025-12-17)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
### Features
|
|
150
|
+
|
|
151
|
+
* **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))
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
### Dependencies
|
|
155
|
+
|
|
156
|
+
* The following workspace dependencies were updated
|
|
157
|
+
* dependencies
|
|
158
|
+
* @aigne/afs bumped to 1.4.0-beta
|
|
159
|
+
* @aigne/afs-history bumped to 1.2.0-beta
|
|
160
|
+
|
|
3
161
|
## [1.71.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.71.0-beta.6...core-v1.71.0) (2025-12-12)
|
|
4
162
|
|
|
5
163
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AFS, type
|
|
1
|
+
import { AFS, type AFSExecOptions, type AFSExecResult, type AFSListOptions, type AFSListResult, type AFSModule, type AFSOptions, type AFSReadResult, type AFSSearchOptions } from "@aigne/afs";
|
|
2
2
|
import { nodejs } from "@aigne/platform-helpers/nodejs/index.js";
|
|
3
3
|
import type * as prompts from "@inquirer/prompts";
|
|
4
|
-
import { type ZodObject, type ZodType } from "zod";
|
|
4
|
+
import { type ZodObject, type ZodType, z } from "zod";
|
|
5
5
|
import type { AgentEvent, Context, UserContext } from "../aigne/context.js";
|
|
6
6
|
import type { MessagePayload } from "../aigne/message-queue.js";
|
|
7
7
|
import type { ContextUsage } from "../aigne/usage.js";
|
|
@@ -9,7 +9,7 @@ import type { Memory, MemoryAgent } from "../memory/memory.js";
|
|
|
9
9
|
import type { MemoryRecorderInput } from "../memory/recorder.js";
|
|
10
10
|
import type { MemoryRetrieverInput } from "../memory/retriever.js";
|
|
11
11
|
import { type Nullish, type PromiseOrValue, type XOr } from "../utils/type-utils.js";
|
|
12
|
-
import type { ChatModel } from "./chat-model.js";
|
|
12
|
+
import type { ChatModel, ChatModelInputMessage } from "./chat-model.js";
|
|
13
13
|
import type { GuideRailAgent, GuideRailAgentOutput } from "./guide-rail-agent.js";
|
|
14
14
|
import type { ImageModel } from "./image-model.js";
|
|
15
15
|
import { type GetterSchema, type TransferAgentOutput } from "./types.js";
|
|
@@ -118,7 +118,6 @@ export interface AgentOptions<I extends Message = Message, O extends Message = M
|
|
|
118
118
|
* agentSucceed, or agentFailed
|
|
119
119
|
*/
|
|
120
120
|
disableEvents?: boolean;
|
|
121
|
-
historyConfig?: Agent["historyConfig"];
|
|
122
121
|
/**
|
|
123
122
|
* One or more memory agents this agent can use
|
|
124
123
|
*/
|
|
@@ -211,15 +210,15 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
|
|
|
211
210
|
parsed: object;
|
|
212
211
|
}): Promise<Agent<I, O>>;
|
|
213
212
|
constructor(options?: AgentOptions<I, O>);
|
|
213
|
+
afs?: AFS;
|
|
214
|
+
tag?: string;
|
|
214
215
|
/**
|
|
215
216
|
* List of memories this agent can use
|
|
216
217
|
*
|
|
217
218
|
* @deprecated use afs instead
|
|
218
219
|
*/
|
|
219
220
|
readonly memories: MemoryAgent[];
|
|
220
|
-
afs?: AFS;
|
|
221
221
|
asyncMemoryRecord?: boolean;
|
|
222
|
-
tag?: string;
|
|
223
222
|
/**
|
|
224
223
|
* Maximum number of memory items to retrieve
|
|
225
224
|
*/
|
|
@@ -349,11 +348,6 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
|
|
|
349
348
|
* agentSucceed, or agentFailed
|
|
350
349
|
*/
|
|
351
350
|
private disableEvents?;
|
|
352
|
-
historyConfig?: {
|
|
353
|
-
disabled?: boolean;
|
|
354
|
-
maxTokens?: number;
|
|
355
|
-
maxItems?: number;
|
|
356
|
-
};
|
|
357
351
|
private subscriptions;
|
|
358
352
|
/**
|
|
359
353
|
* Attach agent to context:
|
|
@@ -455,7 +449,9 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
|
|
|
455
449
|
* @param options Invocation options
|
|
456
450
|
* @returns Final processed output
|
|
457
451
|
*/
|
|
458
|
-
protected processAgentOutput(input: I, output: Exclude<AgentResponse<O>, AgentResponseStream<O>>, options: AgentInvokeOptions
|
|
452
|
+
protected processAgentOutput(input: I, output: Exclude<AgentResponse<O>, AgentResponseStream<O>>, { messages, ...options }: AgentInvokeOptions & {
|
|
453
|
+
messages?: ChatModelInputMessage[];
|
|
454
|
+
}): Promise<O>;
|
|
459
455
|
/**
|
|
460
456
|
* Process errors that occur during agent execution
|
|
461
457
|
*
|
|
@@ -573,23 +569,10 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
|
|
|
573
569
|
/** For AFSModule interface **/
|
|
574
570
|
private agentToAFSEntry;
|
|
575
571
|
private findAgentByAFSPath;
|
|
576
|
-
list(_path: string, _options?: AFSListOptions): Promise<
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
read(path: string): Promise<{
|
|
581
|
-
result?: AFSEntry;
|
|
582
|
-
message?: string;
|
|
583
|
-
}>;
|
|
584
|
-
search(path: string, _query: string, options?: AFSSearchOptions): Promise<{
|
|
585
|
-
list: AFSEntry[];
|
|
586
|
-
message?: string;
|
|
587
|
-
}>;
|
|
588
|
-
exec(path: string, args: Record<string, any>, options: {
|
|
589
|
-
context: Context;
|
|
590
|
-
}): Promise<{
|
|
591
|
-
result: Record<string, any>;
|
|
592
|
-
}>;
|
|
572
|
+
list(_path: string, _options?: AFSListOptions): Promise<AFSListResult>;
|
|
573
|
+
read(path: string): Promise<AFSReadResult>;
|
|
574
|
+
search(path: string, _query: string, options?: AFSSearchOptions): Promise<AFSListResult>;
|
|
575
|
+
exec(path: string, args: Record<string, any>, options: AFSExecOptions): Promise<AFSExecResult>;
|
|
593
576
|
}
|
|
594
577
|
export type AgentInput<T extends Agent> = T extends Agent<infer I, any> ? I : never;
|
|
595
578
|
export type AgentOutput<T extends Agent> = T extends Agent<any, infer O> ? O : never;
|
|
@@ -796,12 +779,31 @@ export interface AgentResponseProgress {
|
|
|
796
779
|
} | {
|
|
797
780
|
event: "agentFailed";
|
|
798
781
|
error: Error;
|
|
782
|
+
} | {
|
|
783
|
+
event: "message";
|
|
784
|
+
message: ChatModelInputMessage;
|
|
799
785
|
}) & Omit<AgentEvent, "agent"> & {
|
|
800
786
|
agent: {
|
|
801
787
|
name: string;
|
|
802
788
|
};
|
|
803
789
|
};
|
|
804
790
|
}
|
|
791
|
+
export type AgentResponseProgressMessageItem = {
|
|
792
|
+
type: "text";
|
|
793
|
+
content: string;
|
|
794
|
+
} | {
|
|
795
|
+
type: "thinking";
|
|
796
|
+
thoughts: string;
|
|
797
|
+
} | {
|
|
798
|
+
type: "tool_use";
|
|
799
|
+
toolUseId: string;
|
|
800
|
+
name: string;
|
|
801
|
+
input: unknown;
|
|
802
|
+
} | {
|
|
803
|
+
type: "tool_result";
|
|
804
|
+
toolUseId: string;
|
|
805
|
+
content: unknown;
|
|
806
|
+
};
|
|
805
807
|
export declare function isAgentResponseProgress<T>(chunk: AgentResponseChunk<T>): chunk is AgentResponseProgress;
|
|
806
808
|
/**
|
|
807
809
|
* Creates a text delta for streaming responses
|
|
@@ -883,6 +885,17 @@ export interface FunctionAgentOptions<I extends Message = Message, O extends Mes
|
|
|
883
885
|
*/
|
|
884
886
|
export declare class FunctionAgent<I extends Message = Message, O extends Message = Message> extends Agent<I, O> {
|
|
885
887
|
tag: string;
|
|
888
|
+
static schema(): ZodObject<{
|
|
889
|
+
process: ZodType<FunctionAgentFn>;
|
|
890
|
+
}, "strip", z.ZodTypeAny, {
|
|
891
|
+
process: FunctionAgentFn<any, any, FunctionAgent<any, any>>;
|
|
892
|
+
}, {
|
|
893
|
+
process: FunctionAgentFn<any, any, FunctionAgent<any, any>>;
|
|
894
|
+
}>;
|
|
895
|
+
static load<I extends Message = any, O extends Message = any>(options: {
|
|
896
|
+
filepath: string;
|
|
897
|
+
parsed: object;
|
|
898
|
+
}): Promise<Agent<I, O>>;
|
|
886
899
|
/**
|
|
887
900
|
* Create a function agent from a function or options
|
|
888
901
|
*
|
package/lib/cjs/agents/agent.js
CHANGED
|
@@ -53,6 +53,7 @@ const nunjucks_1 = __importDefault(require("nunjucks"));
|
|
|
53
53
|
const ufo_1 = require("ufo");
|
|
54
54
|
const zod_1 = require("zod");
|
|
55
55
|
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
56
|
+
const function_agent_js_1 = require("../loader/function-agent.js");
|
|
56
57
|
const agent_utils_js_1 = require("../utils/agent-utils.js");
|
|
57
58
|
const json_schema_js_1 = require("../utils/json-schema.js");
|
|
58
59
|
const logger_js_1 = require("../utils/logger.js");
|
|
@@ -151,7 +152,6 @@ class Agent {
|
|
|
151
152
|
if (options.skills?.length)
|
|
152
153
|
this.skills.push(...options.skills.map(functionToAgent));
|
|
153
154
|
this.disableEvents = options.disableEvents;
|
|
154
|
-
this.historyConfig = options.historyConfig;
|
|
155
155
|
if (Array.isArray(options.memory)) {
|
|
156
156
|
this.memories.push(...options.memory);
|
|
157
157
|
}
|
|
@@ -178,15 +178,15 @@ class Agent {
|
|
|
178
178
|
: options.retryOnError;
|
|
179
179
|
this.guideRails = options.guideRails;
|
|
180
180
|
}
|
|
181
|
+
afs;
|
|
182
|
+
tag;
|
|
181
183
|
/**
|
|
182
184
|
* List of memories this agent can use
|
|
183
185
|
*
|
|
184
186
|
* @deprecated use afs instead
|
|
185
187
|
*/
|
|
186
188
|
memories = [];
|
|
187
|
-
afs;
|
|
188
189
|
asyncMemoryRecord;
|
|
189
|
-
tag;
|
|
190
190
|
/**
|
|
191
191
|
* Maximum number of memory items to retrieve
|
|
192
192
|
*/
|
|
@@ -331,7 +331,6 @@ class Agent {
|
|
|
331
331
|
* agentSucceed, or agentFailed
|
|
332
332
|
*/
|
|
333
333
|
disableEvents;
|
|
334
|
-
historyConfig;
|
|
335
334
|
subscriptions = [];
|
|
336
335
|
/**
|
|
337
336
|
* Attach agent to context:
|
|
@@ -462,11 +461,15 @@ class Agent {
|
|
|
462
461
|
: (0, stream_utils_js_1.isAsyncGenerator)(response)
|
|
463
462
|
? (0, stream_utils_js_1.asyncGeneratorToReadableStream)(response)
|
|
464
463
|
: (0, stream_utils_js_1.objectToAgentResponseStream)(response);
|
|
464
|
+
const messages = [];
|
|
465
465
|
for await (const chunk of stream) {
|
|
466
466
|
(0, stream_utils_js_1.mergeAgentResponseChunk)(output, chunk);
|
|
467
467
|
yield chunk;
|
|
468
|
+
if (isAgentResponseProgress(chunk) && chunk.progress.event === "message") {
|
|
469
|
+
messages.push(chunk.progress.message);
|
|
470
|
+
}
|
|
468
471
|
}
|
|
469
|
-
let result = await this.processAgentOutput(input, output, options);
|
|
472
|
+
let result = await this.processAgentOutput(input, output, { ...options, messages });
|
|
470
473
|
if (attempt > 0) {
|
|
471
474
|
result = { ...result, $meta: { ...result.$meta, retries: attempt } };
|
|
472
475
|
}
|
|
@@ -563,7 +566,7 @@ class Agent {
|
|
|
563
566
|
* @param options Invocation options
|
|
564
567
|
* @returns Final processed output
|
|
565
568
|
*/
|
|
566
|
-
async processAgentOutput(input, output, options) {
|
|
569
|
+
async processAgentOutput(input, output, { messages, ...options }) {
|
|
567
570
|
const { context } = options;
|
|
568
571
|
if (!(0, type_utils_js_1.isRecord)(output)) {
|
|
569
572
|
throw new Error(`expect to return a record type such as {result: ...}, but got (${typeof output}): ${output}`);
|
|
@@ -575,8 +578,14 @@ class Agent {
|
|
|
575
578
|
const o = await this.callHooks(["onSuccess", "onEnd"], { input, output: finalOutput }, options);
|
|
576
579
|
if (o?.output)
|
|
577
580
|
finalOutput = o.output;
|
|
578
|
-
|
|
579
|
-
this.
|
|
581
|
+
this.afs?.emit("agentSucceed", {
|
|
582
|
+
agentId: this.name,
|
|
583
|
+
userId: context.userContext.userId,
|
|
584
|
+
sessionId: context.userContext.sessionId,
|
|
585
|
+
input,
|
|
586
|
+
output: finalOutput,
|
|
587
|
+
messages,
|
|
588
|
+
});
|
|
580
589
|
if (!this.disableEvents)
|
|
581
590
|
context.emit("agentSucceed", { agent: this, output: finalOutput });
|
|
582
591
|
return finalOutput;
|
|
@@ -781,7 +790,7 @@ class Agent {
|
|
|
781
790
|
// TODO: support list skills inside agent path, and use options to filter skills
|
|
782
791
|
async list(_path, _options) {
|
|
783
792
|
const agents = [this, ...this.skills];
|
|
784
|
-
return {
|
|
793
|
+
return { data: agents.map((agent) => this.agentToAFSEntry(agent)) };
|
|
785
794
|
}
|
|
786
795
|
async read(path) {
|
|
787
796
|
const agent = this.findAgentByAFSPath(path);
|
|
@@ -789,7 +798,7 @@ class Agent {
|
|
|
789
798
|
return { message: `Agent not found at path: ${path}` };
|
|
790
799
|
}
|
|
791
800
|
return {
|
|
792
|
-
|
|
801
|
+
data: this.agentToAFSEntry(agent),
|
|
793
802
|
};
|
|
794
803
|
}
|
|
795
804
|
// TODO: implement search inside agent skills
|
|
@@ -800,7 +809,7 @@ class Agent {
|
|
|
800
809
|
const agent = this.findAgentByAFSPath(path);
|
|
801
810
|
if (!agent)
|
|
802
811
|
throw new Error(`Agent not found at path: ${path}`);
|
|
803
|
-
return {
|
|
812
|
+
return { data: await options.context.invoke(agent, args) };
|
|
804
813
|
}
|
|
805
814
|
}
|
|
806
815
|
exports.Agent = Agent;
|
|
@@ -873,6 +882,18 @@ function checkAgentInputOutputSchema(schema) {
|
|
|
873
882
|
*/
|
|
874
883
|
class FunctionAgent extends Agent {
|
|
875
884
|
tag = "FunctionAgent";
|
|
885
|
+
static schema() {
|
|
886
|
+
return zod_1.z.object({
|
|
887
|
+
process: zod_1.z.preprocess((v) => (typeof v === "string" ? (0, function_agent_js_1.codeToFunctionAgentFn)(v) : v), zod_1.z.custom()),
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
static async load(options) {
|
|
891
|
+
const valid = await FunctionAgent.schema().parseAsync(options.parsed);
|
|
892
|
+
return new FunctionAgent({
|
|
893
|
+
...options.parsed,
|
|
894
|
+
process: valid.process,
|
|
895
|
+
});
|
|
896
|
+
}
|
|
876
897
|
/**
|
|
877
898
|
* Create a function agent from a function or options
|
|
878
899
|
*
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { type ZodObject, type ZodType, z } from "zod";
|
|
2
|
+
import { type NestAgentSchema } from "../loader/agent-yaml.js";
|
|
3
|
+
import type { AgentLoadOptions } from "../loader/index.js";
|
|
4
|
+
import { type Instructions } from "../loader/schema.js";
|
|
5
|
+
import type { CompactConfig, SessionMemoryConfig, UserMemoryConfig } from "../prompt/agent-session.js";
|
|
2
6
|
import { PromptBuilder } from "../prompt/prompt-builder.js";
|
|
3
7
|
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessAsyncGenerator, type AgentProcessResult, type Message } from "./agent.js";
|
|
4
8
|
import type { ChatModel, ChatModelInput } from "./chat-model.js";
|
|
@@ -23,8 +27,6 @@ export interface AIAgentOptions<I extends Message = Message, O extends Message =
|
|
|
23
27
|
* more complex prompt templates
|
|
24
28
|
*/
|
|
25
29
|
instructions?: string | PromptBuilder;
|
|
26
|
-
autoReorderSystemMessages?: boolean;
|
|
27
|
-
autoMergeSystemMessages?: boolean;
|
|
28
30
|
/**
|
|
29
31
|
* Pick a message from input to use as the user's message
|
|
30
32
|
*/
|
|
@@ -124,6 +126,53 @@ export interface AIAgentOptions<I extends Message = Message, O extends Message =
|
|
|
124
126
|
*/
|
|
125
127
|
memoryPromptTemplate?: string;
|
|
126
128
|
useMemoriesFromContext?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Agent session configuration
|
|
131
|
+
*
|
|
132
|
+
* Controls history recording, memory extraction, and conversation compaction.
|
|
133
|
+
* By default, mode is "auto" (enabled). Set `{ mode: "disabled" }` to disable
|
|
134
|
+
* for internal utility agents (extractors, compactors, etc.).
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* // Default behavior - session features enabled
|
|
139
|
+
* new AIAgent({
|
|
140
|
+
* session: {
|
|
141
|
+
* compact: { mode: "auto" },
|
|
142
|
+
* sessionMemory: { mode: "auto" },
|
|
143
|
+
* userMemory: { mode: "auto" }
|
|
144
|
+
* }
|
|
145
|
+
* })
|
|
146
|
+
*
|
|
147
|
+
* // Disable for internal utility agents
|
|
148
|
+
* new AIAgent({
|
|
149
|
+
* session: { mode: "disabled" }
|
|
150
|
+
* })
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
session?: Partial<Omit<import("../prompt/agent-session.js").AgentSessionOptions, "sessionId" | "userId" | "agentId" | "afs">>;
|
|
154
|
+
}
|
|
155
|
+
export interface AIAgentLoadSchema {
|
|
156
|
+
instructions?: Instructions;
|
|
157
|
+
inputKey?: string;
|
|
158
|
+
inputFileKey?: string;
|
|
159
|
+
outputKey?: string;
|
|
160
|
+
outputFileKey?: string;
|
|
161
|
+
toolChoice?: AIAgentToolChoice;
|
|
162
|
+
toolCallsConcurrency?: number;
|
|
163
|
+
keepTextInToolUses?: boolean;
|
|
164
|
+
session?: {
|
|
165
|
+
mode?: "auto" | "disabled";
|
|
166
|
+
compact?: Omit<CompactConfig, "compactor"> & {
|
|
167
|
+
compactor?: NestAgentSchema;
|
|
168
|
+
};
|
|
169
|
+
sessionMemory?: Omit<SessionMemoryConfig, "extractor"> & {
|
|
170
|
+
extractor?: NestAgentSchema;
|
|
171
|
+
};
|
|
172
|
+
userMemory?: Omit<UserMemoryConfig, "extractor"> & {
|
|
173
|
+
extractor?: NestAgentSchema;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
127
176
|
}
|
|
128
177
|
/**
|
|
129
178
|
* Tool choice options for AI agents
|
|
@@ -188,6 +237,14 @@ export declare const aiAgentOptionsSchema: ZodObject<{
|
|
|
188
237
|
*/
|
|
189
238
|
export declare class AIAgent<I extends Message = any, O extends Message = any> extends Agent<I, O> {
|
|
190
239
|
tag: string;
|
|
240
|
+
static schema<T>({ filepath }: {
|
|
241
|
+
filepath: string;
|
|
242
|
+
}): ZodType<T>;
|
|
243
|
+
static load<I extends Message = any, O extends Message = any>(options: {
|
|
244
|
+
filepath: string;
|
|
245
|
+
parsed: object;
|
|
246
|
+
options?: AgentLoadOptions;
|
|
247
|
+
}): Promise<Agent<I, O>>;
|
|
191
248
|
/**
|
|
192
249
|
* Create an AIAgent with the specified options
|
|
193
250
|
*
|
|
@@ -218,8 +275,6 @@ export declare class AIAgent<I extends Message = any, O extends Message = any> e
|
|
|
218
275
|
* {@includeCode ../../test/agents/ai-agent.test.ts#example-ai-agent-prompt-builder}
|
|
219
276
|
*/
|
|
220
277
|
instructions: PromptBuilder;
|
|
221
|
-
autoReorderSystemMessages?: boolean;
|
|
222
|
-
autoMergeSystemMessages?: boolean;
|
|
223
278
|
/**
|
|
224
279
|
* Pick a message from input to use as the user's message
|
|
225
280
|
*/
|
|
@@ -315,6 +370,10 @@ export declare class AIAgent<I extends Message = any, O extends Message = any> e
|
|
|
315
370
|
metadataEnd: string;
|
|
316
371
|
parse: (raw: string) => object;
|
|
317
372
|
};
|
|
373
|
+
/**
|
|
374
|
+
* Agent session configuration
|
|
375
|
+
*/
|
|
376
|
+
session?: Partial<Omit<import("../prompt/agent-session.js").AgentSessionOptions, "sessionId" | "userId" | "agentId" | "afs">>;
|
|
318
377
|
get inputSchema(): ZodType<I>;
|
|
319
378
|
/**
|
|
320
379
|
* Process an input message and generate a response
|