@aigne/agent-library 1.24.0-beta.9 → 1.24.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 +284 -0
- package/lib/cjs/agent-skill-manager/index.js +8 -5
- package/lib/cjs/ask-user-question/index.d.ts +2 -1
- package/lib/cjs/ask-user-question/index.js +8 -0
- package/lib/cjs/bash/index.d.ts +8 -0
- package/lib/cjs/bash/index.js +16 -11
- package/lib/cjs/bash/prompt.d.ts +1 -0
- package/lib/cjs/bash/prompt.js +35 -0
- package/lib/dts/ask-user-question/index.d.ts +2 -1
- package/lib/dts/bash/index.d.ts +8 -0
- package/lib/dts/bash/prompt.d.ts +1 -0
- package/lib/esm/agent-skill-manager/index.js +8 -5
- package/lib/esm/ask-user-question/index.d.ts +2 -1
- package/lib/esm/ask-user-question/index.js +9 -1
- package/lib/esm/bash/index.d.ts +8 -0
- package/lib/esm/bash/index.js +16 -11
- package/lib/esm/bash/prompt.d.ts +1 -0
- package/lib/esm/bash/prompt.js +32 -0
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,290 @@
|
|
|
7
7
|
* @aigne/core bumped to 1.22.0
|
|
8
8
|
* @aigne/openai bumped to 0.3.4
|
|
9
9
|
|
|
10
|
+
## [1.24.0](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.27...agent-library-v1.24.0) (2026-01-16)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Dependencies
|
|
14
|
+
|
|
15
|
+
* The following workspace dependencies were updated
|
|
16
|
+
* dependencies
|
|
17
|
+
* @aigne/core bumped to 1.72.0
|
|
18
|
+
* @aigne/openai bumped to 0.16.16
|
|
19
|
+
* @aigne/sqlite bumped to 0.4.9
|
|
20
|
+
* devDependencies
|
|
21
|
+
* @aigne/test-utils bumped to 0.5.69
|
|
22
|
+
|
|
23
|
+
## [1.24.0-beta.27](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.26...agent-library-v1.24.0-beta.27) (2026-01-16)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* add Agent Skill support ([#787](https://github.com/AIGNE-io/aigne-framework/issues/787)) ([f04fbe7](https://github.com/AIGNE-io/aigne-framework/commit/f04fbe76ec24cf3c59c74adf92d87b0c3784a8f7))
|
|
29
|
+
* 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))
|
|
30
|
+
* 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))
|
|
31
|
+
* **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))
|
|
32
|
+
* **agent-library:** add agent skill manager agent ([#859](https://github.com/AIGNE-io/aigne-framework/issues/859)) ([d409bf5](https://github.com/AIGNE-io/aigne-framework/commit/d409bf5f44146c96c0d68cd93bc30b01ec5ae329))
|
|
33
|
+
* **agent-library:** add askUserQuestion agent ([#848](https://github.com/AIGNE-io/aigne-framework/issues/848)) ([60fa69b](https://github.com/AIGNE-io/aigne-framework/commit/60fa69b40ec122295e57ad175075875ed4840345))
|
|
34
|
+
* **agent-library:** add BashAgent with sandbox support ([#816](https://github.com/AIGNE-io/aigne-framework/issues/816)) ([0d4feee](https://github.com/AIGNE-io/aigne-framework/commit/0d4feeeac2b71df1c4d725adeee76c9318ce8e02))
|
|
35
|
+
* **agent-library:** add parallel tasks support for orchestrator agent ([#834](https://github.com/AIGNE-io/aigne-framework/issues/834)) ([7314eb1](https://github.com/AIGNE-io/aigne-framework/commit/7314eb1ef5f1eb4bf6f2b8160c61ef627a6aa3cc))
|
|
36
|
+
* **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))
|
|
37
|
+
* **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))
|
|
38
|
+
* support define agent by third library & orchestrator agent refactor ([#799](https://github.com/AIGNE-io/aigne-framework/issues/799)) ([7264b11](https://github.com/AIGNE-io/aigne-framework/commit/7264b11ab6eed787e928367f09aa08d254968d40))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* **agent-library:** add cwd option for bash agent ([#901](https://github.com/AIGNE-io/aigne-framework/issues/901)) ([d8a036b](https://github.com/AIGNE-io/aigne-framework/commit/d8a036b84ee97f80de747c141dae15a0d96bf4f5))
|
|
44
|
+
* **agent-library:** add header field and use object-based answers in AskUserQuestion ([#851](https://github.com/AIGNE-io/aigne-framework/issues/851)) ([095db95](https://github.com/AIGNE-io/aigne-framework/commit/095db95e43b5d39b35c638d90d6f0b99565e0dc4))
|
|
45
|
+
* **agent-library:** include stdout in the error message ([#872](https://github.com/AIGNE-io/aigne-framework/issues/872)) ([4627428](https://github.com/AIGNE-io/aigne-framework/commit/4627428ade3de38a94491670216372ab2e2f2396))
|
|
46
|
+
* **agent-library:** set default instructions for agent skill manager ([#861](https://github.com/AIGNE-io/aigne-framework/issues/861)) ([ca01a05](https://github.com/AIGNE-io/aigne-framework/commit/ca01a056ff73ebed7094e1e07964bc06cd3d26d0))
|
|
47
|
+
* bump version ([696560f](https://github.com/AIGNE-io/aigne-framework/commit/696560fa2673eddcb4d00ac0523fbbbde7273cb3))
|
|
48
|
+
* bump version ([70d217c](https://github.com/AIGNE-io/aigne-framework/commit/70d217c8360dd0dda7f5f17011c4e92ec836e801))
|
|
49
|
+
* bump version ([af04b69](https://github.com/AIGNE-io/aigne-framework/commit/af04b6931951afa35d52065430acc7fef4b10087))
|
|
50
|
+
* bump version ([ba7ad18](https://github.com/AIGNE-io/aigne-framework/commit/ba7ad184fcf32b49bf0507a3cb638d20fb00690d))
|
|
51
|
+
* bump version ([93a1c10](https://github.com/AIGNE-io/aigne-framework/commit/93a1c10cf35f88eaafe91092481f5d087bd5b3a9))
|
|
52
|
+
* **core:** preserve Agent Skill in session compact and support complex tool result content ([#876](https://github.com/AIGNE-io/aigne-framework/issues/876)) ([edb86ae](https://github.com/AIGNE-io/aigne-framework/commit/edb86ae2b9cfe56a8f08b276f843606e310566cf))
|
|
53
|
+
* **core:** support load third agent in skills ([#819](https://github.com/AIGNE-io/aigne-framework/issues/819)) ([bcbb140](https://github.com/AIGNE-io/aigne-framework/commit/bcbb1404d2fe9c709d99a8c28883b21dd107a844))
|
|
54
|
+
* 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))
|
|
55
|
+
* **orchestrator:** add default task title for worker agent ([#809](https://github.com/AIGNE-io/aigne-framework/issues/809)) ([3524c3c](https://github.com/AIGNE-io/aigne-framework/commit/3524c3c03c6a6822656c8b1684660677af49d508))
|
|
56
|
+
* **orchestrator:** enhance prompts with detailed guidance ([#811](https://github.com/AIGNE-io/aigne-framework/issues/811)) ([5656f38](https://github.com/AIGNE-io/aigne-framework/commit/5656f38c09e458e18b90e962a5e85c96755be2e4))
|
|
57
|
+
* **orchestrator:** support custom input schema for planner/worker/completer ([#823](https://github.com/AIGNE-io/aigne-framework/issues/823)) ([3d26f8b](https://github.com/AIGNE-io/aigne-framework/commit/3d26f8bac8b679010f25d9e4eb59fc6e80afda4c))
|
|
58
|
+
* update deps compatibility in CommonJS environment ([#580](https://github.com/AIGNE-io/aigne-framework/issues/580)) ([a1e35d0](https://github.com/AIGNE-io/aigne-framework/commit/a1e35d016405accb51c1aeb6a544503a1c78e912))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Dependencies
|
|
62
|
+
|
|
63
|
+
* The following workspace dependencies were updated
|
|
64
|
+
* dependencies
|
|
65
|
+
* @aigne/core bumped to 1.72.0-beta.25
|
|
66
|
+
* @aigne/openai bumped to 0.16.16-beta.25
|
|
67
|
+
* devDependencies
|
|
68
|
+
* @aigne/test-utils bumped to 0.5.69-beta.25
|
|
69
|
+
|
|
70
|
+
## [1.24.0-beta.26](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.25...agent-library-v1.24.0-beta.26) (2026-01-16)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
### Dependencies
|
|
74
|
+
|
|
75
|
+
* The following workspace dependencies were updated
|
|
76
|
+
* dependencies
|
|
77
|
+
* @aigne/core bumped to 1.72.0-beta.24
|
|
78
|
+
* @aigne/openai bumped to 0.16.16-beta.24
|
|
79
|
+
* devDependencies
|
|
80
|
+
* @aigne/test-utils bumped to 0.5.69-beta.24
|
|
81
|
+
|
|
82
|
+
## [1.24.0-beta.25](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.24...agent-library-v1.24.0-beta.25) (2026-01-15)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
### Dependencies
|
|
86
|
+
|
|
87
|
+
* The following workspace dependencies were updated
|
|
88
|
+
* dependencies
|
|
89
|
+
* @aigne/core bumped to 1.72.0-beta.23
|
|
90
|
+
* @aigne/openai bumped to 0.16.16-beta.23
|
|
91
|
+
* devDependencies
|
|
92
|
+
* @aigne/test-utils bumped to 0.5.69-beta.23
|
|
93
|
+
|
|
94
|
+
## [1.24.0-beta.24](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.23...agent-library-v1.24.0-beta.24) (2026-01-15)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### Dependencies
|
|
98
|
+
|
|
99
|
+
* The following workspace dependencies were updated
|
|
100
|
+
* dependencies
|
|
101
|
+
* @aigne/core bumped to 1.72.0-beta.22
|
|
102
|
+
* @aigne/openai bumped to 0.16.16-beta.22
|
|
103
|
+
* devDependencies
|
|
104
|
+
* @aigne/test-utils bumped to 0.5.69-beta.22
|
|
105
|
+
|
|
106
|
+
## [1.24.0-beta.23](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.22...agent-library-v1.24.0-beta.23) (2026-01-15)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
### Dependencies
|
|
110
|
+
|
|
111
|
+
* The following workspace dependencies were updated
|
|
112
|
+
* dependencies
|
|
113
|
+
* @aigne/core bumped to 1.72.0-beta.21
|
|
114
|
+
* @aigne/openai bumped to 0.16.16-beta.21
|
|
115
|
+
* devDependencies
|
|
116
|
+
* @aigne/test-utils bumped to 0.5.69-beta.21
|
|
117
|
+
|
|
118
|
+
## [1.24.0-beta.22](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.21...agent-library-v1.24.0-beta.22) (2026-01-15)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
### Dependencies
|
|
122
|
+
|
|
123
|
+
* The following workspace dependencies were updated
|
|
124
|
+
* dependencies
|
|
125
|
+
* @aigne/core bumped to 1.72.0-beta.20
|
|
126
|
+
* @aigne/openai bumped to 0.16.16-beta.20
|
|
127
|
+
* devDependencies
|
|
128
|
+
* @aigne/test-utils bumped to 0.5.69-beta.20
|
|
129
|
+
|
|
130
|
+
## [1.24.0-beta.21](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.20...agent-library-v1.24.0-beta.21) (2026-01-14)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
### Bug Fixes
|
|
134
|
+
|
|
135
|
+
* 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))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
### Dependencies
|
|
139
|
+
|
|
140
|
+
* The following workspace dependencies were updated
|
|
141
|
+
* dependencies
|
|
142
|
+
* @aigne/core bumped to 1.72.0-beta.19
|
|
143
|
+
* @aigne/openai bumped to 0.16.16-beta.19
|
|
144
|
+
* @aigne/sqlite bumped to 0.4.9-beta.2
|
|
145
|
+
* devDependencies
|
|
146
|
+
* @aigne/test-utils bumped to 0.5.69-beta.19
|
|
147
|
+
|
|
148
|
+
## [1.24.0-beta.20](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.19...agent-library-v1.24.0-beta.20) (2026-01-13)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
### Bug Fixes
|
|
152
|
+
|
|
153
|
+
* **agent-library:** add cwd option for bash agent ([#901](https://github.com/AIGNE-io/aigne-framework/issues/901)) ([d8a036b](https://github.com/AIGNE-io/aigne-framework/commit/d8a036b84ee97f80de747c141dae15a0d96bf4f5))
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
### Dependencies
|
|
157
|
+
|
|
158
|
+
* The following workspace dependencies were updated
|
|
159
|
+
* dependencies
|
|
160
|
+
* @aigne/core bumped to 1.72.0-beta.18
|
|
161
|
+
* @aigne/openai bumped to 0.16.16-beta.18
|
|
162
|
+
|
|
163
|
+
## [1.24.0-beta.19](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.18...agent-library-v1.24.0-beta.19) (2026-01-12)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
### Dependencies
|
|
167
|
+
|
|
168
|
+
* The following workspace dependencies were updated
|
|
169
|
+
* dependencies
|
|
170
|
+
* @aigne/core bumped to 1.72.0-beta.17
|
|
171
|
+
* @aigne/openai bumped to 0.16.16-beta.17
|
|
172
|
+
|
|
173
|
+
## [1.24.0-beta.18](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.17...agent-library-v1.24.0-beta.18) (2026-01-12)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
### Dependencies
|
|
177
|
+
|
|
178
|
+
* The following workspace dependencies were updated
|
|
179
|
+
* dependencies
|
|
180
|
+
* @aigne/core bumped to 1.72.0-beta.16
|
|
181
|
+
* @aigne/openai bumped to 0.16.16-beta.16
|
|
182
|
+
|
|
183
|
+
## [1.24.0-beta.17](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.16...agent-library-v1.24.0-beta.17) (2026-01-10)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
### Dependencies
|
|
187
|
+
|
|
188
|
+
* The following workspace dependencies were updated
|
|
189
|
+
* dependencies
|
|
190
|
+
* @aigne/core bumped to 1.72.0-beta.15
|
|
191
|
+
* @aigne/openai bumped to 0.16.16-beta.15
|
|
192
|
+
|
|
193
|
+
## [1.24.0-beta.16](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.15...agent-library-v1.24.0-beta.16) (2026-01-09)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
### Dependencies
|
|
197
|
+
|
|
198
|
+
* The following workspace dependencies were updated
|
|
199
|
+
* dependencies
|
|
200
|
+
* @aigne/core bumped to 1.72.0-beta.14
|
|
201
|
+
* @aigne/openai bumped to 0.16.16-beta.14
|
|
202
|
+
|
|
203
|
+
## [1.24.0-beta.15](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.14...agent-library-v1.24.0-beta.15) (2026-01-08)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
### Features
|
|
207
|
+
|
|
208
|
+
* **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))
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
### Bug Fixes
|
|
212
|
+
|
|
213
|
+
* bump version ([696560f](https://github.com/AIGNE-io/aigne-framework/commit/696560fa2673eddcb4d00ac0523fbbbde7273cb3))
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
### Dependencies
|
|
217
|
+
|
|
218
|
+
* The following workspace dependencies were updated
|
|
219
|
+
* dependencies
|
|
220
|
+
* @aigne/core bumped to 1.72.0-beta.13
|
|
221
|
+
* @aigne/openai bumped to 0.16.16-beta.13
|
|
222
|
+
* @aigne/sqlite bumped to 0.4.9-beta.1
|
|
223
|
+
|
|
224
|
+
## [1.24.0-beta.14](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.13...agent-library-v1.24.0-beta.14) (2026-01-07)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
### Dependencies
|
|
228
|
+
|
|
229
|
+
* The following workspace dependencies were updated
|
|
230
|
+
* dependencies
|
|
231
|
+
* @aigne/core bumped to 1.72.0-beta.12
|
|
232
|
+
* @aigne/openai bumped to 0.16.16-beta.12
|
|
233
|
+
|
|
234
|
+
## [1.24.0-beta.13](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.12...agent-library-v1.24.0-beta.13) (2026-01-06)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
### Bug Fixes
|
|
238
|
+
|
|
239
|
+
* **core:** preserve Agent Skill in session compact and support complex tool result content ([#876](https://github.com/AIGNE-io/aigne-framework/issues/876)) ([edb86ae](https://github.com/AIGNE-io/aigne-framework/commit/edb86ae2b9cfe56a8f08b276f843606e310566cf))
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
### Dependencies
|
|
243
|
+
|
|
244
|
+
* The following workspace dependencies were updated
|
|
245
|
+
* dependencies
|
|
246
|
+
* @aigne/core bumped to 1.72.0-beta.11
|
|
247
|
+
* @aigne/openai bumped to 0.16.16-beta.11
|
|
248
|
+
|
|
249
|
+
## [1.24.0-beta.12](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.11...agent-library-v1.24.0-beta.12) (2026-01-06)
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
### Bug Fixes
|
|
253
|
+
|
|
254
|
+
* **agent-library:** include stdout in the error message ([#872](https://github.com/AIGNE-io/aigne-framework/issues/872)) ([4627428](https://github.com/AIGNE-io/aigne-framework/commit/4627428ade3de38a94491670216372ab2e2f2396))
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
### Dependencies
|
|
258
|
+
|
|
259
|
+
* The following workspace dependencies were updated
|
|
260
|
+
* dependencies
|
|
261
|
+
* @aigne/core bumped to 1.72.0-beta.10
|
|
262
|
+
* @aigne/openai bumped to 0.16.16-beta.10
|
|
263
|
+
|
|
264
|
+
## [1.24.0-beta.11](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.10...agent-library-v1.24.0-beta.11) (2026-01-02)
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
### Features
|
|
268
|
+
|
|
269
|
+
* **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))
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
### Dependencies
|
|
273
|
+
|
|
274
|
+
* The following workspace dependencies were updated
|
|
275
|
+
* dependencies
|
|
276
|
+
* @aigne/core bumped to 1.72.0-beta.9
|
|
277
|
+
* @aigne/openai bumped to 0.16.16-beta.9
|
|
278
|
+
|
|
279
|
+
## [1.24.0-beta.10](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.9...agent-library-v1.24.0-beta.10) (2025-12-31)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
### Features
|
|
283
|
+
|
|
284
|
+
* 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))
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
### Dependencies
|
|
288
|
+
|
|
289
|
+
* The following workspace dependencies were updated
|
|
290
|
+
* dependencies
|
|
291
|
+
* @aigne/core bumped to 1.72.0-beta.8
|
|
292
|
+
* @aigne/openai bumped to 0.16.16-beta.8
|
|
293
|
+
|
|
10
294
|
## [1.24.0-beta.9](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.24.0-beta.8...agent-library-v1.24.0-beta.9) (2025-12-26)
|
|
11
295
|
|
|
12
296
|
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@aigne/core");
|
|
4
|
-
const schema_js_1 = require("@aigne/core/loader/schema.js");
|
|
5
4
|
const prompt_js_1 = require("./prompt.js");
|
|
6
5
|
class AgentSkillManagerAgent extends core_1.AIAgent {
|
|
7
6
|
static async load(options) {
|
|
8
7
|
const schema = core_1.AIAgent.schema(options);
|
|
9
8
|
const valid = await schema.parseAsync(options.parsed);
|
|
10
|
-
return
|
|
11
|
-
...options
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
return core_1.AIAgent.load({
|
|
10
|
+
...options,
|
|
11
|
+
parsed: {
|
|
12
|
+
...options.parsed,
|
|
13
|
+
instructions: valid.instructions || [
|
|
14
|
+
{ role: "system", content: prompt_js_1.AgentSkillManagerSystemPrompt, path: options.filepath },
|
|
15
|
+
],
|
|
16
|
+
},
|
|
14
17
|
});
|
|
15
18
|
}
|
|
16
19
|
constructor(options) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Agent, type AgentInvokeOptions, type AgentProcessResult, type Message } from "@aigne/core";
|
|
1
|
+
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessResult, type Message } from "@aigne/core";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
export interface AskUserQuestionAgentOption {
|
|
4
4
|
label: string;
|
|
@@ -23,5 +23,6 @@ export default class AskUserQuestionAgent extends Agent<AskUserQuestionAgentInpu
|
|
|
23
23
|
filepath: string;
|
|
24
24
|
parsed: object;
|
|
25
25
|
}): Promise<Agent<I, O>>;
|
|
26
|
+
constructor(options?: AgentOptions<AskUserQuestionAgentInput, AskUserQuestionAgentOutput>);
|
|
26
27
|
process(input: AskUserQuestionAgentInput, options: AgentInvokeOptions): Promise<AgentProcessResult<AskUserQuestionAgentOutput>>;
|
|
27
28
|
}
|
|
@@ -33,6 +33,14 @@ class AskUserQuestionAgent extends core_1.Agent {
|
|
|
33
33
|
inputSchema: askUserQuestionAgentInputSchema,
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
+
constructor(options) {
|
|
37
|
+
super({
|
|
38
|
+
...options,
|
|
39
|
+
name: options?.name || defaultName,
|
|
40
|
+
description: options?.description || defaultDescription,
|
|
41
|
+
inputSchema: options?.inputSchema || askUserQuestionAgentInputSchema,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
36
44
|
async process(input, options) {
|
|
37
45
|
const { prompts } = options;
|
|
38
46
|
if (!prompts)
|
package/lib/cjs/bash/index.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ export interface BashAgentOptions extends AgentOptions<BashAgentInput, BashAgent
|
|
|
14
14
|
* @default 60000 (60 seconds)
|
|
15
15
|
*/
|
|
16
16
|
timeout?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Optional current working directory for script execution
|
|
19
|
+
* If not specified, inherits the parent process's working directory
|
|
20
|
+
*/
|
|
21
|
+
cwd?: string;
|
|
17
22
|
/**
|
|
18
23
|
* Optional permissions configuration for command execution control
|
|
19
24
|
* Inspired by Claude Code's permission system
|
|
@@ -71,6 +76,7 @@ export declare class BashAgent extends Agent<BashAgentInput, BashAgentOutput> {
|
|
|
71
76
|
} | undefined>;
|
|
72
77
|
inputKey: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
73
78
|
timeout: z.ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
79
|
+
cwd: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
74
80
|
permissions: z.ZodType<{
|
|
75
81
|
allow?: string[] | undefined;
|
|
76
82
|
deny?: string[] | undefined;
|
|
@@ -88,6 +94,7 @@ export declare class BashAgent extends Agent<BashAgentInput, BashAgentOutput> {
|
|
|
88
94
|
[x: string]: z.ZodTypeAny | undefined;
|
|
89
95
|
} | undefined;
|
|
90
96
|
timeout?: number | undefined;
|
|
97
|
+
cwd?: string | undefined;
|
|
91
98
|
permissions?: {
|
|
92
99
|
allow?: string[] | undefined;
|
|
93
100
|
deny?: string[] | undefined;
|
|
@@ -100,6 +107,7 @@ export declare class BashAgent extends Agent<BashAgentInput, BashAgentOutput> {
|
|
|
100
107
|
[x: string]: z.ZodTypeAny | undefined;
|
|
101
108
|
} | undefined;
|
|
102
109
|
timeout?: number | undefined;
|
|
110
|
+
cwd?: string | undefined;
|
|
103
111
|
permissions?: {
|
|
104
112
|
allow?: string[] | undefined;
|
|
105
113
|
deny?: string[] | undefined;
|
package/lib/cjs/bash/index.js
CHANGED
|
@@ -43,6 +43,7 @@ const sandbox_runtime_1 = require("@anthropic-ai/sandbox-runtime");
|
|
|
43
43
|
const ripgrep_1 = require("@vscode/ripgrep");
|
|
44
44
|
const zod_1 = __importStar(require("zod"));
|
|
45
45
|
const mutex_js_1 = require("../utils/mutex.js");
|
|
46
|
+
const prompt_js_1 = require("./prompt.js");
|
|
46
47
|
const DEFAULT_TIMEOUT = 60e3; // 60 seconds
|
|
47
48
|
let sandboxInitialization;
|
|
48
49
|
const mutex = new mutex_js_1.Mutex();
|
|
@@ -55,6 +56,7 @@ class BashAgent extends core_1.Agent {
|
|
|
55
56
|
sandbox: (0, schema_js_1.optionalize)(zod_1.default.union([makeShapePropertiesOptions(sandbox_runtime_1.SandboxRuntimeConfigSchema, 2), zod_1.default.boolean()])),
|
|
56
57
|
inputKey: (0, schema_js_1.optionalize)(zod_1.default.string().describe("The input key for the bash script.")),
|
|
57
58
|
timeout: (0, schema_js_1.optionalize)(zod_1.default.number().describe("Timeout for script execution in milliseconds.")),
|
|
59
|
+
cwd: (0, schema_js_1.optionalize)(zod_1.default.string().describe("Current working directory for script execution.")),
|
|
58
60
|
permissions: (0, schema_js_1.optionalize)((0, schema_js_1.camelizeSchema)(zod_1.default.object({
|
|
59
61
|
allow: (0, schema_js_1.optionalize)(zod_1.default.array(zod_1.default.string())),
|
|
60
62
|
deny: (0, schema_js_1.optionalize)(zod_1.default.array(zod_1.default.string())),
|
|
@@ -84,13 +86,7 @@ class BashAgent extends core_1.Agent {
|
|
|
84
86
|
constructor(options) {
|
|
85
87
|
super({
|
|
86
88
|
name: "Bash",
|
|
87
|
-
description:
|
|
88
|
-
Execute bash scripts and return stdout and stderr output.
|
|
89
|
-
|
|
90
|
-
When to use:
|
|
91
|
-
- Running system commands or bash scripts
|
|
92
|
-
- Interacting with command-line tools
|
|
93
|
-
`,
|
|
89
|
+
description: options.description || prompt_js_1.BASH_AGENT_DESCRIPTION,
|
|
94
90
|
...options,
|
|
95
91
|
inputSchema: zod_1.default.object({
|
|
96
92
|
[options.inputKey || "script"]: zod_1.default.string().describe("The bash script to execute."),
|
|
@@ -111,6 +107,11 @@ When to use:
|
|
|
111
107
|
const script = input[this.inputKey || "script"];
|
|
112
108
|
if (typeof script !== "string")
|
|
113
109
|
throw new Error(`Invalid or missing script input: ${this.inputKey || "script"}`);
|
|
110
|
+
const afsRootDir = await options.caller?.afs?.initializePhysicalPath();
|
|
111
|
+
const env = {
|
|
112
|
+
...process.env,
|
|
113
|
+
AFS_ROOT_DIR: afsRootDir,
|
|
114
|
+
};
|
|
114
115
|
// Permission check
|
|
115
116
|
const permission = await this.checkPermission(script);
|
|
116
117
|
if (permission === "deny") {
|
|
@@ -134,7 +135,7 @@ When to use:
|
|
|
134
135
|
linux: "linux",
|
|
135
136
|
}[globalThis.process.platform] || "unknown";
|
|
136
137
|
if (this.options.sandbox === false) {
|
|
137
|
-
return this.spawn("bash", ["-c", script]);
|
|
138
|
+
return this.spawn("bash", ["-c", script], { env });
|
|
138
139
|
}
|
|
139
140
|
else {
|
|
140
141
|
if (!sandbox_runtime_1.SandboxManager.isSupportedPlatform(platform)) {
|
|
@@ -142,6 +143,7 @@ When to use:
|
|
|
142
143
|
}
|
|
143
144
|
return await this.runInSandbox(typeof this.options.sandbox === "boolean" ? {} : this.options.sandbox, script, async (sandboxedCommand) => {
|
|
144
145
|
return this.spawn(sandboxedCommand, undefined, {
|
|
146
|
+
env,
|
|
145
147
|
shell: true,
|
|
146
148
|
});
|
|
147
149
|
});
|
|
@@ -156,10 +158,13 @@ When to use:
|
|
|
156
158
|
...options,
|
|
157
159
|
stdio: "pipe",
|
|
158
160
|
timeout,
|
|
161
|
+
cwd: this.options.cwd,
|
|
159
162
|
});
|
|
160
163
|
let stderr = "";
|
|
164
|
+
let stdout = "";
|
|
161
165
|
child.stdout.on("data", (chunk) => {
|
|
162
166
|
controller.enqueue({ delta: { text: { stdout: chunk.toString() } } });
|
|
167
|
+
stdout += chunk.toString();
|
|
163
168
|
});
|
|
164
169
|
child.stderr.on("data", (chunk) => {
|
|
165
170
|
controller.enqueue({ delta: { text: { stderr: chunk.toString() } } });
|
|
@@ -172,7 +177,7 @@ When to use:
|
|
|
172
177
|
// Handle timeout or killed by signal
|
|
173
178
|
if (signal) {
|
|
174
179
|
const timeoutHint = signal === "SIGTERM" ? ` (likely timeout ${timeout})` : "";
|
|
175
|
-
controller.error(new Error(`Bash script killed by signal ${signal}${timeoutHint}: ${stderr}`));
|
|
180
|
+
controller.error(new Error(`Bash script killed by signal ${signal}${timeoutHint}:\n stdout: ${stdout}\n stderr: ${stderr}`));
|
|
176
181
|
return;
|
|
177
182
|
}
|
|
178
183
|
// Handle normal exit
|
|
@@ -182,12 +187,12 @@ When to use:
|
|
|
182
187
|
controller.close();
|
|
183
188
|
}
|
|
184
189
|
else {
|
|
185
|
-
controller.error(new Error(`Bash script exited with code ${code}: ${stderr}`));
|
|
190
|
+
controller.error(new Error(`Bash script exited with code ${code}:\n stdout: ${stdout}\n stderr: ${stderr}`));
|
|
186
191
|
}
|
|
187
192
|
}
|
|
188
193
|
else {
|
|
189
194
|
// Unexpected case: no code and no signal
|
|
190
|
-
controller.error(new Error(`Bash script closed unexpectedly: ${stderr}`));
|
|
195
|
+
controller.error(new Error(`Bash script closed unexpectedly:\n stdout: ${stdout}\n stderr: ${stderr}`));
|
|
191
196
|
}
|
|
192
197
|
});
|
|
193
198
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BASH_AGENT_DESCRIPTION = "Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.\n\nIMPORTANT: This tool is for terminal operations like git, npm, docker, etc. DO NOT use it for file operations (reading, writing, editing, searching, finding files) - use the specialized AFS tools for this instead.\n\nBefore executing the command, please follow these steps:\n\n1. Command Execution:\n - Always quote file paths that contain spaces with double quotes (e.g., cd \"path with spaces/file.txt\")\n - After ensuring proper quoting, execute the command.\n - Capture the output of the command.\n\nUsage notes:\n - The command argument is required.\n - Avoid using Bash with the `find`, `grep`, `cat`, `head`, `tail`, `sed`, `awk`, or `echo` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated AFS tools for these commands:\n - File search: Use afs_list (NOT find or ls)\n - Content search: Use afs_search (NOT grep or rg)\n - Read files: Use afs_read (NOT cat/head/tail)\n - Edit files: Use afs_edit (NOT sed/awk)\n - Write files: Use afs_write (NOT echo >/cat <<EOF)\n - Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of `cd`. You may use `cd` if the User explicitly requests it.\n\n# AFS Path Access\nCRITICAL: When accessing AFS content (/modules/*), you MUST use the $AFS_ROOT_DIR environment variable for absolute paths:\n - Good: python $AFS_ROOT_DIR/modules/workspace/script.py\n - Good: cat $AFS_ROOT_DIR/modules/workspace/data.txt | grep error\n - Bad: python /modules/workspace/script.py (path doesn't exist without $AFS_ROOT_DIR)\n\nFor relative paths, use them directly:\n - Good: python script.py\n - Good: node ../other-module/lib/helper.js\n";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BASH_AGENT_DESCRIPTION = void 0;
|
|
4
|
+
exports.BASH_AGENT_DESCRIPTION = `\
|
|
5
|
+
Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.
|
|
6
|
+
|
|
7
|
+
IMPORTANT: This tool is for terminal operations like git, npm, docker, etc. DO NOT use it for file operations (reading, writing, editing, searching, finding files) - use the specialized AFS tools for this instead.
|
|
8
|
+
|
|
9
|
+
Before executing the command, please follow these steps:
|
|
10
|
+
|
|
11
|
+
1. Command Execution:
|
|
12
|
+
- Always quote file paths that contain spaces with double quotes (e.g., cd "path with spaces/file.txt")
|
|
13
|
+
- After ensuring proper quoting, execute the command.
|
|
14
|
+
- Capture the output of the command.
|
|
15
|
+
|
|
16
|
+
Usage notes:
|
|
17
|
+
- The command argument is required.
|
|
18
|
+
- Avoid using Bash with the \`find\`, \`grep\`, \`cat\`, \`head\`, \`tail\`, \`sed\`, \`awk\`, or \`echo\` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated AFS tools for these commands:
|
|
19
|
+
- File search: Use afs_list (NOT find or ls)
|
|
20
|
+
- Content search: Use afs_search (NOT grep or rg)
|
|
21
|
+
- Read files: Use afs_read (NOT cat/head/tail)
|
|
22
|
+
- Edit files: Use afs_edit (NOT sed/awk)
|
|
23
|
+
- Write files: Use afs_write (NOT echo >/cat <<EOF)
|
|
24
|
+
- Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of \`cd\`. You may use \`cd\` if the User explicitly requests it.
|
|
25
|
+
|
|
26
|
+
# AFS Path Access
|
|
27
|
+
CRITICAL: When accessing AFS content (/modules/*), you MUST use the $AFS_ROOT_DIR environment variable for absolute paths:
|
|
28
|
+
- Good: python $AFS_ROOT_DIR/modules/workspace/script.py
|
|
29
|
+
- Good: cat $AFS_ROOT_DIR/modules/workspace/data.txt | grep error
|
|
30
|
+
- Bad: python /modules/workspace/script.py (path doesn't exist without $AFS_ROOT_DIR)
|
|
31
|
+
|
|
32
|
+
For relative paths, use them directly:
|
|
33
|
+
- Good: python script.py
|
|
34
|
+
- Good: node ../other-module/lib/helper.js
|
|
35
|
+
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Agent, type AgentInvokeOptions, type AgentProcessResult, type Message } from "@aigne/core";
|
|
1
|
+
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessResult, type Message } from "@aigne/core";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
export interface AskUserQuestionAgentOption {
|
|
4
4
|
label: string;
|
|
@@ -23,5 +23,6 @@ export default class AskUserQuestionAgent extends Agent<AskUserQuestionAgentInpu
|
|
|
23
23
|
filepath: string;
|
|
24
24
|
parsed: object;
|
|
25
25
|
}): Promise<Agent<I, O>>;
|
|
26
|
+
constructor(options?: AgentOptions<AskUserQuestionAgentInput, AskUserQuestionAgentOutput>);
|
|
26
27
|
process(input: AskUserQuestionAgentInput, options: AgentInvokeOptions): Promise<AgentProcessResult<AskUserQuestionAgentOutput>>;
|
|
27
28
|
}
|
package/lib/dts/bash/index.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ export interface BashAgentOptions extends AgentOptions<BashAgentInput, BashAgent
|
|
|
14
14
|
* @default 60000 (60 seconds)
|
|
15
15
|
*/
|
|
16
16
|
timeout?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Optional current working directory for script execution
|
|
19
|
+
* If not specified, inherits the parent process's working directory
|
|
20
|
+
*/
|
|
21
|
+
cwd?: string;
|
|
17
22
|
/**
|
|
18
23
|
* Optional permissions configuration for command execution control
|
|
19
24
|
* Inspired by Claude Code's permission system
|
|
@@ -71,6 +76,7 @@ export declare class BashAgent extends Agent<BashAgentInput, BashAgentOutput> {
|
|
|
71
76
|
} | undefined>;
|
|
72
77
|
inputKey: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
73
78
|
timeout: z.ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
79
|
+
cwd: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
74
80
|
permissions: z.ZodType<{
|
|
75
81
|
allow?: string[] | undefined;
|
|
76
82
|
deny?: string[] | undefined;
|
|
@@ -88,6 +94,7 @@ export declare class BashAgent extends Agent<BashAgentInput, BashAgentOutput> {
|
|
|
88
94
|
[x: string]: z.ZodTypeAny | undefined;
|
|
89
95
|
} | undefined;
|
|
90
96
|
timeout?: number | undefined;
|
|
97
|
+
cwd?: string | undefined;
|
|
91
98
|
permissions?: {
|
|
92
99
|
allow?: string[] | undefined;
|
|
93
100
|
deny?: string[] | undefined;
|
|
@@ -100,6 +107,7 @@ export declare class BashAgent extends Agent<BashAgentInput, BashAgentOutput> {
|
|
|
100
107
|
[x: string]: z.ZodTypeAny | undefined;
|
|
101
108
|
} | undefined;
|
|
102
109
|
timeout?: number | undefined;
|
|
110
|
+
cwd?: string | undefined;
|
|
103
111
|
permissions?: {
|
|
104
112
|
allow?: string[] | undefined;
|
|
105
113
|
deny?: string[] | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BASH_AGENT_DESCRIPTION = "Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.\n\nIMPORTANT: This tool is for terminal operations like git, npm, docker, etc. DO NOT use it for file operations (reading, writing, editing, searching, finding files) - use the specialized AFS tools for this instead.\n\nBefore executing the command, please follow these steps:\n\n1. Command Execution:\n - Always quote file paths that contain spaces with double quotes (e.g., cd \"path with spaces/file.txt\")\n - After ensuring proper quoting, execute the command.\n - Capture the output of the command.\n\nUsage notes:\n - The command argument is required.\n - Avoid using Bash with the `find`, `grep`, `cat`, `head`, `tail`, `sed`, `awk`, or `echo` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated AFS tools for these commands:\n - File search: Use afs_list (NOT find or ls)\n - Content search: Use afs_search (NOT grep or rg)\n - Read files: Use afs_read (NOT cat/head/tail)\n - Edit files: Use afs_edit (NOT sed/awk)\n - Write files: Use afs_write (NOT echo >/cat <<EOF)\n - Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of `cd`. You may use `cd` if the User explicitly requests it.\n\n# AFS Path Access\nCRITICAL: When accessing AFS content (/modules/*), you MUST use the $AFS_ROOT_DIR environment variable for absolute paths:\n - Good: python $AFS_ROOT_DIR/modules/workspace/script.py\n - Good: cat $AFS_ROOT_DIR/modules/workspace/data.txt | grep error\n - Bad: python /modules/workspace/script.py (path doesn't exist without $AFS_ROOT_DIR)\n\nFor relative paths, use them directly:\n - Good: python script.py\n - Good: node ../other-module/lib/helper.js\n";
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { AIAgent, } from "@aigne/core";
|
|
2
|
-
import { instructionsToPromptBuilder } from "@aigne/core/loader/schema.js";
|
|
3
2
|
import { AgentSkillManagerSystemPrompt } from "./prompt.js";
|
|
4
3
|
export default class AgentSkillManagerAgent extends AIAgent {
|
|
5
4
|
static async load(options) {
|
|
6
5
|
const schema = AIAgent.schema(options);
|
|
7
6
|
const valid = await schema.parseAsync(options.parsed);
|
|
8
|
-
return
|
|
9
|
-
...options
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
return AIAgent.load({
|
|
8
|
+
...options,
|
|
9
|
+
parsed: {
|
|
10
|
+
...options.parsed,
|
|
11
|
+
instructions: valid.instructions || [
|
|
12
|
+
{ role: "system", content: AgentSkillManagerSystemPrompt, path: options.filepath },
|
|
13
|
+
],
|
|
14
|
+
},
|
|
12
15
|
});
|
|
13
16
|
}
|
|
14
17
|
constructor(options) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Agent, type AgentInvokeOptions, type AgentProcessResult, type Message } from "@aigne/core";
|
|
1
|
+
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessResult, type Message } from "@aigne/core";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
export interface AskUserQuestionAgentOption {
|
|
4
4
|
label: string;
|
|
@@ -23,5 +23,6 @@ export default class AskUserQuestionAgent extends Agent<AskUserQuestionAgentInpu
|
|
|
23
23
|
filepath: string;
|
|
24
24
|
parsed: object;
|
|
25
25
|
}): Promise<Agent<I, O>>;
|
|
26
|
+
constructor(options?: AgentOptions<AskUserQuestionAgentInput, AskUserQuestionAgentOutput>);
|
|
26
27
|
process(input: AskUserQuestionAgentInput, options: AgentInvokeOptions): Promise<AgentProcessResult<AskUserQuestionAgentOutput>>;
|
|
27
28
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Agent } from "@aigne/core";
|
|
1
|
+
import { Agent, } from "@aigne/core";
|
|
2
2
|
import { optionalize } from "@aigne/core/loader/schema.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
const askUserQuestionAgentOptionSchema = z.object({
|
|
@@ -31,6 +31,14 @@ export default class AskUserQuestionAgent extends Agent {
|
|
|
31
31
|
inputSchema: askUserQuestionAgentInputSchema,
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
+
constructor(options) {
|
|
35
|
+
super({
|
|
36
|
+
...options,
|
|
37
|
+
name: options?.name || defaultName,
|
|
38
|
+
description: options?.description || defaultDescription,
|
|
39
|
+
inputSchema: options?.inputSchema || askUserQuestionAgentInputSchema,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
34
42
|
async process(input, options) {
|
|
35
43
|
const { prompts } = options;
|
|
36
44
|
if (!prompts)
|
package/lib/esm/bash/index.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ export interface BashAgentOptions extends AgentOptions<BashAgentInput, BashAgent
|
|
|
14
14
|
* @default 60000 (60 seconds)
|
|
15
15
|
*/
|
|
16
16
|
timeout?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Optional current working directory for script execution
|
|
19
|
+
* If not specified, inherits the parent process's working directory
|
|
20
|
+
*/
|
|
21
|
+
cwd?: string;
|
|
17
22
|
/**
|
|
18
23
|
* Optional permissions configuration for command execution control
|
|
19
24
|
* Inspired by Claude Code's permission system
|
|
@@ -71,6 +76,7 @@ export declare class BashAgent extends Agent<BashAgentInput, BashAgentOutput> {
|
|
|
71
76
|
} | undefined>;
|
|
72
77
|
inputKey: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
73
78
|
timeout: z.ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
79
|
+
cwd: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
74
80
|
permissions: z.ZodType<{
|
|
75
81
|
allow?: string[] | undefined;
|
|
76
82
|
deny?: string[] | undefined;
|
|
@@ -88,6 +94,7 @@ export declare class BashAgent extends Agent<BashAgentInput, BashAgentOutput> {
|
|
|
88
94
|
[x: string]: z.ZodTypeAny | undefined;
|
|
89
95
|
} | undefined;
|
|
90
96
|
timeout?: number | undefined;
|
|
97
|
+
cwd?: string | undefined;
|
|
91
98
|
permissions?: {
|
|
92
99
|
allow?: string[] | undefined;
|
|
93
100
|
deny?: string[] | undefined;
|
|
@@ -100,6 +107,7 @@ export declare class BashAgent extends Agent<BashAgentInput, BashAgentOutput> {
|
|
|
100
107
|
[x: string]: z.ZodTypeAny | undefined;
|
|
101
108
|
} | undefined;
|
|
102
109
|
timeout?: number | undefined;
|
|
110
|
+
cwd?: string | undefined;
|
|
103
111
|
permissions?: {
|
|
104
112
|
allow?: string[] | undefined;
|
|
105
113
|
deny?: string[] | undefined;
|
package/lib/esm/bash/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { SandboxManager, SandboxRuntimeConfigSchema, } from "@anthropic-ai/sandb
|
|
|
7
7
|
import { rgPath } from "@vscode/ripgrep";
|
|
8
8
|
import z, { ZodObject } from "zod";
|
|
9
9
|
import { Mutex } from "../utils/mutex.js";
|
|
10
|
+
import { BASH_AGENT_DESCRIPTION } from "./prompt.js";
|
|
10
11
|
const DEFAULT_TIMEOUT = 60e3; // 60 seconds
|
|
11
12
|
let sandboxInitialization;
|
|
12
13
|
const mutex = new Mutex();
|
|
@@ -19,6 +20,7 @@ export class BashAgent extends Agent {
|
|
|
19
20
|
sandbox: optionalize(z.union([makeShapePropertiesOptions(SandboxRuntimeConfigSchema, 2), z.boolean()])),
|
|
20
21
|
inputKey: optionalize(z.string().describe("The input key for the bash script.")),
|
|
21
22
|
timeout: optionalize(z.number().describe("Timeout for script execution in milliseconds.")),
|
|
23
|
+
cwd: optionalize(z.string().describe("Current working directory for script execution.")),
|
|
22
24
|
permissions: optionalize(camelizeSchema(z.object({
|
|
23
25
|
allow: optionalize(z.array(z.string())),
|
|
24
26
|
deny: optionalize(z.array(z.string())),
|
|
@@ -48,13 +50,7 @@ export class BashAgent extends Agent {
|
|
|
48
50
|
constructor(options) {
|
|
49
51
|
super({
|
|
50
52
|
name: "Bash",
|
|
51
|
-
description:
|
|
52
|
-
Execute bash scripts and return stdout and stderr output.
|
|
53
|
-
|
|
54
|
-
When to use:
|
|
55
|
-
- Running system commands or bash scripts
|
|
56
|
-
- Interacting with command-line tools
|
|
57
|
-
`,
|
|
53
|
+
description: options.description || BASH_AGENT_DESCRIPTION,
|
|
58
54
|
...options,
|
|
59
55
|
inputSchema: z.object({
|
|
60
56
|
[options.inputKey || "script"]: z.string().describe("The bash script to execute."),
|
|
@@ -75,6 +71,11 @@ When to use:
|
|
|
75
71
|
const script = input[this.inputKey || "script"];
|
|
76
72
|
if (typeof script !== "string")
|
|
77
73
|
throw new Error(`Invalid or missing script input: ${this.inputKey || "script"}`);
|
|
74
|
+
const afsRootDir = await options.caller?.afs?.initializePhysicalPath();
|
|
75
|
+
const env = {
|
|
76
|
+
...process.env,
|
|
77
|
+
AFS_ROOT_DIR: afsRootDir,
|
|
78
|
+
};
|
|
78
79
|
// Permission check
|
|
79
80
|
const permission = await this.checkPermission(script);
|
|
80
81
|
if (permission === "deny") {
|
|
@@ -98,7 +99,7 @@ When to use:
|
|
|
98
99
|
linux: "linux",
|
|
99
100
|
}[globalThis.process.platform] || "unknown";
|
|
100
101
|
if (this.options.sandbox === false) {
|
|
101
|
-
return this.spawn("bash", ["-c", script]);
|
|
102
|
+
return this.spawn("bash", ["-c", script], { env });
|
|
102
103
|
}
|
|
103
104
|
else {
|
|
104
105
|
if (!SandboxManager.isSupportedPlatform(platform)) {
|
|
@@ -106,6 +107,7 @@ When to use:
|
|
|
106
107
|
}
|
|
107
108
|
return await this.runInSandbox(typeof this.options.sandbox === "boolean" ? {} : this.options.sandbox, script, async (sandboxedCommand) => {
|
|
108
109
|
return this.spawn(sandboxedCommand, undefined, {
|
|
110
|
+
env,
|
|
109
111
|
shell: true,
|
|
110
112
|
});
|
|
111
113
|
});
|
|
@@ -120,10 +122,13 @@ When to use:
|
|
|
120
122
|
...options,
|
|
121
123
|
stdio: "pipe",
|
|
122
124
|
timeout,
|
|
125
|
+
cwd: this.options.cwd,
|
|
123
126
|
});
|
|
124
127
|
let stderr = "";
|
|
128
|
+
let stdout = "";
|
|
125
129
|
child.stdout.on("data", (chunk) => {
|
|
126
130
|
controller.enqueue({ delta: { text: { stdout: chunk.toString() } } });
|
|
131
|
+
stdout += chunk.toString();
|
|
127
132
|
});
|
|
128
133
|
child.stderr.on("data", (chunk) => {
|
|
129
134
|
controller.enqueue({ delta: { text: { stderr: chunk.toString() } } });
|
|
@@ -136,7 +141,7 @@ When to use:
|
|
|
136
141
|
// Handle timeout or killed by signal
|
|
137
142
|
if (signal) {
|
|
138
143
|
const timeoutHint = signal === "SIGTERM" ? ` (likely timeout ${timeout})` : "";
|
|
139
|
-
controller.error(new Error(`Bash script killed by signal ${signal}${timeoutHint}: ${stderr}`));
|
|
144
|
+
controller.error(new Error(`Bash script killed by signal ${signal}${timeoutHint}:\n stdout: ${stdout}\n stderr: ${stderr}`));
|
|
140
145
|
return;
|
|
141
146
|
}
|
|
142
147
|
// Handle normal exit
|
|
@@ -146,12 +151,12 @@ When to use:
|
|
|
146
151
|
controller.close();
|
|
147
152
|
}
|
|
148
153
|
else {
|
|
149
|
-
controller.error(new Error(`Bash script exited with code ${code}: ${stderr}`));
|
|
154
|
+
controller.error(new Error(`Bash script exited with code ${code}:\n stdout: ${stdout}\n stderr: ${stderr}`));
|
|
150
155
|
}
|
|
151
156
|
}
|
|
152
157
|
else {
|
|
153
158
|
// Unexpected case: no code and no signal
|
|
154
|
-
controller.error(new Error(`Bash script closed unexpectedly: ${stderr}`));
|
|
159
|
+
controller.error(new Error(`Bash script closed unexpectedly:\n stdout: ${stdout}\n stderr: ${stderr}`));
|
|
155
160
|
}
|
|
156
161
|
});
|
|
157
162
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BASH_AGENT_DESCRIPTION = "Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.\n\nIMPORTANT: This tool is for terminal operations like git, npm, docker, etc. DO NOT use it for file operations (reading, writing, editing, searching, finding files) - use the specialized AFS tools for this instead.\n\nBefore executing the command, please follow these steps:\n\n1. Command Execution:\n - Always quote file paths that contain spaces with double quotes (e.g., cd \"path with spaces/file.txt\")\n - After ensuring proper quoting, execute the command.\n - Capture the output of the command.\n\nUsage notes:\n - The command argument is required.\n - Avoid using Bash with the `find`, `grep`, `cat`, `head`, `tail`, `sed`, `awk`, or `echo` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated AFS tools for these commands:\n - File search: Use afs_list (NOT find or ls)\n - Content search: Use afs_search (NOT grep or rg)\n - Read files: Use afs_read (NOT cat/head/tail)\n - Edit files: Use afs_edit (NOT sed/awk)\n - Write files: Use afs_write (NOT echo >/cat <<EOF)\n - Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of `cd`. You may use `cd` if the User explicitly requests it.\n\n# AFS Path Access\nCRITICAL: When accessing AFS content (/modules/*), you MUST use the $AFS_ROOT_DIR environment variable for absolute paths:\n - Good: python $AFS_ROOT_DIR/modules/workspace/script.py\n - Good: cat $AFS_ROOT_DIR/modules/workspace/data.txt | grep error\n - Bad: python /modules/workspace/script.py (path doesn't exist without $AFS_ROOT_DIR)\n\nFor relative paths, use them directly:\n - Good: python script.py\n - Good: node ../other-module/lib/helper.js\n";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const BASH_AGENT_DESCRIPTION = `\
|
|
2
|
+
Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.
|
|
3
|
+
|
|
4
|
+
IMPORTANT: This tool is for terminal operations like git, npm, docker, etc. DO NOT use it for file operations (reading, writing, editing, searching, finding files) - use the specialized AFS tools for this instead.
|
|
5
|
+
|
|
6
|
+
Before executing the command, please follow these steps:
|
|
7
|
+
|
|
8
|
+
1. Command Execution:
|
|
9
|
+
- Always quote file paths that contain spaces with double quotes (e.g., cd "path with spaces/file.txt")
|
|
10
|
+
- After ensuring proper quoting, execute the command.
|
|
11
|
+
- Capture the output of the command.
|
|
12
|
+
|
|
13
|
+
Usage notes:
|
|
14
|
+
- The command argument is required.
|
|
15
|
+
- Avoid using Bash with the \`find\`, \`grep\`, \`cat\`, \`head\`, \`tail\`, \`sed\`, \`awk\`, or \`echo\` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated AFS tools for these commands:
|
|
16
|
+
- File search: Use afs_list (NOT find or ls)
|
|
17
|
+
- Content search: Use afs_search (NOT grep or rg)
|
|
18
|
+
- Read files: Use afs_read (NOT cat/head/tail)
|
|
19
|
+
- Edit files: Use afs_edit (NOT sed/awk)
|
|
20
|
+
- Write files: Use afs_write (NOT echo >/cat <<EOF)
|
|
21
|
+
- Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of \`cd\`. You may use \`cd\` if the User explicitly requests it.
|
|
22
|
+
|
|
23
|
+
# AFS Path Access
|
|
24
|
+
CRITICAL: When accessing AFS content (/modules/*), you MUST use the $AFS_ROOT_DIR environment variable for absolute paths:
|
|
25
|
+
- Good: python $AFS_ROOT_DIR/modules/workspace/script.py
|
|
26
|
+
- Good: cat $AFS_ROOT_DIR/modules/workspace/data.txt | grep error
|
|
27
|
+
- Bad: python /modules/workspace/script.py (path doesn't exist without $AFS_ROOT_DIR)
|
|
28
|
+
|
|
29
|
+
For relative paths, use them directly:
|
|
30
|
+
- Good: python script.py
|
|
31
|
+
- Good: node ../other-module/lib/helper.js
|
|
32
|
+
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/agent-library",
|
|
3
|
-
"version": "1.24.0
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "Collection of agent libraries for AIGNE framework",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -57,15 +57,16 @@
|
|
|
57
57
|
"yaml": "^2.8.1",
|
|
58
58
|
"zod": "^3.25.67",
|
|
59
59
|
"zod-to-json-schema": "^3.24.6",
|
|
60
|
-
"@aigne/core": "^1.72.0
|
|
61
|
-
"@aigne/openai": "^0.16.16
|
|
62
|
-
"@aigne/sqlite": "^0.4.9
|
|
60
|
+
"@aigne/core": "^1.72.0",
|
|
61
|
+
"@aigne/openai": "^0.16.16",
|
|
62
|
+
"@aigne/sqlite": "^0.4.9"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/bun": "^1.2.22",
|
|
66
66
|
"npm-run-all": "^4.1.5",
|
|
67
67
|
"rimraf": "^6.0.1",
|
|
68
|
-
"typescript": "^5.9.2"
|
|
68
|
+
"typescript": "^5.9.2",
|
|
69
|
+
"@aigne/test-utils": "^0.5.69"
|
|
69
70
|
},
|
|
70
71
|
"scripts": {
|
|
71
72
|
"lint": "tsc --noEmit",
|