@aigne/agent-library 1.24.0 → 1.74.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/README.md +12 -12
  2. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  3. package/dist/agent-skill-manager/index.cjs +30 -0
  4. package/dist/agent-skill-manager/index.d.cts +14 -0
  5. package/dist/agent-skill-manager/index.d.cts.map +1 -0
  6. package/dist/agent-skill-manager/index.d.mts +14 -0
  7. package/dist/agent-skill-manager/index.d.mts.map +1 -0
  8. package/dist/agent-skill-manager/index.mjs +30 -0
  9. package/dist/agent-skill-manager/index.mjs.map +1 -0
  10. package/{lib/esm/agent-skill-manager/prompt.js → dist/agent-skill-manager/prompt.cjs} +8 -3
  11. package/{lib/cjs/agent-skill-manager/prompt.js → dist/agent-skill-manager/prompt.mjs} +8 -6
  12. package/dist/agent-skill-manager/prompt.mjs.map +1 -0
  13. package/dist/ask-user-question/index.cjs +88 -0
  14. package/dist/ask-user-question/index.d.cts +33 -0
  15. package/dist/ask-user-question/index.d.cts.map +1 -0
  16. package/dist/ask-user-question/index.d.mts +33 -0
  17. package/dist/ask-user-question/index.d.mts.map +1 -0
  18. package/dist/ask-user-question/index.mjs +88 -0
  19. package/dist/ask-user-question/index.mjs.map +1 -0
  20. package/dist/bash/index.cjs +274 -0
  21. package/dist/bash/index.d.cts +184 -0
  22. package/dist/bash/index.d.cts.map +1 -0
  23. package/dist/bash/index.d.mts +184 -0
  24. package/dist/bash/index.d.mts.map +1 -0
  25. package/dist/bash/index.mjs +271 -0
  26. package/dist/bash/index.mjs.map +1 -0
  27. package/{lib/esm/bash/prompt.js → dist/bash/prompt.cjs} +6 -1
  28. package/{lib/cjs/bash/prompt.js → dist/bash/prompt.mjs} +6 -4
  29. package/dist/bash/prompt.mjs.map +1 -0
  30. package/dist/data-mapper/agents/mapper.cjs +62 -0
  31. package/dist/data-mapper/agents/mapper.mjs +62 -0
  32. package/dist/data-mapper/agents/mapper.mjs.map +1 -0
  33. package/dist/data-mapper/agents/reviewer.cjs +46 -0
  34. package/dist/data-mapper/agents/reviewer.mjs +46 -0
  35. package/dist/data-mapper/agents/reviewer.mjs.map +1 -0
  36. package/dist/data-mapper/index.cjs +25 -0
  37. package/dist/data-mapper/index.d.cts +26 -0
  38. package/dist/data-mapper/index.d.cts.map +1 -0
  39. package/dist/data-mapper/index.d.mts +26 -0
  40. package/dist/data-mapper/index.d.mts.map +1 -0
  41. package/dist/data-mapper/index.mjs +24 -0
  42. package/dist/data-mapper/index.mjs.map +1 -0
  43. package/{lib/esm/data-mapper/prompts.js → dist/data-mapper/prompts.cjs} +6 -1
  44. package/{lib/cjs/data-mapper/prompts.js → dist/data-mapper/prompts.mjs} +6 -4
  45. package/dist/data-mapper/prompts.mjs.map +1 -0
  46. package/dist/data-mapper/tools.cjs +119 -0
  47. package/dist/data-mapper/tools.d.cts +5 -0
  48. package/dist/data-mapper/tools.d.cts.map +1 -0
  49. package/dist/data-mapper/tools.d.mts +8 -0
  50. package/dist/data-mapper/tools.d.mts.map +1 -0
  51. package/dist/data-mapper/tools.mjs +117 -0
  52. package/dist/data-mapper/tools.mjs.map +1 -0
  53. package/dist/index.cjs +0 -0
  54. package/dist/index.d.cts +1 -0
  55. package/dist/index.d.mts +1 -0
  56. package/dist/index.mjs +1 -0
  57. package/dist/orchestrator/index.cjs +233 -0
  58. package/dist/orchestrator/index.d.cts +89 -0
  59. package/dist/orchestrator/index.d.cts.map +1 -0
  60. package/dist/orchestrator/index.d.mts +89 -0
  61. package/dist/orchestrator/index.d.mts.map +1 -0
  62. package/dist/orchestrator/index.mjs +230 -0
  63. package/dist/orchestrator/index.mjs.map +1 -0
  64. package/{lib/cjs/orchestrator/prompt.js → dist/orchestrator/prompt.cjs} +32 -28
  65. package/{lib/esm/orchestrator/prompt.js → dist/orchestrator/prompt.mjs} +30 -25
  66. package/dist/orchestrator/prompt.mjs.map +1 -0
  67. package/dist/orchestrator/type.cjs +74 -0
  68. package/dist/orchestrator/type.d.cts +27 -0
  69. package/dist/orchestrator/type.d.cts.map +1 -0
  70. package/dist/orchestrator/type.d.mts +27 -0
  71. package/dist/orchestrator/type.d.mts.map +1 -0
  72. package/dist/orchestrator/type.mjs +67 -0
  73. package/dist/orchestrator/type.mjs.map +1 -0
  74. package/dist/utils/fs.cjs +23 -0
  75. package/dist/utils/fs.d.cts +6 -0
  76. package/dist/utils/fs.d.cts.map +1 -0
  77. package/dist/utils/fs.d.mts +6 -0
  78. package/dist/utils/fs.d.mts.map +1 -0
  79. package/dist/utils/fs.mjs +22 -0
  80. package/dist/utils/fs.mjs.map +1 -0
  81. package/dist/utils/mutex.cjs +28 -0
  82. package/dist/utils/mutex.d.cts +10 -0
  83. package/dist/utils/mutex.d.cts.map +1 -0
  84. package/dist/utils/mutex.d.mts +10 -0
  85. package/dist/utils/mutex.d.mts.map +1 -0
  86. package/dist/utils/mutex.mjs +28 -0
  87. package/dist/utils/mutex.mjs.map +1 -0
  88. package/package.json +51 -35
  89. package/CHANGELOG.md +0 -2392
  90. package/lib/cjs/agent-skill-manager/index.d.ts +0 -10
  91. package/lib/cjs/agent-skill-manager/index.js +0 -26
  92. package/lib/cjs/agent-skill-manager/prompt.d.ts +0 -1
  93. package/lib/cjs/ask-user-question/index.d.ts +0 -28
  94. package/lib/cjs/ask-user-question/index.js +0 -108
  95. package/lib/cjs/bash/index.d.ts +0 -180
  96. package/lib/cjs/bash/index.js +0 -365
  97. package/lib/cjs/bash/prompt.d.ts +0 -1
  98. package/lib/cjs/data-mapper/agents/mapper.d.ts +0 -14
  99. package/lib/cjs/data-mapper/agents/mapper.js +0 -63
  100. package/lib/cjs/data-mapper/agents/reviewer.d.ts +0 -19
  101. package/lib/cjs/data-mapper/agents/reviewer.js +0 -47
  102. package/lib/cjs/data-mapper/index.d.ts +0 -18
  103. package/lib/cjs/data-mapper/index.js +0 -24
  104. package/lib/cjs/data-mapper/prompts.d.ts +0 -1
  105. package/lib/cjs/data-mapper/tools.d.ts +0 -11
  106. package/lib/cjs/data-mapper/tools.js +0 -164
  107. package/lib/cjs/index.d.ts +0 -1
  108. package/lib/cjs/index.js +0 -2
  109. package/lib/cjs/orchestrator/index.d.ts +0 -78
  110. package/lib/cjs/orchestrator/index.js +0 -277
  111. package/lib/cjs/orchestrator/prompt.d.ts +0 -3
  112. package/lib/cjs/orchestrator/type.d.ts +0 -388
  113. package/lib/cjs/orchestrator/type.js +0 -95
  114. package/lib/cjs/package.json +0 -3
  115. package/lib/cjs/utils/fs.d.ts +0 -2
  116. package/lib/cjs/utils/fs.js +0 -25
  117. package/lib/cjs/utils/mutex.d.ts +0 -6
  118. package/lib/cjs/utils/mutex.js +0 -28
  119. package/lib/dts/agent-skill-manager/index.d.ts +0 -10
  120. package/lib/dts/agent-skill-manager/prompt.d.ts +0 -1
  121. package/lib/dts/ask-user-question/index.d.ts +0 -28
  122. package/lib/dts/bash/index.d.ts +0 -180
  123. package/lib/dts/bash/prompt.d.ts +0 -1
  124. package/lib/dts/data-mapper/agents/mapper.d.ts +0 -14
  125. package/lib/dts/data-mapper/agents/reviewer.d.ts +0 -19
  126. package/lib/dts/data-mapper/index.d.ts +0 -18
  127. package/lib/dts/data-mapper/prompts.d.ts +0 -1
  128. package/lib/dts/data-mapper/tools.d.ts +0 -11
  129. package/lib/dts/index.d.ts +0 -1
  130. package/lib/dts/orchestrator/index.d.ts +0 -78
  131. package/lib/dts/orchestrator/prompt.d.ts +0 -3
  132. package/lib/dts/orchestrator/type.d.ts +0 -388
  133. package/lib/dts/utils/fs.d.ts +0 -2
  134. package/lib/dts/utils/mutex.d.ts +0 -6
  135. package/lib/esm/agent-skill-manager/index.d.ts +0 -10
  136. package/lib/esm/agent-skill-manager/index.js +0 -23
  137. package/lib/esm/agent-skill-manager/prompt.d.ts +0 -1
  138. package/lib/esm/ask-user-question/index.d.ts +0 -28
  139. package/lib/esm/ask-user-question/index.js +0 -105
  140. package/lib/esm/bash/index.d.ts +0 -180
  141. package/lib/esm/bash/index.js +0 -328
  142. package/lib/esm/bash/prompt.d.ts +0 -1
  143. package/lib/esm/data-mapper/agents/mapper.d.ts +0 -14
  144. package/lib/esm/data-mapper/agents/mapper.js +0 -61
  145. package/lib/esm/data-mapper/agents/reviewer.d.ts +0 -19
  146. package/lib/esm/data-mapper/agents/reviewer.js +0 -45
  147. package/lib/esm/data-mapper/index.d.ts +0 -18
  148. package/lib/esm/data-mapper/index.js +0 -16
  149. package/lib/esm/data-mapper/prompts.d.ts +0 -1
  150. package/lib/esm/data-mapper/tools.d.ts +0 -11
  151. package/lib/esm/data-mapper/tools.js +0 -155
  152. package/lib/esm/index.d.ts +0 -1
  153. package/lib/esm/index.js +0 -1
  154. package/lib/esm/orchestrator/index.d.ts +0 -78
  155. package/lib/esm/orchestrator/index.js +0 -240
  156. package/lib/esm/orchestrator/prompt.d.ts +0 -3
  157. package/lib/esm/orchestrator/type.d.ts +0 -388
  158. package/lib/esm/orchestrator/type.js +0 -89
  159. package/lib/esm/package.json +0 -3
  160. package/lib/esm/utils/fs.d.ts +0 -2
  161. package/lib/esm/utils/fs.js +0 -21
  162. package/lib/esm/utils/mutex.d.ts +0 -6
  163. package/lib/esm/utils/mutex.js +0 -24
@@ -1,388 +0,0 @@
1
- import type { Message } from "@aigne/core";
2
- import z from "zod";
3
- /**
4
- * Task execution status
5
- */
6
- export type TaskStatus = "pending" | "completed" | "failed";
7
- /**
8
- * Individual task execution record
9
- */
10
- export interface TaskRecord {
11
- /** Task description */
12
- task: string;
13
- /** Task execution status */
14
- status: TaskStatus;
15
- /** Task execution result (can be any type) */
16
- result?: unknown;
17
- /** Error information if task failed */
18
- error?: {
19
- message: string;
20
- };
21
- /** Timestamp when task was created */
22
- createdAt?: number;
23
- /** Timestamp when task was completed or failed */
24
- completedAt?: number;
25
- }
26
- /**
27
- * Execution state tracking all tasks
28
- */
29
- export interface ExecutionState {
30
- tasks: TaskRecord[];
31
- }
32
- export declare const taskRecordSchema: z.ZodObject<{
33
- task: z.ZodString;
34
- status: z.ZodEnum<["pending", "completed", "failed"]>;
35
- result: z.ZodOptional<z.ZodUnknown>;
36
- error: z.ZodOptional<z.ZodObject<{
37
- message: z.ZodString;
38
- }, "strip", z.ZodTypeAny, {
39
- message: string;
40
- }, {
41
- message: string;
42
- }>>;
43
- createdAt: z.ZodOptional<z.ZodNumber>;
44
- completedAt: z.ZodOptional<z.ZodNumber>;
45
- }, "strip", z.ZodTypeAny, {
46
- status: "pending" | "completed" | "failed";
47
- task: string;
48
- error?: {
49
- message: string;
50
- } | undefined;
51
- result?: unknown;
52
- createdAt?: number | undefined;
53
- completedAt?: number | undefined;
54
- }, {
55
- status: "pending" | "completed" | "failed";
56
- task: string;
57
- error?: {
58
- message: string;
59
- } | undefined;
60
- result?: unknown;
61
- createdAt?: number | undefined;
62
- completedAt?: number | undefined;
63
- }>;
64
- export declare const executionStateSchema: z.ZodObject<{
65
- tasks: z.ZodArray<z.ZodObject<{
66
- task: z.ZodString;
67
- status: z.ZodEnum<["pending", "completed", "failed"]>;
68
- result: z.ZodOptional<z.ZodUnknown>;
69
- error: z.ZodOptional<z.ZodObject<{
70
- message: z.ZodString;
71
- }, "strip", z.ZodTypeAny, {
72
- message: string;
73
- }, {
74
- message: string;
75
- }>>;
76
- createdAt: z.ZodOptional<z.ZodNumber>;
77
- completedAt: z.ZodOptional<z.ZodNumber>;
78
- }, "strip", z.ZodTypeAny, {
79
- status: "pending" | "completed" | "failed";
80
- task: string;
81
- error?: {
82
- message: string;
83
- } | undefined;
84
- result?: unknown;
85
- createdAt?: number | undefined;
86
- completedAt?: number | undefined;
87
- }, {
88
- status: "pending" | "completed" | "failed";
89
- task: string;
90
- error?: {
91
- message: string;
92
- } | undefined;
93
- result?: unknown;
94
- createdAt?: number | undefined;
95
- completedAt?: number | undefined;
96
- }>, "many">;
97
- }, "strip", z.ZodTypeAny, {
98
- tasks: {
99
- status: "pending" | "completed" | "failed";
100
- task: string;
101
- error?: {
102
- message: string;
103
- } | undefined;
104
- result?: unknown;
105
- createdAt?: number | undefined;
106
- completedAt?: number | undefined;
107
- }[];
108
- }, {
109
- tasks: {
110
- status: "pending" | "completed" | "failed";
111
- task: string;
112
- error?: {
113
- message: string;
114
- } | undefined;
115
- result?: unknown;
116
- createdAt?: number | undefined;
117
- completedAt?: number | undefined;
118
- }[];
119
- }>;
120
- export interface PlannerInput extends Message {
121
- objective?: string;
122
- executionState?: ExecutionState;
123
- }
124
- export declare const plannerInputSchema: z.ZodObject<{
125
- objective: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
126
- executionState: z.ZodType<{
127
- tasks: {
128
- status: "pending" | "completed" | "failed";
129
- task: string;
130
- error?: {
131
- message: string;
132
- } | undefined;
133
- result?: unknown;
134
- createdAt?: number | undefined;
135
- completedAt?: number | undefined;
136
- }[];
137
- } | undefined, z.ZodTypeDef, {
138
- tasks: {
139
- status: "pending" | "completed" | "failed";
140
- task: string;
141
- error?: {
142
- message: string;
143
- } | undefined;
144
- result?: unknown;
145
- createdAt?: number | undefined;
146
- completedAt?: number | undefined;
147
- }[];
148
- } | undefined>;
149
- }, "strip", z.ZodTypeAny, {
150
- objective?: string | undefined;
151
- executionState?: {
152
- tasks: {
153
- status: "pending" | "completed" | "failed";
154
- task: string;
155
- error?: {
156
- message: string;
157
- } | undefined;
158
- result?: unknown;
159
- createdAt?: number | undefined;
160
- completedAt?: number | undefined;
161
- }[];
162
- } | undefined;
163
- }, {
164
- objective?: string | undefined;
165
- executionState?: {
166
- tasks: {
167
- status: "pending" | "completed" | "failed";
168
- task: string;
169
- error?: {
170
- message: string;
171
- } | undefined;
172
- result?: unknown;
173
- createdAt?: number | undefined;
174
- completedAt?: number | undefined;
175
- }[];
176
- } | undefined;
177
- }>;
178
- export interface PlannerOutput extends Message {
179
- nextTasks?: string[];
180
- parallelTasks?: boolean;
181
- finished?: boolean;
182
- }
183
- export declare const plannerOutputSchema: z.ZodObject<{
184
- nextTasks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
185
- parallelTasks: z.ZodOptional<z.ZodBoolean>;
186
- finished: z.ZodOptional<z.ZodBoolean>;
187
- }, "strip", z.ZodTypeAny, {
188
- nextTasks?: string[] | undefined;
189
- parallelTasks?: boolean | undefined;
190
- finished?: boolean | undefined;
191
- }, {
192
- nextTasks?: string[] | undefined;
193
- parallelTasks?: boolean | undefined;
194
- finished?: boolean | undefined;
195
- }>;
196
- export interface WorkerInput extends Message {
197
- objective?: string;
198
- executionState?: ExecutionState;
199
- task?: string;
200
- }
201
- export declare const workerInputSchema: z.ZodObject<{
202
- objective: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
203
- task: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
204
- executionState: z.ZodType<{
205
- tasks: {
206
- status: "pending" | "completed" | "failed";
207
- task: string;
208
- error?: {
209
- message: string;
210
- } | undefined;
211
- result?: unknown;
212
- createdAt?: number | undefined;
213
- completedAt?: number | undefined;
214
- }[];
215
- } | undefined, z.ZodTypeDef, {
216
- tasks: {
217
- status: "pending" | "completed" | "failed";
218
- task: string;
219
- error?: {
220
- message: string;
221
- } | undefined;
222
- result?: unknown;
223
- createdAt?: number | undefined;
224
- completedAt?: number | undefined;
225
- }[];
226
- } | undefined>;
227
- }, "strip", z.ZodTypeAny, {
228
- task?: string | undefined;
229
- objective?: string | undefined;
230
- executionState?: {
231
- tasks: {
232
- status: "pending" | "completed" | "failed";
233
- task: string;
234
- error?: {
235
- message: string;
236
- } | undefined;
237
- result?: unknown;
238
- createdAt?: number | undefined;
239
- completedAt?: number | undefined;
240
- }[];
241
- } | undefined;
242
- }, {
243
- task?: string | undefined;
244
- objective?: string | undefined;
245
- executionState?: {
246
- tasks: {
247
- status: "pending" | "completed" | "failed";
248
- task: string;
249
- error?: {
250
- message: string;
251
- } | undefined;
252
- result?: unknown;
253
- createdAt?: number | undefined;
254
- completedAt?: number | undefined;
255
- }[];
256
- } | undefined;
257
- }>;
258
- /**
259
- * Worker output structure
260
- */
261
- export interface WorkerOutput extends Message {
262
- /** Task execution result */
263
- result?: string;
264
- /** Whether the task was completed successfully */
265
- success: boolean;
266
- /** Error information if task failed */
267
- error?: {
268
- message: string;
269
- };
270
- }
271
- export declare const workerOutputSchema: z.ZodObject<{
272
- result: z.ZodOptional<z.ZodString>;
273
- success: z.ZodBoolean;
274
- error: z.ZodOptional<z.ZodObject<{
275
- message: z.ZodString;
276
- }, "strip", z.ZodTypeAny, {
277
- message: string;
278
- }, {
279
- message: string;
280
- }>>;
281
- }, "strip", z.ZodTypeAny, {
282
- success: boolean;
283
- error?: {
284
- message: string;
285
- } | undefined;
286
- result?: string | undefined;
287
- }, {
288
- success: boolean;
289
- error?: {
290
- message: string;
291
- } | undefined;
292
- result?: string | undefined;
293
- }>;
294
- export interface CompleterInput extends Message {
295
- objective?: string;
296
- executionState?: ExecutionState;
297
- }
298
- export declare const completerInputSchema: z.ZodObject<{
299
- objective: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
300
- executionState: z.ZodType<{
301
- tasks: {
302
- status: "pending" | "completed" | "failed";
303
- task: string;
304
- error?: {
305
- message: string;
306
- } | undefined;
307
- result?: unknown;
308
- createdAt?: number | undefined;
309
- completedAt?: number | undefined;
310
- }[];
311
- } | undefined, z.ZodTypeDef, {
312
- tasks: {
313
- status: "pending" | "completed" | "failed";
314
- task: string;
315
- error?: {
316
- message: string;
317
- } | undefined;
318
- result?: unknown;
319
- createdAt?: number | undefined;
320
- completedAt?: number | undefined;
321
- }[];
322
- } | undefined>;
323
- }, "strip", z.ZodTypeAny, {
324
- objective?: string | undefined;
325
- executionState?: {
326
- tasks: {
327
- status: "pending" | "completed" | "failed";
328
- task: string;
329
- error?: {
330
- message: string;
331
- } | undefined;
332
- result?: unknown;
333
- createdAt?: number | undefined;
334
- completedAt?: number | undefined;
335
- }[];
336
- } | undefined;
337
- }, {
338
- objective?: string | undefined;
339
- executionState?: {
340
- tasks: {
341
- status: "pending" | "completed" | "failed";
342
- task: string;
343
- error?: {
344
- message: string;
345
- } | undefined;
346
- result?: unknown;
347
- createdAt?: number | undefined;
348
- completedAt?: number | undefined;
349
- }[];
350
- } | undefined;
351
- }>;
352
- /**
353
- * Default maximum number of task execution iterations
354
- */
355
- export declare const DEFAULT_MAX_ITERATIONS = 20;
356
- /**
357
- * Options for managing execution state to prevent context overflow
358
- */
359
- export interface StateManagementOptions {
360
- /**
361
- * Maximum tokens allowed for execution state
362
- * When exceeded, triggers compression
363
- */
364
- maxTokens?: number;
365
- /**
366
- * Number of recent tasks to keep when compression is triggered
367
- */
368
- keepRecent?: number;
369
- /**
370
- * Maximum number of task execution iterations
371
- * When reached, orchestrator will stop and synthesize final result
372
- * @default 20
373
- */
374
- maxIterations?: number;
375
- }
376
- export declare const stateManagementOptionsSchema: z.ZodObject<{
377
- maxTokens: z.ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
378
- keepRecent: z.ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
379
- maxIterations: z.ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
380
- }, "strip", z.ZodTypeAny, {
381
- maxTokens?: number | undefined;
382
- keepRecent?: number | undefined;
383
- maxIterations?: number | undefined;
384
- }, {
385
- maxTokens?: number | undefined;
386
- keepRecent?: number | undefined;
387
- maxIterations?: number | undefined;
388
- }>;
@@ -1,2 +0,0 @@
1
- export declare function exists(path: string): Promise<boolean>;
2
- export declare function expandHome(filepath: string): string;
@@ -1,6 +0,0 @@
1
- export declare class Mutex {
2
- constructor();
3
- private _lock;
4
- lock(): Promise<() => void>;
5
- runExclusive<T>(callback: () => Promise<T> | T): Promise<T>;
6
- }
@@ -1,10 +0,0 @@
1
- import { type Agent, AIAgent, type AIAgentOptions, type Message } from "@aigne/core";
2
- export interface AgentSkillManagerOptions<I extends Message = Message, O extends Message = Message> extends AIAgentOptions<I, O> {
3
- }
4
- export default class AgentSkillManagerAgent<I extends Message = Message, O extends Message = Message> extends AIAgent<I, O> {
5
- static load<I extends Message = any, O extends Message = any>(options: {
6
- filepath: string;
7
- parsed: object;
8
- }): Promise<Agent<I, O>>;
9
- constructor(options: AgentSkillManagerOptions<I, O>);
10
- }
@@ -1,23 +0,0 @@
1
- import { AIAgent, } from "@aigne/core";
2
- import { AgentSkillManagerSystemPrompt } from "./prompt.js";
3
- export default class AgentSkillManagerAgent extends AIAgent {
4
- static async load(options) {
5
- const schema = AIAgent.schema(options);
6
- const valid = await schema.parseAsync(options.parsed);
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
- },
15
- });
16
- }
17
- constructor(options) {
18
- super({
19
- ...options,
20
- instructions: options.instructions || AgentSkillManagerSystemPrompt,
21
- });
22
- }
23
- }
@@ -1 +0,0 @@
1
- export declare const AgentSkillManagerSystemPrompt = "You are an interactive CLI tool that helps users according to your \"Output Style\" below, which describes how you should respond to user queries. Use the instructions below and the tools available to you to assist the user.\n\nIMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.\n\n# Tone and style\n- Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.\n- Your output will be displayed on a command line interface. Your responses should be short and concise. You can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.\n- Output text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.\n- NEVER create files unless they're absolutely necessary for achieving your goal. ALWAYS prefer editing an existing file to creating a new one. This includes markdown files.\n- Do not use a colon before tool calls. Your tool calls may not be shown directly in the output, so text like \"Let me read the file:\" followed by a read tool call should just be \"Let me read the file.\" with a period.\n\n{% if $afs.enabled %}\n# AFS Context\n\n{{ $afs.description }}\n\n```yaml alt=\"AFS Modules\"\n{{ $afs.modules | yaml.stringify }}\n```\n{% endif %}\n\n# Asking questions as you work\n\nYou have access to the askUserQuestion tool to ask the user questions when you need clarification, want to validate assumptions, or need to make a decision you're unsure about. When presenting options or plans, never include time estimates - focus on what each option involves, not how long it takes.\n\n# Skill usage\n\nWhen the user requests you to perform tasks, check if any of the available skills can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.\n\n## Loading skill resources on demand\n\nSkills may include reference documents (guides, schemas, examples) in a `references/` directory. To optimize performance and context usage:\n\n1. **Start with the main skill file** (e.g., `SKILL.md`) - it contains the workflow overview and references to detailed guides\n2. **Load reference documents only when needed** - read specific guides only when you reach the step that requires them\n3. **Don't preload all resources** - avoid reading all reference files at the start of a task\n\n# Doing tasks\nThe user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:\n- NEVER propose changes to code you haven't read. If a user asks about or wants you to modify a file, read it first. Understand existing code before suggesting modifications.\n- Use the askUserQuestion tool to ask questions, clarify and gather information as needed.\n- Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it.\n- Avoid over-engineering. Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused.\n - Don't add features, refactor code, or make \"improvements\" beyond what was asked. A bug fix doesn't need surrounding code cleaned up. A simple feature doesn't need extra configurability. Don't add docstrings, comments, or type annotations to code you didn't change. Only add comments where the logic isn't self-evident.\n - Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use feature flags or backwards-compatibility shims when you can just change the code.\n - Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is the minimum needed for the current task\u2014three similar lines of code is better than a premature abstraction.\n- Avoid backwards-compatibility hacks like renaming unused `_vars`, re-exporting types, adding `// removed` comments for removed code, etc. If something is unused, delete it completely.\n\nIMPORTANT: Complete tasks fully. Do not stop mid-task or leave work incomplete. Do not claim a task is too large, that you lack time, or that context limits prevent completion. You have unlimited context through summarization. Continue working until the task is done or the user stops you.\n";
@@ -1,28 +0,0 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessResult, type Message } from "@aigne/core";
2
- import { z } from "zod";
3
- export interface AskUserQuestionAgentOption {
4
- label: string;
5
- description?: string;
6
- }
7
- export interface AskUserQuestionAgentInput extends Message {
8
- questions: {
9
- header: string;
10
- question: string;
11
- options?: AskUserQuestionAgentOption[];
12
- multipleSelect?: boolean;
13
- }[];
14
- allowCustomAnswer?: boolean;
15
- }
16
- export interface AskUserQuestionAgentOutput extends Message {
17
- answers: Record<string, string>;
18
- }
19
- export default class AskUserQuestionAgent extends Agent<AskUserQuestionAgentInput, AskUserQuestionAgentOutput> {
20
- tag: string;
21
- static schema(): z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
22
- static load<I extends Message = any, O extends Message = any>(options: {
23
- filepath: string;
24
- parsed: object;
25
- }): Promise<Agent<I, O>>;
26
- constructor(options?: AgentOptions<AskUserQuestionAgentInput, AskUserQuestionAgentOutput>);
27
- process(input: AskUserQuestionAgentInput, options: AgentInvokeOptions): Promise<AgentProcessResult<AskUserQuestionAgentOutput>>;
28
- }
@@ -1,105 +0,0 @@
1
- import { Agent, } from "@aigne/core";
2
- import { optionalize } from "@aigne/core/loader/schema.js";
3
- import { z } from "zod";
4
- const askUserQuestionAgentOptionSchema = z.object({
5
- label: z.string().describe("The display text for this option (1-5 words)"),
6
- description: optionalize(z.string()).describe("Explanation of what this option means"),
7
- });
8
- const askUserQuestionAgentInputSchema = z.object({
9
- questions: z
10
- .array(z.object({
11
- header: z
12
- .string()
13
- .describe("Very short label (max 12 chars) used as key in answers. Examples: 'Auth method', 'Library', 'Approach'"),
14
- question: z.string().describe("The question to ask the user"),
15
- options: optionalize(z.array(askUserQuestionAgentOptionSchema)).describe("List of options to present to the user"),
16
- multipleSelect: optionalize(z.boolean()).describe("Whether to allow multiple selections"),
17
- }))
18
- .describe("List of questions to ask the user"),
19
- allowCustomAnswer: optionalize(z.boolean()).describe("Whether to allow the user to provide custom answers"),
20
- });
21
- export default class AskUserQuestionAgent extends Agent {
22
- tag = "AskUserQuestion";
23
- static schema() {
24
- return z.object({});
25
- }
26
- static async load(options) {
27
- return new AskUserQuestionAgent({
28
- name: defaultName,
29
- description: defaultDescription,
30
- ...options.parsed,
31
- inputSchema: askUserQuestionAgentInputSchema,
32
- });
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
- }
42
- async process(input, options) {
43
- const { prompts } = options;
44
- if (!prompts)
45
- throw new Error("Prompts is not available in AskUserQuestionAgent");
46
- const { questions, allowCustomAnswer } = input;
47
- const answers = {};
48
- for (const q of questions) {
49
- let answer;
50
- if (q.options?.length) {
51
- const choices = q.options.map((opt) => ({
52
- value: opt.label,
53
- name: opt.label,
54
- description: opt.description ?? opt.label,
55
- }));
56
- if (allowCustomAnswer) {
57
- choices.push({
58
- name: "None of the above / Enter my own response",
59
- value: "OTHER_OPTION",
60
- });
61
- }
62
- if (!q.multipleSelect) {
63
- answer = await prompts.select({
64
- message: q.question,
65
- choices,
66
- });
67
- }
68
- else {
69
- answer = await prompts.checkbox({
70
- message: q.question,
71
- choices,
72
- });
73
- }
74
- if (answer === "OTHER_OPTION" ||
75
- (Array.isArray(answer) && answer.includes("OTHER_OPTION"))) {
76
- answer = await prompts.input({
77
- message: `Please provide your response for: ${q.question}`,
78
- });
79
- }
80
- }
81
- else {
82
- answer = await prompts.input({
83
- message: q.question,
84
- });
85
- }
86
- answers[q.header] = Array.isArray(answer) ? answer.join(", ") : answer;
87
- }
88
- return {
89
- answers,
90
- };
91
- }
92
- }
93
- const defaultName = "askUserQuestion";
94
- const defaultDescription = `\
95
- Use this tool when you need to ask the user questions during execution. This allows you to:
96
- 1. Gather user preferences or requirements
97
- 2. Clarify ambiguous instructions
98
- 3. Get decisions on implementation choices as you work
99
- 4. Offer choices to the user about what direction to take.
100
-
101
- Usage notes:
102
- - Users will always be able to select "Other" to provide custom text input
103
- - Use multiSelect: true to allow multiple answers to be selected for a question
104
- - If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label
105
- `;